path
stringlengths
14
112
content
stringlengths
0
6.32M
size
int64
0
6.32M
max_lines
int64
1
100k
repo_name
stringclasses
2 values
autogenerated
bool
1 class
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_debugger_r.py
"Test debugger_r, coverage 30%." from idlelib import debugger_r import unittest from test.support import requires from tkinter import Tk class Test(unittest.TestCase): ## @classmethod ## def setUpClass(cls): ## requires('gui') ## cls.root = Tk() ## ## @classmethod ## def tearDownClass(cls): ## cls.root.destroy() ## del cls.root def test_init(self): self.assertTrue(True) # Get coverage of import # Classes GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy, # GUIAdapter, IdbProxy plus 7 module functions. if __name__ == '__main__': unittest.main(verbosity=2)
631
30
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_help_about.py
"""Test help_about, coverage 100%. help_about.build_bits branches on sys.platform='darwin'. '100% combines coverage on Mac and others. """ from idlelib import help_about import unittest from test.support import requires, findfile from tkinter import Tk, TclError from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Mbox_func from idlelib import textview import os.path from platform import python_version About = help_about.AboutDialog class LiveDialogTest(unittest.TestCase): """Simulate user clicking buttons other than [Close]. Test that invoked textview has text from source. """ @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.dialog = About(cls.root, 'About IDLE', _utest=True) @classmethod def tearDownClass(cls): del cls.dialog cls.root.update_idletasks() cls.root.destroy() del cls.root def test_build_bits(self): self.assertIn(help_about.build_bits(), ('32', '64')) def test_dialog_title(self): """Test about dialog title""" self.assertEqual(self.dialog.title(), 'About IDLE') def test_dialog_logo(self): """Test about dialog logo.""" path, file = os.path.split(self.dialog.icon_image['file']) fn, ext = os.path.splitext(file) self.assertEqual(fn, 'idle_48') def test_printer_buttons(self): """Test buttons whose commands use printer function.""" dialog = self.dialog button_sources = [(dialog.py_license, license, 'license'), (dialog.py_copyright, copyright, 'copyright'), (dialog.py_credits, credits, 'credits')] for button, printer, name in button_sources: with self.subTest(name=name): printer._Printer__setup() button.invoke() get = dialog._current_textview.viewframe.textframe.text.get lines = printer._Printer__lines self.assertEqual(lines[0], get('1.0', '1.end')) self.assertEqual(lines[1], get('2.0', '2.end')) dialog._current_textview.destroy() def test_file_buttons(self): """Test buttons that display files.""" dialog = self.dialog button_sources = [(self.dialog.readme, 'README.txt', 'readme'), (self.dialog.idle_news, 'NEWS.txt', 'news'), (self.dialog.idle_credits, 'CREDITS.txt', 'credits')] for button, filename, name in button_sources: with self.subTest(name=name): button.invoke() fn = findfile(filename, subdir='idlelib') get = dialog._current_textview.viewframe.textframe.text.get with open(fn, encoding='utf-8') as f: self.assertEqual(f.readline().strip(), get('1.0', '1.end')) f.readline() self.assertEqual(f.readline().strip(), get('3.0', '3.end')) dialog._current_textview.destroy() class DefaultTitleTest(unittest.TestCase): "Test default title." @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.dialog = About(cls.root, _utest=True) @classmethod def tearDownClass(cls): del cls.dialog cls.root.update_idletasks() cls.root.destroy() del cls.root def test_dialog_title(self): """Test about dialog title""" self.assertEqual(self.dialog.title(), f'About IDLE {python_version()}' f' ({help_about.build_bits()} bit)') class CloseTest(unittest.TestCase): """Simulate user clicking [Close] button""" @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.dialog = About(cls.root, 'About IDLE', _utest=True) @classmethod def tearDownClass(cls): del cls.dialog cls.root.update_idletasks() cls.root.destroy() del cls.root def test_close(self): self.assertEqual(self.dialog.winfo_class(), 'Toplevel') self.dialog.button_ok.invoke() with self.assertRaises(TclError): self.dialog.winfo_class() class Dummy_about_dialog(): # Dummy class for testing file display functions. idle_credits = About.show_idle_credits idle_readme = About.show_readme idle_news = About.show_idle_news # Called by the above display_file_text = About.display_file_text _utest = True class DisplayFileTest(unittest.TestCase): """Test functions that display files. While somewhat redundant with gui-based test_file_dialog, these unit tests run on all buildbots, not just a few. """ dialog = Dummy_about_dialog() @classmethod def setUpClass(cls): cls.orig_error = textview.showerror cls.orig_view = textview.view_text cls.error = Mbox_func() cls.view = Func() textview.showerror = cls.error textview.view_text = cls.view @classmethod def tearDownClass(cls): textview.showerror = cls.orig_error textview.view_text = cls.orig_view def test_file_display(self): for handler in (self.dialog.idle_credits, self.dialog.idle_readme, self.dialog.idle_news): self.error.message = '' self.view.called = False with self.subTest(handler=handler): handler() self.assertEqual(self.error.message, '') self.assertEqual(self.view.called, True) if __name__ == '__main__': unittest.main(verbosity=2)
5,821
181
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_config_key.py
"Test config_key, coverage 75%" from idlelib import config_key from test.support import requires import unittest from tkinter import Tk from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Mbox_func class ValidationTest(unittest.TestCase): "Test validation methods: OK, KeysOK, bind_ok." class Validator(config_key.GetKeysDialog): def __init__(self, *args, **kwargs): config_key.GetKeysDialog.__init__(self, *args, **kwargs) class listKeysFinal: get = Func() self.listKeysFinal = listKeysFinal GetModifiers = Func() showerror = Mbox_func() @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() keylist = [['<Key-F12>'], ['<Control-Key-x>', '<Control-Key-X>']] cls.dialog = cls.Validator( cls.root, 'Title', '<<Test>>', keylist, _utest=True) @classmethod def tearDownClass(cls): cls.dialog.Cancel() cls.root.update_idletasks() cls.root.destroy() del cls.dialog, cls.root def setUp(self): self.dialog.showerror.message = '' # A test that needs a particular final key value should set it. # A test that sets a non-blank modifier list should reset it to []. def test_ok_empty(self): self.dialog.keyString.set(' ') self.dialog.OK() self.assertEqual(self.dialog.result, '') self.assertEqual(self.dialog.showerror.message, 'No key specified.') def test_ok_good(self): self.dialog.keyString.set('<Key-F11>') self.dialog.listKeysFinal.get.result = 'F11' self.dialog.OK() self.assertEqual(self.dialog.result, '<Key-F11>') self.assertEqual(self.dialog.showerror.message, '') def test_keys_no_ending(self): self.assertFalse(self.dialog.KeysOK('<Control-Shift')) self.assertIn('Missing the final', self.dialog.showerror.message) def test_keys_no_modifier_bad(self): self.dialog.listKeysFinal.get.result = 'A' self.assertFalse(self.dialog.KeysOK('<Key-A>')) self.assertIn('No modifier', self.dialog.showerror.message) def test_keys_no_modifier_ok(self): self.dialog.listKeysFinal.get.result = 'F11' self.assertTrue(self.dialog.KeysOK('<Key-F11>')) self.assertEqual(self.dialog.showerror.message, '') def test_keys_shift_bad(self): self.dialog.listKeysFinal.get.result = 'a' self.dialog.GetModifiers.result = ['Shift'] self.assertFalse(self.dialog.KeysOK('<a>')) self.assertIn('shift modifier', self.dialog.showerror.message) self.dialog.GetModifiers.result = [] def test_keys_dup(self): for mods, final, seq in (([], 'F12', '<Key-F12>'), (['Control'], 'x', '<Control-Key-x>'), (['Control'], 'X', '<Control-Key-X>')): with self.subTest(m=mods, f=final, s=seq): self.dialog.listKeysFinal.get.result = final self.dialog.GetModifiers.result = mods self.assertFalse(self.dialog.KeysOK(seq)) self.assertIn('already in use', self.dialog.showerror.message) self.dialog.GetModifiers.result = [] def test_bind_ok(self): self.assertTrue(self.dialog.bind_ok('<Control-Shift-Key-a>')) self.assertEqual(self.dialog.showerror.message, '') def test_bind_not_ok(self): self.assertFalse(self.dialog.bind_ok('<Control-Shift>')) self.assertIn('not accepted', self.dialog.showerror.message) if __name__ == '__main__': unittest.main(verbosity=2)
3,700
100
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_calltip.py
"Test calltip, coverage 60%" from idlelib import calltip import unittest import textwrap import types default_tip = calltip._default_callable_argspec # Test Class TC is used in multiple get_argspec test methods class TC(): 'doc' tip = "(ai=None, *b)" def __init__(self, ai=None, *b): 'doc' __init__.tip = "(self, ai=None, *b)" def t1(self): 'doc' t1.tip = "(self)" def t2(self, ai, b=None): 'doc' t2.tip = "(self, ai, b=None)" def t3(self, ai, *args): 'doc' t3.tip = "(self, ai, *args)" def t4(self, *args): 'doc' t4.tip = "(self, *args)" def t5(self, ai, b=None, *args, **kw): 'doc' t5.tip = "(self, ai, b=None, *args, **kw)" def t6(no, self): 'doc' t6.tip = "(no, self)" def __call__(self, ci): 'doc' __call__.tip = "(self, ci)" # attaching .tip to wrapped methods does not work @classmethod def cm(cls, a): 'doc' @staticmethod def sm(b): 'doc' tc = TC() signature = calltip.get_argspec # 2.7 and 3.x use different functions class Get_signatureTest(unittest.TestCase): # The signature function must return a string, even if blank. # Test a variety of objects to be sure that none cause it to raise # (quite aside from getting as correct an answer as possible). # The tests of builtins may break if inspect or the docstrings change, # but a red buildbot is better than a user crash (as has happened). # For a simple mismatch, change the expected output to the actual. def test_builtins(self): # Python class that inherits builtin methods class List(list): "List() doc" # Simulate builtin with no docstring for default tip test class SB: __call__ = None def gtest(obj, out): self.assertEqual(signature(obj), out) if List.__doc__ is not None: gtest(List, List.__doc__) # This and append_doc changed in 3.7. gtest(list.__new__, '(*args, **kwargs)\n' 'Create and return a new object.' ' See help(type) for accurate signature.') gtest(list.__init__, '(self, /, *args, **kwargs)' + calltip._argument_positional + '\n' + 'Initialize self. See help(type(self)) for accurate signature.') append_doc = "L.append(object) -> None -- append object to end" gtest(list.append, append_doc) gtest([].append, append_doc) gtest(List.append, append_doc) gtest(types.MethodType, "method(function, instance)") gtest(SB(), default_tip) import re p = re.compile('') gtest(re.sub, '''\ (pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable, it's passed the match object and must return''') gtest(p.sub, '''\ (repl, string, count=0) Return the string obtained by replacing the leftmost \ non-overlapping occurrences o...''') def test_signature_wrap(self): if textwrap.TextWrapper.__doc__ is not None: self.assertEqual(signature(textwrap.TextWrapper), '''\ (width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, placeholder=' [...]')''') def test_docline_truncation(self): def f(): pass f.__doc__ = 'a'*300 self.assertEqual(signature(f), '()\n' + 'a' * (calltip._MAX_COLS-3) + '...') def test_multiline_docstring(self): # Test fewer lines than max. self.assertEqual(signature(range), "range(stop) -> range object\n" "range(start, stop[, step]) -> range object") # Test max lines self.assertEqual(signature(bytes), '''\ bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object''') # Test more than max lines def f(): pass f.__doc__ = 'a\n' * 15 self.assertEqual(signature(f), '()' + '\na' * calltip._MAX_LINES) def test_functions(self): def t1(): 'doc' t1.tip = "()" def t2(a, b=None): 'doc' t2.tip = "(a, b=None)" def t3(a, *args): 'doc' t3.tip = "(a, *args)" def t4(*args): 'doc' t4.tip = "(*args)" def t5(a, b=None, *args, **kw): 'doc' t5.tip = "(a, b=None, *args, **kw)" doc = '\ndoc' if t1.__doc__ is not None else '' for func in (t1, t2, t3, t4, t5, TC): self.assertEqual(signature(func), func.tip + doc) def test_methods(self): doc = '\ndoc' if TC.__doc__ is not None else '' for meth in (TC.t1, TC.t2, TC.t3, TC.t4, TC.t5, TC.t6, TC.__call__): self.assertEqual(signature(meth), meth.tip + doc) self.assertEqual(signature(TC.cm), "(a)" + doc) self.assertEqual(signature(TC.sm), "(b)" + doc) def test_bound_methods(self): # test that first parameter is correctly removed from argspec doc = '\ndoc' if TC.__doc__ is not None else '' for meth, mtip in ((tc.t1, "()"), (tc.t4, "(*args)"), (tc.t6, "(self)"), (tc.__call__, '(ci)'), (tc, '(ci)'), (TC.cm, "(a)"),): self.assertEqual(signature(meth), mtip + doc) def test_starred_parameter(self): # test that starred first parameter is *not* removed from argspec class C: def m1(*args): pass c = C() for meth, mtip in ((C.m1, '(*args)'), (c.m1, "(*args)"),): self.assertEqual(signature(meth), mtip) def test_invalid_method_signature(self): class C: def m2(**kwargs): pass class Test: def __call__(*, a): pass mtip = calltip._invalid_method self.assertEqual(signature(C().m2), mtip) self.assertEqual(signature(Test()), mtip) def test_non_ascii_name(self): # test that re works to delete a first parameter name that # includes non-ascii chars, such as various forms of A. uni = "(A\u0391\u0410\u05d0\u0627\u0905\u1e00\u3042, a)" assert calltip._first_param.sub('', uni) == '(a)' def test_no_docstring(self): def nd(s): pass TC.nd = nd self.assertEqual(signature(nd), "(s)") self.assertEqual(signature(TC.nd), "(s)") self.assertEqual(signature(tc.nd), "()") def test_attribute_exception(self): class NoCall: def __getattr__(self, name): raise BaseException class CallA(NoCall): def __call__(oui, a, b, c): pass class CallB(NoCall): def __call__(self, ci): pass for meth, mtip in ((NoCall, default_tip), (CallA, default_tip), (NoCall(), ''), (CallA(), '(a, b, c)'), (CallB(), '(ci)')): self.assertEqual(signature(meth), mtip) def test_non_callables(self): for obj in (0, 0.0, '0', b'0', [], {}): self.assertEqual(signature(obj), '') class Get_entityTest(unittest.TestCase): def test_bad_entity(self): self.assertIsNone(calltip.get_entity('1/0')) def test_good_entity(self): self.assertIs(calltip.get_entity('int'), int) if __name__ == '__main__': unittest.main(verbosity=2)
7,785
217
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_tooltip.py
from idlelib.tooltip import TooltipBase, Hovertip from test.support import requires requires('gui') from functools import wraps import time from tkinter import Button, Tk, Toplevel import unittest def setUpModule(): global root root = Tk() def root_update(): global root root.update() def tearDownModule(): global root root.update_idletasks() root.destroy() del root def add_call_counting(func): @wraps(func) def wrapped_func(*args, **kwargs): wrapped_func.call_args_list.append((args, kwargs)) return func(*args, **kwargs) wrapped_func.call_args_list = [] return wrapped_func def _make_top_and_button(testobj): global root top = Toplevel(root) testobj.addCleanup(top.destroy) top.title("Test tooltip") button = Button(top, text='ToolTip test button') button.pack() testobj.addCleanup(button.destroy) top.lift() return top, button class ToolTipBaseTest(unittest.TestCase): def setUp(self): self.top, self.button = _make_top_and_button(self) def test_base_class_is_unusable(self): global root top = Toplevel(root) self.addCleanup(top.destroy) button = Button(top, text='ToolTip test button') button.pack() self.addCleanup(button.destroy) with self.assertRaises(NotImplementedError): tooltip = TooltipBase(button) tooltip.showtip() class HovertipTest(unittest.TestCase): def setUp(self): self.top, self.button = _make_top_and_button(self) def test_showtip(self): tooltip = Hovertip(self.button, 'ToolTip text') self.addCleanup(tooltip.hidetip) self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) tooltip.showtip() self.assertTrue(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) def test_showtip_twice(self): tooltip = Hovertip(self.button, 'ToolTip text') self.addCleanup(tooltip.hidetip) self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) tooltip.showtip() self.assertTrue(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) orig_tipwindow = tooltip.tipwindow tooltip.showtip() self.assertTrue(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.assertIs(tooltip.tipwindow, orig_tipwindow) def test_hidetip(self): tooltip = Hovertip(self.button, 'ToolTip text') self.addCleanup(tooltip.hidetip) tooltip.showtip() tooltip.hidetip() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) def test_showtip_on_mouse_enter_no_delay(self): tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=None) self.addCleanup(tooltip.hidetip) tooltip.showtip = add_call_counting(tooltip.showtip) root_update() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.button.event_generate('<Enter>', x=0, y=0) root_update() self.assertTrue(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.assertGreater(len(tooltip.showtip.call_args_list), 0) def test_showtip_on_mouse_enter_hover_delay(self): tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=50) self.addCleanup(tooltip.hidetip) tooltip.showtip = add_call_counting(tooltip.showtip) root_update() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.button.event_generate('<Enter>', x=0, y=0) root_update() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) time.sleep(0.1) root_update() self.assertTrue(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.assertGreater(len(tooltip.showtip.call_args_list), 0) def test_hidetip_on_mouse_leave(self): tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=None) self.addCleanup(tooltip.hidetip) tooltip.showtip = add_call_counting(tooltip.showtip) root_update() self.button.event_generate('<Enter>', x=0, y=0) root_update() self.button.event_generate('<Leave>', x=0, y=0) root_update() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.assertGreater(len(tooltip.showtip.call_args_list), 0) def test_dont_show_on_mouse_leave_before_delay(self): tooltip = Hovertip(self.button, 'ToolTip text', hover_delay=50) self.addCleanup(tooltip.hidetip) tooltip.showtip = add_call_counting(tooltip.showtip) root_update() self.button.event_generate('<Enter>', x=0, y=0) root_update() self.button.event_generate('<Leave>', x=0, y=0) root_update() time.sleep(0.1) root_update() self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable()) self.assertEqual(tooltip.showtip.call_args_list, []) if __name__ == '__main__': unittest.main(verbosity=2)
5,130
147
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_editmenu.py
'''Test (selected) IDLE Edit menu items. Edit modules have their own test files ''' from test.support import requires requires('gui') import tkinter as tk from tkinter import ttk import unittest from idlelib import pyshell class PasteTest(unittest.TestCase): '''Test pasting into widgets that allow pasting. On X11, replacing selections requires tk fix. ''' @classmethod def setUpClass(cls): cls.root = root = tk.Tk() cls.root.withdraw() pyshell.fix_x11_paste(root) cls.text = tk.Text(root) cls.entry = tk.Entry(root) cls.tentry = ttk.Entry(root) cls.spin = tk.Spinbox(root) root.clipboard_clear() root.clipboard_append('two') @classmethod def tearDownClass(cls): del cls.text, cls.entry, cls.tentry cls.root.clipboard_clear() cls.root.update_idletasks() cls.root.destroy() del cls.root def test_paste_text(self): "Test pasting into text with and without a selection." text = self.text for tag, ans in ('', 'onetwo\n'), ('sel', 'two\n'): with self.subTest(tag=tag, ans=ans): text.delete('1.0', 'end') text.insert('1.0', 'one', tag) text.event_generate('<<Paste>>') self.assertEqual(text.get('1.0', 'end'), ans) def test_paste_entry(self): "Test pasting into an entry with and without a selection." # Generated <<Paste>> fails for tk entry without empty select # range for 'no selection'. Live widget works fine. for entry in self.entry, self.tentry: for end, ans in (0, 'onetwo'), ('end', 'two'): with self.subTest(entry=entry, end=end, ans=ans): entry.delete(0, 'end') entry.insert(0, 'one') entry.select_range(0, end) entry.event_generate('<<Paste>>') self.assertEqual(entry.get(), ans) def test_paste_spin(self): "Test pasting into a spinbox with and without a selection." # See note above for entry. spin = self.spin for end, ans in (0, 'onetwo'), ('end', 'two'): with self.subTest(end=end, ans=ans): spin.delete(0, 'end') spin.insert(0, 'one') spin.selection('range', 0, end) # see note spin.event_generate('<<Paste>>') self.assertEqual(spin.get(), ans) if __name__ == '__main__': unittest.main(verbosity=2)
2,564
75
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_autoexpand.py
"Test autoexpand, coverage 100%." from idlelib.autoexpand import AutoExpand import unittest from test.support import requires from tkinter import Text, Tk class Dummy_Editwin: # AutoExpand.__init__ only needs .text def __init__(self, text): self.text = text class AutoExpandTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.tk = Tk() cls.text = Text(cls.tk) cls.auto_expand = AutoExpand(Dummy_Editwin(cls.text)) cls.auto_expand.bell = lambda: None # If mock_tk.Text._decode understood indexes 'insert' with suffixed 'linestart', # 'wordstart', and 'lineend', used by autoexpand, we could use the following # to run these test on non-gui machines (but check bell). ## try: ## requires('gui') ## #raise ResourceDenied() # Uncomment to test mock. ## except ResourceDenied: ## from idlelib.idle_test.mock_tk import Text ## cls.text = Text() ## cls.text.bell = lambda: None ## else: ## from tkinter import Tk, Text ## cls.tk = Tk() ## cls.text = Text(cls.tk) @classmethod def tearDownClass(cls): del cls.text, cls.auto_expand if hasattr(cls, 'tk'): cls.tk.destroy() del cls.tk def tearDown(self): self.text.delete('1.0', 'end') def test_get_prevword(self): text = self.text previous = self.auto_expand.getprevword equal = self.assertEqual equal(previous(), '') text.insert('insert', 't') equal(previous(), 't') text.insert('insert', 'his') equal(previous(), 'this') text.insert('insert', ' ') equal(previous(), '') text.insert('insert', 'is') equal(previous(), 'is') text.insert('insert', '\nsample\nstring') equal(previous(), 'string') text.delete('3.0', 'insert') equal(previous(), '') text.delete('1.0', 'end') equal(previous(), '') def test_before_only(self): previous = self.auto_expand.getprevword expand = self.auto_expand.expand_word_event equal = self.assertEqual self.text.insert('insert', 'ab ac bx ad ab a') equal(self.auto_expand.getwords(), ['ab', 'ad', 'ac', 'a']) expand('event') equal(previous(), 'ab') expand('event') equal(previous(), 'ad') expand('event') equal(previous(), 'ac') expand('event') equal(previous(), 'a') def test_after_only(self): # Also add punctuation 'noise' that should be ignored. text = self.text previous = self.auto_expand.getprevword expand = self.auto_expand.expand_word_event equal = self.assertEqual text.insert('insert', 'a, [ab] ac: () bx"" cd ac= ad ya') text.mark_set('insert', '1.1') equal(self.auto_expand.getwords(), ['ab', 'ac', 'ad', 'a']) expand('event') equal(previous(), 'ab') expand('event') equal(previous(), 'ac') expand('event') equal(previous(), 'ad') expand('event') equal(previous(), 'a') def test_both_before_after(self): text = self.text previous = self.auto_expand.getprevword expand = self.auto_expand.expand_word_event equal = self.assertEqual text.insert('insert', 'ab xy yz\n') text.insert('insert', 'a ac by ac') text.mark_set('insert', '2.1') equal(self.auto_expand.getwords(), ['ab', 'ac', 'a']) expand('event') equal(previous(), 'ab') expand('event') equal(previous(), 'ac') expand('event') equal(previous(), 'a') def test_other_expand_cases(self): text = self.text expand = self.auto_expand.expand_word_event equal = self.assertEqual # no expansion candidate found equal(self.auto_expand.getwords(), []) equal(expand('event'), 'break') text.insert('insert', 'bx cy dz a') equal(self.auto_expand.getwords(), []) # reset state by successfully expanding once # move cursor to another position and expand again text.insert('insert', 'ac xy a ac ad a') text.mark_set('insert', '1.7') expand('event') initial_state = self.auto_expand.state text.mark_set('insert', '1.end') expand('event') new_state = self.auto_expand.state self.assertNotEqual(initial_state, new_state) if __name__ == '__main__': unittest.main(verbosity=2)
4,640
156
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_window.py
"Test window, coverage 47%." from idlelib import window import unittest from test.support import requires from tkinter import Tk class WindowListTest(unittest.TestCase): def test_init(self): wl = window.WindowList() self.assertEqual(wl.dict, {}) self.assertEqual(wl.callbacks, []) # Further tests need mock Window. class ListedToplevelTest(unittest.TestCase): @classmethod def setUpClass(cls): window.registry = set() requires('gui') cls.root = Tk() cls.root.withdraw() @classmethod def tearDownClass(cls): window.registry = window.WindowList() cls.root.update_idletasks() ## for id in cls.root.tk.call('after', 'info'): ## cls.root.after_cancel(id) # Need for EditorWindow. cls.root.destroy() del cls.root def test_init(self): win = window.ListedToplevel(self.root) self.assertIn(win, window.registry) self.assertEqual(win.focused_widget, win) if __name__ == '__main__': unittest.main(verbosity=2)
1,075
46
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_configdialog.py
"""Test configdialog, coverage 94%. Half the class creates dialog, half works with user customizations. """ from idlelib import configdialog from test.support import requires requires('gui') import unittest from unittest import mock from idlelib.idle_test.mock_idle import Func from tkinter import Tk, StringVar, IntVar, BooleanVar, DISABLED, NORMAL from idlelib import config from idlelib.configdialog import idleConf, changes, tracers # Tests should not depend on fortuitous user configurations. # They must not affect actual user .cfg files. # Use solution from test_config: empty parsers with no filename. usercfg = idleConf.userCfg testcfg = { 'main': config.IdleUserConfParser(''), 'highlight': config.IdleUserConfParser(''), 'keys': config.IdleUserConfParser(''), 'extensions': config.IdleUserConfParser(''), } root = None dialog = None mainpage = changes['main'] highpage = changes['highlight'] keyspage = changes['keys'] extpage = changes['extensions'] def setUpModule(): global root, dialog idleConf.userCfg = testcfg root = Tk() # root.withdraw() # Comment out, see issue 30870 dialog = configdialog.ConfigDialog(root, 'Test', _utest=True) def tearDownModule(): global root, dialog idleConf.userCfg = usercfg tracers.detach() tracers.clear() changes.clear() root.update_idletasks() root.destroy() root = dialog = None class FontPageTest(unittest.TestCase): """Test that font widgets enable users to make font changes. Test that widget actions set vars, that var changes add three options to changes and call set_samples, and that set_samples changes the font of both sample boxes. """ @classmethod def setUpClass(cls): page = cls.page = dialog.fontpage dialog.note.select(page) page.set_samples = Func() # Mask instance method. page.update() @classmethod def tearDownClass(cls): del cls.page.set_samples # Unmask instance method. def setUp(self): changes.clear() def test_load_font_cfg(self): # Leave widget load test to human visual check. # TODO Improve checks when add IdleConf.get_font_values. tracers.detach() d = self.page d.font_name.set('Fake') d.font_size.set('1') d.font_bold.set(True) d.set_samples.called = 0 d.load_font_cfg() self.assertNotEqual(d.font_name.get(), 'Fake') self.assertNotEqual(d.font_size.get(), '1') self.assertFalse(d.font_bold.get()) self.assertEqual(d.set_samples.called, 1) tracers.attach() def test_fontlist_key(self): # Up and Down keys should select a new font. d = self.page if d.fontlist.size() < 2: self.skipTest('need at least 2 fonts') fontlist = d.fontlist fontlist.activate(0) font = d.fontlist.get('active') # Test Down key. fontlist.focus_force() fontlist.update() fontlist.event_generate('<Key-Down>') fontlist.event_generate('<KeyRelease-Down>') down_font = fontlist.get('active') self.assertNotEqual(down_font, font) self.assertIn(d.font_name.get(), down_font.lower()) # Test Up key. fontlist.focus_force() fontlist.update() fontlist.event_generate('<Key-Up>') fontlist.event_generate('<KeyRelease-Up>') up_font = fontlist.get('active') self.assertEqual(up_font, font) self.assertIn(d.font_name.get(), up_font.lower()) def test_fontlist_mouse(self): # Click on item should select that item. d = self.page if d.fontlist.size() < 2: self.skipTest('need at least 2 fonts') fontlist = d.fontlist fontlist.activate(0) # Select next item in listbox fontlist.focus_force() fontlist.see(1) fontlist.update() x, y, dx, dy = fontlist.bbox(1) x += dx // 2 y += dy // 2 fontlist.event_generate('<Button-1>', x=x, y=y) fontlist.event_generate('<ButtonRelease-1>', x=x, y=y) font1 = fontlist.get(1) select_font = fontlist.get('anchor') self.assertEqual(select_font, font1) self.assertIn(d.font_name.get(), font1.lower()) def test_sizelist(self): # Click on number should select that number d = self.page d.sizelist.variable.set(40) self.assertEqual(d.font_size.get(), '40') def test_bold_toggle(self): # Click on checkbutton should invert it. d = self.page d.font_bold.set(False) d.bold_toggle.invoke() self.assertTrue(d.font_bold.get()) d.bold_toggle.invoke() self.assertFalse(d.font_bold.get()) def test_font_set(self): # Test that setting a font Variable results in 3 provisional # change entries and a call to set_samples. Use values sure to # not be defaults. default_font = idleConf.GetFont(root, 'main', 'EditorWindow') default_size = str(default_font[1]) default_bold = default_font[2] == 'bold' d = self.page d.font_size.set(default_size) d.font_bold.set(default_bold) d.set_samples.called = 0 d.font_name.set('Test Font') expected = {'EditorWindow': {'font': 'Test Font', 'font-size': default_size, 'font-bold': str(default_bold)}} self.assertEqual(mainpage, expected) self.assertEqual(d.set_samples.called, 1) changes.clear() d.font_size.set('20') expected = {'EditorWindow': {'font': 'Test Font', 'font-size': '20', 'font-bold': str(default_bold)}} self.assertEqual(mainpage, expected) self.assertEqual(d.set_samples.called, 2) changes.clear() d.font_bold.set(not default_bold) expected = {'EditorWindow': {'font': 'Test Font', 'font-size': '20', 'font-bold': str(not default_bold)}} self.assertEqual(mainpage, expected) self.assertEqual(d.set_samples.called, 3) def test_set_samples(self): d = self.page del d.set_samples # Unmask method for test orig_samples = d.font_sample, d.highlight_sample d.font_sample, d.highlight_sample = {}, {} d.font_name.set('test') d.font_size.set('5') d.font_bold.set(1) expected = {'font': ('test', '5', 'bold')} # Test set_samples. d.set_samples() self.assertTrue(d.font_sample == d.highlight_sample == expected) d.font_sample, d.highlight_sample = orig_samples d.set_samples = Func() # Re-mask for other tests. class IndentTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.page = dialog.fontpage cls.page.update() def test_load_tab_cfg(self): d = self.page d.space_num.set(16) d.load_tab_cfg() self.assertEqual(d.space_num.get(), 4) def test_indent_scale(self): d = self.page changes.clear() d.indent_scale.set(20) self.assertEqual(d.space_num.get(), 16) self.assertEqual(mainpage, {'Indent': {'num-spaces': '16'}}) class HighPageTest(unittest.TestCase): """Test that highlight tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that themes work correctly. """ @classmethod def setUpClass(cls): page = cls.page = dialog.highpage dialog.note.select(page) page.set_theme_type = Func() page.paint_theme_sample = Func() page.set_highlight_target = Func() page.set_color_sample = Func() page.update() @classmethod def tearDownClass(cls): d = cls.page del d.set_theme_type, d.paint_theme_sample del d.set_highlight_target, d.set_color_sample def setUp(self): d = self.page # The following is needed for test_load_key_cfg, _delete_custom_keys. # This may indicate a defect in some test or function. for section in idleConf.GetSectionList('user', 'highlight'): idleConf.userCfg['highlight'].remove_section(section) changes.clear() d.set_theme_type.called = 0 d.paint_theme_sample.called = 0 d.set_highlight_target.called = 0 d.set_color_sample.called = 0 def test_load_theme_cfg(self): tracers.detach() d = self.page eq = self.assertEqual # Use builtin theme with no user themes created. idleConf.CurrentTheme = mock.Mock(return_value='IDLE Classic') d.load_theme_cfg() self.assertTrue(d.theme_source.get()) # builtinlist sets variable builtin_name to the CurrentTheme default. eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), '- no custom themes -') eq(d.custom_theme_on.state(), ('disabled',)) eq(d.set_theme_type.called, 1) eq(d.paint_theme_sample.called, 1) eq(d.set_highlight_target.called, 1) # Builtin theme with non-empty user theme list. idleConf.SetOption('highlight', 'test1', 'option', 'value') idleConf.SetOption('highlight', 'test2', 'option2', 'value2') d.load_theme_cfg() eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), 'test1') eq(d.set_theme_type.called, 2) eq(d.paint_theme_sample.called, 2) eq(d.set_highlight_target.called, 2) # Use custom theme. idleConf.CurrentTheme = mock.Mock(return_value='test2') idleConf.SetOption('main', 'Theme', 'default', '0') d.load_theme_cfg() self.assertFalse(d.theme_source.get()) eq(d.builtin_name.get(), 'IDLE Classic') eq(d.custom_name.get(), 'test2') eq(d.set_theme_type.called, 3) eq(d.paint_theme_sample.called, 3) eq(d.set_highlight_target.called, 3) del idleConf.CurrentTheme tracers.attach() def test_theme_source(self): eq = self.assertEqual d = self.page # Test these separately. d.var_changed_builtin_name = Func() d.var_changed_custom_name = Func() # Builtin selected. d.builtin_theme_on.invoke() eq(mainpage, {'Theme': {'default': 'True'}}) eq(d.var_changed_builtin_name.called, 1) eq(d.var_changed_custom_name.called, 0) changes.clear() # Custom selected. d.custom_theme_on.state(('!disabled',)) d.custom_theme_on.invoke() self.assertEqual(mainpage, {'Theme': {'default': 'False'}}) eq(d.var_changed_builtin_name.called, 1) eq(d.var_changed_custom_name.called, 1) del d.var_changed_builtin_name, d.var_changed_custom_name def test_builtin_name(self): eq = self.assertEqual d = self.page item_list = ['IDLE Classic', 'IDLE Dark', 'IDLE New'] # Not in old_themes, defaults name to first item. idleConf.SetOption('main', 'Theme', 'name', 'spam') d.builtinlist.SetMenu(item_list, 'IDLE Dark') eq(mainpage, {'Theme': {'name': 'IDLE Classic', 'name2': 'IDLE Dark'}}) eq(d.theme_message['text'], 'New theme, see Help') eq(d.paint_theme_sample.called, 1) # Not in old themes - uses name2. changes.clear() idleConf.SetOption('main', 'Theme', 'name', 'IDLE New') d.builtinlist.SetMenu(item_list, 'IDLE Dark') eq(mainpage, {'Theme': {'name2': 'IDLE Dark'}}) eq(d.theme_message['text'], 'New theme, see Help') eq(d.paint_theme_sample.called, 2) # Builtin name in old_themes. changes.clear() d.builtinlist.SetMenu(item_list, 'IDLE Classic') eq(mainpage, {'Theme': {'name': 'IDLE Classic', 'name2': ''}}) eq(d.theme_message['text'], '') eq(d.paint_theme_sample.called, 3) def test_custom_name(self): d = self.page # If no selections, doesn't get added. d.customlist.SetMenu([], '- no custom themes -') self.assertNotIn('Theme', mainpage) self.assertEqual(d.paint_theme_sample.called, 0) # Custom name selected. changes.clear() d.customlist.SetMenu(['a', 'b', 'c'], 'c') self.assertEqual(mainpage, {'Theme': {'name': 'c'}}) self.assertEqual(d.paint_theme_sample.called, 1) def test_color(self): d = self.page d.on_new_color_set = Func() # self.color is only set in get_color through ColorChooser. d.color.set('green') self.assertEqual(d.on_new_color_set.called, 1) del d.on_new_color_set def test_highlight_target_list_mouse(self): # Set highlight_target through targetlist. eq = self.assertEqual d = self.page d.targetlist.SetMenu(['a', 'b', 'c'], 'c') eq(d.highlight_target.get(), 'c') eq(d.set_highlight_target.called, 1) def test_highlight_target_text_mouse(self): # Set highlight_target through clicking highlight_sample. eq = self.assertEqual d = self.page elem = {} count = 0 hs = d.highlight_sample hs.focus_force() hs.see(1.0) hs.update_idletasks() def tag_to_element(elem): for element, tag in d.theme_elements.items(): elem[tag[0]] = element def click_it(start): x, y, dx, dy = hs.bbox(start) x += dx // 2 y += dy // 2 hs.event_generate('<Enter>', x=0, y=0) hs.event_generate('<Motion>', x=x, y=y) hs.event_generate('<ButtonPress-1>', x=x, y=y) hs.event_generate('<ButtonRelease-1>', x=x, y=y) # Flip theme_elements to make the tag the key. tag_to_element(elem) # If highlight_sample has a tag that isn't in theme_elements, there # will be a KeyError in the test run. for tag in hs.tag_names(): for start_index in hs.tag_ranges(tag)[0::2]: count += 1 click_it(start_index) eq(d.highlight_target.get(), elem[tag]) eq(d.set_highlight_target.called, count) def test_set_theme_type(self): eq = self.assertEqual d = self.page del d.set_theme_type # Builtin theme selected. d.theme_source.set(True) d.set_theme_type() eq(d.builtinlist['state'], NORMAL) eq(d.customlist['state'], DISABLED) eq(d.button_delete_custom.state(), ('disabled',)) # Custom theme selected. d.theme_source.set(False) d.set_theme_type() eq(d.builtinlist['state'], DISABLED) eq(d.custom_theme_on.state(), ('selected',)) eq(d.customlist['state'], NORMAL) eq(d.button_delete_custom.state(), ()) d.set_theme_type = Func() def test_get_color(self): eq = self.assertEqual d = self.page orig_chooser = configdialog.tkColorChooser.askcolor chooser = configdialog.tkColorChooser.askcolor = Func() gntn = d.get_new_theme_name = Func() d.highlight_target.set('Editor Breakpoint') d.color.set('#ffffff') # Nothing selected. chooser.result = (None, None) d.button_set_color.invoke() eq(d.color.get(), '#ffffff') # Selection same as previous color. chooser.result = ('', d.style.lookup(d.frame_color_set['style'], 'background')) d.button_set_color.invoke() eq(d.color.get(), '#ffffff') # Select different color. chooser.result = ((222.8671875, 0.0, 0.0), '#de0000') # Default theme. d.color.set('#ffffff') d.theme_source.set(True) # No theme name selected therefore color not saved. gntn.result = '' d.button_set_color.invoke() eq(gntn.called, 1) eq(d.color.get(), '#ffffff') # Theme name selected. gntn.result = 'My New Theme' d.button_set_color.invoke() eq(d.custom_name.get(), gntn.result) eq(d.color.get(), '#de0000') # Custom theme. d.color.set('#ffffff') d.theme_source.set(False) d.button_set_color.invoke() eq(d.color.get(), '#de0000') del d.get_new_theme_name configdialog.tkColorChooser.askcolor = orig_chooser def test_on_new_color_set(self): d = self.page color = '#3f7cae' d.custom_name.set('Python') d.highlight_target.set('Selected Text') d.fg_bg_toggle.set(True) d.color.set(color) self.assertEqual(d.style.lookup(d.frame_color_set['style'], 'background'), color) self.assertEqual(d.highlight_sample.tag_cget('hilite', 'foreground'), color) self.assertEqual(highpage, {'Python': {'hilite-foreground': color}}) def test_get_new_theme_name(self): orig_sectionname = configdialog.SectionName sn = configdialog.SectionName = Func(return_self=True) d = self.page sn.result = 'New Theme' self.assertEqual(d.get_new_theme_name(''), 'New Theme') configdialog.SectionName = orig_sectionname def test_save_as_new_theme(self): d = self.page gntn = d.get_new_theme_name = Func() d.theme_source.set(True) # No name entered. gntn.result = '' d.button_save_custom.invoke() self.assertNotIn(gntn.result, idleConf.userCfg['highlight']) # Name entered. gntn.result = 'my new theme' gntn.called = 0 self.assertNotIn(gntn.result, idleConf.userCfg['highlight']) d.button_save_custom.invoke() self.assertIn(gntn.result, idleConf.userCfg['highlight']) del d.get_new_theme_name def test_create_new_and_save_new(self): eq = self.assertEqual d = self.page # Use default as previously active theme. d.theme_source.set(True) d.builtin_name.set('IDLE Classic') first_new = 'my new custom theme' second_new = 'my second custom theme' # No changes, so themes are an exact copy. self.assertNotIn(first_new, idleConf.userCfg) d.create_new(first_new) eq(idleConf.GetSectionList('user', 'highlight'), [first_new]) eq(idleConf.GetThemeDict('default', 'IDLE Classic'), idleConf.GetThemeDict('user', first_new)) eq(d.custom_name.get(), first_new) self.assertFalse(d.theme_source.get()) # Use custom set. eq(d.set_theme_type.called, 1) # Test that changed targets are in new theme. changes.add_option('highlight', first_new, 'hit-background', 'yellow') self.assertNotIn(second_new, idleConf.userCfg) d.create_new(second_new) eq(idleConf.GetSectionList('user', 'highlight'), [first_new, second_new]) self.assertNotEqual(idleConf.GetThemeDict('user', first_new), idleConf.GetThemeDict('user', second_new)) # Check that difference in themes was in `hit-background` from `changes`. idleConf.SetOption('highlight', first_new, 'hit-background', 'yellow') eq(idleConf.GetThemeDict('user', first_new), idleConf.GetThemeDict('user', second_new)) def test_set_highlight_target(self): eq = self.assertEqual d = self.page del d.set_highlight_target # Target is cursor. d.highlight_target.set('Cursor') eq(d.fg_on.state(), ('disabled', 'selected')) eq(d.bg_on.state(), ('disabled',)) self.assertTrue(d.fg_bg_toggle) eq(d.set_color_sample.called, 1) # Target is not cursor. d.highlight_target.set('Comment') eq(d.fg_on.state(), ('selected',)) eq(d.bg_on.state(), ()) self.assertTrue(d.fg_bg_toggle) eq(d.set_color_sample.called, 2) d.set_highlight_target = Func() def test_set_color_sample_binding(self): d = self.page scs = d.set_color_sample d.fg_on.invoke() self.assertEqual(scs.called, 1) d.bg_on.invoke() self.assertEqual(scs.called, 2) def test_set_color_sample(self): d = self.page del d.set_color_sample d.highlight_target.set('Selected Text') d.fg_bg_toggle.set(True) d.set_color_sample() self.assertEqual( d.style.lookup(d.frame_color_set['style'], 'background'), d.highlight_sample.tag_cget('hilite', 'foreground')) d.set_color_sample = Func() def test_paint_theme_sample(self): eq = self.assertEqual d = self.page del d.paint_theme_sample hs_tag = d.highlight_sample.tag_cget gh = idleConf.GetHighlight fg = 'foreground' bg = 'background' # Create custom theme based on IDLE Dark. d.theme_source.set(True) d.builtin_name.set('IDLE Dark') theme = 'IDLE Test' d.create_new(theme) d.set_color_sample.called = 0 # Base theme with nothing in `changes`. d.paint_theme_sample() eq(hs_tag('break', fg), gh(theme, 'break', fgBg='fg')) eq(hs_tag('cursor', bg), gh(theme, 'normal', fgBg='bg')) self.assertNotEqual(hs_tag('console', fg), 'blue') self.assertNotEqual(hs_tag('console', bg), 'yellow') eq(d.set_color_sample.called, 1) # Apply changes. changes.add_option('highlight', theme, 'console-foreground', 'blue') changes.add_option('highlight', theme, 'console-background', 'yellow') d.paint_theme_sample() eq(hs_tag('break', fg), gh(theme, 'break', fgBg='fg')) eq(hs_tag('cursor', bg), gh(theme, 'normal', fgBg='bg')) eq(hs_tag('console', fg), 'blue') eq(hs_tag('console', bg), 'yellow') eq(d.set_color_sample.called, 2) d.paint_theme_sample = Func() def test_delete_custom(self): eq = self.assertEqual d = self.page d.button_delete_custom.state(('!disabled',)) yesno = d.askyesno = Func() dialog.deactivate_current_config = Func() dialog.activate_config_changes = Func() theme_name = 'spam theme' idleConf.userCfg['highlight'].SetOption(theme_name, 'name', 'value') highpage[theme_name] = {'option': 'True'} # Force custom theme. d.theme_source.set(False) d.custom_name.set(theme_name) # Cancel deletion. yesno.result = False d.button_delete_custom.invoke() eq(yesno.called, 1) eq(highpage[theme_name], {'option': 'True'}) eq(idleConf.GetSectionList('user', 'highlight'), ['spam theme']) eq(dialog.deactivate_current_config.called, 0) eq(dialog.activate_config_changes.called, 0) eq(d.set_theme_type.called, 0) # Confirm deletion. yesno.result = True d.button_delete_custom.invoke() eq(yesno.called, 2) self.assertNotIn(theme_name, highpage) eq(idleConf.GetSectionList('user', 'highlight'), []) eq(d.custom_theme_on.state(), ('disabled',)) eq(d.custom_name.get(), '- no custom themes -') eq(dialog.deactivate_current_config.called, 1) eq(dialog.activate_config_changes.called, 1) eq(d.set_theme_type.called, 1) del dialog.activate_config_changes, dialog.deactivate_current_config del d.askyesno class KeysPageTest(unittest.TestCase): """Test that keys tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that key sets works correctly. """ @classmethod def setUpClass(cls): page = cls.page = dialog.keyspage dialog.note.select(page) page.set_keys_type = Func() page.load_keys_list = Func() @classmethod def tearDownClass(cls): page = cls.page del page.set_keys_type, page.load_keys_list def setUp(self): d = self.page # The following is needed for test_load_key_cfg, _delete_custom_keys. # This may indicate a defect in some test or function. for section in idleConf.GetSectionList('user', 'keys'): idleConf.userCfg['keys'].remove_section(section) changes.clear() d.set_keys_type.called = 0 d.load_keys_list.called = 0 def test_load_key_cfg(self): tracers.detach() d = self.page eq = self.assertEqual # Use builtin keyset with no user keysets created. idleConf.CurrentKeys = mock.Mock(return_value='IDLE Classic OSX') d.load_key_cfg() self.assertTrue(d.keyset_source.get()) # builtinlist sets variable builtin_name to the CurrentKeys default. eq(d.builtin_name.get(), 'IDLE Classic OSX') eq(d.custom_name.get(), '- no custom keys -') eq(d.custom_keyset_on.state(), ('disabled',)) eq(d.set_keys_type.called, 1) eq(d.load_keys_list.called, 1) eq(d.load_keys_list.args, ('IDLE Classic OSX', )) # Builtin keyset with non-empty user keyset list. idleConf.SetOption('keys', 'test1', 'option', 'value') idleConf.SetOption('keys', 'test2', 'option2', 'value2') d.load_key_cfg() eq(d.builtin_name.get(), 'IDLE Classic OSX') eq(d.custom_name.get(), 'test1') eq(d.set_keys_type.called, 2) eq(d.load_keys_list.called, 2) eq(d.load_keys_list.args, ('IDLE Classic OSX', )) # Use custom keyset. idleConf.CurrentKeys = mock.Mock(return_value='test2') idleConf.default_keys = mock.Mock(return_value='IDLE Modern Unix') idleConf.SetOption('main', 'Keys', 'default', '0') d.load_key_cfg() self.assertFalse(d.keyset_source.get()) eq(d.builtin_name.get(), 'IDLE Modern Unix') eq(d.custom_name.get(), 'test2') eq(d.set_keys_type.called, 3) eq(d.load_keys_list.called, 3) eq(d.load_keys_list.args, ('test2', )) del idleConf.CurrentKeys, idleConf.default_keys tracers.attach() def test_keyset_source(self): eq = self.assertEqual d = self.page # Test these separately. d.var_changed_builtin_name = Func() d.var_changed_custom_name = Func() # Builtin selected. d.builtin_keyset_on.invoke() eq(mainpage, {'Keys': {'default': 'True'}}) eq(d.var_changed_builtin_name.called, 1) eq(d.var_changed_custom_name.called, 0) changes.clear() # Custom selected. d.custom_keyset_on.state(('!disabled',)) d.custom_keyset_on.invoke() self.assertEqual(mainpage, {'Keys': {'default': 'False'}}) eq(d.var_changed_builtin_name.called, 1) eq(d.var_changed_custom_name.called, 1) del d.var_changed_builtin_name, d.var_changed_custom_name def test_builtin_name(self): eq = self.assertEqual d = self.page idleConf.userCfg['main'].remove_section('Keys') item_list = ['IDLE Classic Windows', 'IDLE Classic OSX', 'IDLE Modern UNIX'] # Not in old_keys, defaults name to first item. d.builtinlist.SetMenu(item_list, 'IDLE Modern UNIX') eq(mainpage, {'Keys': {'name': 'IDLE Classic Windows', 'name2': 'IDLE Modern UNIX'}}) eq(d.keys_message['text'], 'New key set, see Help') eq(d.load_keys_list.called, 1) eq(d.load_keys_list.args, ('IDLE Modern UNIX', )) # Not in old keys - uses name2. changes.clear() idleConf.SetOption('main', 'Keys', 'name', 'IDLE Classic Unix') d.builtinlist.SetMenu(item_list, 'IDLE Modern UNIX') eq(mainpage, {'Keys': {'name2': 'IDLE Modern UNIX'}}) eq(d.keys_message['text'], 'New key set, see Help') eq(d.load_keys_list.called, 2) eq(d.load_keys_list.args, ('IDLE Modern UNIX', )) # Builtin name in old_keys. changes.clear() d.builtinlist.SetMenu(item_list, 'IDLE Classic OSX') eq(mainpage, {'Keys': {'name': 'IDLE Classic OSX', 'name2': ''}}) eq(d.keys_message['text'], '') eq(d.load_keys_list.called, 3) eq(d.load_keys_list.args, ('IDLE Classic OSX', )) def test_custom_name(self): d = self.page # If no selections, doesn't get added. d.customlist.SetMenu([], '- no custom keys -') self.assertNotIn('Keys', mainpage) self.assertEqual(d.load_keys_list.called, 0) # Custom name selected. changes.clear() d.customlist.SetMenu(['a', 'b', 'c'], 'c') self.assertEqual(mainpage, {'Keys': {'name': 'c'}}) self.assertEqual(d.load_keys_list.called, 1) def test_keybinding(self): idleConf.SetOption('extensions', 'ZzDummy', 'enable', 'True') d = self.page d.custom_name.set('my custom keys') d.bindingslist.delete(0, 'end') d.bindingslist.insert(0, 'copy') d.bindingslist.insert(1, 'z-in') d.bindingslist.selection_set(0) d.bindingslist.selection_anchor(0) # Core binding - adds to keys. d.keybinding.set('<Key-F11>') self.assertEqual(keyspage, {'my custom keys': {'copy': '<Key-F11>'}}) # Not a core binding - adds to extensions. d.bindingslist.selection_set(1) d.bindingslist.selection_anchor(1) d.keybinding.set('<Key-F11>') self.assertEqual(extpage, {'ZzDummy_cfgBindings': {'z-in': '<Key-F11>'}}) def test_set_keys_type(self): eq = self.assertEqual d = self.page del d.set_keys_type # Builtin keyset selected. d.keyset_source.set(True) d.set_keys_type() eq(d.builtinlist['state'], NORMAL) eq(d.customlist['state'], DISABLED) eq(d.button_delete_custom_keys.state(), ('disabled',)) # Custom keyset selected. d.keyset_source.set(False) d.set_keys_type() eq(d.builtinlist['state'], DISABLED) eq(d.custom_keyset_on.state(), ('selected',)) eq(d.customlist['state'], NORMAL) eq(d.button_delete_custom_keys.state(), ()) d.set_keys_type = Func() def test_get_new_keys(self): eq = self.assertEqual d = self.page orig_getkeysdialog = configdialog.GetKeysDialog gkd = configdialog.GetKeysDialog = Func(return_self=True) gnkn = d.get_new_keys_name = Func() d.button_new_keys.state(('!disabled',)) d.bindingslist.delete(0, 'end') d.bindingslist.insert(0, 'copy - <Control-Shift-Key-C>') d.bindingslist.selection_set(0) d.bindingslist.selection_anchor(0) d.keybinding.set('Key-a') d.keyset_source.set(True) # Default keyset. # Default keyset; no change to binding. gkd.result = '' d.button_new_keys.invoke() eq(d.bindingslist.get('anchor'), 'copy - <Control-Shift-Key-C>') # Keybinding isn't changed when there isn't a change entered. eq(d.keybinding.get(), 'Key-a') # Default keyset; binding changed. gkd.result = '<Key-F11>' # No keyset name selected therefore binding not saved. gnkn.result = '' d.button_new_keys.invoke() eq(gnkn.called, 1) eq(d.bindingslist.get('anchor'), 'copy - <Control-Shift-Key-C>') # Keyset name selected. gnkn.result = 'My New Key Set' d.button_new_keys.invoke() eq(d.custom_name.get(), gnkn.result) eq(d.bindingslist.get('anchor'), 'copy - <Key-F11>') eq(d.keybinding.get(), '<Key-F11>') # User keyset; binding changed. d.keyset_source.set(False) # Custom keyset. gnkn.called = 0 gkd.result = '<Key-p>' d.button_new_keys.invoke() eq(gnkn.called, 0) eq(d.bindingslist.get('anchor'), 'copy - <Key-p>') eq(d.keybinding.get(), '<Key-p>') del d.get_new_keys_name configdialog.GetKeysDialog = orig_getkeysdialog def test_get_new_keys_name(self): orig_sectionname = configdialog.SectionName sn = configdialog.SectionName = Func(return_self=True) d = self.page sn.result = 'New Keys' self.assertEqual(d.get_new_keys_name(''), 'New Keys') configdialog.SectionName = orig_sectionname def test_save_as_new_key_set(self): d = self.page gnkn = d.get_new_keys_name = Func() d.keyset_source.set(True) # No name entered. gnkn.result = '' d.button_save_custom_keys.invoke() # Name entered. gnkn.result = 'my new key set' gnkn.called = 0 self.assertNotIn(gnkn.result, idleConf.userCfg['keys']) d.button_save_custom_keys.invoke() self.assertIn(gnkn.result, idleConf.userCfg['keys']) del d.get_new_keys_name def test_on_bindingslist_select(self): d = self.page b = d.bindingslist b.delete(0, 'end') b.insert(0, 'copy') b.insert(1, 'find') b.activate(0) b.focus_force() b.see(1) b.update() x, y, dx, dy = b.bbox(1) x += dx // 2 y += dy // 2 b.event_generate('<Enter>', x=0, y=0) b.event_generate('<Motion>', x=x, y=y) b.event_generate('<Button-1>', x=x, y=y) b.event_generate('<ButtonRelease-1>', x=x, y=y) self.assertEqual(b.get('anchor'), 'find') self.assertEqual(d.button_new_keys.state(), ()) def test_create_new_key_set_and_save_new_key_set(self): eq = self.assertEqual d = self.page # Use default as previously active keyset. d.keyset_source.set(True) d.builtin_name.set('IDLE Classic Windows') first_new = 'my new custom key set' second_new = 'my second custom keyset' # No changes, so keysets are an exact copy. self.assertNotIn(first_new, idleConf.userCfg) d.create_new_key_set(first_new) eq(idleConf.GetSectionList('user', 'keys'), [first_new]) eq(idleConf.GetKeySet('IDLE Classic Windows'), idleConf.GetKeySet(first_new)) eq(d.custom_name.get(), first_new) self.assertFalse(d.keyset_source.get()) # Use custom set. eq(d.set_keys_type.called, 1) # Test that changed keybindings are in new keyset. changes.add_option('keys', first_new, 'copy', '<Key-F11>') self.assertNotIn(second_new, idleConf.userCfg) d.create_new_key_set(second_new) eq(idleConf.GetSectionList('user', 'keys'), [first_new, second_new]) self.assertNotEqual(idleConf.GetKeySet(first_new), idleConf.GetKeySet(second_new)) # Check that difference in keysets was in option `copy` from `changes`. idleConf.SetOption('keys', first_new, 'copy', '<Key-F11>') eq(idleConf.GetKeySet(first_new), idleConf.GetKeySet(second_new)) def test_load_keys_list(self): eq = self.assertEqual d = self.page gks = idleConf.GetKeySet = Func() del d.load_keys_list b = d.bindingslist b.delete(0, 'end') b.insert(0, '<<find>>') b.insert(1, '<<help>>') gks.result = {'<<copy>>': ['<Control-Key-c>', '<Control-Key-C>'], '<<force-open-completions>>': ['<Control-Key-space>'], '<<spam>>': ['<Key-F11>']} changes.add_option('keys', 'my keys', 'spam', '<Shift-Key-a>') expected = ('copy - <Control-Key-c> <Control-Key-C>', 'force-open-completions - <Control-Key-space>', 'spam - <Shift-Key-a>') # No current selection. d.load_keys_list('my keys') eq(b.get(0, 'end'), expected) eq(b.get('anchor'), '') eq(b.curselection(), ()) # Check selection. b.selection_set(1) b.selection_anchor(1) d.load_keys_list('my keys') eq(b.get(0, 'end'), expected) eq(b.get('anchor'), 'force-open-completions - <Control-Key-space>') eq(b.curselection(), (1, )) # Change selection. b.selection_set(2) b.selection_anchor(2) d.load_keys_list('my keys') eq(b.get(0, 'end'), expected) eq(b.get('anchor'), 'spam - <Shift-Key-a>') eq(b.curselection(), (2, )) d.load_keys_list = Func() del idleConf.GetKeySet def test_delete_custom_keys(self): eq = self.assertEqual d = self.page d.button_delete_custom_keys.state(('!disabled',)) yesno = d.askyesno = Func() dialog.deactivate_current_config = Func() dialog.activate_config_changes = Func() keyset_name = 'spam key set' idleConf.userCfg['keys'].SetOption(keyset_name, 'name', 'value') keyspage[keyset_name] = {'option': 'True'} # Force custom keyset. d.keyset_source.set(False) d.custom_name.set(keyset_name) # Cancel deletion. yesno.result = False d.button_delete_custom_keys.invoke() eq(yesno.called, 1) eq(keyspage[keyset_name], {'option': 'True'}) eq(idleConf.GetSectionList('user', 'keys'), ['spam key set']) eq(dialog.deactivate_current_config.called, 0) eq(dialog.activate_config_changes.called, 0) eq(d.set_keys_type.called, 0) # Confirm deletion. yesno.result = True d.button_delete_custom_keys.invoke() eq(yesno.called, 2) self.assertNotIn(keyset_name, keyspage) eq(idleConf.GetSectionList('user', 'keys'), []) eq(d.custom_keyset_on.state(), ('disabled',)) eq(d.custom_name.get(), '- no custom keys -') eq(dialog.deactivate_current_config.called, 1) eq(dialog.activate_config_changes.called, 1) eq(d.set_keys_type.called, 1) del dialog.activate_config_changes, dialog.deactivate_current_config del d.askyesno class GenPageTest(unittest.TestCase): """Test that general tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that helplist works correctly. """ @classmethod def setUpClass(cls): page = cls.page = dialog.genpage dialog.note.select(page) page.set = page.set_add_delete_state = Func() page.upc = page.update_help_changes = Func() page.update() @classmethod def tearDownClass(cls): page = cls.page del page.set, page.set_add_delete_state del page.upc, page.update_help_changes page.helplist.delete(0, 'end') page.user_helplist.clear() def setUp(self): changes.clear() def test_load_general_cfg(self): # Set to wrong values, load, check right values. eq = self.assertEqual d = self.page d.startup_edit.set(1) d.autosave.set(1) d.win_width.set(1) d.win_height.set(1) d.helplist.insert('end', 'bad') d.user_helplist = ['bad', 'worse'] idleConf.SetOption('main', 'HelpFiles', '1', 'name;file') d.load_general_cfg() eq(d.startup_edit.get(), 0) eq(d.autosave.get(), 0) eq(d.win_width.get(), '80') eq(d.win_height.get(), '40') eq(d.helplist.get(0, 'end'), ('name',)) eq(d.user_helplist, [('name', 'file', '1')]) def test_startup(self): d = self.page d.startup_editor_on.invoke() self.assertEqual(mainpage, {'General': {'editor-on-startup': '1'}}) changes.clear() d.startup_shell_on.invoke() self.assertEqual(mainpage, {'General': {'editor-on-startup': '0'}}) def test_editor_size(self): d = self.page d.win_height_int.delete(0, 'end') d.win_height_int.insert(0, '11') self.assertEqual(mainpage, {'EditorWindow': {'height': '11'}}) changes.clear() d.win_width_int.delete(0, 'end') d.win_width_int.insert(0, '11') self.assertEqual(mainpage, {'EditorWindow': {'width': '11'}}) def test_autocomplete_wait(self): self.page.auto_wait_int.delete(0, 'end') self.page.auto_wait_int.insert(0, '11') self.assertEqual(extpage, {'AutoComplete': {'popupwait': '11'}}) def test_parenmatch(self): d = self.page eq = self.assertEqual d.paren_style_type['menu'].invoke(0) eq(extpage, {'ParenMatch': {'style': 'opener'}}) changes.clear() d.paren_flash_time.delete(0, 'end') d.paren_flash_time.insert(0, '11') eq(extpage, {'ParenMatch': {'flash-delay': '11'}}) changes.clear() d.bell_on.invoke() eq(extpage, {'ParenMatch': {'bell': 'False'}}) def test_autosave(self): d = self.page d.save_auto_on.invoke() self.assertEqual(mainpage, {'General': {'autosave': '1'}}) d.save_ask_on.invoke() self.assertEqual(mainpage, {'General': {'autosave': '0'}}) def test_paragraph(self): self.page.format_width_int.delete(0, 'end') self.page.format_width_int.insert(0, '11') self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}}) def test_context(self): self.page.context_int.delete(0, 'end') self.page.context_int.insert(0, '1') self.assertEqual(extpage, {'CodeContext': {'maxlines': '1'}}) def test_source_selected(self): d = self.page d.set = d.set_add_delete_state d.upc = d.update_help_changes helplist = d.helplist dex = 'end' helplist.insert(dex, 'source') helplist.activate(dex) helplist.focus_force() helplist.see(dex) helplist.update() x, y, dx, dy = helplist.bbox(dex) x += dx // 2 y += dy // 2 d.set.called = d.upc.called = 0 helplist.event_generate('<Enter>', x=0, y=0) helplist.event_generate('<Motion>', x=x, y=y) helplist.event_generate('<Button-1>', x=x, y=y) helplist.event_generate('<ButtonRelease-1>', x=x, y=y) self.assertEqual(helplist.get('anchor'), 'source') self.assertTrue(d.set.called) self.assertFalse(d.upc.called) def test_set_add_delete_state(self): # Call with 0 items, 1 unselected item, 1 selected item. eq = self.assertEqual d = self.page del d.set_add_delete_state # Unmask method. sad = d.set_add_delete_state h = d.helplist h.delete(0, 'end') sad() eq(d.button_helplist_edit.state(), ('disabled',)) eq(d.button_helplist_remove.state(), ('disabled',)) h.insert(0, 'source') sad() eq(d.button_helplist_edit.state(), ('disabled',)) eq(d.button_helplist_remove.state(), ('disabled',)) h.selection_set(0) sad() eq(d.button_helplist_edit.state(), ()) eq(d.button_helplist_remove.state(), ()) d.set_add_delete_state = Func() # Mask method. def test_helplist_item_add(self): # Call without and twice with HelpSource result. # Double call enables check on order. eq = self.assertEqual orig_helpsource = configdialog.HelpSource hs = configdialog.HelpSource = Func(return_self=True) d = self.page d.helplist.delete(0, 'end') d.user_helplist.clear() d.set.called = d.upc.called = 0 hs.result = '' d.helplist_item_add() self.assertTrue(list(d.helplist.get(0, 'end')) == d.user_helplist == []) self.assertFalse(d.upc.called) hs.result = ('name1', 'file1') d.helplist_item_add() hs.result = ('name2', 'file2') d.helplist_item_add() eq(d.helplist.get(0, 'end'), ('name1', 'name2')) eq(d.user_helplist, [('name1', 'file1'), ('name2', 'file2')]) eq(d.upc.called, 2) self.assertFalse(d.set.called) configdialog.HelpSource = orig_helpsource def test_helplist_item_edit(self): # Call without and with HelpSource change. eq = self.assertEqual orig_helpsource = configdialog.HelpSource hs = configdialog.HelpSource = Func(return_self=True) d = self.page d.helplist.delete(0, 'end') d.helplist.insert(0, 'name1') d.helplist.selection_set(0) d.helplist.selection_anchor(0) d.user_helplist.clear() d.user_helplist.append(('name1', 'file1')) d.set.called = d.upc.called = 0 hs.result = '' d.helplist_item_edit() hs.result = ('name1', 'file1') d.helplist_item_edit() eq(d.helplist.get(0, 'end'), ('name1',)) eq(d.user_helplist, [('name1', 'file1')]) self.assertFalse(d.upc.called) hs.result = ('name2', 'file2') d.helplist_item_edit() eq(d.helplist.get(0, 'end'), ('name2',)) eq(d.user_helplist, [('name2', 'file2')]) self.assertTrue(d.upc.called == d.set.called == 1) configdialog.HelpSource = orig_helpsource def test_helplist_item_remove(self): eq = self.assertEqual d = self.page d.helplist.delete(0, 'end') d.helplist.insert(0, 'name1') d.helplist.selection_set(0) d.helplist.selection_anchor(0) d.user_helplist.clear() d.user_helplist.append(('name1', 'file1')) d.set.called = d.upc.called = 0 d.helplist_item_remove() eq(d.helplist.get(0, 'end'), ()) eq(d.user_helplist, []) self.assertTrue(d.upc.called == d.set.called == 1) def test_update_help_changes(self): d = self.page del d.update_help_changes d.user_helplist.clear() d.user_helplist.append(('name1', 'file1')) d.user_helplist.append(('name2', 'file2')) d.update_help_changes() self.assertEqual(mainpage['HelpFiles'], {'1': 'name1;file1', '2': 'name2;file2'}) d.update_help_changes = Func() class VarTraceTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.tracers = configdialog.VarTrace() cls.iv = IntVar(root) cls.bv = BooleanVar(root) @classmethod def tearDownClass(cls): del cls.tracers, cls.iv, cls.bv def setUp(self): self.tracers.clear() self.called = 0 def var_changed_increment(self, *params): self.called += 13 def var_changed_boolean(self, *params): pass def test_init(self): tr = self.tracers tr.__init__() self.assertEqual(tr.untraced, []) self.assertEqual(tr.traced, []) def test_clear(self): tr = self.tracers tr.untraced.append(0) tr.traced.append(1) tr.clear() self.assertEqual(tr.untraced, []) self.assertEqual(tr.traced, []) def test_add(self): tr = self.tracers func = Func() cb = tr.make_callback = mock.Mock(return_value=func) iv = tr.add(self.iv, self.var_changed_increment) self.assertIs(iv, self.iv) bv = tr.add(self.bv, self.var_changed_boolean) self.assertIs(bv, self.bv) sv = StringVar(root) sv2 = tr.add(sv, ('main', 'section', 'option')) self.assertIs(sv2, sv) cb.assert_called_once() cb.assert_called_with(sv, ('main', 'section', 'option')) expected = [(iv, self.var_changed_increment), (bv, self.var_changed_boolean), (sv, func)] self.assertEqual(tr.traced, []) self.assertEqual(tr.untraced, expected) del tr.make_callback def test_make_callback(self): cb = self.tracers.make_callback(self.iv, ('main', 'section', 'option')) self.assertTrue(callable(cb)) self.iv.set(42) # Not attached, so set didn't invoke the callback. self.assertNotIn('section', changes['main']) # Invoke callback manually. cb() self.assertIn('section', changes['main']) self.assertEqual(changes['main']['section']['option'], '42') changes.clear() def test_attach_detach(self): tr = self.tracers iv = tr.add(self.iv, self.var_changed_increment) bv = tr.add(self.bv, self.var_changed_boolean) expected = [(iv, self.var_changed_increment), (bv, self.var_changed_boolean)] # Attach callbacks and test call increment. tr.attach() self.assertEqual(tr.untraced, []) self.assertCountEqual(tr.traced, expected) iv.set(1) self.assertEqual(iv.get(), 1) self.assertEqual(self.called, 13) # Check that only one callback is attached to a variable. # If more than one callback were attached, then var_changed_increment # would be called twice and the counter would be 2. self.called = 0 tr.attach() iv.set(1) self.assertEqual(self.called, 13) # Detach callbacks. self.called = 0 tr.detach() self.assertEqual(tr.traced, []) self.assertCountEqual(tr.untraced, expected) iv.set(1) self.assertEqual(self.called, 0) if __name__ == '__main__': unittest.main(verbosity=2)
49,767
1,419
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_mainmenu.py
"Test mainmenu, coverage 100%." # Reported as 88%; mocking turtledemo absence would have no point. from idlelib import mainmenu import unittest class MainMenuTest(unittest.TestCase): def test_menudefs(self): actual = [item[0] for item in mainmenu.menudefs] expect = ['file', 'edit', 'format', 'run', 'shell', 'debug', 'options', 'window', 'help'] self.assertEqual(actual, expect) def test_default_keydefs(self): self.assertGreaterEqual(len(mainmenu.default_keydefs), 50) if __name__ == '__main__': unittest.main(verbosity=2)
594
22
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_multicall.py
"Test multicall, coverage 33%." from idlelib import multicall import unittest from test.support import requires from tkinter import Tk, Text class MultiCallTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.mc = multicall.MultiCallCreator(Text) @classmethod def tearDownClass(cls): del cls.mc cls.root.update_idletasks() ## for id in cls.root.tk.call('after', 'info'): ## cls.root.after_cancel(id) # Need for EditorWindow. cls.root.destroy() del cls.root def test_creator(self): mc = self.mc self.assertIs(multicall._multicall_dict[Text], mc) self.assertTrue(issubclass(mc, Text)) mc2 = multicall.MultiCallCreator(Text) self.assertIs(mc, mc2) def test_init(self): mctext = self.mc(self.root) self.assertIsInstance(mctext._MultiCall__binders, list) if __name__ == '__main__': unittest.main(verbosity=2)
1,042
41
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_debugobj_r.py
"Test debugobj_r, coverage 56%." from idlelib import debugobj_r import unittest class WrappedObjectTreeItemTest(unittest.TestCase): def test_getattr(self): ti = debugobj_r.WrappedObjectTreeItem(list) self.assertEqual(ti.append, list.append) class StubObjectTreeItemTest(unittest.TestCase): def test_init(self): ti = debugobj_r.StubObjectTreeItem('socket', 1111) self.assertEqual(ti.sockio, 'socket') self.assertEqual(ti.oid, 1111) if __name__ == '__main__': unittest.main(verbosity=2)
545
23
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_pyshell.py
"Test pyshell, coverage 12%." # Plus coverage of test_warning. Was 20% with test_openshell. from idlelib import pyshell import unittest from test.support import requires from tkinter import Tk class PyShellFileListTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() @classmethod def tearDownClass(cls): #cls.root.update_idletasks() ## for id in cls.root.tk.call('after', 'info'): ## cls.root.after_cancel(id) # Need for EditorWindow. cls.root.destroy() del cls.root def test_init(self): psfl = pyshell.PyShellFileList(self.root) self.assertEqual(psfl.EditorWindow, pyshell.PyShellEditorWindow) self.assertIsNone(psfl.pyshell) # The following sometimes causes 'invalid command name "109734456recolorize"'. # Uncommenting after_cancel above prevents this, but results in # TclError: bad window path name ".!listedtoplevel.!frame.text" # which is normally prevented by after_cancel. ## def test_openshell(self): ## pyshell.use_subprocess = False ## ps = pyshell.PyShellFileList(self.root).open_shell() ## self.assertIsInstance(ps, pyshell.PyShell) if __name__ == '__main__': unittest.main(verbosity=2)
1,307
43
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_undo.py
"Test undo, coverage 77%." # Only test UndoDelegator so far. from idlelib.undo import UndoDelegator import unittest from test.support import requires requires('gui') from unittest.mock import Mock from tkinter import Text, Tk from idlelib.percolator import Percolator class UndoDelegatorTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = Tk() cls.text = Text(cls.root) cls.percolator = Percolator(cls.text) @classmethod def tearDownClass(cls): cls.percolator.redir.close() del cls.percolator, cls.text cls.root.destroy() del cls.root def setUp(self): self.delegator = UndoDelegator() self.delegator.bell = Mock() self.percolator.insertfilter(self.delegator) def tearDown(self): self.percolator.removefilter(self.delegator) self.text.delete('1.0', 'end') self.delegator.resetcache() def test_undo_event(self): text = self.text text.insert('insert', 'foobar') text.insert('insert', 'h') text.event_generate('<<undo>>') self.assertEqual(text.get('1.0', 'end'), '\n') text.insert('insert', 'foo') text.insert('insert', 'bar') text.delete('1.2', '1.4') text.insert('insert', 'hello') text.event_generate('<<undo>>') self.assertEqual(text.get('1.0', '1.4'), 'foar') text.event_generate('<<undo>>') self.assertEqual(text.get('1.0', '1.6'), 'foobar') text.event_generate('<<undo>>') self.assertEqual(text.get('1.0', '1.3'), 'foo') text.event_generate('<<undo>>') self.delegator.undo_event('event') self.assertTrue(self.delegator.bell.called) def test_redo_event(self): text = self.text text.insert('insert', 'foo') text.insert('insert', 'bar') text.delete('1.0', '1.3') text.event_generate('<<undo>>') text.event_generate('<<redo>>') self.assertEqual(text.get('1.0', '1.3'), 'bar') text.event_generate('<<redo>>') self.assertTrue(self.delegator.bell.called) def test_dump_event(self): """ Dump_event cannot be tested directly without changing environment variables. So, test statements in dump_event indirectly """ text = self.text d = self.delegator text.insert('insert', 'foo') text.insert('insert', 'bar') text.delete('1.2', '1.4') self.assertTupleEqual((d.pointer, d.can_merge), (3, True)) text.event_generate('<<undo>>') self.assertTupleEqual((d.pointer, d.can_merge), (2, False)) def test_get_set_saved(self): # test the getter method get_saved # test the setter method set_saved # indirectly test check_saved d = self.delegator self.assertTrue(d.get_saved()) self.text.insert('insert', 'a') self.assertFalse(d.get_saved()) d.saved_change_hook = Mock() d.set_saved(True) self.assertEqual(d.pointer, d.saved) self.assertTrue(d.saved_change_hook.called) d.set_saved(False) self.assertEqual(d.saved, -1) self.assertTrue(d.saved_change_hook.called) def test_undo_start_stop(self): # test the undo_block_start and undo_block_stop methods text = self.text text.insert('insert', 'foo') self.delegator.undo_block_start() text.insert('insert', 'bar') text.insert('insert', 'bar') self.delegator.undo_block_stop() self.assertEqual(text.get('1.0', '1.3'), 'foo') # test another code path self.delegator.undo_block_start() text.insert('insert', 'bar') self.delegator.undo_block_stop() self.assertEqual(text.get('1.0', '1.3'), 'foo') def test_addcmd(self): text = self.text # when number of undo operations exceeds max_undo self.delegator.max_undo = max_undo = 10 for i in range(max_undo + 10): text.insert('insert', 'foo') self.assertLessEqual(len(self.delegator.undolist), max_undo) if __name__ == '__main__': unittest.main(verbosity=2, exit=False)
4,228
136
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_query.py
"""Test query, coverage 91%). Non-gui tests for Query, SectionName, ModuleName, and HelpSource use dummy versions that extract the non-gui methods and add other needed attributes. GUI tests create an instance of each class and simulate entries and button clicks. Subclass tests only target the new code in the subclass definition. The appearance of the widgets is checked by the Query and HelpSource htests. These are run by running query.py. """ from idlelib import query import unittest from test.support import requires from tkinter import Tk import sys from unittest import mock from idlelib.idle_test.mock_tk import Var # NON-GUI TESTS class QueryTest(unittest.TestCase): "Test Query base class." class Dummy_Query: # Test the following Query methods. entry_ok = query.Query.entry_ok ok = query.Query.ok cancel = query.Query.cancel # Add attributes and initialization needed for tests. entry = Var() entry_error = {} def __init__(self, dummy_entry): self.entry.set(dummy_entry) self.entry_error['text'] = '' self.result = None self.destroyed = False def showerror(self, message): self.entry_error['text'] = message def destroy(self): self.destroyed = True def test_entry_ok_blank(self): dialog = self.Dummy_Query(' ') self.assertEqual(dialog.entry_ok(), None) self.assertEqual((dialog.result, dialog.destroyed), (None, False)) self.assertIn('blank line', dialog.entry_error['text']) def test_entry_ok_good(self): dialog = self.Dummy_Query(' good ') Equal = self.assertEqual Equal(dialog.entry_ok(), 'good') Equal((dialog.result, dialog.destroyed), (None, False)) Equal(dialog.entry_error['text'], '') def test_ok_blank(self): dialog = self.Dummy_Query('') dialog.entry.focus_set = mock.Mock() self.assertEqual(dialog.ok(), None) self.assertTrue(dialog.entry.focus_set.called) del dialog.entry.focus_set self.assertEqual((dialog.result, dialog.destroyed), (None, False)) def test_ok_good(self): dialog = self.Dummy_Query('good') self.assertEqual(dialog.ok(), None) self.assertEqual((dialog.result, dialog.destroyed), ('good', True)) def test_cancel(self): dialog = self.Dummy_Query('does not matter') self.assertEqual(dialog.cancel(), None) self.assertEqual((dialog.result, dialog.destroyed), (None, True)) class SectionNameTest(unittest.TestCase): "Test SectionName subclass of Query." class Dummy_SectionName: entry_ok = query.SectionName.entry_ok # Function being tested. used_names = ['used'] entry = Var() entry_error = {} def __init__(self, dummy_entry): self.entry.set(dummy_entry) self.entry_error['text'] = '' def showerror(self, message): self.entry_error['text'] = message def test_blank_section_name(self): dialog = self.Dummy_SectionName(' ') self.assertEqual(dialog.entry_ok(), None) self.assertIn('no name', dialog.entry_error['text']) def test_used_section_name(self): dialog = self.Dummy_SectionName('used') self.assertEqual(dialog.entry_ok(), None) self.assertIn('use', dialog.entry_error['text']) def test_long_section_name(self): dialog = self.Dummy_SectionName('good'*8) self.assertEqual(dialog.entry_ok(), None) self.assertIn('longer than 30', dialog.entry_error['text']) def test_good_section_name(self): dialog = self.Dummy_SectionName(' good ') self.assertEqual(dialog.entry_ok(), 'good') self.assertEqual(dialog.entry_error['text'], '') class ModuleNameTest(unittest.TestCase): "Test ModuleName subclass of Query." class Dummy_ModuleName: entry_ok = query.ModuleName.entry_ok # Function being tested. text0 = '' entry = Var() entry_error = {} def __init__(self, dummy_entry): self.entry.set(dummy_entry) self.entry_error['text'] = '' def showerror(self, message): self.entry_error['text'] = message def test_blank_module_name(self): dialog = self.Dummy_ModuleName(' ') self.assertEqual(dialog.entry_ok(), None) self.assertIn('no name', dialog.entry_error['text']) def test_bogus_module_name(self): dialog = self.Dummy_ModuleName('__name_xyz123_should_not_exist__') self.assertEqual(dialog.entry_ok(), None) self.assertIn('not found', dialog.entry_error['text']) def test_c_source_name(self): dialog = self.Dummy_ModuleName('itertools') self.assertEqual(dialog.entry_ok(), None) self.assertIn('source-based', dialog.entry_error['text']) def test_good_module_name(self): dialog = self.Dummy_ModuleName('idlelib') self.assertTrue(dialog.entry_ok().endswith('__init__.py')) self.assertEqual(dialog.entry_error['text'], '') # 3 HelpSource test classes each test one function. orig_platform = query.platform class HelpsourceBrowsefileTest(unittest.TestCase): "Test browse_file method of ModuleName subclass of Query." class Dummy_HelpSource: browse_file = query.HelpSource.browse_file pathvar = Var() def test_file_replaces_path(self): dialog = self.Dummy_HelpSource() # Path is widget entry, either '' or something. # Func return is file dialog return, either '' or something. # Func return should override widget entry. # We need all 4 combinations to test all (most) code paths. for path, func, result in ( ('', lambda a,b,c:'', ''), ('', lambda a,b,c: __file__, __file__), ('htest', lambda a,b,c:'', 'htest'), ('htest', lambda a,b,c: __file__, __file__)): with self.subTest(): dialog.pathvar.set(path) dialog.askfilename = func dialog.browse_file() self.assertEqual(dialog.pathvar.get(), result) class HelpsourcePathokTest(unittest.TestCase): "Test path_ok method of HelpSource subclass of Query." class Dummy_HelpSource: path_ok = query.HelpSource.path_ok path = Var() path_error = {} def __init__(self, dummy_path): self.path.set(dummy_path) self.path_error['text'] = '' def showerror(self, message, widget=None): self.path_error['text'] = message @classmethod def tearDownClass(cls): query.platform = orig_platform def test_path_ok_blank(self): dialog = self.Dummy_HelpSource(' ') self.assertEqual(dialog.path_ok(), None) self.assertIn('no help file', dialog.path_error['text']) def test_path_ok_bad(self): dialog = self.Dummy_HelpSource(__file__ + 'bad-bad-bad') self.assertEqual(dialog.path_ok(), None) self.assertIn('not exist', dialog.path_error['text']) def test_path_ok_web(self): dialog = self.Dummy_HelpSource('') Equal = self.assertEqual for url in 'www.py.org', 'http://py.org': with self.subTest(): dialog.path.set(url) self.assertEqual(dialog.path_ok(), url) self.assertEqual(dialog.path_error['text'], '') def test_path_ok_file(self): dialog = self.Dummy_HelpSource('') for platform, prefix in ('darwin', 'file://'), ('other', ''): with self.subTest(): query.platform = platform dialog.path.set(__file__) self.assertEqual(dialog.path_ok(), prefix + __file__) self.assertEqual(dialog.path_error['text'], '') class HelpsourceEntryokTest(unittest.TestCase): "Test entry_ok method of HelpSource subclass of Query." class Dummy_HelpSource: entry_ok = query.HelpSource.entry_ok entry_error = {} path_error = {} def item_ok(self): return self.name def path_ok(self): return self.path def test_entry_ok_helpsource(self): dialog = self.Dummy_HelpSource() for name, path, result in ((None, None, None), (None, 'doc.txt', None), ('doc', None, None), ('doc', 'doc.txt', ('doc', 'doc.txt'))): with self.subTest(): dialog.name, dialog.path = name, path self.assertEqual(dialog.entry_ok(), result) # GUI TESTS class QueryGuiTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = root = Tk() cls.root.withdraw() cls.dialog = query.Query(root, 'TEST', 'test', _utest=True) cls.dialog.destroy = mock.Mock() @classmethod def tearDownClass(cls): del cls.dialog.destroy del cls.dialog cls.root.destroy() del cls.root def setUp(self): self.dialog.entry.delete(0, 'end') self.dialog.result = None self.dialog.destroy.reset_mock() def test_click_ok(self): dialog = self.dialog dialog.entry.insert(0, 'abc') dialog.button_ok.invoke() self.assertEqual(dialog.result, 'abc') self.assertTrue(dialog.destroy.called) def test_click_blank(self): dialog = self.dialog dialog.button_ok.invoke() self.assertEqual(dialog.result, None) self.assertFalse(dialog.destroy.called) def test_click_cancel(self): dialog = self.dialog dialog.entry.insert(0, 'abc') dialog.button_cancel.invoke() self.assertEqual(dialog.result, None) self.assertTrue(dialog.destroy.called) class SectionnameGuiTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') def test_click_section_name(self): root = Tk() root.withdraw() dialog = query.SectionName(root, 'T', 't', {'abc'}, _utest=True) Equal = self.assertEqual self.assertEqual(dialog.used_names, {'abc'}) dialog.entry.insert(0, 'okay') dialog.button_ok.invoke() self.assertEqual(dialog.result, 'okay') del dialog root.destroy() del root class ModulenameGuiTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') def test_click_module_name(self): root = Tk() root.withdraw() dialog = query.ModuleName(root, 'T', 't', 'idlelib', _utest=True) self.assertEqual(dialog.text0, 'idlelib') self.assertEqual(dialog.entry.get(), 'idlelib') dialog.button_ok.invoke() self.assertTrue(dialog.result.endswith('__init__.py')) del dialog root.destroy() del root class HelpsourceGuiTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') def test_click_help_source(self): root = Tk() root.withdraw() dialog = query.HelpSource(root, 'T', menuitem='__test__', filepath=__file__, _utest=True) Equal = self.assertEqual Equal(dialog.entry.get(), '__test__') Equal(dialog.path.get(), __file__) dialog.button_ok.invoke() prefix = "file://" if sys.platform == 'darwin' else '' Equal(dialog.result, ('__test__', prefix + __file__)) del dialog root.destroy() del root if __name__ == '__main__': unittest.main(verbosity=2, exit=False)
11,768
353
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_search.py
"Test search, coverage 69%." from idlelib import search import unittest from test.support import requires requires('gui') from tkinter import Tk, Text, BooleanVar from idlelib import searchengine # Does not currently test the event handler wrappers. # A usage test should simulate clicks and check highlighting. # Tests need to be coordinated with SearchDialogBase tests # to avoid duplication. class SearchDialogTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = Tk() @classmethod def tearDownClass(cls): cls.root.destroy() del cls.root def setUp(self): self.engine = searchengine.SearchEngine(self.root) self.dialog = search.SearchDialog(self.root, self.engine) self.dialog.bell = lambda: None self.text = Text(self.root) self.text.insert('1.0', 'Hello World!') def test_find_again(self): # Search for various expressions text = self.text self.engine.setpat('') self.assertFalse(self.dialog.find_again(text)) self.dialog.bell = lambda: None self.engine.setpat('Hello') self.assertTrue(self.dialog.find_again(text)) self.engine.setpat('Goodbye') self.assertFalse(self.dialog.find_again(text)) self.engine.setpat('World!') self.assertTrue(self.dialog.find_again(text)) self.engine.setpat('Hello World!') self.assertTrue(self.dialog.find_again(text)) # Regular expression self.engine.revar = BooleanVar(self.root, True) self.engine.setpat('W[aeiouy]r') self.assertTrue(self.dialog.find_again(text)) def test_find_selection(self): # Select some text and make sure it's found text = self.text # Add additional line to find self.text.insert('2.0', 'Hello World!') text.tag_add('sel', '1.0', '1.4') # Select 'Hello' self.assertTrue(self.dialog.find_selection(text)) text.tag_remove('sel', '1.0', 'end') text.tag_add('sel', '1.6', '1.11') # Select 'World!' self.assertTrue(self.dialog.find_selection(text)) text.tag_remove('sel', '1.0', 'end') text.tag_add('sel', '1.0', '1.11') # Select 'Hello World!' self.assertTrue(self.dialog.find_selection(text)) # Remove additional line text.delete('2.0', 'end') if __name__ == '__main__': unittest.main(verbosity=2, exit=2)
2,459
81
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_iomenu.py
"Test , coverage 16%." from idlelib import iomenu import unittest from test.support import requires from tkinter import Tk from idlelib.editor import EditorWindow class IOBindigTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.editwin = EditorWindow(root=cls.root) @classmethod def tearDownClass(cls): cls.editwin._close() del cls.editwin cls.root.update_idletasks() for id in cls.root.tk.call('after', 'info'): cls.root.after_cancel(id) # Need for EditorWindow. cls.root.destroy() del cls.root def test_init(self): io = iomenu.IOBinding(self.editwin) self.assertIs(io.editwin, self.editwin) io.close if __name__ == '__main__': unittest.main(verbosity=2)
870
38
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_statusbar.py
"Test statusbar, coverage 100%." from idlelib import statusbar import unittest from test.support import requires from tkinter import Tk class Test(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() @classmethod def tearDownClass(cls): cls.root.update_idletasks() cls.root.destroy() del cls.root def test_init(self): bar = statusbar.MultiStatusBar(self.root) self.assertEqual(bar.labels, {}) def test_set_label(self): bar = statusbar.MultiStatusBar(self.root) bar.set_label('left', text='sometext', width=10) self.assertIn('left', bar.labels) left = bar.labels['left'] self.assertEqual(left['text'], 'sometext') self.assertEqual(left['width'], 10) bar.set_label('left', text='revised text') self.assertEqual(left['text'], 'revised text') bar.set_label('right', text='correct text') self.assertEqual(bar.labels['right']['text'], 'correct text') if __name__ == '__main__': unittest.main(verbosity=2)
1,133
42
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/__init__.py
'''idlelib.idle_test is a private implementation of test.test_idle, which tests the IDLE application as part of the stdlib test suite. Run IDLE tests alone with "python -m test.test_idle". Starting with Python 3.6, IDLE requires tcl/tk 8.5 or later. This package and its contained modules are subject to change and any direct use is at your own risk. ''' from os.path import dirname def load_tests(loader, standard_tests, pattern): this_dir = dirname(__file__) top_dir = dirname(dirname(this_dir)) package_tests = loader.discover(start_dir=this_dir, pattern='test*.py', top_level_dir=top_dir) standard_tests.addTests(package_tests) return standard_tests
712
18
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_macosx.py
"Test macosx, coverage 45% on Windows." from idlelib import macosx import unittest from test.support import requires import tkinter as tk import unittest.mock as mock from idlelib.filelist import FileList mactypes = {'carbon', 'cocoa', 'xquartz'} nontypes = {'other'} alltypes = mactypes | nontypes class InitTktypeTest(unittest.TestCase): "Test _init_tk_type." @classmethod def setUpClass(cls): requires('gui') cls.root = tk.Tk() cls.root.withdraw() cls.orig_platform = macosx.platform @classmethod def tearDownClass(cls): cls.root.update_idletasks() cls.root.destroy() del cls.root macosx.platform = cls.orig_platform def test_init_sets_tktype(self): "Test that _init_tk_type sets _tk_type according to platform." for platform, types in ('darwin', alltypes), ('other', nontypes): with self.subTest(platform=platform): macosx.platform = platform macosx._tk_type == None macosx._init_tk_type() self.assertIn(macosx._tk_type, types) class IsTypeTkTest(unittest.TestCase): "Test each of the four isTypeTk predecates." isfuncs = ((macosx.isAquaTk, ('carbon', 'cocoa')), (macosx.isCarbonTk, ('carbon')), (macosx.isCocoaTk, ('cocoa')), (macosx.isXQuartz, ('xquartz')), ) @mock.patch('idlelib.macosx._init_tk_type') def test_is_calls_init(self, mockinit): "Test that each isTypeTk calls _init_tk_type when _tk_type is None." macosx._tk_type = None for func, whentrue in self.isfuncs: with self.subTest(func=func): func() self.assertTrue(mockinit.called) mockinit.reset_mock() def test_isfuncs(self): "Test that each isTypeTk return correct bool." for func, whentrue in self.isfuncs: for tktype in alltypes: with self.subTest(func=func, whentrue=whentrue, tktype=tktype): macosx._tk_type = tktype (self.assertTrue if tktype in whentrue else self.assertFalse)\ (func()) class SetupTest(unittest.TestCase): "Test setupApp." @classmethod def setUpClass(cls): requires('gui') cls.root = tk.Tk() cls.root.withdraw() def cmd(tkpath, func): assert isinstance(tkpath, str) assert isinstance(func, type(cmd)) cls.root.createcommand = cmd @classmethod def tearDownClass(cls): cls.root.update_idletasks() cls.root.destroy() del cls.root @mock.patch('idlelib.macosx.overrideRootMenu') #27312 def test_setupapp(self, overrideRootMenu): "Call setupApp with each possible graphics type." root = self.root flist = FileList(root) for tktype in alltypes: with self.subTest(tktype=tktype): macosx._tk_type = tktype macosx.setupApp(root, flist) if tktype in ('carbon', 'cocoa'): self.assertTrue(overrideRootMenu.called) overrideRootMenu.reset_mock() if __name__ == '__main__': unittest.main(verbosity=2)
3,309
105
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/idlelib/idle_test/test_textview.py
"""Test textview, coverage 100%. Since all methods and functions create (or destroy) a ViewWindow, which is a widget containing a widget, etcetera, all tests must be gui tests. Using mock Text would not change this. Other mocks are used to retrieve information about calls. """ from idlelib import textview as tv import unittest from test.support import requires requires('gui') import os from tkinter import Tk from tkinter.ttk import Button from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Mbox_func def setUpModule(): global root root = Tk() root.withdraw() def tearDownModule(): global root root.update_idletasks() root.destroy() del root # If we call ViewWindow or wrapper functions with defaults # modal=True, _utest=False, test hangs on call to wait_window. # Have also gotten tk error 'can't invoke "event" command'. class VW(tv.ViewWindow): # Used in ViewWindowTest. transient = Func() grab_set = Func() wait_window = Func() # Call wrapper class VW with mock wait_window. class ViewWindowTest(unittest.TestCase): def setUp(self): VW.transient.__init__() VW.grab_set.__init__() VW.wait_window.__init__() def test_init_modal(self): view = VW(root, 'Title', 'test text') self.assertTrue(VW.transient.called) self.assertTrue(VW.grab_set.called) self.assertTrue(VW.wait_window.called) view.ok() def test_init_nonmodal(self): view = VW(root, 'Title', 'test text', modal=False) self.assertFalse(VW.transient.called) self.assertFalse(VW.grab_set.called) self.assertFalse(VW.wait_window.called) view.ok() def test_ok(self): view = VW(root, 'Title', 'test text', modal=False) view.destroy = Func() view.ok() self.assertTrue(view.destroy.called) del view.destroy # Unmask real function. view.destroy() class TextFrameTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = root = Tk() root.withdraw() cls.frame = tv.TextFrame(root, 'test text') @classmethod def tearDownClass(cls): del cls.frame cls.root.update_idletasks() cls.root.destroy() del cls.root def test_line1(self): get = self.frame.text.get self.assertEqual(get('1.0', '1.end'), 'test text') # Call ViewWindow with modal=False. class ViewFunctionTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.orig_error = tv.showerror tv.showerror = Mbox_func() @classmethod def tearDownClass(cls): tv.showerror = cls.orig_error del cls.orig_error def test_view_text(self): view = tv.view_text(root, 'Title', 'test text', modal=False) self.assertIsInstance(view, tv.ViewWindow) self.assertIsInstance(view.viewframe, tv.ViewFrame) view.viewframe.ok() def test_view_file(self): view = tv.view_file(root, 'Title', __file__, 'ascii', modal=False) self.assertIsInstance(view, tv.ViewWindow) self.assertIsInstance(view.viewframe, tv.ViewFrame) get = view.viewframe.textframe.text.get self.assertIn('Test', get('1.0', '1.end')) view.ok() def test_bad_file(self): # Mock showerror will be used; view_file will return None. view = tv.view_file(root, 'Title', 'abc.xyz', 'ascii', modal=False) self.assertIsNone(view) self.assertEqual(tv.showerror.title, 'File Load Error') def test_bad_encoding(self): p = os.path fn = p.abspath(p.join(p.dirname(__file__), '..', 'CREDITS.txt')) view = tv.view_file(root, 'Title', fn, 'ascii', modal=False) self.assertIsNone(view) self.assertEqual(tv.showerror.title, 'Unicode Decode Error') def test_nowrap(self): view = tv.view_text(root, 'Title', 'test', modal=False, wrap='none') text_widget = view.viewframe.textframe.text self.assertEqual(text_widget.cget('wrap'), 'none') # Call ViewWindow with _utest=True. class ButtonClickTest(unittest.TestCase): def setUp(self): self.view = None self.called = False def tearDown(self): if self.view: self.view.destroy() def test_view_text_bind_with_button(self): def _command(): self.called = True self.view = tv.view_text(root, 'TITLE_TEXT', 'COMMAND', _utest=True) button = Button(root, text='BUTTON', command=_command) button.invoke() self.addCleanup(button.destroy) self.assertEqual(self.called, True) self.assertEqual(self.view.title(), 'TITLE_TEXT') self.assertEqual(self.view.viewframe.textframe.text.get('1.0', '1.end'), 'COMMAND') def test_view_file_bind_with_button(self): def _command(): self.called = True self.view = tv.view_file(root, 'TITLE_FILE', __file__, encoding='ascii', _utest=True) button = Button(root, text='BUTTON', command=_command) button.invoke() self.addCleanup(button.destroy) self.assertEqual(self.called, True) self.assertEqual(self.view.title(), 'TITLE_FILE') get = self.view.viewframe.textframe.text.get with open(__file__) as f: self.assertEqual(get('1.0', '1.end'), f.readline().strip()) f.readline() self.assertEqual(get('3.0', '3.end'), f.readline().strip()) if __name__ == '__main__': unittest.main(verbosity=2)
5,634
182
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/html/entities.py
"""HTML character entity references.""" __all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs'] # maps the HTML entity name to the Unicode code point name2codepoint = { 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1 'Acirc': 0x00c2, # latin capital letter A with circumflex, U+00C2 ISOlat1 'Agrave': 0x00c0, # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 'Alpha': 0x0391, # greek capital letter alpha, U+0391 'Aring': 0x00c5, # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 'Atilde': 0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1 'Auml': 0x00c4, # latin capital letter A with diaeresis, U+00C4 ISOlat1 'Beta': 0x0392, # greek capital letter beta, U+0392 'Ccedil': 0x00c7, # latin capital letter C with cedilla, U+00C7 ISOlat1 'Chi': 0x03a7, # greek capital letter chi, U+03A7 'Dagger': 0x2021, # double dagger, U+2021 ISOpub 'Delta': 0x0394, # greek capital letter delta, U+0394 ISOgrk3 'ETH': 0x00d0, # latin capital letter ETH, U+00D0 ISOlat1 'Eacute': 0x00c9, # latin capital letter E with acute, U+00C9 ISOlat1 'Ecirc': 0x00ca, # latin capital letter E with circumflex, U+00CA ISOlat1 'Egrave': 0x00c8, # latin capital letter E with grave, U+00C8 ISOlat1 'Epsilon': 0x0395, # greek capital letter epsilon, U+0395 'Eta': 0x0397, # greek capital letter eta, U+0397 'Euml': 0x00cb, # latin capital letter E with diaeresis, U+00CB ISOlat1 'Gamma': 0x0393, # greek capital letter gamma, U+0393 ISOgrk3 'Iacute': 0x00cd, # latin capital letter I with acute, U+00CD ISOlat1 'Icirc': 0x00ce, # latin capital letter I with circumflex, U+00CE ISOlat1 'Igrave': 0x00cc, # latin capital letter I with grave, U+00CC ISOlat1 'Iota': 0x0399, # greek capital letter iota, U+0399 'Iuml': 0x00cf, # latin capital letter I with diaeresis, U+00CF ISOlat1 'Kappa': 0x039a, # greek capital letter kappa, U+039A 'Lambda': 0x039b, # greek capital letter lambda, U+039B ISOgrk3 'Mu': 0x039c, # greek capital letter mu, U+039C 'Ntilde': 0x00d1, # latin capital letter N with tilde, U+00D1 ISOlat1 'Nu': 0x039d, # greek capital letter nu, U+039D 'OElig': 0x0152, # latin capital ligature OE, U+0152 ISOlat2 'Oacute': 0x00d3, # latin capital letter O with acute, U+00D3 ISOlat1 'Ocirc': 0x00d4, # latin capital letter O with circumflex, U+00D4 ISOlat1 'Ograve': 0x00d2, # latin capital letter O with grave, U+00D2 ISOlat1 'Omega': 0x03a9, # greek capital letter omega, U+03A9 ISOgrk3 'Omicron': 0x039f, # greek capital letter omicron, U+039F 'Oslash': 0x00d8, # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 'Otilde': 0x00d5, # latin capital letter O with tilde, U+00D5 ISOlat1 'Ouml': 0x00d6, # latin capital letter O with diaeresis, U+00D6 ISOlat1 'Phi': 0x03a6, # greek capital letter phi, U+03A6 ISOgrk3 'Pi': 0x03a0, # greek capital letter pi, U+03A0 ISOgrk3 'Prime': 0x2033, # double prime = seconds = inches, U+2033 ISOtech 'Psi': 0x03a8, # greek capital letter psi, U+03A8 ISOgrk3 'Rho': 0x03a1, # greek capital letter rho, U+03A1 'Scaron': 0x0160, # latin capital letter S with caron, U+0160 ISOlat2 'Sigma': 0x03a3, # greek capital letter sigma, U+03A3 ISOgrk3 'THORN': 0x00de, # latin capital letter THORN, U+00DE ISOlat1 'Tau': 0x03a4, # greek capital letter tau, U+03A4 'Theta': 0x0398, # greek capital letter theta, U+0398 ISOgrk3 'Uacute': 0x00da, # latin capital letter U with acute, U+00DA ISOlat1 'Ucirc': 0x00db, # latin capital letter U with circumflex, U+00DB ISOlat1 'Ugrave': 0x00d9, # latin capital letter U with grave, U+00D9 ISOlat1 'Upsilon': 0x03a5, # greek capital letter upsilon, U+03A5 ISOgrk3 'Uuml': 0x00dc, # latin capital letter U with diaeresis, U+00DC ISOlat1 'Xi': 0x039e, # greek capital letter xi, U+039E ISOgrk3 'Yacute': 0x00dd, # latin capital letter Y with acute, U+00DD ISOlat1 'Yuml': 0x0178, # latin capital letter Y with diaeresis, U+0178 ISOlat2 'Zeta': 0x0396, # greek capital letter zeta, U+0396 'aacute': 0x00e1, # latin small letter a with acute, U+00E1 ISOlat1 'acirc': 0x00e2, # latin small letter a with circumflex, U+00E2 ISOlat1 'acute': 0x00b4, # acute accent = spacing acute, U+00B4 ISOdia 'aelig': 0x00e6, # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 'agrave': 0x00e0, # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 'alefsym': 0x2135, # alef symbol = first transfinite cardinal, U+2135 NEW 'alpha': 0x03b1, # greek small letter alpha, U+03B1 ISOgrk3 'amp': 0x0026, # ampersand, U+0026 ISOnum 'and': 0x2227, # logical and = wedge, U+2227 ISOtech 'ang': 0x2220, # angle, U+2220 ISOamso 'aring': 0x00e5, # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 'asymp': 0x2248, # almost equal to = asymptotic to, U+2248 ISOamsr 'atilde': 0x00e3, # latin small letter a with tilde, U+00E3 ISOlat1 'auml': 0x00e4, # latin small letter a with diaeresis, U+00E4 ISOlat1 'bdquo': 0x201e, # double low-9 quotation mark, U+201E NEW 'beta': 0x03b2, # greek small letter beta, U+03B2 ISOgrk3 'brvbar': 0x00a6, # broken bar = broken vertical bar, U+00A6 ISOnum 'bull': 0x2022, # bullet = black small circle, U+2022 ISOpub 'cap': 0x2229, # intersection = cap, U+2229 ISOtech 'ccedil': 0x00e7, # latin small letter c with cedilla, U+00E7 ISOlat1 'cedil': 0x00b8, # cedilla = spacing cedilla, U+00B8 ISOdia 'cent': 0x00a2, # cent sign, U+00A2 ISOnum 'chi': 0x03c7, # greek small letter chi, U+03C7 ISOgrk3 'circ': 0x02c6, # modifier letter circumflex accent, U+02C6 ISOpub 'clubs': 0x2663, # black club suit = shamrock, U+2663 ISOpub 'cong': 0x2245, # approximately equal to, U+2245 ISOtech 'copy': 0x00a9, # copyright sign, U+00A9 ISOnum 'crarr': 0x21b5, # downwards arrow with corner leftwards = carriage return, U+21B5 NEW 'cup': 0x222a, # union = cup, U+222A ISOtech 'curren': 0x00a4, # currency sign, U+00A4 ISOnum 'dArr': 0x21d3, # downwards double arrow, U+21D3 ISOamsa 'dagger': 0x2020, # dagger, U+2020 ISOpub 'darr': 0x2193, # downwards arrow, U+2193 ISOnum 'deg': 0x00b0, # degree sign, U+00B0 ISOnum 'delta': 0x03b4, # greek small letter delta, U+03B4 ISOgrk3 'diams': 0x2666, # black diamond suit, U+2666 ISOpub 'divide': 0x00f7, # division sign, U+00F7 ISOnum 'eacute': 0x00e9, # latin small letter e with acute, U+00E9 ISOlat1 'ecirc': 0x00ea, # latin small letter e with circumflex, U+00EA ISOlat1 'egrave': 0x00e8, # latin small letter e with grave, U+00E8 ISOlat1 'empty': 0x2205, # empty set = null set = diameter, U+2205 ISOamso 'emsp': 0x2003, # em space, U+2003 ISOpub 'ensp': 0x2002, # en space, U+2002 ISOpub 'epsilon': 0x03b5, # greek small letter epsilon, U+03B5 ISOgrk3 'equiv': 0x2261, # identical to, U+2261 ISOtech 'eta': 0x03b7, # greek small letter eta, U+03B7 ISOgrk3 'eth': 0x00f0, # latin small letter eth, U+00F0 ISOlat1 'euml': 0x00eb, # latin small letter e with diaeresis, U+00EB ISOlat1 'euro': 0x20ac, # euro sign, U+20AC NEW 'exist': 0x2203, # there exists, U+2203 ISOtech 'fnof': 0x0192, # latin small f with hook = function = florin, U+0192 ISOtech 'forall': 0x2200, # for all, U+2200 ISOtech 'frac12': 0x00bd, # vulgar fraction one half = fraction one half, U+00BD ISOnum 'frac14': 0x00bc, # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum 'frac34': 0x00be, # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum 'frasl': 0x2044, # fraction slash, U+2044 NEW 'gamma': 0x03b3, # greek small letter gamma, U+03B3 ISOgrk3 'ge': 0x2265, # greater-than or equal to, U+2265 ISOtech 'gt': 0x003e, # greater-than sign, U+003E ISOnum 'hArr': 0x21d4, # left right double arrow, U+21D4 ISOamsa 'harr': 0x2194, # left right arrow, U+2194 ISOamsa 'hearts': 0x2665, # black heart suit = valentine, U+2665 ISOpub 'hellip': 0x2026, # horizontal ellipsis = three dot leader, U+2026 ISOpub 'iacute': 0x00ed, # latin small letter i with acute, U+00ED ISOlat1 'icirc': 0x00ee, # latin small letter i with circumflex, U+00EE ISOlat1 'iexcl': 0x00a1, # inverted exclamation mark, U+00A1 ISOnum 'igrave': 0x00ec, # latin small letter i with grave, U+00EC ISOlat1 'image': 0x2111, # blackletter capital I = imaginary part, U+2111 ISOamso 'infin': 0x221e, # infinity, U+221E ISOtech 'int': 0x222b, # integral, U+222B ISOtech 'iota': 0x03b9, # greek small letter iota, U+03B9 ISOgrk3 'iquest': 0x00bf, # inverted question mark = turned question mark, U+00BF ISOnum 'isin': 0x2208, # element of, U+2208 ISOtech 'iuml': 0x00ef, # latin small letter i with diaeresis, U+00EF ISOlat1 'kappa': 0x03ba, # greek small letter kappa, U+03BA ISOgrk3 'lArr': 0x21d0, # leftwards double arrow, U+21D0 ISOtech 'lambda': 0x03bb, # greek small letter lambda, U+03BB ISOgrk3 'lang': 0x2329, # left-pointing angle bracket = bra, U+2329 ISOtech 'laquo': 0x00ab, # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum 'larr': 0x2190, # leftwards arrow, U+2190 ISOnum 'lceil': 0x2308, # left ceiling = apl upstile, U+2308 ISOamsc 'ldquo': 0x201c, # left double quotation mark, U+201C ISOnum 'le': 0x2264, # less-than or equal to, U+2264 ISOtech 'lfloor': 0x230a, # left floor = apl downstile, U+230A ISOamsc 'lowast': 0x2217, # asterisk operator, U+2217 ISOtech 'loz': 0x25ca, # lozenge, U+25CA ISOpub 'lrm': 0x200e, # left-to-right mark, U+200E NEW RFC 2070 'lsaquo': 0x2039, # single left-pointing angle quotation mark, U+2039 ISO proposed 'lsquo': 0x2018, # left single quotation mark, U+2018 ISOnum 'lt': 0x003c, # less-than sign, U+003C ISOnum 'macr': 0x00af, # macron = spacing macron = overline = APL overbar, U+00AF ISOdia 'mdash': 0x2014, # em dash, U+2014 ISOpub 'micro': 0x00b5, # micro sign, U+00B5 ISOnum 'middot': 0x00b7, # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum 'minus': 0x2212, # minus sign, U+2212 ISOtech 'mu': 0x03bc, # greek small letter mu, U+03BC ISOgrk3 'nabla': 0x2207, # nabla = backward difference, U+2207 ISOtech 'nbsp': 0x00a0, # no-break space = non-breaking space, U+00A0 ISOnum 'ndash': 0x2013, # en dash, U+2013 ISOpub 'ne': 0x2260, # not equal to, U+2260 ISOtech 'ni': 0x220b, # contains as member, U+220B ISOtech 'not': 0x00ac, # not sign, U+00AC ISOnum 'notin': 0x2209, # not an element of, U+2209 ISOtech 'nsub': 0x2284, # not a subset of, U+2284 ISOamsn 'ntilde': 0x00f1, # latin small letter n with tilde, U+00F1 ISOlat1 'nu': 0x03bd, # greek small letter nu, U+03BD ISOgrk3 'oacute': 0x00f3, # latin small letter o with acute, U+00F3 ISOlat1 'ocirc': 0x00f4, # latin small letter o with circumflex, U+00F4 ISOlat1 'oelig': 0x0153, # latin small ligature oe, U+0153 ISOlat2 'ograve': 0x00f2, # latin small letter o with grave, U+00F2 ISOlat1 'oline': 0x203e, # overline = spacing overscore, U+203E NEW 'omega': 0x03c9, # greek small letter omega, U+03C9 ISOgrk3 'omicron': 0x03bf, # greek small letter omicron, U+03BF NEW 'oplus': 0x2295, # circled plus = direct sum, U+2295 ISOamsb 'or': 0x2228, # logical or = vee, U+2228 ISOtech 'ordf': 0x00aa, # feminine ordinal indicator, U+00AA ISOnum 'ordm': 0x00ba, # masculine ordinal indicator, U+00BA ISOnum 'oslash': 0x00f8, # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 'otilde': 0x00f5, # latin small letter o with tilde, U+00F5 ISOlat1 'otimes': 0x2297, # circled times = vector product, U+2297 ISOamsb 'ouml': 0x00f6, # latin small letter o with diaeresis, U+00F6 ISOlat1 'para': 0x00b6, # pilcrow sign = paragraph sign, U+00B6 ISOnum 'part': 0x2202, # partial differential, U+2202 ISOtech 'permil': 0x2030, # per mille sign, U+2030 ISOtech 'perp': 0x22a5, # up tack = orthogonal to = perpendicular, U+22A5 ISOtech 'phi': 0x03c6, # greek small letter phi, U+03C6 ISOgrk3 'pi': 0x03c0, # greek small letter pi, U+03C0 ISOgrk3 'piv': 0x03d6, # greek pi symbol, U+03D6 ISOgrk3 'plusmn': 0x00b1, # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum 'pound': 0x00a3, # pound sign, U+00A3 ISOnum 'prime': 0x2032, # prime = minutes = feet, U+2032 ISOtech 'prod': 0x220f, # n-ary product = product sign, U+220F ISOamsb 'prop': 0x221d, # proportional to, U+221D ISOtech 'psi': 0x03c8, # greek small letter psi, U+03C8 ISOgrk3 'quot': 0x0022, # quotation mark = APL quote, U+0022 ISOnum 'rArr': 0x21d2, # rightwards double arrow, U+21D2 ISOtech 'radic': 0x221a, # square root = radical sign, U+221A ISOtech 'rang': 0x232a, # right-pointing angle bracket = ket, U+232A ISOtech 'raquo': 0x00bb, # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum 'rarr': 0x2192, # rightwards arrow, U+2192 ISOnum 'rceil': 0x2309, # right ceiling, U+2309 ISOamsc 'rdquo': 0x201d, # right double quotation mark, U+201D ISOnum 'real': 0x211c, # blackletter capital R = real part symbol, U+211C ISOamso 'reg': 0x00ae, # registered sign = registered trade mark sign, U+00AE ISOnum 'rfloor': 0x230b, # right floor, U+230B ISOamsc 'rho': 0x03c1, # greek small letter rho, U+03C1 ISOgrk3 'rlm': 0x200f, # right-to-left mark, U+200F NEW RFC 2070 'rsaquo': 0x203a, # single right-pointing angle quotation mark, U+203A ISO proposed 'rsquo': 0x2019, # right single quotation mark, U+2019 ISOnum 'sbquo': 0x201a, # single low-9 quotation mark, U+201A NEW 'scaron': 0x0161, # latin small letter s with caron, U+0161 ISOlat2 'sdot': 0x22c5, # dot operator, U+22C5 ISOamsb 'sect': 0x00a7, # section sign, U+00A7 ISOnum 'shy': 0x00ad, # soft hyphen = discretionary hyphen, U+00AD ISOnum 'sigma': 0x03c3, # greek small letter sigma, U+03C3 ISOgrk3 'sigmaf': 0x03c2, # greek small letter final sigma, U+03C2 ISOgrk3 'sim': 0x223c, # tilde operator = varies with = similar to, U+223C ISOtech 'spades': 0x2660, # black spade suit, U+2660 ISOpub 'sub': 0x2282, # subset of, U+2282 ISOtech 'sube': 0x2286, # subset of or equal to, U+2286 ISOtech 'sum': 0x2211, # n-ary summation, U+2211 ISOamsb 'sup': 0x2283, # superset of, U+2283 ISOtech 'sup1': 0x00b9, # superscript one = superscript digit one, U+00B9 ISOnum 'sup2': 0x00b2, # superscript two = superscript digit two = squared, U+00B2 ISOnum 'sup3': 0x00b3, # superscript three = superscript digit three = cubed, U+00B3 ISOnum 'supe': 0x2287, # superset of or equal to, U+2287 ISOtech 'szlig': 0x00df, # latin small letter sharp s = ess-zed, U+00DF ISOlat1 'tau': 0x03c4, # greek small letter tau, U+03C4 ISOgrk3 'there4': 0x2234, # therefore, U+2234 ISOtech 'theta': 0x03b8, # greek small letter theta, U+03B8 ISOgrk3 'thetasym': 0x03d1, # greek small letter theta symbol, U+03D1 NEW 'thinsp': 0x2009, # thin space, U+2009 ISOpub 'thorn': 0x00fe, # latin small letter thorn with, U+00FE ISOlat1 'tilde': 0x02dc, # small tilde, U+02DC ISOdia 'times': 0x00d7, # multiplication sign, U+00D7 ISOnum 'trade': 0x2122, # trade mark sign, U+2122 ISOnum 'uArr': 0x21d1, # upwards double arrow, U+21D1 ISOamsa 'uacute': 0x00fa, # latin small letter u with acute, U+00FA ISOlat1 'uarr': 0x2191, # upwards arrow, U+2191 ISOnum 'ucirc': 0x00fb, # latin small letter u with circumflex, U+00FB ISOlat1 'ugrave': 0x00f9, # latin small letter u with grave, U+00F9 ISOlat1 'uml': 0x00a8, # diaeresis = spacing diaeresis, U+00A8 ISOdia 'upsih': 0x03d2, # greek upsilon with hook symbol, U+03D2 NEW 'upsilon': 0x03c5, # greek small letter upsilon, U+03C5 ISOgrk3 'uuml': 0x00fc, # latin small letter u with diaeresis, U+00FC ISOlat1 'weierp': 0x2118, # script capital P = power set = Weierstrass p, U+2118 ISOamso 'xi': 0x03be, # greek small letter xi, U+03BE ISOgrk3 'yacute': 0x00fd, # latin small letter y with acute, U+00FD ISOlat1 'yen': 0x00a5, # yen sign = yuan sign, U+00A5 ISOnum 'yuml': 0x00ff, # latin small letter y with diaeresis, U+00FF ISOlat1 'zeta': 0x03b6, # greek small letter zeta, U+03B6 ISOgrk3 'zwj': 0x200d, # zero width joiner, U+200D NEW RFC 2070 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070 } # maps the HTML5 named character references to the equivalent Unicode character(s) html5 = { 'Aacute': '\xc1', 'aacute': '\xe1', 'Aacute;': '\xc1', 'aacute;': '\xe1', 'Abreve;': '\u0102', 'abreve;': '\u0103', 'ac;': '\u223e', 'acd;': '\u223f', 'acE;': '\u223e\u0333', 'Acirc': '\xc2', 'acirc': '\xe2', 'Acirc;': '\xc2', 'acirc;': '\xe2', 'acute': '\xb4', 'acute;': '\xb4', 'Acy;': '\u0410', 'acy;': '\u0430', 'AElig': '\xc6', 'aelig': '\xe6', 'AElig;': '\xc6', 'aelig;': '\xe6', 'af;': '\u2061', 'Afr;': '\U0001d504', 'afr;': '\U0001d51e', 'Agrave': '\xc0', 'agrave': '\xe0', 'Agrave;': '\xc0', 'agrave;': '\xe0', 'alefsym;': '\u2135', 'aleph;': '\u2135', 'Alpha;': '\u0391', 'alpha;': '\u03b1', 'Amacr;': '\u0100', 'amacr;': '\u0101', 'amalg;': '\u2a3f', 'AMP': '&', 'amp': '&', 'AMP;': '&', 'amp;': '&', 'And;': '\u2a53', 'and;': '\u2227', 'andand;': '\u2a55', 'andd;': '\u2a5c', 'andslope;': '\u2a58', 'andv;': '\u2a5a', 'ang;': '\u2220', 'ange;': '\u29a4', 'angle;': '\u2220', 'angmsd;': '\u2221', 'angmsdaa;': '\u29a8', 'angmsdab;': '\u29a9', 'angmsdac;': '\u29aa', 'angmsdad;': '\u29ab', 'angmsdae;': '\u29ac', 'angmsdaf;': '\u29ad', 'angmsdag;': '\u29ae', 'angmsdah;': '\u29af', 'angrt;': '\u221f', 'angrtvb;': '\u22be', 'angrtvbd;': '\u299d', 'angsph;': '\u2222', 'angst;': '\xc5', 'angzarr;': '\u237c', 'Aogon;': '\u0104', 'aogon;': '\u0105', 'Aopf;': '\U0001d538', 'aopf;': '\U0001d552', 'ap;': '\u2248', 'apacir;': '\u2a6f', 'apE;': '\u2a70', 'ape;': '\u224a', 'apid;': '\u224b', 'apos;': "'", 'ApplyFunction;': '\u2061', 'approx;': '\u2248', 'approxeq;': '\u224a', 'Aring': '\xc5', 'aring': '\xe5', 'Aring;': '\xc5', 'aring;': '\xe5', 'Ascr;': '\U0001d49c', 'ascr;': '\U0001d4b6', 'Assign;': '\u2254', 'ast;': '*', 'asymp;': '\u2248', 'asympeq;': '\u224d', 'Atilde': '\xc3', 'atilde': '\xe3', 'Atilde;': '\xc3', 'atilde;': '\xe3', 'Auml': '\xc4', 'auml': '\xe4', 'Auml;': '\xc4', 'auml;': '\xe4', 'awconint;': '\u2233', 'awint;': '\u2a11', 'backcong;': '\u224c', 'backepsilon;': '\u03f6', 'backprime;': '\u2035', 'backsim;': '\u223d', 'backsimeq;': '\u22cd', 'Backslash;': '\u2216', 'Barv;': '\u2ae7', 'barvee;': '\u22bd', 'Barwed;': '\u2306', 'barwed;': '\u2305', 'barwedge;': '\u2305', 'bbrk;': '\u23b5', 'bbrktbrk;': '\u23b6', 'bcong;': '\u224c', 'Bcy;': '\u0411', 'bcy;': '\u0431', 'bdquo;': '\u201e', 'becaus;': '\u2235', 'Because;': '\u2235', 'because;': '\u2235', 'bemptyv;': '\u29b0', 'bepsi;': '\u03f6', 'bernou;': '\u212c', 'Bernoullis;': '\u212c', 'Beta;': '\u0392', 'beta;': '\u03b2', 'beth;': '\u2136', 'between;': '\u226c', 'Bfr;': '\U0001d505', 'bfr;': '\U0001d51f', 'bigcap;': '\u22c2', 'bigcirc;': '\u25ef', 'bigcup;': '\u22c3', 'bigodot;': '\u2a00', 'bigoplus;': '\u2a01', 'bigotimes;': '\u2a02', 'bigsqcup;': '\u2a06', 'bigstar;': '\u2605', 'bigtriangledown;': '\u25bd', 'bigtriangleup;': '\u25b3', 'biguplus;': '\u2a04', 'bigvee;': '\u22c1', 'bigwedge;': '\u22c0', 'bkarow;': '\u290d', 'blacklozenge;': '\u29eb', 'blacksquare;': '\u25aa', 'blacktriangle;': '\u25b4', 'blacktriangledown;': '\u25be', 'blacktriangleleft;': '\u25c2', 'blacktriangleright;': '\u25b8', 'blank;': '\u2423', 'blk12;': '\u2592', 'blk14;': '\u2591', 'blk34;': '\u2593', 'block;': '\u2588', 'bne;': '=\u20e5', 'bnequiv;': '\u2261\u20e5', 'bNot;': '\u2aed', 'bnot;': '\u2310', 'Bopf;': '\U0001d539', 'bopf;': '\U0001d553', 'bot;': '\u22a5', 'bottom;': '\u22a5', 'bowtie;': '\u22c8', 'boxbox;': '\u29c9', 'boxDL;': '\u2557', 'boxDl;': '\u2556', 'boxdL;': '\u2555', 'boxdl;': '\u2510', 'boxDR;': '\u2554', 'boxDr;': '\u2553', 'boxdR;': '\u2552', 'boxdr;': '\u250c', 'boxH;': '\u2550', 'boxh;': '\u2500', 'boxHD;': '\u2566', 'boxHd;': '\u2564', 'boxhD;': '\u2565', 'boxhd;': '\u252c', 'boxHU;': '\u2569', 'boxHu;': '\u2567', 'boxhU;': '\u2568', 'boxhu;': '\u2534', 'boxminus;': '\u229f', 'boxplus;': '\u229e', 'boxtimes;': '\u22a0', 'boxUL;': '\u255d', 'boxUl;': '\u255c', 'boxuL;': '\u255b', 'boxul;': '\u2518', 'boxUR;': '\u255a', 'boxUr;': '\u2559', 'boxuR;': '\u2558', 'boxur;': '\u2514', 'boxV;': '\u2551', 'boxv;': '\u2502', 'boxVH;': '\u256c', 'boxVh;': '\u256b', 'boxvH;': '\u256a', 'boxvh;': '\u253c', 'boxVL;': '\u2563', 'boxVl;': '\u2562', 'boxvL;': '\u2561', 'boxvl;': '\u2524', 'boxVR;': '\u2560', 'boxVr;': '\u255f', 'boxvR;': '\u255e', 'boxvr;': '\u251c', 'bprime;': '\u2035', 'Breve;': '\u02d8', 'breve;': '\u02d8', 'brvbar': '\xa6', 'brvbar;': '\xa6', 'Bscr;': '\u212c', 'bscr;': '\U0001d4b7', 'bsemi;': '\u204f', 'bsim;': '\u223d', 'bsime;': '\u22cd', 'bsol;': '\\', 'bsolb;': '\u29c5', 'bsolhsub;': '\u27c8', 'bull;': '\u2022', 'bullet;': '\u2022', 'bump;': '\u224e', 'bumpE;': '\u2aae', 'bumpe;': '\u224f', 'Bumpeq;': '\u224e', 'bumpeq;': '\u224f', 'Cacute;': '\u0106', 'cacute;': '\u0107', 'Cap;': '\u22d2', 'cap;': '\u2229', 'capand;': '\u2a44', 'capbrcup;': '\u2a49', 'capcap;': '\u2a4b', 'capcup;': '\u2a47', 'capdot;': '\u2a40', 'CapitalDifferentialD;': '\u2145', 'caps;': '\u2229\ufe00', 'caret;': '\u2041', 'caron;': '\u02c7', 'Cayleys;': '\u212d', 'ccaps;': '\u2a4d', 'Ccaron;': '\u010c', 'ccaron;': '\u010d', 'Ccedil': '\xc7', 'ccedil': '\xe7', 'Ccedil;': '\xc7', 'ccedil;': '\xe7', 'Ccirc;': '\u0108', 'ccirc;': '\u0109', 'Cconint;': '\u2230', 'ccups;': '\u2a4c', 'ccupssm;': '\u2a50', 'Cdot;': '\u010a', 'cdot;': '\u010b', 'cedil': '\xb8', 'cedil;': '\xb8', 'Cedilla;': '\xb8', 'cemptyv;': '\u29b2', 'cent': '\xa2', 'cent;': '\xa2', 'CenterDot;': '\xb7', 'centerdot;': '\xb7', 'Cfr;': '\u212d', 'cfr;': '\U0001d520', 'CHcy;': '\u0427', 'chcy;': '\u0447', 'check;': '\u2713', 'checkmark;': '\u2713', 'Chi;': '\u03a7', 'chi;': '\u03c7', 'cir;': '\u25cb', 'circ;': '\u02c6', 'circeq;': '\u2257', 'circlearrowleft;': '\u21ba', 'circlearrowright;': '\u21bb', 'circledast;': '\u229b', 'circledcirc;': '\u229a', 'circleddash;': '\u229d', 'CircleDot;': '\u2299', 'circledR;': '\xae', 'circledS;': '\u24c8', 'CircleMinus;': '\u2296', 'CirclePlus;': '\u2295', 'CircleTimes;': '\u2297', 'cirE;': '\u29c3', 'cire;': '\u2257', 'cirfnint;': '\u2a10', 'cirmid;': '\u2aef', 'cirscir;': '\u29c2', 'ClockwiseContourIntegral;': '\u2232', 'CloseCurlyDoubleQuote;': '\u201d', 'CloseCurlyQuote;': '\u2019', 'clubs;': '\u2663', 'clubsuit;': '\u2663', 'Colon;': '\u2237', 'colon;': ':', 'Colone;': '\u2a74', 'colone;': '\u2254', 'coloneq;': '\u2254', 'comma;': ',', 'commat;': '@', 'comp;': '\u2201', 'compfn;': '\u2218', 'complement;': '\u2201', 'complexes;': '\u2102', 'cong;': '\u2245', 'congdot;': '\u2a6d', 'Congruent;': '\u2261', 'Conint;': '\u222f', 'conint;': '\u222e', 'ContourIntegral;': '\u222e', 'Copf;': '\u2102', 'copf;': '\U0001d554', 'coprod;': '\u2210', 'Coproduct;': '\u2210', 'COPY': '\xa9', 'copy': '\xa9', 'COPY;': '\xa9', 'copy;': '\xa9', 'copysr;': '\u2117', 'CounterClockwiseContourIntegral;': '\u2233', 'crarr;': '\u21b5', 'Cross;': '\u2a2f', 'cross;': '\u2717', 'Cscr;': '\U0001d49e', 'cscr;': '\U0001d4b8', 'csub;': '\u2acf', 'csube;': '\u2ad1', 'csup;': '\u2ad0', 'csupe;': '\u2ad2', 'ctdot;': '\u22ef', 'cudarrl;': '\u2938', 'cudarrr;': '\u2935', 'cuepr;': '\u22de', 'cuesc;': '\u22df', 'cularr;': '\u21b6', 'cularrp;': '\u293d', 'Cup;': '\u22d3', 'cup;': '\u222a', 'cupbrcap;': '\u2a48', 'CupCap;': '\u224d', 'cupcap;': '\u2a46', 'cupcup;': '\u2a4a', 'cupdot;': '\u228d', 'cupor;': '\u2a45', 'cups;': '\u222a\ufe00', 'curarr;': '\u21b7', 'curarrm;': '\u293c', 'curlyeqprec;': '\u22de', 'curlyeqsucc;': '\u22df', 'curlyvee;': '\u22ce', 'curlywedge;': '\u22cf', 'curren': '\xa4', 'curren;': '\xa4', 'curvearrowleft;': '\u21b6', 'curvearrowright;': '\u21b7', 'cuvee;': '\u22ce', 'cuwed;': '\u22cf', 'cwconint;': '\u2232', 'cwint;': '\u2231', 'cylcty;': '\u232d', 'Dagger;': '\u2021', 'dagger;': '\u2020', 'daleth;': '\u2138', 'Darr;': '\u21a1', 'dArr;': '\u21d3', 'darr;': '\u2193', 'dash;': '\u2010', 'Dashv;': '\u2ae4', 'dashv;': '\u22a3', 'dbkarow;': '\u290f', 'dblac;': '\u02dd', 'Dcaron;': '\u010e', 'dcaron;': '\u010f', 'Dcy;': '\u0414', 'dcy;': '\u0434', 'DD;': '\u2145', 'dd;': '\u2146', 'ddagger;': '\u2021', 'ddarr;': '\u21ca', 'DDotrahd;': '\u2911', 'ddotseq;': '\u2a77', 'deg': '\xb0', 'deg;': '\xb0', 'Del;': '\u2207', 'Delta;': '\u0394', 'delta;': '\u03b4', 'demptyv;': '\u29b1', 'dfisht;': '\u297f', 'Dfr;': '\U0001d507', 'dfr;': '\U0001d521', 'dHar;': '\u2965', 'dharl;': '\u21c3', 'dharr;': '\u21c2', 'DiacriticalAcute;': '\xb4', 'DiacriticalDot;': '\u02d9', 'DiacriticalDoubleAcute;': '\u02dd', 'DiacriticalGrave;': '`', 'DiacriticalTilde;': '\u02dc', 'diam;': '\u22c4', 'Diamond;': '\u22c4', 'diamond;': '\u22c4', 'diamondsuit;': '\u2666', 'diams;': '\u2666', 'die;': '\xa8', 'DifferentialD;': '\u2146', 'digamma;': '\u03dd', 'disin;': '\u22f2', 'div;': '\xf7', 'divide': '\xf7', 'divide;': '\xf7', 'divideontimes;': '\u22c7', 'divonx;': '\u22c7', 'DJcy;': '\u0402', 'djcy;': '\u0452', 'dlcorn;': '\u231e', 'dlcrop;': '\u230d', 'dollar;': '$', 'Dopf;': '\U0001d53b', 'dopf;': '\U0001d555', 'Dot;': '\xa8', 'dot;': '\u02d9', 'DotDot;': '\u20dc', 'doteq;': '\u2250', 'doteqdot;': '\u2251', 'DotEqual;': '\u2250', 'dotminus;': '\u2238', 'dotplus;': '\u2214', 'dotsquare;': '\u22a1', 'doublebarwedge;': '\u2306', 'DoubleContourIntegral;': '\u222f', 'DoubleDot;': '\xa8', 'DoubleDownArrow;': '\u21d3', 'DoubleLeftArrow;': '\u21d0', 'DoubleLeftRightArrow;': '\u21d4', 'DoubleLeftTee;': '\u2ae4', 'DoubleLongLeftArrow;': '\u27f8', 'DoubleLongLeftRightArrow;': '\u27fa', 'DoubleLongRightArrow;': '\u27f9', 'DoubleRightArrow;': '\u21d2', 'DoubleRightTee;': '\u22a8', 'DoubleUpArrow;': '\u21d1', 'DoubleUpDownArrow;': '\u21d5', 'DoubleVerticalBar;': '\u2225', 'DownArrow;': '\u2193', 'Downarrow;': '\u21d3', 'downarrow;': '\u2193', 'DownArrowBar;': '\u2913', 'DownArrowUpArrow;': '\u21f5', 'DownBreve;': '\u0311', 'downdownarrows;': '\u21ca', 'downharpoonleft;': '\u21c3', 'downharpoonright;': '\u21c2', 'DownLeftRightVector;': '\u2950', 'DownLeftTeeVector;': '\u295e', 'DownLeftVector;': '\u21bd', 'DownLeftVectorBar;': '\u2956', 'DownRightTeeVector;': '\u295f', 'DownRightVector;': '\u21c1', 'DownRightVectorBar;': '\u2957', 'DownTee;': '\u22a4', 'DownTeeArrow;': '\u21a7', 'drbkarow;': '\u2910', 'drcorn;': '\u231f', 'drcrop;': '\u230c', 'Dscr;': '\U0001d49f', 'dscr;': '\U0001d4b9', 'DScy;': '\u0405', 'dscy;': '\u0455', 'dsol;': '\u29f6', 'Dstrok;': '\u0110', 'dstrok;': '\u0111', 'dtdot;': '\u22f1', 'dtri;': '\u25bf', 'dtrif;': '\u25be', 'duarr;': '\u21f5', 'duhar;': '\u296f', 'dwangle;': '\u29a6', 'DZcy;': '\u040f', 'dzcy;': '\u045f', 'dzigrarr;': '\u27ff', 'Eacute': '\xc9', 'eacute': '\xe9', 'Eacute;': '\xc9', 'eacute;': '\xe9', 'easter;': '\u2a6e', 'Ecaron;': '\u011a', 'ecaron;': '\u011b', 'ecir;': '\u2256', 'Ecirc': '\xca', 'ecirc': '\xea', 'Ecirc;': '\xca', 'ecirc;': '\xea', 'ecolon;': '\u2255', 'Ecy;': '\u042d', 'ecy;': '\u044d', 'eDDot;': '\u2a77', 'Edot;': '\u0116', 'eDot;': '\u2251', 'edot;': '\u0117', 'ee;': '\u2147', 'efDot;': '\u2252', 'Efr;': '\U0001d508', 'efr;': '\U0001d522', 'eg;': '\u2a9a', 'Egrave': '\xc8', 'egrave': '\xe8', 'Egrave;': '\xc8', 'egrave;': '\xe8', 'egs;': '\u2a96', 'egsdot;': '\u2a98', 'el;': '\u2a99', 'Element;': '\u2208', 'elinters;': '\u23e7', 'ell;': '\u2113', 'els;': '\u2a95', 'elsdot;': '\u2a97', 'Emacr;': '\u0112', 'emacr;': '\u0113', 'empty;': '\u2205', 'emptyset;': '\u2205', 'EmptySmallSquare;': '\u25fb', 'emptyv;': '\u2205', 'EmptyVerySmallSquare;': '\u25ab', 'emsp13;': '\u2004', 'emsp14;': '\u2005', 'emsp;': '\u2003', 'ENG;': '\u014a', 'eng;': '\u014b', 'ensp;': '\u2002', 'Eogon;': '\u0118', 'eogon;': '\u0119', 'Eopf;': '\U0001d53c', 'eopf;': '\U0001d556', 'epar;': '\u22d5', 'eparsl;': '\u29e3', 'eplus;': '\u2a71', 'epsi;': '\u03b5', 'Epsilon;': '\u0395', 'epsilon;': '\u03b5', 'epsiv;': '\u03f5', 'eqcirc;': '\u2256', 'eqcolon;': '\u2255', 'eqsim;': '\u2242', 'eqslantgtr;': '\u2a96', 'eqslantless;': '\u2a95', 'Equal;': '\u2a75', 'equals;': '=', 'EqualTilde;': '\u2242', 'equest;': '\u225f', 'Equilibrium;': '\u21cc', 'equiv;': '\u2261', 'equivDD;': '\u2a78', 'eqvparsl;': '\u29e5', 'erarr;': '\u2971', 'erDot;': '\u2253', 'Escr;': '\u2130', 'escr;': '\u212f', 'esdot;': '\u2250', 'Esim;': '\u2a73', 'esim;': '\u2242', 'Eta;': '\u0397', 'eta;': '\u03b7', 'ETH': '\xd0', 'eth': '\xf0', 'ETH;': '\xd0', 'eth;': '\xf0', 'Euml': '\xcb', 'euml': '\xeb', 'Euml;': '\xcb', 'euml;': '\xeb', 'euro;': '\u20ac', 'excl;': '!', 'exist;': '\u2203', 'Exists;': '\u2203', 'expectation;': '\u2130', 'ExponentialE;': '\u2147', 'exponentiale;': '\u2147', 'fallingdotseq;': '\u2252', 'Fcy;': '\u0424', 'fcy;': '\u0444', 'female;': '\u2640', 'ffilig;': '\ufb03', 'fflig;': '\ufb00', 'ffllig;': '\ufb04', 'Ffr;': '\U0001d509', 'ffr;': '\U0001d523', 'filig;': '\ufb01', 'FilledSmallSquare;': '\u25fc', 'FilledVerySmallSquare;': '\u25aa', 'fjlig;': 'fj', 'flat;': '\u266d', 'fllig;': '\ufb02', 'fltns;': '\u25b1', 'fnof;': '\u0192', 'Fopf;': '\U0001d53d', 'fopf;': '\U0001d557', 'ForAll;': '\u2200', 'forall;': '\u2200', 'fork;': '\u22d4', 'forkv;': '\u2ad9', 'Fouriertrf;': '\u2131', 'fpartint;': '\u2a0d', 'frac12': '\xbd', 'frac12;': '\xbd', 'frac13;': '\u2153', 'frac14': '\xbc', 'frac14;': '\xbc', 'frac15;': '\u2155', 'frac16;': '\u2159', 'frac18;': '\u215b', 'frac23;': '\u2154', 'frac25;': '\u2156', 'frac34': '\xbe', 'frac34;': '\xbe', 'frac35;': '\u2157', 'frac38;': '\u215c', 'frac45;': '\u2158', 'frac56;': '\u215a', 'frac58;': '\u215d', 'frac78;': '\u215e', 'frasl;': '\u2044', 'frown;': '\u2322', 'Fscr;': '\u2131', 'fscr;': '\U0001d4bb', 'gacute;': '\u01f5', 'Gamma;': '\u0393', 'gamma;': '\u03b3', 'Gammad;': '\u03dc', 'gammad;': '\u03dd', 'gap;': '\u2a86', 'Gbreve;': '\u011e', 'gbreve;': '\u011f', 'Gcedil;': '\u0122', 'Gcirc;': '\u011c', 'gcirc;': '\u011d', 'Gcy;': '\u0413', 'gcy;': '\u0433', 'Gdot;': '\u0120', 'gdot;': '\u0121', 'gE;': '\u2267', 'ge;': '\u2265', 'gEl;': '\u2a8c', 'gel;': '\u22db', 'geq;': '\u2265', 'geqq;': '\u2267', 'geqslant;': '\u2a7e', 'ges;': '\u2a7e', 'gescc;': '\u2aa9', 'gesdot;': '\u2a80', 'gesdoto;': '\u2a82', 'gesdotol;': '\u2a84', 'gesl;': '\u22db\ufe00', 'gesles;': '\u2a94', 'Gfr;': '\U0001d50a', 'gfr;': '\U0001d524', 'Gg;': '\u22d9', 'gg;': '\u226b', 'ggg;': '\u22d9', 'gimel;': '\u2137', 'GJcy;': '\u0403', 'gjcy;': '\u0453', 'gl;': '\u2277', 'gla;': '\u2aa5', 'glE;': '\u2a92', 'glj;': '\u2aa4', 'gnap;': '\u2a8a', 'gnapprox;': '\u2a8a', 'gnE;': '\u2269', 'gne;': '\u2a88', 'gneq;': '\u2a88', 'gneqq;': '\u2269', 'gnsim;': '\u22e7', 'Gopf;': '\U0001d53e', 'gopf;': '\U0001d558', 'grave;': '`', 'GreaterEqual;': '\u2265', 'GreaterEqualLess;': '\u22db', 'GreaterFullEqual;': '\u2267', 'GreaterGreater;': '\u2aa2', 'GreaterLess;': '\u2277', 'GreaterSlantEqual;': '\u2a7e', 'GreaterTilde;': '\u2273', 'Gscr;': '\U0001d4a2', 'gscr;': '\u210a', 'gsim;': '\u2273', 'gsime;': '\u2a8e', 'gsiml;': '\u2a90', 'GT': '>', 'gt': '>', 'GT;': '>', 'Gt;': '\u226b', 'gt;': '>', 'gtcc;': '\u2aa7', 'gtcir;': '\u2a7a', 'gtdot;': '\u22d7', 'gtlPar;': '\u2995', 'gtquest;': '\u2a7c', 'gtrapprox;': '\u2a86', 'gtrarr;': '\u2978', 'gtrdot;': '\u22d7', 'gtreqless;': '\u22db', 'gtreqqless;': '\u2a8c', 'gtrless;': '\u2277', 'gtrsim;': '\u2273', 'gvertneqq;': '\u2269\ufe00', 'gvnE;': '\u2269\ufe00', 'Hacek;': '\u02c7', 'hairsp;': '\u200a', 'half;': '\xbd', 'hamilt;': '\u210b', 'HARDcy;': '\u042a', 'hardcy;': '\u044a', 'hArr;': '\u21d4', 'harr;': '\u2194', 'harrcir;': '\u2948', 'harrw;': '\u21ad', 'Hat;': '^', 'hbar;': '\u210f', 'Hcirc;': '\u0124', 'hcirc;': '\u0125', 'hearts;': '\u2665', 'heartsuit;': '\u2665', 'hellip;': '\u2026', 'hercon;': '\u22b9', 'Hfr;': '\u210c', 'hfr;': '\U0001d525', 'HilbertSpace;': '\u210b', 'hksearow;': '\u2925', 'hkswarow;': '\u2926', 'hoarr;': '\u21ff', 'homtht;': '\u223b', 'hookleftarrow;': '\u21a9', 'hookrightarrow;': '\u21aa', 'Hopf;': '\u210d', 'hopf;': '\U0001d559', 'horbar;': '\u2015', 'HorizontalLine;': '\u2500', 'Hscr;': '\u210b', 'hscr;': '\U0001d4bd', 'hslash;': '\u210f', 'Hstrok;': '\u0126', 'hstrok;': '\u0127', 'HumpDownHump;': '\u224e', 'HumpEqual;': '\u224f', 'hybull;': '\u2043', 'hyphen;': '\u2010', 'Iacute': '\xcd', 'iacute': '\xed', 'Iacute;': '\xcd', 'iacute;': '\xed', 'ic;': '\u2063', 'Icirc': '\xce', 'icirc': '\xee', 'Icirc;': '\xce', 'icirc;': '\xee', 'Icy;': '\u0418', 'icy;': '\u0438', 'Idot;': '\u0130', 'IEcy;': '\u0415', 'iecy;': '\u0435', 'iexcl': '\xa1', 'iexcl;': '\xa1', 'iff;': '\u21d4', 'Ifr;': '\u2111', 'ifr;': '\U0001d526', 'Igrave': '\xcc', 'igrave': '\xec', 'Igrave;': '\xcc', 'igrave;': '\xec', 'ii;': '\u2148', 'iiiint;': '\u2a0c', 'iiint;': '\u222d', 'iinfin;': '\u29dc', 'iiota;': '\u2129', 'IJlig;': '\u0132', 'ijlig;': '\u0133', 'Im;': '\u2111', 'Imacr;': '\u012a', 'imacr;': '\u012b', 'image;': '\u2111', 'ImaginaryI;': '\u2148', 'imagline;': '\u2110', 'imagpart;': '\u2111', 'imath;': '\u0131', 'imof;': '\u22b7', 'imped;': '\u01b5', 'Implies;': '\u21d2', 'in;': '\u2208', 'incare;': '\u2105', 'infin;': '\u221e', 'infintie;': '\u29dd', 'inodot;': '\u0131', 'Int;': '\u222c', 'int;': '\u222b', 'intcal;': '\u22ba', 'integers;': '\u2124', 'Integral;': '\u222b', 'intercal;': '\u22ba', 'Intersection;': '\u22c2', 'intlarhk;': '\u2a17', 'intprod;': '\u2a3c', 'InvisibleComma;': '\u2063', 'InvisibleTimes;': '\u2062', 'IOcy;': '\u0401', 'iocy;': '\u0451', 'Iogon;': '\u012e', 'iogon;': '\u012f', 'Iopf;': '\U0001d540', 'iopf;': '\U0001d55a', 'Iota;': '\u0399', 'iota;': '\u03b9', 'iprod;': '\u2a3c', 'iquest': '\xbf', 'iquest;': '\xbf', 'Iscr;': '\u2110', 'iscr;': '\U0001d4be', 'isin;': '\u2208', 'isindot;': '\u22f5', 'isinE;': '\u22f9', 'isins;': '\u22f4', 'isinsv;': '\u22f3', 'isinv;': '\u2208', 'it;': '\u2062', 'Itilde;': '\u0128', 'itilde;': '\u0129', 'Iukcy;': '\u0406', 'iukcy;': '\u0456', 'Iuml': '\xcf', 'iuml': '\xef', 'Iuml;': '\xcf', 'iuml;': '\xef', 'Jcirc;': '\u0134', 'jcirc;': '\u0135', 'Jcy;': '\u0419', 'jcy;': '\u0439', 'Jfr;': '\U0001d50d', 'jfr;': '\U0001d527', 'jmath;': '\u0237', 'Jopf;': '\U0001d541', 'jopf;': '\U0001d55b', 'Jscr;': '\U0001d4a5', 'jscr;': '\U0001d4bf', 'Jsercy;': '\u0408', 'jsercy;': '\u0458', 'Jukcy;': '\u0404', 'jukcy;': '\u0454', 'Kappa;': '\u039a', 'kappa;': '\u03ba', 'kappav;': '\u03f0', 'Kcedil;': '\u0136', 'kcedil;': '\u0137', 'Kcy;': '\u041a', 'kcy;': '\u043a', 'Kfr;': '\U0001d50e', 'kfr;': '\U0001d528', 'kgreen;': '\u0138', 'KHcy;': '\u0425', 'khcy;': '\u0445', 'KJcy;': '\u040c', 'kjcy;': '\u045c', 'Kopf;': '\U0001d542', 'kopf;': '\U0001d55c', 'Kscr;': '\U0001d4a6', 'kscr;': '\U0001d4c0', 'lAarr;': '\u21da', 'Lacute;': '\u0139', 'lacute;': '\u013a', 'laemptyv;': '\u29b4', 'lagran;': '\u2112', 'Lambda;': '\u039b', 'lambda;': '\u03bb', 'Lang;': '\u27ea', 'lang;': '\u27e8', 'langd;': '\u2991', 'langle;': '\u27e8', 'lap;': '\u2a85', 'Laplacetrf;': '\u2112', 'laquo': '\xab', 'laquo;': '\xab', 'Larr;': '\u219e', 'lArr;': '\u21d0', 'larr;': '\u2190', 'larrb;': '\u21e4', 'larrbfs;': '\u291f', 'larrfs;': '\u291d', 'larrhk;': '\u21a9', 'larrlp;': '\u21ab', 'larrpl;': '\u2939', 'larrsim;': '\u2973', 'larrtl;': '\u21a2', 'lat;': '\u2aab', 'lAtail;': '\u291b', 'latail;': '\u2919', 'late;': '\u2aad', 'lates;': '\u2aad\ufe00', 'lBarr;': '\u290e', 'lbarr;': '\u290c', 'lbbrk;': '\u2772', 'lbrace;': '{', 'lbrack;': '[', 'lbrke;': '\u298b', 'lbrksld;': '\u298f', 'lbrkslu;': '\u298d', 'Lcaron;': '\u013d', 'lcaron;': '\u013e', 'Lcedil;': '\u013b', 'lcedil;': '\u013c', 'lceil;': '\u2308', 'lcub;': '{', 'Lcy;': '\u041b', 'lcy;': '\u043b', 'ldca;': '\u2936', 'ldquo;': '\u201c', 'ldquor;': '\u201e', 'ldrdhar;': '\u2967', 'ldrushar;': '\u294b', 'ldsh;': '\u21b2', 'lE;': '\u2266', 'le;': '\u2264', 'LeftAngleBracket;': '\u27e8', 'LeftArrow;': '\u2190', 'Leftarrow;': '\u21d0', 'leftarrow;': '\u2190', 'LeftArrowBar;': '\u21e4', 'LeftArrowRightArrow;': '\u21c6', 'leftarrowtail;': '\u21a2', 'LeftCeiling;': '\u2308', 'LeftDoubleBracket;': '\u27e6', 'LeftDownTeeVector;': '\u2961', 'LeftDownVector;': '\u21c3', 'LeftDownVectorBar;': '\u2959', 'LeftFloor;': '\u230a', 'leftharpoondown;': '\u21bd', 'leftharpoonup;': '\u21bc', 'leftleftarrows;': '\u21c7', 'LeftRightArrow;': '\u2194', 'Leftrightarrow;': '\u21d4', 'leftrightarrow;': '\u2194', 'leftrightarrows;': '\u21c6', 'leftrightharpoons;': '\u21cb', 'leftrightsquigarrow;': '\u21ad', 'LeftRightVector;': '\u294e', 'LeftTee;': '\u22a3', 'LeftTeeArrow;': '\u21a4', 'LeftTeeVector;': '\u295a', 'leftthreetimes;': '\u22cb', 'LeftTriangle;': '\u22b2', 'LeftTriangleBar;': '\u29cf', 'LeftTriangleEqual;': '\u22b4', 'LeftUpDownVector;': '\u2951', 'LeftUpTeeVector;': '\u2960', 'LeftUpVector;': '\u21bf', 'LeftUpVectorBar;': '\u2958', 'LeftVector;': '\u21bc', 'LeftVectorBar;': '\u2952', 'lEg;': '\u2a8b', 'leg;': '\u22da', 'leq;': '\u2264', 'leqq;': '\u2266', 'leqslant;': '\u2a7d', 'les;': '\u2a7d', 'lescc;': '\u2aa8', 'lesdot;': '\u2a7f', 'lesdoto;': '\u2a81', 'lesdotor;': '\u2a83', 'lesg;': '\u22da\ufe00', 'lesges;': '\u2a93', 'lessapprox;': '\u2a85', 'lessdot;': '\u22d6', 'lesseqgtr;': '\u22da', 'lesseqqgtr;': '\u2a8b', 'LessEqualGreater;': '\u22da', 'LessFullEqual;': '\u2266', 'LessGreater;': '\u2276', 'lessgtr;': '\u2276', 'LessLess;': '\u2aa1', 'lesssim;': '\u2272', 'LessSlantEqual;': '\u2a7d', 'LessTilde;': '\u2272', 'lfisht;': '\u297c', 'lfloor;': '\u230a', 'Lfr;': '\U0001d50f', 'lfr;': '\U0001d529', 'lg;': '\u2276', 'lgE;': '\u2a91', 'lHar;': '\u2962', 'lhard;': '\u21bd', 'lharu;': '\u21bc', 'lharul;': '\u296a', 'lhblk;': '\u2584', 'LJcy;': '\u0409', 'ljcy;': '\u0459', 'Ll;': '\u22d8', 'll;': '\u226a', 'llarr;': '\u21c7', 'llcorner;': '\u231e', 'Lleftarrow;': '\u21da', 'llhard;': '\u296b', 'lltri;': '\u25fa', 'Lmidot;': '\u013f', 'lmidot;': '\u0140', 'lmoust;': '\u23b0', 'lmoustache;': '\u23b0', 'lnap;': '\u2a89', 'lnapprox;': '\u2a89', 'lnE;': '\u2268', 'lne;': '\u2a87', 'lneq;': '\u2a87', 'lneqq;': '\u2268', 'lnsim;': '\u22e6', 'loang;': '\u27ec', 'loarr;': '\u21fd', 'lobrk;': '\u27e6', 'LongLeftArrow;': '\u27f5', 'Longleftarrow;': '\u27f8', 'longleftarrow;': '\u27f5', 'LongLeftRightArrow;': '\u27f7', 'Longleftrightarrow;': '\u27fa', 'longleftrightarrow;': '\u27f7', 'longmapsto;': '\u27fc', 'LongRightArrow;': '\u27f6', 'Longrightarrow;': '\u27f9', 'longrightarrow;': '\u27f6', 'looparrowleft;': '\u21ab', 'looparrowright;': '\u21ac', 'lopar;': '\u2985', 'Lopf;': '\U0001d543', 'lopf;': '\U0001d55d', 'loplus;': '\u2a2d', 'lotimes;': '\u2a34', 'lowast;': '\u2217', 'lowbar;': '_', 'LowerLeftArrow;': '\u2199', 'LowerRightArrow;': '\u2198', 'loz;': '\u25ca', 'lozenge;': '\u25ca', 'lozf;': '\u29eb', 'lpar;': '(', 'lparlt;': '\u2993', 'lrarr;': '\u21c6', 'lrcorner;': '\u231f', 'lrhar;': '\u21cb', 'lrhard;': '\u296d', 'lrm;': '\u200e', 'lrtri;': '\u22bf', 'lsaquo;': '\u2039', 'Lscr;': '\u2112', 'lscr;': '\U0001d4c1', 'Lsh;': '\u21b0', 'lsh;': '\u21b0', 'lsim;': '\u2272', 'lsime;': '\u2a8d', 'lsimg;': '\u2a8f', 'lsqb;': '[', 'lsquo;': '\u2018', 'lsquor;': '\u201a', 'Lstrok;': '\u0141', 'lstrok;': '\u0142', 'LT': '<', 'lt': '<', 'LT;': '<', 'Lt;': '\u226a', 'lt;': '<', 'ltcc;': '\u2aa6', 'ltcir;': '\u2a79', 'ltdot;': '\u22d6', 'lthree;': '\u22cb', 'ltimes;': '\u22c9', 'ltlarr;': '\u2976', 'ltquest;': '\u2a7b', 'ltri;': '\u25c3', 'ltrie;': '\u22b4', 'ltrif;': '\u25c2', 'ltrPar;': '\u2996', 'lurdshar;': '\u294a', 'luruhar;': '\u2966', 'lvertneqq;': '\u2268\ufe00', 'lvnE;': '\u2268\ufe00', 'macr': '\xaf', 'macr;': '\xaf', 'male;': '\u2642', 'malt;': '\u2720', 'maltese;': '\u2720', 'Map;': '\u2905', 'map;': '\u21a6', 'mapsto;': '\u21a6', 'mapstodown;': '\u21a7', 'mapstoleft;': '\u21a4', 'mapstoup;': '\u21a5', 'marker;': '\u25ae', 'mcomma;': '\u2a29', 'Mcy;': '\u041c', 'mcy;': '\u043c', 'mdash;': '\u2014', 'mDDot;': '\u223a', 'measuredangle;': '\u2221', 'MediumSpace;': '\u205f', 'Mellintrf;': '\u2133', 'Mfr;': '\U0001d510', 'mfr;': '\U0001d52a', 'mho;': '\u2127', 'micro': '\xb5', 'micro;': '\xb5', 'mid;': '\u2223', 'midast;': '*', 'midcir;': '\u2af0', 'middot': '\xb7', 'middot;': '\xb7', 'minus;': '\u2212', 'minusb;': '\u229f', 'minusd;': '\u2238', 'minusdu;': '\u2a2a', 'MinusPlus;': '\u2213', 'mlcp;': '\u2adb', 'mldr;': '\u2026', 'mnplus;': '\u2213', 'models;': '\u22a7', 'Mopf;': '\U0001d544', 'mopf;': '\U0001d55e', 'mp;': '\u2213', 'Mscr;': '\u2133', 'mscr;': '\U0001d4c2', 'mstpos;': '\u223e', 'Mu;': '\u039c', 'mu;': '\u03bc', 'multimap;': '\u22b8', 'mumap;': '\u22b8', 'nabla;': '\u2207', 'Nacute;': '\u0143', 'nacute;': '\u0144', 'nang;': '\u2220\u20d2', 'nap;': '\u2249', 'napE;': '\u2a70\u0338', 'napid;': '\u224b\u0338', 'napos;': '\u0149', 'napprox;': '\u2249', 'natur;': '\u266e', 'natural;': '\u266e', 'naturals;': '\u2115', 'nbsp': '\xa0', 'nbsp;': '\xa0', 'nbump;': '\u224e\u0338', 'nbumpe;': '\u224f\u0338', 'ncap;': '\u2a43', 'Ncaron;': '\u0147', 'ncaron;': '\u0148', 'Ncedil;': '\u0145', 'ncedil;': '\u0146', 'ncong;': '\u2247', 'ncongdot;': '\u2a6d\u0338', 'ncup;': '\u2a42', 'Ncy;': '\u041d', 'ncy;': '\u043d', 'ndash;': '\u2013', 'ne;': '\u2260', 'nearhk;': '\u2924', 'neArr;': '\u21d7', 'nearr;': '\u2197', 'nearrow;': '\u2197', 'nedot;': '\u2250\u0338', 'NegativeMediumSpace;': '\u200b', 'NegativeThickSpace;': '\u200b', 'NegativeThinSpace;': '\u200b', 'NegativeVeryThinSpace;': '\u200b', 'nequiv;': '\u2262', 'nesear;': '\u2928', 'nesim;': '\u2242\u0338', 'NestedGreaterGreater;': '\u226b', 'NestedLessLess;': '\u226a', 'NewLine;': '\n', 'nexist;': '\u2204', 'nexists;': '\u2204', 'Nfr;': '\U0001d511', 'nfr;': '\U0001d52b', 'ngE;': '\u2267\u0338', 'nge;': '\u2271', 'ngeq;': '\u2271', 'ngeqq;': '\u2267\u0338', 'ngeqslant;': '\u2a7e\u0338', 'nges;': '\u2a7e\u0338', 'nGg;': '\u22d9\u0338', 'ngsim;': '\u2275', 'nGt;': '\u226b\u20d2', 'ngt;': '\u226f', 'ngtr;': '\u226f', 'nGtv;': '\u226b\u0338', 'nhArr;': '\u21ce', 'nharr;': '\u21ae', 'nhpar;': '\u2af2', 'ni;': '\u220b', 'nis;': '\u22fc', 'nisd;': '\u22fa', 'niv;': '\u220b', 'NJcy;': '\u040a', 'njcy;': '\u045a', 'nlArr;': '\u21cd', 'nlarr;': '\u219a', 'nldr;': '\u2025', 'nlE;': '\u2266\u0338', 'nle;': '\u2270', 'nLeftarrow;': '\u21cd', 'nleftarrow;': '\u219a', 'nLeftrightarrow;': '\u21ce', 'nleftrightarrow;': '\u21ae', 'nleq;': '\u2270', 'nleqq;': '\u2266\u0338', 'nleqslant;': '\u2a7d\u0338', 'nles;': '\u2a7d\u0338', 'nless;': '\u226e', 'nLl;': '\u22d8\u0338', 'nlsim;': '\u2274', 'nLt;': '\u226a\u20d2', 'nlt;': '\u226e', 'nltri;': '\u22ea', 'nltrie;': '\u22ec', 'nLtv;': '\u226a\u0338', 'nmid;': '\u2224', 'NoBreak;': '\u2060', 'NonBreakingSpace;': '\xa0', 'Nopf;': '\u2115', 'nopf;': '\U0001d55f', 'not': '\xac', 'Not;': '\u2aec', 'not;': '\xac', 'NotCongruent;': '\u2262', 'NotCupCap;': '\u226d', 'NotDoubleVerticalBar;': '\u2226', 'NotElement;': '\u2209', 'NotEqual;': '\u2260', 'NotEqualTilde;': '\u2242\u0338', 'NotExists;': '\u2204', 'NotGreater;': '\u226f', 'NotGreaterEqual;': '\u2271', 'NotGreaterFullEqual;': '\u2267\u0338', 'NotGreaterGreater;': '\u226b\u0338', 'NotGreaterLess;': '\u2279', 'NotGreaterSlantEqual;': '\u2a7e\u0338', 'NotGreaterTilde;': '\u2275', 'NotHumpDownHump;': '\u224e\u0338', 'NotHumpEqual;': '\u224f\u0338', 'notin;': '\u2209', 'notindot;': '\u22f5\u0338', 'notinE;': '\u22f9\u0338', 'notinva;': '\u2209', 'notinvb;': '\u22f7', 'notinvc;': '\u22f6', 'NotLeftTriangle;': '\u22ea', 'NotLeftTriangleBar;': '\u29cf\u0338', 'NotLeftTriangleEqual;': '\u22ec', 'NotLess;': '\u226e', 'NotLessEqual;': '\u2270', 'NotLessGreater;': '\u2278', 'NotLessLess;': '\u226a\u0338', 'NotLessSlantEqual;': '\u2a7d\u0338', 'NotLessTilde;': '\u2274', 'NotNestedGreaterGreater;': '\u2aa2\u0338', 'NotNestedLessLess;': '\u2aa1\u0338', 'notni;': '\u220c', 'notniva;': '\u220c', 'notnivb;': '\u22fe', 'notnivc;': '\u22fd', 'NotPrecedes;': '\u2280', 'NotPrecedesEqual;': '\u2aaf\u0338', 'NotPrecedesSlantEqual;': '\u22e0', 'NotReverseElement;': '\u220c', 'NotRightTriangle;': '\u22eb', 'NotRightTriangleBar;': '\u29d0\u0338', 'NotRightTriangleEqual;': '\u22ed', 'NotSquareSubset;': '\u228f\u0338', 'NotSquareSubsetEqual;': '\u22e2', 'NotSquareSuperset;': '\u2290\u0338', 'NotSquareSupersetEqual;': '\u22e3', 'NotSubset;': '\u2282\u20d2', 'NotSubsetEqual;': '\u2288', 'NotSucceeds;': '\u2281', 'NotSucceedsEqual;': '\u2ab0\u0338', 'NotSucceedsSlantEqual;': '\u22e1', 'NotSucceedsTilde;': '\u227f\u0338', 'NotSuperset;': '\u2283\u20d2', 'NotSupersetEqual;': '\u2289', 'NotTilde;': '\u2241', 'NotTildeEqual;': '\u2244', 'NotTildeFullEqual;': '\u2247', 'NotTildeTilde;': '\u2249', 'NotVerticalBar;': '\u2224', 'npar;': '\u2226', 'nparallel;': '\u2226', 'nparsl;': '\u2afd\u20e5', 'npart;': '\u2202\u0338', 'npolint;': '\u2a14', 'npr;': '\u2280', 'nprcue;': '\u22e0', 'npre;': '\u2aaf\u0338', 'nprec;': '\u2280', 'npreceq;': '\u2aaf\u0338', 'nrArr;': '\u21cf', 'nrarr;': '\u219b', 'nrarrc;': '\u2933\u0338', 'nrarrw;': '\u219d\u0338', 'nRightarrow;': '\u21cf', 'nrightarrow;': '\u219b', 'nrtri;': '\u22eb', 'nrtrie;': '\u22ed', 'nsc;': '\u2281', 'nsccue;': '\u22e1', 'nsce;': '\u2ab0\u0338', 'Nscr;': '\U0001d4a9', 'nscr;': '\U0001d4c3', 'nshortmid;': '\u2224', 'nshortparallel;': '\u2226', 'nsim;': '\u2241', 'nsime;': '\u2244', 'nsimeq;': '\u2244', 'nsmid;': '\u2224', 'nspar;': '\u2226', 'nsqsube;': '\u22e2', 'nsqsupe;': '\u22e3', 'nsub;': '\u2284', 'nsubE;': '\u2ac5\u0338', 'nsube;': '\u2288', 'nsubset;': '\u2282\u20d2', 'nsubseteq;': '\u2288', 'nsubseteqq;': '\u2ac5\u0338', 'nsucc;': '\u2281', 'nsucceq;': '\u2ab0\u0338', 'nsup;': '\u2285', 'nsupE;': '\u2ac6\u0338', 'nsupe;': '\u2289', 'nsupset;': '\u2283\u20d2', 'nsupseteq;': '\u2289', 'nsupseteqq;': '\u2ac6\u0338', 'ntgl;': '\u2279', 'Ntilde': '\xd1', 'ntilde': '\xf1', 'Ntilde;': '\xd1', 'ntilde;': '\xf1', 'ntlg;': '\u2278', 'ntriangleleft;': '\u22ea', 'ntrianglelefteq;': '\u22ec', 'ntriangleright;': '\u22eb', 'ntrianglerighteq;': '\u22ed', 'Nu;': '\u039d', 'nu;': '\u03bd', 'num;': '#', 'numero;': '\u2116', 'numsp;': '\u2007', 'nvap;': '\u224d\u20d2', 'nVDash;': '\u22af', 'nVdash;': '\u22ae', 'nvDash;': '\u22ad', 'nvdash;': '\u22ac', 'nvge;': '\u2265\u20d2', 'nvgt;': '>\u20d2', 'nvHarr;': '\u2904', 'nvinfin;': '\u29de', 'nvlArr;': '\u2902', 'nvle;': '\u2264\u20d2', 'nvlt;': '<\u20d2', 'nvltrie;': '\u22b4\u20d2', 'nvrArr;': '\u2903', 'nvrtrie;': '\u22b5\u20d2', 'nvsim;': '\u223c\u20d2', 'nwarhk;': '\u2923', 'nwArr;': '\u21d6', 'nwarr;': '\u2196', 'nwarrow;': '\u2196', 'nwnear;': '\u2927', 'Oacute': '\xd3', 'oacute': '\xf3', 'Oacute;': '\xd3', 'oacute;': '\xf3', 'oast;': '\u229b', 'ocir;': '\u229a', 'Ocirc': '\xd4', 'ocirc': '\xf4', 'Ocirc;': '\xd4', 'ocirc;': '\xf4', 'Ocy;': '\u041e', 'ocy;': '\u043e', 'odash;': '\u229d', 'Odblac;': '\u0150', 'odblac;': '\u0151', 'odiv;': '\u2a38', 'odot;': '\u2299', 'odsold;': '\u29bc', 'OElig;': '\u0152', 'oelig;': '\u0153', 'ofcir;': '\u29bf', 'Ofr;': '\U0001d512', 'ofr;': '\U0001d52c', 'ogon;': '\u02db', 'Ograve': '\xd2', 'ograve': '\xf2', 'Ograve;': '\xd2', 'ograve;': '\xf2', 'ogt;': '\u29c1', 'ohbar;': '\u29b5', 'ohm;': '\u03a9', 'oint;': '\u222e', 'olarr;': '\u21ba', 'olcir;': '\u29be', 'olcross;': '\u29bb', 'oline;': '\u203e', 'olt;': '\u29c0', 'Omacr;': '\u014c', 'omacr;': '\u014d', 'Omega;': '\u03a9', 'omega;': '\u03c9', 'Omicron;': '\u039f', 'omicron;': '\u03bf', 'omid;': '\u29b6', 'ominus;': '\u2296', 'Oopf;': '\U0001d546', 'oopf;': '\U0001d560', 'opar;': '\u29b7', 'OpenCurlyDoubleQuote;': '\u201c', 'OpenCurlyQuote;': '\u2018', 'operp;': '\u29b9', 'oplus;': '\u2295', 'Or;': '\u2a54', 'or;': '\u2228', 'orarr;': '\u21bb', 'ord;': '\u2a5d', 'order;': '\u2134', 'orderof;': '\u2134', 'ordf': '\xaa', 'ordf;': '\xaa', 'ordm': '\xba', 'ordm;': '\xba', 'origof;': '\u22b6', 'oror;': '\u2a56', 'orslope;': '\u2a57', 'orv;': '\u2a5b', 'oS;': '\u24c8', 'Oscr;': '\U0001d4aa', 'oscr;': '\u2134', 'Oslash': '\xd8', 'oslash': '\xf8', 'Oslash;': '\xd8', 'oslash;': '\xf8', 'osol;': '\u2298', 'Otilde': '\xd5', 'otilde': '\xf5', 'Otilde;': '\xd5', 'otilde;': '\xf5', 'Otimes;': '\u2a37', 'otimes;': '\u2297', 'otimesas;': '\u2a36', 'Ouml': '\xd6', 'ouml': '\xf6', 'Ouml;': '\xd6', 'ouml;': '\xf6', 'ovbar;': '\u233d', 'OverBar;': '\u203e', 'OverBrace;': '\u23de', 'OverBracket;': '\u23b4', 'OverParenthesis;': '\u23dc', 'par;': '\u2225', 'para': '\xb6', 'para;': '\xb6', 'parallel;': '\u2225', 'parsim;': '\u2af3', 'parsl;': '\u2afd', 'part;': '\u2202', 'PartialD;': '\u2202', 'Pcy;': '\u041f', 'pcy;': '\u043f', 'percnt;': '%', 'period;': '.', 'permil;': '\u2030', 'perp;': '\u22a5', 'pertenk;': '\u2031', 'Pfr;': '\U0001d513', 'pfr;': '\U0001d52d', 'Phi;': '\u03a6', 'phi;': '\u03c6', 'phiv;': '\u03d5', 'phmmat;': '\u2133', 'phone;': '\u260e', 'Pi;': '\u03a0', 'pi;': '\u03c0', 'pitchfork;': '\u22d4', 'piv;': '\u03d6', 'planck;': '\u210f', 'planckh;': '\u210e', 'plankv;': '\u210f', 'plus;': '+', 'plusacir;': '\u2a23', 'plusb;': '\u229e', 'pluscir;': '\u2a22', 'plusdo;': '\u2214', 'plusdu;': '\u2a25', 'pluse;': '\u2a72', 'PlusMinus;': '\xb1', 'plusmn': '\xb1', 'plusmn;': '\xb1', 'plussim;': '\u2a26', 'plustwo;': '\u2a27', 'pm;': '\xb1', 'Poincareplane;': '\u210c', 'pointint;': '\u2a15', 'Popf;': '\u2119', 'popf;': '\U0001d561', 'pound': '\xa3', 'pound;': '\xa3', 'Pr;': '\u2abb', 'pr;': '\u227a', 'prap;': '\u2ab7', 'prcue;': '\u227c', 'prE;': '\u2ab3', 'pre;': '\u2aaf', 'prec;': '\u227a', 'precapprox;': '\u2ab7', 'preccurlyeq;': '\u227c', 'Precedes;': '\u227a', 'PrecedesEqual;': '\u2aaf', 'PrecedesSlantEqual;': '\u227c', 'PrecedesTilde;': '\u227e', 'preceq;': '\u2aaf', 'precnapprox;': '\u2ab9', 'precneqq;': '\u2ab5', 'precnsim;': '\u22e8', 'precsim;': '\u227e', 'Prime;': '\u2033', 'prime;': '\u2032', 'primes;': '\u2119', 'prnap;': '\u2ab9', 'prnE;': '\u2ab5', 'prnsim;': '\u22e8', 'prod;': '\u220f', 'Product;': '\u220f', 'profalar;': '\u232e', 'profline;': '\u2312', 'profsurf;': '\u2313', 'prop;': '\u221d', 'Proportion;': '\u2237', 'Proportional;': '\u221d', 'propto;': '\u221d', 'prsim;': '\u227e', 'prurel;': '\u22b0', 'Pscr;': '\U0001d4ab', 'pscr;': '\U0001d4c5', 'Psi;': '\u03a8', 'psi;': '\u03c8', 'puncsp;': '\u2008', 'Qfr;': '\U0001d514', 'qfr;': '\U0001d52e', 'qint;': '\u2a0c', 'Qopf;': '\u211a', 'qopf;': '\U0001d562', 'qprime;': '\u2057', 'Qscr;': '\U0001d4ac', 'qscr;': '\U0001d4c6', 'quaternions;': '\u210d', 'quatint;': '\u2a16', 'quest;': '?', 'questeq;': '\u225f', 'QUOT': '"', 'quot': '"', 'QUOT;': '"', 'quot;': '"', 'rAarr;': '\u21db', 'race;': '\u223d\u0331', 'Racute;': '\u0154', 'racute;': '\u0155', 'radic;': '\u221a', 'raemptyv;': '\u29b3', 'Rang;': '\u27eb', 'rang;': '\u27e9', 'rangd;': '\u2992', 'range;': '\u29a5', 'rangle;': '\u27e9', 'raquo': '\xbb', 'raquo;': '\xbb', 'Rarr;': '\u21a0', 'rArr;': '\u21d2', 'rarr;': '\u2192', 'rarrap;': '\u2975', 'rarrb;': '\u21e5', 'rarrbfs;': '\u2920', 'rarrc;': '\u2933', 'rarrfs;': '\u291e', 'rarrhk;': '\u21aa', 'rarrlp;': '\u21ac', 'rarrpl;': '\u2945', 'rarrsim;': '\u2974', 'Rarrtl;': '\u2916', 'rarrtl;': '\u21a3', 'rarrw;': '\u219d', 'rAtail;': '\u291c', 'ratail;': '\u291a', 'ratio;': '\u2236', 'rationals;': '\u211a', 'RBarr;': '\u2910', 'rBarr;': '\u290f', 'rbarr;': '\u290d', 'rbbrk;': '\u2773', 'rbrace;': '}', 'rbrack;': ']', 'rbrke;': '\u298c', 'rbrksld;': '\u298e', 'rbrkslu;': '\u2990', 'Rcaron;': '\u0158', 'rcaron;': '\u0159', 'Rcedil;': '\u0156', 'rcedil;': '\u0157', 'rceil;': '\u2309', 'rcub;': '}', 'Rcy;': '\u0420', 'rcy;': '\u0440', 'rdca;': '\u2937', 'rdldhar;': '\u2969', 'rdquo;': '\u201d', 'rdquor;': '\u201d', 'rdsh;': '\u21b3', 'Re;': '\u211c', 'real;': '\u211c', 'realine;': '\u211b', 'realpart;': '\u211c', 'reals;': '\u211d', 'rect;': '\u25ad', 'REG': '\xae', 'reg': '\xae', 'REG;': '\xae', 'reg;': '\xae', 'ReverseElement;': '\u220b', 'ReverseEquilibrium;': '\u21cb', 'ReverseUpEquilibrium;': '\u296f', 'rfisht;': '\u297d', 'rfloor;': '\u230b', 'Rfr;': '\u211c', 'rfr;': '\U0001d52f', 'rHar;': '\u2964', 'rhard;': '\u21c1', 'rharu;': '\u21c0', 'rharul;': '\u296c', 'Rho;': '\u03a1', 'rho;': '\u03c1', 'rhov;': '\u03f1', 'RightAngleBracket;': '\u27e9', 'RightArrow;': '\u2192', 'Rightarrow;': '\u21d2', 'rightarrow;': '\u2192', 'RightArrowBar;': '\u21e5', 'RightArrowLeftArrow;': '\u21c4', 'rightarrowtail;': '\u21a3', 'RightCeiling;': '\u2309', 'RightDoubleBracket;': '\u27e7', 'RightDownTeeVector;': '\u295d', 'RightDownVector;': '\u21c2', 'RightDownVectorBar;': '\u2955', 'RightFloor;': '\u230b', 'rightharpoondown;': '\u21c1', 'rightharpoonup;': '\u21c0', 'rightleftarrows;': '\u21c4', 'rightleftharpoons;': '\u21cc', 'rightrightarrows;': '\u21c9', 'rightsquigarrow;': '\u219d', 'RightTee;': '\u22a2', 'RightTeeArrow;': '\u21a6', 'RightTeeVector;': '\u295b', 'rightthreetimes;': '\u22cc', 'RightTriangle;': '\u22b3', 'RightTriangleBar;': '\u29d0', 'RightTriangleEqual;': '\u22b5', 'RightUpDownVector;': '\u294f', 'RightUpTeeVector;': '\u295c', 'RightUpVector;': '\u21be', 'RightUpVectorBar;': '\u2954', 'RightVector;': '\u21c0', 'RightVectorBar;': '\u2953', 'ring;': '\u02da', 'risingdotseq;': '\u2253', 'rlarr;': '\u21c4', 'rlhar;': '\u21cc', 'rlm;': '\u200f', 'rmoust;': '\u23b1', 'rmoustache;': '\u23b1', 'rnmid;': '\u2aee', 'roang;': '\u27ed', 'roarr;': '\u21fe', 'robrk;': '\u27e7', 'ropar;': '\u2986', 'Ropf;': '\u211d', 'ropf;': '\U0001d563', 'roplus;': '\u2a2e', 'rotimes;': '\u2a35', 'RoundImplies;': '\u2970', 'rpar;': ')', 'rpargt;': '\u2994', 'rppolint;': '\u2a12', 'rrarr;': '\u21c9', 'Rrightarrow;': '\u21db', 'rsaquo;': '\u203a', 'Rscr;': '\u211b', 'rscr;': '\U0001d4c7', 'Rsh;': '\u21b1', 'rsh;': '\u21b1', 'rsqb;': ']', 'rsquo;': '\u2019', 'rsquor;': '\u2019', 'rthree;': '\u22cc', 'rtimes;': '\u22ca', 'rtri;': '\u25b9', 'rtrie;': '\u22b5', 'rtrif;': '\u25b8', 'rtriltri;': '\u29ce', 'RuleDelayed;': '\u29f4', 'ruluhar;': '\u2968', 'rx;': '\u211e', 'Sacute;': '\u015a', 'sacute;': '\u015b', 'sbquo;': '\u201a', 'Sc;': '\u2abc', 'sc;': '\u227b', 'scap;': '\u2ab8', 'Scaron;': '\u0160', 'scaron;': '\u0161', 'sccue;': '\u227d', 'scE;': '\u2ab4', 'sce;': '\u2ab0', 'Scedil;': '\u015e', 'scedil;': '\u015f', 'Scirc;': '\u015c', 'scirc;': '\u015d', 'scnap;': '\u2aba', 'scnE;': '\u2ab6', 'scnsim;': '\u22e9', 'scpolint;': '\u2a13', 'scsim;': '\u227f', 'Scy;': '\u0421', 'scy;': '\u0441', 'sdot;': '\u22c5', 'sdotb;': '\u22a1', 'sdote;': '\u2a66', 'searhk;': '\u2925', 'seArr;': '\u21d8', 'searr;': '\u2198', 'searrow;': '\u2198', 'sect': '\xa7', 'sect;': '\xa7', 'semi;': ';', 'seswar;': '\u2929', 'setminus;': '\u2216', 'setmn;': '\u2216', 'sext;': '\u2736', 'Sfr;': '\U0001d516', 'sfr;': '\U0001d530', 'sfrown;': '\u2322', 'sharp;': '\u266f', 'SHCHcy;': '\u0429', 'shchcy;': '\u0449', 'SHcy;': '\u0428', 'shcy;': '\u0448', 'ShortDownArrow;': '\u2193', 'ShortLeftArrow;': '\u2190', 'shortmid;': '\u2223', 'shortparallel;': '\u2225', 'ShortRightArrow;': '\u2192', 'ShortUpArrow;': '\u2191', 'shy': '\xad', 'shy;': '\xad', 'Sigma;': '\u03a3', 'sigma;': '\u03c3', 'sigmaf;': '\u03c2', 'sigmav;': '\u03c2', 'sim;': '\u223c', 'simdot;': '\u2a6a', 'sime;': '\u2243', 'simeq;': '\u2243', 'simg;': '\u2a9e', 'simgE;': '\u2aa0', 'siml;': '\u2a9d', 'simlE;': '\u2a9f', 'simne;': '\u2246', 'simplus;': '\u2a24', 'simrarr;': '\u2972', 'slarr;': '\u2190', 'SmallCircle;': '\u2218', 'smallsetminus;': '\u2216', 'smashp;': '\u2a33', 'smeparsl;': '\u29e4', 'smid;': '\u2223', 'smile;': '\u2323', 'smt;': '\u2aaa', 'smte;': '\u2aac', 'smtes;': '\u2aac\ufe00', 'SOFTcy;': '\u042c', 'softcy;': '\u044c', 'sol;': '/', 'solb;': '\u29c4', 'solbar;': '\u233f', 'Sopf;': '\U0001d54a', 'sopf;': '\U0001d564', 'spades;': '\u2660', 'spadesuit;': '\u2660', 'spar;': '\u2225', 'sqcap;': '\u2293', 'sqcaps;': '\u2293\ufe00', 'sqcup;': '\u2294', 'sqcups;': '\u2294\ufe00', 'Sqrt;': '\u221a', 'sqsub;': '\u228f', 'sqsube;': '\u2291', 'sqsubset;': '\u228f', 'sqsubseteq;': '\u2291', 'sqsup;': '\u2290', 'sqsupe;': '\u2292', 'sqsupset;': '\u2290', 'sqsupseteq;': '\u2292', 'squ;': '\u25a1', 'Square;': '\u25a1', 'square;': '\u25a1', 'SquareIntersection;': '\u2293', 'SquareSubset;': '\u228f', 'SquareSubsetEqual;': '\u2291', 'SquareSuperset;': '\u2290', 'SquareSupersetEqual;': '\u2292', 'SquareUnion;': '\u2294', 'squarf;': '\u25aa', 'squf;': '\u25aa', 'srarr;': '\u2192', 'Sscr;': '\U0001d4ae', 'sscr;': '\U0001d4c8', 'ssetmn;': '\u2216', 'ssmile;': '\u2323', 'sstarf;': '\u22c6', 'Star;': '\u22c6', 'star;': '\u2606', 'starf;': '\u2605', 'straightepsilon;': '\u03f5', 'straightphi;': '\u03d5', 'strns;': '\xaf', 'Sub;': '\u22d0', 'sub;': '\u2282', 'subdot;': '\u2abd', 'subE;': '\u2ac5', 'sube;': '\u2286', 'subedot;': '\u2ac3', 'submult;': '\u2ac1', 'subnE;': '\u2acb', 'subne;': '\u228a', 'subplus;': '\u2abf', 'subrarr;': '\u2979', 'Subset;': '\u22d0', 'subset;': '\u2282', 'subseteq;': '\u2286', 'subseteqq;': '\u2ac5', 'SubsetEqual;': '\u2286', 'subsetneq;': '\u228a', 'subsetneqq;': '\u2acb', 'subsim;': '\u2ac7', 'subsub;': '\u2ad5', 'subsup;': '\u2ad3', 'succ;': '\u227b', 'succapprox;': '\u2ab8', 'succcurlyeq;': '\u227d', 'Succeeds;': '\u227b', 'SucceedsEqual;': '\u2ab0', 'SucceedsSlantEqual;': '\u227d', 'SucceedsTilde;': '\u227f', 'succeq;': '\u2ab0', 'succnapprox;': '\u2aba', 'succneqq;': '\u2ab6', 'succnsim;': '\u22e9', 'succsim;': '\u227f', 'SuchThat;': '\u220b', 'Sum;': '\u2211', 'sum;': '\u2211', 'sung;': '\u266a', 'sup1': '\xb9', 'sup1;': '\xb9', 'sup2': '\xb2', 'sup2;': '\xb2', 'sup3': '\xb3', 'sup3;': '\xb3', 'Sup;': '\u22d1', 'sup;': '\u2283', 'supdot;': '\u2abe', 'supdsub;': '\u2ad8', 'supE;': '\u2ac6', 'supe;': '\u2287', 'supedot;': '\u2ac4', 'Superset;': '\u2283', 'SupersetEqual;': '\u2287', 'suphsol;': '\u27c9', 'suphsub;': '\u2ad7', 'suplarr;': '\u297b', 'supmult;': '\u2ac2', 'supnE;': '\u2acc', 'supne;': '\u228b', 'supplus;': '\u2ac0', 'Supset;': '\u22d1', 'supset;': '\u2283', 'supseteq;': '\u2287', 'supseteqq;': '\u2ac6', 'supsetneq;': '\u228b', 'supsetneqq;': '\u2acc', 'supsim;': '\u2ac8', 'supsub;': '\u2ad4', 'supsup;': '\u2ad6', 'swarhk;': '\u2926', 'swArr;': '\u21d9', 'swarr;': '\u2199', 'swarrow;': '\u2199', 'swnwar;': '\u292a', 'szlig': '\xdf', 'szlig;': '\xdf', 'Tab;': '\t', 'target;': '\u2316', 'Tau;': '\u03a4', 'tau;': '\u03c4', 'tbrk;': '\u23b4', 'Tcaron;': '\u0164', 'tcaron;': '\u0165', 'Tcedil;': '\u0162', 'tcedil;': '\u0163', 'Tcy;': '\u0422', 'tcy;': '\u0442', 'tdot;': '\u20db', 'telrec;': '\u2315', 'Tfr;': '\U0001d517', 'tfr;': '\U0001d531', 'there4;': '\u2234', 'Therefore;': '\u2234', 'therefore;': '\u2234', 'Theta;': '\u0398', 'theta;': '\u03b8', 'thetasym;': '\u03d1', 'thetav;': '\u03d1', 'thickapprox;': '\u2248', 'thicksim;': '\u223c', 'ThickSpace;': '\u205f\u200a', 'thinsp;': '\u2009', 'ThinSpace;': '\u2009', 'thkap;': '\u2248', 'thksim;': '\u223c', 'THORN': '\xde', 'thorn': '\xfe', 'THORN;': '\xde', 'thorn;': '\xfe', 'Tilde;': '\u223c', 'tilde;': '\u02dc', 'TildeEqual;': '\u2243', 'TildeFullEqual;': '\u2245', 'TildeTilde;': '\u2248', 'times': '\xd7', 'times;': '\xd7', 'timesb;': '\u22a0', 'timesbar;': '\u2a31', 'timesd;': '\u2a30', 'tint;': '\u222d', 'toea;': '\u2928', 'top;': '\u22a4', 'topbot;': '\u2336', 'topcir;': '\u2af1', 'Topf;': '\U0001d54b', 'topf;': '\U0001d565', 'topfork;': '\u2ada', 'tosa;': '\u2929', 'tprime;': '\u2034', 'TRADE;': '\u2122', 'trade;': '\u2122', 'triangle;': '\u25b5', 'triangledown;': '\u25bf', 'triangleleft;': '\u25c3', 'trianglelefteq;': '\u22b4', 'triangleq;': '\u225c', 'triangleright;': '\u25b9', 'trianglerighteq;': '\u22b5', 'tridot;': '\u25ec', 'trie;': '\u225c', 'triminus;': '\u2a3a', 'TripleDot;': '\u20db', 'triplus;': '\u2a39', 'trisb;': '\u29cd', 'tritime;': '\u2a3b', 'trpezium;': '\u23e2', 'Tscr;': '\U0001d4af', 'tscr;': '\U0001d4c9', 'TScy;': '\u0426', 'tscy;': '\u0446', 'TSHcy;': '\u040b', 'tshcy;': '\u045b', 'Tstrok;': '\u0166', 'tstrok;': '\u0167', 'twixt;': '\u226c', 'twoheadleftarrow;': '\u219e', 'twoheadrightarrow;': '\u21a0', 'Uacute': '\xda', 'uacute': '\xfa', 'Uacute;': '\xda', 'uacute;': '\xfa', 'Uarr;': '\u219f', 'uArr;': '\u21d1', 'uarr;': '\u2191', 'Uarrocir;': '\u2949', 'Ubrcy;': '\u040e', 'ubrcy;': '\u045e', 'Ubreve;': '\u016c', 'ubreve;': '\u016d', 'Ucirc': '\xdb', 'ucirc': '\xfb', 'Ucirc;': '\xdb', 'ucirc;': '\xfb', 'Ucy;': '\u0423', 'ucy;': '\u0443', 'udarr;': '\u21c5', 'Udblac;': '\u0170', 'udblac;': '\u0171', 'udhar;': '\u296e', 'ufisht;': '\u297e', 'Ufr;': '\U0001d518', 'ufr;': '\U0001d532', 'Ugrave': '\xd9', 'ugrave': '\xf9', 'Ugrave;': '\xd9', 'ugrave;': '\xf9', 'uHar;': '\u2963', 'uharl;': '\u21bf', 'uharr;': '\u21be', 'uhblk;': '\u2580', 'ulcorn;': '\u231c', 'ulcorner;': '\u231c', 'ulcrop;': '\u230f', 'ultri;': '\u25f8', 'Umacr;': '\u016a', 'umacr;': '\u016b', 'uml': '\xa8', 'uml;': '\xa8', 'UnderBar;': '_', 'UnderBrace;': '\u23df', 'UnderBracket;': '\u23b5', 'UnderParenthesis;': '\u23dd', 'Union;': '\u22c3', 'UnionPlus;': '\u228e', 'Uogon;': '\u0172', 'uogon;': '\u0173', 'Uopf;': '\U0001d54c', 'uopf;': '\U0001d566', 'UpArrow;': '\u2191', 'Uparrow;': '\u21d1', 'uparrow;': '\u2191', 'UpArrowBar;': '\u2912', 'UpArrowDownArrow;': '\u21c5', 'UpDownArrow;': '\u2195', 'Updownarrow;': '\u21d5', 'updownarrow;': '\u2195', 'UpEquilibrium;': '\u296e', 'upharpoonleft;': '\u21bf', 'upharpoonright;': '\u21be', 'uplus;': '\u228e', 'UpperLeftArrow;': '\u2196', 'UpperRightArrow;': '\u2197', 'Upsi;': '\u03d2', 'upsi;': '\u03c5', 'upsih;': '\u03d2', 'Upsilon;': '\u03a5', 'upsilon;': '\u03c5', 'UpTee;': '\u22a5', 'UpTeeArrow;': '\u21a5', 'upuparrows;': '\u21c8', 'urcorn;': '\u231d', 'urcorner;': '\u231d', 'urcrop;': '\u230e', 'Uring;': '\u016e', 'uring;': '\u016f', 'urtri;': '\u25f9', 'Uscr;': '\U0001d4b0', 'uscr;': '\U0001d4ca', 'utdot;': '\u22f0', 'Utilde;': '\u0168', 'utilde;': '\u0169', 'utri;': '\u25b5', 'utrif;': '\u25b4', 'uuarr;': '\u21c8', 'Uuml': '\xdc', 'uuml': '\xfc', 'Uuml;': '\xdc', 'uuml;': '\xfc', 'uwangle;': '\u29a7', 'vangrt;': '\u299c', 'varepsilon;': '\u03f5', 'varkappa;': '\u03f0', 'varnothing;': '\u2205', 'varphi;': '\u03d5', 'varpi;': '\u03d6', 'varpropto;': '\u221d', 'vArr;': '\u21d5', 'varr;': '\u2195', 'varrho;': '\u03f1', 'varsigma;': '\u03c2', 'varsubsetneq;': '\u228a\ufe00', 'varsubsetneqq;': '\u2acb\ufe00', 'varsupsetneq;': '\u228b\ufe00', 'varsupsetneqq;': '\u2acc\ufe00', 'vartheta;': '\u03d1', 'vartriangleleft;': '\u22b2', 'vartriangleright;': '\u22b3', 'Vbar;': '\u2aeb', 'vBar;': '\u2ae8', 'vBarv;': '\u2ae9', 'Vcy;': '\u0412', 'vcy;': '\u0432', 'VDash;': '\u22ab', 'Vdash;': '\u22a9', 'vDash;': '\u22a8', 'vdash;': '\u22a2', 'Vdashl;': '\u2ae6', 'Vee;': '\u22c1', 'vee;': '\u2228', 'veebar;': '\u22bb', 'veeeq;': '\u225a', 'vellip;': '\u22ee', 'Verbar;': '\u2016', 'verbar;': '|', 'Vert;': '\u2016', 'vert;': '|', 'VerticalBar;': '\u2223', 'VerticalLine;': '|', 'VerticalSeparator;': '\u2758', 'VerticalTilde;': '\u2240', 'VeryThinSpace;': '\u200a', 'Vfr;': '\U0001d519', 'vfr;': '\U0001d533', 'vltri;': '\u22b2', 'vnsub;': '\u2282\u20d2', 'vnsup;': '\u2283\u20d2', 'Vopf;': '\U0001d54d', 'vopf;': '\U0001d567', 'vprop;': '\u221d', 'vrtri;': '\u22b3', 'Vscr;': '\U0001d4b1', 'vscr;': '\U0001d4cb', 'vsubnE;': '\u2acb\ufe00', 'vsubne;': '\u228a\ufe00', 'vsupnE;': '\u2acc\ufe00', 'vsupne;': '\u228b\ufe00', 'Vvdash;': '\u22aa', 'vzigzag;': '\u299a', 'Wcirc;': '\u0174', 'wcirc;': '\u0175', 'wedbar;': '\u2a5f', 'Wedge;': '\u22c0', 'wedge;': '\u2227', 'wedgeq;': '\u2259', 'weierp;': '\u2118', 'Wfr;': '\U0001d51a', 'wfr;': '\U0001d534', 'Wopf;': '\U0001d54e', 'wopf;': '\U0001d568', 'wp;': '\u2118', 'wr;': '\u2240', 'wreath;': '\u2240', 'Wscr;': '\U0001d4b2', 'wscr;': '\U0001d4cc', 'xcap;': '\u22c2', 'xcirc;': '\u25ef', 'xcup;': '\u22c3', 'xdtri;': '\u25bd', 'Xfr;': '\U0001d51b', 'xfr;': '\U0001d535', 'xhArr;': '\u27fa', 'xharr;': '\u27f7', 'Xi;': '\u039e', 'xi;': '\u03be', 'xlArr;': '\u27f8', 'xlarr;': '\u27f5', 'xmap;': '\u27fc', 'xnis;': '\u22fb', 'xodot;': '\u2a00', 'Xopf;': '\U0001d54f', 'xopf;': '\U0001d569', 'xoplus;': '\u2a01', 'xotime;': '\u2a02', 'xrArr;': '\u27f9', 'xrarr;': '\u27f6', 'Xscr;': '\U0001d4b3', 'xscr;': '\U0001d4cd', 'xsqcup;': '\u2a06', 'xuplus;': '\u2a04', 'xutri;': '\u25b3', 'xvee;': '\u22c1', 'xwedge;': '\u22c0', 'Yacute': '\xdd', 'yacute': '\xfd', 'Yacute;': '\xdd', 'yacute;': '\xfd', 'YAcy;': '\u042f', 'yacy;': '\u044f', 'Ycirc;': '\u0176', 'ycirc;': '\u0177', 'Ycy;': '\u042b', 'ycy;': '\u044b', 'yen': '\xa5', 'yen;': '\xa5', 'Yfr;': '\U0001d51c', 'yfr;': '\U0001d536', 'YIcy;': '\u0407', 'yicy;': '\u0457', 'Yopf;': '\U0001d550', 'yopf;': '\U0001d56a', 'Yscr;': '\U0001d4b4', 'yscr;': '\U0001d4ce', 'YUcy;': '\u042e', 'yucy;': '\u044e', 'yuml': '\xff', 'Yuml;': '\u0178', 'yuml;': '\xff', 'Zacute;': '\u0179', 'zacute;': '\u017a', 'Zcaron;': '\u017d', 'zcaron;': '\u017e', 'Zcy;': '\u0417', 'zcy;': '\u0437', 'Zdot;': '\u017b', 'zdot;': '\u017c', 'zeetrf;': '\u2128', 'ZeroWidthSpace;': '\u200b', 'Zeta;': '\u0396', 'zeta;': '\u03b6', 'Zfr;': '\u2128', 'zfr;': '\U0001d537', 'ZHcy;': '\u0416', 'zhcy;': '\u0436', 'zigrarr;': '\u21dd', 'Zopf;': '\u2124', 'zopf;': '\U0001d56b', 'Zscr;': '\U0001d4b5', 'zscr;': '\U0001d4cf', 'zwj;': '\u200d', 'zwnj;': '\u200c', } # maps the Unicode code point to the HTML entity name codepoint2name = {} # maps the HTML entity name to the character # (or a character reference if the character is outside the Latin-1 range) entitydefs = {} for (name, codepoint) in name2codepoint.items(): codepoint2name[codepoint] = name entitydefs[name] = chr(codepoint) del name, codepoint
75,315
2,510
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/html/parser.py
"""A parser for HTML and XHTML.""" # This file is based on sgmllib.py, but the API is slightly different. # XXX There should be a way to distinguish between PCDATA (parsed # character data -- the normal case), RCDATA (replaceable character # data -- only char and entity references and end tags are special) # and CDATA (character data -- only end tags are special). import re import warnings import _markupbase from html import unescape __all__ = ['HTMLParser'] # Regular expressions used for parsing interesting_normal = re.compile('[&<]') incomplete = re.compile('&[a-zA-Z#]') entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]') starttagopen = re.compile('<[a-zA-Z]') piclose = re.compile('>') commentclose = re.compile(r'--\s*>') # Note: # 1) if you change tagfind/attrfind remember to update locatestarttagend too; # 2) if you change tagfind/attrfind and/or locatestarttagend the parser will # explode, so don't do it. # see http://www.w3.org/TR/html5/tokenization.html#tag-open-state # and http://www.w3.org/TR/html5/tokenization.html#tag-name-state tagfind_tolerant = re.compile(r'([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*') attrfind_tolerant = re.compile( r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*' r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*') locatestarttagend_tolerant = re.compile(r""" <[a-zA-Z][^\t\n\r\f />\x00]* # tag name (?:[\s/]* # optional whitespace before attribute name (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name (?:\s*=+\s* # value indicator (?:'[^']*' # LITA-enclosed value |"[^"]*" # LIT-enclosed value |(?!['"])[^>\s]* # bare value ) (?:\s*,)* # possibly followed by a comma )?(?:\s|/(?!>))* )* )? \s* # trailing whitespace """, re.VERBOSE) endendtag = re.compile('>') # the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between # </ and the tag name, so maybe this should be fixed endtagfind = re.compile(r'</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>') class HTMLParser(_markupbase.ParserBase): """Find tags and other markup and call handler functions. Usage: p = HTMLParser() p.feed(data) ... p.close() Start tags are handled by calling self.handle_starttag() or self.handle_startendtag(); end tags by self.handle_endtag(). The data between tags is passed from the parser to the derived class by calling self.handle_data() with the data as argument (the data may be split up in arbitrary chunks). If convert_charrefs is True the character references are converted automatically to the corresponding Unicode character (and self.handle_data() is no longer split in chunks), otherwise they are passed by calling self.handle_entityref() or self.handle_charref() with the string containing respectively the named or numeric reference as the argument. """ CDATA_CONTENT_ELEMENTS = ("script", "style") def __init__(self, *, convert_charrefs=True): """Initialize and reset this instance. If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters. """ self.convert_charrefs = convert_charrefs self.reset() def reset(self): """Reset this instance. Loses all unprocessed data.""" self.rawdata = '' self.lasttag = '???' self.interesting = interesting_normal self.cdata_elem = None _markupbase.ParserBase.reset(self) def feed(self, data): r"""Feed data to the parser. Call this as often as you want, with as little or as much text as you want (may include '\n'). """ self.rawdata = self.rawdata + data self.goahead(0) def close(self): """Handle any buffered data.""" self.goahead(1) __starttag_text = None def get_starttag_text(self): """Return full source of start tag: '<...>'.""" return self.__starttag_text def set_cdata_mode(self, elem): self.cdata_elem = elem.lower() self.interesting = re.compile(r'</\s*%s\s*>' % self.cdata_elem, re.I) def clear_cdata_mode(self): self.interesting = interesting_normal self.cdata_elem = None # Internal -- handle data as far as reasonable. May leave state # and data to be processed by a subsequent call. If 'end' is # true, force handling all data as if followed by EOF marker. def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.convert_charrefs and not self.cdata_elem: j = rawdata.find('<', i) if j < 0: # if we can't find the next <, either we are at the end # or there's more text incoming. If the latter is True, # we can't pass the text to handle_data in case we have # a charref cut in half at end. Try to determine if # this is the case before proceeding by looking for an # & near the end and see if it's followed by a space or ;. amppos = rawdata.rfind('&', max(i, n-34)) if (amppos >= 0 and not re.compile(r'[\s;]').search(rawdata, amppos)): break # wait till we get all the text j = n else: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: if self.cdata_elem: break j = n if i < j: if self.convert_charrefs and not self.cdata_elem: self.handle_data(unescape(rawdata[i:j])) else: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break startswith = rawdata.startswith if startswith('<', i): if starttagopen.match(rawdata, i): # < + letter k = self.parse_starttag(i) elif startswith("</", i): k = self.parse_endtag(i) elif startswith("<!--", i): k = self.parse_comment(i) elif startswith("<?", i): k = self.parse_pi(i) elif startswith("<!", i): k = self.parse_html_declaration(i) elif (i + 1) < n: self.handle_data("<") k = i + 1 else: break if k < 0: if not end: break k = rawdata.find('>', i + 1) if k < 0: k = rawdata.find('<', i + 1) if k < 0: k = i + 1 else: k += 1 if self.convert_charrefs and not self.cdata_elem: self.handle_data(unescape(rawdata[i:k])) else: self.handle_data(rawdata[i:k]) i = self.updatepos(i, k) elif startswith("&#", i): match = charref.match(rawdata, i) if match: name = match.group()[2:-1] self.handle_charref(name) k = match.end() if not startswith(';', k-1): k = k - 1 i = self.updatepos(i, k) continue else: if ";" in rawdata[i:]: # bail by consuming &# self.handle_data(rawdata[i:i+2]) i = self.updatepos(i, i+2) break elif startswith('&', i): match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end() if not startswith(';', k-1): k = k - 1 i = self.updatepos(i, k) continue match = incomplete.match(rawdata, i) if match: # match.group() will contain at least 2 chars if end and match.group() == rawdata[i:]: k = match.end() if k <= i: k = n i = self.updatepos(i, i + 1) # incomplete break elif (i + 1) < n: # not the end of the buffer, and can't be confused # with some other construct self.handle_data("&") i = self.updatepos(i, i + 1) else: break else: assert 0, "interesting.search() lied" # end while if end and i < n and not self.cdata_elem: if self.convert_charrefs and not self.cdata_elem: self.handle_data(unescape(rawdata[i:n])) else: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] # Internal -- parse html declarations, return length or -1 if not terminated # See w3.org/TR/html5/tokenization.html#markup-declaration-open-state # See also parse_declaration in _markupbase def parse_html_declaration(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == '<!', ('unexpected call to ' 'parse_html_declaration()') if rawdata[i:i+4] == '<!--': # this case is actually already handled in goahead() return self.parse_comment(i) elif rawdata[i:i+3] == '<![': return self.parse_marked_section(i) elif rawdata[i:i+9].lower() == '<!doctype': # find the closing > gtpos = rawdata.find('>', i+9) if gtpos == -1: return -1 self.handle_decl(rawdata[i+2:gtpos]) return gtpos+1 else: return self.parse_bogus_comment(i) # Internal -- parse bogus comment, return length or -1 if not terminated # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state def parse_bogus_comment(self, i, report=1): rawdata = self.rawdata assert rawdata[i:i+2] in ('<!', '</'), ('unexpected call to ' 'parse_comment()') pos = rawdata.find('>', i+2) if pos == -1: return -1 if report: self.handle_comment(rawdata[i+2:pos]) return pos + 1 # Internal -- parse processing instr, return end or -1 if not terminated def parse_pi(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == '<?', 'unexpected call to parse_pi()' match = piclose.search(rawdata, i+2) # > if not match: return -1 j = match.start() self.handle_pi(rawdata[i+2: j]) j = match.end() return j # Internal -- handle starttag, return end or -1 if not terminated def parse_starttag(self, i): self.__starttag_text = None endpos = self.check_for_whole_start_tag(i) if endpos < 0: return endpos rawdata = self.rawdata self.__starttag_text = rawdata[i:endpos] # Now parse the data between i+1 and j into a tag and attrs attrs = [] match = tagfind_tolerant.match(rawdata, i+1) assert match, 'unexpected call to parse_starttag()' k = match.end() self.lasttag = tag = match.group(1).lower() while k < endpos: m = attrfind_tolerant.match(rawdata, k) if not m: break attrname, rest, attrvalue = m.group(1, 2, 3) if not rest: attrvalue = None elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ attrvalue[:1] == '"' == attrvalue[-1:]: attrvalue = attrvalue[1:-1] if attrvalue: attrvalue = unescape(attrvalue) attrs.append((attrname.lower(), attrvalue)) k = m.end() end = rawdata[k:endpos].strip() if end not in (">", "/>"): lineno, offset = self.getpos() if "\n" in self.__starttag_text: lineno = lineno + self.__starttag_text.count("\n") offset = len(self.__starttag_text) \ - self.__starttag_text.rfind("\n") else: offset = offset + len(self.__starttag_text) self.handle_data(rawdata[i:endpos]) return endpos if end.endswith('/>'): # XHTML-style empty tag: <span attr="value" /> self.handle_startendtag(tag, attrs) else: self.handle_starttag(tag, attrs) if tag in self.CDATA_CONTENT_ELEMENTS: self.set_cdata_mode(tag) return endpos # Internal -- check to see if we have a complete starttag; return end # or -1 if incomplete. def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend_tolerant.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if next == "/": if rawdata.startswith("/>", j): return j + 2 if rawdata.startswith("/", j): # buffer boundary return -1 # else bogus input if j > i: return j else: return i + 1 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=/" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): # end of input in or before attribute value, or we have the # '/' from a '/>' ending return -1 if j > i: return j else: return i + 1 raise AssertionError("we should not get here!") # Internal -- parse endtag, return end or -1 if incomplete def parse_endtag(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag" match = endendtag.search(rawdata, i+1) # > if not match: return -1 gtpos = match.end() match = endtagfind.match(rawdata, i) # </ + tag + > if not match: if self.cdata_elem is not None: self.handle_data(rawdata[i:gtpos]) return gtpos # find the name: w3.org/TR/html5/tokenization.html#tag-name-state namematch = tagfind_tolerant.match(rawdata, i+2) if not namematch: # w3.org/TR/html5/tokenization.html#end-tag-open-state if rawdata[i:i+3] == '</>': return i+3 else: return self.parse_bogus_comment(i) tagname = namematch.group(1).lower() # consume and ignore other stuff between the name and the > # Note: this is not 100% correct, since we might have things like # </tag attr=">">, but looking for > after tha name should cover # most of the cases and is much simpler gtpos = rawdata.find('>', namematch.end()) self.handle_endtag(tagname) return gtpos+1 elem = match.group(1).lower() # script or style if self.cdata_elem is not None: if elem != self.cdata_elem: self.handle_data(rawdata[i:gtpos]) return gtpos self.handle_endtag(elem.lower()) self.clear_cdata_mode() return gtpos # Overridable -- finish processing of start+end tag: <tag.../> def handle_startendtag(self, tag, attrs): self.handle_starttag(tag, attrs) self.handle_endtag(tag) # Overridable -- handle start tag def handle_starttag(self, tag, attrs): pass # Overridable -- handle end tag def handle_endtag(self, tag): pass # Overridable -- handle character reference def handle_charref(self, name): pass # Overridable -- handle entity reference def handle_entityref(self, name): pass # Overridable -- handle data def handle_data(self, data): pass # Overridable -- handle comment def handle_comment(self, data): pass # Overridable -- handle declaration def handle_decl(self, decl): pass # Overridable -- handle processing instruction def handle_pi(self, data): pass def unknown_decl(self, data): pass # Internal -- helper to remove special character quoting def unescape(self, s): warnings.warn('The unescape method is deprecated and will be removed ' 'in 3.5, use html.unescape() instead.', DeprecationWarning, stacklevel=2) return unescape(s)
17,729
471
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/html/__init__.py
""" General functions for HTML manipulation. """ import re as _re from html.entities import html5 as _html5 __all__ = ['escape', 'unescape'] def escape(s, quote=True): """ Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true (the default), the quotation mark characters, both double quote (") and single quote (') characters are also translated. """ s = s.replace("&", "&amp;") # Must be done first! s = s.replace("<", "&lt;") s = s.replace(">", "&gt;") if quote: s = s.replace('"', "&quot;") s = s.replace('\'', "&#x27;") return s # see http://www.w3.org/TR/html5/syntax.html#tokenizing-character-references _invalid_charrefs = { 0x00: '\ufffd', # REPLACEMENT CHARACTER 0x0d: '\r', # CARRIAGE RETURN 0x80: '\u20ac', # EURO SIGN 0x81: '\x81', # <control> 0x82: '\u201a', # SINGLE LOW-9 QUOTATION MARK 0x83: '\u0192', # LATIN SMALL LETTER F WITH HOOK 0x84: '\u201e', # DOUBLE LOW-9 QUOTATION MARK 0x85: '\u2026', # HORIZONTAL ELLIPSIS 0x86: '\u2020', # DAGGER 0x87: '\u2021', # DOUBLE DAGGER 0x88: '\u02c6', # MODIFIER LETTER CIRCUMFLEX ACCENT 0x89: '\u2030', # PER MILLE SIGN 0x8a: '\u0160', # LATIN CAPITAL LETTER S WITH CARON 0x8b: '\u2039', # SINGLE LEFT-POINTING ANGLE QUOTATION MARK 0x8c: '\u0152', # LATIN CAPITAL LIGATURE OE 0x8d: '\x8d', # <control> 0x8e: '\u017d', # LATIN CAPITAL LETTER Z WITH CARON 0x8f: '\x8f', # <control> 0x90: '\x90', # <control> 0x91: '\u2018', # LEFT SINGLE QUOTATION MARK 0x92: '\u2019', # RIGHT SINGLE QUOTATION MARK 0x93: '\u201c', # LEFT DOUBLE QUOTATION MARK 0x94: '\u201d', # RIGHT DOUBLE QUOTATION MARK 0x95: '\u2022', # BULLET 0x96: '\u2013', # EN DASH 0x97: '\u2014', # EM DASH 0x98: '\u02dc', # SMALL TILDE 0x99: '\u2122', # TRADE MARK SIGN 0x9a: '\u0161', # LATIN SMALL LETTER S WITH CARON 0x9b: '\u203a', # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 0x9c: '\u0153', # LATIN SMALL LIGATURE OE 0x9d: '\x9d', # <control> 0x9e: '\u017e', # LATIN SMALL LETTER Z WITH CARON 0x9f: '\u0178', # LATIN CAPITAL LETTER Y WITH DIAERESIS } _invalid_codepoints = { # 0x0001 to 0x0008 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, # 0x000E to 0x001F 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, # 0x007F to 0x009F 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, # 0xFDD0 to 0xFDEF 0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, 0xfdd7, 0xfdd8, 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, 0xfddf, 0xfde0, 0xfde1, 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, 0xfde7, 0xfde8, 0xfde9, 0xfdea, 0xfdeb, 0xfdec, 0xfded, 0xfdee, 0xfdef, # others 0xb, 0xfffe, 0xffff, 0x1fffe, 0x1ffff, 0x2fffe, 0x2ffff, 0x3fffe, 0x3ffff, 0x4fffe, 0x4ffff, 0x5fffe, 0x5ffff, 0x6fffe, 0x6ffff, 0x7fffe, 0x7ffff, 0x8fffe, 0x8ffff, 0x9fffe, 0x9ffff, 0xafffe, 0xaffff, 0xbfffe, 0xbffff, 0xcfffe, 0xcffff, 0xdfffe, 0xdffff, 0xefffe, 0xeffff, 0xffffe, 0xfffff, 0x10fffe, 0x10ffff } def _replace_charref(s): s = s.group(1) if s[0] == '#': # numeric charref if s[1] in 'xX': num = int(s[2:].rstrip(';'), 16) else: num = int(s[1:].rstrip(';')) if num in _invalid_charrefs: return _invalid_charrefs[num] if 0xD800 <= num <= 0xDFFF or num > 0x10FFFF: return '\uFFFD' if num in _invalid_codepoints: return '' return chr(num) else: # named charref if s in _html5: return _html5[s] # find the longest matching name (as defined by the standard) for x in range(len(s)-1, 1, -1): if s[:x] in _html5: return _html5[s[:x]] + s[x:] else: return '&' + s _charref = _re.compile(r'&(#[0-9]+;?' r'|#[xX][0-9a-fA-F]+;?' r'|[^\t\n\f <&#;]{1,32};?)') def unescape(s): """ Convert all named and numeric character references (e.g. &gt;, &#62;, &x3e;) in the string s to the corresponding unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the list of HTML 5 named character references defined in html.entities.html5. """ if '&' not in s: return s return _charref.sub(_replace_charref, s)
4,756
133
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/pydoc_data/topics.py
# -*- coding: utf-8 -*- # Autogenerated by Sphinx on Mon Jun 28 12:38:05 2021 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' 'Assert statements are a convenient way to insert debugging ' 'assertions\n' 'into a program:\n' '\n' ' assert_stmt ::= "assert" expression ["," expression]\n' '\n' 'The simple form, "assert expression", is equivalent to\n' '\n' ' if __debug__:\n' ' if not expression: raise AssertionError\n' '\n' 'The extended form, "assert expression1, expression2", is ' 'equivalent to\n' '\n' ' if __debug__:\n' ' if not expression1: raise AssertionError(expression2)\n' '\n' 'These equivalences assume that "__debug__" and "AssertionError" ' 'refer\n' 'to the built-in variables with those names. In the current\n' 'implementation, the built-in variable "__debug__" is "True" under\n' 'normal circumstances, "False" when optimization is requested ' '(command\n' 'line option "-O"). The current code generator emits no code for ' 'an\n' 'assert statement when optimization is requested at compile time. ' 'Note\n' 'that it is unnecessary to include the source code for the ' 'expression\n' 'that failed in the error message; it will be displayed as part of ' 'the\n' 'stack trace.\n' '\n' 'Assignments to "__debug__" are illegal. The value for the ' 'built-in\n' 'variable is determined when the interpreter starts.\n', 'assignment': 'Assignment statements\n' '*********************\n' '\n' 'Assignment statements are used to (re)bind names to values and ' 'to\n' 'modify attributes or items of mutable objects:\n' '\n' ' assignment_stmt ::= (target_list "=")+ (starred_expression ' '| yield_expression)\n' ' target_list ::= target ("," target)* [","]\n' ' target ::= identifier\n' ' | "(" [target_list] ")"\n' ' | "[" [target_list] "]"\n' ' | attributeref\n' ' | subscription\n' ' | slicing\n' ' | "*" target\n' '\n' '(See section Primaries for the syntax definitions for ' '*attributeref*,\n' '*subscription*, and *slicing*.)\n' '\n' 'An assignment statement evaluates the expression list ' '(remember that\n' 'this can be a single expression or a comma-separated list, the ' 'latter\n' 'yielding a tuple) and assigns the single resulting object to ' 'each of\n' 'the target lists, from left to right.\n' '\n' 'Assignment is defined recursively depending on the form of the ' 'target\n' '(list). When a target is part of a mutable object (an ' 'attribute\n' 'reference, subscription or slicing), the mutable object must\n' 'ultimately perform the assignment and decide about its ' 'validity, and\n' 'may raise an exception if the assignment is unacceptable. The ' 'rules\n' 'observed by various types and the exceptions raised are given ' 'with the\n' 'definition of the object types (see section The standard type\n' 'hierarchy).\n' '\n' 'Assignment of an object to a target list, optionally enclosed ' 'in\n' 'parentheses or square brackets, is recursively defined as ' 'follows.\n' '\n' '* If the target list is a single target with no trailing ' 'comma,\n' ' optionally in parentheses, the object is assigned to that ' 'target.\n' '\n' '* Else: The object must be an iterable with the same number of ' 'items\n' ' as there are targets in the target list, and the items are ' 'assigned,\n' ' from left to right, to the corresponding targets.\n' '\n' ' * If the target list contains one target prefixed with an ' 'asterisk,\n' ' called a “starred” target: The object must be an iterable ' 'with at\n' ' least as many items as there are targets in the target ' 'list, minus\n' ' one. The first items of the iterable are assigned, from ' 'left to\n' ' right, to the targets before the starred target. The ' 'final items\n' ' of the iterable are assigned to the targets after the ' 'starred\n' ' target. A list of the remaining items in the iterable is ' 'then\n' ' assigned to the starred target (the list can be empty).\n' '\n' ' * Else: The object must be an iterable with the same number ' 'of items\n' ' as there are targets in the target list, and the items ' 'are\n' ' assigned, from left to right, to the corresponding ' 'targets.\n' '\n' 'Assignment of an object to a single target is recursively ' 'defined as\n' 'follows.\n' '\n' '* If the target is an identifier (name):\n' '\n' ' * If the name does not occur in a "global" or "nonlocal" ' 'statement\n' ' in the current code block: the name is bound to the object ' 'in the\n' ' current local namespace.\n' '\n' ' * Otherwise: the name is bound to the object in the global ' 'namespace\n' ' or the outer namespace determined by "nonlocal", ' 'respectively.\n' '\n' ' The name is rebound if it was already bound. This may cause ' 'the\n' ' reference count for the object previously bound to the name ' 'to reach\n' ' zero, causing the object to be deallocated and its ' 'destructor (if it\n' ' has one) to be called.\n' '\n' '* If the target is an attribute reference: The primary ' 'expression in\n' ' the reference is evaluated. It should yield an object with\n' ' assignable attributes; if this is not the case, "TypeError" ' 'is\n' ' raised. That object is then asked to assign the assigned ' 'object to\n' ' the given attribute; if it cannot perform the assignment, it ' 'raises\n' ' an exception (usually but not necessarily ' '"AttributeError").\n' '\n' ' Note: If the object is a class instance and the attribute ' 'reference\n' ' occurs on both sides of the assignment operator, the RHS ' 'expression,\n' ' "a.x" can access either an instance attribute or (if no ' 'instance\n' ' attribute exists) a class attribute. The LHS target "a.x" ' 'is always\n' ' set as an instance attribute, creating it if necessary. ' 'Thus, the\n' ' two occurrences of "a.x" do not necessarily refer to the ' 'same\n' ' attribute: if the RHS expression refers to a class ' 'attribute, the\n' ' LHS creates a new instance attribute as the target of the\n' ' assignment:\n' '\n' ' class Cls:\n' ' x = 3 # class variable\n' ' inst = Cls()\n' ' inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x ' 'as 3\n' '\n' ' This description does not necessarily apply to descriptor\n' ' attributes, such as properties created with "property()".\n' '\n' '* If the target is a subscription: The primary expression in ' 'the\n' ' reference is evaluated. It should yield either a mutable ' 'sequence\n' ' object (such as a list) or a mapping object (such as a ' 'dictionary).\n' ' Next, the subscript expression is evaluated.\n' '\n' ' If the primary is a mutable sequence object (such as a ' 'list), the\n' ' subscript must yield an integer. If it is negative, the ' 'sequence’s\n' ' length is added to it. The resulting value must be a ' 'nonnegative\n' ' integer less than the sequence’s length, and the sequence is ' 'asked\n' ' to assign the assigned object to its item with that index. ' 'If the\n' ' index is out of range, "IndexError" is raised (assignment to ' 'a\n' ' subscripted sequence cannot add new items to a list).\n' '\n' ' If the primary is a mapping object (such as a dictionary), ' 'the\n' ' subscript must have a type compatible with the mapping’s key ' 'type,\n' ' and the mapping is then asked to create a key/datum pair ' 'which maps\n' ' the subscript to the assigned object. This can either ' 'replace an\n' ' existing key/value pair with the same key value, or insert a ' 'new\n' ' key/value pair (if no key with the same value existed).\n' '\n' ' For user-defined objects, the "__setitem__()" method is ' 'called with\n' ' appropriate arguments.\n' '\n' '* If the target is a slicing: The primary expression in the ' 'reference\n' ' is evaluated. It should yield a mutable sequence object ' '(such as a\n' ' list). The assigned object should be a sequence object of ' 'the same\n' ' type. Next, the lower and upper bound expressions are ' 'evaluated,\n' ' insofar they are present; defaults are zero and the ' 'sequence’s\n' ' length. The bounds should evaluate to integers. If either ' 'bound is\n' ' negative, the sequence’s length is added to it. The ' 'resulting\n' ' bounds are clipped to lie between zero and the sequence’s ' 'length,\n' ' inclusive. Finally, the sequence object is asked to replace ' 'the\n' ' slice with the items of the assigned sequence. The length ' 'of the\n' ' slice may be different from the length of the assigned ' 'sequence,\n' ' thus changing the length of the target sequence, if the ' 'target\n' ' sequence allows it.\n' '\n' '**CPython implementation detail:** In the current ' 'implementation, the\n' 'syntax for targets is taken to be the same as for expressions, ' 'and\n' 'invalid syntax is rejected during the code generation phase, ' 'causing\n' 'less detailed error messages.\n' '\n' 'Although the definition of assignment implies that overlaps ' 'between\n' 'the left-hand side and the right-hand side are ‘simultaneous’ ' '(for\n' 'example "a, b = b, a" swaps two variables), overlaps *within* ' 'the\n' 'collection of assigned-to variables occur left-to-right, ' 'sometimes\n' 'resulting in confusion. For instance, the following program ' 'prints\n' '"[0, 2]":\n' '\n' ' x = [0, 1]\n' ' i = 0\n' ' i, x[i] = 1, 2 # i is updated, then x[i] is ' 'updated\n' ' print(x)\n' '\n' 'See also:\n' '\n' ' **PEP 3132** - Extended Iterable Unpacking\n' ' The specification for the "*target" feature.\n' '\n' '\n' 'Augmented assignment statements\n' '===============================\n' '\n' 'Augmented assignment is the combination, in a single ' 'statement, of a\n' 'binary operation and an assignment statement:\n' '\n' ' augmented_assignment_stmt ::= augtarget augop ' '(expression_list | yield_expression)\n' ' augtarget ::= identifier | attributeref | ' 'subscription | slicing\n' ' augop ::= "+=" | "-=" | "*=" | "@=" | ' '"/=" | "//=" | "%=" | "**="\n' ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' '\n' '(See section Primaries for the syntax definitions of the last ' 'three\n' 'symbols.)\n' '\n' 'An augmented assignment evaluates the target (which, unlike ' 'normal\n' 'assignment statements, cannot be an unpacking) and the ' 'expression\n' 'list, performs the binary operation specific to the type of ' 'assignment\n' 'on the two operands, and assigns the result to the original ' 'target.\n' 'The target is only evaluated once.\n' '\n' 'An augmented assignment expression like "x += 1" can be ' 'rewritten as\n' '"x = x + 1" to achieve a similar, but not exactly equal ' 'effect. In the\n' 'augmented version, "x" is only evaluated once. Also, when ' 'possible,\n' 'the actual operation is performed *in-place*, meaning that ' 'rather than\n' 'creating a new object and assigning that to the target, the ' 'old object\n' 'is modified instead.\n' '\n' 'Unlike normal assignments, augmented assignments evaluate the ' 'left-\n' 'hand side *before* evaluating the right-hand side. For ' 'example, "a[i]\n' '+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and ' 'performs\n' 'the addition, and lastly, it writes the result back to ' '"a[i]".\n' '\n' 'With the exception of assigning to tuples and multiple targets ' 'in a\n' 'single statement, the assignment done by augmented assignment\n' 'statements is handled the same way as normal assignments. ' 'Similarly,\n' 'with the exception of the possible *in-place* behavior, the ' 'binary\n' 'operation performed by augmented assignment is the same as the ' 'normal\n' 'binary operations.\n' '\n' 'For targets which are attribute references, the same caveat ' 'about\n' 'class and instance attributes applies as for regular ' 'assignments.\n' '\n' '\n' 'Annotated assignment statements\n' '===============================\n' '\n' 'Annotation assignment is the combination, in a single ' 'statement, of a\n' 'variable or attribute annotation and an optional assignment ' 'statement:\n' '\n' ' annotated_assignment_stmt ::= augtarget ":" expression ["=" ' 'expression]\n' '\n' 'The difference from normal Assignment statements is that only ' 'single\n' 'target and only single right hand side value is allowed.\n' '\n' 'For simple names as assignment targets, if in class or module ' 'scope,\n' 'the annotations are evaluated and stored in a special class or ' 'module\n' 'attribute "__annotations__" that is a dictionary mapping from ' 'variable\n' 'names (mangled if private) to evaluated annotations. This ' 'attribute is\n' 'writable and is automatically created at the start of class or ' 'module\n' 'body execution, if annotations are found statically.\n' '\n' 'For expressions as assignment targets, the annotations are ' 'evaluated\n' 'if in class or module scope, but not stored.\n' '\n' 'If a name is annotated in a function scope, then this name is ' 'local\n' 'for that scope. Annotations are never evaluated and stored in ' 'function\n' 'scopes.\n' '\n' 'If the right hand side is present, an annotated assignment ' 'performs\n' 'the actual assignment before evaluating annotations (where\n' 'applicable). If the right hand side is not present for an ' 'expression\n' 'target, then the interpreter evaluates the target except for ' 'the last\n' '"__setitem__()" or "__setattr__()" call.\n' '\n' 'See also:\n' '\n' ' **PEP 526** - Syntax for Variable Annotations\n' ' The proposal that added syntax for annotating the types ' 'of\n' ' variables (including class variables and instance ' 'variables),\n' ' instead of expressing them through comments.\n' '\n' ' **PEP 484** - Type hints\n' ' The proposal that added the "typing" module to provide a ' 'standard\n' ' syntax for type annotations that can be used in static ' 'analysis\n' ' tools and IDEs.\n', 'atom-identifiers': 'Identifiers (Names)\n' '*******************\n' '\n' 'An identifier occurring as an atom is a name. See ' 'section Identifiers\n' 'and keywords for lexical definition and section Naming ' 'and binding for\n' 'documentation of naming and binding.\n' '\n' 'When the name is bound to an object, evaluation of the ' 'atom yields\n' 'that object. When a name is not bound, an attempt to ' 'evaluate it\n' 'raises a "NameError" exception.\n' '\n' '**Private name mangling:** When an identifier that ' 'textually occurs in\n' 'a class definition begins with two or more underscore ' 'characters and\n' 'does not end in two or more underscores, it is ' 'considered a *private\n' 'name* of that class. Private names are transformed to a ' 'longer form\n' 'before code is generated for them. The transformation ' 'inserts the\n' 'class name, with leading underscores removed and a ' 'single underscore\n' 'inserted, in front of the name. For example, the ' 'identifier "__spam"\n' 'occurring in a class named "Ham" will be transformed to ' '"_Ham__spam".\n' 'This transformation is independent of the syntactical ' 'context in which\n' 'the identifier is used. If the transformed name is ' 'extremely long\n' '(longer than 255 characters), implementation defined ' 'truncation may\n' 'happen. If the class name consists only of underscores, ' 'no\n' 'transformation is done.\n', 'atom-literals': 'Literals\n' '********\n' '\n' 'Python supports string and bytes literals and various ' 'numeric\n' 'literals:\n' '\n' ' literal ::= stringliteral | bytesliteral\n' ' | integer | floatnumber | imagnumber\n' '\n' 'Evaluation of a literal yields an object of the given type ' '(string,\n' 'bytes, integer, floating point number, complex number) with ' 'the given\n' 'value. The value may be approximated in the case of ' 'floating point\n' 'and imaginary (complex) literals. See section Literals for ' 'details.\n' '\n' 'All literals correspond to immutable data types, and hence ' 'the\n' 'object’s identity is less important than its value. ' 'Multiple\n' 'evaluations of literals with the same value (either the ' 'same\n' 'occurrence in the program text or a different occurrence) ' 'may obtain\n' 'the same object or a different object with the same ' 'value.\n', 'attribute-access': 'Customizing attribute access\n' '****************************\n' '\n' 'The following methods can be defined to customize the ' 'meaning of\n' 'attribute access (use of, assignment to, or deletion of ' '"x.name") for\n' 'class instances.\n' '\n' 'object.__getattr__(self, name)\n' '\n' ' Called when the default attribute access fails with ' 'an\n' ' "AttributeError" (either "__getattribute__()" raises ' 'an\n' ' "AttributeError" because *name* is not an instance ' 'attribute or an\n' ' attribute in the class tree for "self"; or ' '"__get__()" of a *name*\n' ' property raises "AttributeError"). This method ' 'should either\n' ' return the (computed) attribute value or raise an ' '"AttributeError"\n' ' exception.\n' '\n' ' Note that if the attribute is found through the ' 'normal mechanism,\n' ' "__getattr__()" is not called. (This is an ' 'intentional asymmetry\n' ' between "__getattr__()" and "__setattr__()".) This is ' 'done both for\n' ' efficiency reasons and because otherwise ' '"__getattr__()" would have\n' ' no way to access other attributes of the instance. ' 'Note that at\n' ' least for instance variables, you can fake total ' 'control by not\n' ' inserting any values in the instance attribute ' 'dictionary (but\n' ' instead inserting them in another object). See the\n' ' "__getattribute__()" method below for a way to ' 'actually get total\n' ' control over attribute access.\n' '\n' 'object.__getattribute__(self, name)\n' '\n' ' Called unconditionally to implement attribute ' 'accesses for\n' ' instances of the class. If the class also defines ' '"__getattr__()",\n' ' the latter will not be called unless ' '"__getattribute__()" either\n' ' calls it explicitly or raises an "AttributeError". ' 'This method\n' ' should return the (computed) attribute value or raise ' 'an\n' ' "AttributeError" exception. In order to avoid ' 'infinite recursion in\n' ' this method, its implementation should always call ' 'the base class\n' ' method with the same name to access any attributes it ' 'needs, for\n' ' example, "object.__getattribute__(self, name)".\n' '\n' ' Note:\n' '\n' ' This method may still be bypassed when looking up ' 'special methods\n' ' as the result of implicit invocation via language ' 'syntax or\n' ' built-in functions. See Special method lookup.\n' '\n' 'object.__setattr__(self, name, value)\n' '\n' ' Called when an attribute assignment is attempted. ' 'This is called\n' ' instead of the normal mechanism (i.e. store the value ' 'in the\n' ' instance dictionary). *name* is the attribute name, ' '*value* is the\n' ' value to be assigned to it.\n' '\n' ' If "__setattr__()" wants to assign to an instance ' 'attribute, it\n' ' should call the base class method with the same name, ' 'for example,\n' ' "object.__setattr__(self, name, value)".\n' '\n' 'object.__delattr__(self, name)\n' '\n' ' Like "__setattr__()" but for attribute deletion ' 'instead of\n' ' assignment. This should only be implemented if "del ' 'obj.name" is\n' ' meaningful for the object.\n' '\n' 'object.__dir__(self)\n' '\n' ' Called when "dir()" is called on the object. A ' 'sequence must be\n' ' returned. "dir()" converts the returned sequence to a ' 'list and\n' ' sorts it.\n' '\n' '\n' 'Customizing module attribute access\n' '===================================\n' '\n' 'For a more fine grained customization of the module ' 'behavior (setting\n' 'attributes, properties, etc.), one can set the ' '"__class__" attribute\n' 'of a module object to a subclass of "types.ModuleType". ' 'For example:\n' '\n' ' import sys\n' ' from types import ModuleType\n' '\n' ' class VerboseModule(ModuleType):\n' ' def __repr__(self):\n' " return f'Verbose {self.__name__}'\n" '\n' ' def __setattr__(self, attr, value):\n' " print(f'Setting {attr}...')\n" ' setattr(self, attr, value)\n' '\n' ' sys.modules[__name__].__class__ = VerboseModule\n' '\n' 'Note:\n' '\n' ' Setting module "__class__" only affects lookups made ' 'using the\n' ' attribute access syntax – directly accessing the ' 'module globals\n' ' (whether by code within the module, or via a reference ' 'to the\n' ' module’s globals dictionary) is unaffected.\n' '\n' 'Changed in version 3.5: "__class__" module attribute is ' 'now writable.\n' '\n' '\n' 'Implementing Descriptors\n' '========================\n' '\n' 'The following methods only apply when an instance of the ' 'class\n' 'containing the method (a so-called *descriptor* class) ' 'appears in an\n' '*owner* class (the descriptor must be in either the ' 'owner’s class\n' 'dictionary or in the class dictionary for one of its ' 'parents). In the\n' 'examples below, “the attribute” refers to the attribute ' 'whose name is\n' 'the key of the property in the owner class’ "__dict__".\n' '\n' 'object.__get__(self, instance, owner)\n' '\n' ' Called to get the attribute of the owner class (class ' 'attribute\n' ' access) or of an instance of that class (instance ' 'attribute\n' ' access). *owner* is always the owner class, while ' '*instance* is the\n' ' instance that the attribute was accessed through, or ' '"None" when\n' ' the attribute is accessed through the *owner*. This ' 'method should\n' ' return the (computed) attribute value or raise an ' '"AttributeError"\n' ' exception.\n' '\n' 'object.__set__(self, instance, value)\n' '\n' ' Called to set the attribute on an instance *instance* ' 'of the owner\n' ' class to a new value, *value*.\n' '\n' 'object.__delete__(self, instance)\n' '\n' ' Called to delete the attribute on an instance ' '*instance* of the\n' ' owner class.\n' '\n' 'object.__set_name__(self, owner, name)\n' '\n' ' Called at the time the owning class *owner* is ' 'created. The\n' ' descriptor has been assigned to *name*.\n' '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the ' '"inspect" module as\n' 'specifying the class where this object was defined ' '(setting this\n' 'appropriately can assist in runtime introspection of ' 'dynamic class\n' 'attributes). For callables, it may indicate that an ' 'instance of the\n' 'given type (or a subclass) is expected or required as ' 'the first\n' 'positional argument (for example, CPython sets this ' 'attribute for\n' 'unbound methods that are implemented in C).\n' '\n' '\n' 'Invoking Descriptors\n' '====================\n' '\n' 'In general, a descriptor is an object attribute with ' '“binding\n' 'behavior”, one whose attribute access has been ' 'overridden by methods\n' 'in the descriptor protocol: "__get__()", "__set__()", ' 'and\n' '"__delete__()". If any of those methods are defined for ' 'an object, it\n' 'is said to be a descriptor.\n' '\n' 'The default behavior for attribute access is to get, ' 'set, or delete\n' 'the attribute from an object’s dictionary. For instance, ' '"a.x" has a\n' 'lookup chain starting with "a.__dict__[\'x\']", then\n' '"type(a).__dict__[\'x\']", and continuing through the ' 'base classes of\n' '"type(a)" excluding metaclasses.\n' '\n' 'However, if the looked-up value is an object defining ' 'one of the\n' 'descriptor methods, then Python may override the default ' 'behavior and\n' 'invoke the descriptor method instead. Where this occurs ' 'in the\n' 'precedence chain depends on which descriptor methods ' 'were defined and\n' 'how they were called.\n' '\n' 'The starting point for descriptor invocation is a ' 'binding, "a.x". How\n' 'the arguments are assembled depends on "a":\n' '\n' 'Direct Call\n' ' The simplest and least common call is when user code ' 'directly\n' ' invokes a descriptor method: "x.__get__(a)".\n' '\n' 'Instance Binding\n' ' If binding to an object instance, "a.x" is ' 'transformed into the\n' ' call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n' '\n' 'Class Binding\n' ' If binding to a class, "A.x" is transformed into the ' 'call:\n' ' "A.__dict__[\'x\'].__get__(None, A)".\n' '\n' 'Super Binding\n' ' If "a" is an instance of "super", then the binding ' '"super(B,\n' ' obj).m()" searches "obj.__class__.__mro__" for the ' 'base class "A"\n' ' immediately preceding "B" and then invokes the ' 'descriptor with the\n' ' call: "A.__dict__[\'m\'].__get__(obj, ' 'obj.__class__)".\n' '\n' 'For instance bindings, the precedence of descriptor ' 'invocation depends\n' 'on the which descriptor methods are defined. A ' 'descriptor can define\n' 'any combination of "__get__()", "__set__()" and ' '"__delete__()". If it\n' 'does not define "__get__()", then accessing the ' 'attribute will return\n' 'the descriptor object itself unless there is a value in ' 'the object’s\n' 'instance dictionary. If the descriptor defines ' '"__set__()" and/or\n' '"__delete__()", it is a data descriptor; if it defines ' 'neither, it is\n' 'a non-data descriptor. Normally, data descriptors ' 'define both\n' '"__get__()" and "__set__()", while non-data descriptors ' 'have just the\n' '"__get__()" method. Data descriptors with "__set__()" ' 'and "__get__()"\n' 'defined always override a redefinition in an instance ' 'dictionary. In\n' 'contrast, non-data descriptors can be overridden by ' 'instances.\n' '\n' 'Python methods (including "staticmethod()" and ' '"classmethod()") are\n' 'implemented as non-data descriptors. Accordingly, ' 'instances can\n' 'redefine and override methods. This allows individual ' 'instances to\n' 'acquire behaviors that differ from other instances of ' 'the same class.\n' '\n' 'The "property()" function is implemented as a data ' 'descriptor.\n' 'Accordingly, instances cannot override the behavior of a ' 'property.\n' '\n' '\n' '__slots__\n' '=========\n' '\n' '*__slots__* allow us to explicitly declare data members ' '(like\n' 'properties) and deny the creation of *__dict__* and ' '*__weakref__*\n' '(unless explicitly declared in *__slots__* or available ' 'in a parent.)\n' '\n' 'The space saved over using *__dict__* can be ' 'significant.\n' '\n' 'object.__slots__\n' '\n' ' This class variable can be assigned a string, ' 'iterable, or sequence\n' ' of strings with variable names used by instances. ' '*__slots__*\n' ' reserves space for the declared variables and ' 'prevents the\n' ' automatic creation of *__dict__* and *__weakref__* ' 'for each\n' ' instance.\n' '\n' '\n' 'Notes on using *__slots__*\n' '--------------------------\n' '\n' '* When inheriting from a class without *__slots__*, the ' '*__dict__* and\n' ' *__weakref__* attribute of the instances will always ' 'be accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' ' variables not listed in the *__slots__* definition. ' 'Attempts to\n' ' assign to an unlisted variable name raises ' '"AttributeError". If\n' ' dynamic assignment of new variables is desired, then ' 'add\n' ' "\'__dict__\'" to the sequence of strings in the ' '*__slots__*\n' ' declaration.\n' '\n' '* Without a *__weakref__* variable for each instance, ' 'classes defining\n' ' *__slots__* do not support weak references to its ' 'instances. If weak\n' ' reference support is needed, then add ' '"\'__weakref__\'" to the\n' ' sequence of strings in the *__slots__* declaration.\n' '\n' '* *__slots__* are implemented at the class level by ' 'creating\n' ' descriptors (Implementing Descriptors) for each ' 'variable name. As a\n' ' result, class attributes cannot be used to set default ' 'values for\n' ' instance variables defined by *__slots__*; otherwise, ' 'the class\n' ' attribute would overwrite the descriptor assignment.\n' '\n' '* The action of a *__slots__* declaration is not limited ' 'to the class\n' ' where it is defined. *__slots__* declared in parents ' 'are available\n' ' in child classes. However, child subclasses will get a ' '*__dict__*\n' ' and *__weakref__* unless they also define *__slots__* ' '(which should\n' ' only contain names of any *additional* slots).\n' '\n' '* If a class defines a slot also defined in a base ' 'class, the instance\n' ' variable defined by the base class slot is ' 'inaccessible (except by\n' ' retrieving its descriptor directly from the base ' 'class). This\n' ' renders the meaning of the program undefined. In the ' 'future, a\n' ' check may be added to prevent this.\n' '\n' '* Nonempty *__slots__* does not work for classes derived ' 'from\n' ' “variable-length” built-in types such as "int", ' '"bytes" and "tuple".\n' '\n' '* Any non-string iterable may be assigned to ' '*__slots__*. Mappings may\n' ' also be used; however, in the future, special meaning ' 'may be\n' ' assigned to the values corresponding to each key.\n' '\n' '* *__class__* assignment works only if both classes have ' 'the same\n' ' *__slots__*.\n' '\n' '* Multiple inheritance with multiple slotted parent ' 'classes can be\n' ' used, but only one parent is allowed to have ' 'attributes created by\n' ' slots (the other bases must have empty slot layouts) - ' 'violations\n' ' raise "TypeError".\n', 'attribute-references': 'Attribute references\n' '********************\n' '\n' 'An attribute reference is a primary followed by a ' 'period and a name:\n' '\n' ' attributeref ::= primary "." identifier\n' '\n' 'The primary must evaluate to an object of a type ' 'that supports\n' 'attribute references, which most objects do. This ' 'object is then\n' 'asked to produce the attribute whose name is the ' 'identifier. This\n' 'production can be customized by overriding the ' '"__getattr__()" method.\n' 'If this attribute is not available, the exception ' '"AttributeError" is\n' 'raised. Otherwise, the type and value of the object ' 'produced is\n' 'determined by the object. Multiple evaluations of ' 'the same attribute\n' 'reference may yield different objects.\n', 'augassign': 'Augmented assignment statements\n' '*******************************\n' '\n' 'Augmented assignment is the combination, in a single statement, ' 'of a\n' 'binary operation and an assignment statement:\n' '\n' ' augmented_assignment_stmt ::= augtarget augop ' '(expression_list | yield_expression)\n' ' augtarget ::= identifier | attributeref | ' 'subscription | slicing\n' ' augop ::= "+=" | "-=" | "*=" | "@=" | ' '"/=" | "//=" | "%=" | "**="\n' ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' '\n' '(See section Primaries for the syntax definitions of the last ' 'three\n' 'symbols.)\n' '\n' 'An augmented assignment evaluates the target (which, unlike ' 'normal\n' 'assignment statements, cannot be an unpacking) and the ' 'expression\n' 'list, performs the binary operation specific to the type of ' 'assignment\n' 'on the two operands, and assigns the result to the original ' 'target.\n' 'The target is only evaluated once.\n' '\n' 'An augmented assignment expression like "x += 1" can be ' 'rewritten as\n' '"x = x + 1" to achieve a similar, but not exactly equal effect. ' 'In the\n' 'augmented version, "x" is only evaluated once. Also, when ' 'possible,\n' 'the actual operation is performed *in-place*, meaning that ' 'rather than\n' 'creating a new object and assigning that to the target, the old ' 'object\n' 'is modified instead.\n' '\n' 'Unlike normal assignments, augmented assignments evaluate the ' 'left-\n' 'hand side *before* evaluating the right-hand side. For ' 'example, "a[i]\n' '+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and ' 'performs\n' 'the addition, and lastly, it writes the result back to "a[i]".\n' '\n' 'With the exception of assigning to tuples and multiple targets ' 'in a\n' 'single statement, the assignment done by augmented assignment\n' 'statements is handled the same way as normal assignments. ' 'Similarly,\n' 'with the exception of the possible *in-place* behavior, the ' 'binary\n' 'operation performed by augmented assignment is the same as the ' 'normal\n' 'binary operations.\n' '\n' 'For targets which are attribute references, the same caveat ' 'about\n' 'class and instance attributes applies as for regular ' 'assignments.\n', 'binary': 'Binary arithmetic operations\n' '****************************\n' '\n' 'The binary arithmetic operations have the conventional priority\n' 'levels. Note that some of these operations also apply to certain ' 'non-\n' 'numeric types. Apart from the power operator, there are only two\n' 'levels, one for multiplicative operators and one for additive\n' 'operators:\n' '\n' ' m_expr ::= u_expr | m_expr "*" u_expr | m_expr "@" m_expr |\n' ' m_expr "//" u_expr | m_expr "/" u_expr |\n' ' m_expr "%" u_expr\n' ' a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n' '\n' 'The "*" (multiplication) operator yields the product of its ' 'arguments.\n' 'The arguments must either both be numbers, or one argument must be ' 'an\n' 'integer and the other must be a sequence. In the former case, the\n' 'numbers are converted to a common type and then multiplied ' 'together.\n' 'In the latter case, sequence repetition is performed; a negative\n' 'repetition factor yields an empty sequence.\n' '\n' 'The "@" (at) operator is intended to be used for matrix\n' 'multiplication. No builtin Python types implement this operator.\n' '\n' 'New in version 3.5.\n' '\n' 'The "/" (division) and "//" (floor division) operators yield the\n' 'quotient of their arguments. The numeric arguments are first\n' 'converted to a common type. Division of integers yields a float, ' 'while\n' 'floor division of integers results in an integer; the result is ' 'that\n' 'of mathematical division with the ‘floor’ function applied to the\n' 'result. Division by zero raises the "ZeroDivisionError" ' 'exception.\n' '\n' 'The "%" (modulo) operator yields the remainder from the division ' 'of\n' 'the first argument by the second. The numeric arguments are ' 'first\n' 'converted to a common type. A zero right argument raises the\n' '"ZeroDivisionError" exception. The arguments may be floating ' 'point\n' 'numbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals ' '"4*0.7 +\n' '0.34".) The modulo operator always yields a result with the same ' 'sign\n' 'as its second operand (or zero); the absolute value of the result ' 'is\n' 'strictly smaller than the absolute value of the second operand ' '[1].\n' '\n' 'The floor division and modulo operators are connected by the ' 'following\n' 'identity: "x == (x//y)*y + (x%y)". Floor division and modulo are ' 'also\n' 'connected with the built-in function "divmod()": "divmod(x, y) ==\n' '(x//y, x%y)". [2].\n' '\n' 'In addition to performing the modulo operation on numbers, the ' '"%"\n' 'operator is also overloaded by string objects to perform ' 'old-style\n' 'string formatting (also known as interpolation). The syntax for\n' 'string formatting is described in the Python Library Reference,\n' 'section printf-style String Formatting.\n' '\n' 'The floor division operator, the modulo operator, and the ' '"divmod()"\n' 'function are not defined for complex numbers. Instead, convert to ' 'a\n' 'floating point number using the "abs()" function if appropriate.\n' '\n' 'The "+" (addition) operator yields the sum of its arguments. The\n' 'arguments must either both be numbers or both be sequences of the ' 'same\n' 'type. In the former case, the numbers are converted to a common ' 'type\n' 'and then added together. In the latter case, the sequences are\n' 'concatenated.\n' '\n' 'The "-" (subtraction) operator yields the difference of its ' 'arguments.\n' 'The numeric arguments are first converted to a common type.\n', 'bitwise': 'Binary bitwise operations\n' '*************************\n' '\n' 'Each of the three bitwise operations has a different priority ' 'level:\n' '\n' ' and_expr ::= shift_expr | and_expr "&" shift_expr\n' ' xor_expr ::= and_expr | xor_expr "^" and_expr\n' ' or_expr ::= xor_expr | or_expr "|" xor_expr\n' '\n' 'The "&" operator yields the bitwise AND of its arguments, which ' 'must\n' 'be integers.\n' '\n' 'The "^" operator yields the bitwise XOR (exclusive OR) of its\n' 'arguments, which must be integers.\n' '\n' 'The "|" operator yields the bitwise (inclusive) OR of its ' 'arguments,\n' 'which must be integers.\n', 'bltin-code-objects': 'Code Objects\n' '************\n' '\n' 'Code objects are used by the implementation to ' 'represent “pseudo-\n' 'compiled” executable Python code such as a function ' 'body. They differ\n' 'from function objects because they don’t contain a ' 'reference to their\n' 'global execution environment. Code objects are ' 'returned by the built-\n' 'in "compile()" function and can be extracted from ' 'function objects\n' 'through their "__code__" attribute. See also the ' '"code" module.\n' '\n' 'A code object can be executed or evaluated by passing ' 'it (instead of a\n' 'source string) to the "exec()" or "eval()" built-in ' 'functions.\n' '\n' 'See The standard type hierarchy for more ' 'information.\n', 'bltin-ellipsis-object': 'The Ellipsis Object\n' '*******************\n' '\n' 'This object is commonly used by slicing (see ' 'Slicings). It supports\n' 'no special operations. There is exactly one ' 'ellipsis object, named\n' '"Ellipsis" (a built-in name). "type(Ellipsis)()" ' 'produces the\n' '"Ellipsis" singleton.\n' '\n' 'It is written as "Ellipsis" or "...".\n', 'bltin-null-object': 'The Null Object\n' '***************\n' '\n' 'This object is returned by functions that don’t ' 'explicitly return a\n' 'value. It supports no special operations. There is ' 'exactly one null\n' 'object, named "None" (a built-in name). "type(None)()" ' 'produces the\n' 'same singleton.\n' '\n' 'It is written as "None".\n', 'bltin-type-objects': 'Type Objects\n' '************\n' '\n' 'Type objects represent the various object types. An ' 'object’s type is\n' 'accessed by the built-in function "type()". There are ' 'no special\n' 'operations on types. The standard module "types" ' 'defines names for\n' 'all standard built-in types.\n' '\n' 'Types are written like this: "<class \'int\'>".\n', 'booleans': 'Boolean operations\n' '******************\n' '\n' ' or_test ::= and_test | or_test "or" and_test\n' ' and_test ::= not_test | and_test "and" not_test\n' ' not_test ::= comparison | "not" not_test\n' '\n' 'In the context of Boolean operations, and also when expressions ' 'are\n' 'used by control flow statements, the following values are ' 'interpreted\n' 'as false: "False", "None", numeric zero of all types, and empty\n' 'strings and containers (including strings, tuples, lists,\n' 'dictionaries, sets and frozensets). All other values are ' 'interpreted\n' 'as true. User-defined objects can customize their truth value ' 'by\n' 'providing a "__bool__()" method.\n' '\n' 'The operator "not" yields "True" if its argument is false, ' '"False"\n' 'otherwise.\n' '\n' 'The expression "x and y" first evaluates *x*; if *x* is false, ' 'its\n' 'value is returned; otherwise, *y* is evaluated and the resulting ' 'value\n' 'is returned.\n' '\n' 'The expression "x or y" first evaluates *x*; if *x* is true, its ' 'value\n' 'is returned; otherwise, *y* is evaluated and the resulting value ' 'is\n' 'returned.\n' '\n' 'Note that neither "and" nor "or" restrict the value and type ' 'they\n' 'return to "False" and "True", but rather return the last ' 'evaluated\n' 'argument. This is sometimes useful, e.g., if "s" is a string ' 'that\n' 'should be replaced by a default value if it is empty, the ' 'expression\n' '"s or \'foo\'" yields the desired value. Because "not" has to ' 'create a\n' 'new value, it returns a boolean value regardless of the type of ' 'its\n' 'argument (for example, "not \'foo\'" produces "False" rather ' 'than "\'\'".)\n', 'break': 'The "break" statement\n' '*********************\n' '\n' ' break_stmt ::= "break"\n' '\n' '"break" may only occur syntactically nested in a "for" or "while"\n' 'loop, but not nested in a function or class definition within that\n' 'loop.\n' '\n' 'It terminates the nearest enclosing loop, skipping the optional ' '"else"\n' 'clause if the loop has one.\n' '\n' 'If a "for" loop is terminated by "break", the loop control target\n' 'keeps its current value.\n' '\n' 'When "break" passes control out of a "try" statement with a ' '"finally"\n' 'clause, that "finally" clause is executed before really leaving ' 'the\n' 'loop.\n', 'callable-types': 'Emulating callable objects\n' '**************************\n' '\n' 'object.__call__(self[, args...])\n' '\n' ' Called when the instance is “called” as a function; if ' 'this method\n' ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' ' "x.__call__(arg1, arg2, ...)".\n', 'calls': 'Calls\n' '*****\n' '\n' 'A call calls a callable object (e.g., a *function*) with a ' 'possibly\n' 'empty series of *arguments*:\n' '\n' ' call ::= primary "(" [argument_list [","] | ' 'comprehension] ")"\n' ' argument_list ::= positional_arguments ["," ' 'starred_and_keywords]\n' ' ["," keywords_arguments]\n' ' | starred_and_keywords ["," ' 'keywords_arguments]\n' ' | keywords_arguments\n' ' positional_arguments ::= ["*"] expression ("," ["*"] ' 'expression)*\n' ' starred_and_keywords ::= ("*" expression | keyword_item)\n' ' ("," "*" expression | "," ' 'keyword_item)*\n' ' keywords_arguments ::= (keyword_item | "**" expression)\n' ' ("," keyword_item | "," "**" ' 'expression)*\n' ' keyword_item ::= identifier "=" expression\n' '\n' 'An optional trailing comma may be present after the positional and\n' 'keyword arguments but does not affect the semantics.\n' '\n' 'The primary must evaluate to a callable object (user-defined\n' 'functions, built-in functions, methods of built-in objects, class\n' 'objects, methods of class instances, and all objects having a\n' '"__call__()" method are callable). All argument expressions are\n' 'evaluated before the call is attempted. Please refer to section\n' 'Function definitions for the syntax of formal *parameter* lists.\n' '\n' 'If keyword arguments are present, they are first converted to\n' 'positional arguments, as follows. First, a list of unfilled slots ' 'is\n' 'created for the formal parameters. If there are N positional\n' 'arguments, they are placed in the first N slots. Next, for each\n' 'keyword argument, the identifier is used to determine the\n' 'corresponding slot (if the identifier is the same as the first ' 'formal\n' 'parameter name, the first slot is used, and so on). If the slot ' 'is\n' 'already filled, a "TypeError" exception is raised. Otherwise, the\n' 'value of the argument is placed in the slot, filling it (even if ' 'the\n' 'expression is "None", it fills the slot). When all arguments have\n' 'been processed, the slots that are still unfilled are filled with ' 'the\n' 'corresponding default value from the function definition. ' '(Default\n' 'values are calculated, once, when the function is defined; thus, a\n' 'mutable object such as a list or dictionary used as default value ' 'will\n' 'be shared by all calls that don’t specify an argument value for ' 'the\n' 'corresponding slot; this should usually be avoided.) If there are ' 'any\n' 'unfilled slots for which no default value is specified, a ' '"TypeError"\n' 'exception is raised. Otherwise, the list of filled slots is used ' 'as\n' 'the argument list for the call.\n' '\n' '**CPython implementation detail:** An implementation may provide\n' 'built-in functions whose positional parameters do not have names, ' 'even\n' 'if they are ‘named’ for the purpose of documentation, and which\n' 'therefore cannot be supplied by keyword. In CPython, this is the ' 'case\n' 'for functions implemented in C that use "PyArg_ParseTuple()" to ' 'parse\n' 'their arguments.\n' '\n' 'If there are more positional arguments than there are formal ' 'parameter\n' 'slots, a "TypeError" exception is raised, unless a formal ' 'parameter\n' 'using the syntax "*identifier" is present; in this case, that ' 'formal\n' 'parameter receives a tuple containing the excess positional ' 'arguments\n' '(or an empty tuple if there were no excess positional arguments).\n' '\n' 'If any keyword argument does not correspond to a formal parameter\n' 'name, a "TypeError" exception is raised, unless a formal parameter\n' 'using the syntax "**identifier" is present; in this case, that ' 'formal\n' 'parameter receives a dictionary containing the excess keyword\n' 'arguments (using the keywords as keys and the argument values as\n' 'corresponding values), or a (new) empty dictionary if there were ' 'no\n' 'excess keyword arguments.\n' '\n' 'If the syntax "*expression" appears in the function call, ' '"expression"\n' 'must evaluate to an *iterable*. Elements from these iterables are\n' 'treated as if they were additional positional arguments. For the ' 'call\n' '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, …, ' '*yM*,\n' 'this is equivalent to a call with M+4 positional arguments *x1*, ' '*x2*,\n' '*y1*, …, *yM*, *x3*, *x4*.\n' '\n' 'A consequence of this is that although the "*expression" syntax ' 'may\n' 'appear *after* explicit keyword arguments, it is processed ' '*before*\n' 'the keyword arguments (and any "**expression" arguments – see ' 'below).\n' 'So:\n' '\n' ' >>> def f(a, b):\n' ' ... print(a, b)\n' ' ...\n' ' >>> f(b=1, *(2,))\n' ' 2 1\n' ' >>> f(a=1, *(2,))\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 1, in <module>\n' " TypeError: f() got multiple values for keyword argument 'a'\n" ' >>> f(1, *(2,))\n' ' 1 2\n' '\n' 'It is unusual for both keyword arguments and the "*expression" ' 'syntax\n' 'to be used in the same call, so in practice this confusion does ' 'not\n' 'arise.\n' '\n' 'If the syntax "**expression" appears in the function call,\n' '"expression" must evaluate to a *mapping*, the contents of which ' 'are\n' 'treated as additional keyword arguments. If a keyword is already\n' 'present (as an explicit keyword argument, or from another ' 'unpacking),\n' 'a "TypeError" exception is raised.\n' '\n' 'Formal parameters using the syntax "*identifier" or "**identifier"\n' 'cannot be used as positional argument slots or as keyword argument\n' 'names.\n' '\n' 'Changed in version 3.5: Function calls accept any number of "*" ' 'and\n' '"**" unpackings, positional arguments may follow iterable ' 'unpackings\n' '("*"), and keyword arguments may follow dictionary unpackings ' '("**").\n' 'Originally proposed by **PEP 448**.\n' '\n' 'A call always returns some value, possibly "None", unless it raises ' 'an\n' 'exception. How this value is computed depends on the type of the\n' 'callable object.\n' '\n' 'If it is—\n' '\n' 'a user-defined function:\n' ' The code block for the function is executed, passing it the\n' ' argument list. The first thing the code block will do is bind ' 'the\n' ' formal parameters to the arguments; this is described in ' 'section\n' ' Function definitions. When the code block executes a "return"\n' ' statement, this specifies the return value of the function ' 'call.\n' '\n' 'a built-in function or method:\n' ' The result is up to the interpreter; see Built-in Functions for ' 'the\n' ' descriptions of built-in functions and methods.\n' '\n' 'a class object:\n' ' A new instance of that class is returned.\n' '\n' 'a class instance method:\n' ' The corresponding user-defined function is called, with an ' 'argument\n' ' list that is one longer than the argument list of the call: the\n' ' instance becomes the first argument.\n' '\n' 'a class instance:\n' ' The class must define a "__call__()" method; the effect is then ' 'the\n' ' same as if that method was called.\n', 'class': 'Class definitions\n' '*****************\n' '\n' 'A class definition defines a class object (see section The ' 'standard\n' 'type hierarchy):\n' '\n' ' classdef ::= [decorators] "class" classname [inheritance] ":" ' 'suite\n' ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' 'list\n' 'usually gives a list of base classes (see Metaclasses for more\n' 'advanced uses), so each item in the list should evaluate to a ' 'class\n' 'object which allows subclassing. Classes without an inheritance ' 'list\n' 'inherit, by default, from the base class "object"; hence,\n' '\n' ' class Foo:\n' ' pass\n' '\n' 'is equivalent to\n' '\n' ' class Foo(object):\n' ' pass\n' '\n' 'The class’s suite is then executed in a new execution frame (see\n' 'Naming and binding), using a newly created local namespace and the\n' 'original global namespace. (Usually, the suite contains mostly\n' 'function definitions.) When the class’s suite finishes execution, ' 'its\n' 'execution frame is discarded but its local namespace is saved. [3] ' 'A\n' 'class object is then created using the inheritance list for the ' 'base\n' 'classes and the saved local namespace for the attribute ' 'dictionary.\n' 'The class name is bound to this class object in the original local\n' 'namespace.\n' '\n' 'The order in which attributes are defined in the class body is\n' 'preserved in the new class’s "__dict__". Note that this is ' 'reliable\n' 'only right after the class is created and only for classes that ' 'were\n' 'defined using the definition syntax.\n' '\n' 'Class creation can be customized heavily using metaclasses.\n' '\n' 'Classes can also be decorated: just like when decorating ' 'functions,\n' '\n' ' @f1(arg)\n' ' @f2\n' ' class Foo: pass\n' '\n' 'is roughly equivalent to\n' '\n' ' class Foo: pass\n' ' Foo = f1(arg)(f2(Foo))\n' '\n' 'The evaluation rules for the decorator expressions are the same as ' 'for\n' 'function decorators. The result is then bound to the class name.\n' '\n' '**Programmer’s note:** Variables defined in the class definition ' 'are\n' 'class attributes; they are shared by instances. Instance ' 'attributes\n' 'can be set in a method with "self.name = value". Both class and\n' 'instance attributes are accessible through the notation ' '“"self.name"”,\n' 'and an instance attribute hides a class attribute with the same ' 'name\n' 'when accessed in this way. Class attributes can be used as ' 'defaults\n' 'for instance attributes, but using mutable values there can lead ' 'to\n' 'unexpected results. Descriptors can be used to create instance\n' 'variables with different implementation details.\n' '\n' 'See also:\n' '\n' ' **PEP 3115** - Metaclasses in Python 3000\n' ' The proposal that changed the declaration of metaclasses to ' 'the\n' ' current syntax, and the semantics for how classes with\n' ' metaclasses are constructed.\n' '\n' ' **PEP 3129** - Class Decorators\n' ' The proposal that added class decorators. Function and ' 'method\n' ' decorators were introduced in **PEP 318**.\n', 'comparisons': 'Comparisons\n' '***********\n' '\n' 'Unlike C, all comparison operations in Python have the same ' 'priority,\n' 'which is lower than that of any arithmetic, shifting or ' 'bitwise\n' 'operation. Also unlike C, expressions like "a < b < c" have ' 'the\n' 'interpretation that is conventional in mathematics:\n' '\n' ' comparison ::= or_expr (comp_operator or_expr)*\n' ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n' ' | "is" ["not"] | ["not"] "in"\n' '\n' 'Comparisons yield boolean values: "True" or "False".\n' '\n' 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" ' 'is\n' 'equivalent to "x < y and y <= z", except that "y" is ' 'evaluated only\n' 'once (but in both cases "z" is not evaluated at all when "x < ' 'y" is\n' 'found to be false).\n' '\n' 'Formally, if *a*, *b*, *c*, …, *y*, *z* are expressions and ' '*op1*,\n' '*op2*, …, *opN* are comparison operators, then "a op1 b op2 c ' '... y\n' 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN ' 'z", except\n' 'that each expression is evaluated at most once.\n' '\n' 'Note that "a op1 b op2 c" doesn’t imply any kind of ' 'comparison between\n' '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal ' '(though\n' 'perhaps not pretty).\n' '\n' '\n' 'Value comparisons\n' '=================\n' '\n' 'The operators "<", ">", "==", ">=", "<=", and "!=" compare ' 'the values\n' 'of two objects. The objects do not need to have the same ' 'type.\n' '\n' 'Chapter Objects, values and types states that objects have a ' 'value (in\n' 'addition to type and identity). The value of an object is a ' 'rather\n' 'abstract notion in Python: For example, there is no canonical ' 'access\n' 'method for an object’s value. Also, there is no requirement ' 'that the\n' 'value of an object should be constructed in a particular way, ' 'e.g.\n' 'comprised of all its data attributes. Comparison operators ' 'implement a\n' 'particular notion of what the value of an object is. One can ' 'think of\n' 'them as defining the value of an object indirectly, by means ' 'of their\n' 'comparison implementation.\n' '\n' 'Because all types are (direct or indirect) subtypes of ' '"object", they\n' 'inherit the default comparison behavior from "object". Types ' 'can\n' 'customize their comparison behavior by implementing *rich ' 'comparison\n' 'methods* like "__lt__()", described in Basic customization.\n' '\n' 'The default behavior for equality comparison ("==" and "!=") ' 'is based\n' 'on the identity of the objects. Hence, equality comparison ' 'of\n' 'instances with the same identity results in equality, and ' 'equality\n' 'comparison of instances with different identities results in\n' 'inequality. A motivation for this default behavior is the ' 'desire that\n' 'all objects should be reflexive (i.e. "x is y" implies "x == ' 'y").\n' '\n' 'A default order comparison ("<", ">", "<=", and ">=") is not ' 'provided;\n' 'an attempt raises "TypeError". A motivation for this default ' 'behavior\n' 'is the lack of a similar invariant as for equality.\n' '\n' 'The behavior of the default equality comparison, that ' 'instances with\n' 'different identities are always unequal, may be in contrast ' 'to what\n' 'types will need that have a sensible definition of object ' 'value and\n' 'value-based equality. Such types will need to customize ' 'their\n' 'comparison behavior, and in fact, a number of built-in types ' 'have done\n' 'that.\n' '\n' 'The following list describes the comparison behavior of the ' 'most\n' 'important built-in types.\n' '\n' '* Numbers of built-in numeric types (Numeric Types — int, ' 'float,\n' ' complex) and of the standard library types ' '"fractions.Fraction" and\n' ' "decimal.Decimal" can be compared within and across their ' 'types,\n' ' with the restriction that complex numbers do not support ' 'order\n' ' comparison. Within the limits of the types involved, they ' 'compare\n' ' mathematically (algorithmically) correct without loss of ' 'precision.\n' '\n' ' The not-a-number values "float(\'NaN\')" and ' '"Decimal(\'NaN\')" are\n' ' special. They are identical to themselves ("x is x" is ' 'true) but\n' ' are not equal to themselves ("x == x" is false). ' 'Additionally,\n' ' comparing any number to a not-a-number value will return ' '"False".\n' ' For example, both "3 < float(\'NaN\')" and "float(\'NaN\') ' '< 3" will\n' ' return "False".\n' '\n' '* Binary sequences (instances of "bytes" or "bytearray") can ' 'be\n' ' compared within and across their types. They compare\n' ' lexicographically using the numeric values of their ' 'elements.\n' '\n' '* Strings (instances of "str") compare lexicographically ' 'using the\n' ' numerical Unicode code points (the result of the built-in ' 'function\n' ' "ord()") of their characters. [3]\n' '\n' ' Strings and binary sequences cannot be directly compared.\n' '\n' '* Sequences (instances of "tuple", "list", or "range") can be ' 'compared\n' ' only within each of their types, with the restriction that ' 'ranges do\n' ' not support order comparison. Equality comparison across ' 'these\n' ' types results in inequality, and ordering comparison across ' 'these\n' ' types raises "TypeError".\n' '\n' ' Sequences compare lexicographically using comparison of\n' ' corresponding elements, whereby reflexivity of the elements ' 'is\n' ' enforced.\n' '\n' ' In enforcing reflexivity of elements, the comparison of ' 'collections\n' ' assumes that for a collection element "x", "x == x" is ' 'always true.\n' ' Based on that assumption, element identity is compared ' 'first, and\n' ' element comparison is performed only for distinct ' 'elements. This\n' ' approach yields the same result as a strict element ' 'comparison\n' ' would, if the compared elements are reflexive. For ' 'non-reflexive\n' ' elements, the result is different than for strict element\n' ' comparison, and may be surprising: The non-reflexive ' 'not-a-number\n' ' values for example result in the following comparison ' 'behavior when\n' ' used in a list:\n' '\n' " >>> nan = float('NaN')\n" ' >>> nan is nan\n' ' True\n' ' >>> nan == nan\n' ' False <-- the defined non-reflexive ' 'behavior of NaN\n' ' >>> [nan] == [nan]\n' ' True <-- list enforces reflexivity and ' 'tests identity first\n' '\n' ' Lexicographical comparison between built-in collections ' 'works as\n' ' follows:\n' '\n' ' * For two collections to compare equal, they must be of the ' 'same\n' ' type, have the same length, and each pair of ' 'corresponding\n' ' elements must compare equal (for example, "[1,2] == ' '(1,2)" is\n' ' false because the type is not the same).\n' '\n' ' * Collections that support order comparison are ordered the ' 'same as\n' ' their first unequal elements (for example, "[1,2,x] <= ' '[1,2,y]"\n' ' has the same value as "x <= y"). If a corresponding ' 'element does\n' ' not exist, the shorter collection is ordered first (for ' 'example,\n' ' "[1,2] < [1,2,3]" is true).\n' '\n' '* Mappings (instances of "dict") compare equal if and only if ' 'they\n' ' have equal *(key, value)* pairs. Equality comparison of the ' 'keys and\n' ' values enforces reflexivity.\n' '\n' ' Order comparisons ("<", ">", "<=", and ">=") raise ' '"TypeError".\n' '\n' '* Sets (instances of "set" or "frozenset") can be compared ' 'within and\n' ' across their types.\n' '\n' ' They define order comparison operators to mean subset and ' 'superset\n' ' tests. Those relations do not define total orderings (for ' 'example,\n' ' the two sets "{1,2}" and "{2,3}" are not equal, nor subsets ' 'of one\n' ' another, nor supersets of one another). Accordingly, sets ' 'are not\n' ' appropriate arguments for functions which depend on total ' 'ordering\n' ' (for example, "min()", "max()", and "sorted()" produce ' 'undefined\n' ' results given a list of sets as inputs).\n' '\n' ' Comparison of sets enforces reflexivity of its elements.\n' '\n' '* Most other built-in types have no comparison methods ' 'implemented, so\n' ' they inherit the default comparison behavior.\n' '\n' 'User-defined classes that customize their comparison behavior ' 'should\n' 'follow some consistency rules, if possible:\n' '\n' '* Equality comparison should be reflexive. In other words, ' 'identical\n' ' objects should compare equal:\n' '\n' ' "x is y" implies "x == y"\n' '\n' '* Comparison should be symmetric. In other words, the ' 'following\n' ' expressions should have the same result:\n' '\n' ' "x == y" and "y == x"\n' '\n' ' "x != y" and "y != x"\n' '\n' ' "x < y" and "y > x"\n' '\n' ' "x <= y" and "y >= x"\n' '\n' '* Comparison should be transitive. The following ' '(non-exhaustive)\n' ' examples illustrate that:\n' '\n' ' "x > y and y > z" implies "x > z"\n' '\n' ' "x < y and y <= z" implies "x < z"\n' '\n' '* Inverse comparison should result in the boolean negation. ' 'In other\n' ' words, the following expressions should have the same ' 'result:\n' '\n' ' "x == y" and "not x != y"\n' '\n' ' "x < y" and "not x >= y" (for total ordering)\n' '\n' ' "x > y" and "not x <= y" (for total ordering)\n' '\n' ' The last two expressions apply to totally ordered ' 'collections (e.g.\n' ' to sequences, but not to sets or mappings). See also the\n' ' "total_ordering()" decorator.\n' '\n' '* The "hash()" result should be consistent with equality. ' 'Objects that\n' ' are equal should either have the same hash value, or be ' 'marked as\n' ' unhashable.\n' '\n' 'Python does not enforce these consistency rules. In fact, ' 'the\n' 'not-a-number values are an example for not following these ' 'rules.\n' '\n' '\n' 'Membership test operations\n' '==========================\n' '\n' 'The operators "in" and "not in" test for membership. "x in ' 's"\n' 'evaluates to "True" if *x* is a member of *s*, and "False" ' 'otherwise.\n' '"x not in s" returns the negation of "x in s". All built-in ' 'sequences\n' 'and set types support this as well as dictionary, for which ' '"in" tests\n' 'whether the dictionary has a given key. For container types ' 'such as\n' 'list, tuple, set, frozenset, dict, or collections.deque, the\n' 'expression "x in y" is equivalent to "any(x is e or x == e ' 'for e in\n' 'y)".\n' '\n' 'For the string and bytes types, "x in y" is "True" if and ' 'only if *x*\n' 'is a substring of *y*. An equivalent test is "y.find(x) != ' '-1".\n' 'Empty strings are always considered to be a substring of any ' 'other\n' 'string, so """ in "abc"" will return "True".\n' '\n' 'For user-defined classes which define the "__contains__()" ' 'method, "x\n' 'in y" returns "True" if "y.__contains__(x)" returns a true ' 'value, and\n' '"False" otherwise.\n' '\n' 'For user-defined classes which do not define "__contains__()" ' 'but do\n' 'define "__iter__()", "x in y" is "True" if some value "z" ' 'with "x ==\n' 'z" is produced while iterating over "y". If an exception is ' 'raised\n' 'during the iteration, it is as if "in" raised that ' 'exception.\n' '\n' 'Lastly, the old-style iteration protocol is tried: if a class ' 'defines\n' '"__getitem__()", "x in y" is "True" if and only if there is a ' 'non-\n' 'negative integer index *i* such that "x == y[i]", and all ' 'lower\n' 'integer indices do not raise "IndexError" exception. (If any ' 'other\n' 'exception is raised, it is as if "in" raised that ' 'exception).\n' '\n' 'The operator "not in" is defined to have the inverse true ' 'value of\n' '"in".\n' '\n' '\n' 'Identity comparisons\n' '====================\n' '\n' 'The operators "is" and "is not" test for object identity: "x ' 'is y" is\n' 'true if and only if *x* and *y* are the same object. Object ' 'identity\n' 'is determined using the "id()" function. "x is not y" yields ' 'the\n' 'inverse truth value. [4]\n', 'compound': 'Compound statements\n' '*******************\n' '\n' 'Compound statements contain (groups of) other statements; they ' 'affect\n' 'or control the execution of those other statements in some way. ' 'In\n' 'general, compound statements span multiple lines, although in ' 'simple\n' 'incarnations a whole compound statement may be contained in one ' 'line.\n' '\n' 'The "if", "while" and "for" statements implement traditional ' 'control\n' 'flow constructs. "try" specifies exception handlers and/or ' 'cleanup\n' 'code for a group of statements, while the "with" statement ' 'allows the\n' 'execution of initialization and finalization code around a block ' 'of\n' 'code. Function and class definitions are also syntactically ' 'compound\n' 'statements.\n' '\n' 'A compound statement consists of one or more ‘clauses.’ A ' 'clause\n' 'consists of a header and a ‘suite.’ The clause headers of a\n' 'particular compound statement are all at the same indentation ' 'level.\n' 'Each clause header begins with a uniquely identifying keyword ' 'and ends\n' 'with a colon. A suite is a group of statements controlled by a\n' 'clause. A suite can be one or more semicolon-separated simple\n' 'statements on the same line as the header, following the ' 'header’s\n' 'colon, or it can be one or more indented statements on ' 'subsequent\n' 'lines. Only the latter form of a suite can contain nested ' 'compound\n' 'statements; the following is illegal, mostly because it wouldn’t ' 'be\n' 'clear to which "if" clause a following "else" clause would ' 'belong:\n' '\n' ' if test1: if test2: print(x)\n' '\n' 'Also note that the semicolon binds tighter than the colon in ' 'this\n' 'context, so that in the following example, either all or none of ' 'the\n' '"print()" calls are executed:\n' '\n' ' if x < y < z: print(x); print(y); print(z)\n' '\n' 'Summarizing:\n' '\n' ' compound_stmt ::= if_stmt\n' ' | while_stmt\n' ' | for_stmt\n' ' | try_stmt\n' ' | with_stmt\n' ' | funcdef\n' ' | classdef\n' ' | async_with_stmt\n' ' | async_for_stmt\n' ' | async_funcdef\n' ' suite ::= stmt_list NEWLINE | NEWLINE INDENT ' 'statement+ DEDENT\n' ' statement ::= stmt_list NEWLINE | compound_stmt\n' ' stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n' '\n' 'Note that statements always end in a "NEWLINE" possibly followed ' 'by a\n' '"DEDENT". Also note that optional continuation clauses always ' 'begin\n' 'with a keyword that cannot start a statement, thus there are no\n' 'ambiguities (the ‘dangling "else"’ problem is solved in Python ' 'by\n' 'requiring nested "if" statements to be indented).\n' '\n' 'The formatting of the grammar rules in the following sections ' 'places\n' 'each clause on a separate line for clarity.\n' '\n' '\n' 'The "if" statement\n' '==================\n' '\n' 'The "if" statement is used for conditional execution:\n' '\n' ' if_stmt ::= "if" expression ":" suite\n' ' ("elif" expression ":" suite)*\n' ' ["else" ":" suite]\n' '\n' 'It selects exactly one of the suites by evaluating the ' 'expressions one\n' 'by one until one is found to be true (see section Boolean ' 'operations\n' 'for the definition of true and false); then that suite is ' 'executed\n' '(and no other part of the "if" statement is executed or ' 'evaluated).\n' 'If all expressions are false, the suite of the "else" clause, ' 'if\n' 'present, is executed.\n' '\n' '\n' 'The "while" statement\n' '=====================\n' '\n' 'The "while" statement is used for repeated execution as long as ' 'an\n' 'expression is true:\n' '\n' ' while_stmt ::= "while" expression ":" suite\n' ' ["else" ":" suite]\n' '\n' 'This repeatedly tests the expression and, if it is true, ' 'executes the\n' 'first suite; if the expression is false (which may be the first ' 'time\n' 'it is tested) the suite of the "else" clause, if present, is ' 'executed\n' 'and the loop terminates.\n' '\n' 'A "break" statement executed in the first suite terminates the ' 'loop\n' 'without executing the "else" clause’s suite. A "continue" ' 'statement\n' 'executed in the first suite skips the rest of the suite and goes ' 'back\n' 'to testing the expression.\n' '\n' '\n' 'The "for" statement\n' '===================\n' '\n' 'The "for" statement is used to iterate over the elements of a ' 'sequence\n' '(such as a string, tuple or list) or other iterable object:\n' '\n' ' for_stmt ::= "for" target_list "in" expression_list ":" ' 'suite\n' ' ["else" ":" suite]\n' '\n' 'The expression list is evaluated once; it should yield an ' 'iterable\n' 'object. An iterator is created for the result of the\n' '"expression_list". The suite is then executed once for each ' 'item\n' 'provided by the iterator, in the order returned by the ' 'iterator. Each\n' 'item in turn is assigned to the target list using the standard ' 'rules\n' 'for assignments (see Assignment statements), and then the suite ' 'is\n' 'executed. When the items are exhausted (which is immediately ' 'when the\n' 'sequence is empty or an iterator raises a "StopIteration" ' 'exception),\n' 'the suite in the "else" clause, if present, is executed, and the ' 'loop\n' 'terminates.\n' '\n' 'A "break" statement executed in the first suite terminates the ' 'loop\n' 'without executing the "else" clause’s suite. A "continue" ' 'statement\n' 'executed in the first suite skips the rest of the suite and ' 'continues\n' 'with the next item, or with the "else" clause if there is no ' 'next\n' 'item.\n' '\n' 'The for-loop makes assignments to the variables(s) in the target ' 'list.\n' 'This overwrites all previous assignments to those variables ' 'including\n' 'those made in the suite of the for-loop:\n' '\n' ' for i in range(10):\n' ' print(i)\n' ' i = 5 # this will not affect the for-loop\n' ' # because i will be overwritten with ' 'the next\n' ' # index in the range\n' '\n' 'Names in the target list are not deleted when the loop is ' 'finished,\n' 'but if the sequence is empty, they will not have been assigned ' 'to at\n' 'all by the loop. Hint: the built-in function "range()" returns ' 'an\n' 'iterator of integers suitable to emulate the effect of Pascal’s ' '"for i\n' ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, ' '2]".\n' '\n' 'Note:\n' '\n' ' There is a subtlety when the sequence is being modified by the ' 'loop\n' ' (this can only occur for mutable sequences, e.g. lists). An\n' ' internal counter is used to keep track of which item is used ' 'next,\n' ' and this is incremented on each iteration. When this counter ' 'has\n' ' reached the length of the sequence the loop terminates. This ' 'means\n' ' that if the suite deletes the current (or a previous) item ' 'from the\n' ' sequence, the next item will be skipped (since it gets the ' 'index of\n' ' the current item which has already been treated). Likewise, ' 'if the\n' ' suite inserts an item in the sequence before the current item, ' 'the\n' ' current item will be treated again the next time through the ' 'loop.\n' ' This can lead to nasty bugs that can be avoided by making a\n' ' temporary copy using a slice of the whole sequence, e.g.,\n' '\n' ' for x in a[:]:\n' ' if x < 0: a.remove(x)\n' '\n' '\n' 'The "try" statement\n' '===================\n' '\n' 'The "try" statement specifies exception handlers and/or cleanup ' 'code\n' 'for a group of statements:\n' '\n' ' try_stmt ::= try1_stmt | try2_stmt\n' ' try1_stmt ::= "try" ":" suite\n' ' ("except" [expression ["as" identifier]] ":" ' 'suite)+\n' ' ["else" ":" suite]\n' ' ["finally" ":" suite]\n' ' try2_stmt ::= "try" ":" suite\n' ' "finally" ":" suite\n' '\n' 'The "except" clause(s) specify one or more exception handlers. ' 'When no\n' 'exception occurs in the "try" clause, no exception handler is\n' 'executed. When an exception occurs in the "try" suite, a search ' 'for an\n' 'exception handler is started. This search inspects the except ' 'clauses\n' 'in turn until one is found that matches the exception. An ' 'expression-\n' 'less except clause, if present, must be last; it matches any\n' 'exception. For an except clause with an expression, that ' 'expression\n' 'is evaluated, and the clause matches the exception if the ' 'resulting\n' 'object is “compatible” with the exception. An object is ' 'compatible\n' 'with an exception if it is the class or a base class of the ' 'exception\n' 'object or a tuple containing an item compatible with the ' 'exception.\n' '\n' 'If no except clause matches the exception, the search for an ' 'exception\n' 'handler continues in the surrounding code and on the invocation ' 'stack.\n' '[1]\n' '\n' 'If the evaluation of an expression in the header of an except ' 'clause\n' 'raises an exception, the original search for a handler is ' 'canceled and\n' 'a search starts for the new exception in the surrounding code ' 'and on\n' 'the call stack (it is treated as if the entire "try" statement ' 'raised\n' 'the exception).\n' '\n' 'When a matching except clause is found, the exception is ' 'assigned to\n' 'the target specified after the "as" keyword in that except ' 'clause, if\n' 'present, and the except clause’s suite is executed. All except\n' 'clauses must have an executable block. When the end of this ' 'block is\n' 'reached, execution continues normally after the entire try ' 'statement.\n' '(This means that if two nested handlers exist for the same ' 'exception,\n' 'and the exception occurs in the try clause of the inner handler, ' 'the\n' 'outer handler will not handle the exception.)\n' '\n' 'When an exception has been assigned using "as target", it is ' 'cleared\n' 'at the end of the except clause. This is as if\n' '\n' ' except E as N:\n' ' foo\n' '\n' 'was translated to\n' '\n' ' except E as N:\n' ' try:\n' ' foo\n' ' finally:\n' ' del N\n' '\n' 'This means the exception must be assigned to a different name to ' 'be\n' 'able to refer to it after the except clause. Exceptions are ' 'cleared\n' 'because with the traceback attached to them, they form a ' 'reference\n' 'cycle with the stack frame, keeping all locals in that frame ' 'alive\n' 'until the next garbage collection occurs.\n' '\n' 'Before an except clause’s suite is executed, details about the\n' 'exception are stored in the "sys" module and can be accessed ' 'via\n' '"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting ' 'of the\n' 'exception class, the exception instance and a traceback object ' '(see\n' 'section The standard type hierarchy) identifying the point in ' 'the\n' 'program where the exception occurred. "sys.exc_info()" values ' 'are\n' 'restored to their previous values (before the call) when ' 'returning\n' 'from a function that handled an exception.\n' '\n' 'The optional "else" clause is executed if the control flow ' 'leaves the\n' '"try" suite, no exception was raised, and no "return", ' '"continue", or\n' '"break" statement was executed. Exceptions in the "else" clause ' 'are\n' 'not handled by the preceding "except" clauses.\n' '\n' 'If "finally" is present, it specifies a ‘cleanup’ handler. The ' '"try"\n' 'clause is executed, including any "except" and "else" clauses. ' 'If an\n' 'exception occurs in any of the clauses and is not handled, the\n' 'exception is temporarily saved. The "finally" clause is ' 'executed. If\n' 'there is a saved exception it is re-raised at the end of the ' '"finally"\n' 'clause. If the "finally" clause raises another exception, the ' 'saved\n' 'exception is set as the context of the new exception. If the ' '"finally"\n' 'clause executes a "return" or "break" statement, the saved ' 'exception\n' 'is discarded:\n' '\n' ' >>> def f():\n' ' ... try:\n' ' ... 1/0\n' ' ... finally:\n' ' ... return 42\n' ' ...\n' ' >>> f()\n' ' 42\n' '\n' 'The exception information is not available to the program ' 'during\n' 'execution of the "finally" clause.\n' '\n' 'When a "return", "break" or "continue" statement is executed in ' 'the\n' '"try" suite of a "try"…"finally" statement, the "finally" clause ' 'is\n' 'also executed ‘on the way out.’ A "continue" statement is ' 'illegal in\n' 'the "finally" clause. (The reason is a problem with the current\n' 'implementation — this restriction may be lifted in the future).\n' '\n' 'The return value of a function is determined by the last ' '"return"\n' 'statement executed. Since the "finally" clause always executes, ' 'a\n' '"return" statement executed in the "finally" clause will always ' 'be the\n' 'last one executed:\n' '\n' ' >>> def foo():\n' ' ... try:\n' " ... return 'try'\n" ' ... finally:\n' " ... return 'finally'\n" ' ...\n' ' >>> foo()\n' " 'finally'\n" '\n' 'Additional information on exceptions can be found in section\n' 'Exceptions, and information on using the "raise" statement to ' 'generate\n' 'exceptions may be found in section The raise statement.\n' '\n' '\n' 'The "with" statement\n' '====================\n' '\n' 'The "with" statement is used to wrap the execution of a block ' 'with\n' 'methods defined by a context manager (see section With ' 'Statement\n' 'Context Managers). This allows common "try"…"except"…"finally" ' 'usage\n' 'patterns to be encapsulated for convenient reuse.\n' '\n' ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' ' with_item ::= expression ["as" target]\n' '\n' 'The execution of the "with" statement with one “item” proceeds ' 'as\n' 'follows:\n' '\n' '1. The context expression (the expression given in the ' '"with_item") is\n' ' evaluated to obtain a context manager.\n' '\n' '2. The context manager’s "__exit__()" is loaded for later use.\n' '\n' '3. The context manager’s "__enter__()" method is invoked.\n' '\n' '4. If a target was included in the "with" statement, the return ' 'value\n' ' from "__enter__()" is assigned to it.\n' '\n' ' Note:\n' '\n' ' The "with" statement guarantees that if the "__enter__()" ' 'method\n' ' returns without an error, then "__exit__()" will always be\n' ' called. Thus, if an error occurs during the assignment to ' 'the\n' ' target list, it will be treated the same as an error ' 'occurring\n' ' within the suite would be. See step 6 below.\n' '\n' '5. The suite is executed.\n' '\n' '6. The context manager’s "__exit__()" method is invoked. If an\n' ' exception caused the suite to be exited, its type, value, ' 'and\n' ' traceback are passed as arguments to "__exit__()". Otherwise, ' 'three\n' ' "None" arguments are supplied.\n' '\n' ' If the suite was exited due to an exception, and the return ' 'value\n' ' from the "__exit__()" method was false, the exception is ' 'reraised.\n' ' If the return value was true, the exception is suppressed, ' 'and\n' ' execution continues with the statement following the "with"\n' ' statement.\n' '\n' ' If the suite was exited for any reason other than an ' 'exception, the\n' ' return value from "__exit__()" is ignored, and execution ' 'proceeds\n' ' at the normal location for the kind of exit that was taken.\n' '\n' 'With more than one item, the context managers are processed as ' 'if\n' 'multiple "with" statements were nested:\n' '\n' ' with A() as a, B() as b:\n' ' suite\n' '\n' 'is equivalent to\n' '\n' ' with A() as a:\n' ' with B() as b:\n' ' suite\n' '\n' 'Changed in version 3.1: Support for multiple context ' 'expressions.\n' '\n' 'See also:\n' '\n' ' **PEP 343** - The “with” statement\n' ' The specification, background, and examples for the Python ' '"with"\n' ' statement.\n' '\n' '\n' 'Function definitions\n' '====================\n' '\n' 'A function definition defines a user-defined function object ' '(see\n' 'section The standard type hierarchy):\n' '\n' ' funcdef ::= [decorators] "def" funcname "(" ' '[parameter_list] ")"\n' ' ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' ' | parameter_list_starargs\n' ' parameter_list_starargs ::= "*" [parameter] ("," ' 'defparameter)* ["," ["**" parameter [","]]]\n' ' | "**" parameter [","]\n' ' parameter ::= identifier [":" expression]\n' ' defparameter ::= parameter ["=" expression]\n' ' funcname ::= identifier\n' '\n' 'A function definition is an executable statement. Its execution ' 'binds\n' 'the function name in the current local namespace to a function ' 'object\n' '(a wrapper around the executable code for the function). This\n' 'function object contains a reference to the current global ' 'namespace\n' 'as the global namespace to be used when the function is called.\n' '\n' 'The function definition does not execute the function body; this ' 'gets\n' 'executed only when the function is called. [2]\n' '\n' 'A function definition may be wrapped by one or more *decorator*\n' 'expressions. Decorator expressions are evaluated when the ' 'function is\n' 'defined, in the scope that contains the function definition. ' 'The\n' 'result must be a callable, which is invoked with the function ' 'object\n' 'as the only argument. The returned value is bound to the ' 'function name\n' 'instead of the function object. Multiple decorators are applied ' 'in\n' 'nested fashion. For example, the following code\n' '\n' ' @f1(arg)\n' ' @f2\n' ' def func(): pass\n' '\n' 'is roughly equivalent to\n' '\n' ' def func(): pass\n' ' func = f1(arg)(f2(func))\n' '\n' 'except that the original function is not temporarily bound to ' 'the name\n' '"func".\n' '\n' 'When one or more *parameters* have the form *parameter* "="\n' '*expression*, the function is said to have “default parameter ' 'values.”\n' 'For a parameter with a default value, the corresponding ' '*argument* may\n' 'be omitted from a call, in which case the parameter’s default ' 'value is\n' 'substituted. If a parameter has a default value, all following\n' 'parameters up until the “"*"” must also have a default value — ' 'this is\n' 'a syntactic restriction that is not expressed by the grammar.\n' '\n' '**Default parameter values are evaluated from left to right when ' 'the\n' 'function definition is executed.** This means that the ' 'expression is\n' 'evaluated once, when the function is defined, and that the same ' '“pre-\n' 'computed” value is used for each call. This is especially ' 'important\n' 'to understand when a default parameter is a mutable object, such ' 'as a\n' 'list or a dictionary: if the function modifies the object (e.g. ' 'by\n' 'appending an item to a list), the default value is in effect ' 'modified.\n' 'This is generally not what was intended. A way around this is ' 'to use\n' '"None" as the default, and explicitly test for it in the body of ' 'the\n' 'function, e.g.:\n' '\n' ' def whats_on_the_telly(penguin=None):\n' ' if penguin is None:\n' ' penguin = []\n' ' penguin.append("property of the zoo")\n' ' return penguin\n' '\n' 'Function call semantics are described in more detail in section ' 'Calls.\n' 'A function call always assigns values to all parameters ' 'mentioned in\n' 'the parameter list, either from position arguments, from ' 'keyword\n' 'arguments, or from default values. If the form “"*identifier"” ' 'is\n' 'present, it is initialized to a tuple receiving any excess ' 'positional\n' 'parameters, defaulting to the empty tuple. If the form\n' '“"**identifier"” is present, it is initialized to a new ordered\n' 'mapping receiving any excess keyword arguments, defaulting to a ' 'new\n' 'empty mapping of the same type. Parameters after “"*"” or\n' '“"*identifier"” are keyword-only parameters and may only be ' 'passed\n' 'used keyword arguments.\n' '\n' 'Parameters may have annotations of the form “": expression"” ' 'following\n' 'the parameter name. Any parameter may have an annotation even ' 'those\n' 'of the form "*identifier" or "**identifier". Functions may ' 'have\n' '“return” annotation of the form “"-> expression"” after the ' 'parameter\n' 'list. These annotations can be any valid Python expression and ' 'are\n' 'evaluated when the function definition is executed. Annotations ' 'may\n' 'be evaluated in a different order than they appear in the source ' 'code.\n' 'The presence of annotations does not change the semantics of a\n' 'function. The annotation values are available as values of a\n' 'dictionary keyed by the parameters’ names in the ' '"__annotations__"\n' 'attribute of the function object.\n' '\n' 'It is also possible to create anonymous functions (functions not ' 'bound\n' 'to a name), for immediate use in expressions. This uses lambda\n' 'expressions, described in section Lambdas. Note that the ' 'lambda\n' 'expression is merely a shorthand for a simplified function ' 'definition;\n' 'a function defined in a “"def"” statement can be passed around ' 'or\n' 'assigned to another name just like a function defined by a ' 'lambda\n' 'expression. The “"def"” form is actually more powerful since ' 'it\n' 'allows the execution of multiple statements and annotations.\n' '\n' '**Programmer’s note:** Functions are first-class objects. A ' '“"def"”\n' 'statement executed inside a function definition defines a local\n' 'function that can be returned or passed around. Free variables ' 'used\n' 'in the nested function can access the local variables of the ' 'function\n' 'containing the def. See section Naming and binding for ' 'details.\n' '\n' 'See also:\n' '\n' ' **PEP 3107** - Function Annotations\n' ' The original specification for function annotations.\n' '\n' '\n' 'Class definitions\n' '=================\n' '\n' 'A class definition defines a class object (see section The ' 'standard\n' 'type hierarchy):\n' '\n' ' classdef ::= [decorators] "class" classname [inheritance] ' '":" suite\n' ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' 'list\n' 'usually gives a list of base classes (see Metaclasses for more\n' 'advanced uses), so each item in the list should evaluate to a ' 'class\n' 'object which allows subclassing. Classes without an inheritance ' 'list\n' 'inherit, by default, from the base class "object"; hence,\n' '\n' ' class Foo:\n' ' pass\n' '\n' 'is equivalent to\n' '\n' ' class Foo(object):\n' ' pass\n' '\n' 'The class’s suite is then executed in a new execution frame ' '(see\n' 'Naming and binding), using a newly created local namespace and ' 'the\n' 'original global namespace. (Usually, the suite contains mostly\n' 'function definitions.) When the class’s suite finishes ' 'execution, its\n' 'execution frame is discarded but its local namespace is saved. ' '[3] A\n' 'class object is then created using the inheritance list for the ' 'base\n' 'classes and the saved local namespace for the attribute ' 'dictionary.\n' 'The class name is bound to this class object in the original ' 'local\n' 'namespace.\n' '\n' 'The order in which attributes are defined in the class body is\n' 'preserved in the new class’s "__dict__". Note that this is ' 'reliable\n' 'only right after the class is created and only for classes that ' 'were\n' 'defined using the definition syntax.\n' '\n' 'Class creation can be customized heavily using metaclasses.\n' '\n' 'Classes can also be decorated: just like when decorating ' 'functions,\n' '\n' ' @f1(arg)\n' ' @f2\n' ' class Foo: pass\n' '\n' 'is roughly equivalent to\n' '\n' ' class Foo: pass\n' ' Foo = f1(arg)(f2(Foo))\n' '\n' 'The evaluation rules for the decorator expressions are the same ' 'as for\n' 'function decorators. The result is then bound to the class ' 'name.\n' '\n' '**Programmer’s note:** Variables defined in the class definition ' 'are\n' 'class attributes; they are shared by instances. Instance ' 'attributes\n' 'can be set in a method with "self.name = value". Both class ' 'and\n' 'instance attributes are accessible through the notation ' '“"self.name"”,\n' 'and an instance attribute hides a class attribute with the same ' 'name\n' 'when accessed in this way. Class attributes can be used as ' 'defaults\n' 'for instance attributes, but using mutable values there can lead ' 'to\n' 'unexpected results. Descriptors can be used to create instance\n' 'variables with different implementation details.\n' '\n' 'See also:\n' '\n' ' **PEP 3115** - Metaclasses in Python 3000\n' ' The proposal that changed the declaration of metaclasses to ' 'the\n' ' current syntax, and the semantics for how classes with\n' ' metaclasses are constructed.\n' '\n' ' **PEP 3129** - Class Decorators\n' ' The proposal that added class decorators. Function and ' 'method\n' ' decorators were introduced in **PEP 318**.\n' '\n' '\n' 'Coroutines\n' '==========\n' '\n' 'New in version 3.5.\n' '\n' '\n' 'Coroutine function definition\n' '-----------------------------\n' '\n' ' async_funcdef ::= [decorators] "async" "def" funcname "(" ' '[parameter_list] ")"\n' ' ["->" expression] ":" suite\n' '\n' 'Execution of Python coroutines can be suspended and resumed at ' 'many\n' 'points (see *coroutine*). In the body of a coroutine, any ' '"await" and\n' '"async" identifiers become reserved keywords; "await" ' 'expressions,\n' '"async for" and "async with" can only be used in coroutine ' 'bodies.\n' '\n' 'Functions defined with "async def" syntax are always coroutine\n' 'functions, even if they do not contain "await" or "async" ' 'keywords.\n' '\n' 'It is a "SyntaxError" to use "yield from" expressions in "async ' 'def"\n' 'coroutines.\n' '\n' 'An example of a coroutine function:\n' '\n' ' async def func(param1, param2):\n' ' do_stuff()\n' ' await some_coroutine()\n' '\n' '\n' 'The "async for" statement\n' '-------------------------\n' '\n' ' async_for_stmt ::= "async" for_stmt\n' '\n' 'An *asynchronous iterable* is able to call asynchronous code in ' 'its\n' '*iter* implementation, and *asynchronous iterator* can call\n' 'asynchronous code in its *next* method.\n' '\n' 'The "async for" statement allows convenient iteration over\n' 'asynchronous iterators.\n' '\n' 'The following code:\n' '\n' ' async for TARGET in ITER:\n' ' BLOCK\n' ' else:\n' ' BLOCK2\n' '\n' 'Is semantically equivalent to:\n' '\n' ' iter = (ITER)\n' ' iter = type(iter).__aiter__(iter)\n' ' running = True\n' ' while running:\n' ' try:\n' ' TARGET = await type(iter).__anext__(iter)\n' ' except StopAsyncIteration:\n' ' running = False\n' ' else:\n' ' BLOCK\n' ' else:\n' ' BLOCK2\n' '\n' 'See also "__aiter__()" and "__anext__()" for details.\n' '\n' 'It is a "SyntaxError" to use "async for" statement outside of ' 'an\n' '"async def" function.\n' '\n' '\n' 'The "async with" statement\n' '--------------------------\n' '\n' ' async_with_stmt ::= "async" with_stmt\n' '\n' 'An *asynchronous context manager* is a *context manager* that is ' 'able\n' 'to suspend execution in its *enter* and *exit* methods.\n' '\n' 'The following code:\n' '\n' ' async with EXPR as VAR:\n' ' BLOCK\n' '\n' 'Is semantically equivalent to:\n' '\n' ' mgr = (EXPR)\n' ' aexit = type(mgr).__aexit__\n' ' aenter = type(mgr).__aenter__(mgr)\n' '\n' ' VAR = await aenter\n' ' try:\n' ' BLOCK\n' ' except:\n' ' if not await aexit(mgr, *sys.exc_info()):\n' ' raise\n' ' else:\n' ' await aexit(mgr, None, None, None)\n' '\n' 'See also "__aenter__()" and "__aexit__()" for details.\n' '\n' 'It is a "SyntaxError" to use "async with" statement outside of ' 'an\n' '"async def" function.\n' '\n' 'See also:\n' '\n' ' **PEP 492** - Coroutines with async and await syntax\n' ' The proposal that made coroutines a proper standalone ' 'concept in\n' ' Python, and added supporting syntax.\n' '\n' '-[ Footnotes ]-\n' '\n' '[1] The exception is propagated to the invocation stack unless ' 'there\n' ' is a "finally" clause which happens to raise another ' 'exception.\n' ' That new exception causes the old one to be lost.\n' '\n' '[2] A string literal appearing as the first statement in the ' 'function\n' ' body is transformed into the function’s "__doc__" attribute ' 'and\n' ' therefore the function’s *docstring*.\n' '\n' '[3] A string literal appearing as the first statement in the ' 'class\n' ' body is transformed into the namespace’s "__doc__" item and\n' ' therefore the class’s *docstring*.\n', 'context-managers': 'With Statement Context Managers\n' '*******************************\n' '\n' 'A *context manager* is an object that defines the ' 'runtime context to\n' 'be established when executing a "with" statement. The ' 'context manager\n' 'handles the entry into, and the exit from, the desired ' 'runtime context\n' 'for the execution of the block of code. Context ' 'managers are normally\n' 'invoked using the "with" statement (described in section ' 'The with\n' 'statement), but can also be used by directly invoking ' 'their methods.\n' '\n' 'Typical uses of context managers include saving and ' 'restoring various\n' 'kinds of global state, locking and unlocking resources, ' 'closing opened\n' 'files, etc.\n' '\n' 'For more information on context managers, see Context ' 'Manager Types.\n' '\n' 'object.__enter__(self)\n' '\n' ' Enter the runtime context related to this object. The ' '"with"\n' ' statement will bind this method’s return value to the ' 'target(s)\n' ' specified in the "as" clause of the statement, if ' 'any.\n' '\n' 'object.__exit__(self, exc_type, exc_value, traceback)\n' '\n' ' Exit the runtime context related to this object. The ' 'parameters\n' ' describe the exception that caused the context to be ' 'exited. If the\n' ' context was exited without an exception, all three ' 'arguments will\n' ' be "None".\n' '\n' ' If an exception is supplied, and the method wishes to ' 'suppress the\n' ' exception (i.e., prevent it from being propagated), ' 'it should\n' ' return a true value. Otherwise, the exception will be ' 'processed\n' ' normally upon exit from this method.\n' '\n' ' Note that "__exit__()" methods should not reraise the ' 'passed-in\n' ' exception; this is the caller’s responsibility.\n' '\n' 'See also:\n' '\n' ' **PEP 343** - The “with” statement\n' ' The specification, background, and examples for the ' 'Python "with"\n' ' statement.\n', 'continue': 'The "continue" statement\n' '************************\n' '\n' ' continue_stmt ::= "continue"\n' '\n' '"continue" may only occur syntactically nested in a "for" or ' '"while"\n' 'loop, but not nested in a function or class definition or ' '"finally"\n' 'clause within that loop. It continues with the next cycle of ' 'the\n' 'nearest enclosing loop.\n' '\n' 'When "continue" passes control out of a "try" statement with a\n' '"finally" clause, that "finally" clause is executed before ' 'really\n' 'starting the next loop cycle.\n', 'conversions': 'Arithmetic conversions\n' '**********************\n' '\n' 'When a description of an arithmetic operator below uses the ' 'phrase\n' '“the numeric arguments are converted to a common type,” this ' 'means\n' 'that the operator implementation for built-in types works as ' 'follows:\n' '\n' '* If either argument is a complex number, the other is ' 'converted to\n' ' complex;\n' '\n' '* otherwise, if either argument is a floating point number, ' 'the other\n' ' is converted to floating point;\n' '\n' '* otherwise, both must be integers and no conversion is ' 'necessary.\n' '\n' 'Some additional rules apply for certain operators (e.g., a ' 'string as a\n' 'left argument to the ‘%’ operator). Extensions must define ' 'their own\n' 'conversion behavior.\n', 'customization': 'Basic customization\n' '*******************\n' '\n' 'object.__new__(cls[, ...])\n' '\n' ' Called to create a new instance of class *cls*. ' '"__new__()" is a\n' ' static method (special-cased so you need not declare it ' 'as such)\n' ' that takes the class of which an instance was requested ' 'as its\n' ' first argument. The remaining arguments are those ' 'passed to the\n' ' object constructor expression (the call to the class). ' 'The return\n' ' value of "__new__()" should be the new object instance ' '(usually an\n' ' instance of *cls*).\n' '\n' ' Typical implementations create a new instance of the ' 'class by\n' ' invoking the superclass’s "__new__()" method using\n' ' "super().__new__(cls[, ...])" with appropriate arguments ' 'and then\n' ' modifying the newly-created instance as necessary before ' 'returning\n' ' it.\n' '\n' ' If "__new__()" returns an instance of *cls*, then the ' 'new\n' ' instance’s "__init__()" method will be invoked like\n' ' "__init__(self[, ...])", where *self* is the new ' 'instance and the\n' ' remaining arguments are the same as were passed to ' '"__new__()".\n' '\n' ' If "__new__()" does not return an instance of *cls*, ' 'then the new\n' ' instance’s "__init__()" method will not be invoked.\n' '\n' ' "__new__()" is intended mainly to allow subclasses of ' 'immutable\n' ' types (like int, str, or tuple) to customize instance ' 'creation. It\n' ' is also commonly overridden in custom metaclasses in ' 'order to\n' ' customize class creation.\n' '\n' 'object.__init__(self[, ...])\n' '\n' ' Called after the instance has been created (by ' '"__new__()"), but\n' ' before it is returned to the caller. The arguments are ' 'those\n' ' passed to the class constructor expression. If a base ' 'class has an\n' ' "__init__()" method, the derived class’s "__init__()" ' 'method, if\n' ' any, must explicitly call it to ensure proper ' 'initialization of the\n' ' base class part of the instance; for example:\n' ' "super().__init__([args...])".\n' '\n' ' Because "__new__()" and "__init__()" work together in ' 'constructing\n' ' objects ("__new__()" to create it, and "__init__()" to ' 'customize\n' ' it), no non-"None" value may be returned by ' '"__init__()"; doing so\n' ' will cause a "TypeError" to be raised at runtime.\n' '\n' 'object.__del__(self)\n' '\n' ' Called when the instance is about to be destroyed. This ' 'is also\n' ' called a finalizer or (improperly) a destructor. If a ' 'base class\n' ' has a "__del__()" method, the derived class’s ' '"__del__()" method,\n' ' if any, must explicitly call it to ensure proper ' 'deletion of the\n' ' base class part of the instance.\n' '\n' ' It is possible (though not recommended!) for the ' '"__del__()" method\n' ' to postpone destruction of the instance by creating a ' 'new reference\n' ' to it. This is called object *resurrection*. It is\n' ' implementation-dependent whether "__del__()" is called a ' 'second\n' ' time when a resurrected object is about to be destroyed; ' 'the\n' ' current *CPython* implementation only calls it once.\n' '\n' ' It is not guaranteed that "__del__()" methods are called ' 'for\n' ' objects that still exist when the interpreter exits.\n' '\n' ' Note:\n' '\n' ' "del x" doesn’t directly call "x.__del__()" — the ' 'former\n' ' decrements the reference count for "x" by one, and the ' 'latter is\n' ' only called when "x"’s reference count reaches zero.\n' '\n' ' **CPython implementation detail:** It is possible for a ' 'reference\n' ' cycle to prevent the reference count of an object from ' 'going to\n' ' zero. In this case, the cycle will be later detected ' 'and deleted\n' ' by the *cyclic garbage collector*. A common cause of ' 'reference\n' ' cycles is when an exception has been caught in a local ' 'variable.\n' ' The frame’s locals then reference the exception, which ' 'references\n' ' its own traceback, which references the locals of all ' 'frames caught\n' ' in the traceback.\n' '\n' ' See also: Documentation for the "gc" module.\n' '\n' ' Warning:\n' '\n' ' Due to the precarious circumstances under which ' '"__del__()"\n' ' methods are invoked, exceptions that occur during ' 'their execution\n' ' are ignored, and a warning is printed to "sys.stderr" ' 'instead.\n' ' In particular:\n' '\n' ' * "__del__()" can be invoked when arbitrary code is ' 'being\n' ' executed, including from any arbitrary thread. If ' '"__del__()"\n' ' needs to take a lock or invoke any other blocking ' 'resource, it\n' ' may deadlock as the resource may already be taken by ' 'the code\n' ' that gets interrupted to execute "__del__()".\n' '\n' ' * "__del__()" can be executed during interpreter ' 'shutdown. As a\n' ' consequence, the global variables it needs to access ' '(including\n' ' other modules) may already have been deleted or set ' 'to "None".\n' ' Python guarantees that globals whose name begins ' 'with a single\n' ' underscore are deleted from their module before ' 'other globals\n' ' are deleted; if no other references to such globals ' 'exist, this\n' ' may help in assuring that imported modules are still ' 'available\n' ' at the time when the "__del__()" method is called.\n' '\n' 'object.__repr__(self)\n' '\n' ' Called by the "repr()" built-in function to compute the ' '“official”\n' ' string representation of an object. If at all possible, ' 'this\n' ' should look like a valid Python expression that could be ' 'used to\n' ' recreate an object with the same value (given an ' 'appropriate\n' ' environment). If this is not possible, a string of the ' 'form\n' ' "<...some useful description...>" should be returned. ' 'The return\n' ' value must be a string object. If a class defines ' '"__repr__()" but\n' ' not "__str__()", then "__repr__()" is also used when an ' '“informal”\n' ' string representation of instances of that class is ' 'required.\n' '\n' ' This is typically used for debugging, so it is important ' 'that the\n' ' representation is information-rich and unambiguous.\n' '\n' 'object.__str__(self)\n' '\n' ' Called by "str(object)" and the built-in functions ' '"format()" and\n' ' "print()" to compute the “informal” or nicely printable ' 'string\n' ' representation of an object. The return value must be a ' 'string\n' ' object.\n' '\n' ' This method differs from "object.__repr__()" in that ' 'there is no\n' ' expectation that "__str__()" return a valid Python ' 'expression: a\n' ' more convenient or concise representation can be used.\n' '\n' ' The default implementation defined by the built-in type ' '"object"\n' ' calls "object.__repr__()".\n' '\n' 'object.__bytes__(self)\n' '\n' ' Called by bytes to compute a byte-string representation ' 'of an\n' ' object. This should return a "bytes" object.\n' '\n' 'object.__format__(self, format_spec)\n' '\n' ' Called by the "format()" built-in function, and by ' 'extension,\n' ' evaluation of formatted string literals and the ' '"str.format()"\n' ' method, to produce a “formatted” string representation ' 'of an\n' ' object. The "format_spec" argument is a string that ' 'contains a\n' ' description of the formatting options desired. The ' 'interpretation\n' ' of the "format_spec" argument is up to the type ' 'implementing\n' ' "__format__()", however most classes will either ' 'delegate\n' ' formatting to one of the built-in types, or use a ' 'similar\n' ' formatting option syntax.\n' '\n' ' See Format Specification Mini-Language for a description ' 'of the\n' ' standard formatting syntax.\n' '\n' ' The return value must be a string object.\n' '\n' ' Changed in version 3.4: The __format__ method of ' '"object" itself\n' ' raises a "TypeError" if passed any non-empty string.\n' '\n' 'object.__lt__(self, other)\n' 'object.__le__(self, other)\n' 'object.__eq__(self, other)\n' 'object.__ne__(self, other)\n' 'object.__gt__(self, other)\n' 'object.__ge__(self, other)\n' '\n' ' These are the so-called “rich comparison” methods. The\n' ' correspondence between operator symbols and method names ' 'is as\n' ' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls ' '"x.__le__(y)",\n' ' "x==y" calls "x.__eq__(y)", "x!=y" calls "x.__ne__(y)", ' '"x>y" calls\n' ' "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n' '\n' ' A rich comparison method may return the singleton ' '"NotImplemented"\n' ' if it does not implement the operation for a given pair ' 'of\n' ' arguments. By convention, "False" and "True" are ' 'returned for a\n' ' successful comparison. However, these methods can return ' 'any value,\n' ' so if the comparison operator is used in a Boolean ' 'context (e.g.,\n' ' in the condition of an "if" statement), Python will call ' '"bool()"\n' ' on the value to determine if the result is true or ' 'false.\n' '\n' ' By default, "__ne__()" delegates to "__eq__()" and ' 'inverts the\n' ' result unless it is "NotImplemented". There are no ' 'other implied\n' ' relationships among the comparison operators, for ' 'example, the\n' ' truth of "(x<y or x==y)" does not imply "x<=y". To ' 'automatically\n' ' generate ordering operations from a single root ' 'operation, see\n' ' "functools.total_ordering()".\n' '\n' ' See the paragraph on "__hash__()" for some important ' 'notes on\n' ' creating *hashable* objects which support custom ' 'comparison\n' ' operations and are usable as dictionary keys.\n' '\n' ' There are no swapped-argument versions of these methods ' '(to be used\n' ' when the left argument does not support the operation ' 'but the right\n' ' argument does); rather, "__lt__()" and "__gt__()" are ' 'each other’s\n' ' reflection, "__le__()" and "__ge__()" are each other’s ' 'reflection,\n' ' and "__eq__()" and "__ne__()" are their own reflection. ' 'If the\n' ' operands are of different types, and right operand’s ' 'type is a\n' ' direct or indirect subclass of the left operand’s type, ' 'the\n' ' reflected method of the right operand has priority, ' 'otherwise the\n' ' left operand’s method has priority. Virtual subclassing ' 'is not\n' ' considered.\n' '\n' 'object.__hash__(self)\n' '\n' ' Called by built-in function "hash()" and for operations ' 'on members\n' ' of hashed collections including "set", "frozenset", and ' '"dict".\n' ' "__hash__()" should return an integer. The only required ' 'property\n' ' is that objects which compare equal have the same hash ' 'value; it is\n' ' advised to mix together the hash values of the ' 'components of the\n' ' object that also play a part in comparison of objects by ' 'packing\n' ' them into a tuple and hashing the tuple. Example:\n' '\n' ' def __hash__(self):\n' ' return hash((self.name, self.nick, self.color))\n' '\n' ' Note:\n' '\n' ' "hash()" truncates the value returned from an object’s ' 'custom\n' ' "__hash__()" method to the size of a "Py_ssize_t". ' 'This is\n' ' typically 8 bytes on 64-bit builds and 4 bytes on ' '32-bit builds.\n' ' If an object’s "__hash__()" must interoperate on ' 'builds of\n' ' different bit sizes, be sure to check the width on all ' 'supported\n' ' builds. An easy way to do this is with "python -c ' '"import sys;\n' ' print(sys.hash_info.width)"".\n' '\n' ' If a class does not define an "__eq__()" method it ' 'should not\n' ' define a "__hash__()" operation either; if it defines ' '"__eq__()"\n' ' but not "__hash__()", its instances will not be usable ' 'as items in\n' ' hashable collections. If a class defines mutable ' 'objects and\n' ' implements an "__eq__()" method, it should not ' 'implement\n' ' "__hash__()", since the implementation of hashable ' 'collections\n' ' requires that a key’s hash value is immutable (if the ' 'object’s hash\n' ' value changes, it will be in the wrong hash bucket).\n' '\n' ' User-defined classes have "__eq__()" and "__hash__()" ' 'methods by\n' ' default; with them, all objects compare unequal (except ' 'with\n' ' themselves) and "x.__hash__()" returns an appropriate ' 'value such\n' ' that "x == y" implies both that "x is y" and "hash(x) == ' 'hash(y)".\n' '\n' ' A class that overrides "__eq__()" and does not define ' '"__hash__()"\n' ' will have its "__hash__()" implicitly set to "None". ' 'When the\n' ' "__hash__()" method of a class is "None", instances of ' 'the class\n' ' will raise an appropriate "TypeError" when a program ' 'attempts to\n' ' retrieve their hash value, and will also be correctly ' 'identified as\n' ' unhashable when checking "isinstance(obj, ' 'collections.Hashable)".\n' '\n' ' If a class that overrides "__eq__()" needs to retain ' 'the\n' ' implementation of "__hash__()" from a parent class, the ' 'interpreter\n' ' must be told this explicitly by setting "__hash__ =\n' ' <ParentClass>.__hash__".\n' '\n' ' If a class that does not override "__eq__()" wishes to ' 'suppress\n' ' hash support, it should include "__hash__ = None" in the ' 'class\n' ' definition. A class which defines its own "__hash__()" ' 'that\n' ' explicitly raises a "TypeError" would be incorrectly ' 'identified as\n' ' hashable by an "isinstance(obj, collections.Hashable)" ' 'call.\n' '\n' ' Note:\n' '\n' ' By default, the "__hash__()" values of str, bytes and ' 'datetime\n' ' objects are “salted” with an unpredictable random ' 'value.\n' ' Although they remain constant within an individual ' 'Python\n' ' process, they are not predictable between repeated ' 'invocations of\n' ' Python.This is intended to provide protection against ' 'a denial-\n' ' of-service caused by carefully-chosen inputs that ' 'exploit the\n' ' worst case performance of a dict insertion, O(n^2) ' 'complexity.\n' ' See ' 'http://www.ocert.org/advisories/ocert-2011-003.html for\n' ' details.Changing hash values affects the iteration ' 'order of\n' ' dicts, sets and other mappings. Python has never made ' 'guarantees\n' ' about this ordering (and it typically varies between ' '32-bit and\n' ' 64-bit builds).See also "PYTHONHASHSEED".\n' '\n' ' Changed in version 3.3: Hash randomization is enabled by ' 'default.\n' '\n' 'object.__bool__(self)\n' '\n' ' Called to implement truth value testing and the built-in ' 'operation\n' ' "bool()"; should return "False" or "True". When this ' 'method is not\n' ' defined, "__len__()" is called, if it is defined, and ' 'the object is\n' ' considered true if its result is nonzero. If a class ' 'defines\n' ' neither "__len__()" nor "__bool__()", all its instances ' 'are\n' ' considered true.\n', 'debugger': '"pdb" — The Python Debugger\n' '***************************\n' '\n' '**Source code:** Lib/pdb.py\n' '\n' '======================================================================\n' '\n' 'The module "pdb" defines an interactive source code debugger ' 'for\n' 'Python programs. It supports setting (conditional) breakpoints ' 'and\n' 'single stepping at the source line level, inspection of stack ' 'frames,\n' 'source code listing, and evaluation of arbitrary Python code in ' 'the\n' 'context of any stack frame. It also supports post-mortem ' 'debugging\n' 'and can be called under program control.\n' '\n' 'The debugger is extensible – it is actually defined as the ' 'class\n' '"Pdb". This is currently undocumented but easily understood by ' 'reading\n' 'the source. The extension interface uses the modules "bdb" and ' '"cmd".\n' '\n' 'The debugger’s prompt is "(Pdb)". Typical usage to run a program ' 'under\n' 'control of the debugger is:\n' '\n' ' >>> import pdb\n' ' >>> import mymodule\n' " >>> pdb.run('mymodule.test()')\n" ' > <string>(0)?()\n' ' (Pdb) continue\n' ' > <string>(1)?()\n' ' (Pdb) continue\n' " NameError: 'spam'\n" ' > <string>(1)?()\n' ' (Pdb)\n' '\n' 'Changed in version 3.3: Tab-completion via the "readline" module ' 'is\n' 'available for commands and command arguments, e.g. the current ' 'global\n' 'and local names are offered as arguments of the "p" command.\n' '\n' '"pdb.py" can also be invoked as a script to debug other ' 'scripts. For\n' 'example:\n' '\n' ' python3 -m pdb myscript.py\n' '\n' 'When invoked as a script, pdb will automatically enter ' 'post-mortem\n' 'debugging if the program being debugged exits abnormally. After ' 'post-\n' 'mortem debugging (or after normal exit of the program), pdb ' 'will\n' 'restart the program. Automatic restarting preserves pdb’s state ' '(such\n' 'as breakpoints) and in most cases is more useful than quitting ' 'the\n' 'debugger upon program’s exit.\n' '\n' 'New in version 3.2: "pdb.py" now accepts a "-c" option that ' 'executes\n' 'commands as if given in a ".pdbrc" file, see Debugger Commands.\n' '\n' 'The typical usage to break into the debugger from a running ' 'program is\n' 'to insert\n' '\n' ' import pdb; pdb.set_trace()\n' '\n' 'at the location you want to break into the debugger. You can ' 'then\n' 'step through the code following this statement, and continue ' 'running\n' 'without the debugger using the "continue" command.\n' '\n' 'The typical usage to inspect a crashed program is:\n' '\n' ' >>> import pdb\n' ' >>> import mymodule\n' ' >>> mymodule.test()\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 1, in <module>\n' ' File "./mymodule.py", line 4, in test\n' ' test2()\n' ' File "./mymodule.py", line 3, in test2\n' ' print(spam)\n' ' NameError: spam\n' ' >>> pdb.pm()\n' ' > ./mymodule.py(3)test2()\n' ' -> print(spam)\n' ' (Pdb)\n' '\n' 'The module defines the following functions; each enters the ' 'debugger\n' 'in a slightly different way:\n' '\n' 'pdb.run(statement, globals=None, locals=None)\n' '\n' ' Execute the *statement* (given as a string or a code object) ' 'under\n' ' debugger control. The debugger prompt appears before any ' 'code is\n' ' executed; you can set breakpoints and type "continue", or you ' 'can\n' ' step through the statement using "step" or "next" (all these\n' ' commands are explained below). The optional *globals* and ' '*locals*\n' ' arguments specify the environment in which the code is ' 'executed; by\n' ' default the dictionary of the module "__main__" is used. ' '(See the\n' ' explanation of the built-in "exec()" or "eval()" functions.)\n' '\n' 'pdb.runeval(expression, globals=None, locals=None)\n' '\n' ' Evaluate the *expression* (given as a string or a code ' 'object)\n' ' under debugger control. When "runeval()" returns, it returns ' 'the\n' ' value of the expression. Otherwise this function is similar ' 'to\n' ' "run()".\n' '\n' 'pdb.runcall(function, *args, **kwds)\n' '\n' ' Call the *function* (a function or method object, not a ' 'string)\n' ' with the given arguments. When "runcall()" returns, it ' 'returns\n' ' whatever the function call returned. The debugger prompt ' 'appears\n' ' as soon as the function is entered.\n' '\n' 'pdb.set_trace()\n' '\n' ' Enter the debugger at the calling stack frame. This is ' 'useful to\n' ' hard-code a breakpoint at a given point in a program, even if ' 'the\n' ' code is not otherwise being debugged (e.g. when an assertion\n' ' fails).\n' '\n' 'pdb.post_mortem(traceback=None)\n' '\n' ' Enter post-mortem debugging of the given *traceback* object. ' 'If no\n' ' *traceback* is given, it uses the one of the exception that ' 'is\n' ' currently being handled (an exception must be being handled ' 'if the\n' ' default is to be used).\n' '\n' 'pdb.pm()\n' '\n' ' Enter post-mortem debugging of the traceback found in\n' ' "sys.last_traceback".\n' '\n' 'The "run*" functions and "set_trace()" are aliases for ' 'instantiating\n' 'the "Pdb" class and calling the method of the same name. If you ' 'want\n' 'to access further features, you have to do this yourself:\n' '\n' "class pdb.Pdb(completekey='tab', stdin=None, stdout=None, " 'skip=None, nosigint=False, readrc=True)\n' '\n' ' "Pdb" is the debugger class.\n' '\n' ' The *completekey*, *stdin* and *stdout* arguments are passed ' 'to the\n' ' underlying "cmd.Cmd" class; see the description there.\n' '\n' ' The *skip* argument, if given, must be an iterable of ' 'glob-style\n' ' module name patterns. The debugger will not step into frames ' 'that\n' ' originate in a module that matches one of these patterns. ' '[1]\n' '\n' ' By default, Pdb sets a handler for the SIGINT signal (which ' 'is sent\n' ' when the user presses "Ctrl-C" on the console) when you give ' 'a\n' ' "continue" command. This allows you to break into the ' 'debugger\n' ' again by pressing "Ctrl-C". If you want Pdb not to touch ' 'the\n' ' SIGINT handler, set *nosigint* to true.\n' '\n' ' The *readrc* argument defaults to true and controls whether ' 'Pdb\n' ' will load .pdbrc files from the filesystem.\n' '\n' ' Example call to enable tracing with *skip*:\n' '\n' " import pdb; pdb.Pdb(skip=['django.*']).set_trace()\n" '\n' ' New in version 3.1: The *skip* argument.\n' '\n' ' New in version 3.2: The *nosigint* argument. Previously, a ' 'SIGINT\n' ' handler was never set by Pdb.\n' '\n' ' Changed in version 3.6: The *readrc* argument.\n' '\n' ' run(statement, globals=None, locals=None)\n' ' runeval(expression, globals=None, locals=None)\n' ' runcall(function, *args, **kwds)\n' ' set_trace()\n' '\n' ' See the documentation for the functions explained above.\n' '\n' '\n' 'Debugger Commands\n' '=================\n' '\n' 'The commands recognized by the debugger are listed below. Most\n' 'commands can be abbreviated to one or two letters as indicated; ' 'e.g.\n' '"h(elp)" means that either "h" or "help" can be used to enter ' 'the help\n' 'command (but not "he" or "hel", nor "H" or "Help" or "HELP").\n' 'Arguments to commands must be separated by whitespace (spaces ' 'or\n' 'tabs). Optional arguments are enclosed in square brackets ' '("[]") in\n' 'the command syntax; the square brackets must not be typed.\n' 'Alternatives in the command syntax are separated by a vertical ' 'bar\n' '("|").\n' '\n' 'Entering a blank line repeats the last command entered. ' 'Exception: if\n' 'the last command was a "list" command, the next 11 lines are ' 'listed.\n' '\n' 'Commands that the debugger doesn’t recognize are assumed to be ' 'Python\n' 'statements and are executed in the context of the program being\n' 'debugged. Python statements can also be prefixed with an ' 'exclamation\n' 'point ("!"). This is a powerful way to inspect the program ' 'being\n' 'debugged; it is even possible to change a variable or call a ' 'function.\n' 'When an exception occurs in such a statement, the exception name ' 'is\n' 'printed but the debugger’s state is not changed.\n' '\n' 'The debugger supports aliases. Aliases can have parameters ' 'which\n' 'allows one a certain level of adaptability to the context under\n' 'examination.\n' '\n' 'Multiple commands may be entered on a single line, separated by ' '";;".\n' '(A single ";" is not used as it is the separator for multiple ' 'commands\n' 'in a line that is passed to the Python parser.) No intelligence ' 'is\n' 'applied to separating the commands; the input is split at the ' 'first\n' '";;" pair, even if it is in the middle of a quoted string.\n' '\n' 'If a file ".pdbrc" exists in the user’s home directory or in ' 'the\n' 'current directory, it is read in and executed as if it had been ' 'typed\n' 'at the debugger prompt. This is particularly useful for ' 'aliases. If\n' 'both files exist, the one in the home directory is read first ' 'and\n' 'aliases defined there can be overridden by the local file.\n' '\n' 'Changed in version 3.2: ".pdbrc" can now contain commands that\n' 'continue debugging, such as "continue" or "next". Previously, ' 'these\n' 'commands had no effect.\n' '\n' 'h(elp) [command]\n' '\n' ' Without argument, print the list of available commands. With ' 'a\n' ' *command* as argument, print help about that command. "help ' 'pdb"\n' ' displays the full documentation (the docstring of the "pdb"\n' ' module). Since the *command* argument must be an identifier, ' '"help\n' ' exec" must be entered to get help on the "!" command.\n' '\n' 'w(here)\n' '\n' ' Print a stack trace, with the most recent frame at the ' 'bottom. An\n' ' arrow indicates the current frame, which determines the ' 'context of\n' ' most commands.\n' '\n' 'd(own) [count]\n' '\n' ' Move the current frame *count* (default one) levels down in ' 'the\n' ' stack trace (to a newer frame).\n' '\n' 'u(p) [count]\n' '\n' ' Move the current frame *count* (default one) levels up in the ' 'stack\n' ' trace (to an older frame).\n' '\n' 'b(reak) [([filename:]lineno | function) [, condition]]\n' '\n' ' With a *lineno* argument, set a break there in the current ' 'file.\n' ' With a *function* argument, set a break at the first ' 'executable\n' ' statement within that function. The line number may be ' 'prefixed\n' ' with a filename and a colon, to specify a breakpoint in ' 'another\n' ' file (probably one that hasn’t been loaded yet). The file ' 'is\n' ' searched on "sys.path". Note that each breakpoint is ' 'assigned a\n' ' number to which all the other breakpoint commands refer.\n' '\n' ' If a second argument is present, it is an expression which ' 'must\n' ' evaluate to true before the breakpoint is honored.\n' '\n' ' Without argument, list all breaks, including for each ' 'breakpoint,\n' ' the number of times that breakpoint has been hit, the ' 'current\n' ' ignore count, and the associated condition if any.\n' '\n' 'tbreak [([filename:]lineno | function) [, condition]]\n' '\n' ' Temporary breakpoint, which is removed automatically when it ' 'is\n' ' first hit. The arguments are the same as for "break".\n' '\n' 'cl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n' '\n' ' With a *filename:lineno* argument, clear all the breakpoints ' 'at\n' ' this line. With a space separated list of breakpoint numbers, ' 'clear\n' ' those breakpoints. Without argument, clear all breaks (but ' 'first\n' ' ask confirmation).\n' '\n' 'disable [bpnumber [bpnumber ...]]\n' '\n' ' Disable the breakpoints given as a space separated list of\n' ' breakpoint numbers. Disabling a breakpoint means it cannot ' 'cause\n' ' the program to stop execution, but unlike clearing a ' 'breakpoint, it\n' ' remains in the list of breakpoints and can be (re-)enabled.\n' '\n' 'enable [bpnumber [bpnumber ...]]\n' '\n' ' Enable the breakpoints specified.\n' '\n' 'ignore bpnumber [count]\n' '\n' ' Set the ignore count for the given breakpoint number. If ' 'count is\n' ' omitted, the ignore count is set to 0. A breakpoint becomes ' 'active\n' ' when the ignore count is zero. When non-zero, the count is\n' ' decremented each time the breakpoint is reached and the ' 'breakpoint\n' ' is not disabled and any associated condition evaluates to ' 'true.\n' '\n' 'condition bpnumber [condition]\n' '\n' ' Set a new *condition* for the breakpoint, an expression which ' 'must\n' ' evaluate to true before the breakpoint is honored. If ' '*condition*\n' ' is absent, any existing condition is removed; i.e., the ' 'breakpoint\n' ' is made unconditional.\n' '\n' 'commands [bpnumber]\n' '\n' ' Specify a list of commands for breakpoint number *bpnumber*. ' 'The\n' ' commands themselves appear on the following lines. Type a ' 'line\n' ' containing just "end" to terminate the commands. An example:\n' '\n' ' (Pdb) commands 1\n' ' (com) p some_variable\n' ' (com) end\n' ' (Pdb)\n' '\n' ' To remove all commands from a breakpoint, type commands and ' 'follow\n' ' it immediately with "end"; that is, give no commands.\n' '\n' ' With no *bpnumber* argument, commands refers to the last ' 'breakpoint\n' ' set.\n' '\n' ' You can use breakpoint commands to start your program up ' 'again.\n' ' Simply use the continue command, or step, or any other ' 'command that\n' ' resumes execution.\n' '\n' ' Specifying any command resuming execution (currently ' 'continue,\n' ' step, next, return, jump, quit and their abbreviations) ' 'terminates\n' ' the command list (as if that command was immediately followed ' 'by\n' ' end). This is because any time you resume execution (even ' 'with a\n' ' simple next or step), you may encounter another ' 'breakpoint—which\n' ' could have its own command list, leading to ambiguities about ' 'which\n' ' list to execute.\n' '\n' ' If you use the ‘silent’ command in the command list, the ' 'usual\n' ' message about stopping at a breakpoint is not printed. This ' 'may be\n' ' desirable for breakpoints that are to print a specific ' 'message and\n' ' then continue. If none of the other commands print anything, ' 'you\n' ' see no sign that the breakpoint was reached.\n' '\n' 's(tep)\n' '\n' ' Execute the current line, stop at the first possible ' 'occasion\n' ' (either in a function that is called or on the next line in ' 'the\n' ' current function).\n' '\n' 'n(ext)\n' '\n' ' Continue execution until the next line in the current ' 'function is\n' ' reached or it returns. (The difference between "next" and ' '"step"\n' ' is that "step" stops inside a called function, while "next"\n' ' executes called functions at (nearly) full speed, only ' 'stopping at\n' ' the next line in the current function.)\n' '\n' 'unt(il) [lineno]\n' '\n' ' Without argument, continue execution until the line with a ' 'number\n' ' greater than the current one is reached.\n' '\n' ' With a line number, continue execution until a line with a ' 'number\n' ' greater or equal to that is reached. In both cases, also ' 'stop when\n' ' the current frame returns.\n' '\n' ' Changed in version 3.2: Allow giving an explicit line ' 'number.\n' '\n' 'r(eturn)\n' '\n' ' Continue execution until the current function returns.\n' '\n' 'c(ont(inue))\n' '\n' ' Continue execution, only stop when a breakpoint is ' 'encountered.\n' '\n' 'j(ump) lineno\n' '\n' ' Set the next line that will be executed. Only available in ' 'the\n' ' bottom-most frame. This lets you jump back and execute code ' 'again,\n' ' or jump forward to skip code that you don’t want to run.\n' '\n' ' It should be noted that not all jumps are allowed – for ' 'instance it\n' ' is not possible to jump into the middle of a "for" loop or ' 'out of a\n' ' "finally" clause.\n' '\n' 'l(ist) [first[, last]]\n' '\n' ' List source code for the current file. Without arguments, ' 'list 11\n' ' lines around the current line or continue the previous ' 'listing.\n' ' With "." as argument, list 11 lines around the current line. ' 'With\n' ' one argument, list 11 lines around at that line. With two\n' ' arguments, list the given range; if the second argument is ' 'less\n' ' than the first, it is interpreted as a count.\n' '\n' ' The current line in the current frame is indicated by "->". ' 'If an\n' ' exception is being debugged, the line where the exception ' 'was\n' ' originally raised or propagated is indicated by ">>", if it ' 'differs\n' ' from the current line.\n' '\n' ' New in version 3.2: The ">>" marker.\n' '\n' 'll | longlist\n' '\n' ' List all source code for the current function or frame.\n' ' Interesting lines are marked as for "list".\n' '\n' ' New in version 3.2.\n' '\n' 'a(rgs)\n' '\n' ' Print the argument list of the current function.\n' '\n' 'p expression\n' '\n' ' Evaluate the *expression* in the current context and print ' 'its\n' ' value.\n' '\n' ' Note:\n' '\n' ' "print()" can also be used, but is not a debugger command — ' 'this\n' ' executes the Python "print()" function.\n' '\n' 'pp expression\n' '\n' ' Like the "p" command, except the value of the expression is ' 'pretty-\n' ' printed using the "pprint" module.\n' '\n' 'whatis expression\n' '\n' ' Print the type of the *expression*.\n' '\n' 'source expression\n' '\n' ' Try to get source code for the given object and display it.\n' '\n' ' New in version 3.2.\n' '\n' 'display [expression]\n' '\n' ' Display the value of the expression if it changed, each time\n' ' execution stops in the current frame.\n' '\n' ' Without expression, list all display expressions for the ' 'current\n' ' frame.\n' '\n' ' New in version 3.2.\n' '\n' 'undisplay [expression]\n' '\n' ' Do not display the expression any more in the current frame.\n' ' Without expression, clear all display expressions for the ' 'current\n' ' frame.\n' '\n' ' New in version 3.2.\n' '\n' 'interact\n' '\n' ' Start an interactive interpreter (using the "code" module) ' 'whose\n' ' global namespace contains all the (global and local) names ' 'found in\n' ' the current scope.\n' '\n' ' New in version 3.2.\n' '\n' 'alias [name [command]]\n' '\n' ' Create an alias called *name* that executes *command*. The ' 'command\n' ' must *not* be enclosed in quotes. Replaceable parameters can ' 'be\n' ' indicated by "%1", "%2", and so on, while "%*" is replaced by ' 'all\n' ' the parameters. If no command is given, the current alias ' 'for\n' ' *name* is shown. If no arguments are given, all aliases are ' 'listed.\n' '\n' ' Aliases may be nested and can contain anything that can be ' 'legally\n' ' typed at the pdb prompt. Note that internal pdb commands ' '*can* be\n' ' overridden by aliases. Such a command is then hidden until ' 'the\n' ' alias is removed. Aliasing is recursively applied to the ' 'first\n' ' word of the command line; all other words in the line are ' 'left\n' ' alone.\n' '\n' ' As an example, here are two useful aliases (especially when ' 'placed\n' ' in the ".pdbrc" file):\n' '\n' ' # Print instance variables (usage "pi classInst")\n' ' alias pi for k in %1.__dict__.keys(): ' 'print("%1.",k,"=",%1.__dict__[k])\n' ' # Print instance variables in self\n' ' alias ps pi self\n' '\n' 'unalias name\n' '\n' ' Delete the specified alias.\n' '\n' '! statement\n' '\n' ' Execute the (one-line) *statement* in the context of the ' 'current\n' ' stack frame. The exclamation point can be omitted unless the ' 'first\n' ' word of the statement resembles a debugger command. To set ' 'a\n' ' global variable, you can prefix the assignment command with ' 'a\n' ' "global" statement on the same line, e.g.:\n' '\n' " (Pdb) global list_options; list_options = ['-l']\n" ' (Pdb)\n' '\n' 'run [args ...]\n' 'restart [args ...]\n' '\n' ' Restart the debugged Python program. If an argument is ' 'supplied,\n' ' it is split with "shlex" and the result is used as the new\n' ' "sys.argv". History, breakpoints, actions and debugger ' 'options are\n' ' preserved. "restart" is an alias for "run".\n' '\n' 'q(uit)\n' '\n' ' Quit from the debugger. The program being executed is ' 'aborted.\n' '\n' '-[ Footnotes ]-\n' '\n' '[1] Whether a frame is considered to originate in a certain ' 'module is\n' ' determined by the "__name__" in the frame globals.\n', 'del': 'The "del" statement\n' '*******************\n' '\n' ' del_stmt ::= "del" target_list\n' '\n' 'Deletion is recursively defined very similar to the way assignment ' 'is\n' 'defined. Rather than spelling it out in full details, here are some\n' 'hints.\n' '\n' 'Deletion of a target list recursively deletes each target, from left\n' 'to right.\n' '\n' 'Deletion of a name removes the binding of that name from the local ' 'or\n' 'global namespace, depending on whether the name occurs in a "global"\n' 'statement in the same code block. If the name is unbound, a\n' '"NameError" exception will be raised.\n' '\n' 'Deletion of attribute references, subscriptions and slicings is ' 'passed\n' 'to the primary object involved; deletion of a slicing is in general\n' 'equivalent to assignment of an empty slice of the right type (but ' 'even\n' 'this is determined by the sliced object).\n' '\n' 'Changed in version 3.2: Previously it was illegal to delete a name\n' 'from the local namespace if it occurs as a free variable in a nested\n' 'block.\n', 'dict': 'Dictionary displays\n' '*******************\n' '\n' 'A dictionary display is a possibly empty series of key/datum pairs\n' 'enclosed in curly braces:\n' '\n' ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' '"}"\n' ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' ' key_datum ::= expression ":" expression | "**" or_expr\n' ' dict_comprehension ::= expression ":" expression comp_for\n' '\n' 'A dictionary display yields a new dictionary object.\n' '\n' 'If a comma-separated sequence of key/datum pairs is given, they are\n' 'evaluated from left to right to define the entries of the ' 'dictionary:\n' 'each key object is used as a key into the dictionary to store the\n' 'corresponding datum. This means that you can specify the same key\n' 'multiple times in the key/datum list, and the final dictionary’s ' 'value\n' 'for that key will be the last one given.\n' '\n' 'A double asterisk "**" denotes *dictionary unpacking*. Its operand\n' 'must be a *mapping*. Each mapping item is added to the new\n' 'dictionary. Later values replace values already set by earlier\n' 'key/datum pairs and earlier dictionary unpackings.\n' '\n' 'New in version 3.5: Unpacking into dictionary displays, originally\n' 'proposed by **PEP 448**.\n' '\n' 'A dict comprehension, in contrast to list and set comprehensions,\n' 'needs two expressions separated with a colon followed by the usual\n' '“for” and “if” clauses. When the comprehension is run, the ' 'resulting\n' 'key and value elements are inserted in the new dictionary in the ' 'order\n' 'they are produced.\n' '\n' 'Restrictions on the types of the key values are listed earlier in\n' 'section The standard type hierarchy. (To summarize, the key type\n' 'should be *hashable*, which excludes all mutable objects.) Clashes\n' 'between duplicate keys are not detected; the last datum (textually\n' 'rightmost in the display) stored for a given key value prevails.\n', 'dynamic-features': 'Interaction with dynamic features\n' '*********************************\n' '\n' 'Name resolution of free variables occurs at runtime, not ' 'at compile\n' 'time. This means that the following code will print 42:\n' '\n' ' i = 10\n' ' def f():\n' ' print(i)\n' ' i = 42\n' ' f()\n' '\n' 'The "eval()" and "exec()" functions do not have access ' 'to the full\n' 'environment for resolving names. Names may be resolved ' 'in the local\n' 'and global namespaces of the caller. Free variables are ' 'not resolved\n' 'in the nearest enclosing namespace, but in the global ' 'namespace. [1]\n' 'The "exec()" and "eval()" functions have optional ' 'arguments to\n' 'override the global and local namespace. If only one ' 'namespace is\n' 'specified, it is used for both.\n', 'else': 'The "if" statement\n' '******************\n' '\n' 'The "if" statement is used for conditional execution:\n' '\n' ' if_stmt ::= "if" expression ":" suite\n' ' ("elif" expression ":" suite)*\n' ' ["else" ":" suite]\n' '\n' 'It selects exactly one of the suites by evaluating the expressions ' 'one\n' 'by one until one is found to be true (see section Boolean ' 'operations\n' 'for the definition of true and false); then that suite is executed\n' '(and no other part of the "if" statement is executed or evaluated).\n' 'If all expressions are false, the suite of the "else" clause, if\n' 'present, is executed.\n', 'exceptions': 'Exceptions\n' '**********\n' '\n' 'Exceptions are a means of breaking out of the normal flow of ' 'control\n' 'of a code block in order to handle errors or other ' 'exceptional\n' 'conditions. An exception is *raised* at the point where the ' 'error is\n' 'detected; it may be *handled* by the surrounding code block or ' 'by any\n' 'code block that directly or indirectly invoked the code block ' 'where\n' 'the error occurred.\n' '\n' 'The Python interpreter raises an exception when it detects a ' 'run-time\n' 'error (such as division by zero). A Python program can also\n' 'explicitly raise an exception with the "raise" statement. ' 'Exception\n' 'handlers are specified with the "try" … "except" statement. ' 'The\n' '"finally" clause of such a statement can be used to specify ' 'cleanup\n' 'code which does not handle the exception, but is executed ' 'whether an\n' 'exception occurred or not in the preceding code.\n' '\n' 'Python uses the “termination” model of error handling: an ' 'exception\n' 'handler can find out what happened and continue execution at ' 'an outer\n' 'level, but it cannot repair the cause of the error and retry ' 'the\n' 'failing operation (except by re-entering the offending piece ' 'of code\n' 'from the top).\n' '\n' 'When an exception is not handled at all, the interpreter ' 'terminates\n' 'execution of the program, or returns to its interactive main ' 'loop. In\n' 'either case, it prints a stack backtrace, except when the ' 'exception is\n' '"SystemExit".\n' '\n' 'Exceptions are identified by class instances. The "except" ' 'clause is\n' 'selected depending on the class of the instance: it must ' 'reference the\n' 'class of the instance or a base class thereof. The instance ' 'can be\n' 'received by the handler and can carry additional information ' 'about the\n' 'exceptional condition.\n' '\n' 'Note:\n' '\n' ' Exception messages are not part of the Python API. Their ' 'contents\n' ' may change from one version of Python to the next without ' 'warning\n' ' and should not be relied on by code which will run under ' 'multiple\n' ' versions of the interpreter.\n' '\n' 'See also the description of the "try" statement in section The ' 'try\n' 'statement and "raise" statement in section The raise ' 'statement.\n' '\n' '-[ Footnotes ]-\n' '\n' '[1] This limitation occurs because the code that is executed ' 'by these\n' ' operations is not available at the time the module is ' 'compiled.\n', 'execmodel': 'Execution model\n' '***************\n' '\n' '\n' 'Structure of a program\n' '======================\n' '\n' 'A Python program is constructed from code blocks. A *block* is ' 'a piece\n' 'of Python program text that is executed as a unit. The ' 'following are\n' 'blocks: a module, a function body, and a class definition. ' 'Each\n' 'command typed interactively is a block. A script file (a file ' 'given\n' 'as standard input to the interpreter or specified as a command ' 'line\n' 'argument to the interpreter) is a code block. A script command ' '(a\n' 'command specified on the interpreter command line with the ' '"-c"\n' 'option) is a code block. The string argument passed to the ' 'built-in\n' 'functions "eval()" and "exec()" is a code block.\n' '\n' 'A code block is executed in an *execution frame*. A frame ' 'contains\n' 'some administrative information (used for debugging) and ' 'determines\n' 'where and how execution continues after the code block’s ' 'execution has\n' 'completed.\n' '\n' '\n' 'Naming and binding\n' '==================\n' '\n' '\n' 'Binding of names\n' '----------------\n' '\n' '*Names* refer to objects. Names are introduced by name ' 'binding\n' 'operations.\n' '\n' 'The following constructs bind names: formal parameters to ' 'functions,\n' '"import" statements, class and function definitions (these bind ' 'the\n' 'class or function name in the defining block), and targets that ' 'are\n' 'identifiers if occurring in an assignment, "for" loop header, ' 'or after\n' '"as" in a "with" statement or "except" clause. The "import" ' 'statement\n' 'of the form "from ... import *" binds all names defined in the\n' 'imported module, except those beginning with an underscore. ' 'This form\n' 'may only be used at the module level.\n' '\n' 'A target occurring in a "del" statement is also considered ' 'bound for\n' 'this purpose (though the actual semantics are to unbind the ' 'name).\n' '\n' 'Each assignment or import statement occurs within a block ' 'defined by a\n' 'class or function definition or at the module level (the ' 'top-level\n' 'code block).\n' '\n' 'If a name is bound in a block, it is a local variable of that ' 'block,\n' 'unless declared as "nonlocal" or "global". If a name is bound ' 'at the\n' 'module level, it is a global variable. (The variables of the ' 'module\n' 'code block are local and global.) If a variable is used in a ' 'code\n' 'block but not defined there, it is a *free variable*.\n' '\n' 'Each occurrence of a name in the program text refers to the ' '*binding*\n' 'of that name established by the following name resolution ' 'rules.\n' '\n' '\n' 'Resolution of names\n' '-------------------\n' '\n' 'A *scope* defines the visibility of a name within a block. If ' 'a local\n' 'variable is defined in a block, its scope includes that block. ' 'If the\n' 'definition occurs in a function block, the scope extends to any ' 'blocks\n' 'contained within the defining one, unless a contained block ' 'introduces\n' 'a different binding for the name.\n' '\n' 'When a name is used in a code block, it is resolved using the ' 'nearest\n' 'enclosing scope. The set of all such scopes visible to a code ' 'block\n' 'is called the block’s *environment*.\n' '\n' 'When a name is not found at all, a "NameError" exception is ' 'raised. If\n' 'the current scope is a function scope, and the name refers to a ' 'local\n' 'variable that has not yet been bound to a value at the point ' 'where the\n' 'name is used, an "UnboundLocalError" exception is raised.\n' '"UnboundLocalError" is a subclass of "NameError".\n' '\n' 'If a name binding operation occurs anywhere within a code ' 'block, all\n' 'uses of the name within the block are treated as references to ' 'the\n' 'current block. This can lead to errors when a name is used ' 'within a\n' 'block before it is bound. This rule is subtle. Python lacks\n' 'declarations and allows name binding operations to occur ' 'anywhere\n' 'within a code block. The local variables of a code block can ' 'be\n' 'determined by scanning the entire text of the block for name ' 'binding\n' 'operations.\n' '\n' 'If the "global" statement occurs within a block, all uses of ' 'the name\n' 'specified in the statement refer to the binding of that name in ' 'the\n' 'top-level namespace. Names are resolved in the top-level ' 'namespace by\n' 'searching the global namespace, i.e. the namespace of the ' 'module\n' 'containing the code block, and the builtins namespace, the ' 'namespace\n' 'of the module "builtins". The global namespace is searched ' 'first. If\n' 'the name is not found there, the builtins namespace is ' 'searched. The\n' '"global" statement must precede all uses of the name.\n' '\n' 'The "global" statement has the same scope as a name binding ' 'operation\n' 'in the same block. If the nearest enclosing scope for a free ' 'variable\n' 'contains a global statement, the free variable is treated as a ' 'global.\n' '\n' 'The "nonlocal" statement causes corresponding names to refer ' 'to\n' 'previously bound variables in the nearest enclosing function ' 'scope.\n' '"SyntaxError" is raised at compile time if the given name does ' 'not\n' 'exist in any enclosing function scope.\n' '\n' 'The namespace for a module is automatically created the first ' 'time a\n' 'module is imported. The main module for a script is always ' 'called\n' '"__main__".\n' '\n' 'Class definition blocks and arguments to "exec()" and "eval()" ' 'are\n' 'special in the context of name resolution. A class definition ' 'is an\n' 'executable statement that may use and define names. These ' 'references\n' 'follow the normal rules for name resolution with an exception ' 'that\n' 'unbound local variables are looked up in the global namespace. ' 'The\n' 'namespace of the class definition becomes the attribute ' 'dictionary of\n' 'the class. The scope of names defined in a class block is ' 'limited to\n' 'the class block; it does not extend to the code blocks of ' 'methods –\n' 'this includes comprehensions and generator expressions since ' 'they are\n' 'implemented using a function scope. This means that the ' 'following\n' 'will fail:\n' '\n' ' class A:\n' ' a = 42\n' ' b = list(a + i for i in range(10))\n' '\n' '\n' 'Builtins and restricted execution\n' '---------------------------------\n' '\n' '**CPython implementation detail:** Users should not touch\n' '"__builtins__"; it is strictly an implementation detail. ' 'Users\n' 'wanting to override values in the builtins namespace should ' '"import"\n' 'the "builtins" module and modify its attributes appropriately.\n' '\n' 'The builtins namespace associated with the execution of a code ' 'block\n' 'is actually found by looking up the name "__builtins__" in its ' 'global\n' 'namespace; this should be a dictionary or a module (in the ' 'latter case\n' 'the module’s dictionary is used). By default, when in the ' '"__main__"\n' 'module, "__builtins__" is the built-in module "builtins"; when ' 'in any\n' 'other module, "__builtins__" is an alias for the dictionary of ' 'the\n' '"builtins" module itself.\n' '\n' '\n' 'Interaction with dynamic features\n' '---------------------------------\n' '\n' 'Name resolution of free variables occurs at runtime, not at ' 'compile\n' 'time. This means that the following code will print 42:\n' '\n' ' i = 10\n' ' def f():\n' ' print(i)\n' ' i = 42\n' ' f()\n' '\n' 'The "eval()" and "exec()" functions do not have access to the ' 'full\n' 'environment for resolving names. Names may be resolved in the ' 'local\n' 'and global namespaces of the caller. Free variables are not ' 'resolved\n' 'in the nearest enclosing namespace, but in the global ' 'namespace. [1]\n' 'The "exec()" and "eval()" functions have optional arguments to\n' 'override the global and local namespace. If only one namespace ' 'is\n' 'specified, it is used for both.\n' '\n' '\n' 'Exceptions\n' '==========\n' '\n' 'Exceptions are a means of breaking out of the normal flow of ' 'control\n' 'of a code block in order to handle errors or other exceptional\n' 'conditions. An exception is *raised* at the point where the ' 'error is\n' 'detected; it may be *handled* by the surrounding code block or ' 'by any\n' 'code block that directly or indirectly invoked the code block ' 'where\n' 'the error occurred.\n' '\n' 'The Python interpreter raises an exception when it detects a ' 'run-time\n' 'error (such as division by zero). A Python program can also\n' 'explicitly raise an exception with the "raise" statement. ' 'Exception\n' 'handlers are specified with the "try" … "except" statement. ' 'The\n' '"finally" clause of such a statement can be used to specify ' 'cleanup\n' 'code which does not handle the exception, but is executed ' 'whether an\n' 'exception occurred or not in the preceding code.\n' '\n' 'Python uses the “termination” model of error handling: an ' 'exception\n' 'handler can find out what happened and continue execution at an ' 'outer\n' 'level, but it cannot repair the cause of the error and retry ' 'the\n' 'failing operation (except by re-entering the offending piece of ' 'code\n' 'from the top).\n' '\n' 'When an exception is not handled at all, the interpreter ' 'terminates\n' 'execution of the program, or returns to its interactive main ' 'loop. In\n' 'either case, it prints a stack backtrace, except when the ' 'exception is\n' '"SystemExit".\n' '\n' 'Exceptions are identified by class instances. The "except" ' 'clause is\n' 'selected depending on the class of the instance: it must ' 'reference the\n' 'class of the instance or a base class thereof. The instance ' 'can be\n' 'received by the handler and can carry additional information ' 'about the\n' 'exceptional condition.\n' '\n' 'Note:\n' '\n' ' Exception messages are not part of the Python API. Their ' 'contents\n' ' may change from one version of Python to the next without ' 'warning\n' ' and should not be relied on by code which will run under ' 'multiple\n' ' versions of the interpreter.\n' '\n' 'See also the description of the "try" statement in section The ' 'try\n' 'statement and "raise" statement in section The raise ' 'statement.\n' '\n' '-[ Footnotes ]-\n' '\n' '[1] This limitation occurs because the code that is executed by ' 'these\n' ' operations is not available at the time the module is ' 'compiled.\n', 'exprlists': 'Expression lists\n' '****************\n' '\n' ' expression_list ::= expression ("," expression)* [","]\n' ' starred_list ::= starred_item ("," starred_item)* ' '[","]\n' ' starred_expression ::= expression | (starred_item ",")* ' '[starred_item]\n' ' starred_item ::= expression | "*" or_expr\n' '\n' 'Except when part of a list or set display, an expression list\n' 'containing at least one comma yields a tuple. The length of ' 'the tuple\n' 'is the number of expressions in the list. The expressions are\n' 'evaluated from left to right.\n' '\n' 'An asterisk "*" denotes *iterable unpacking*. Its operand must ' 'be an\n' '*iterable*. The iterable is expanded into a sequence of items, ' 'which\n' 'are included in the new tuple, list, or set, at the site of ' 'the\n' 'unpacking.\n' '\n' 'New in version 3.5: Iterable unpacking in expression lists, ' 'originally\n' 'proposed by **PEP 448**.\n' '\n' 'The trailing comma is required only to create a single tuple ' '(a.k.a. a\n' '*singleton*); it is optional in all other cases. A single ' 'expression\n' 'without a trailing comma doesn’t create a tuple, but rather ' 'yields the\n' 'value of that expression. (To create an empty tuple, use an ' 'empty pair\n' 'of parentheses: "()".)\n', 'floating': 'Floating point literals\n' '***********************\n' '\n' 'Floating point literals are described by the following lexical\n' 'definitions:\n' '\n' ' floatnumber ::= pointfloat | exponentfloat\n' ' pointfloat ::= [digitpart] fraction | digitpart "."\n' ' exponentfloat ::= (digitpart | pointfloat) exponent\n' ' digitpart ::= digit (["_"] digit)*\n' ' fraction ::= "." digitpart\n' ' exponent ::= ("e" | "E") ["+" | "-"] digitpart\n' '\n' 'Note that the integer and exponent parts are always interpreted ' 'using\n' 'radix 10. For example, "077e010" is legal, and denotes the same ' 'number\n' 'as "77e10". The allowed range of floating point literals is\n' 'implementation-dependent. As in integer literals, underscores ' 'are\n' 'supported for digit grouping.\n' '\n' 'Some examples of floating point literals:\n' '\n' ' 3.14 10. .001 1e100 3.14e-10 0e0 ' '3.14_15_93\n' '\n' 'Changed in version 3.6: Underscores are now allowed for ' 'grouping\n' 'purposes in literals.\n', 'for': 'The "for" statement\n' '*******************\n' '\n' 'The "for" statement is used to iterate over the elements of a ' 'sequence\n' '(such as a string, tuple or list) or other iterable object:\n' '\n' ' for_stmt ::= "for" target_list "in" expression_list ":" suite\n' ' ["else" ":" suite]\n' '\n' 'The expression list is evaluated once; it should yield an iterable\n' 'object. An iterator is created for the result of the\n' '"expression_list". The suite is then executed once for each item\n' 'provided by the iterator, in the order returned by the iterator. ' 'Each\n' 'item in turn is assigned to the target list using the standard rules\n' 'for assignments (see Assignment statements), and then the suite is\n' 'executed. When the items are exhausted (which is immediately when ' 'the\n' 'sequence is empty or an iterator raises a "StopIteration" ' 'exception),\n' 'the suite in the "else" clause, if present, is executed, and the ' 'loop\n' 'terminates.\n' '\n' 'A "break" statement executed in the first suite terminates the loop\n' 'without executing the "else" clause’s suite. A "continue" statement\n' 'executed in the first suite skips the rest of the suite and ' 'continues\n' 'with the next item, or with the "else" clause if there is no next\n' 'item.\n' '\n' 'The for-loop makes assignments to the variables(s) in the target ' 'list.\n' 'This overwrites all previous assignments to those variables ' 'including\n' 'those made in the suite of the for-loop:\n' '\n' ' for i in range(10):\n' ' print(i)\n' ' i = 5 # this will not affect the for-loop\n' ' # because i will be overwritten with the ' 'next\n' ' # index in the range\n' '\n' 'Names in the target list are not deleted when the loop is finished,\n' 'but if the sequence is empty, they will not have been assigned to at\n' 'all by the loop. Hint: the built-in function "range()" returns an\n' 'iterator of integers suitable to emulate the effect of Pascal’s "for ' 'i\n' ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n' '\n' 'Note:\n' '\n' ' There is a subtlety when the sequence is being modified by the ' 'loop\n' ' (this can only occur for mutable sequences, e.g. lists). An\n' ' internal counter is used to keep track of which item is used next,\n' ' and this is incremented on each iteration. When this counter has\n' ' reached the length of the sequence the loop terminates. This ' 'means\n' ' that if the suite deletes the current (or a previous) item from ' 'the\n' ' sequence, the next item will be skipped (since it gets the index ' 'of\n' ' the current item which has already been treated). Likewise, if ' 'the\n' ' suite inserts an item in the sequence before the current item, the\n' ' current item will be treated again the next time through the loop.\n' ' This can lead to nasty bugs that can be avoided by making a\n' ' temporary copy using a slice of the whole sequence, e.g.,\n' '\n' ' for x in a[:]:\n' ' if x < 0: a.remove(x)\n', 'formatstrings': 'Format String Syntax\n' '********************\n' '\n' 'The "str.format()" method and the "Formatter" class share ' 'the same\n' 'syntax for format strings (although in the case of ' '"Formatter",\n' 'subclasses can define their own format string syntax). The ' 'syntax is\n' 'related to that of formatted string literals, but there ' 'are\n' 'differences.\n' '\n' 'Format strings contain “replacement fields” surrounded by ' 'curly braces\n' '"{}". Anything that is not contained in braces is ' 'considered literal\n' 'text, which is copied unchanged to the output. If you need ' 'to include\n' 'a brace character in the literal text, it can be escaped by ' 'doubling:\n' '"{{" and "}}".\n' '\n' 'The grammar for a replacement field is as follows:\n' '\n' ' replacement_field ::= "{" [field_name] ["!" ' 'conversion] [":" format_spec] "}"\n' ' field_name ::= arg_name ("." attribute_name | ' '"[" element_index "]")*\n' ' arg_name ::= [identifier | digit+]\n' ' attribute_name ::= identifier\n' ' element_index ::= digit+ | index_string\n' ' index_string ::= <any source character except ' '"]"> +\n' ' conversion ::= "r" | "s" | "a"\n' ' format_spec ::= <described in the next ' 'section>\n' '\n' 'In less formal terms, the replacement field can start with ' 'a\n' '*field_name* that specifies the object whose value is to be ' 'formatted\n' 'and inserted into the output instead of the replacement ' 'field. The\n' '*field_name* is optionally followed by a *conversion* ' 'field, which is\n' 'preceded by an exclamation point "\'!\'", and a ' '*format_spec*, which is\n' 'preceded by a colon "\':\'". These specify a non-default ' 'format for the\n' 'replacement value.\n' '\n' 'See also the Format Specification Mini-Language section.\n' '\n' 'The *field_name* itself begins with an *arg_name* that is ' 'either a\n' 'number or a keyword. If it’s a number, it refers to a ' 'positional\n' 'argument, and if it’s a keyword, it refers to a named ' 'keyword\n' 'argument. If the numerical arg_names in a format string ' 'are 0, 1, 2,\n' '… in sequence, they can all be omitted (not just some) and ' 'the numbers\n' '0, 1, 2, … will be automatically inserted in that order. ' 'Because\n' '*arg_name* is not quote-delimited, it is not possible to ' 'specify\n' 'arbitrary dictionary keys (e.g., the strings "\'10\'" or ' '"\':-]\'") within\n' 'a format string. The *arg_name* can be followed by any ' 'number of index\n' 'or attribute expressions. An expression of the form ' '"\'.name\'" selects\n' 'the named attribute using "getattr()", while an expression ' 'of the form\n' '"\'[index]\'" does an index lookup using "__getitem__()".\n' '\n' 'Changed in version 3.1: The positional argument specifiers ' 'can be\n' 'omitted for "str.format()", so "\'{} {}\'.format(a, b)" is ' 'equivalent to\n' '"\'{0} {1}\'.format(a, b)".\n' '\n' 'Changed in version 3.4: The positional argument specifiers ' 'can be\n' 'omitted for "Formatter".\n' '\n' 'Some simple format string examples:\n' '\n' ' "First, thou shalt count to {0}" # References first ' 'positional argument\n' ' "Bring me a {}" # Implicitly ' 'references the first positional argument\n' ' "From {} to {}" # Same as "From {0} to ' '{1}"\n' ' "My quest is {name}" # References keyword ' "argument 'name'\n" ' "Weight in tons {0.weight}" # \'weight\' attribute ' 'of first positional arg\n' ' "Units destroyed: {players[0]}" # First element of ' "keyword argument 'players'.\n" '\n' 'The *conversion* field causes a type coercion before ' 'formatting.\n' 'Normally, the job of formatting a value is done by the ' '"__format__()"\n' 'method of the value itself. However, in some cases it is ' 'desirable to\n' 'force a type to be formatted as a string, overriding its ' 'own\n' 'definition of formatting. By converting the value to a ' 'string before\n' 'calling "__format__()", the normal formatting logic is ' 'bypassed.\n' '\n' 'Three conversion flags are currently supported: "\'!s\'" ' 'which calls\n' '"str()" on the value, "\'!r\'" which calls "repr()" and ' '"\'!a\'" which\n' 'calls "ascii()".\n' '\n' 'Some examples:\n' '\n' ' "Harold\'s a clever {0!s}" # Calls str() on the ' 'argument first\n' ' "Bring out the holy {name!r}" # Calls repr() on the ' 'argument first\n' ' "More {!a}" # Calls ascii() on the ' 'argument first\n' '\n' 'The *format_spec* field contains a specification of how the ' 'value\n' 'should be presented, including such details as field width, ' 'alignment,\n' 'padding, decimal precision and so on. Each value type can ' 'define its\n' 'own “formatting mini-language” or interpretation of the ' '*format_spec*.\n' '\n' 'Most built-in types support a common formatting ' 'mini-language, which\n' 'is described in the next section.\n' '\n' 'A *format_spec* field can also include nested replacement ' 'fields\n' 'within it. These nested replacement fields may contain a ' 'field name,\n' 'conversion flag and format specification, but deeper ' 'nesting is not\n' 'allowed. The replacement fields within the format_spec ' 'are\n' 'substituted before the *format_spec* string is interpreted. ' 'This\n' 'allows the formatting of a value to be dynamically ' 'specified.\n' '\n' 'See the Format examples section for some examples.\n' '\n' '\n' 'Format Specification Mini-Language\n' '==================================\n' '\n' '“Format specifications” are used within replacement fields ' 'contained\n' 'within a format string to define how individual values are ' 'presented\n' '(see Format String Syntax and Formatted string literals). ' 'They can\n' 'also be passed directly to the built-in "format()" ' 'function. Each\n' 'formattable type may define how the format specification is ' 'to be\n' 'interpreted.\n' '\n' 'Most built-in types implement the following options for ' 'format\n' 'specifications, although some of the formatting options are ' 'only\n' 'supported by the numeric types.\n' '\n' 'A general convention is that an empty format string ("""") ' 'produces\n' 'the same result as if you had called "str()" on the value. ' 'A non-empty\n' 'format string typically modifies the result.\n' '\n' 'The general form of a *standard format specifier* is:\n' '\n' ' format_spec ::= ' '[[fill]align][sign][#][0][width][grouping_option][.precision][type]\n' ' fill ::= <any character>\n' ' align ::= "<" | ">" | "=" | "^"\n' ' sign ::= "+" | "-" | " "\n' ' width ::= digit+\n' ' grouping_option ::= "_" | ","\n' ' precision ::= digit+\n' ' type ::= "b" | "c" | "d" | "e" | "E" | "f" | ' '"F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n' '\n' 'If a valid *align* value is specified, it can be preceded ' 'by a *fill*\n' 'character that can be any character and defaults to a space ' 'if\n' 'omitted. It is not possible to use a literal curly brace ' '(”"{"” or\n' '“"}"”) as the *fill* character in a formatted string ' 'literal or when\n' 'using the "str.format()" method. However, it is possible ' 'to insert a\n' 'curly brace with a nested replacement field. This ' 'limitation doesn’t\n' 'affect the "format()" function.\n' '\n' 'The meaning of the various alignment options is as ' 'follows:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | Option | ' 'Meaning ' '|\n' ' ' '|===========|============================================================|\n' ' | "\'<\'" | Forces the field to be left-aligned ' 'within the available |\n' ' | | space (this is the default for most ' 'objects). |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'>\'" | Forces the field to be right-aligned ' 'within the available |\n' ' | | space (this is the default for ' 'numbers). |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'=\'" | Forces the padding to be placed after ' 'the sign (if any) |\n' ' | | but before the digits. This is used for ' 'printing fields |\n' ' | | in the form ‘+000000120’. This alignment ' 'option is only |\n' ' | | valid for numeric types. It becomes the ' 'default when ‘0’ |\n' ' | | immediately precedes the field ' 'width. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'^\'" | Forces the field to be centered within ' 'the available |\n' ' | | ' 'space. ' '|\n' ' ' '+-----------+------------------------------------------------------------+\n' '\n' 'Note that unless a minimum field width is defined, the ' 'field width\n' 'will always be the same size as the data to fill it, so ' 'that the\n' 'alignment option has no meaning in this case.\n' '\n' 'The *sign* option is only valid for number types, and can ' 'be one of\n' 'the following:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | Option | ' 'Meaning ' '|\n' ' ' '|===========|============================================================|\n' ' | "\'+\'" | indicates that a sign should be used for ' 'both positive as |\n' ' | | well as negative ' 'numbers. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'-\'" | indicates that a sign should be used ' 'only for negative |\n' ' | | numbers (this is the default ' 'behavior). |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | space | indicates that a leading space should be ' 'used on positive |\n' ' | | numbers, and a minus sign on negative ' 'numbers. |\n' ' ' '+-----------+------------------------------------------------------------+\n' '\n' 'The "\'#\'" option causes the “alternate form” to be used ' 'for the\n' 'conversion. The alternate form is defined differently for ' 'different\n' 'types. This option is only valid for integer, float, ' 'complex and\n' 'Decimal types. For integers, when binary, octal, or ' 'hexadecimal output\n' 'is used, this option adds the prefix respective "\'0b\'", ' '"\'0o\'", or\n' '"\'0x\'" to the output value. For floats, complex and ' 'Decimal the\n' 'alternate form causes the result of the conversion to ' 'always contain a\n' 'decimal-point character, even if no digits follow it. ' 'Normally, a\n' 'decimal-point character appears in the result of these ' 'conversions\n' 'only if a digit follows it. In addition, for "\'g\'" and ' '"\'G\'"\n' 'conversions, trailing zeros are not removed from the ' 'result.\n' '\n' 'The "\',\'" option signals the use of a comma for a ' 'thousands separator.\n' 'For a locale aware separator, use the "\'n\'" integer ' 'presentation type\n' 'instead.\n' '\n' 'Changed in version 3.1: Added the "\',\'" option (see also ' '**PEP 378**).\n' '\n' 'The "\'_\'" option signals the use of an underscore for a ' 'thousands\n' 'separator for floating point presentation types and for ' 'integer\n' 'presentation type "\'d\'". For integer presentation types ' '"\'b\'", "\'o\'",\n' '"\'x\'", and "\'X\'", underscores will be inserted every 4 ' 'digits. For\n' 'other presentation types, specifying this option is an ' 'error.\n' '\n' 'Changed in version 3.6: Added the "\'_\'" option (see also ' '**PEP 515**).\n' '\n' '*width* is a decimal integer defining the minimum field ' 'width. If not\n' 'specified, then the field width will be determined by the ' 'content.\n' '\n' 'When no explicit alignment is given, preceding the *width* ' 'field by a\n' 'zero ("\'0\'") character enables sign-aware zero-padding ' 'for numeric\n' 'types. This is equivalent to a *fill* character of "\'0\'" ' 'with an\n' '*alignment* type of "\'=\'".\n' '\n' 'The *precision* is a decimal number indicating how many ' 'digits should\n' 'be displayed after the decimal point for a floating point ' 'value\n' 'formatted with "\'f\'" and "\'F\'", or before and after the ' 'decimal point\n' 'for a floating point value formatted with "\'g\'" or ' '"\'G\'". For non-\n' 'number types the field indicates the maximum field size - ' 'in other\n' 'words, how many characters will be used from the field ' 'content. The\n' '*precision* is not allowed for integer values.\n' '\n' 'Finally, the *type* determines how the data should be ' 'presented.\n' '\n' 'The available string presentation types are:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | Type | ' 'Meaning ' '|\n' ' ' '|===========|============================================================|\n' ' | "\'s\'" | String format. This is the default type ' 'for strings and |\n' ' | | may be ' 'omitted. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | None | The same as ' '"\'s\'". |\n' ' ' '+-----------+------------------------------------------------------------+\n' '\n' 'The available integer presentation types are:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | Type | ' 'Meaning ' '|\n' ' ' '|===========|============================================================|\n' ' | "\'b\'" | Binary format. Outputs the number in ' 'base 2. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'c\'" | Character. Converts the integer to the ' 'corresponding |\n' ' | | unicode character before ' 'printing. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'d\'" | Decimal Integer. Outputs the number in ' 'base 10. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'o\'" | Octal format. Outputs the number in base ' '8. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'x\'" | Hex format. Outputs the number in base ' '16, using lower- |\n' ' | | case letters for the digits above ' '9. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'X\'" | Hex format. Outputs the number in base ' '16, using upper- |\n' ' | | case letters for the digits above ' '9. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'n\'" | Number. This is the same as "\'d\'", ' 'except that it uses the |\n' ' | | current locale setting to insert the ' 'appropriate number |\n' ' | | separator ' 'characters. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | None | The same as ' '"\'d\'". |\n' ' ' '+-----------+------------------------------------------------------------+\n' '\n' 'In addition to the above presentation types, integers can ' 'be formatted\n' 'with the floating point presentation types listed below ' '(except "\'n\'"\n' 'and "None"). When doing so, "float()" is used to convert ' 'the integer\n' 'to a floating point number before formatting.\n' '\n' 'The available presentation types for floating point and ' 'decimal values\n' 'are:\n' '\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | Type | ' 'Meaning ' '|\n' ' ' '|===========|============================================================|\n' ' | "\'e\'" | Exponent notation. Prints the number in ' 'scientific |\n' ' | | notation using the letter ‘e’ to indicate ' 'the exponent. |\n' ' | | The default precision is ' '"6". |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'E\'" | Exponent notation. Same as "\'e\'" ' 'except it uses an upper |\n' ' | | case ‘E’ as the separator ' 'character. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'f\'" | Fixed-point notation. Displays the ' 'number as a fixed-point |\n' ' | | number. The default precision is ' '"6". |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'F\'" | Fixed-point notation. Same as "\'f\'", ' 'but converts "nan" to |\n' ' | | "NAN" and "inf" to ' '"INF". |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'g\'" | General format. For a given precision ' '"p >= 1", this |\n' ' | | rounds the number to "p" significant ' 'digits and then |\n' ' | | formats the result in either fixed-point ' 'format or in |\n' ' | | scientific notation, depending on its ' 'magnitude. The |\n' ' | | precise rules are as follows: suppose that ' 'the result |\n' ' | | formatted with presentation type "\'e\'" ' 'and precision "p-1" |\n' ' | | would have exponent "exp". Then if "-4 <= ' 'exp < p", the |\n' ' | | number is formatted with presentation type ' '"\'f\'" and |\n' ' | | precision "p-1-exp". Otherwise, the ' 'number is formatted |\n' ' | | with presentation type "\'e\'" and ' 'precision "p-1". In both |\n' ' | | cases insignificant trailing zeros are ' 'removed from the |\n' ' | | significand, and the decimal point is also ' 'removed if |\n' ' | | there are no remaining digits following ' 'it. Positive and |\n' ' | | negative infinity, positive and negative ' 'zero, and nans, |\n' ' | | are formatted as "inf", "-inf", "0", "-0" ' 'and "nan" |\n' ' | | respectively, regardless of the ' 'precision. A precision of |\n' ' | | "0" is treated as equivalent to a ' 'precision of "1". The |\n' ' | | default precision is ' '"6". |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'G\'" | General format. Same as "\'g\'" except ' 'switches to "\'E\'" if |\n' ' | | the number gets too large. The ' 'representations of infinity |\n' ' | | and NaN are uppercased, ' 'too. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'n\'" | Number. This is the same as "\'g\'", ' 'except that it uses the |\n' ' | | current locale setting to insert the ' 'appropriate number |\n' ' | | separator ' 'characters. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | "\'%\'" | Percentage. Multiplies the number by 100 ' 'and displays in |\n' ' | | fixed ("\'f\'") format, followed by a ' 'percent sign. |\n' ' ' '+-----------+------------------------------------------------------------+\n' ' | None | Similar to "\'g\'", except that ' 'fixed-point notation, when |\n' ' | | used, has at least one digit past the ' 'decimal point. The |\n' ' | | default precision is as high as needed to ' 'represent the |\n' ' | | particular value. The overall effect is to ' 'match the |\n' ' | | output of "str()" as altered by the other ' 'format |\n' ' | | ' 'modifiers. ' '|\n' ' ' '+-----------+------------------------------------------------------------+\n' '\n' '\n' 'Format examples\n' '===============\n' '\n' 'This section contains examples of the "str.format()" syntax ' 'and\n' 'comparison with the old "%"-formatting.\n' '\n' 'In most of the cases the syntax is similar to the old ' '"%"-formatting,\n' 'with the addition of the "{}" and with ":" used instead of ' '"%". For\n' 'example, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n' '\n' 'The new format syntax also supports new and different ' 'options, shown\n' 'in the following examples.\n' '\n' 'Accessing arguments by position:\n' '\n' " >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" " 'a, b, c'\n" " >>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n" " 'a, b, c'\n" " >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" " 'c, b, a'\n" " >>> '{2}, {1}, {0}'.format(*'abc') # unpacking " 'argument sequence\n' " 'c, b, a'\n" " >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' " 'indices can be repeated\n' " 'abracadabra'\n" '\n' 'Accessing arguments by name:\n' '\n' " >>> 'Coordinates: {latitude}, " "{longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" " 'Coordinates: 37.24N, -115.81W'\n" " >>> coord = {'latitude': '37.24N', 'longitude': " "'-115.81W'}\n" " >>> 'Coordinates: {latitude}, " "{longitude}'.format(**coord)\n" " 'Coordinates: 37.24N, -115.81W'\n" '\n' 'Accessing arguments’ attributes:\n' '\n' ' >>> c = 3-5j\n' " >>> ('The complex number {0} is formed from the real " "part {0.real} '\n" " ... 'and the imaginary part {0.imag}.').format(c)\n" " 'The complex number (3-5j) is formed from the real part " "3.0 and the imaginary part -5.0.'\n" ' >>> class Point:\n' ' ... def __init__(self, x, y):\n' ' ... self.x, self.y = x, y\n' ' ... def __str__(self):\n' " ... return 'Point({self.x}, " "{self.y})'.format(self=self)\n" ' ...\n' ' >>> str(Point(4, 2))\n' " 'Point(4, 2)'\n" '\n' 'Accessing arguments’ items:\n' '\n' ' >>> coord = (3, 5)\n' " >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" " 'X: 3; Y: 5'\n" '\n' 'Replacing "%s" and "%r":\n' '\n' ' >>> "repr() shows quotes: {!r}; str() doesn\'t: ' '{!s}".format(\'test1\', \'test2\')\n' ' "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n' '\n' 'Aligning the text and specifying a width:\n' '\n' " >>> '{:<30}'.format('left aligned')\n" " 'left aligned '\n" " >>> '{:>30}'.format('right aligned')\n" " ' right aligned'\n" " >>> '{:^30}'.format('centered')\n" " ' centered '\n" " >>> '{:*^30}'.format('centered') # use '*' as a fill " 'char\n' " '***********centered***********'\n" '\n' 'Replacing "%+f", "%-f", and "% f" and specifying a sign:\n' '\n' " >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it " 'always\n' " '+3.140000; -3.140000'\n" " >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space " 'for positive numbers\n' " ' 3.140000; -3.140000'\n" " >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the " "minus -- same as '{:f}; {:f}'\n" " '3.140000; -3.140000'\n" '\n' 'Replacing "%x" and "%o" and converting the value to ' 'different bases:\n' '\n' ' >>> # format also supports binary numbers\n' ' >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: ' '{0:b}".format(42)\n' " 'int: 42; hex: 2a; oct: 52; bin: 101010'\n" ' >>> # with 0x, 0o, or 0b as prefix:\n' ' >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: ' '{0:#b}".format(42)\n' " 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\n" '\n' 'Using the comma as a thousands separator:\n' '\n' " >>> '{:,}'.format(1234567890)\n" " '1,234,567,890'\n" '\n' 'Expressing a percentage:\n' '\n' ' >>> points = 19\n' ' >>> total = 22\n' " >>> 'Correct answers: {:.2%}'.format(points/total)\n" " 'Correct answers: 86.36%'\n" '\n' 'Using type-specific formatting:\n' '\n' ' >>> import datetime\n' ' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n' " >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" " '2010-07-04 12:15:58'\n" '\n' 'Nesting arguments and more complex examples:\n' '\n' " >>> for align, text in zip('<^>', ['left', 'center', " "'right']):\n" " ... '{0:{fill}{align}16}'.format(text, fill=align, " 'align=align)\n' ' ...\n' " 'left<<<<<<<<<<<<'\n" " '^^^^^center^^^^^'\n" " '>>>>>>>>>>>right'\n" ' >>>\n' ' >>> octets = [192, 168, 0, 1]\n' " >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n" " 'C0A80001'\n" ' >>> int(_, 16)\n' ' 3232235521\n' ' >>>\n' ' >>> width = 5\n' ' >>> for num in range(5,12): \n' " ... for base in 'dXob':\n" " ... print('{0:{width}{base}}'.format(num, " "base=base, width=width), end=' ')\n" ' ... print()\n' ' ...\n' ' 5 5 5 101\n' ' 6 6 6 110\n' ' 7 7 7 111\n' ' 8 8 10 1000\n' ' 9 9 11 1001\n' ' 10 A 12 1010\n' ' 11 B 13 1011\n', 'function': 'Function definitions\n' '********************\n' '\n' 'A function definition defines a user-defined function object ' '(see\n' 'section The standard type hierarchy):\n' '\n' ' funcdef ::= [decorators] "def" funcname "(" ' '[parameter_list] ")"\n' ' ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' ' | parameter_list_starargs\n' ' parameter_list_starargs ::= "*" [parameter] ("," ' 'defparameter)* ["," ["**" parameter [","]]]\n' ' | "**" parameter [","]\n' ' parameter ::= identifier [":" expression]\n' ' defparameter ::= parameter ["=" expression]\n' ' funcname ::= identifier\n' '\n' 'A function definition is an executable statement. Its execution ' 'binds\n' 'the function name in the current local namespace to a function ' 'object\n' '(a wrapper around the executable code for the function). This\n' 'function object contains a reference to the current global ' 'namespace\n' 'as the global namespace to be used when the function is called.\n' '\n' 'The function definition does not execute the function body; this ' 'gets\n' 'executed only when the function is called. [2]\n' '\n' 'A function definition may be wrapped by one or more *decorator*\n' 'expressions. Decorator expressions are evaluated when the ' 'function is\n' 'defined, in the scope that contains the function definition. ' 'The\n' 'result must be a callable, which is invoked with the function ' 'object\n' 'as the only argument. The returned value is bound to the ' 'function name\n' 'instead of the function object. Multiple decorators are applied ' 'in\n' 'nested fashion. For example, the following code\n' '\n' ' @f1(arg)\n' ' @f2\n' ' def func(): pass\n' '\n' 'is roughly equivalent to\n' '\n' ' def func(): pass\n' ' func = f1(arg)(f2(func))\n' '\n' 'except that the original function is not temporarily bound to ' 'the name\n' '"func".\n' '\n' 'When one or more *parameters* have the form *parameter* "="\n' '*expression*, the function is said to have “default parameter ' 'values.”\n' 'For a parameter with a default value, the corresponding ' '*argument* may\n' 'be omitted from a call, in which case the parameter’s default ' 'value is\n' 'substituted. If a parameter has a default value, all following\n' 'parameters up until the “"*"” must also have a default value — ' 'this is\n' 'a syntactic restriction that is not expressed by the grammar.\n' '\n' '**Default parameter values are evaluated from left to right when ' 'the\n' 'function definition is executed.** This means that the ' 'expression is\n' 'evaluated once, when the function is defined, and that the same ' '“pre-\n' 'computed” value is used for each call. This is especially ' 'important\n' 'to understand when a default parameter is a mutable object, such ' 'as a\n' 'list or a dictionary: if the function modifies the object (e.g. ' 'by\n' 'appending an item to a list), the default value is in effect ' 'modified.\n' 'This is generally not what was intended. A way around this is ' 'to use\n' '"None" as the default, and explicitly test for it in the body of ' 'the\n' 'function, e.g.:\n' '\n' ' def whats_on_the_telly(penguin=None):\n' ' if penguin is None:\n' ' penguin = []\n' ' penguin.append("property of the zoo")\n' ' return penguin\n' '\n' 'Function call semantics are described in more detail in section ' 'Calls.\n' 'A function call always assigns values to all parameters ' 'mentioned in\n' 'the parameter list, either from position arguments, from ' 'keyword\n' 'arguments, or from default values. If the form “"*identifier"” ' 'is\n' 'present, it is initialized to a tuple receiving any excess ' 'positional\n' 'parameters, defaulting to the empty tuple. If the form\n' '“"**identifier"” is present, it is initialized to a new ordered\n' 'mapping receiving any excess keyword arguments, defaulting to a ' 'new\n' 'empty mapping of the same type. Parameters after “"*"” or\n' '“"*identifier"” are keyword-only parameters and may only be ' 'passed\n' 'used keyword arguments.\n' '\n' 'Parameters may have annotations of the form “": expression"” ' 'following\n' 'the parameter name. Any parameter may have an annotation even ' 'those\n' 'of the form "*identifier" or "**identifier". Functions may ' 'have\n' '“return” annotation of the form “"-> expression"” after the ' 'parameter\n' 'list. These annotations can be any valid Python expression and ' 'are\n' 'evaluated when the function definition is executed. Annotations ' 'may\n' 'be evaluated in a different order than they appear in the source ' 'code.\n' 'The presence of annotations does not change the semantics of a\n' 'function. The annotation values are available as values of a\n' 'dictionary keyed by the parameters’ names in the ' '"__annotations__"\n' 'attribute of the function object.\n' '\n' 'It is also possible to create anonymous functions (functions not ' 'bound\n' 'to a name), for immediate use in expressions. This uses lambda\n' 'expressions, described in section Lambdas. Note that the ' 'lambda\n' 'expression is merely a shorthand for a simplified function ' 'definition;\n' 'a function defined in a “"def"” statement can be passed around ' 'or\n' 'assigned to another name just like a function defined by a ' 'lambda\n' 'expression. The “"def"” form is actually more powerful since ' 'it\n' 'allows the execution of multiple statements and annotations.\n' '\n' '**Programmer’s note:** Functions are first-class objects. A ' '“"def"”\n' 'statement executed inside a function definition defines a local\n' 'function that can be returned or passed around. Free variables ' 'used\n' 'in the nested function can access the local variables of the ' 'function\n' 'containing the def. See section Naming and binding for ' 'details.\n' '\n' 'See also:\n' '\n' ' **PEP 3107** - Function Annotations\n' ' The original specification for function annotations.\n', 'global': 'The "global" statement\n' '**********************\n' '\n' ' global_stmt ::= "global" identifier ("," identifier)*\n' '\n' 'The "global" statement is a declaration which holds for the ' 'entire\n' 'current code block. It means that the listed identifiers are to ' 'be\n' 'interpreted as globals. It would be impossible to assign to a ' 'global\n' 'variable without "global", although free variables may refer to\n' 'globals without being declared global.\n' '\n' 'Names listed in a "global" statement must not be used in the same ' 'code\n' 'block textually preceding that "global" statement.\n' '\n' 'Names listed in a "global" statement must not be defined as ' 'formal\n' 'parameters or in a "for" loop control target, "class" definition,\n' 'function definition, "import" statement, or variable annotation.\n' '\n' '**CPython implementation detail:** The current implementation does ' 'not\n' 'enforce some of these restrictions, but programs should not abuse ' 'this\n' 'freedom, as future implementations may enforce them or silently ' 'change\n' 'the meaning of the program.\n' '\n' '**Programmer’s note:** "global" is a directive to the parser. It\n' 'applies only to code parsed at the same time as the "global"\n' 'statement. In particular, a "global" statement contained in a ' 'string\n' 'or code object supplied to the built-in "exec()" function does ' 'not\n' 'affect the code block *containing* the function call, and code\n' 'contained in such a string is unaffected by "global" statements in ' 'the\n' 'code containing the function call. The same applies to the ' '"eval()"\n' 'and "compile()" functions.\n', 'id-classes': 'Reserved classes of identifiers\n' '*******************************\n' '\n' 'Certain classes of identifiers (besides keywords) have ' 'special\n' 'meanings. These classes are identified by the patterns of ' 'leading and\n' 'trailing underscore characters:\n' '\n' '"_*"\n' ' Not imported by "from module import *". The special ' 'identifier "_"\n' ' is used in the interactive interpreter to store the result ' 'of the\n' ' last evaluation; it is stored in the "builtins" module. ' 'When not\n' ' in interactive mode, "_" has no special meaning and is not ' 'defined.\n' ' See section The import statement.\n' '\n' ' Note:\n' '\n' ' The name "_" is often used in conjunction with\n' ' internationalization; refer to the documentation for the\n' ' "gettext" module for more information on this ' 'convention.\n' '\n' '"__*__"\n' ' System-defined names. These names are defined by the ' 'interpreter\n' ' and its implementation (including the standard library). ' 'Current\n' ' system names are discussed in the Special method names ' 'section and\n' ' elsewhere. More will likely be defined in future versions ' 'of\n' ' Python. *Any* use of "__*__" names, in any context, that ' 'does not\n' ' follow explicitly documented use, is subject to breakage ' 'without\n' ' warning.\n' '\n' '"__*"\n' ' Class-private names. Names in this category, when used ' 'within the\n' ' context of a class definition, are re-written to use a ' 'mangled form\n' ' to help avoid name clashes between “private” attributes of ' 'base and\n' ' derived classes. See section Identifiers (Names).\n', 'identifiers': 'Identifiers and keywords\n' '************************\n' '\n' 'Identifiers (also referred to as *names*) are described by ' 'the\n' 'following lexical definitions.\n' '\n' 'The syntax of identifiers in Python is based on the Unicode ' 'standard\n' 'annex UAX-31, with elaboration and changes as defined below; ' 'see also\n' '**PEP 3131** for further details.\n' '\n' 'Within the ASCII range (U+0001..U+007F), the valid characters ' 'for\n' 'identifiers are the same as in Python 2.x: the uppercase and ' 'lowercase\n' 'letters "A" through "Z", the underscore "_" and, except for ' 'the first\n' 'character, the digits "0" through "9".\n' '\n' 'Python 3.0 introduces additional characters from outside the ' 'ASCII\n' 'range (see **PEP 3131**). For these characters, the ' 'classification\n' 'uses the version of the Unicode Character Database as ' 'included in the\n' '"unicodedata" module.\n' '\n' 'Identifiers are unlimited in length. Case is significant.\n' '\n' ' identifier ::= xid_start xid_continue*\n' ' id_start ::= <all characters in general categories Lu, ' 'Ll, Lt, Lm, Lo, Nl, the underscore, and characters with the ' 'Other_ID_Start property>\n' ' id_continue ::= <all characters in id_start, plus ' 'characters in the categories Mn, Mc, Nd, Pc and others with ' 'the Other_ID_Continue property>\n' ' xid_start ::= <all characters in id_start whose NFKC ' 'normalization is in "id_start xid_continue*">\n' ' xid_continue ::= <all characters in id_continue whose NFKC ' 'normalization is in "id_continue*">\n' '\n' 'The Unicode category codes mentioned above stand for:\n' '\n' '* *Lu* - uppercase letters\n' '\n' '* *Ll* - lowercase letters\n' '\n' '* *Lt* - titlecase letters\n' '\n' '* *Lm* - modifier letters\n' '\n' '* *Lo* - other letters\n' '\n' '* *Nl* - letter numbers\n' '\n' '* *Mn* - nonspacing marks\n' '\n' '* *Mc* - spacing combining marks\n' '\n' '* *Nd* - decimal numbers\n' '\n' '* *Pc* - connector punctuations\n' '\n' '* *Other_ID_Start* - explicit list of characters in ' 'PropList.txt to\n' ' support backwards compatibility\n' '\n' '* *Other_ID_Continue* - likewise\n' '\n' 'All identifiers are converted into the normal form NFKC while ' 'parsing;\n' 'comparison of identifiers is based on NFKC.\n' '\n' 'A non-normative HTML file listing all valid identifier ' 'characters for\n' 'Unicode 4.1 can be found at https://www.dcl.hpi.uni-\n' 'potsdam.de/home/loewis/table-3131.html.\n' '\n' '\n' 'Keywords\n' '========\n' '\n' 'The following identifiers are used as reserved words, or ' '*keywords* of\n' 'the language, and cannot be used as ordinary identifiers. ' 'They must\n' 'be spelled exactly as written here:\n' '\n' ' False class finally is return\n' ' None continue for lambda try\n' ' True def from nonlocal while\n' ' and del global not with\n' ' as elif if or yield\n' ' assert else import pass\n' ' break except in raise\n' '\n' '\n' 'Reserved classes of identifiers\n' '===============================\n' '\n' 'Certain classes of identifiers (besides keywords) have ' 'special\n' 'meanings. These classes are identified by the patterns of ' 'leading and\n' 'trailing underscore characters:\n' '\n' '"_*"\n' ' Not imported by "from module import *". The special ' 'identifier "_"\n' ' is used in the interactive interpreter to store the result ' 'of the\n' ' last evaluation; it is stored in the "builtins" module. ' 'When not\n' ' in interactive mode, "_" has no special meaning and is not ' 'defined.\n' ' See section The import statement.\n' '\n' ' Note:\n' '\n' ' The name "_" is often used in conjunction with\n' ' internationalization; refer to the documentation for ' 'the\n' ' "gettext" module for more information on this ' 'convention.\n' '\n' '"__*__"\n' ' System-defined names. These names are defined by the ' 'interpreter\n' ' and its implementation (including the standard library). ' 'Current\n' ' system names are discussed in the Special method names ' 'section and\n' ' elsewhere. More will likely be defined in future versions ' 'of\n' ' Python. *Any* use of "__*__" names, in any context, that ' 'does not\n' ' follow explicitly documented use, is subject to breakage ' 'without\n' ' warning.\n' '\n' '"__*"\n' ' Class-private names. Names in this category, when used ' 'within the\n' ' context of a class definition, are re-written to use a ' 'mangled form\n' ' to help avoid name clashes between “private” attributes of ' 'base and\n' ' derived classes. See section Identifiers (Names).\n', 'if': 'The "if" statement\n' '******************\n' '\n' 'The "if" statement is used for conditional execution:\n' '\n' ' if_stmt ::= "if" expression ":" suite\n' ' ("elif" expression ":" suite)*\n' ' ["else" ":" suite]\n' '\n' 'It selects exactly one of the suites by evaluating the expressions ' 'one\n' 'by one until one is found to be true (see section Boolean operations\n' 'for the definition of true and false); then that suite is executed\n' '(and no other part of the "if" statement is executed or evaluated).\n' 'If all expressions are false, the suite of the "else" clause, if\n' 'present, is executed.\n', 'imaginary': 'Imaginary literals\n' '******************\n' '\n' 'Imaginary literals are described by the following lexical ' 'definitions:\n' '\n' ' imagnumber ::= (floatnumber | digitpart) ("j" | "J")\n' '\n' 'An imaginary literal yields a complex number with a real part ' 'of 0.0.\n' 'Complex numbers are represented as a pair of floating point ' 'numbers\n' 'and have the same restrictions on their range. To create a ' 'complex\n' 'number with a nonzero real part, add a floating point number to ' 'it,\n' 'e.g., "(3+4j)". Some examples of imaginary literals:\n' '\n' ' 3.14j 10.j 10j .001j 1e100j 3.14e-10j ' '3.14_15_93j\n', 'import': 'The "import" statement\n' '**********************\n' '\n' ' import_stmt ::= "import" module ["as" identifier] ("," ' 'module ["as" identifier])*\n' ' | "from" relative_module "import" identifier ' '["as" identifier]\n' ' ("," identifier ["as" identifier])*\n' ' | "from" relative_module "import" "(" ' 'identifier ["as" identifier]\n' ' ("," identifier ["as" identifier])* [","] ")"\n' ' | "from" module "import" "*"\n' ' module ::= (identifier ".")* identifier\n' ' relative_module ::= "."* module | "."+\n' '\n' 'The basic import statement (no "from" clause) is executed in two\n' 'steps:\n' '\n' '1. find a module, loading and initializing it if necessary\n' '\n' '2. define a name or names in the local namespace for the scope ' 'where\n' ' the "import" statement occurs.\n' '\n' 'When the statement contains multiple clauses (separated by commas) ' 'the\n' 'two steps are carried out separately for each clause, just as ' 'though\n' 'the clauses had been separated out into individual import ' 'statements.\n' '\n' 'The details of the first step, finding and loading modules are\n' 'described in greater detail in the section on the import system, ' 'which\n' 'also describes the various types of packages and modules that can ' 'be\n' 'imported, as well as all the hooks that can be used to customize ' 'the\n' 'import system. Note that failures in this step may indicate ' 'either\n' 'that the module could not be located, *or* that an error occurred\n' 'while initializing the module, which includes execution of the\n' 'module’s code.\n' '\n' 'If the requested module is retrieved successfully, it will be ' 'made\n' 'available in the local namespace in one of three ways:\n' '\n' '* If the module name is followed by "as", then the name following ' '"as"\n' ' is bound directly to the imported module.\n' '\n' '* If no other name is specified, and the module being imported is ' 'a\n' ' top level module, the module’s name is bound in the local ' 'namespace\n' ' as a reference to the imported module\n' '\n' '* If the module being imported is *not* a top level module, then ' 'the\n' ' name of the top level package that contains the module is bound ' 'in\n' ' the local namespace as a reference to the top level package. ' 'The\n' ' imported module must be accessed using its full qualified name\n' ' rather than directly\n' '\n' 'The "from" form uses a slightly more complex process:\n' '\n' '1. find the module specified in the "from" clause, loading and\n' ' initializing it if necessary;\n' '\n' '2. for each of the identifiers specified in the "import" clauses:\n' '\n' ' 1. check if the imported module has an attribute by that name\n' '\n' ' 2. if not, attempt to import a submodule with that name and ' 'then\n' ' check the imported module again for that attribute\n' '\n' ' 3. if the attribute is not found, "ImportError" is raised.\n' '\n' ' 4. otherwise, a reference to that value is stored in the local\n' ' namespace, using the name in the "as" clause if it is ' 'present,\n' ' otherwise using the attribute name\n' '\n' 'Examples:\n' '\n' ' import foo # foo imported and bound locally\n' ' import foo.bar.baz # foo.bar.baz imported, foo bound ' 'locally\n' ' import foo.bar.baz as fbb # foo.bar.baz imported and bound as ' 'fbb\n' ' from foo.bar import baz # foo.bar.baz imported and bound as ' 'baz\n' ' from foo import attr # foo imported and foo.attr bound as ' 'attr\n' '\n' 'If the list of identifiers is replaced by a star ("\'*\'"), all ' 'public\n' 'names defined in the module are bound in the local namespace for ' 'the\n' 'scope where the "import" statement occurs.\n' '\n' 'The *public names* defined by a module are determined by checking ' 'the\n' 'module’s namespace for a variable named "__all__"; if defined, it ' 'must\n' 'be a sequence of strings which are names defined or imported by ' 'that\n' 'module. The names given in "__all__" are all considered public ' 'and\n' 'are required to exist. If "__all__" is not defined, the set of ' 'public\n' 'names includes all names found in the module’s namespace which do ' 'not\n' 'begin with an underscore character ("\'_\'"). "__all__" should ' 'contain\n' 'the entire public API. It is intended to avoid accidentally ' 'exporting\n' 'items that are not part of the API (such as library modules which ' 'were\n' 'imported and used within the module).\n' '\n' 'The wild card form of import — "from module import *" — is only\n' 'allowed at the module level. Attempting to use it in class or\n' 'function definitions will raise a "SyntaxError".\n' '\n' 'When specifying what module to import you do not have to specify ' 'the\n' 'absolute name of the module. When a module or package is ' 'contained\n' 'within another package it is possible to make a relative import ' 'within\n' 'the same top package without having to mention the package name. ' 'By\n' 'using leading dots in the specified module or package after "from" ' 'you\n' 'can specify how high to traverse up the current package hierarchy\n' 'without specifying exact names. One leading dot means the current\n' 'package where the module making the import exists. Two dots means ' 'up\n' 'one package level. Three dots is up two levels, etc. So if you ' 'execute\n' '"from . import mod" from a module in the "pkg" package then you ' 'will\n' 'end up importing "pkg.mod". If you execute "from ..subpkg2 import ' 'mod"\n' 'from within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\n' 'specification for relative imports is contained within **PEP ' '328**.\n' '\n' '"importlib.import_module()" is provided to support applications ' 'that\n' 'determine dynamically the modules to be loaded.\n' '\n' '\n' 'Future statements\n' '=================\n' '\n' 'A *future statement* is a directive to the compiler that a ' 'particular\n' 'module should be compiled using syntax or semantics that will be\n' 'available in a specified future release of Python where the ' 'feature\n' 'becomes standard.\n' '\n' 'The future statement is intended to ease migration to future ' 'versions\n' 'of Python that introduce incompatible changes to the language. ' 'It\n' 'allows use of the new features on a per-module basis before the\n' 'release in which the feature becomes standard.\n' '\n' ' future_stmt ::= "from" "__future__" "import" feature ["as" ' 'identifier]\n' ' ("," feature ["as" identifier])*\n' ' | "from" "__future__" "import" "(" feature ' '["as" identifier]\n' ' ("," feature ["as" identifier])* [","] ")"\n' ' feature ::= identifier\n' '\n' 'A future statement must appear near the top of the module. The ' 'only\n' 'lines that can appear before a future statement are:\n' '\n' '* the module docstring (if any),\n' '\n' '* comments,\n' '\n' '* blank lines, and\n' '\n' '* other future statements.\n' '\n' 'The features recognized by Python 3.0 are "absolute_import",\n' '"division", "generators", "unicode_literals", "print_function",\n' '"nested_scopes" and "with_statement". They are all redundant ' 'because\n' 'they are always enabled, and only kept for backwards ' 'compatibility.\n' '\n' 'A future statement is recognized and treated specially at compile\n' 'time: Changes to the semantics of core constructs are often\n' 'implemented by generating different code. It may even be the ' 'case\n' 'that a new feature introduces new incompatible syntax (such as a ' 'new\n' 'reserved word), in which case the compiler may need to parse the\n' 'module differently. Such decisions cannot be pushed off until\n' 'runtime.\n' '\n' 'For any given release, the compiler knows which feature names ' 'have\n' 'been defined, and raises a compile-time error if a future ' 'statement\n' 'contains a feature not known to it.\n' '\n' 'The direct runtime semantics are the same as for any import ' 'statement:\n' 'there is a standard module "__future__", described later, and it ' 'will\n' 'be imported in the usual way at the time the future statement is\n' 'executed.\n' '\n' 'The interesting runtime semantics depend on the specific feature\n' 'enabled by the future statement.\n' '\n' 'Note that there is nothing special about the statement:\n' '\n' ' import __future__ [as name]\n' '\n' 'That is not a future statement; it’s an ordinary import statement ' 'with\n' 'no special semantics or syntax restrictions.\n' '\n' 'Code compiled by calls to the built-in functions "exec()" and\n' '"compile()" that occur in a module "M" containing a future ' 'statement\n' 'will, by default, use the new syntax or semantics associated with ' 'the\n' 'future statement. This can be controlled by optional arguments ' 'to\n' '"compile()" — see the documentation of that function for details.\n' '\n' 'A future statement typed at an interactive interpreter prompt ' 'will\n' 'take effect for the rest of the interpreter session. If an\n' 'interpreter is started with the "-i" option, is passed a script ' 'name\n' 'to execute, and the script includes a future statement, it will be ' 'in\n' 'effect in the interactive session started after the script is\n' 'executed.\n' '\n' 'See also:\n' '\n' ' **PEP 236** - Back to the __future__\n' ' The original proposal for the __future__ mechanism.\n', 'in': 'Membership test operations\n' '**************************\n' '\n' 'The operators "in" and "not in" test for membership. "x in s"\n' 'evaluates to "True" if *x* is a member of *s*, and "False" otherwise.\n' '"x not in s" returns the negation of "x in s". All built-in ' 'sequences\n' 'and set types support this as well as dictionary, for which "in" ' 'tests\n' 'whether the dictionary has a given key. For container types such as\n' 'list, tuple, set, frozenset, dict, or collections.deque, the\n' 'expression "x in y" is equivalent to "any(x is e or x == e for e in\n' 'y)".\n' '\n' 'For the string and bytes types, "x in y" is "True" if and only if *x*\n' 'is a substring of *y*. An equivalent test is "y.find(x) != -1".\n' 'Empty strings are always considered to be a substring of any other\n' 'string, so """ in "abc"" will return "True".\n' '\n' 'For user-defined classes which define the "__contains__()" method, "x\n' 'in y" returns "True" if "y.__contains__(x)" returns a true value, and\n' '"False" otherwise.\n' '\n' 'For user-defined classes which do not define "__contains__()" but do\n' 'define "__iter__()", "x in y" is "True" if some value "z" with "x ==\n' 'z" is produced while iterating over "y". If an exception is raised\n' 'during the iteration, it is as if "in" raised that exception.\n' '\n' 'Lastly, the old-style iteration protocol is tried: if a class defines\n' '"__getitem__()", "x in y" is "True" if and only if there is a non-\n' 'negative integer index *i* such that "x == y[i]", and all lower\n' 'integer indices do not raise "IndexError" exception. (If any other\n' 'exception is raised, it is as if "in" raised that exception).\n' '\n' 'The operator "not in" is defined to have the inverse true value of\n' '"in".\n', 'integers': 'Integer literals\n' '****************\n' '\n' 'Integer literals are described by the following lexical ' 'definitions:\n' '\n' ' integer ::= decinteger | bininteger | octinteger | ' 'hexinteger\n' ' decinteger ::= nonzerodigit (["_"] digit)* | "0"+ (["_"] ' '"0")*\n' ' bininteger ::= "0" ("b" | "B") (["_"] bindigit)+\n' ' octinteger ::= "0" ("o" | "O") (["_"] octdigit)+\n' ' hexinteger ::= "0" ("x" | "X") (["_"] hexdigit)+\n' ' nonzerodigit ::= "1"..."9"\n' ' digit ::= "0"..."9"\n' ' bindigit ::= "0" | "1"\n' ' octdigit ::= "0"..."7"\n' ' hexdigit ::= digit | "a"..."f" | "A"..."F"\n' '\n' 'There is no limit for the length of integer literals apart from ' 'what\n' 'can be stored in available memory.\n' '\n' 'Underscores are ignored for determining the numeric value of ' 'the\n' 'literal. They can be used to group digits for enhanced ' 'readability.\n' 'One underscore can occur between digits, and after base ' 'specifiers\n' 'like "0x".\n' '\n' 'Note that leading zeros in a non-zero decimal number are not ' 'allowed.\n' 'This is for disambiguation with C-style octal literals, which ' 'Python\n' 'used before version 3.0.\n' '\n' 'Some examples of integer literals:\n' '\n' ' 7 2147483647 0o177 0b100110111\n' ' 3 79228162514264337593543950336 0o377 0xdeadbeef\n' ' 100_000_000_000 0b_1110_0101\n' '\n' 'Changed in version 3.6: Underscores are now allowed for ' 'grouping\n' 'purposes in literals.\n', 'lambda': 'Lambdas\n' '*******\n' '\n' ' lambda_expr ::= "lambda" [parameter_list] ":" ' 'expression\n' ' lambda_expr_nocond ::= "lambda" [parameter_list] ":" ' 'expression_nocond\n' '\n' 'Lambda expressions (sometimes called lambda forms) are used to ' 'create\n' 'anonymous functions. The expression "lambda parameters: ' 'expression"\n' 'yields a function object. The unnamed object behaves like a ' 'function\n' 'object defined with:\n' '\n' ' def <lambda>(parameters):\n' ' return expression\n' '\n' 'See section Function definitions for the syntax of parameter ' 'lists.\n' 'Note that functions created with lambda expressions cannot ' 'contain\n' 'statements or annotations.\n', 'lists': 'List displays\n' '*************\n' '\n' 'A list display is a possibly empty series of expressions enclosed ' 'in\n' 'square brackets:\n' '\n' ' list_display ::= "[" [starred_list | comprehension] "]"\n' '\n' 'A list display yields a new list object, the contents being ' 'specified\n' 'by either a list of expressions or a comprehension. When a comma-\n' 'separated list of expressions is supplied, its elements are ' 'evaluated\n' 'from left to right and placed into the list object in that order.\n' 'When a comprehension is supplied, the list is constructed from the\n' 'elements resulting from the comprehension.\n', 'naming': 'Naming and binding\n' '******************\n' '\n' '\n' 'Binding of names\n' '================\n' '\n' '*Names* refer to objects. Names are introduced by name binding\n' 'operations.\n' '\n' 'The following constructs bind names: formal parameters to ' 'functions,\n' '"import" statements, class and function definitions (these bind ' 'the\n' 'class or function name in the defining block), and targets that ' 'are\n' 'identifiers if occurring in an assignment, "for" loop header, or ' 'after\n' '"as" in a "with" statement or "except" clause. The "import" ' 'statement\n' 'of the form "from ... import *" binds all names defined in the\n' 'imported module, except those beginning with an underscore. This ' 'form\n' 'may only be used at the module level.\n' '\n' 'A target occurring in a "del" statement is also considered bound ' 'for\n' 'this purpose (though the actual semantics are to unbind the ' 'name).\n' '\n' 'Each assignment or import statement occurs within a block defined ' 'by a\n' 'class or function definition or at the module level (the ' 'top-level\n' 'code block).\n' '\n' 'If a name is bound in a block, it is a local variable of that ' 'block,\n' 'unless declared as "nonlocal" or "global". If a name is bound at ' 'the\n' 'module level, it is a global variable. (The variables of the ' 'module\n' 'code block are local and global.) If a variable is used in a ' 'code\n' 'block but not defined there, it is a *free variable*.\n' '\n' 'Each occurrence of a name in the program text refers to the ' '*binding*\n' 'of that name established by the following name resolution rules.\n' '\n' '\n' 'Resolution of names\n' '===================\n' '\n' 'A *scope* defines the visibility of a name within a block. If a ' 'local\n' 'variable is defined in a block, its scope includes that block. If ' 'the\n' 'definition occurs in a function block, the scope extends to any ' 'blocks\n' 'contained within the defining one, unless a contained block ' 'introduces\n' 'a different binding for the name.\n' '\n' 'When a name is used in a code block, it is resolved using the ' 'nearest\n' 'enclosing scope. The set of all such scopes visible to a code ' 'block\n' 'is called the block’s *environment*.\n' '\n' 'When a name is not found at all, a "NameError" exception is ' 'raised. If\n' 'the current scope is a function scope, and the name refers to a ' 'local\n' 'variable that has not yet been bound to a value at the point where ' 'the\n' 'name is used, an "UnboundLocalError" exception is raised.\n' '"UnboundLocalError" is a subclass of "NameError".\n' '\n' 'If a name binding operation occurs anywhere within a code block, ' 'all\n' 'uses of the name within the block are treated as references to ' 'the\n' 'current block. This can lead to errors when a name is used within ' 'a\n' 'block before it is bound. This rule is subtle. Python lacks\n' 'declarations and allows name binding operations to occur anywhere\n' 'within a code block. The local variables of a code block can be\n' 'determined by scanning the entire text of the block for name ' 'binding\n' 'operations.\n' '\n' 'If the "global" statement occurs within a block, all uses of the ' 'name\n' 'specified in the statement refer to the binding of that name in ' 'the\n' 'top-level namespace. Names are resolved in the top-level ' 'namespace by\n' 'searching the global namespace, i.e. the namespace of the module\n' 'containing the code block, and the builtins namespace, the ' 'namespace\n' 'of the module "builtins". The global namespace is searched ' 'first. If\n' 'the name is not found there, the builtins namespace is searched. ' 'The\n' '"global" statement must precede all uses of the name.\n' '\n' 'The "global" statement has the same scope as a name binding ' 'operation\n' 'in the same block. If the nearest enclosing scope for a free ' 'variable\n' 'contains a global statement, the free variable is treated as a ' 'global.\n' '\n' 'The "nonlocal" statement causes corresponding names to refer to\n' 'previously bound variables in the nearest enclosing function ' 'scope.\n' '"SyntaxError" is raised at compile time if the given name does ' 'not\n' 'exist in any enclosing function scope.\n' '\n' 'The namespace for a module is automatically created the first time ' 'a\n' 'module is imported. The main module for a script is always ' 'called\n' '"__main__".\n' '\n' 'Class definition blocks and arguments to "exec()" and "eval()" ' 'are\n' 'special in the context of name resolution. A class definition is ' 'an\n' 'executable statement that may use and define names. These ' 'references\n' 'follow the normal rules for name resolution with an exception ' 'that\n' 'unbound local variables are looked up in the global namespace. ' 'The\n' 'namespace of the class definition becomes the attribute dictionary ' 'of\n' 'the class. The scope of names defined in a class block is limited ' 'to\n' 'the class block; it does not extend to the code blocks of methods ' '–\n' 'this includes comprehensions and generator expressions since they ' 'are\n' 'implemented using a function scope. This means that the ' 'following\n' 'will fail:\n' '\n' ' class A:\n' ' a = 42\n' ' b = list(a + i for i in range(10))\n' '\n' '\n' 'Builtins and restricted execution\n' '=================================\n' '\n' '**CPython implementation detail:** Users should not touch\n' '"__builtins__"; it is strictly an implementation detail. Users\n' 'wanting to override values in the builtins namespace should ' '"import"\n' 'the "builtins" module and modify its attributes appropriately.\n' '\n' 'The builtins namespace associated with the execution of a code ' 'block\n' 'is actually found by looking up the name "__builtins__" in its ' 'global\n' 'namespace; this should be a dictionary or a module (in the latter ' 'case\n' 'the module’s dictionary is used). By default, when in the ' '"__main__"\n' 'module, "__builtins__" is the built-in module "builtins"; when in ' 'any\n' 'other module, "__builtins__" is an alias for the dictionary of ' 'the\n' '"builtins" module itself.\n' '\n' '\n' 'Interaction with dynamic features\n' '=================================\n' '\n' 'Name resolution of free variables occurs at runtime, not at ' 'compile\n' 'time. This means that the following code will print 42:\n' '\n' ' i = 10\n' ' def f():\n' ' print(i)\n' ' i = 42\n' ' f()\n' '\n' 'The "eval()" and "exec()" functions do not have access to the ' 'full\n' 'environment for resolving names. Names may be resolved in the ' 'local\n' 'and global namespaces of the caller. Free variables are not ' 'resolved\n' 'in the nearest enclosing namespace, but in the global namespace. ' '[1]\n' 'The "exec()" and "eval()" functions have optional arguments to\n' 'override the global and local namespace. If only one namespace ' 'is\n' 'specified, it is used for both.\n', 'nonlocal': 'The "nonlocal" statement\n' '************************\n' '\n' ' nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n' '\n' 'The "nonlocal" statement causes the listed identifiers to refer ' 'to\n' 'previously bound variables in the nearest enclosing scope ' 'excluding\n' 'globals. This is important because the default behavior for ' 'binding is\n' 'to search the local namespace first. The statement allows\n' 'encapsulated code to rebind variables outside of the local ' 'scope\n' 'besides the global (module) scope.\n' '\n' 'Names listed in a "nonlocal" statement, unlike those listed in ' 'a\n' '"global" statement, must refer to pre-existing bindings in an\n' 'enclosing scope (the scope in which a new binding should be ' 'created\n' 'cannot be determined unambiguously).\n' '\n' 'Names listed in a "nonlocal" statement must not collide with ' 'pre-\n' 'existing bindings in the local scope.\n' '\n' 'See also:\n' '\n' ' **PEP 3104** - Access to Names in Outer Scopes\n' ' The specification for the "nonlocal" statement.\n', 'numbers': 'Numeric literals\n' '****************\n' '\n' 'There are three types of numeric literals: integers, floating ' 'point\n' 'numbers, and imaginary numbers. There are no complex literals\n' '(complex numbers can be formed by adding a real number and an\n' 'imaginary number).\n' '\n' 'Note that numeric literals do not include a sign; a phrase like ' '"-1"\n' 'is actually an expression composed of the unary operator ‘"-"’ ' 'and the\n' 'literal "1".\n', 'numeric-types': 'Emulating numeric types\n' '***********************\n' '\n' 'The following methods can be defined to emulate numeric ' 'objects.\n' 'Methods corresponding to operations that are not supported ' 'by the\n' 'particular kind of number implemented (e.g., bitwise ' 'operations for\n' 'non-integral numbers) should be left undefined.\n' '\n' 'object.__add__(self, other)\n' 'object.__sub__(self, other)\n' 'object.__mul__(self, other)\n' 'object.__matmul__(self, other)\n' 'object.__truediv__(self, other)\n' 'object.__floordiv__(self, other)\n' 'object.__mod__(self, other)\n' 'object.__divmod__(self, other)\n' 'object.__pow__(self, other[, modulo])\n' 'object.__lshift__(self, other)\n' 'object.__rshift__(self, other)\n' 'object.__and__(self, other)\n' 'object.__xor__(self, other)\n' 'object.__or__(self, other)\n' '\n' ' These methods are called to implement the binary ' 'arithmetic\n' ' operations ("+", "-", "*", "@", "/", "//", "%", ' '"divmod()",\n' ' "pow()", "**", "<<", ">>", "&", "^", "|"). For ' 'instance, to\n' ' evaluate the expression "x + y", where *x* is an ' 'instance of a\n' ' class that has an "__add__()" method, "x.__add__(y)" is ' 'called.\n' ' The "__divmod__()" method should be the equivalent to ' 'using\n' ' "__floordiv__()" and "__mod__()"; it should not be ' 'related to\n' ' "__truediv__()". Note that "__pow__()" should be ' 'defined to accept\n' ' an optional third argument if the ternary version of the ' 'built-in\n' ' "pow()" function is to be supported.\n' '\n' ' If one of those methods does not support the operation ' 'with the\n' ' supplied arguments, it should return "NotImplemented".\n' '\n' 'object.__radd__(self, other)\n' 'object.__rsub__(self, other)\n' 'object.__rmul__(self, other)\n' 'object.__rmatmul__(self, other)\n' 'object.__rtruediv__(self, other)\n' 'object.__rfloordiv__(self, other)\n' 'object.__rmod__(self, other)\n' 'object.__rdivmod__(self, other)\n' 'object.__rpow__(self, other)\n' 'object.__rlshift__(self, other)\n' 'object.__rrshift__(self, other)\n' 'object.__rand__(self, other)\n' 'object.__rxor__(self, other)\n' 'object.__ror__(self, other)\n' '\n' ' These methods are called to implement the binary ' 'arithmetic\n' ' operations ("+", "-", "*", "@", "/", "//", "%", ' '"divmod()",\n' ' "pow()", "**", "<<", ">>", "&", "^", "|") with reflected ' '(swapped)\n' ' operands. These functions are only called if the left ' 'operand does\n' ' not support the corresponding operation [3] and the ' 'operands are of\n' ' different types. [4] For instance, to evaluate the ' 'expression "x -\n' ' y", where *y* is an instance of a class that has an ' '"__rsub__()"\n' ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' 'returns\n' ' *NotImplemented*.\n' '\n' ' Note that ternary "pow()" will not try calling ' '"__rpow__()" (the\n' ' coercion rules would become too complicated).\n' '\n' ' Note:\n' '\n' ' If the right operand’s type is a subclass of the left ' 'operand’s\n' ' type and that subclass provides the reflected method ' 'for the\n' ' operation, this method will be called before the left ' 'operand’s\n' ' non-reflected method. This behavior allows subclasses ' 'to\n' ' override their ancestors’ operations.\n' '\n' 'object.__iadd__(self, other)\n' 'object.__isub__(self, other)\n' 'object.__imul__(self, other)\n' 'object.__imatmul__(self, other)\n' 'object.__itruediv__(self, other)\n' 'object.__ifloordiv__(self, other)\n' 'object.__imod__(self, other)\n' 'object.__ipow__(self, other[, modulo])\n' 'object.__ilshift__(self, other)\n' 'object.__irshift__(self, other)\n' 'object.__iand__(self, other)\n' 'object.__ixor__(self, other)\n' 'object.__ior__(self, other)\n' '\n' ' These methods are called to implement the augmented ' 'arithmetic\n' ' assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", ' '"**=",\n' ' "<<=", ">>=", "&=", "^=", "|="). These methods should ' 'attempt to\n' ' do the operation in-place (modifying *self*) and return ' 'the result\n' ' (which could be, but does not have to be, *self*). If a ' 'specific\n' ' method is not defined, the augmented assignment falls ' 'back to the\n' ' normal methods. For instance, if *x* is an instance of ' 'a class\n' ' with an "__iadd__()" method, "x += y" is equivalent to ' '"x =\n' ' x.__iadd__(y)" . Otherwise, "x.__add__(y)" and ' '"y.__radd__(x)" are\n' ' considered, as with the evaluation of "x + y". In ' 'certain\n' ' situations, augmented assignment can result in ' 'unexpected errors\n' ' (see Why does a_tuple[i] += [‘item’] raise an exception ' 'when the\n' ' addition works?), but this behavior is in fact part of ' 'the data\n' ' model.\n' '\n' 'object.__neg__(self)\n' 'object.__pos__(self)\n' 'object.__abs__(self)\n' 'object.__invert__(self)\n' '\n' ' Called to implement the unary arithmetic operations ' '("-", "+",\n' ' "abs()" and "~").\n' '\n' 'object.__complex__(self)\n' 'object.__int__(self)\n' 'object.__float__(self)\n' '\n' ' Called to implement the built-in functions "complex()", ' '"int()" and\n' ' "float()". Should return a value of the appropriate ' 'type.\n' '\n' 'object.__index__(self)\n' '\n' ' Called to implement "operator.index()", and whenever ' 'Python needs\n' ' to losslessly convert the numeric object to an integer ' 'object (such\n' ' as in slicing, or in the built-in "bin()", "hex()" and ' '"oct()"\n' ' functions). Presence of this method indicates that the ' 'numeric\n' ' object is an integer type. Must return an integer.\n' '\n' ' Note:\n' '\n' ' In order to have a coherent integer type class, when\n' ' "__index__()" is defined "__int__()" should also be ' 'defined, and\n' ' both should return the same value.\n' '\n' 'object.__round__(self[, ndigits])\n' 'object.__trunc__(self)\n' 'object.__floor__(self)\n' 'object.__ceil__(self)\n' '\n' ' Called to implement the built-in function "round()" and ' '"math"\n' ' functions "trunc()", "floor()" and "ceil()". Unless ' '*ndigits* is\n' ' passed to "__round__()" all these methods should return ' 'the value\n' ' of the object truncated to an "Integral" (typically an ' '"int").\n' '\n' ' If "__int__()" is not defined then the built-in function ' '"int()"\n' ' falls back to "__trunc__()".\n', 'objects': 'Objects, values and types\n' '*************************\n' '\n' '*Objects* are Python’s abstraction for data. All data in a ' 'Python\n' 'program is represented by objects or by relations between ' 'objects. (In\n' 'a sense, and in conformance to Von Neumann’s model of a “stored\n' 'program computer,” code is also represented by objects.)\n' '\n' 'Every object has an identity, a type and a value. An object’s\n' '*identity* never changes once it has been created; you may think ' 'of it\n' 'as the object’s address in memory. The ‘"is"’ operator compares ' 'the\n' 'identity of two objects; the "id()" function returns an integer\n' 'representing its identity.\n' '\n' '**CPython implementation detail:** For CPython, "id(x)" is the ' 'memory\n' 'address where "x" is stored.\n' '\n' 'An object’s type determines the operations that the object ' 'supports\n' '(e.g., “does it have a length?”) and also defines the possible ' 'values\n' 'for objects of that type. The "type()" function returns an ' 'object’s\n' 'type (which is an object itself). Like its identity, an ' 'object’s\n' '*type* is also unchangeable. [1]\n' '\n' 'The *value* of some objects can change. Objects whose value can\n' 'change are said to be *mutable*; objects whose value is ' 'unchangeable\n' 'once they are created are called *immutable*. (The value of an\n' 'immutable container object that contains a reference to a ' 'mutable\n' 'object can change when the latter’s value is changed; however ' 'the\n' 'container is still considered immutable, because the collection ' 'of\n' 'objects it contains cannot be changed. So, immutability is not\n' 'strictly the same as having an unchangeable value, it is more ' 'subtle.)\n' 'An object’s mutability is determined by its type; for instance,\n' 'numbers, strings and tuples are immutable, while dictionaries ' 'and\n' 'lists are mutable.\n' '\n' 'Objects are never explicitly destroyed; however, when they ' 'become\n' 'unreachable they may be garbage-collected. An implementation is\n' 'allowed to postpone garbage collection or omit it altogether — it ' 'is a\n' 'matter of implementation quality how garbage collection is\n' 'implemented, as long as no objects are collected that are still\n' 'reachable.\n' '\n' '**CPython implementation detail:** CPython currently uses a ' 'reference-\n' 'counting scheme with (optional) delayed detection of cyclically ' 'linked\n' 'garbage, which collects most objects as soon as they become\n' 'unreachable, but is not guaranteed to collect garbage containing\n' 'circular references. See the documentation of the "gc" module ' 'for\n' 'information on controlling the collection of cyclic garbage. ' 'Other\n' 'implementations act differently and CPython may change. Do not ' 'depend\n' 'on immediate finalization of objects when they become unreachable ' '(so\n' 'you should always close files explicitly).\n' '\n' 'Note that the use of the implementation’s tracing or debugging\n' 'facilities may keep objects alive that would normally be ' 'collectable.\n' 'Also note that catching an exception with a ‘"try"…"except"’ ' 'statement\n' 'may keep objects alive.\n' '\n' 'Some objects contain references to “external” resources such as ' 'open\n' 'files or windows. It is understood that these resources are ' 'freed\n' 'when the object is garbage-collected, but since garbage ' 'collection is\n' 'not guaranteed to happen, such objects also provide an explicit ' 'way to\n' 'release the external resource, usually a "close()" method. ' 'Programs\n' 'are strongly recommended to explicitly close such objects. The\n' '‘"try"…"finally"’ statement and the ‘"with"’ statement provide\n' 'convenient ways to do this.\n' '\n' 'Some objects contain references to other objects; these are ' 'called\n' '*containers*. Examples of containers are tuples, lists and\n' 'dictionaries. The references are part of a container’s value. ' 'In\n' 'most cases, when we talk about the value of a container, we imply ' 'the\n' 'values, not the identities of the contained objects; however, ' 'when we\n' 'talk about the mutability of a container, only the identities of ' 'the\n' 'immediately contained objects are implied. So, if an immutable\n' 'container (like a tuple) contains a reference to a mutable ' 'object, its\n' 'value changes if that mutable object is changed.\n' '\n' 'Types affect almost all aspects of object behavior. Even the\n' 'importance of object identity is affected in some sense: for ' 'immutable\n' 'types, operations that compute new values may actually return a\n' 'reference to any existing object with the same type and value, ' 'while\n' 'for mutable objects this is not allowed. E.g., after "a = 1; b = ' '1",\n' '"a" and "b" may or may not refer to the same object with the ' 'value\n' 'one, depending on the implementation, but after "c = []; d = []", ' '"c"\n' 'and "d" are guaranteed to refer to two different, unique, newly\n' 'created empty lists. (Note that "c = d = []" assigns the same ' 'object\n' 'to both "c" and "d".)\n', 'operator-summary': 'Operator precedence\n' '*******************\n' '\n' 'The following table summarizes the operator precedence ' 'in Python, from\n' 'lowest precedence (least binding) to highest precedence ' '(most\n' 'binding). Operators in the same box have the same ' 'precedence. Unless\n' 'the syntax is explicitly given, operators are binary. ' 'Operators in\n' 'the same box group left to right (except for ' 'exponentiation, which\n' 'groups from right to left).\n' '\n' 'Note that comparisons, membership tests, and identity ' 'tests, all have\n' 'the same precedence and have a left-to-right chaining ' 'feature as\n' 'described in the Comparisons section.\n' '\n' '+-------------------------------------------------+---------------------------------------+\n' '| Operator | ' 'Description |\n' '|=================================================|=======================================|\n' '| "lambda" | ' 'Lambda expression |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "if" – "else" | ' 'Conditional expression |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "or" | ' 'Boolean OR |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "and" | ' 'Boolean AND |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "not" "x" | ' 'Boolean NOT |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "in", "not in", "is", "is not", "<", "<=", ">", | ' 'Comparisons, including membership |\n' '| ">=", "!=", "==" | ' 'tests and identity tests |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "|" | ' 'Bitwise OR |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "^" | ' 'Bitwise XOR |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "&" | ' 'Bitwise AND |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "<<", ">>" | ' 'Shifts |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "+", "-" | ' 'Addition and subtraction |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "*", "@", "/", "//", "%" | ' 'Multiplication, matrix |\n' '| | ' 'multiplication, division, floor |\n' '| | ' 'division, remainder [5] |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "+x", "-x", "~x" | ' 'Positive, negative, bitwise NOT |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "**" | ' 'Exponentiation [6] |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "await" "x" | ' 'Await expression |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "x[index]", "x[index:index]", | ' 'Subscription, slicing, call, |\n' '| "x(arguments...)", "x.attribute" | ' 'attribute reference |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "(expressions...)", "[expressions...]", "{key: | ' 'Binding or tuple display, list |\n' '| value...}", "{expressions...}" | ' 'display, dictionary display, set |\n' '| | ' 'display |\n' '+-------------------------------------------------+---------------------------------------+\n' '\n' '-[ Footnotes ]-\n' '\n' '[1] While "abs(x%y) < abs(y)" is true mathematically, ' 'for floats it\n' ' may not be true numerically due to roundoff. For ' 'example, and\n' ' assuming a platform on which a Python float is an ' 'IEEE 754 double-\n' ' precision number, in order that "-1e-100 % 1e100" ' 'have the same\n' ' sign as "1e100", the computed result is "-1e-100 + ' '1e100", which\n' ' is numerically exactly equal to "1e100". The ' 'function\n' ' "math.fmod()" returns a result whose sign matches ' 'the sign of the\n' ' first argument instead, and so returns "-1e-100" in ' 'this case.\n' ' Which approach is more appropriate depends on the ' 'application.\n' '\n' '[2] If x is very close to an exact integer multiple of ' 'y, it’s\n' ' possible for "x//y" to be one larger than ' '"(x-x%y)//y" due to\n' ' rounding. In such cases, Python returns the latter ' 'result, in\n' ' order to preserve that "divmod(x,y)[0] * y + x % y" ' 'be very close\n' ' to "x".\n' '\n' '[3] The Unicode standard distinguishes between *code ' 'points* (e.g.\n' ' U+0041) and *abstract characters* (e.g. “LATIN ' 'CAPITAL LETTER A”).\n' ' While most abstract characters in Unicode are only ' 'represented\n' ' using one code point, there is a number of abstract ' 'characters\n' ' that can in addition be represented using a sequence ' 'of more than\n' ' one code point. For example, the abstract character ' '“LATIN\n' ' CAPITAL LETTER C WITH CEDILLA” can be represented as ' 'a single\n' ' *precomposed character* at code position U+00C7, or ' 'as a sequence\n' ' of a *base character* at code position U+0043 (LATIN ' 'CAPITAL\n' ' LETTER C), followed by a *combining character* at ' 'code position\n' ' U+0327 (COMBINING CEDILLA).\n' '\n' ' The comparison operators on strings compare at the ' 'level of\n' ' Unicode code points. This may be counter-intuitive ' 'to humans. For\n' ' example, ""\\u00C7" == "\\u0043\\u0327"" is "False", ' 'even though both\n' ' strings represent the same abstract character “LATIN ' 'CAPITAL\n' ' LETTER C WITH CEDILLA”.\n' '\n' ' To compare strings at the level of abstract ' 'characters (that is,\n' ' in a way intuitive to humans), use ' '"unicodedata.normalize()".\n' '\n' '[4] Due to automatic garbage-collection, free lists, and ' 'the dynamic\n' ' nature of descriptors, you may notice seemingly ' 'unusual behaviour\n' ' in certain uses of the "is" operator, like those ' 'involving\n' ' comparisons between instance methods, or constants. ' 'Check their\n' ' documentation for more info.\n' '\n' '[5] The "%" operator is also used for string formatting; ' 'the same\n' ' precedence applies.\n' '\n' '[6] The power operator "**" binds less tightly than an ' 'arithmetic or\n' ' bitwise unary operator on its right, that is, ' '"2**-1" is "0.5".\n', 'pass': 'The "pass" statement\n' '********************\n' '\n' ' pass_stmt ::= "pass"\n' '\n' '"pass" is a null operation — when it is executed, nothing happens. ' 'It\n' 'is useful as a placeholder when a statement is required ' 'syntactically,\n' 'but no code needs to be executed, for example:\n' '\n' ' def f(arg): pass # a function that does nothing (yet)\n' '\n' ' class C: pass # a class with no methods (yet)\n', 'power': 'The power operator\n' '******************\n' '\n' 'The power operator binds more tightly than unary operators on its\n' 'left; it binds less tightly than unary operators on its right. ' 'The\n' 'syntax is:\n' '\n' ' power ::= (await_expr | primary) ["**" u_expr]\n' '\n' 'Thus, in an unparenthesized sequence of power and unary operators, ' 'the\n' 'operators are evaluated from right to left (this does not ' 'constrain\n' 'the evaluation order for the operands): "-1**2" results in "-1".\n' '\n' 'The power operator has the same semantics as the built-in "pow()"\n' 'function, when called with two arguments: it yields its left ' 'argument\n' 'raised to the power of its right argument. The numeric arguments ' 'are\n' 'first converted to a common type, and the result is of that type.\n' '\n' 'For int operands, the result has the same type as the operands ' 'unless\n' 'the second argument is negative; in that case, all arguments are\n' 'converted to float and a float result is delivered. For example,\n' '"10**2" returns "100", but "10**-2" returns "0.01".\n' '\n' 'Raising "0.0" to a negative power results in a ' '"ZeroDivisionError".\n' 'Raising a negative number to a fractional power results in a ' '"complex"\n' 'number. (In earlier versions it raised a "ValueError".)\n', 'raise': 'The "raise" statement\n' '*********************\n' '\n' ' raise_stmt ::= "raise" [expression ["from" expression]]\n' '\n' 'If no expressions are present, "raise" re-raises the last ' 'exception\n' 'that was active in the current scope. If no exception is active ' 'in\n' 'the current scope, a "RuntimeError" exception is raised indicating\n' 'that this is an error.\n' '\n' 'Otherwise, "raise" evaluates the first expression as the exception\n' 'object. It must be either a subclass or an instance of\n' '"BaseException". If it is a class, the exception instance will be\n' 'obtained when needed by instantiating the class with no arguments.\n' '\n' 'The *type* of the exception is the exception instance’s class, the\n' '*value* is the instance itself.\n' '\n' 'A traceback object is normally created automatically when an ' 'exception\n' 'is raised and attached to it as the "__traceback__" attribute, ' 'which\n' 'is writable. You can create an exception and set your own traceback ' 'in\n' 'one step using the "with_traceback()" exception method (which ' 'returns\n' 'the same exception instance, with its traceback set to its ' 'argument),\n' 'like so:\n' '\n' ' raise Exception("foo occurred").with_traceback(tracebackobj)\n' '\n' 'The "from" clause is used for exception chaining: if given, the ' 'second\n' '*expression* must be another exception class or instance, which ' 'will\n' 'then be attached to the raised exception as the "__cause__" ' 'attribute\n' '(which is writable). If the raised exception is not handled, both\n' 'exceptions will be printed:\n' '\n' ' >>> try:\n' ' ... print(1 / 0)\n' ' ... except Exception as exc:\n' ' ... raise RuntimeError("Something bad happened") from exc\n' ' ...\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 2, in <module>\n' ' ZeroDivisionError: division by zero\n' '\n' ' The above exception was the direct cause of the following ' 'exception:\n' '\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 4, in <module>\n' ' RuntimeError: Something bad happened\n' '\n' 'A similar mechanism works implicitly if an exception is raised ' 'inside\n' 'an exception handler or a "finally" clause: the previous exception ' 'is\n' 'then attached as the new exception’s "__context__" attribute:\n' '\n' ' >>> try:\n' ' ... print(1 / 0)\n' ' ... except:\n' ' ... raise RuntimeError("Something bad happened")\n' ' ...\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 2, in <module>\n' ' ZeroDivisionError: division by zero\n' '\n' ' During handling of the above exception, another exception ' 'occurred:\n' '\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 4, in <module>\n' ' RuntimeError: Something bad happened\n' '\n' 'Exception chaining can be explicitly suppressed by specifying ' '"None"\n' 'in the "from" clause:\n' '\n' ' >>> try:\n' ' ... print(1 / 0)\n' ' ... except:\n' ' ... raise RuntimeError("Something bad happened") from None\n' ' ...\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 4, in <module>\n' ' RuntimeError: Something bad happened\n' '\n' 'Additional information on exceptions can be found in section\n' 'Exceptions, and information about handling exceptions is in ' 'section\n' 'The try statement.\n' '\n' 'Changed in version 3.3: "None" is now permitted as "Y" in "raise X\n' 'from Y".\n' '\n' 'New in version 3.3: The "__suppress_context__" attribute to ' 'suppress\n' 'automatic display of the exception context.\n', 'return': 'The "return" statement\n' '**********************\n' '\n' ' return_stmt ::= "return" [expression_list]\n' '\n' '"return" may only occur syntactically nested in a function ' 'definition,\n' 'not within a nested class definition.\n' '\n' 'If an expression list is present, it is evaluated, else "None" is\n' 'substituted.\n' '\n' '"return" leaves the current function call with the expression list ' '(or\n' '"None") as return value.\n' '\n' 'When "return" passes control out of a "try" statement with a ' '"finally"\n' 'clause, that "finally" clause is executed before really leaving ' 'the\n' 'function.\n' '\n' 'In a generator function, the "return" statement indicates that ' 'the\n' 'generator is done and will cause "StopIteration" to be raised. ' 'The\n' 'returned value (if any) is used as an argument to construct\n' '"StopIteration" and becomes the "StopIteration.value" attribute.\n' '\n' 'In an asynchronous generator function, an empty "return" ' 'statement\n' 'indicates that the asynchronous generator is done and will cause\n' '"StopAsyncIteration" to be raised. A non-empty "return" statement ' 'is\n' 'a syntax error in an asynchronous generator function.\n', 'sequence-types': 'Emulating container types\n' '*************************\n' '\n' 'The following methods can be defined to implement ' 'container objects.\n' 'Containers usually are sequences (such as lists or tuples) ' 'or mappings\n' '(like dictionaries), but can represent other containers as ' 'well. The\n' 'first set of methods is used either to emulate a sequence ' 'or to\n' 'emulate a mapping; the difference is that for a sequence, ' 'the\n' 'allowable keys should be the integers *k* for which "0 <= ' 'k < N" where\n' '*N* is the length of the sequence, or slice objects, which ' 'define a\n' 'range of items. It is also recommended that mappings ' 'provide the\n' 'methods "keys()", "values()", "items()", "get()", ' '"clear()",\n' '"setdefault()", "pop()", "popitem()", "copy()", and ' '"update()"\n' 'behaving similar to those for Python’s standard dictionary ' 'objects.\n' 'The "collections" module provides a "MutableMapping" ' 'abstract base\n' 'class to help create those methods from a base set of ' '"__getitem__()",\n' '"__setitem__()", "__delitem__()", and "keys()". Mutable ' 'sequences\n' 'should provide methods "append()", "count()", "index()", ' '"extend()",\n' '"insert()", "pop()", "remove()", "reverse()" and "sort()", ' 'like Python\n' 'standard list objects. Finally, sequence types should ' 'implement\n' 'addition (meaning concatenation) and multiplication ' '(meaning\n' 'repetition) by defining the methods "__add__()", ' '"__radd__()",\n' '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" ' 'described\n' 'below; they should not define other numerical operators. ' 'It is\n' 'recommended that both mappings and sequences implement ' 'the\n' '"__contains__()" method to allow efficient use of the "in" ' 'operator;\n' 'for mappings, "in" should search the mapping’s keys; for ' 'sequences, it\n' 'should search through the values. It is further ' 'recommended that both\n' 'mappings and sequences implement the "__iter__()" method ' 'to allow\n' 'efficient iteration through the container; for mappings, ' '"__iter__()"\n' 'should be the same as "keys()"; for sequences, it should ' 'iterate\n' 'through the values.\n' '\n' 'object.__len__(self)\n' '\n' ' Called to implement the built-in function "len()". ' 'Should return\n' ' the length of the object, an integer ">=" 0. Also, an ' 'object that\n' ' doesn’t define a "__bool__()" method and whose ' '"__len__()" method\n' ' returns zero is considered to be false in a Boolean ' 'context.\n' '\n' ' **CPython implementation detail:** In CPython, the ' 'length is\n' ' required to be at most "sys.maxsize". If the length is ' 'larger than\n' ' "sys.maxsize" some features (such as "len()") may ' 'raise\n' ' "OverflowError". To prevent raising "OverflowError" by ' 'truth value\n' ' testing, an object must define a "__bool__()" method.\n' '\n' 'object.__length_hint__(self)\n' '\n' ' Called to implement "operator.length_hint()". Should ' 'return an\n' ' estimated length for the object (which may be greater ' 'or less than\n' ' the actual length). The length must be an integer ">=" ' '0. This\n' ' method is purely an optimization and is never required ' 'for\n' ' correctness.\n' '\n' ' New in version 3.4.\n' '\n' 'Note:\n' '\n' ' Slicing is done exclusively with the following three ' 'methods. A\n' ' call like\n' '\n' ' a[1:2] = b\n' '\n' ' is translated to\n' '\n' ' a[slice(1, 2, None)] = b\n' '\n' ' and so forth. Missing slice items are always filled in ' 'with "None".\n' '\n' 'object.__getitem__(self, key)\n' '\n' ' Called to implement evaluation of "self[key]". For ' 'sequence types,\n' ' the accepted keys should be integers and slice ' 'objects. Note that\n' ' the special interpretation of negative indexes (if the ' 'class wishes\n' ' to emulate a sequence type) is up to the ' '"__getitem__()" method. If\n' ' *key* is of an inappropriate type, "TypeError" may be ' 'raised; if of\n' ' a value outside the set of indexes for the sequence ' '(after any\n' ' special interpretation of negative values), ' '"IndexError" should be\n' ' raised. For mapping types, if *key* is missing (not in ' 'the\n' ' container), "KeyError" should be raised.\n' '\n' ' Note:\n' '\n' ' "for" loops expect that an "IndexError" will be ' 'raised for\n' ' illegal indexes to allow proper detection of the end ' 'of the\n' ' sequence.\n' '\n' 'object.__setitem__(self, key, value)\n' '\n' ' Called to implement assignment to "self[key]". Same ' 'note as for\n' ' "__getitem__()". This should only be implemented for ' 'mappings if\n' ' the objects support changes to the values for keys, or ' 'if new keys\n' ' can be added, or for sequences if elements can be ' 'replaced. The\n' ' same exceptions should be raised for improper *key* ' 'values as for\n' ' the "__getitem__()" method.\n' '\n' 'object.__delitem__(self, key)\n' '\n' ' Called to implement deletion of "self[key]". Same note ' 'as for\n' ' "__getitem__()". This should only be implemented for ' 'mappings if\n' ' the objects support removal of keys, or for sequences ' 'if elements\n' ' can be removed from the sequence. The same exceptions ' 'should be\n' ' raised for improper *key* values as for the ' '"__getitem__()" method.\n' '\n' 'object.__missing__(self, key)\n' '\n' ' Called by "dict"."__getitem__()" to implement ' '"self[key]" for dict\n' ' subclasses when key is not in the dictionary.\n' '\n' 'object.__iter__(self)\n' '\n' ' This method is called when an iterator is required for ' 'a container.\n' ' This method should return a new iterator object that ' 'can iterate\n' ' over all the objects in the container. For mappings, ' 'it should\n' ' iterate over the keys of the container.\n' '\n' ' Iterator objects also need to implement this method; ' 'they are\n' ' required to return themselves. For more information on ' 'iterator\n' ' objects, see Iterator Types.\n' '\n' 'object.__reversed__(self)\n' '\n' ' Called (if present) by the "reversed()" built-in to ' 'implement\n' ' reverse iteration. It should return a new iterator ' 'object that\n' ' iterates over all the objects in the container in ' 'reverse order.\n' '\n' ' If the "__reversed__()" method is not provided, the ' '"reversed()"\n' ' built-in will fall back to using the sequence protocol ' '("__len__()"\n' ' and "__getitem__()"). Objects that support the ' 'sequence protocol\n' ' should only provide "__reversed__()" if they can ' 'provide an\n' ' implementation that is more efficient than the one ' 'provided by\n' ' "reversed()".\n' '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' 'implemented as an iteration through a sequence. However, ' 'container\n' 'objects can supply the following special method with a ' 'more efficient\n' 'implementation, which also does not require the object be ' 'a sequence.\n' '\n' 'object.__contains__(self, item)\n' '\n' ' Called to implement membership test operators. Should ' 'return true\n' ' if *item* is in *self*, false otherwise. For mapping ' 'objects, this\n' ' should consider the keys of the mapping rather than the ' 'values or\n' ' the key-item pairs.\n' '\n' ' For objects that don’t define "__contains__()", the ' 'membership test\n' ' first tries iteration via "__iter__()", then the old ' 'sequence\n' ' iteration protocol via "__getitem__()", see this ' 'section in the\n' ' language reference.\n', 'shifting': 'Shifting operations\n' '*******************\n' '\n' 'The shifting operations have lower priority than the arithmetic\n' 'operations:\n' '\n' ' shift_expr ::= a_expr | shift_expr ("<<" | ">>") a_expr\n' '\n' 'These operators accept integers as arguments. They shift the ' 'first\n' 'argument to the left or right by the number of bits given by ' 'the\n' 'second argument.\n' '\n' 'A right shift by *n* bits is defined as floor division by ' '"pow(2,n)".\n' 'A left shift by *n* bits is defined as multiplication with ' '"pow(2,n)".\n' '\n' 'Note:\n' '\n' ' In the current implementation, the right-hand operand is ' 'required to\n' ' be at most "sys.maxsize". If the right-hand operand is larger ' 'than\n' ' "sys.maxsize" an "OverflowError" exception is raised.\n', 'slicings': 'Slicings\n' '********\n' '\n' 'A slicing selects a range of items in a sequence object (e.g., ' 'a\n' 'string, tuple or list). Slicings may be used as expressions or ' 'as\n' 'targets in assignment or "del" statements. The syntax for a ' 'slicing:\n' '\n' ' slicing ::= primary "[" slice_list "]"\n' ' slice_list ::= slice_item ("," slice_item)* [","]\n' ' slice_item ::= expression | proper_slice\n' ' proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" ' '[stride] ]\n' ' lower_bound ::= expression\n' ' upper_bound ::= expression\n' ' stride ::= expression\n' '\n' 'There is ambiguity in the formal syntax here: anything that ' 'looks like\n' 'an expression list also looks like a slice list, so any ' 'subscription\n' 'can be interpreted as a slicing. Rather than further ' 'complicating the\n' 'syntax, this is disambiguated by defining that in this case the\n' 'interpretation as a subscription takes priority over the\n' 'interpretation as a slicing (this is the case if the slice list\n' 'contains no proper slice).\n' '\n' 'The semantics for a slicing are as follows. The primary is ' 'indexed\n' '(using the same "__getitem__()" method as normal subscription) ' 'with a\n' 'key that is constructed from the slice list, as follows. If the ' 'slice\n' 'list contains at least one comma, the key is a tuple containing ' 'the\n' 'conversion of the slice items; otherwise, the conversion of the ' 'lone\n' 'slice item is the key. The conversion of a slice item that is ' 'an\n' 'expression is that expression. The conversion of a proper slice ' 'is a\n' 'slice object (see section The standard type hierarchy) whose ' '"start",\n' '"stop" and "step" attributes are the values of the expressions ' 'given\n' 'as lower bound, upper bound and stride, respectively, ' 'substituting\n' '"None" for missing expressions.\n', 'specialattrs': 'Special Attributes\n' '******************\n' '\n' 'The implementation adds a few special read-only attributes ' 'to several\n' 'object types, where they are relevant. Some of these are ' 'not reported\n' 'by the "dir()" built-in function.\n' '\n' 'object.__dict__\n' '\n' ' A dictionary or other mapping object used to store an ' 'object’s\n' ' (writable) attributes.\n' '\n' 'instance.__class__\n' '\n' ' The class to which a class instance belongs.\n' '\n' 'class.__bases__\n' '\n' ' The tuple of base classes of a class object.\n' '\n' 'definition.__name__\n' '\n' ' The name of the class, function, method, descriptor, or ' 'generator\n' ' instance.\n' '\n' 'definition.__qualname__\n' '\n' ' The *qualified name* of the class, function, method, ' 'descriptor, or\n' ' generator instance.\n' '\n' ' New in version 3.3.\n' '\n' 'class.__mro__\n' '\n' ' This attribute is a tuple of classes that are considered ' 'when\n' ' looking for base classes during method resolution.\n' '\n' 'class.mro()\n' '\n' ' This method can be overridden by a metaclass to customize ' 'the\n' ' method resolution order for its instances. It is called ' 'at class\n' ' instantiation, and its result is stored in "__mro__".\n' '\n' 'class.__subclasses__()\n' '\n' ' Each class keeps a list of weak references to its ' 'immediate\n' ' subclasses. This method returns a list of all those ' 'references\n' ' still alive. Example:\n' '\n' ' >>> int.__subclasses__()\n' " [<class 'bool'>]\n" '\n' '-[ Footnotes ]-\n' '\n' '[1] Additional information on these special methods may be ' 'found in\n' ' the Python Reference Manual (Basic customization).\n' '\n' '[2] As a consequence, the list "[1, 2]" is considered equal ' 'to "[1.0,\n' ' 2.0]", and similarly for tuples.\n' '\n' '[3] They must have since the parser can’t tell the type of ' 'the\n' ' operands.\n' '\n' '[4] Cased characters are those with general category ' 'property being\n' ' one of “Lu” (Letter, uppercase), “Ll” (Letter, ' 'lowercase), or “Lt”\n' ' (Letter, titlecase).\n' '\n' '[5] To format only a tuple you should therefore provide a ' 'singleton\n' ' tuple whose only element is the tuple to be formatted.\n', 'specialnames': 'Special method names\n' '********************\n' '\n' 'A class can implement certain operations that are invoked by ' 'special\n' 'syntax (such as arithmetic operations or subscripting and ' 'slicing) by\n' 'defining methods with special names. This is Python’s ' 'approach to\n' '*operator overloading*, allowing classes to define their own ' 'behavior\n' 'with respect to language operators. For instance, if a ' 'class defines\n' 'a method named "__getitem__()", and "x" is an instance of ' 'this class,\n' 'then "x[i]" is roughly equivalent to "type(x).__getitem__(x, ' 'i)".\n' 'Except where mentioned, attempts to execute an operation ' 'raise an\n' 'exception when no appropriate method is defined (typically\n' '"AttributeError" or "TypeError").\n' '\n' 'Setting a special method to "None" indicates that the ' 'corresponding\n' 'operation is not available. For example, if a class sets ' '"__iter__()"\n' 'to "None", the class is not iterable, so calling "iter()" on ' 'its\n' 'instances will raise a "TypeError" (without falling back to\n' '"__getitem__()"). [2]\n' '\n' 'When implementing a class that emulates any built-in type, ' 'it is\n' 'important that the emulation only be implemented to the ' 'degree that it\n' 'makes sense for the object being modelled. For example, ' 'some\n' 'sequences may work well with retrieval of individual ' 'elements, but\n' 'extracting a slice may not make sense. (One example of this ' 'is the\n' '"NodeList" interface in the W3C’s Document Object Model.)\n' '\n' '\n' 'Basic customization\n' '===================\n' '\n' 'object.__new__(cls[, ...])\n' '\n' ' Called to create a new instance of class *cls*. ' '"__new__()" is a\n' ' static method (special-cased so you need not declare it ' 'as such)\n' ' that takes the class of which an instance was requested ' 'as its\n' ' first argument. The remaining arguments are those passed ' 'to the\n' ' object constructor expression (the call to the class). ' 'The return\n' ' value of "__new__()" should be the new object instance ' '(usually an\n' ' instance of *cls*).\n' '\n' ' Typical implementations create a new instance of the ' 'class by\n' ' invoking the superclass’s "__new__()" method using\n' ' "super().__new__(cls[, ...])" with appropriate arguments ' 'and then\n' ' modifying the newly-created instance as necessary before ' 'returning\n' ' it.\n' '\n' ' If "__new__()" returns an instance of *cls*, then the ' 'new\n' ' instance’s "__init__()" method will be invoked like\n' ' "__init__(self[, ...])", where *self* is the new instance ' 'and the\n' ' remaining arguments are the same as were passed to ' '"__new__()".\n' '\n' ' If "__new__()" does not return an instance of *cls*, then ' 'the new\n' ' instance’s "__init__()" method will not be invoked.\n' '\n' ' "__new__()" is intended mainly to allow subclasses of ' 'immutable\n' ' types (like int, str, or tuple) to customize instance ' 'creation. It\n' ' is also commonly overridden in custom metaclasses in ' 'order to\n' ' customize class creation.\n' '\n' 'object.__init__(self[, ...])\n' '\n' ' Called after the instance has been created (by ' '"__new__()"), but\n' ' before it is returned to the caller. The arguments are ' 'those\n' ' passed to the class constructor expression. If a base ' 'class has an\n' ' "__init__()" method, the derived class’s "__init__()" ' 'method, if\n' ' any, must explicitly call it to ensure proper ' 'initialization of the\n' ' base class part of the instance; for example:\n' ' "super().__init__([args...])".\n' '\n' ' Because "__new__()" and "__init__()" work together in ' 'constructing\n' ' objects ("__new__()" to create it, and "__init__()" to ' 'customize\n' ' it), no non-"None" value may be returned by "__init__()"; ' 'doing so\n' ' will cause a "TypeError" to be raised at runtime.\n' '\n' 'object.__del__(self)\n' '\n' ' Called when the instance is about to be destroyed. This ' 'is also\n' ' called a finalizer or (improperly) a destructor. If a ' 'base class\n' ' has a "__del__()" method, the derived class’s "__del__()" ' 'method,\n' ' if any, must explicitly call it to ensure proper deletion ' 'of the\n' ' base class part of the instance.\n' '\n' ' It is possible (though not recommended!) for the ' '"__del__()" method\n' ' to postpone destruction of the instance by creating a new ' 'reference\n' ' to it. This is called object *resurrection*. It is\n' ' implementation-dependent whether "__del__()" is called a ' 'second\n' ' time when a resurrected object is about to be destroyed; ' 'the\n' ' current *CPython* implementation only calls it once.\n' '\n' ' It is not guaranteed that "__del__()" methods are called ' 'for\n' ' objects that still exist when the interpreter exits.\n' '\n' ' Note:\n' '\n' ' "del x" doesn’t directly call "x.__del__()" — the ' 'former\n' ' decrements the reference count for "x" by one, and the ' 'latter is\n' ' only called when "x"’s reference count reaches zero.\n' '\n' ' **CPython implementation detail:** It is possible for a ' 'reference\n' ' cycle to prevent the reference count of an object from ' 'going to\n' ' zero. In this case, the cycle will be later detected and ' 'deleted\n' ' by the *cyclic garbage collector*. A common cause of ' 'reference\n' ' cycles is when an exception has been caught in a local ' 'variable.\n' ' The frame’s locals then reference the exception, which ' 'references\n' ' its own traceback, which references the locals of all ' 'frames caught\n' ' in the traceback.\n' '\n' ' See also: Documentation for the "gc" module.\n' '\n' ' Warning:\n' '\n' ' Due to the precarious circumstances under which ' '"__del__()"\n' ' methods are invoked, exceptions that occur during their ' 'execution\n' ' are ignored, and a warning is printed to "sys.stderr" ' 'instead.\n' ' In particular:\n' '\n' ' * "__del__()" can be invoked when arbitrary code is ' 'being\n' ' executed, including from any arbitrary thread. If ' '"__del__()"\n' ' needs to take a lock or invoke any other blocking ' 'resource, it\n' ' may deadlock as the resource may already be taken by ' 'the code\n' ' that gets interrupted to execute "__del__()".\n' '\n' ' * "__del__()" can be executed during interpreter ' 'shutdown. As a\n' ' consequence, the global variables it needs to access ' '(including\n' ' other modules) may already have been deleted or set ' 'to "None".\n' ' Python guarantees that globals whose name begins with ' 'a single\n' ' underscore are deleted from their module before other ' 'globals\n' ' are deleted; if no other references to such globals ' 'exist, this\n' ' may help in assuring that imported modules are still ' 'available\n' ' at the time when the "__del__()" method is called.\n' '\n' 'object.__repr__(self)\n' '\n' ' Called by the "repr()" built-in function to compute the ' '“official”\n' ' string representation of an object. If at all possible, ' 'this\n' ' should look like a valid Python expression that could be ' 'used to\n' ' recreate an object with the same value (given an ' 'appropriate\n' ' environment). If this is not possible, a string of the ' 'form\n' ' "<...some useful description...>" should be returned. The ' 'return\n' ' value must be a string object. If a class defines ' '"__repr__()" but\n' ' not "__str__()", then "__repr__()" is also used when an ' '“informal”\n' ' string representation of instances of that class is ' 'required.\n' '\n' ' This is typically used for debugging, so it is important ' 'that the\n' ' representation is information-rich and unambiguous.\n' '\n' 'object.__str__(self)\n' '\n' ' Called by "str(object)" and the built-in functions ' '"format()" and\n' ' "print()" to compute the “informal” or nicely printable ' 'string\n' ' representation of an object. The return value must be a ' 'string\n' ' object.\n' '\n' ' This method differs from "object.__repr__()" in that ' 'there is no\n' ' expectation that "__str__()" return a valid Python ' 'expression: a\n' ' more convenient or concise representation can be used.\n' '\n' ' The default implementation defined by the built-in type ' '"object"\n' ' calls "object.__repr__()".\n' '\n' 'object.__bytes__(self)\n' '\n' ' Called by bytes to compute a byte-string representation ' 'of an\n' ' object. This should return a "bytes" object.\n' '\n' 'object.__format__(self, format_spec)\n' '\n' ' Called by the "format()" built-in function, and by ' 'extension,\n' ' evaluation of formatted string literals and the ' '"str.format()"\n' ' method, to produce a “formatted” string representation of ' 'an\n' ' object. The "format_spec" argument is a string that ' 'contains a\n' ' description of the formatting options desired. The ' 'interpretation\n' ' of the "format_spec" argument is up to the type ' 'implementing\n' ' "__format__()", however most classes will either ' 'delegate\n' ' formatting to one of the built-in types, or use a ' 'similar\n' ' formatting option syntax.\n' '\n' ' See Format Specification Mini-Language for a description ' 'of the\n' ' standard formatting syntax.\n' '\n' ' The return value must be a string object.\n' '\n' ' Changed in version 3.4: The __format__ method of "object" ' 'itself\n' ' raises a "TypeError" if passed any non-empty string.\n' '\n' 'object.__lt__(self, other)\n' 'object.__le__(self, other)\n' 'object.__eq__(self, other)\n' 'object.__ne__(self, other)\n' 'object.__gt__(self, other)\n' 'object.__ge__(self, other)\n' '\n' ' These are the so-called “rich comparison” methods. The\n' ' correspondence between operator symbols and method names ' 'is as\n' ' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls ' '"x.__le__(y)",\n' ' "x==y" calls "x.__eq__(y)", "x!=y" calls "x.__ne__(y)", ' '"x>y" calls\n' ' "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n' '\n' ' A rich comparison method may return the singleton ' '"NotImplemented"\n' ' if it does not implement the operation for a given pair ' 'of\n' ' arguments. By convention, "False" and "True" are returned ' 'for a\n' ' successful comparison. However, these methods can return ' 'any value,\n' ' so if the comparison operator is used in a Boolean ' 'context (e.g.,\n' ' in the condition of an "if" statement), Python will call ' '"bool()"\n' ' on the value to determine if the result is true or ' 'false.\n' '\n' ' By default, "__ne__()" delegates to "__eq__()" and ' 'inverts the\n' ' result unless it is "NotImplemented". There are no other ' 'implied\n' ' relationships among the comparison operators, for ' 'example, the\n' ' truth of "(x<y or x==y)" does not imply "x<=y". To ' 'automatically\n' ' generate ordering operations from a single root ' 'operation, see\n' ' "functools.total_ordering()".\n' '\n' ' See the paragraph on "__hash__()" for some important ' 'notes on\n' ' creating *hashable* objects which support custom ' 'comparison\n' ' operations and are usable as dictionary keys.\n' '\n' ' There are no swapped-argument versions of these methods ' '(to be used\n' ' when the left argument does not support the operation but ' 'the right\n' ' argument does); rather, "__lt__()" and "__gt__()" are ' 'each other’s\n' ' reflection, "__le__()" and "__ge__()" are each other’s ' 'reflection,\n' ' and "__eq__()" and "__ne__()" are their own reflection. ' 'If the\n' ' operands are of different types, and right operand’s type ' 'is a\n' ' direct or indirect subclass of the left operand’s type, ' 'the\n' ' reflected method of the right operand has priority, ' 'otherwise the\n' ' left operand’s method has priority. Virtual subclassing ' 'is not\n' ' considered.\n' '\n' 'object.__hash__(self)\n' '\n' ' Called by built-in function "hash()" and for operations ' 'on members\n' ' of hashed collections including "set", "frozenset", and ' '"dict".\n' ' "__hash__()" should return an integer. The only required ' 'property\n' ' is that objects which compare equal have the same hash ' 'value; it is\n' ' advised to mix together the hash values of the components ' 'of the\n' ' object that also play a part in comparison of objects by ' 'packing\n' ' them into a tuple and hashing the tuple. Example:\n' '\n' ' def __hash__(self):\n' ' return hash((self.name, self.nick, self.color))\n' '\n' ' Note:\n' '\n' ' "hash()" truncates the value returned from an object’s ' 'custom\n' ' "__hash__()" method to the size of a "Py_ssize_t". ' 'This is\n' ' typically 8 bytes on 64-bit builds and 4 bytes on ' '32-bit builds.\n' ' If an object’s "__hash__()" must interoperate on ' 'builds of\n' ' different bit sizes, be sure to check the width on all ' 'supported\n' ' builds. An easy way to do this is with "python -c ' '"import sys;\n' ' print(sys.hash_info.width)"".\n' '\n' ' If a class does not define an "__eq__()" method it should ' 'not\n' ' define a "__hash__()" operation either; if it defines ' '"__eq__()"\n' ' but not "__hash__()", its instances will not be usable as ' 'items in\n' ' hashable collections. If a class defines mutable objects ' 'and\n' ' implements an "__eq__()" method, it should not implement\n' ' "__hash__()", since the implementation of hashable ' 'collections\n' ' requires that a key’s hash value is immutable (if the ' 'object’s hash\n' ' value changes, it will be in the wrong hash bucket).\n' '\n' ' User-defined classes have "__eq__()" and "__hash__()" ' 'methods by\n' ' default; with them, all objects compare unequal (except ' 'with\n' ' themselves) and "x.__hash__()" returns an appropriate ' 'value such\n' ' that "x == y" implies both that "x is y" and "hash(x) == ' 'hash(y)".\n' '\n' ' A class that overrides "__eq__()" and does not define ' '"__hash__()"\n' ' will have its "__hash__()" implicitly set to "None". ' 'When the\n' ' "__hash__()" method of a class is "None", instances of ' 'the class\n' ' will raise an appropriate "TypeError" when a program ' 'attempts to\n' ' retrieve their hash value, and will also be correctly ' 'identified as\n' ' unhashable when checking "isinstance(obj, ' 'collections.Hashable)".\n' '\n' ' If a class that overrides "__eq__()" needs to retain the\n' ' implementation of "__hash__()" from a parent class, the ' 'interpreter\n' ' must be told this explicitly by setting "__hash__ =\n' ' <ParentClass>.__hash__".\n' '\n' ' If a class that does not override "__eq__()" wishes to ' 'suppress\n' ' hash support, it should include "__hash__ = None" in the ' 'class\n' ' definition. A class which defines its own "__hash__()" ' 'that\n' ' explicitly raises a "TypeError" would be incorrectly ' 'identified as\n' ' hashable by an "isinstance(obj, collections.Hashable)" ' 'call.\n' '\n' ' Note:\n' '\n' ' By default, the "__hash__()" values of str, bytes and ' 'datetime\n' ' objects are “salted” with an unpredictable random ' 'value.\n' ' Although they remain constant within an individual ' 'Python\n' ' process, they are not predictable between repeated ' 'invocations of\n' ' Python.This is intended to provide protection against a ' 'denial-\n' ' of-service caused by carefully-chosen inputs that ' 'exploit the\n' ' worst case performance of a dict insertion, O(n^2) ' 'complexity.\n' ' See http://www.ocert.org/advisories/ocert-2011-003.html ' 'for\n' ' details.Changing hash values affects the iteration ' 'order of\n' ' dicts, sets and other mappings. Python has never made ' 'guarantees\n' ' about this ordering (and it typically varies between ' '32-bit and\n' ' 64-bit builds).See also "PYTHONHASHSEED".\n' '\n' ' Changed in version 3.3: Hash randomization is enabled by ' 'default.\n' '\n' 'object.__bool__(self)\n' '\n' ' Called to implement truth value testing and the built-in ' 'operation\n' ' "bool()"; should return "False" or "True". When this ' 'method is not\n' ' defined, "__len__()" is called, if it is defined, and the ' 'object is\n' ' considered true if its result is nonzero. If a class ' 'defines\n' ' neither "__len__()" nor "__bool__()", all its instances ' 'are\n' ' considered true.\n' '\n' '\n' 'Customizing attribute access\n' '============================\n' '\n' 'The following methods can be defined to customize the ' 'meaning of\n' 'attribute access (use of, assignment to, or deletion of ' '"x.name") for\n' 'class instances.\n' '\n' 'object.__getattr__(self, name)\n' '\n' ' Called when the default attribute access fails with an\n' ' "AttributeError" (either "__getattribute__()" raises an\n' ' "AttributeError" because *name* is not an instance ' 'attribute or an\n' ' attribute in the class tree for "self"; or "__get__()" of ' 'a *name*\n' ' property raises "AttributeError"). This method should ' 'either\n' ' return the (computed) attribute value or raise an ' '"AttributeError"\n' ' exception.\n' '\n' ' Note that if the attribute is found through the normal ' 'mechanism,\n' ' "__getattr__()" is not called. (This is an intentional ' 'asymmetry\n' ' between "__getattr__()" and "__setattr__()".) This is ' 'done both for\n' ' efficiency reasons and because otherwise "__getattr__()" ' 'would have\n' ' no way to access other attributes of the instance. Note ' 'that at\n' ' least for instance variables, you can fake total control ' 'by not\n' ' inserting any values in the instance attribute dictionary ' '(but\n' ' instead inserting them in another object). See the\n' ' "__getattribute__()" method below for a way to actually ' 'get total\n' ' control over attribute access.\n' '\n' 'object.__getattribute__(self, name)\n' '\n' ' Called unconditionally to implement attribute accesses ' 'for\n' ' instances of the class. If the class also defines ' '"__getattr__()",\n' ' the latter will not be called unless "__getattribute__()" ' 'either\n' ' calls it explicitly or raises an "AttributeError". This ' 'method\n' ' should return the (computed) attribute value or raise an\n' ' "AttributeError" exception. In order to avoid infinite ' 'recursion in\n' ' this method, its implementation should always call the ' 'base class\n' ' method with the same name to access any attributes it ' 'needs, for\n' ' example, "object.__getattribute__(self, name)".\n' '\n' ' Note:\n' '\n' ' This method may still be bypassed when looking up ' 'special methods\n' ' as the result of implicit invocation via language ' 'syntax or\n' ' built-in functions. See Special method lookup.\n' '\n' 'object.__setattr__(self, name, value)\n' '\n' ' Called when an attribute assignment is attempted. This ' 'is called\n' ' instead of the normal mechanism (i.e. store the value in ' 'the\n' ' instance dictionary). *name* is the attribute name, ' '*value* is the\n' ' value to be assigned to it.\n' '\n' ' If "__setattr__()" wants to assign to an instance ' 'attribute, it\n' ' should call the base class method with the same name, for ' 'example,\n' ' "object.__setattr__(self, name, value)".\n' '\n' 'object.__delattr__(self, name)\n' '\n' ' Like "__setattr__()" but for attribute deletion instead ' 'of\n' ' assignment. This should only be implemented if "del ' 'obj.name" is\n' ' meaningful for the object.\n' '\n' 'object.__dir__(self)\n' '\n' ' Called when "dir()" is called on the object. A sequence ' 'must be\n' ' returned. "dir()" converts the returned sequence to a ' 'list and\n' ' sorts it.\n' '\n' '\n' 'Customizing module attribute access\n' '-----------------------------------\n' '\n' 'For a more fine grained customization of the module behavior ' '(setting\n' 'attributes, properties, etc.), one can set the "__class__" ' 'attribute\n' 'of a module object to a subclass of "types.ModuleType". For ' 'example:\n' '\n' ' import sys\n' ' from types import ModuleType\n' '\n' ' class VerboseModule(ModuleType):\n' ' def __repr__(self):\n' " return f'Verbose {self.__name__}'\n" '\n' ' def __setattr__(self, attr, value):\n' " print(f'Setting {attr}...')\n" ' setattr(self, attr, value)\n' '\n' ' sys.modules[__name__].__class__ = VerboseModule\n' '\n' 'Note:\n' '\n' ' Setting module "__class__" only affects lookups made using ' 'the\n' ' attribute access syntax – directly accessing the module ' 'globals\n' ' (whether by code within the module, or via a reference to ' 'the\n' ' module’s globals dictionary) is unaffected.\n' '\n' 'Changed in version 3.5: "__class__" module attribute is now ' 'writable.\n' '\n' '\n' 'Implementing Descriptors\n' '------------------------\n' '\n' 'The following methods only apply when an instance of the ' 'class\n' 'containing the method (a so-called *descriptor* class) ' 'appears in an\n' '*owner* class (the descriptor must be in either the owner’s ' 'class\n' 'dictionary or in the class dictionary for one of its ' 'parents). In the\n' 'examples below, “the attribute” refers to the attribute ' 'whose name is\n' 'the key of the property in the owner class’ "__dict__".\n' '\n' 'object.__get__(self, instance, owner)\n' '\n' ' Called to get the attribute of the owner class (class ' 'attribute\n' ' access) or of an instance of that class (instance ' 'attribute\n' ' access). *owner* is always the owner class, while ' '*instance* is the\n' ' instance that the attribute was accessed through, or ' '"None" when\n' ' the attribute is accessed through the *owner*. This ' 'method should\n' ' return the (computed) attribute value or raise an ' '"AttributeError"\n' ' exception.\n' '\n' 'object.__set__(self, instance, value)\n' '\n' ' Called to set the attribute on an instance *instance* of ' 'the owner\n' ' class to a new value, *value*.\n' '\n' 'object.__delete__(self, instance)\n' '\n' ' Called to delete the attribute on an instance *instance* ' 'of the\n' ' owner class.\n' '\n' 'object.__set_name__(self, owner, name)\n' '\n' ' Called at the time the owning class *owner* is created. ' 'The\n' ' descriptor has been assigned to *name*.\n' '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the "inspect" ' 'module as\n' 'specifying the class where this object was defined (setting ' 'this\n' 'appropriately can assist in runtime introspection of dynamic ' 'class\n' 'attributes). For callables, it may indicate that an instance ' 'of the\n' 'given type (or a subclass) is expected or required as the ' 'first\n' 'positional argument (for example, CPython sets this ' 'attribute for\n' 'unbound methods that are implemented in C).\n' '\n' '\n' 'Invoking Descriptors\n' '--------------------\n' '\n' 'In general, a descriptor is an object attribute with ' '“binding\n' 'behavior”, one whose attribute access has been overridden by ' 'methods\n' 'in the descriptor protocol: "__get__()", "__set__()", and\n' '"__delete__()". If any of those methods are defined for an ' 'object, it\n' 'is said to be a descriptor.\n' '\n' 'The default behavior for attribute access is to get, set, or ' 'delete\n' 'the attribute from an object’s dictionary. For instance, ' '"a.x" has a\n' 'lookup chain starting with "a.__dict__[\'x\']", then\n' '"type(a).__dict__[\'x\']", and continuing through the base ' 'classes of\n' '"type(a)" excluding metaclasses.\n' '\n' 'However, if the looked-up value is an object defining one of ' 'the\n' 'descriptor methods, then Python may override the default ' 'behavior and\n' 'invoke the descriptor method instead. Where this occurs in ' 'the\n' 'precedence chain depends on which descriptor methods were ' 'defined and\n' 'how they were called.\n' '\n' 'The starting point for descriptor invocation is a binding, ' '"a.x". How\n' 'the arguments are assembled depends on "a":\n' '\n' 'Direct Call\n' ' The simplest and least common call is when user code ' 'directly\n' ' invokes a descriptor method: "x.__get__(a)".\n' '\n' 'Instance Binding\n' ' If binding to an object instance, "a.x" is transformed ' 'into the\n' ' call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n' '\n' 'Class Binding\n' ' If binding to a class, "A.x" is transformed into the ' 'call:\n' ' "A.__dict__[\'x\'].__get__(None, A)".\n' '\n' 'Super Binding\n' ' If "a" is an instance of "super", then the binding ' '"super(B,\n' ' obj).m()" searches "obj.__class__.__mro__" for the base ' 'class "A"\n' ' immediately preceding "B" and then invokes the descriptor ' 'with the\n' ' call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n' '\n' 'For instance bindings, the precedence of descriptor ' 'invocation depends\n' 'on the which descriptor methods are defined. A descriptor ' 'can define\n' 'any combination of "__get__()", "__set__()" and ' '"__delete__()". If it\n' 'does not define "__get__()", then accessing the attribute ' 'will return\n' 'the descriptor object itself unless there is a value in the ' 'object’s\n' 'instance dictionary. If the descriptor defines "__set__()" ' 'and/or\n' '"__delete__()", it is a data descriptor; if it defines ' 'neither, it is\n' 'a non-data descriptor. Normally, data descriptors define ' 'both\n' '"__get__()" and "__set__()", while non-data descriptors have ' 'just the\n' '"__get__()" method. Data descriptors with "__set__()" and ' '"__get__()"\n' 'defined always override a redefinition in an instance ' 'dictionary. In\n' 'contrast, non-data descriptors can be overridden by ' 'instances.\n' '\n' 'Python methods (including "staticmethod()" and ' '"classmethod()") are\n' 'implemented as non-data descriptors. Accordingly, instances ' 'can\n' 'redefine and override methods. This allows individual ' 'instances to\n' 'acquire behaviors that differ from other instances of the ' 'same class.\n' '\n' 'The "property()" function is implemented as a data ' 'descriptor.\n' 'Accordingly, instances cannot override the behavior of a ' 'property.\n' '\n' '\n' '__slots__\n' '---------\n' '\n' '*__slots__* allow us to explicitly declare data members ' '(like\n' 'properties) and deny the creation of *__dict__* and ' '*__weakref__*\n' '(unless explicitly declared in *__slots__* or available in a ' 'parent.)\n' '\n' 'The space saved over using *__dict__* can be significant.\n' '\n' 'object.__slots__\n' '\n' ' This class variable can be assigned a string, iterable, ' 'or sequence\n' ' of strings with variable names used by instances. ' '*__slots__*\n' ' reserves space for the declared variables and prevents ' 'the\n' ' automatic creation of *__dict__* and *__weakref__* for ' 'each\n' ' instance.\n' '\n' '\n' 'Notes on using *__slots__*\n' '~~~~~~~~~~~~~~~~~~~~~~~~~~\n' '\n' '* When inheriting from a class without *__slots__*, the ' '*__dict__* and\n' ' *__weakref__* attribute of the instances will always be ' 'accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' ' variables not listed in the *__slots__* definition. ' 'Attempts to\n' ' assign to an unlisted variable name raises ' '"AttributeError". If\n' ' dynamic assignment of new variables is desired, then add\n' ' "\'__dict__\'" to the sequence of strings in the ' '*__slots__*\n' ' declaration.\n' '\n' '* Without a *__weakref__* variable for each instance, ' 'classes defining\n' ' *__slots__* do not support weak references to its ' 'instances. If weak\n' ' reference support is needed, then add "\'__weakref__\'" to ' 'the\n' ' sequence of strings in the *__slots__* declaration.\n' '\n' '* *__slots__* are implemented at the class level by ' 'creating\n' ' descriptors (Implementing Descriptors) for each variable ' 'name. As a\n' ' result, class attributes cannot be used to set default ' 'values for\n' ' instance variables defined by *__slots__*; otherwise, the ' 'class\n' ' attribute would overwrite the descriptor assignment.\n' '\n' '* The action of a *__slots__* declaration is not limited to ' 'the class\n' ' where it is defined. *__slots__* declared in parents are ' 'available\n' ' in child classes. However, child subclasses will get a ' '*__dict__*\n' ' and *__weakref__* unless they also define *__slots__* ' '(which should\n' ' only contain names of any *additional* slots).\n' '\n' '* If a class defines a slot also defined in a base class, ' 'the instance\n' ' variable defined by the base class slot is inaccessible ' '(except by\n' ' retrieving its descriptor directly from the base class). ' 'This\n' ' renders the meaning of the program undefined. In the ' 'future, a\n' ' check may be added to prevent this.\n' '\n' '* Nonempty *__slots__* does not work for classes derived ' 'from\n' ' “variable-length” built-in types such as "int", "bytes" ' 'and "tuple".\n' '\n' '* Any non-string iterable may be assigned to *__slots__*. ' 'Mappings may\n' ' also be used; however, in the future, special meaning may ' 'be\n' ' assigned to the values corresponding to each key.\n' '\n' '* *__class__* assignment works only if both classes have the ' 'same\n' ' *__slots__*.\n' '\n' '* Multiple inheritance with multiple slotted parent classes ' 'can be\n' ' used, but only one parent is allowed to have attributes ' 'created by\n' ' slots (the other bases must have empty slot layouts) - ' 'violations\n' ' raise "TypeError".\n' '\n' '\n' 'Customizing class creation\n' '==========================\n' '\n' 'Whenever a class inherits from another class, ' '*__init_subclass__* is\n' 'called on that class. This way, it is possible to write ' 'classes which\n' 'change the behavior of subclasses. This is closely related ' 'to class\n' 'decorators, but where class decorators only affect the ' 'specific class\n' 'they’re applied to, "__init_subclass__" solely applies to ' 'future\n' 'subclasses of the class defining the method.\n' '\n' 'classmethod object.__init_subclass__(cls)\n' '\n' ' This method is called whenever the containing class is ' 'subclassed.\n' ' *cls* is then the new subclass. If defined as a normal ' 'instance\n' ' method, this method is implicitly converted to a class ' 'method.\n' '\n' ' Keyword arguments which are given to a new class are ' 'passed to the\n' ' parent’s class "__init_subclass__". For compatibility ' 'with other\n' ' classes using "__init_subclass__", one should take out ' 'the needed\n' ' keyword arguments and pass the others over to the base ' 'class, as\n' ' in:\n' '\n' ' class Philosopher:\n' ' def __init_subclass__(cls, default_name, ' '**kwargs):\n' ' super().__init_subclass__(**kwargs)\n' ' cls.default_name = default_name\n' '\n' ' class AustralianPhilosopher(Philosopher, ' 'default_name="Bruce"):\n' ' pass\n' '\n' ' The default implementation "object.__init_subclass__" ' 'does nothing,\n' ' but raises an error if it is called with any arguments.\n' '\n' ' Note:\n' '\n' ' The metaclass hint "metaclass" is consumed by the rest ' 'of the\n' ' type machinery, and is never passed to ' '"__init_subclass__"\n' ' implementations. The actual metaclass (rather than the ' 'explicit\n' ' hint) can be accessed as "type(cls)".\n' '\n' ' New in version 3.6.\n' '\n' '\n' 'Metaclasses\n' '-----------\n' '\n' 'By default, classes are constructed using "type()". The ' 'class body is\n' 'executed in a new namespace and the class name is bound ' 'locally to the\n' 'result of "type(name, bases, namespace)".\n' '\n' 'The class creation process can be customized by passing the\n' '"metaclass" keyword argument in the class definition line, ' 'or by\n' 'inheriting from an existing class that included such an ' 'argument. In\n' 'the following example, both "MyClass" and "MySubclass" are ' 'instances\n' 'of "Meta":\n' '\n' ' class Meta(type):\n' ' pass\n' '\n' ' class MyClass(metaclass=Meta):\n' ' pass\n' '\n' ' class MySubclass(MyClass):\n' ' pass\n' '\n' 'Any other keyword arguments that are specified in the class ' 'definition\n' 'are passed through to all metaclass operations described ' 'below.\n' '\n' 'When a class definition is executed, the following steps ' 'occur:\n' '\n' '* the appropriate metaclass is determined\n' '\n' '* the class namespace is prepared\n' '\n' '* the class body is executed\n' '\n' '* the class object is created\n' '\n' '\n' 'Determining the appropriate metaclass\n' '-------------------------------------\n' '\n' 'The appropriate metaclass for a class definition is ' 'determined as\n' 'follows:\n' '\n' '* if no bases and no explicit metaclass are given, then ' '"type()" is\n' ' used\n' '\n' '* if an explicit metaclass is given and it is *not* an ' 'instance of\n' ' "type()", then it is used directly as the metaclass\n' '\n' '* if an instance of "type()" is given as the explicit ' 'metaclass, or\n' ' bases are defined, then the most derived metaclass is ' 'used\n' '\n' 'The most derived metaclass is selected from the explicitly ' 'specified\n' 'metaclass (if any) and the metaclasses (i.e. "type(cls)") of ' 'all\n' 'specified base classes. The most derived metaclass is one ' 'which is a\n' 'subtype of *all* of these candidate metaclasses. If none of ' 'the\n' 'candidate metaclasses meets that criterion, then the class ' 'definition\n' 'will fail with "TypeError".\n' '\n' '\n' 'Preparing the class namespace\n' '-----------------------------\n' '\n' 'Once the appropriate metaclass has been identified, then the ' 'class\n' 'namespace is prepared. If the metaclass has a "__prepare__" ' 'attribute,\n' 'it is called as "namespace = metaclass.__prepare__(name, ' 'bases,\n' '**kwds)" (where the additional keyword arguments, if any, ' 'come from\n' 'the class definition).\n' '\n' 'If the metaclass has no "__prepare__" attribute, then the ' 'class\n' 'namespace is initialised as an empty ordered mapping.\n' '\n' 'See also:\n' '\n' ' **PEP 3115** - Metaclasses in Python 3000\n' ' Introduced the "__prepare__" namespace hook\n' '\n' '\n' 'Executing the class body\n' '------------------------\n' '\n' 'The class body is executed (approximately) as "exec(body, ' 'globals(),\n' 'namespace)". The key difference from a normal call to ' '"exec()" is that\n' 'lexical scoping allows the class body (including any ' 'methods) to\n' 'reference names from the current and outer scopes when the ' 'class\n' 'definition occurs inside a function.\n' '\n' 'However, even when the class definition occurs inside the ' 'function,\n' 'methods defined inside the class still cannot see names ' 'defined at the\n' 'class scope. Class variables must be accessed through the ' 'first\n' 'parameter of instance or class methods, or through the ' 'implicit\n' 'lexically scoped "__class__" reference described in the next ' 'section.\n' '\n' '\n' 'Creating the class object\n' '-------------------------\n' '\n' 'Once the class namespace has been populated by executing the ' 'class\n' 'body, the class object is created by calling ' '"metaclass(name, bases,\n' 'namespace, **kwds)" (the additional keywords passed here are ' 'the same\n' 'as those passed to "__prepare__").\n' '\n' 'This class object is the one that will be referenced by the ' 'zero-\n' 'argument form of "super()". "__class__" is an implicit ' 'closure\n' 'reference created by the compiler if any methods in a class ' 'body refer\n' 'to either "__class__" or "super". This allows the zero ' 'argument form\n' 'of "super()" to correctly identify the class being defined ' 'based on\n' 'lexical scoping, while the class or instance that was used ' 'to make the\n' 'current call is identified based on the first argument ' 'passed to the\n' 'method.\n' '\n' '**CPython implementation detail:** In CPython 3.6 and later, ' 'the\n' '"__class__" cell is passed to the metaclass as a ' '"__classcell__" entry\n' 'in the class namespace. If present, this must be propagated ' 'up to the\n' '"type.__new__" call in order for the class to be ' 'initialised\n' 'correctly. Failing to do so will result in a ' '"DeprecationWarning" in\n' 'Python 3.6, and a "RuntimeError" in Python 3.8.\n' '\n' 'When using the default metaclass "type", or any metaclass ' 'that\n' 'ultimately calls "type.__new__", the following additional\n' 'customisation steps are invoked after creating the class ' 'object:\n' '\n' '* first, "type.__new__" collects all of the descriptors in ' 'the class\n' ' namespace that define a "__set_name__()" method;\n' '\n' '* second, all of these "__set_name__" methods are called ' 'with the\n' ' class being defined and the assigned name of that ' 'particular\n' ' descriptor; and\n' '\n' '* finally, the "__init_subclass__()" hook is called on the ' 'immediate\n' ' parent of the new class in its method resolution order.\n' '\n' 'After the class object is created, it is passed to the ' 'class\n' 'decorators included in the class definition (if any) and the ' 'resulting\n' 'object is bound in the local namespace as the defined ' 'class.\n' '\n' 'When a new class is created by "type.__new__", the object ' 'provided as\n' 'the namespace parameter is copied to a new ordered mapping ' 'and the\n' 'original object is discarded. The new copy is wrapped in a ' 'read-only\n' 'proxy, which becomes the "__dict__" attribute of the class ' 'object.\n' '\n' 'See also:\n' '\n' ' **PEP 3135** - New super\n' ' Describes the implicit "__class__" closure reference\n' '\n' '\n' 'Uses for metaclasses\n' '--------------------\n' '\n' 'The potential uses for metaclasses are boundless. Some ideas ' 'that have\n' 'been explored include enum, logging, interface checking, ' 'automatic\n' 'delegation, automatic property creation, proxies, ' 'frameworks, and\n' 'automatic resource locking/synchronization.\n' '\n' '\n' 'Customizing instance and subclass checks\n' '========================================\n' '\n' 'The following methods are used to override the default ' 'behavior of the\n' '"isinstance()" and "issubclass()" built-in functions.\n' '\n' 'In particular, the metaclass "abc.ABCMeta" implements these ' 'methods in\n' 'order to allow the addition of Abstract Base Classes (ABCs) ' 'as\n' '“virtual base classes” to any class or type (including ' 'built-in\n' 'types), including other ABCs.\n' '\n' 'class.__instancecheck__(self, instance)\n' '\n' ' Return true if *instance* should be considered a (direct ' 'or\n' ' indirect) instance of *class*. If defined, called to ' 'implement\n' ' "isinstance(instance, class)".\n' '\n' 'class.__subclasscheck__(self, subclass)\n' '\n' ' Return true if *subclass* should be considered a (direct ' 'or\n' ' indirect) subclass of *class*. If defined, called to ' 'implement\n' ' "issubclass(subclass, class)".\n' '\n' 'Note that these methods are looked up on the type ' '(metaclass) of a\n' 'class. They cannot be defined as class methods in the ' 'actual class.\n' 'This is consistent with the lookup of special methods that ' 'are called\n' 'on instances, only in this case the instance is itself a ' 'class.\n' '\n' 'See also:\n' '\n' ' **PEP 3119** - Introducing Abstract Base Classes\n' ' Includes the specification for customizing ' '"isinstance()" and\n' ' "issubclass()" behavior through "__instancecheck__()" ' 'and\n' ' "__subclasscheck__()", with motivation for this ' 'functionality in\n' ' the context of adding Abstract Base Classes (see the ' '"abc"\n' ' module) to the language.\n' '\n' '\n' 'Emulating callable objects\n' '==========================\n' '\n' 'object.__call__(self[, args...])\n' '\n' ' Called when the instance is “called” as a function; if ' 'this method\n' ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' ' "x.__call__(arg1, arg2, ...)".\n' '\n' '\n' 'Emulating container types\n' '=========================\n' '\n' 'The following methods can be defined to implement container ' 'objects.\n' 'Containers usually are sequences (such as lists or tuples) ' 'or mappings\n' '(like dictionaries), but can represent other containers as ' 'well. The\n' 'first set of methods is used either to emulate a sequence or ' 'to\n' 'emulate a mapping; the difference is that for a sequence, ' 'the\n' 'allowable keys should be the integers *k* for which "0 <= k ' '< N" where\n' '*N* is the length of the sequence, or slice objects, which ' 'define a\n' 'range of items. It is also recommended that mappings ' 'provide the\n' 'methods "keys()", "values()", "items()", "get()", ' '"clear()",\n' '"setdefault()", "pop()", "popitem()", "copy()", and ' '"update()"\n' 'behaving similar to those for Python’s standard dictionary ' 'objects.\n' 'The "collections" module provides a "MutableMapping" ' 'abstract base\n' 'class to help create those methods from a base set of ' '"__getitem__()",\n' '"__setitem__()", "__delitem__()", and "keys()". Mutable ' 'sequences\n' 'should provide methods "append()", "count()", "index()", ' '"extend()",\n' '"insert()", "pop()", "remove()", "reverse()" and "sort()", ' 'like Python\n' 'standard list objects. Finally, sequence types should ' 'implement\n' 'addition (meaning concatenation) and multiplication ' '(meaning\n' 'repetition) by defining the methods "__add__()", ' '"__radd__()",\n' '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" ' 'described\n' 'below; they should not define other numerical operators. It ' 'is\n' 'recommended that both mappings and sequences implement the\n' '"__contains__()" method to allow efficient use of the "in" ' 'operator;\n' 'for mappings, "in" should search the mapping’s keys; for ' 'sequences, it\n' 'should search through the values. It is further recommended ' 'that both\n' 'mappings and sequences implement the "__iter__()" method to ' 'allow\n' 'efficient iteration through the container; for mappings, ' '"__iter__()"\n' 'should be the same as "keys()"; for sequences, it should ' 'iterate\n' 'through the values.\n' '\n' 'object.__len__(self)\n' '\n' ' Called to implement the built-in function "len()". ' 'Should return\n' ' the length of the object, an integer ">=" 0. Also, an ' 'object that\n' ' doesn’t define a "__bool__()" method and whose ' '"__len__()" method\n' ' returns zero is considered to be false in a Boolean ' 'context.\n' '\n' ' **CPython implementation detail:** In CPython, the length ' 'is\n' ' required to be at most "sys.maxsize". If the length is ' 'larger than\n' ' "sys.maxsize" some features (such as "len()") may raise\n' ' "OverflowError". To prevent raising "OverflowError" by ' 'truth value\n' ' testing, an object must define a "__bool__()" method.\n' '\n' 'object.__length_hint__(self)\n' '\n' ' Called to implement "operator.length_hint()". Should ' 'return an\n' ' estimated length for the object (which may be greater or ' 'less than\n' ' the actual length). The length must be an integer ">=" 0. ' 'This\n' ' method is purely an optimization and is never required ' 'for\n' ' correctness.\n' '\n' ' New in version 3.4.\n' '\n' 'Note:\n' '\n' ' Slicing is done exclusively with the following three ' 'methods. A\n' ' call like\n' '\n' ' a[1:2] = b\n' '\n' ' is translated to\n' '\n' ' a[slice(1, 2, None)] = b\n' '\n' ' and so forth. Missing slice items are always filled in ' 'with "None".\n' '\n' 'object.__getitem__(self, key)\n' '\n' ' Called to implement evaluation of "self[key]". For ' 'sequence types,\n' ' the accepted keys should be integers and slice objects. ' 'Note that\n' ' the special interpretation of negative indexes (if the ' 'class wishes\n' ' to emulate a sequence type) is up to the "__getitem__()" ' 'method. If\n' ' *key* is of an inappropriate type, "TypeError" may be ' 'raised; if of\n' ' a value outside the set of indexes for the sequence ' '(after any\n' ' special interpretation of negative values), "IndexError" ' 'should be\n' ' raised. For mapping types, if *key* is missing (not in ' 'the\n' ' container), "KeyError" should be raised.\n' '\n' ' Note:\n' '\n' ' "for" loops expect that an "IndexError" will be raised ' 'for\n' ' illegal indexes to allow proper detection of the end of ' 'the\n' ' sequence.\n' '\n' 'object.__setitem__(self, key, value)\n' '\n' ' Called to implement assignment to "self[key]". Same note ' 'as for\n' ' "__getitem__()". This should only be implemented for ' 'mappings if\n' ' the objects support changes to the values for keys, or if ' 'new keys\n' ' can be added, or for sequences if elements can be ' 'replaced. The\n' ' same exceptions should be raised for improper *key* ' 'values as for\n' ' the "__getitem__()" method.\n' '\n' 'object.__delitem__(self, key)\n' '\n' ' Called to implement deletion of "self[key]". Same note ' 'as for\n' ' "__getitem__()". This should only be implemented for ' 'mappings if\n' ' the objects support removal of keys, or for sequences if ' 'elements\n' ' can be removed from the sequence. The same exceptions ' 'should be\n' ' raised for improper *key* values as for the ' '"__getitem__()" method.\n' '\n' 'object.__missing__(self, key)\n' '\n' ' Called by "dict"."__getitem__()" to implement "self[key]" ' 'for dict\n' ' subclasses when key is not in the dictionary.\n' '\n' 'object.__iter__(self)\n' '\n' ' This method is called when an iterator is required for a ' 'container.\n' ' This method should return a new iterator object that can ' 'iterate\n' ' over all the objects in the container. For mappings, it ' 'should\n' ' iterate over the keys of the container.\n' '\n' ' Iterator objects also need to implement this method; they ' 'are\n' ' required to return themselves. For more information on ' 'iterator\n' ' objects, see Iterator Types.\n' '\n' 'object.__reversed__(self)\n' '\n' ' Called (if present) by the "reversed()" built-in to ' 'implement\n' ' reverse iteration. It should return a new iterator ' 'object that\n' ' iterates over all the objects in the container in reverse ' 'order.\n' '\n' ' If the "__reversed__()" method is not provided, the ' '"reversed()"\n' ' built-in will fall back to using the sequence protocol ' '("__len__()"\n' ' and "__getitem__()"). Objects that support the sequence ' 'protocol\n' ' should only provide "__reversed__()" if they can provide ' 'an\n' ' implementation that is more efficient than the one ' 'provided by\n' ' "reversed()".\n' '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' 'implemented as an iteration through a sequence. However, ' 'container\n' 'objects can supply the following special method with a more ' 'efficient\n' 'implementation, which also does not require the object be a ' 'sequence.\n' '\n' 'object.__contains__(self, item)\n' '\n' ' Called to implement membership test operators. Should ' 'return true\n' ' if *item* is in *self*, false otherwise. For mapping ' 'objects, this\n' ' should consider the keys of the mapping rather than the ' 'values or\n' ' the key-item pairs.\n' '\n' ' For objects that don’t define "__contains__()", the ' 'membership test\n' ' first tries iteration via "__iter__()", then the old ' 'sequence\n' ' iteration protocol via "__getitem__()", see this section ' 'in the\n' ' language reference.\n' '\n' '\n' 'Emulating numeric types\n' '=======================\n' '\n' 'The following methods can be defined to emulate numeric ' 'objects.\n' 'Methods corresponding to operations that are not supported ' 'by the\n' 'particular kind of number implemented (e.g., bitwise ' 'operations for\n' 'non-integral numbers) should be left undefined.\n' '\n' 'object.__add__(self, other)\n' 'object.__sub__(self, other)\n' 'object.__mul__(self, other)\n' 'object.__matmul__(self, other)\n' 'object.__truediv__(self, other)\n' 'object.__floordiv__(self, other)\n' 'object.__mod__(self, other)\n' 'object.__divmod__(self, other)\n' 'object.__pow__(self, other[, modulo])\n' 'object.__lshift__(self, other)\n' 'object.__rshift__(self, other)\n' 'object.__and__(self, other)\n' 'object.__xor__(self, other)\n' 'object.__or__(self, other)\n' '\n' ' These methods are called to implement the binary ' 'arithmetic\n' ' operations ("+", "-", "*", "@", "/", "//", "%", ' '"divmod()",\n' ' "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, ' 'to\n' ' evaluate the expression "x + y", where *x* is an instance ' 'of a\n' ' class that has an "__add__()" method, "x.__add__(y)" is ' 'called.\n' ' The "__divmod__()" method should be the equivalent to ' 'using\n' ' "__floordiv__()" and "__mod__()"; it should not be ' 'related to\n' ' "__truediv__()". Note that "__pow__()" should be defined ' 'to accept\n' ' an optional third argument if the ternary version of the ' 'built-in\n' ' "pow()" function is to be supported.\n' '\n' ' If one of those methods does not support the operation ' 'with the\n' ' supplied arguments, it should return "NotImplemented".\n' '\n' 'object.__radd__(self, other)\n' 'object.__rsub__(self, other)\n' 'object.__rmul__(self, other)\n' 'object.__rmatmul__(self, other)\n' 'object.__rtruediv__(self, other)\n' 'object.__rfloordiv__(self, other)\n' 'object.__rmod__(self, other)\n' 'object.__rdivmod__(self, other)\n' 'object.__rpow__(self, other)\n' 'object.__rlshift__(self, other)\n' 'object.__rrshift__(self, other)\n' 'object.__rand__(self, other)\n' 'object.__rxor__(self, other)\n' 'object.__ror__(self, other)\n' '\n' ' These methods are called to implement the binary ' 'arithmetic\n' ' operations ("+", "-", "*", "@", "/", "//", "%", ' '"divmod()",\n' ' "pow()", "**", "<<", ">>", "&", "^", "|") with reflected ' '(swapped)\n' ' operands. These functions are only called if the left ' 'operand does\n' ' not support the corresponding operation [3] and the ' 'operands are of\n' ' different types. [4] For instance, to evaluate the ' 'expression "x -\n' ' y", where *y* is an instance of a class that has an ' '"__rsub__()"\n' ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' 'returns\n' ' *NotImplemented*.\n' '\n' ' Note that ternary "pow()" will not try calling ' '"__rpow__()" (the\n' ' coercion rules would become too complicated).\n' '\n' ' Note:\n' '\n' ' If the right operand’s type is a subclass of the left ' 'operand’s\n' ' type and that subclass provides the reflected method ' 'for the\n' ' operation, this method will be called before the left ' 'operand’s\n' ' non-reflected method. This behavior allows subclasses ' 'to\n' ' override their ancestors’ operations.\n' '\n' 'object.__iadd__(self, other)\n' 'object.__isub__(self, other)\n' 'object.__imul__(self, other)\n' 'object.__imatmul__(self, other)\n' 'object.__itruediv__(self, other)\n' 'object.__ifloordiv__(self, other)\n' 'object.__imod__(self, other)\n' 'object.__ipow__(self, other[, modulo])\n' 'object.__ilshift__(self, other)\n' 'object.__irshift__(self, other)\n' 'object.__iand__(self, other)\n' 'object.__ixor__(self, other)\n' 'object.__ior__(self, other)\n' '\n' ' These methods are called to implement the augmented ' 'arithmetic\n' ' assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", ' '"**=",\n' ' "<<=", ">>=", "&=", "^=", "|="). These methods should ' 'attempt to\n' ' do the operation in-place (modifying *self*) and return ' 'the result\n' ' (which could be, but does not have to be, *self*). If a ' 'specific\n' ' method is not defined, the augmented assignment falls ' 'back to the\n' ' normal methods. For instance, if *x* is an instance of a ' 'class\n' ' with an "__iadd__()" method, "x += y" is equivalent to "x ' '=\n' ' x.__iadd__(y)" . Otherwise, "x.__add__(y)" and ' '"y.__radd__(x)" are\n' ' considered, as with the evaluation of "x + y". In ' 'certain\n' ' situations, augmented assignment can result in unexpected ' 'errors\n' ' (see Why does a_tuple[i] += [‘item’] raise an exception ' 'when the\n' ' addition works?), but this behavior is in fact part of ' 'the data\n' ' model.\n' '\n' 'object.__neg__(self)\n' 'object.__pos__(self)\n' 'object.__abs__(self)\n' 'object.__invert__(self)\n' '\n' ' Called to implement the unary arithmetic operations ("-", ' '"+",\n' ' "abs()" and "~").\n' '\n' 'object.__complex__(self)\n' 'object.__int__(self)\n' 'object.__float__(self)\n' '\n' ' Called to implement the built-in functions "complex()", ' '"int()" and\n' ' "float()". Should return a value of the appropriate ' 'type.\n' '\n' 'object.__index__(self)\n' '\n' ' Called to implement "operator.index()", and whenever ' 'Python needs\n' ' to losslessly convert the numeric object to an integer ' 'object (such\n' ' as in slicing, or in the built-in "bin()", "hex()" and ' '"oct()"\n' ' functions). Presence of this method indicates that the ' 'numeric\n' ' object is an integer type. Must return an integer.\n' '\n' ' Note:\n' '\n' ' In order to have a coherent integer type class, when\n' ' "__index__()" is defined "__int__()" should also be ' 'defined, and\n' ' both should return the same value.\n' '\n' 'object.__round__(self[, ndigits])\n' 'object.__trunc__(self)\n' 'object.__floor__(self)\n' 'object.__ceil__(self)\n' '\n' ' Called to implement the built-in function "round()" and ' '"math"\n' ' functions "trunc()", "floor()" and "ceil()". Unless ' '*ndigits* is\n' ' passed to "__round__()" all these methods should return ' 'the value\n' ' of the object truncated to an "Integral" (typically an ' '"int").\n' '\n' ' If "__int__()" is not defined then the built-in function ' '"int()"\n' ' falls back to "__trunc__()".\n' '\n' '\n' 'With Statement Context Managers\n' '===============================\n' '\n' 'A *context manager* is an object that defines the runtime ' 'context to\n' 'be established when executing a "with" statement. The ' 'context manager\n' 'handles the entry into, and the exit from, the desired ' 'runtime context\n' 'for the execution of the block of code. Context managers ' 'are normally\n' 'invoked using the "with" statement (described in section The ' 'with\n' 'statement), but can also be used by directly invoking their ' 'methods.\n' '\n' 'Typical uses of context managers include saving and ' 'restoring various\n' 'kinds of global state, locking and unlocking resources, ' 'closing opened\n' 'files, etc.\n' '\n' 'For more information on context managers, see Context ' 'Manager Types.\n' '\n' 'object.__enter__(self)\n' '\n' ' Enter the runtime context related to this object. The ' '"with"\n' ' statement will bind this method’s return value to the ' 'target(s)\n' ' specified in the "as" clause of the statement, if any.\n' '\n' 'object.__exit__(self, exc_type, exc_value, traceback)\n' '\n' ' Exit the runtime context related to this object. The ' 'parameters\n' ' describe the exception that caused the context to be ' 'exited. If the\n' ' context was exited without an exception, all three ' 'arguments will\n' ' be "None".\n' '\n' ' If an exception is supplied, and the method wishes to ' 'suppress the\n' ' exception (i.e., prevent it from being propagated), it ' 'should\n' ' return a true value. Otherwise, the exception will be ' 'processed\n' ' normally upon exit from this method.\n' '\n' ' Note that "__exit__()" methods should not reraise the ' 'passed-in\n' ' exception; this is the caller’s responsibility.\n' '\n' 'See also:\n' '\n' ' **PEP 343** - The “with” statement\n' ' The specification, background, and examples for the ' 'Python "with"\n' ' statement.\n' '\n' '\n' 'Special method lookup\n' '=====================\n' '\n' 'For custom classes, implicit invocations of special methods ' 'are only\n' 'guaranteed to work correctly if defined on an object’s type, ' 'not in\n' 'the object’s instance dictionary. That behaviour is the ' 'reason why\n' 'the following code raises an exception:\n' '\n' ' >>> class C:\n' ' ... pass\n' ' ...\n' ' >>> c = C()\n' ' >>> c.__len__ = lambda: 5\n' ' >>> len(c)\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 1, in <module>\n' " TypeError: object of type 'C' has no len()\n" '\n' 'The rationale behind this behaviour lies with a number of ' 'special\n' 'methods such as "__hash__()" and "__repr__()" that are ' 'implemented by\n' 'all objects, including type objects. If the implicit lookup ' 'of these\n' 'methods used the conventional lookup process, they would ' 'fail when\n' 'invoked on the type object itself:\n' '\n' ' >>> 1 .__hash__() == hash(1)\n' ' True\n' ' >>> int.__hash__() == hash(int)\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 1, in <module>\n' " TypeError: descriptor '__hash__' of 'int' object needs an " 'argument\n' '\n' 'Incorrectly attempting to invoke an unbound method of a ' 'class in this\n' 'way is sometimes referred to as ‘metaclass confusion’, and ' 'is avoided\n' 'by bypassing the instance when looking up special methods:\n' '\n' ' >>> type(1).__hash__(1) == hash(1)\n' ' True\n' ' >>> type(int).__hash__(int) == hash(int)\n' ' True\n' '\n' 'In addition to bypassing any instance attributes in the ' 'interest of\n' 'correctness, implicit special method lookup generally also ' 'bypasses\n' 'the "__getattribute__()" method even of the object’s ' 'metaclass:\n' '\n' ' >>> class Meta(type):\n' ' ... def __getattribute__(*args):\n' ' ... print("Metaclass getattribute invoked")\n' ' ... return type.__getattribute__(*args)\n' ' ...\n' ' >>> class C(object, metaclass=Meta):\n' ' ... def __len__(self):\n' ' ... return 10\n' ' ... def __getattribute__(*args):\n' ' ... print("Class getattribute invoked")\n' ' ... return object.__getattribute__(*args)\n' ' ...\n' ' >>> c = C()\n' ' >>> c.__len__() # Explicit lookup via ' 'instance\n' ' Class getattribute invoked\n' ' 10\n' ' >>> type(c).__len__(c) # Explicit lookup via ' 'type\n' ' Metaclass getattribute invoked\n' ' 10\n' ' >>> len(c) # Implicit lookup\n' ' 10\n' '\n' 'Bypassing the "__getattribute__()" machinery in this fashion ' 'provides\n' 'significant scope for speed optimisations within the ' 'interpreter, at\n' 'the cost of some flexibility in the handling of special ' 'methods (the\n' 'special method *must* be set on the class object itself in ' 'order to be\n' 'consistently invoked by the interpreter).\n', 'string-methods': 'String Methods\n' '**************\n' '\n' 'Strings implement all of the common sequence operations, ' 'along with\n' 'the additional methods described below.\n' '\n' 'Strings also support two styles of string formatting, one ' 'providing a\n' 'large degree of flexibility and customization (see ' '"str.format()",\n' 'Format String Syntax and Custom String Formatting) and the ' 'other based\n' 'on C "printf" style formatting that handles a narrower ' 'range of types\n' 'and is slightly harder to use correctly, but is often ' 'faster for the\n' 'cases it can handle (printf-style String Formatting).\n' '\n' 'The Text Processing Services section of the standard ' 'library covers a\n' 'number of other modules that provide various text related ' 'utilities\n' '(including regular expression support in the "re" ' 'module).\n' '\n' 'str.capitalize()\n' '\n' ' Return a copy of the string with its first character ' 'capitalized\n' ' and the rest lowercased.\n' '\n' 'str.casefold()\n' '\n' ' Return a casefolded copy of the string. Casefolded ' 'strings may be\n' ' used for caseless matching.\n' '\n' ' Casefolding is similar to lowercasing but more ' 'aggressive because\n' ' it is intended to remove all case distinctions in a ' 'string. For\n' ' example, the German lowercase letter "\'ß\'" is ' 'equivalent to ""ss"".\n' ' Since it is already lowercase, "lower()" would do ' 'nothing to "\'ß\'";\n' ' "casefold()" converts it to ""ss"".\n' '\n' ' The casefolding algorithm is described in section 3.13 ' 'of the\n' ' Unicode Standard.\n' '\n' ' New in version 3.3.\n' '\n' 'str.center(width[, fillchar])\n' '\n' ' Return centered in a string of length *width*. Padding ' 'is done\n' ' using the specified *fillchar* (default is an ASCII ' 'space). The\n' ' original string is returned if *width* is less than or ' 'equal to\n' ' "len(s)".\n' '\n' 'str.count(sub[, start[, end]])\n' '\n' ' Return the number of non-overlapping occurrences of ' 'substring *sub*\n' ' in the range [*start*, *end*]. Optional arguments ' '*start* and\n' ' *end* are interpreted as in slice notation.\n' '\n' 'str.encode(encoding="utf-8", errors="strict")\n' '\n' ' Return an encoded version of the string as a bytes ' 'object. Default\n' ' encoding is "\'utf-8\'". *errors* may be given to set a ' 'different\n' ' error handling scheme. The default for *errors* is ' '"\'strict\'",\n' ' meaning that encoding errors raise a "UnicodeError". ' 'Other possible\n' ' values are "\'ignore\'", "\'replace\'", ' '"\'xmlcharrefreplace\'",\n' ' "\'backslashreplace\'" and any other name registered ' 'via\n' ' "codecs.register_error()", see section Error Handlers. ' 'For a list\n' ' of possible encodings, see section Standard Encodings.\n' '\n' ' Changed in version 3.1: Support for keyword arguments ' 'added.\n' '\n' 'str.endswith(suffix[, start[, end]])\n' '\n' ' Return "True" if the string ends with the specified ' '*suffix*,\n' ' otherwise return "False". *suffix* can also be a tuple ' 'of suffixes\n' ' to look for. With optional *start*, test beginning at ' 'that\n' ' position. With optional *end*, stop comparing at that ' 'position.\n' '\n' 'str.expandtabs(tabsize=8)\n' '\n' ' Return a copy of the string where all tab characters ' 'are replaced\n' ' by one or more spaces, depending on the current column ' 'and the\n' ' given tab size. Tab positions occur every *tabsize* ' 'characters\n' ' (default is 8, giving tab positions at columns 0, 8, 16 ' 'and so on).\n' ' To expand the string, the current column is set to zero ' 'and the\n' ' string is examined character by character. If the ' 'character is a\n' ' tab ("\\t"), one or more space characters are inserted ' 'in the result\n' ' until the current column is equal to the next tab ' 'position. (The\n' ' tab character itself is not copied.) If the character ' 'is a newline\n' ' ("\\n") or return ("\\r"), it is copied and the current ' 'column is\n' ' reset to zero. Any other character is copied unchanged ' 'and the\n' ' current column is incremented by one regardless of how ' 'the\n' ' character is represented when printed.\n' '\n' " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n" " '01 012 0123 01234'\n" " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" " '01 012 0123 01234'\n" '\n' 'str.find(sub[, start[, end]])\n' '\n' ' Return the lowest index in the string where substring ' '*sub* is\n' ' found within the slice "s[start:end]". Optional ' 'arguments *start*\n' ' and *end* are interpreted as in slice notation. Return ' '"-1" if\n' ' *sub* is not found.\n' '\n' ' Note:\n' '\n' ' The "find()" method should be used only if you need ' 'to know the\n' ' position of *sub*. To check if *sub* is a substring ' 'or not, use\n' ' the "in" operator:\n' '\n' " >>> 'Py' in 'Python'\n" ' True\n' '\n' 'str.format(*args, **kwargs)\n' '\n' ' Perform a string formatting operation. The string on ' 'which this\n' ' method is called can contain literal text or ' 'replacement fields\n' ' delimited by braces "{}". Each replacement field ' 'contains either\n' ' the numeric index of a positional argument, or the name ' 'of a\n' ' keyword argument. Returns a copy of the string where ' 'each\n' ' replacement field is replaced with the string value of ' 'the\n' ' corresponding argument.\n' '\n' ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n' " 'The sum of 1 + 2 is 3'\n" '\n' ' See Format String Syntax for a description of the ' 'various\n' ' formatting options that can be specified in format ' 'strings.\n' '\n' ' Note:\n' '\n' ' When formatting a number ("int", "float", "complex",\n' ' "decimal.Decimal" and subclasses) with the "n" type ' '(ex:\n' ' "\'{:n}\'.format(1234)"), the function temporarily ' 'sets the\n' ' "LC_CTYPE" locale to the "LC_NUMERIC" locale to ' 'decode\n' ' "decimal_point" and "thousands_sep" fields of ' '"localeconv()" if\n' ' they are non-ASCII or longer than 1 byte, and the ' '"LC_NUMERIC"\n' ' locale is different than the "LC_CTYPE" locale. This ' 'temporary\n' ' change affects other threads.\n' '\n' ' Changed in version 3.6.5: When formatting a number with ' 'the "n"\n' ' type, the function sets temporarily the "LC_CTYPE" ' 'locale to the\n' ' "LC_NUMERIC" locale in some cases.\n' '\n' 'str.format_map(mapping)\n' '\n' ' Similar to "str.format(**mapping)", except that ' '"mapping" is used\n' ' directly and not copied to a "dict". This is useful if ' 'for example\n' ' "mapping" is a dict subclass:\n' '\n' ' >>> class Default(dict):\n' ' ... def __missing__(self, key):\n' ' ... return key\n' ' ...\n' " >>> '{name} was born in " "{country}'.format_map(Default(name='Guido'))\n" " 'Guido was born in country'\n" '\n' ' New in version 3.2.\n' '\n' 'str.index(sub[, start[, end]])\n' '\n' ' Like "find()", but raise "ValueError" when the ' 'substring is not\n' ' found.\n' '\n' 'str.isalnum()\n' '\n' ' Return true if all characters in the string are ' 'alphanumeric and\n' ' there is at least one character, false otherwise. A ' 'character "c"\n' ' is alphanumeric if one of the following returns ' '"True":\n' ' "c.isalpha()", "c.isdecimal()", "c.isdigit()", or ' '"c.isnumeric()".\n' '\n' 'str.isalpha()\n' '\n' ' Return true if all characters in the string are ' 'alphabetic and\n' ' there is at least one character, false otherwise. ' 'Alphabetic\n' ' characters are those characters defined in the Unicode ' 'character\n' ' database as “Letter”, i.e., those with general category ' 'property\n' ' being one of “Lm”, “Lt”, “Lu”, “Ll”, or “Lo”. Note ' 'that this is\n' ' different from the “Alphabetic” property defined in the ' 'Unicode\n' ' Standard.\n' '\n' 'str.isdecimal()\n' '\n' ' Return true if all characters in the string are decimal ' 'characters\n' ' and there is at least one character, false otherwise. ' 'Decimal\n' ' characters are those that can be used to form numbers ' 'in base 10,\n' ' e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a ' 'decimal character\n' ' is a character in the Unicode General Category “Nd”.\n' '\n' 'str.isdigit()\n' '\n' ' Return true if all characters in the string are digits ' 'and there is\n' ' at least one character, false otherwise. Digits ' 'include decimal\n' ' characters and digits that need special handling, such ' 'as the\n' ' compatibility superscript digits. This covers digits ' 'which cannot\n' ' be used to form numbers in base 10, like the Kharosthi ' 'numbers.\n' ' Formally, a digit is a character that has the property ' 'value\n' ' Numeric_Type=Digit or Numeric_Type=Decimal.\n' '\n' 'str.isidentifier()\n' '\n' ' Return true if the string is a valid identifier ' 'according to the\n' ' language definition, section Identifiers and keywords.\n' '\n' ' Use "keyword.iskeyword()" to test for reserved ' 'identifiers such as\n' ' "def" and "class".\n' '\n' 'str.islower()\n' '\n' ' Return true if all cased characters [4] in the string ' 'are lowercase\n' ' and there is at least one cased character, false ' 'otherwise.\n' '\n' 'str.isnumeric()\n' '\n' ' Return true if all characters in the string are numeric ' 'characters,\n' ' and there is at least one character, false otherwise. ' 'Numeric\n' ' characters include digit characters, and all characters ' 'that have\n' ' the Unicode numeric value property, e.g. U+2155, VULGAR ' 'FRACTION\n' ' ONE FIFTH. Formally, numeric characters are those with ' 'the\n' ' property value Numeric_Type=Digit, Numeric_Type=Decimal ' 'or\n' ' Numeric_Type=Numeric.\n' '\n' 'str.isprintable()\n' '\n' ' Return true if all characters in the string are ' 'printable or the\n' ' string is empty, false otherwise. Nonprintable ' 'characters are\n' ' those characters defined in the Unicode character ' 'database as\n' ' “Other” or “Separator”, excepting the ASCII space ' '(0x20) which is\n' ' considered printable. (Note that printable characters ' 'in this\n' ' context are those which should not be escaped when ' '"repr()" is\n' ' invoked on a string. It has no bearing on the handling ' 'of strings\n' ' written to "sys.stdout" or "sys.stderr".)\n' '\n' 'str.isspace()\n' '\n' ' Return true if there are only whitespace characters in ' 'the string\n' ' and there is at least one character, false otherwise. ' 'Whitespace\n' ' characters are those characters defined in the Unicode ' 'character\n' ' database as “Other” or “Separator” and those with ' 'bidirectional\n' ' property being one of “WS”, “B”, or “S”.\n' '\n' 'str.istitle()\n' '\n' ' Return true if the string is a titlecased string and ' 'there is at\n' ' least one character, for example uppercase characters ' 'may only\n' ' follow uncased characters and lowercase characters only ' 'cased ones.\n' ' Return false otherwise.\n' '\n' 'str.isupper()\n' '\n' ' Return true if all cased characters [4] in the string ' 'are uppercase\n' ' and there is at least one cased character, false ' 'otherwise.\n' '\n' 'str.join(iterable)\n' '\n' ' Return a string which is the concatenation of the ' 'strings in\n' ' *iterable*. A "TypeError" will be raised if there are ' 'any non-\n' ' string values in *iterable*, including "bytes" ' 'objects. The\n' ' separator between elements is the string providing this ' 'method.\n' '\n' 'str.ljust(width[, fillchar])\n' '\n' ' Return the string left justified in a string of length ' '*width*.\n' ' Padding is done using the specified *fillchar* (default ' 'is an ASCII\n' ' space). The original string is returned if *width* is ' 'less than or\n' ' equal to "len(s)".\n' '\n' 'str.lower()\n' '\n' ' Return a copy of the string with all the cased ' 'characters [4]\n' ' converted to lowercase.\n' '\n' ' The lowercasing algorithm used is described in section ' '3.13 of the\n' ' Unicode Standard.\n' '\n' 'str.lstrip([chars])\n' '\n' ' Return a copy of the string with leading characters ' 'removed. The\n' ' *chars* argument is a string specifying the set of ' 'characters to be\n' ' removed. If omitted or "None", the *chars* argument ' 'defaults to\n' ' removing whitespace. The *chars* argument is not a ' 'prefix; rather,\n' ' all combinations of its values are stripped:\n' '\n' " >>> ' spacious '.lstrip()\n" " 'spacious '\n" " >>> 'www.example.com'.lstrip('cmowz.')\n" " 'example.com'\n" '\n' 'static str.maketrans(x[, y[, z]])\n' '\n' ' This static method returns a translation table usable ' 'for\n' ' "str.translate()".\n' '\n' ' If there is only one argument, it must be a dictionary ' 'mapping\n' ' Unicode ordinals (integers) or characters (strings of ' 'length 1) to\n' ' Unicode ordinals, strings (of arbitrary lengths) or ' '"None".\n' ' Character keys will then be converted to ordinals.\n' '\n' ' If there are two arguments, they must be strings of ' 'equal length,\n' ' and in the resulting dictionary, each character in x ' 'will be mapped\n' ' to the character at the same position in y. If there ' 'is a third\n' ' argument, it must be a string, whose characters will be ' 'mapped to\n' ' "None" in the result.\n' '\n' 'str.partition(sep)\n' '\n' ' Split the string at the first occurrence of *sep*, and ' 'return a\n' ' 3-tuple containing the part before the separator, the ' 'separator\n' ' itself, and the part after the separator. If the ' 'separator is not\n' ' found, return a 3-tuple containing the string itself, ' 'followed by\n' ' two empty strings.\n' '\n' 'str.replace(old, new[, count])\n' '\n' ' Return a copy of the string with all occurrences of ' 'substring *old*\n' ' replaced by *new*. If the optional argument *count* is ' 'given, only\n' ' the first *count* occurrences are replaced.\n' '\n' 'str.rfind(sub[, start[, end]])\n' '\n' ' Return the highest index in the string where substring ' '*sub* is\n' ' found, such that *sub* is contained within ' '"s[start:end]".\n' ' Optional arguments *start* and *end* are interpreted as ' 'in slice\n' ' notation. Return "-1" on failure.\n' '\n' 'str.rindex(sub[, start[, end]])\n' '\n' ' Like "rfind()" but raises "ValueError" when the ' 'substring *sub* is\n' ' not found.\n' '\n' 'str.rjust(width[, fillchar])\n' '\n' ' Return the string right justified in a string of length ' '*width*.\n' ' Padding is done using the specified *fillchar* (default ' 'is an ASCII\n' ' space). The original string is returned if *width* is ' 'less than or\n' ' equal to "len(s)".\n' '\n' 'str.rpartition(sep)\n' '\n' ' Split the string at the last occurrence of *sep*, and ' 'return a\n' ' 3-tuple containing the part before the separator, the ' 'separator\n' ' itself, and the part after the separator. If the ' 'separator is not\n' ' found, return a 3-tuple containing two empty strings, ' 'followed by\n' ' the string itself.\n' '\n' 'str.rsplit(sep=None, maxsplit=-1)\n' '\n' ' Return a list of the words in the string, using *sep* ' 'as the\n' ' delimiter string. If *maxsplit* is given, at most ' '*maxsplit* splits\n' ' are done, the *rightmost* ones. If *sep* is not ' 'specified or\n' ' "None", any whitespace string is a separator. Except ' 'for splitting\n' ' from the right, "rsplit()" behaves like "split()" which ' 'is\n' ' described in detail below.\n' '\n' 'str.rstrip([chars])\n' '\n' ' Return a copy of the string with trailing characters ' 'removed. The\n' ' *chars* argument is a string specifying the set of ' 'characters to be\n' ' removed. If omitted or "None", the *chars* argument ' 'defaults to\n' ' removing whitespace. The *chars* argument is not a ' 'suffix; rather,\n' ' all combinations of its values are stripped:\n' '\n' " >>> ' spacious '.rstrip()\n" " ' spacious'\n" " >>> 'mississippi'.rstrip('ipz')\n" " 'mississ'\n" '\n' 'str.split(sep=None, maxsplit=-1)\n' '\n' ' Return a list of the words in the string, using *sep* ' 'as the\n' ' delimiter string. If *maxsplit* is given, at most ' '*maxsplit*\n' ' splits are done (thus, the list will have at most ' '"maxsplit+1"\n' ' elements). If *maxsplit* is not specified or "-1", ' 'then there is\n' ' no limit on the number of splits (all possible splits ' 'are made).\n' '\n' ' If *sep* is given, consecutive delimiters are not ' 'grouped together\n' ' and are deemed to delimit empty strings (for example,\n' ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', ' '\'2\']"). The *sep* argument\n' ' may consist of multiple characters (for example,\n' ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', ' '\'3\']"). Splitting an\n' ' empty string with a specified separator returns ' '"[\'\']".\n' '\n' ' For example:\n' '\n' " >>> '1,2,3'.split(',')\n" " ['1', '2', '3']\n" " >>> '1,2,3'.split(',', maxsplit=1)\n" " ['1', '2,3']\n" " >>> '1,2,,3,'.split(',')\n" " ['1', '2', '', '3', '']\n" '\n' ' If *sep* is not specified or is "None", a different ' 'splitting\n' ' algorithm is applied: runs of consecutive whitespace ' 'are regarded\n' ' as a single separator, and the result will contain no ' 'empty strings\n' ' at the start or end if the string has leading or ' 'trailing\n' ' whitespace. Consequently, splitting an empty string or ' 'a string\n' ' consisting of just whitespace with a "None" separator ' 'returns "[]".\n' '\n' ' For example:\n' '\n' " >>> '1 2 3'.split()\n" " ['1', '2', '3']\n" " >>> '1 2 3'.split(maxsplit=1)\n" " ['1', '2 3']\n" " >>> ' 1 2 3 '.split()\n" " ['1', '2', '3']\n" '\n' 'str.splitlines([keepends])\n' '\n' ' Return a list of the lines in the string, breaking at ' 'line\n' ' boundaries. Line breaks are not included in the ' 'resulting list\n' ' unless *keepends* is given and true.\n' '\n' ' This method splits on the following line boundaries. ' 'In\n' ' particular, the boundaries are a superset of *universal ' 'newlines*.\n' '\n' ' ' '+-------------------------+-------------------------------+\n' ' | Representation | ' 'Description |\n' ' ' '|=========================|===============================|\n' ' | "\\n" | Line ' 'Feed |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\r" | Carriage ' 'Return |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\r\\n" | Carriage Return + Line ' 'Feed |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\v" or "\\x0b" | Line ' 'Tabulation |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\f" or "\\x0c" | Form ' 'Feed |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\x1c" | File ' 'Separator |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\x1d" | Group ' 'Separator |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\x1e" | Record ' 'Separator |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\x85" | Next Line (C1 Control ' 'Code) |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\u2028" | Line ' 'Separator |\n' ' ' '+-------------------------+-------------------------------+\n' ' | "\\u2029" | Paragraph ' 'Separator |\n' ' ' '+-------------------------+-------------------------------+\n' '\n' ' Changed in version 3.2: "\\v" and "\\f" added to list ' 'of line\n' ' boundaries.\n' '\n' ' For example:\n' '\n' " >>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" " ['ab c', '', 'de fg', 'kl']\n" " >>> 'ab c\\n\\nde " "fg\\rkl\\r\\n'.splitlines(keepends=True)\n" " ['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']\n" '\n' ' Unlike "split()" when a delimiter string *sep* is ' 'given, this\n' ' method returns an empty list for the empty string, and ' 'a terminal\n' ' line break does not result in an extra line:\n' '\n' ' >>> "".splitlines()\n' ' []\n' ' >>> "One line\\n".splitlines()\n' " ['One line']\n" '\n' ' For comparison, "split(\'\\n\')" gives:\n' '\n' " >>> ''.split('\\n')\n" " ['']\n" " >>> 'Two lines\\n'.split('\\n')\n" " ['Two lines', '']\n" '\n' 'str.startswith(prefix[, start[, end]])\n' '\n' ' Return "True" if string starts with the *prefix*, ' 'otherwise return\n' ' "False". *prefix* can also be a tuple of prefixes to ' 'look for.\n' ' With optional *start*, test string beginning at that ' 'position.\n' ' With optional *end*, stop comparing string at that ' 'position.\n' '\n' 'str.strip([chars])\n' '\n' ' Return a copy of the string with the leading and ' 'trailing\n' ' characters removed. The *chars* argument is a string ' 'specifying the\n' ' set of characters to be removed. If omitted or "None", ' 'the *chars*\n' ' argument defaults to removing whitespace. The *chars* ' 'argument is\n' ' not a prefix or suffix; rather, all combinations of its ' 'values are\n' ' stripped:\n' '\n' " >>> ' spacious '.strip()\n" " 'spacious'\n" " >>> 'www.example.com'.strip('cmowz.')\n" " 'example'\n" '\n' ' The outermost leading and trailing *chars* argument ' 'values are\n' ' stripped from the string. Characters are removed from ' 'the leading\n' ' end until reaching a string character that is not ' 'contained in the\n' ' set of characters in *chars*. A similar action takes ' 'place on the\n' ' trailing end. For example:\n' '\n' " >>> comment_string = '#....... Section 3.2.1 Issue " "#32 .......'\n" " >>> comment_string.strip('.#! ')\n" " 'Section 3.2.1 Issue #32'\n" '\n' 'str.swapcase()\n' '\n' ' Return a copy of the string with uppercase characters ' 'converted to\n' ' lowercase and vice versa. Note that it is not ' 'necessarily true that\n' ' "s.swapcase().swapcase() == s".\n' '\n' 'str.title()\n' '\n' ' Return a titlecased version of the string where words ' 'start with an\n' ' uppercase character and the remaining characters are ' 'lowercase.\n' '\n' ' For example:\n' '\n' " >>> 'Hello world'.title()\n" " 'Hello World'\n" '\n' ' The algorithm uses a simple language-independent ' 'definition of a\n' ' word as groups of consecutive letters. The definition ' 'works in\n' ' many contexts but it means that apostrophes in ' 'contractions and\n' ' possessives form word boundaries, which may not be the ' 'desired\n' ' result:\n' '\n' ' >>> "they\'re bill\'s friends from the UK".title()\n' ' "They\'Re Bill\'S Friends From The Uk"\n' '\n' ' A workaround for apostrophes can be constructed using ' 'regular\n' ' expressions:\n' '\n' ' >>> import re\n' ' >>> def titlecase(s):\n' ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n' ' ... lambda mo: ' 'mo.group(0)[0].upper() +\n' ' ... ' 'mo.group(0)[1:].lower(),\n' ' ... s)\n' ' ...\n' ' >>> titlecase("they\'re bill\'s friends.")\n' ' "They\'re Bill\'s Friends."\n' '\n' 'str.translate(table)\n' '\n' ' Return a copy of the string in which each character has ' 'been mapped\n' ' through the given translation table. The table must be ' 'an object\n' ' that implements indexing via "__getitem__()", typically ' 'a *mapping*\n' ' or *sequence*. When indexed by a Unicode ordinal (an ' 'integer), the\n' ' table object can do any of the following: return a ' 'Unicode ordinal\n' ' or a string, to map the character to one or more other ' 'characters;\n' ' return "None", to delete the character from the return ' 'string; or\n' ' raise a "LookupError" exception, to map the character ' 'to itself.\n' '\n' ' You can use "str.maketrans()" to create a translation ' 'map from\n' ' character-to-character mappings in different formats.\n' '\n' ' See also the "codecs" module for a more flexible ' 'approach to custom\n' ' character mappings.\n' '\n' 'str.upper()\n' '\n' ' Return a copy of the string with all the cased ' 'characters [4]\n' ' converted to uppercase. Note that ' '"s.upper().isupper()" might be\n' ' "False" if "s" contains uncased characters or if the ' 'Unicode\n' ' category of the resulting character(s) is not “Lu” ' '(Letter,\n' ' uppercase), but e.g. “Lt” (Letter, titlecase).\n' '\n' ' The uppercasing algorithm used is described in section ' '3.13 of the\n' ' Unicode Standard.\n' '\n' 'str.zfill(width)\n' '\n' ' Return a copy of the string left filled with ASCII ' '"\'0\'" digits to\n' ' make a string of length *width*. A leading sign prefix\n' ' ("\'+\'"/"\'-\'") is handled by inserting the padding ' '*after* the sign\n' ' character rather than before. The original string is ' 'returned if\n' ' *width* is less than or equal to "len(s)".\n' '\n' ' For example:\n' '\n' ' >>> "42".zfill(5)\n' " '00042'\n" ' >>> "-42".zfill(5)\n' " '-0042'\n", 'strings': 'String and Bytes literals\n' '*************************\n' '\n' 'String literals are described by the following lexical ' 'definitions:\n' '\n' ' stringliteral ::= [stringprefix](shortstring | longstring)\n' ' stringprefix ::= "r" | "u" | "R" | "U" | "f" | "F"\n' ' | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | ' '"Rf" | "RF"\n' ' shortstring ::= "\'" shortstringitem* "\'" | \'"\' ' 'shortstringitem* \'"\'\n' ' longstring ::= "\'\'\'" longstringitem* "\'\'\'" | ' '\'"""\' longstringitem* \'"""\'\n' ' shortstringitem ::= shortstringchar | stringescapeseq\n' ' longstringitem ::= longstringchar | stringescapeseq\n' ' shortstringchar ::= <any source character except "\\" or ' 'newline or the quote>\n' ' longstringchar ::= <any source character except "\\">\n' ' stringescapeseq ::= "\\" <any source character>\n' '\n' ' bytesliteral ::= bytesprefix(shortbytes | longbytes)\n' ' bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | ' '"rb" | "rB" | "Rb" | "RB"\n' ' shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' ' 'shortbytesitem* \'"\'\n' ' longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' ' 'longbytesitem* \'"""\'\n' ' shortbytesitem ::= shortbyteschar | bytesescapeseq\n' ' longbytesitem ::= longbyteschar | bytesescapeseq\n' ' shortbyteschar ::= <any ASCII character except "\\" or newline ' 'or the quote>\n' ' longbyteschar ::= <any ASCII character except "\\">\n' ' bytesescapeseq ::= "\\" <any ASCII character>\n' '\n' 'One syntactic restriction not indicated by these productions is ' 'that\n' 'whitespace is not allowed between the "stringprefix" or ' '"bytesprefix"\n' 'and the rest of the literal. The source character set is defined ' 'by\n' 'the encoding declaration; it is UTF-8 if no encoding declaration ' 'is\n' 'given in the source file; see section Encoding declarations.\n' '\n' 'In plain English: Both types of literals can be enclosed in ' 'matching\n' 'single quotes ("\'") or double quotes ("""). They can also be ' 'enclosed\n' 'in matching groups of three single or double quotes (these are\n' 'generally referred to as *triple-quoted strings*). The ' 'backslash\n' '("\\") character is used to escape characters that otherwise have ' 'a\n' 'special meaning, such as newline, backslash itself, or the quote\n' 'character.\n' '\n' 'Bytes literals are always prefixed with "\'b\'" or "\'B\'"; they ' 'produce\n' 'an instance of the "bytes" type instead of the "str" type. They ' 'may\n' 'only contain ASCII characters; bytes with a numeric value of 128 ' 'or\n' 'greater must be expressed with escapes.\n' '\n' 'Both string and bytes literals may optionally be prefixed with a\n' 'letter "\'r\'" or "\'R\'"; such strings are called *raw strings* ' 'and treat\n' 'backslashes as literal characters. As a result, in string ' 'literals,\n' '"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated ' 'specially.\n' 'Given that Python 2.x’s raw unicode literals behave differently ' 'than\n' 'Python 3.x’s the "\'ur\'" syntax is not supported.\n' '\n' 'New in version 3.3: The "\'rb\'" prefix of raw bytes literals has ' 'been\n' 'added as a synonym of "\'br\'".\n' '\n' 'New in version 3.3: Support for the unicode legacy literal\n' '("u\'value\'") was reintroduced to simplify the maintenance of ' 'dual\n' 'Python 2.x and 3.x codebases. See **PEP 414** for more ' 'information.\n' '\n' 'A string literal with "\'f\'" or "\'F\'" in its prefix is a ' '*formatted\n' 'string literal*; see Formatted string literals. The "\'f\'" may ' 'be\n' 'combined with "\'r\'", but not with "\'b\'" or "\'u\'", therefore ' 'raw\n' 'formatted strings are possible, but formatted bytes literals are ' 'not.\n' '\n' 'In triple-quoted literals, unescaped newlines and quotes are ' 'allowed\n' '(and are retained), except that three unescaped quotes in a row\n' 'terminate the literal. (A “quote” is the character used to open ' 'the\n' 'literal, i.e. either "\'" or """.)\n' '\n' 'Unless an "\'r\'" or "\'R\'" prefix is present, escape sequences ' 'in string\n' 'and bytes literals are interpreted according to rules similar to ' 'those\n' 'used by Standard C. The recognized escape sequences are:\n' '\n' '+-------------------+-----------------------------------+---------+\n' '| Escape Sequence | Meaning | Notes ' '|\n' '|===================|===================================|=========|\n' '| "\\newline" | Backslash and newline ignored ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\\\" | Backslash ("\\") ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\\'" | Single quote ("\'") ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\"" | Double quote (""") ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\a" | ASCII Bell (BEL) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\b" | ASCII Backspace (BS) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\f" | ASCII Formfeed (FF) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\n" | ASCII Linefeed (LF) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\r" | ASCII Carriage Return (CR) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\t" | ASCII Horizontal Tab (TAB) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\v" | ASCII Vertical Tab (VT) ' '| |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\ooo" | Character with octal value *ooo* | ' '(1,3) |\n' '+-------------------+-----------------------------------+---------+\n' '| "\\xhh" | Character with hex value *hh* | ' '(2,3) |\n' '+-------------------+-----------------------------------+---------+\n' '\n' 'Escape sequences only recognized in string literals are:\n' '\n' '+-------------------+-----------------------------------+---------+\n' '| Escape Sequence | Meaning | Notes ' '|\n' '|===================|===================================|=========|\n' '| "\\N{name}" | Character named *name* in the | ' '(4) |\n' '| | Unicode database | ' '|\n' '+-------------------+-----------------------------------+---------+\n' '| "\\uxxxx" | Character with 16-bit hex value | ' '(5) |\n' '| | *xxxx* | ' '|\n' '+-------------------+-----------------------------------+---------+\n' '| "\\Uxxxxxxxx" | Character with 32-bit hex value | ' '(6) |\n' '| | *xxxxxxxx* | ' '|\n' '+-------------------+-----------------------------------+---------+\n' '\n' 'Notes:\n' '\n' '1. As in Standard C, up to three octal digits are accepted.\n' '\n' '2. Unlike in Standard C, exactly two hex digits are required.\n' '\n' '3. In a bytes literal, hexadecimal and octal escapes denote the ' 'byte\n' ' with the given value. In a string literal, these escapes ' 'denote a\n' ' Unicode character with the given value.\n' '\n' '4. Changed in version 3.3: Support for name aliases [1] has been\n' ' added.\n' '\n' '5. Exactly four hex digits are required.\n' '\n' '6. Any Unicode character can be encoded this way. Exactly eight ' 'hex\n' ' digits are required.\n' '\n' 'Unlike Standard C, all unrecognized escape sequences are left in ' 'the\n' 'string unchanged, i.e., *the backslash is left in the result*. ' '(This\n' 'behavior is useful when debugging: if an escape sequence is ' 'mistyped,\n' 'the resulting output is more easily recognized as broken.) It is ' 'also\n' 'important to note that the escape sequences only recognized in ' 'string\n' 'literals fall into the category of unrecognized escapes for ' 'bytes\n' 'literals.\n' '\n' ' Changed in version 3.6: Unrecognized escape sequences produce ' 'a\n' ' DeprecationWarning. In some future version of Python they ' 'will be\n' ' a SyntaxError.\n' '\n' 'Even in a raw literal, quotes can be escaped with a backslash, ' 'but the\n' 'backslash remains in the result; for example, "r"\\""" is a ' 'valid\n' 'string literal consisting of two characters: a backslash and a ' 'double\n' 'quote; "r"\\"" is not a valid string literal (even a raw string ' 'cannot\n' 'end in an odd number of backslashes). Specifically, *a raw ' 'literal\n' 'cannot end in a single backslash* (since the backslash would ' 'escape\n' 'the following quote character). Note also that a single ' 'backslash\n' 'followed by a newline is interpreted as those two characters as ' 'part\n' 'of the literal, *not* as a line continuation.\n', 'subscriptions': 'Subscriptions\n' '*************\n' '\n' 'A subscription selects an item of a sequence (string, tuple ' 'or list)\n' 'or mapping (dictionary) object:\n' '\n' ' subscription ::= primary "[" expression_list "]"\n' '\n' 'The primary must evaluate to an object that supports ' 'subscription\n' '(lists or dictionaries for example). User-defined objects ' 'can support\n' 'subscription by defining a "__getitem__()" method.\n' '\n' 'For built-in objects, there are two types of objects that ' 'support\n' 'subscription:\n' '\n' 'If the primary is a mapping, the expression list must ' 'evaluate to an\n' 'object whose value is one of the keys of the mapping, and ' 'the\n' 'subscription selects the value in the mapping that ' 'corresponds to that\n' 'key. (The expression list is a tuple except if it has ' 'exactly one\n' 'item.)\n' '\n' 'If the primary is a sequence, the expression list must ' 'evaluate to an\n' 'integer or a slice (as discussed in the following ' 'section).\n' '\n' 'The formal syntax makes no special provision for negative ' 'indices in\n' 'sequences; however, built-in sequences all provide a ' '"__getitem__()"\n' 'method that interprets negative indices by adding the ' 'length of the\n' 'sequence to the index (so that "x[-1]" selects the last ' 'item of "x").\n' 'The resulting value must be a nonnegative integer less than ' 'the number\n' 'of items in the sequence, and the subscription selects the ' 'item whose\n' 'index is that value (counting from zero). Since the support ' 'for\n' 'negative indices and slicing occurs in the object’s ' '"__getitem__()"\n' 'method, subclasses overriding this method will need to ' 'explicitly add\n' 'that support.\n' '\n' 'A string’s items are characters. A character is not a ' 'separate data\n' 'type but a string of exactly one character.\n', 'truth': 'Truth Value Testing\n' '*******************\n' '\n' 'Any object can be tested for truth value, for use in an "if" or\n' '"while" condition or as operand of the Boolean operations below.\n' '\n' 'By default, an object is considered true unless its class defines\n' 'either a "__bool__()" method that returns "False" or a "__len__()"\n' 'method that returns zero, when called with the object. [1] Here ' 'are\n' 'most of the built-in objects considered false:\n' '\n' '* constants defined to be false: "None" and "False".\n' '\n' '* zero of any numeric type: "0", "0.0", "0j", "Decimal(0)",\n' ' "Fraction(0, 1)"\n' '\n' '* empty sequences and collections: "\'\'", "()", "[]", "{}", ' '"set()",\n' ' "range(0)"\n' '\n' 'Operations and built-in functions that have a Boolean result ' 'always\n' 'return "0" or "False" for false and "1" or "True" for true, unless\n' 'otherwise stated. (Important exception: the Boolean operations ' '"or"\n' 'and "and" always return one of their operands.)\n', 'try': 'The "try" statement\n' '*******************\n' '\n' 'The "try" statement specifies exception handlers and/or cleanup code\n' 'for a group of statements:\n' '\n' ' try_stmt ::= try1_stmt | try2_stmt\n' ' try1_stmt ::= "try" ":" suite\n' ' ("except" [expression ["as" identifier]] ":" ' 'suite)+\n' ' ["else" ":" suite]\n' ' ["finally" ":" suite]\n' ' try2_stmt ::= "try" ":" suite\n' ' "finally" ":" suite\n' '\n' 'The "except" clause(s) specify one or more exception handlers. When ' 'no\n' 'exception occurs in the "try" clause, no exception handler is\n' 'executed. When an exception occurs in the "try" suite, a search for ' 'an\n' 'exception handler is started. This search inspects the except ' 'clauses\n' 'in turn until one is found that matches the exception. An ' 'expression-\n' 'less except clause, if present, must be last; it matches any\n' 'exception. For an except clause with an expression, that expression\n' 'is evaluated, and the clause matches the exception if the resulting\n' 'object is “compatible” with the exception. An object is compatible\n' 'with an exception if it is the class or a base class of the ' 'exception\n' 'object or a tuple containing an item compatible with the exception.\n' '\n' 'If no except clause matches the exception, the search for an ' 'exception\n' 'handler continues in the surrounding code and on the invocation ' 'stack.\n' '[1]\n' '\n' 'If the evaluation of an expression in the header of an except clause\n' 'raises an exception, the original search for a handler is canceled ' 'and\n' 'a search starts for the new exception in the surrounding code and on\n' 'the call stack (it is treated as if the entire "try" statement ' 'raised\n' 'the exception).\n' '\n' 'When a matching except clause is found, the exception is assigned to\n' 'the target specified after the "as" keyword in that except clause, ' 'if\n' 'present, and the except clause’s suite is executed. All except\n' 'clauses must have an executable block. When the end of this block ' 'is\n' 'reached, execution continues normally after the entire try ' 'statement.\n' '(This means that if two nested handlers exist for the same ' 'exception,\n' 'and the exception occurs in the try clause of the inner handler, the\n' 'outer handler will not handle the exception.)\n' '\n' 'When an exception has been assigned using "as target", it is cleared\n' 'at the end of the except clause. This is as if\n' '\n' ' except E as N:\n' ' foo\n' '\n' 'was translated to\n' '\n' ' except E as N:\n' ' try:\n' ' foo\n' ' finally:\n' ' del N\n' '\n' 'This means the exception must be assigned to a different name to be\n' 'able to refer to it after the except clause. Exceptions are cleared\n' 'because with the traceback attached to them, they form a reference\n' 'cycle with the stack frame, keeping all locals in that frame alive\n' 'until the next garbage collection occurs.\n' '\n' 'Before an except clause’s suite is executed, details about the\n' 'exception are stored in the "sys" module and can be accessed via\n' '"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of ' 'the\n' 'exception class, the exception instance and a traceback object (see\n' 'section The standard type hierarchy) identifying the point in the\n' 'program where the exception occurred. "sys.exc_info()" values are\n' 'restored to their previous values (before the call) when returning\n' 'from a function that handled an exception.\n' '\n' 'The optional "else" clause is executed if the control flow leaves ' 'the\n' '"try" suite, no exception was raised, and no "return", "continue", ' 'or\n' '"break" statement was executed. Exceptions in the "else" clause are\n' 'not handled by the preceding "except" clauses.\n' '\n' 'If "finally" is present, it specifies a ‘cleanup’ handler. The ' '"try"\n' 'clause is executed, including any "except" and "else" clauses. If ' 'an\n' 'exception occurs in any of the clauses and is not handled, the\n' 'exception is temporarily saved. The "finally" clause is executed. ' 'If\n' 'there is a saved exception it is re-raised at the end of the ' '"finally"\n' 'clause. If the "finally" clause raises another exception, the saved\n' 'exception is set as the context of the new exception. If the ' '"finally"\n' 'clause executes a "return" or "break" statement, the saved exception\n' 'is discarded:\n' '\n' ' >>> def f():\n' ' ... try:\n' ' ... 1/0\n' ' ... finally:\n' ' ... return 42\n' ' ...\n' ' >>> f()\n' ' 42\n' '\n' 'The exception information is not available to the program during\n' 'execution of the "finally" clause.\n' '\n' 'When a "return", "break" or "continue" statement is executed in the\n' '"try" suite of a "try"…"finally" statement, the "finally" clause is\n' 'also executed ‘on the way out.’ A "continue" statement is illegal in\n' 'the "finally" clause. (The reason is a problem with the current\n' 'implementation — this restriction may be lifted in the future).\n' '\n' 'The return value of a function is determined by the last "return"\n' 'statement executed. Since the "finally" clause always executes, a\n' '"return" statement executed in the "finally" clause will always be ' 'the\n' 'last one executed:\n' '\n' ' >>> def foo():\n' ' ... try:\n' " ... return 'try'\n" ' ... finally:\n' " ... return 'finally'\n" ' ...\n' ' >>> foo()\n' " 'finally'\n" '\n' 'Additional information on exceptions can be found in section\n' 'Exceptions, and information on using the "raise" statement to ' 'generate\n' 'exceptions may be found in section The raise statement.\n', 'types': 'The standard type hierarchy\n' '***************************\n' '\n' 'Below is a list of the types that are built into Python. ' 'Extension\n' 'modules (written in C, Java, or other languages, depending on the\n' 'implementation) can define additional types. Future versions of\n' 'Python may add types to the type hierarchy (e.g., rational ' 'numbers,\n' 'efficiently stored arrays of integers, etc.), although such ' 'additions\n' 'will often be provided via the standard library instead.\n' '\n' 'Some of the type descriptions below contain a paragraph listing\n' '‘special attributes.’ These are attributes that provide access to ' 'the\n' 'implementation and are not intended for general use. Their ' 'definition\n' 'may change in the future.\n' '\n' 'None\n' ' This type has a single value. There is a single object with ' 'this\n' ' value. This object is accessed through the built-in name "None". ' 'It\n' ' is used to signify the absence of a value in many situations, ' 'e.g.,\n' ' it is returned from functions that don’t explicitly return\n' ' anything. Its truth value is false.\n' '\n' 'NotImplemented\n' ' This type has a single value. There is a single object with ' 'this\n' ' value. This object is accessed through the built-in name\n' ' "NotImplemented". Numeric methods and rich comparison methods\n' ' should return this value if they do not implement the operation ' 'for\n' ' the operands provided. (The interpreter will then try the\n' ' reflected operation, or some other fallback, depending on the\n' ' operator.) Its truth value is true.\n' '\n' ' See Implementing the arithmetic operations for more details.\n' '\n' 'Ellipsis\n' ' This type has a single value. There is a single object with ' 'this\n' ' value. This object is accessed through the literal "..." or the\n' ' built-in name "Ellipsis". Its truth value is true.\n' '\n' '"numbers.Number"\n' ' These are created by numeric literals and returned as results ' 'by\n' ' arithmetic operators and arithmetic built-in functions. ' 'Numeric\n' ' objects are immutable; once created their value never changes.\n' ' Python numbers are of course strongly related to mathematical\n' ' numbers, but subject to the limitations of numerical ' 'representation\n' ' in computers.\n' '\n' ' Python distinguishes between integers, floating point numbers, ' 'and\n' ' complex numbers:\n' '\n' ' "numbers.Integral"\n' ' These represent elements from the mathematical set of ' 'integers\n' ' (positive and negative).\n' '\n' ' There are two types of integers:\n' '\n' ' Integers ("int")\n' '\n' ' These represent numbers in an unlimited range, subject to\n' ' available (virtual) memory only. For the purpose of ' 'shift\n' ' and mask operations, a binary representation is assumed, ' 'and\n' ' negative numbers are represented in a variant of 2’s\n' ' complement which gives the illusion of an infinite string ' 'of\n' ' sign bits extending to the left.\n' '\n' ' Booleans ("bool")\n' ' These represent the truth values False and True. The two\n' ' objects representing the values "False" and "True" are ' 'the\n' ' only Boolean objects. The Boolean type is a subtype of ' 'the\n' ' integer type, and Boolean values behave like the values 0 ' 'and\n' ' 1, respectively, in almost all contexts, the exception ' 'being\n' ' that when converted to a string, the strings ""False"" or\n' ' ""True"" are returned, respectively.\n' '\n' ' The rules for integer representation are intended to give ' 'the\n' ' most meaningful interpretation of shift and mask operations\n' ' involving negative integers.\n' '\n' ' "numbers.Real" ("float")\n' ' These represent machine-level double precision floating ' 'point\n' ' numbers. You are at the mercy of the underlying machine\n' ' architecture (and C or Java implementation) for the accepted\n' ' range and handling of overflow. Python does not support ' 'single-\n' ' precision floating point numbers; the savings in processor ' 'and\n' ' memory usage that are usually the reason for using these are\n' ' dwarfed by the overhead of using objects in Python, so there ' 'is\n' ' no reason to complicate the language with two kinds of ' 'floating\n' ' point numbers.\n' '\n' ' "numbers.Complex" ("complex")\n' ' These represent complex numbers as a pair of machine-level\n' ' double precision floating point numbers. The same caveats ' 'apply\n' ' as for floating point numbers. The real and imaginary parts ' 'of a\n' ' complex number "z" can be retrieved through the read-only\n' ' attributes "z.real" and "z.imag".\n' '\n' 'Sequences\n' ' These represent finite ordered sets indexed by non-negative\n' ' numbers. The built-in function "len()" returns the number of ' 'items\n' ' of a sequence. When the length of a sequence is *n*, the index ' 'set\n' ' contains the numbers 0, 1, …, *n*-1. Item *i* of sequence *a* ' 'is\n' ' selected by "a[i]".\n' '\n' ' Sequences also support slicing: "a[i:j]" selects all items with\n' ' index *k* such that *i* "<=" *k* "<" *j*. When used as an\n' ' expression, a slice is a sequence of the same type. This ' 'implies\n' ' that the index set is renumbered so that it starts at 0.\n' '\n' ' Some sequences also support “extended slicing” with a third ' '“step”\n' ' parameter: "a[i:j:k]" selects all items of *a* with index *x* ' 'where\n' ' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n' '\n' ' Sequences are distinguished according to their mutability:\n' '\n' ' Immutable sequences\n' ' An object of an immutable sequence type cannot change once it ' 'is\n' ' created. (If the object contains references to other ' 'objects,\n' ' these other objects may be mutable and may be changed; ' 'however,\n' ' the collection of objects directly referenced by an ' 'immutable\n' ' object cannot change.)\n' '\n' ' The following types are immutable sequences:\n' '\n' ' Strings\n' ' A string is a sequence of values that represent Unicode ' 'code\n' ' points. All the code points in the range "U+0000 - ' 'U+10FFFF"\n' ' can be represented in a string. Python doesn’t have a ' '"char"\n' ' type; instead, every code point in the string is ' 'represented\n' ' as a string object with length "1". The built-in ' 'function\n' ' "ord()" converts a code point from its string form to an\n' ' integer in the range "0 - 10FFFF"; "chr()" converts an\n' ' integer in the range "0 - 10FFFF" to the corresponding ' 'length\n' ' "1" string object. "str.encode()" can be used to convert ' 'a\n' ' "str" to "bytes" using the given text encoding, and\n' ' "bytes.decode()" can be used to achieve the opposite.\n' '\n' ' Tuples\n' ' The items of a tuple are arbitrary Python objects. Tuples ' 'of\n' ' two or more items are formed by comma-separated lists of\n' ' expressions. A tuple of one item (a ‘singleton’) can be\n' ' formed by affixing a comma to an expression (an expression ' 'by\n' ' itself does not create a tuple, since parentheses must be\n' ' usable for grouping of expressions). An empty tuple can ' 'be\n' ' formed by an empty pair of parentheses.\n' '\n' ' Bytes\n' ' A bytes object is an immutable array. The items are ' '8-bit\n' ' bytes, represented by integers in the range 0 <= x < 256.\n' ' Bytes literals (like "b\'abc\'") and the built-in ' '"bytes()"\n' ' constructor can be used to create bytes objects. Also, ' 'bytes\n' ' objects can be decoded to strings via the "decode()" ' 'method.\n' '\n' ' Mutable sequences\n' ' Mutable sequences can be changed after they are created. ' 'The\n' ' subscription and slicing notations can be used as the target ' 'of\n' ' assignment and "del" (delete) statements.\n' '\n' ' There are currently two intrinsic mutable sequence types:\n' '\n' ' Lists\n' ' The items of a list are arbitrary Python objects. Lists ' 'are\n' ' formed by placing a comma-separated list of expressions ' 'in\n' ' square brackets. (Note that there are no special cases ' 'needed\n' ' to form lists of length 0 or 1.)\n' '\n' ' Byte Arrays\n' ' A bytearray object is a mutable array. They are created ' 'by\n' ' the built-in "bytearray()" constructor. Aside from being\n' ' mutable (and hence unhashable), byte arrays otherwise ' 'provide\n' ' the same interface and functionality as immutable "bytes"\n' ' objects.\n' '\n' ' The extension module "array" provides an additional example ' 'of a\n' ' mutable sequence type, as does the "collections" module.\n' '\n' 'Set types\n' ' These represent unordered, finite sets of unique, immutable\n' ' objects. As such, they cannot be indexed by any subscript. ' 'However,\n' ' they can be iterated over, and the built-in function "len()"\n' ' returns the number of items in a set. Common uses for sets are ' 'fast\n' ' membership testing, removing duplicates from a sequence, and\n' ' computing mathematical operations such as intersection, union,\n' ' difference, and symmetric difference.\n' '\n' ' For set elements, the same immutability rules apply as for\n' ' dictionary keys. Note that numeric types obey the normal rules ' 'for\n' ' numeric comparison: if two numbers compare equal (e.g., "1" and\n' ' "1.0"), only one of them can be contained in a set.\n' '\n' ' There are currently two intrinsic set types:\n' '\n' ' Sets\n' ' These represent a mutable set. They are created by the ' 'built-in\n' ' "set()" constructor and can be modified afterwards by ' 'several\n' ' methods, such as "add()".\n' '\n' ' Frozen sets\n' ' These represent an immutable set. They are created by the\n' ' built-in "frozenset()" constructor. As a frozenset is ' 'immutable\n' ' and *hashable*, it can be used again as an element of ' 'another\n' ' set, or as a dictionary key.\n' '\n' 'Mappings\n' ' These represent finite sets of objects indexed by arbitrary ' 'index\n' ' sets. The subscript notation "a[k]" selects the item indexed by ' '"k"\n' ' from the mapping "a"; this can be used in expressions and as ' 'the\n' ' target of assignments or "del" statements. The built-in ' 'function\n' ' "len()" returns the number of items in a mapping.\n' '\n' ' There is currently a single intrinsic mapping type:\n' '\n' ' Dictionaries\n' ' These represent finite sets of objects indexed by nearly\n' ' arbitrary values. The only types of values not acceptable ' 'as\n' ' keys are values containing lists or dictionaries or other\n' ' mutable types that are compared by value rather than by ' 'object\n' ' identity, the reason being that the efficient implementation ' 'of\n' ' dictionaries requires a key’s hash value to remain constant.\n' ' Numeric types used for keys obey the normal rules for ' 'numeric\n' ' comparison: if two numbers compare equal (e.g., "1" and ' '"1.0")\n' ' then they can be used interchangeably to index the same\n' ' dictionary entry.\n' '\n' ' Dictionaries are mutable; they can be created by the "{...}"\n' ' notation (see section Dictionary displays).\n' '\n' ' The extension modules "dbm.ndbm" and "dbm.gnu" provide\n' ' additional examples of mapping types, as does the ' '"collections"\n' ' module.\n' '\n' 'Callable types\n' ' These are the types to which the function call operation (see\n' ' section Calls) can be applied:\n' '\n' ' User-defined functions\n' ' A user-defined function object is created by a function\n' ' definition (see section Function definitions). It should be\n' ' called with an argument list containing the same number of ' 'items\n' ' as the function’s formal parameter list.\n' '\n' ' Special attributes:\n' '\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | Attribute | Meaning ' '| |\n' ' ' '|===========================|=================================|=============|\n' ' | "__doc__" | The function’s documentation ' '| Writable |\n' ' | | string, or "None" if ' '| |\n' ' | | unavailable; not inherited by ' '| |\n' ' | | subclasses ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__name__" | The function’s name ' '| Writable |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__qualname__" | The function’s *qualified name* ' '| Writable |\n' ' | | New in version 3.3. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__module__" | The name of the module the ' '| Writable |\n' ' | | function was defined in, or ' '| |\n' ' | | "None" if unavailable. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__defaults__" | A tuple containing default ' '| Writable |\n' ' | | argument values for those ' '| |\n' ' | | arguments that have defaults, ' '| |\n' ' | | or "None" if no arguments have ' '| |\n' ' | | a default value ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__code__" | The code object representing ' '| Writable |\n' ' | | the compiled function body. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__globals__" | A reference to the dictionary ' '| Read-only |\n' ' | | that holds the function’s ' '| |\n' ' | | global variables — the global ' '| |\n' ' | | namespace of the module in ' '| |\n' ' | | which the function was defined. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__dict__" | The namespace supporting ' '| Writable |\n' ' | | arbitrary function attributes. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__closure__" | "None" or a tuple of cells that ' '| Read-only |\n' ' | | contain bindings for the ' '| |\n' ' | | function’s free variables. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__annotations__" | A dict containing annotations ' '| Writable |\n' ' | | of parameters. The keys of the ' '| |\n' ' | | dict are the parameter names, ' '| |\n' ' | | and "\'return\'" for the ' 'return | |\n' ' | | annotation, if provided. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' ' | "__kwdefaults__" | A dict containing defaults for ' '| Writable |\n' ' | | keyword-only parameters. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' '\n' ' Most of the attributes labelled “Writable” check the type of ' 'the\n' ' assigned value.\n' '\n' ' Function objects also support getting and setting arbitrary\n' ' attributes, which can be used, for example, to attach ' 'metadata\n' ' to functions. Regular attribute dot-notation is used to get ' 'and\n' ' set such attributes. *Note that the current implementation ' 'only\n' ' supports function attributes on user-defined functions. ' 'Function\n' ' attributes on built-in functions may be supported in the\n' ' future.*\n' '\n' ' Additional information about a function’s definition can be\n' ' retrieved from its code object; see the description of ' 'internal\n' ' types below.\n' '\n' ' Instance methods\n' ' An instance method object combines a class, a class instance ' 'and\n' ' any callable object (normally a user-defined function).\n' '\n' ' Special read-only attributes: "__self__" is the class ' 'instance\n' ' object, "__func__" is the function object; "__doc__" is the\n' ' method’s documentation (same as "__func__.__doc__"); ' '"__name__"\n' ' is the method name (same as "__func__.__name__"); ' '"__module__"\n' ' is the name of the module the method was defined in, or ' '"None"\n' ' if unavailable.\n' '\n' ' Methods also support accessing (but not setting) the ' 'arbitrary\n' ' function attributes on the underlying function object.\n' '\n' ' User-defined method objects may be created when getting an\n' ' attribute of a class (perhaps via an instance of that class), ' 'if\n' ' that attribute is a user-defined function object or a class\n' ' method object.\n' '\n' ' When an instance method object is created by retrieving a ' 'user-\n' ' defined function object from a class via one of its ' 'instances,\n' ' its "__self__" attribute is the instance, and the method ' 'object\n' ' is said to be bound. The new method’s "__func__" attribute ' 'is\n' ' the original function object.\n' '\n' ' When a user-defined method object is created by retrieving\n' ' another method object from a class or instance, the behaviour ' 'is\n' ' the same as for a function object, except that the ' '"__func__"\n' ' attribute of the new instance is not the original method ' 'object\n' ' but its "__func__" attribute.\n' '\n' ' When an instance method object is created by retrieving a ' 'class\n' ' method object from a class or instance, its "__self__" ' 'attribute\n' ' is the class itself, and its "__func__" attribute is the\n' ' function object underlying the class method.\n' '\n' ' When an instance method object is called, the underlying\n' ' function ("__func__") is called, inserting the class ' 'instance\n' ' ("__self__") in front of the argument list. For instance, ' 'when\n' ' "C" is a class which contains a definition for a function ' '"f()",\n' ' and "x" is an instance of "C", calling "x.f(1)" is equivalent ' 'to\n' ' calling "C.f(x, 1)".\n' '\n' ' When an instance method object is derived from a class ' 'method\n' ' object, the “class instance” stored in "__self__" will ' 'actually\n' ' be the class itself, so that calling either "x.f(1)" or ' '"C.f(1)"\n' ' is equivalent to calling "f(C,1)" where "f" is the ' 'underlying\n' ' function.\n' '\n' ' Note that the transformation from function object to ' 'instance\n' ' method object happens each time the attribute is retrieved ' 'from\n' ' the instance. In some cases, a fruitful optimization is to\n' ' assign the attribute to a local variable and call that local\n' ' variable. Also notice that this transformation only happens ' 'for\n' ' user-defined functions; other callable objects (and all non-\n' ' callable objects) are retrieved without transformation. It ' 'is\n' ' also important to note that user-defined functions which are\n' ' attributes of a class instance are not converted to bound\n' ' methods; this *only* happens when the function is an ' 'attribute\n' ' of the class.\n' '\n' ' Generator functions\n' ' A function or method which uses the "yield" statement (see\n' ' section The yield statement) is called a *generator ' 'function*.\n' ' Such a function, when called, always returns an iterator ' 'object\n' ' which can be used to execute the body of the function: ' 'calling\n' ' the iterator’s "iterator.__next__()" method will cause the\n' ' function to execute until it provides a value using the ' '"yield"\n' ' statement. When the function executes a "return" statement ' 'or\n' ' falls off the end, a "StopIteration" exception is raised and ' 'the\n' ' iterator will have reached the end of the set of values to ' 'be\n' ' returned.\n' '\n' ' Coroutine functions\n' ' A function or method which is defined using "async def" is\n' ' called a *coroutine function*. Such a function, when ' 'called,\n' ' returns a *coroutine* object. It may contain "await"\n' ' expressions, as well as "async with" and "async for" ' 'statements.\n' ' See also the Coroutine Objects section.\n' '\n' ' Asynchronous generator functions\n' ' A function or method which is defined using "async def" and\n' ' which uses the "yield" statement is called a *asynchronous\n' ' generator function*. Such a function, when called, returns ' 'an\n' ' asynchronous iterator object which can be used in an "async ' 'for"\n' ' statement to execute the body of the function.\n' '\n' ' Calling the asynchronous iterator’s "aiterator.__anext__()"\n' ' method will return an *awaitable* which when awaited will\n' ' execute until it provides a value using the "yield" ' 'expression.\n' ' When the function executes an empty "return" statement or ' 'falls\n' ' off the end, a "StopAsyncIteration" exception is raised and ' 'the\n' ' asynchronous iterator will have reached the end of the set ' 'of\n' ' values to be yielded.\n' '\n' ' Built-in functions\n' ' A built-in function object is a wrapper around a C function.\n' ' Examples of built-in functions are "len()" and "math.sin()"\n' ' ("math" is a standard built-in module). The number and type ' 'of\n' ' the arguments are determined by the C function. Special ' 'read-\n' ' only attributes: "__doc__" is the function’s documentation\n' ' string, or "None" if unavailable; "__name__" is the ' 'function’s\n' ' name; "__self__" is set to "None" (but see the next item);\n' ' "__module__" is the name of the module the function was ' 'defined\n' ' in or "None" if unavailable.\n' '\n' ' Built-in methods\n' ' This is really a different disguise of a built-in function, ' 'this\n' ' time containing an object passed to the C function as an\n' ' implicit extra argument. An example of a built-in method is\n' ' "alist.append()", assuming *alist* is a list object. In this\n' ' case, the special read-only attribute "__self__" is set to ' 'the\n' ' object denoted by *alist*.\n' '\n' ' Classes\n' ' Classes are callable. These objects normally act as ' 'factories\n' ' for new instances of themselves, but variations are possible ' 'for\n' ' class types that override "__new__()". The arguments of the\n' ' call are passed to "__new__()" and, in the typical case, to\n' ' "__init__()" to initialize the new instance.\n' '\n' ' Class Instances\n' ' Instances of arbitrary classes can be made callable by ' 'defining\n' ' a "__call__()" method in their class.\n' '\n' 'Modules\n' ' Modules are a basic organizational unit of Python code, and are\n' ' created by the import system as invoked either by the "import"\n' ' statement (see "import"), or by calling functions such as\n' ' "importlib.import_module()" and built-in "__import__()". A ' 'module\n' ' object has a namespace implemented by a dictionary object (this ' 'is\n' ' the dictionary referenced by the "__globals__" attribute of\n' ' functions defined in the module). Attribute references are\n' ' translated to lookups in this dictionary, e.g., "m.x" is ' 'equivalent\n' ' to "m.__dict__["x"]". A module object does not contain the code\n' ' object used to initialize the module (since it isn’t needed ' 'once\n' ' the initialization is done).\n' '\n' ' Attribute assignment updates the module’s namespace dictionary,\n' ' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n' '\n' ' Predefined (writable) attributes: "__name__" is the module’s ' 'name;\n' ' "__doc__" is the module’s documentation string, or "None" if\n' ' unavailable; "__annotations__" (optional) is a dictionary\n' ' containing *variable annotations* collected during module body\n' ' execution; "__file__" is the pathname of the file from which ' 'the\n' ' module was loaded, if it was loaded from a file. The "__file__"\n' ' attribute may be missing for certain types of modules, such as ' 'C\n' ' modules that are statically linked into the interpreter; for\n' ' extension modules loaded dynamically from a shared library, it ' 'is\n' ' the pathname of the shared library file.\n' '\n' ' Special read-only attribute: "__dict__" is the module’s ' 'namespace\n' ' as a dictionary object.\n' '\n' ' **CPython implementation detail:** Because of the way CPython\n' ' clears module dictionaries, the module dictionary will be ' 'cleared\n' ' when the module falls out of scope even if the dictionary still ' 'has\n' ' live references. To avoid this, copy the dictionary or keep ' 'the\n' ' module around while using its dictionary directly.\n' '\n' 'Custom classes\n' ' Custom class types are typically created by class definitions ' '(see\n' ' section Class definitions). A class has a namespace implemented ' 'by\n' ' a dictionary object. Class attribute references are translated ' 'to\n' ' lookups in this dictionary, e.g., "C.x" is translated to\n' ' "C.__dict__["x"]" (although there are a number of hooks which ' 'allow\n' ' for other means of locating attributes). When the attribute name ' 'is\n' ' not found there, the attribute search continues in the base\n' ' classes. This search of the base classes uses the C3 method\n' ' resolution order which behaves correctly even in the presence ' 'of\n' ' ‘diamond’ inheritance structures where there are multiple\n' ' inheritance paths leading back to a common ancestor. Additional\n' ' details on the C3 MRO used by Python can be found in the\n' ' documentation accompanying the 2.3 release at\n' ' https://www.python.org/download/releases/2.3/mro/.\n' '\n' ' When a class attribute reference (for class "C", say) would ' 'yield a\n' ' class method object, it is transformed into an instance method\n' ' object whose "__self__" attribute is "C". When it would yield ' 'a\n' ' static method object, it is transformed into the object wrapped ' 'by\n' ' the static method object. See section Implementing Descriptors ' 'for\n' ' another way in which attributes retrieved from a class may ' 'differ\n' ' from those actually contained in its "__dict__".\n' '\n' ' Class attribute assignments update the class’s dictionary, ' 'never\n' ' the dictionary of a base class.\n' '\n' ' A class object can be called (see above) to yield a class ' 'instance\n' ' (see below).\n' '\n' ' Special attributes: "__name__" is the class name; "__module__" ' 'is\n' ' the module name in which the class was defined; "__dict__" is ' 'the\n' ' dictionary containing the class’s namespace; "__bases__" is a ' 'tuple\n' ' containing the base classes, in the order of their occurrence ' 'in\n' ' the base class list; "__doc__" is the class’s documentation ' 'string,\n' ' or "None" if undefined; "__annotations__" (optional) is a\n' ' dictionary containing *variable annotations* collected during ' 'class\n' ' body execution.\n' '\n' 'Class instances\n' ' A class instance is created by calling a class object (see ' 'above).\n' ' A class instance has a namespace implemented as a dictionary ' 'which\n' ' is the first place in which attribute references are searched.\n' ' When an attribute is not found there, and the instance’s class ' 'has\n' ' an attribute by that name, the search continues with the class\n' ' attributes. If a class attribute is found that is a ' 'user-defined\n' ' function object, it is transformed into an instance method ' 'object\n' ' whose "__self__" attribute is the instance. Static method and\n' ' class method objects are also transformed; see above under\n' ' “Classes”. See section Implementing Descriptors for another way ' 'in\n' ' which attributes of a class retrieved via its instances may ' 'differ\n' ' from the objects actually stored in the class’s "__dict__". If ' 'no\n' ' class attribute is found, and the object’s class has a\n' ' "__getattr__()" method, that is called to satisfy the lookup.\n' '\n' ' Attribute assignments and deletions update the instance’s\n' ' dictionary, never a class’s dictionary. If the class has a\n' ' "__setattr__()" or "__delattr__()" method, this is called ' 'instead\n' ' of updating the instance dictionary directly.\n' '\n' ' Class instances can pretend to be numbers, sequences, or ' 'mappings\n' ' if they have methods with certain special names. See section\n' ' Special method names.\n' '\n' ' Special attributes: "__dict__" is the attribute dictionary;\n' ' "__class__" is the instance’s class.\n' '\n' 'I/O objects (also known as file objects)\n' ' A *file object* represents an open file. Various shortcuts are\n' ' available to create file objects: the "open()" built-in ' 'function,\n' ' and also "os.popen()", "os.fdopen()", and the "makefile()" ' 'method\n' ' of socket objects (and perhaps by other functions or methods\n' ' provided by extension modules).\n' '\n' ' The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n' ' initialized to file objects corresponding to the interpreter’s\n' ' standard input, output and error streams; they are all open in ' 'text\n' ' mode and therefore follow the interface defined by the\n' ' "io.TextIOBase" abstract class.\n' '\n' 'Internal types\n' ' A few types used internally by the interpreter are exposed to ' 'the\n' ' user. Their definitions may change with future versions of the\n' ' interpreter, but they are mentioned here for completeness.\n' '\n' ' Code objects\n' ' Code objects represent *byte-compiled* executable Python ' 'code,\n' ' or *bytecode*. The difference between a code object and a\n' ' function object is that the function object contains an ' 'explicit\n' ' reference to the function’s globals (the module in which it ' 'was\n' ' defined), while a code object contains no context; also the\n' ' default argument values are stored in the function object, ' 'not\n' ' in the code object (because they represent values calculated ' 'at\n' ' run-time). Unlike function objects, code objects are ' 'immutable\n' ' and contain no references (directly or indirectly) to ' 'mutable\n' ' objects.\n' '\n' ' Special read-only attributes: "co_name" gives the function ' 'name;\n' ' "co_argcount" is the number of positional arguments ' '(including\n' ' arguments with default values); "co_nlocals" is the number ' 'of\n' ' local variables used by the function (including arguments);\n' ' "co_varnames" is a tuple containing the names of the local\n' ' variables (starting with the argument names); "co_cellvars" ' 'is a\n' ' tuple containing the names of local variables that are\n' ' referenced by nested functions; "co_freevars" is a tuple\n' ' containing the names of free variables; "co_code" is a ' 'string\n' ' representing the sequence of bytecode instructions; ' '"co_consts"\n' ' is a tuple containing the literals used by the bytecode;\n' ' "co_names" is a tuple containing the names used by the ' 'bytecode;\n' ' "co_filename" is the filename from which the code was ' 'compiled;\n' ' "co_firstlineno" is the first line number of the function;\n' ' "co_lnotab" is a string encoding the mapping from bytecode\n' ' offsets to line numbers (for details see the source code of ' 'the\n' ' interpreter); "co_stacksize" is the required stack size\n' ' (including local variables); "co_flags" is an integer ' 'encoding a\n' ' number of flags for the interpreter.\n' '\n' ' The following flag bits are defined for "co_flags": bit ' '"0x04"\n' ' is set if the function uses the "*arguments" syntax to accept ' 'an\n' ' arbitrary number of positional arguments; bit "0x08" is set ' 'if\n' ' the function uses the "**keywords" syntax to accept ' 'arbitrary\n' ' keyword arguments; bit "0x20" is set if the function is a\n' ' generator.\n' '\n' ' Future feature declarations ("from __future__ import ' 'division")\n' ' also use bits in "co_flags" to indicate whether a code ' 'object\n' ' was compiled with a particular feature enabled: bit "0x2000" ' 'is\n' ' set if the function was compiled with future division ' 'enabled;\n' ' bits "0x10" and "0x1000" were used in earlier versions of\n' ' Python.\n' '\n' ' Other bits in "co_flags" are reserved for internal use.\n' '\n' ' If a code object represents a function, the first item in\n' ' "co_consts" is the documentation string of the function, or\n' ' "None" if undefined.\n' '\n' ' Frame objects\n' ' Frame objects represent execution frames. They may occur in\n' ' traceback objects (see below).\n' '\n' ' Special read-only attributes: "f_back" is to the previous ' 'stack\n' ' frame (towards the caller), or "None" if this is the bottom\n' ' stack frame; "f_code" is the code object being executed in ' 'this\n' ' frame; "f_locals" is the dictionary used to look up local\n' ' variables; "f_globals" is used for global variables;\n' ' "f_builtins" is used for built-in (intrinsic) names; ' '"f_lasti"\n' ' gives the precise instruction (this is an index into the\n' ' bytecode string of the code object).\n' '\n' ' Special writable attributes: "f_trace", if not "None", is a\n' ' function called at the start of each source code line (this ' 'is\n' ' used by the debugger); "f_lineno" is the current line number ' 'of\n' ' the frame — writing to this from within a trace function ' 'jumps\n' ' to the given line (only for the bottom-most frame). A ' 'debugger\n' ' can implement a Jump command (aka Set Next Statement) by ' 'writing\n' ' to f_lineno.\n' '\n' ' Frame objects support one method:\n' '\n' ' frame.clear()\n' '\n' ' This method clears all references to local variables held ' 'by\n' ' the frame. Also, if the frame belonged to a generator, ' 'the\n' ' generator is finalized. This helps break reference ' 'cycles\n' ' involving frame objects (for example when catching an\n' ' exception and storing its traceback for later use).\n' '\n' ' "RuntimeError" is raised if the frame is currently ' 'executing.\n' '\n' ' New in version 3.4.\n' '\n' ' Traceback objects\n' ' Traceback objects represent a stack trace of an exception. ' 'A\n' ' traceback object is created when an exception occurs. When ' 'the\n' ' search for an exception handler unwinds the execution stack, ' 'at\n' ' each unwound level a traceback object is inserted in front ' 'of\n' ' the current traceback. When an exception handler is ' 'entered,\n' ' the stack trace is made available to the program. (See ' 'section\n' ' The try statement.) It is accessible as the third item of ' 'the\n' ' tuple returned by "sys.exc_info()". When the program contains ' 'no\n' ' suitable handler, the stack trace is written (nicely ' 'formatted)\n' ' to the standard error stream; if the interpreter is ' 'interactive,\n' ' it is also made available to the user as ' '"sys.last_traceback".\n' '\n' ' Special read-only attributes: "tb_next" is the next level in ' 'the\n' ' stack trace (towards the frame where the exception occurred), ' 'or\n' ' "None" if there is no next level; "tb_frame" points to the\n' ' execution frame of the current level; "tb_lineno" gives the ' 'line\n' ' number where the exception occurred; "tb_lasti" indicates ' 'the\n' ' precise instruction. The line number and last instruction ' 'in\n' ' the traceback may differ from the line number of its frame\n' ' object if the exception occurred in a "try" statement with ' 'no\n' ' matching except clause or with a finally clause.\n' '\n' ' Slice objects\n' ' Slice objects are used to represent slices for ' '"__getitem__()"\n' ' methods. They are also created by the built-in "slice()"\n' ' function.\n' '\n' ' Special read-only attributes: "start" is the lower bound; ' '"stop"\n' ' is the upper bound; "step" is the step value; each is "None" ' 'if\n' ' omitted. These attributes can have any type.\n' '\n' ' Slice objects support one method:\n' '\n' ' slice.indices(self, length)\n' '\n' ' This method takes a single integer argument *length* and\n' ' computes information about the slice that the slice ' 'object\n' ' would describe if applied to a sequence of *length* ' 'items.\n' ' It returns a tuple of three integers; respectively these ' 'are\n' ' the *start* and *stop* indices and the *step* or stride\n' ' length of the slice. Missing or out-of-bounds indices are\n' ' handled in a manner consistent with regular slices.\n' '\n' ' Static method objects\n' ' Static method objects provide a way of defeating the\n' ' transformation of function objects to method objects ' 'described\n' ' above. A static method object is a wrapper around any other\n' ' object, usually a user-defined method object. When a static\n' ' method object is retrieved from a class or a class instance, ' 'the\n' ' object actually returned is the wrapped object, which is not\n' ' subject to any further transformation. Static method objects ' 'are\n' ' not themselves callable, although the objects they wrap ' 'usually\n' ' are. Static method objects are created by the built-in\n' ' "staticmethod()" constructor.\n' '\n' ' Class method objects\n' ' A class method object, like a static method object, is a ' 'wrapper\n' ' around another object that alters the way in which that ' 'object\n' ' is retrieved from classes and class instances. The behaviour ' 'of\n' ' class method objects upon such retrieval is described above,\n' ' under “User-defined methods”. Class method objects are ' 'created\n' ' by the built-in "classmethod()" constructor.\n', 'typesfunctions': 'Functions\n' '*********\n' '\n' 'Function objects are created by function definitions. The ' 'only\n' 'operation on a function object is to call it: ' '"func(argument-list)".\n' '\n' 'There are really two flavors of function objects: built-in ' 'functions\n' 'and user-defined functions. Both support the same ' 'operation (to call\n' 'the function), but the implementation is different, hence ' 'the\n' 'different object types.\n' '\n' 'See Function definitions for more information.\n', 'typesmapping': 'Mapping Types — "dict"\n' '**********************\n' '\n' 'A *mapping* object maps *hashable* values to arbitrary ' 'objects.\n' 'Mappings are mutable objects. There is currently only one ' 'standard\n' 'mapping type, the *dictionary*. (For other containers see ' 'the built-\n' 'in "list", "set", and "tuple" classes, and the "collections" ' 'module.)\n' '\n' 'A dictionary’s keys are *almost* arbitrary values. Values ' 'that are\n' 'not *hashable*, that is, values containing lists, ' 'dictionaries or\n' 'other mutable types (that are compared by value rather than ' 'by object\n' 'identity) may not be used as keys. Numeric types used for ' 'keys obey\n' 'the normal rules for numeric comparison: if two numbers ' 'compare equal\n' '(such as "1" and "1.0") then they can be used ' 'interchangeably to index\n' 'the same dictionary entry. (Note however, that since ' 'computers store\n' 'floating-point numbers as approximations it is usually ' 'unwise to use\n' 'them as dictionary keys.)\n' '\n' 'Dictionaries can be created by placing a comma-separated ' 'list of "key:\n' 'value" pairs within braces, for example: "{\'jack\': 4098, ' "'sjoerd':\n" '4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the ' '"dict"\n' 'constructor.\n' '\n' 'class dict(**kwarg)\n' 'class dict(mapping, **kwarg)\n' 'class dict(iterable, **kwarg)\n' '\n' ' Return a new dictionary initialized from an optional ' 'positional\n' ' argument and a possibly empty set of keyword arguments.\n' '\n' ' If no positional argument is given, an empty dictionary ' 'is created.\n' ' If a positional argument is given and it is a mapping ' 'object, a\n' ' dictionary is created with the same key-value pairs as ' 'the mapping\n' ' object. Otherwise, the positional argument must be an ' '*iterable*\n' ' object. Each item in the iterable must itself be an ' 'iterable with\n' ' exactly two objects. The first object of each item ' 'becomes a key\n' ' in the new dictionary, and the second object the ' 'corresponding\n' ' value. If a key occurs more than once, the last value ' 'for that key\n' ' becomes the corresponding value in the new dictionary.\n' '\n' ' If keyword arguments are given, the keyword arguments and ' 'their\n' ' values are added to the dictionary created from the ' 'positional\n' ' argument. If a key being added is already present, the ' 'value from\n' ' the keyword argument replaces the value from the ' 'positional\n' ' argument.\n' '\n' ' To illustrate, the following examples all return a ' 'dictionary equal\n' ' to "{"one": 1, "two": 2, "three": 3}":\n' '\n' ' >>> a = dict(one=1, two=2, three=3)\n' " >>> b = {'one': 1, 'two': 2, 'three': 3}\n" " >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" " >>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" " >>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" ' >>> a == b == c == d == e\n' ' True\n' '\n' ' Providing keyword arguments as in the first example only ' 'works for\n' ' keys that are valid Python identifiers. Otherwise, any ' 'valid keys\n' ' can be used.\n' '\n' ' These are the operations that dictionaries support (and ' 'therefore,\n' ' custom mapping types should support too):\n' '\n' ' len(d)\n' '\n' ' Return the number of items in the dictionary *d*.\n' '\n' ' d[key]\n' '\n' ' Return the item of *d* with key *key*. Raises a ' '"KeyError" if\n' ' *key* is not in the map.\n' '\n' ' If a subclass of dict defines a method "__missing__()" ' 'and *key*\n' ' is not present, the "d[key]" operation calls that ' 'method with\n' ' the key *key* as argument. The "d[key]" operation ' 'then returns\n' ' or raises whatever is returned or raised by the\n' ' "__missing__(key)" call. No other operations or ' 'methods invoke\n' ' "__missing__()". If "__missing__()" is not defined, ' '"KeyError"\n' ' is raised. "__missing__()" must be a method; it cannot ' 'be an\n' ' instance variable:\n' '\n' ' >>> class Counter(dict):\n' ' ... def __missing__(self, key):\n' ' ... return 0\n' ' >>> c = Counter()\n' " >>> c['red']\n" ' 0\n' " >>> c['red'] += 1\n" " >>> c['red']\n" ' 1\n' '\n' ' The example above shows part of the implementation of\n' ' "collections.Counter". A different "__missing__" ' 'method is used\n' ' by "collections.defaultdict".\n' '\n' ' d[key] = value\n' '\n' ' Set "d[key]" to *value*.\n' '\n' ' del d[key]\n' '\n' ' Remove "d[key]" from *d*. Raises a "KeyError" if ' '*key* is not\n' ' in the map.\n' '\n' ' key in d\n' '\n' ' Return "True" if *d* has a key *key*, else "False".\n' '\n' ' key not in d\n' '\n' ' Equivalent to "not key in d".\n' '\n' ' iter(d)\n' '\n' ' Return an iterator over the keys of the dictionary. ' 'This is a\n' ' shortcut for "iter(d.keys())".\n' '\n' ' clear()\n' '\n' ' Remove all items from the dictionary.\n' '\n' ' copy()\n' '\n' ' Return a shallow copy of the dictionary.\n' '\n' ' classmethod fromkeys(seq[, value])\n' '\n' ' Create a new dictionary with keys from *seq* and ' 'values set to\n' ' *value*.\n' '\n' ' "fromkeys()" is a class method that returns a new ' 'dictionary.\n' ' *value* defaults to "None".\n' '\n' ' get(key[, default])\n' '\n' ' Return the value for *key* if *key* is in the ' 'dictionary, else\n' ' *default*. If *default* is not given, it defaults to ' '"None", so\n' ' that this method never raises a "KeyError".\n' '\n' ' items()\n' '\n' ' Return a new view of the dictionary’s items ("(key, ' 'value)"\n' ' pairs). See the documentation of view objects.\n' '\n' ' keys()\n' '\n' ' Return a new view of the dictionary’s keys. See the\n' ' documentation of view objects.\n' '\n' ' pop(key[, default])\n' '\n' ' If *key* is in the dictionary, remove it and return ' 'its value,\n' ' else return *default*. If *default* is not given and ' '*key* is\n' ' not in the dictionary, a "KeyError" is raised.\n' '\n' ' popitem()\n' '\n' ' Remove and return an arbitrary "(key, value)" pair ' 'from the\n' ' dictionary.\n' '\n' ' "popitem()" is useful to destructively iterate over a\n' ' dictionary, as often used in set algorithms. If the ' 'dictionary\n' ' is empty, calling "popitem()" raises a "KeyError".\n' '\n' ' setdefault(key[, default])\n' '\n' ' If *key* is in the dictionary, return its value. If ' 'not, insert\n' ' *key* with a value of *default* and return *default*. ' '*default*\n' ' defaults to "None".\n' '\n' ' update([other])\n' '\n' ' Update the dictionary with the key/value pairs from ' '*other*,\n' ' overwriting existing keys. Return "None".\n' '\n' ' "update()" accepts either another dictionary object or ' 'an\n' ' iterable of key/value pairs (as tuples or other ' 'iterables of\n' ' length two). If keyword arguments are specified, the ' 'dictionary\n' ' is then updated with those key/value pairs: ' '"d.update(red=1,\n' ' blue=2)".\n' '\n' ' values()\n' '\n' ' Return a new view of the dictionary’s values. See ' 'the\n' ' documentation of view objects.\n' '\n' ' Dictionaries compare equal if and only if they have the ' 'same "(key,\n' ' value)" pairs. Order comparisons (‘<’, ‘<=’, ‘>=’, ‘>’) ' 'raise\n' ' "TypeError".\n' '\n' 'See also:\n' '\n' ' "types.MappingProxyType" can be used to create a read-only ' 'view of a\n' ' "dict".\n' '\n' '\n' 'Dictionary view objects\n' '=======================\n' '\n' 'The objects returned by "dict.keys()", "dict.values()" and\n' '"dict.items()" are *view objects*. They provide a dynamic ' 'view on the\n' 'dictionary’s entries, which means that when the dictionary ' 'changes,\n' 'the view reflects these changes.\n' '\n' 'Dictionary views can be iterated over to yield their ' 'respective data,\n' 'and support membership tests:\n' '\n' 'len(dictview)\n' '\n' ' Return the number of entries in the dictionary.\n' '\n' 'iter(dictview)\n' '\n' ' Return an iterator over the keys, values or items ' '(represented as\n' ' tuples of "(key, value)") in the dictionary.\n' '\n' ' Keys and values are iterated over in an arbitrary order ' 'which is\n' ' non-random, varies across Python implementations, and ' 'depends on\n' ' the dictionary’s history of insertions and deletions. If ' 'keys,\n' ' values and items views are iterated over with no ' 'intervening\n' ' modifications to the dictionary, the order of items will ' 'directly\n' ' correspond. This allows the creation of "(value, key)" ' 'pairs using\n' ' "zip()": "pairs = zip(d.values(), d.keys())". Another ' 'way to\n' ' create the same list is "pairs = [(v, k) for (k, v) in ' 'd.items()]".\n' '\n' ' Iterating views while adding or deleting entries in the ' 'dictionary\n' ' may raise a "RuntimeError" or fail to iterate over all ' 'entries.\n' '\n' 'x in dictview\n' '\n' ' Return "True" if *x* is in the underlying dictionary’s ' 'keys, values\n' ' or items (in the latter case, *x* should be a "(key, ' 'value)"\n' ' tuple).\n' '\n' 'Keys views are set-like since their entries are unique and ' 'hashable.\n' 'If all values are hashable, so that "(key, value)" pairs are ' 'unique\n' 'and hashable, then the items view is also set-like. (Values ' 'views are\n' 'not treated as set-like since the entries are generally not ' 'unique.)\n' 'For set-like views, all of the operations defined for the ' 'abstract\n' 'base class "collections.abc.Set" are available (for example, ' '"==",\n' '"<", or "^").\n' '\n' 'An example of dictionary view usage:\n' '\n' " >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, " "'spam': 500}\n" ' >>> keys = dishes.keys()\n' ' >>> values = dishes.values()\n' '\n' ' >>> # iteration\n' ' >>> n = 0\n' ' >>> for val in values:\n' ' ... n += val\n' ' >>> print(n)\n' ' 504\n' '\n' ' >>> # keys and values are iterated over in the same ' 'order\n' ' >>> list(keys)\n' " ['eggs', 'bacon', 'sausage', 'spam']\n" ' >>> list(values)\n' ' [2, 1, 1, 500]\n' '\n' ' >>> # view objects are dynamic and reflect dict changes\n' " >>> del dishes['eggs']\n" " >>> del dishes['sausage']\n" ' >>> list(keys)\n' " ['spam', 'bacon']\n" '\n' ' >>> # set operations\n' " >>> keys & {'eggs', 'bacon', 'salad'}\n" " {'bacon'}\n" " >>> keys ^ {'sausage', 'juice'}\n" " {'juice', 'sausage', 'bacon', 'spam'}\n", 'typesmethods': 'Methods\n' '*******\n' '\n' 'Methods are functions that are called using the attribute ' 'notation.\n' 'There are two flavors: built-in methods (such as "append()" ' 'on lists)\n' 'and class instance methods. Built-in methods are described ' 'with the\n' 'types that support them.\n' '\n' 'If you access a method (a function defined in a class ' 'namespace)\n' 'through an instance, you get a special object: a *bound ' 'method* (also\n' 'called *instance method*) object. When called, it will add ' 'the "self"\n' 'argument to the argument list. Bound methods have two ' 'special read-\n' 'only attributes: "m.__self__" is the object on which the ' 'method\n' 'operates, and "m.__func__" is the function implementing the ' 'method.\n' 'Calling "m(arg-1, arg-2, ..., arg-n)" is completely ' 'equivalent to\n' 'calling "m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)".\n' '\n' 'Like function objects, bound method objects support getting ' 'arbitrary\n' 'attributes. However, since method attributes are actually ' 'stored on\n' 'the underlying function object ("meth.__func__"), setting ' 'method\n' 'attributes on bound methods is disallowed. Attempting to ' 'set an\n' 'attribute on a method results in an "AttributeError" being ' 'raised. In\n' 'order to set a method attribute, you need to explicitly set ' 'it on the\n' 'underlying function object:\n' '\n' ' >>> class C:\n' ' ... def method(self):\n' ' ... pass\n' ' ...\n' ' >>> c = C()\n' " >>> c.method.whoami = 'my name is method' # can't set on " 'the method\n' ' Traceback (most recent call last):\n' ' File "<stdin>", line 1, in <module>\n' " AttributeError: 'method' object has no attribute " "'whoami'\n" " >>> c.method.__func__.whoami = 'my name is method'\n" ' >>> c.method.whoami\n' " 'my name is method'\n" '\n' 'See The standard type hierarchy for more information.\n', 'typesmodules': 'Modules\n' '*******\n' '\n' 'The only special operation on a module is attribute access: ' '"m.name",\n' 'where *m* is a module and *name* accesses a name defined in ' '*m*’s\n' 'symbol table. Module attributes can be assigned to. (Note ' 'that the\n' '"import" statement is not, strictly speaking, an operation ' 'on a module\n' 'object; "import foo" does not require a module object named ' '*foo* to\n' 'exist, rather it requires an (external) *definition* for a ' 'module\n' 'named *foo* somewhere.)\n' '\n' 'A special attribute of every module is "__dict__". This is ' 'the\n' 'dictionary containing the module’s symbol table. Modifying ' 'this\n' 'dictionary will actually change the module’s symbol table, ' 'but direct\n' 'assignment to the "__dict__" attribute is not possible (you ' 'can write\n' '"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but ' 'you can’t\n' 'write "m.__dict__ = {}"). Modifying "__dict__" directly is ' 'not\n' 'recommended.\n' '\n' 'Modules built into the interpreter are written like this: ' '"<module\n' '\'sys\' (built-in)>". If loaded from a file, they are ' 'written as\n' '"<module \'os\' from ' '\'/usr/local/lib/pythonX.Y/os.pyc\'>".\n', 'typesseq': 'Sequence Types — "list", "tuple", "range"\n' '*****************************************\n' '\n' 'There are three basic sequence types: lists, tuples, and range\n' 'objects. Additional sequence types tailored for processing of ' 'binary\n' 'data and text strings are described in dedicated sections.\n' '\n' '\n' 'Common Sequence Operations\n' '==========================\n' '\n' 'The operations in the following table are supported by most ' 'sequence\n' 'types, both mutable and immutable. The ' '"collections.abc.Sequence" ABC\n' 'is provided to make it easier to correctly implement these ' 'operations\n' 'on custom sequence types.\n' '\n' 'This table lists the sequence operations sorted in ascending ' 'priority.\n' 'In the table, *s* and *t* are sequences of the same type, *n*, ' '*i*,\n' '*j* and *k* are integers and *x* is an arbitrary object that ' 'meets any\n' 'type and value restrictions imposed by *s*.\n' '\n' 'The "in" and "not in" operations have the same priorities as ' 'the\n' 'comparison operations. The "+" (concatenation) and "*" ' '(repetition)\n' 'operations have the same priority as the corresponding numeric\n' 'operations. [3]\n' '\n' '+----------------------------+----------------------------------+------------+\n' '| Operation | Result ' '| Notes |\n' '|============================|==================================|============|\n' '| "x in s" | "True" if an item of *s* is ' '| (1) |\n' '| | equal to *x*, else "False" ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "x not in s" | "False" if an item of *s* is ' '| (1) |\n' '| | equal to *x*, else "True" ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "s + t" | the concatenation of *s* and *t* ' '| (6)(7) |\n' '+----------------------------+----------------------------------+------------+\n' '| "s * n" or "n * s" | equivalent to adding *s* to ' '| (2)(7) |\n' '| | itself *n* times ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "s[i]" | *i*th item of *s*, origin 0 ' '| (3) |\n' '+----------------------------+----------------------------------+------------+\n' '| "s[i:j]" | slice of *s* from *i* to *j* ' '| (3)(4) |\n' '+----------------------------+----------------------------------+------------+\n' '| "s[i:j:k]" | slice of *s* from *i* to *j* ' '| (3)(5) |\n' '| | with step *k* ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "len(s)" | length of *s* ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "min(s)" | smallest item of *s* ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "max(s)" | largest item of *s* ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "s.index(x[, i[, j]])" | index of the first occurrence of ' '| (8) |\n' '| | *x* in *s* (at or after index ' '| |\n' '| | *i* and before index *j*) ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '| "s.count(x)" | total number of occurrences of ' '| |\n' '| | *x* in *s* ' '| |\n' '+----------------------------+----------------------------------+------------+\n' '\n' 'Sequences of the same type also support comparisons. In ' 'particular,\n' 'tuples and lists are compared lexicographically by comparing\n' 'corresponding elements. This means that to compare equal, every\n' 'element must compare equal and the two sequences must be of the ' 'same\n' 'type and have the same length. (For full details see ' 'Comparisons in\n' 'the language reference.)\n' '\n' 'Notes:\n' '\n' '1. While the "in" and "not in" operations are used only for ' 'simple\n' ' containment testing in the general case, some specialised ' 'sequences\n' ' (such as "str", "bytes" and "bytearray") also use them for\n' ' subsequence testing:\n' '\n' ' >>> "gg" in "eggs"\n' ' True\n' '\n' '2. Values of *n* less than "0" are treated as "0" (which yields ' 'an\n' ' empty sequence of the same type as *s*). Note that items in ' 'the\n' ' sequence *s* are not copied; they are referenced multiple ' 'times.\n' ' This often haunts new Python programmers; consider:\n' '\n' ' >>> lists = [[]] * 3\n' ' >>> lists\n' ' [[], [], []]\n' ' >>> lists[0].append(3)\n' ' >>> lists\n' ' [[3], [3], [3]]\n' '\n' ' What has happened is that "[[]]" is a one-element list ' 'containing\n' ' an empty list, so all three elements of "[[]] * 3" are ' 'references\n' ' to this single empty list. Modifying any of the elements of\n' ' "lists" modifies this single list. You can create a list of\n' ' different lists this way:\n' '\n' ' >>> lists = [[] for i in range(3)]\n' ' >>> lists[0].append(3)\n' ' >>> lists[1].append(5)\n' ' >>> lists[2].append(7)\n' ' >>> lists\n' ' [[3], [5], [7]]\n' '\n' ' Further explanation is available in the FAQ entry How do I ' 'create a\n' ' multidimensional list?.\n' '\n' '3. If *i* or *j* is negative, the index is relative to the end ' 'of\n' ' sequence *s*: "len(s) + i" or "len(s) + j" is substituted. ' 'But\n' ' note that "-0" is still "0".\n' '\n' '4. The slice of *s* from *i* to *j* is defined as the sequence ' 'of\n' ' items with index *k* such that "i <= k < j". If *i* or *j* ' 'is\n' ' greater than "len(s)", use "len(s)". If *i* is omitted or ' '"None",\n' ' use "0". If *j* is omitted or "None", use "len(s)". If *i* ' 'is\n' ' greater than or equal to *j*, the slice is empty.\n' '\n' '5. The slice of *s* from *i* to *j* with step *k* is defined as ' 'the\n' ' sequence of items with index "x = i + n*k" such that "0 <= n ' '<\n' ' (j-i)/k". In other words, the indices are "i", "i+k", ' '"i+2*k",\n' ' "i+3*k" and so on, stopping when *j* is reached (but never\n' ' including *j*). When *k* is positive, *i* and *j* are ' 'reduced to\n' ' "len(s)" if they are greater. When *k* is negative, *i* and ' '*j* are\n' ' reduced to "len(s) - 1" if they are greater. If *i* or *j* ' 'are\n' ' omitted or "None", they become “end” values (which end ' 'depends on\n' ' the sign of *k*). Note, *k* cannot be zero. If *k* is ' '"None", it\n' ' is treated like "1".\n' '\n' '6. Concatenating immutable sequences always results in a new ' 'object.\n' ' This means that building up a sequence by repeated ' 'concatenation\n' ' will have a quadratic runtime cost in the total sequence ' 'length.\n' ' To get a linear runtime cost, you must switch to one of the\n' ' alternatives below:\n' '\n' ' * if concatenating "str" objects, you can build a list and ' 'use\n' ' "str.join()" at the end or else write to an "io.StringIO"\n' ' instance and retrieve its value when complete\n' '\n' ' * if concatenating "bytes" objects, you can similarly use\n' ' "bytes.join()" or "io.BytesIO", or you can do in-place\n' ' concatenation with a "bytearray" object. "bytearray" ' 'objects are\n' ' mutable and have an efficient overallocation mechanism\n' '\n' ' * if concatenating "tuple" objects, extend a "list" instead\n' '\n' ' * for other types, investigate the relevant class ' 'documentation\n' '\n' '7. Some sequence types (such as "range") only support item ' 'sequences\n' ' that follow specific patterns, and hence don’t support ' 'sequence\n' ' concatenation or repetition.\n' '\n' '8. "index" raises "ValueError" when *x* is not found in *s*. Not ' 'all\n' ' implementations support passing the additional arguments *i* ' 'and\n' ' *j*. These arguments allow efficient searching of subsections ' 'of\n' ' the sequence. Passing the extra arguments is roughly ' 'equivalent to\n' ' using "s[i:j].index(x)", only without copying any data and ' 'with the\n' ' returned index being relative to the start of the sequence ' 'rather\n' ' than the start of the slice.\n' '\n' '\n' 'Immutable Sequence Types\n' '========================\n' '\n' 'The only operation that immutable sequence types generally ' 'implement\n' 'that is not also implemented by mutable sequence types is ' 'support for\n' 'the "hash()" built-in.\n' '\n' 'This support allows immutable sequences, such as "tuple" ' 'instances, to\n' 'be used as "dict" keys and stored in "set" and "frozenset" ' 'instances.\n' '\n' 'Attempting to hash an immutable sequence that contains ' 'unhashable\n' 'values will result in "TypeError".\n' '\n' '\n' 'Mutable Sequence Types\n' '======================\n' '\n' 'The operations in the following table are defined on mutable ' 'sequence\n' 'types. The "collections.abc.MutableSequence" ABC is provided to ' 'make\n' 'it easier to correctly implement these operations on custom ' 'sequence\n' 'types.\n' '\n' 'In the table *s* is an instance of a mutable sequence type, *t* ' 'is any\n' 'iterable object and *x* is an arbitrary object that meets any ' 'type and\n' 'value restrictions imposed by *s* (for example, "bytearray" ' 'only\n' 'accepts integers that meet the value restriction "0 <= x <= ' '255").\n' '\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| Operation | ' 'Result | Notes |\n' '|================================|==================================|=======================|\n' '| "s[i] = x" | item *i* of *s* is replaced ' 'by | |\n' '| | ' '*x* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s[i:j] = t" | slice of *s* from *i* to *j* ' 'is | |\n' '| | replaced by the contents of ' 'the | |\n' '| | iterable ' '*t* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "del s[i:j]" | same as "s[i:j] = ' '[]" | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s[i:j:k] = t" | the elements of "s[i:j:k]" ' 'are | (1) |\n' '| | replaced by those of ' '*t* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "del s[i:j:k]" | removes the elements ' 'of | |\n' '| | "s[i:j:k]" from the ' 'list | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.append(x)" | appends *x* to the end of ' 'the | |\n' '| | sequence (same ' 'as | |\n' '| | "s[len(s):len(s)] = ' '[x]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.clear()" | removes all items from *s* ' '(same | (5) |\n' '| | as "del ' 's[:]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.copy()" | creates a shallow copy of ' '*s* | (5) |\n' '| | (same as ' '"s[:]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.extend(t)" or "s += t" | extends *s* with the contents ' 'of | |\n' '| | *t* (for the most part the ' 'same | |\n' '| | as "s[len(s):len(s)] = ' 't") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s *= n" | updates *s* with its ' 'contents | (6) |\n' '| | repeated *n* ' 'times | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.insert(i, x)" | inserts *x* into *s* at ' 'the | |\n' '| | index given by *i* (same ' 'as | |\n' '| | "s[i:i] = ' '[x]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.pop([i])" | retrieves the item at *i* ' 'and | (2) |\n' '| | also removes it from ' '*s* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.remove(x)" | remove the first item from ' '*s* | (3) |\n' '| | where "s[i] == ' 'x" | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.reverse()" | reverses the items of *s* ' 'in | (4) |\n' '| | ' 'place | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '\n' 'Notes:\n' '\n' '1. *t* must have the same length as the slice it is replacing.\n' '\n' '2. The optional argument *i* defaults to "-1", so that by ' 'default the\n' ' last item is removed and returned.\n' '\n' '3. "remove" raises "ValueError" when *x* is not found in *s*.\n' '\n' '4. The "reverse()" method modifies the sequence in place for ' 'economy\n' ' of space when reversing a large sequence. To remind users ' 'that it\n' ' operates by side effect, it does not return the reversed ' 'sequence.\n' '\n' '5. "clear()" and "copy()" are included for consistency with the\n' ' interfaces of mutable containers that don’t support slicing\n' ' operations (such as "dict" and "set")\n' '\n' ' New in version 3.3: "clear()" and "copy()" methods.\n' '\n' '6. The value *n* is an integer, or an object implementing\n' ' "__index__()". Zero and negative values of *n* clear the ' 'sequence.\n' ' Items in the sequence are not copied; they are referenced ' 'multiple\n' ' times, as explained for "s * n" under Common Sequence ' 'Operations.\n' '\n' '\n' 'Lists\n' '=====\n' '\n' 'Lists are mutable sequences, typically used to store collections ' 'of\n' 'homogeneous items (where the precise degree of similarity will ' 'vary by\n' 'application).\n' '\n' 'class list([iterable])\n' '\n' ' Lists may be constructed in several ways:\n' '\n' ' * Using a pair of square brackets to denote the empty list: ' '"[]"\n' '\n' ' * Using square brackets, separating items with commas: "[a]", ' '"[a,\n' ' b, c]"\n' '\n' ' * Using a list comprehension: "[x for x in iterable]"\n' '\n' ' * Using the type constructor: "list()" or "list(iterable)"\n' '\n' ' The constructor builds a list whose items are the same and in ' 'the\n' ' same order as *iterable*’s items. *iterable* may be either ' 'a\n' ' sequence, a container that supports iteration, or an ' 'iterator\n' ' object. If *iterable* is already a list, a copy is made and\n' ' returned, similar to "iterable[:]". For example, ' '"list(\'abc\')"\n' ' returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" ' 'returns "[1, 2,\n' ' 3]". If no argument is given, the constructor creates a new ' 'empty\n' ' list, "[]".\n' '\n' ' Many other operations also produce lists, including the ' '"sorted()"\n' ' built-in.\n' '\n' ' Lists implement all of the common and mutable sequence ' 'operations.\n' ' Lists also provide the following additional method:\n' '\n' ' sort(*, key=None, reverse=False)\n' '\n' ' This method sorts the list in place, using only "<" ' 'comparisons\n' ' between items. Exceptions are not suppressed - if any ' 'comparison\n' ' operations fail, the entire sort operation will fail (and ' 'the\n' ' list will likely be left in a partially modified state).\n' '\n' ' "sort()" accepts two arguments that can only be passed by\n' ' keyword (keyword-only arguments):\n' '\n' ' *key* specifies a function of one argument that is used ' 'to\n' ' extract a comparison key from each list element (for ' 'example,\n' ' "key=str.lower"). The key corresponding to each item in ' 'the list\n' ' is calculated once and then used for the entire sorting ' 'process.\n' ' The default value of "None" means that list items are ' 'sorted\n' ' directly without calculating a separate key value.\n' '\n' ' The "functools.cmp_to_key()" utility is available to ' 'convert a\n' ' 2.x style *cmp* function to a *key* function.\n' '\n' ' *reverse* is a boolean value. If set to "True", then the ' 'list\n' ' elements are sorted as if each comparison were reversed.\n' '\n' ' This method modifies the sequence in place for economy of ' 'space\n' ' when sorting a large sequence. To remind users that it ' 'operates\n' ' by side effect, it does not return the sorted sequence ' '(use\n' ' "sorted()" to explicitly request a new sorted list ' 'instance).\n' '\n' ' The "sort()" method is guaranteed to be stable. A sort ' 'is\n' ' stable if it guarantees not to change the relative order ' 'of\n' ' elements that compare equal — this is helpful for sorting ' 'in\n' ' multiple passes (for example, sort by department, then by ' 'salary\n' ' grade).\n' '\n' ' **CPython implementation detail:** While a list is being ' 'sorted,\n' ' the effect of attempting to mutate, or even inspect, the ' 'list is\n' ' undefined. The C implementation of Python makes the list ' 'appear\n' ' empty for the duration, and raises "ValueError" if it can ' 'detect\n' ' that the list has been mutated during a sort.\n' '\n' '\n' 'Tuples\n' '======\n' '\n' 'Tuples are immutable sequences, typically used to store ' 'collections of\n' 'heterogeneous data (such as the 2-tuples produced by the ' '"enumerate()"\n' 'built-in). Tuples are also used for cases where an immutable ' 'sequence\n' 'of homogeneous data is needed (such as allowing storage in a ' '"set" or\n' '"dict" instance).\n' '\n' 'class tuple([iterable])\n' '\n' ' Tuples may be constructed in a number of ways:\n' '\n' ' * Using a pair of parentheses to denote the empty tuple: ' '"()"\n' '\n' ' * Using a trailing comma for a singleton tuple: "a," or ' '"(a,)"\n' '\n' ' * Separating items with commas: "a, b, c" or "(a, b, c)"\n' '\n' ' * Using the "tuple()" built-in: "tuple()" or ' '"tuple(iterable)"\n' '\n' ' The constructor builds a tuple whose items are the same and ' 'in the\n' ' same order as *iterable*’s items. *iterable* may be either ' 'a\n' ' sequence, a container that supports iteration, or an ' 'iterator\n' ' object. If *iterable* is already a tuple, it is returned\n' ' unchanged. For example, "tuple(\'abc\')" returns "(\'a\', ' '\'b\', \'c\')"\n' ' and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument ' 'is\n' ' given, the constructor creates a new empty tuple, "()".\n' '\n' ' Note that it is actually the comma which makes a tuple, not ' 'the\n' ' parentheses. The parentheses are optional, except in the ' 'empty\n' ' tuple case, or when they are needed to avoid syntactic ' 'ambiguity.\n' ' For example, "f(a, b, c)" is a function call with three ' 'arguments,\n' ' while "f((a, b, c))" is a function call with a 3-tuple as the ' 'sole\n' ' argument.\n' '\n' ' Tuples implement all of the common sequence operations.\n' '\n' 'For heterogeneous collections of data where access by name is ' 'clearer\n' 'than access by index, "collections.namedtuple()" may be a more\n' 'appropriate choice than a simple tuple object.\n' '\n' '\n' 'Ranges\n' '======\n' '\n' 'The "range" type represents an immutable sequence of numbers and ' 'is\n' 'commonly used for looping a specific number of times in "for" ' 'loops.\n' '\n' 'class range(stop)\n' 'class range(start, stop[, step])\n' '\n' ' The arguments to the range constructor must be integers ' '(either\n' ' built-in "int" or any object that implements the "__index__"\n' ' special method). If the *step* argument is omitted, it ' 'defaults to\n' ' "1". If the *start* argument is omitted, it defaults to "0". ' 'If\n' ' *step* is zero, "ValueError" is raised.\n' '\n' ' For a positive *step*, the contents of a range "r" are ' 'determined\n' ' by the formula "r[i] = start + step*i" where "i >= 0" and ' '"r[i] <\n' ' stop".\n' '\n' ' For a negative *step*, the contents of the range are still\n' ' determined by the formula "r[i] = start + step*i", but the\n' ' constraints are "i >= 0" and "r[i] > stop".\n' '\n' ' A range object will be empty if "r[0]" does not meet the ' 'value\n' ' constraint. Ranges do support negative indices, but these ' 'are\n' ' interpreted as indexing from the end of the sequence ' 'determined by\n' ' the positive indices.\n' '\n' ' Ranges containing absolute values larger than "sys.maxsize" ' 'are\n' ' permitted but some features (such as "len()") may raise\n' ' "OverflowError".\n' '\n' ' Range examples:\n' '\n' ' >>> list(range(10))\n' ' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n' ' >>> list(range(1, 11))\n' ' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n' ' >>> list(range(0, 30, 5))\n' ' [0, 5, 10, 15, 20, 25]\n' ' >>> list(range(0, 10, 3))\n' ' [0, 3, 6, 9]\n' ' >>> list(range(0, -10, -1))\n' ' [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n' ' >>> list(range(0))\n' ' []\n' ' >>> list(range(1, 0))\n' ' []\n' '\n' ' Ranges implement all of the common sequence operations ' 'except\n' ' concatenation and repetition (due to the fact that range ' 'objects\n' ' can only represent sequences that follow a strict pattern ' 'and\n' ' repetition and concatenation will usually violate that ' 'pattern).\n' '\n' ' start\n' '\n' ' The value of the *start* parameter (or "0" if the ' 'parameter was\n' ' not supplied)\n' '\n' ' stop\n' '\n' ' The value of the *stop* parameter\n' '\n' ' step\n' '\n' ' The value of the *step* parameter (or "1" if the parameter ' 'was\n' ' not supplied)\n' '\n' 'The advantage of the "range" type over a regular "list" or ' '"tuple" is\n' 'that a "range" object will always take the same (small) amount ' 'of\n' 'memory, no matter the size of the range it represents (as it ' 'only\n' 'stores the "start", "stop" and "step" values, calculating ' 'individual\n' 'items and subranges as needed).\n' '\n' 'Range objects implement the "collections.abc.Sequence" ABC, and\n' 'provide features such as containment tests, element index ' 'lookup,\n' 'slicing and support for negative indices (see Sequence Types — ' 'list,\n' 'tuple, range):\n' '\n' '>>> r = range(0, 20, 2)\n' '>>> r\n' 'range(0, 20, 2)\n' '>>> 11 in r\n' 'False\n' '>>> 10 in r\n' 'True\n' '>>> r.index(10)\n' '5\n' '>>> r[5]\n' '10\n' '>>> r[:5]\n' 'range(0, 10, 2)\n' '>>> r[-1]\n' '18\n' '\n' 'Testing range objects for equality with "==" and "!=" compares ' 'them as\n' 'sequences. That is, two range objects are considered equal if ' 'they\n' 'represent the same sequence of values. (Note that two range ' 'objects\n' 'that compare equal might have different "start", "stop" and ' '"step"\n' 'attributes, for example "range(0) == range(2, 1, 3)" or ' '"range(0, 3,\n' '2) == range(0, 4, 2)".)\n' '\n' 'Changed in version 3.2: Implement the Sequence ABC. Support ' 'slicing\n' 'and negative indices. Test "int" objects for membership in ' 'constant\n' 'time instead of iterating through all items.\n' '\n' 'Changed in version 3.3: Define ‘==’ and ‘!=’ to compare range ' 'objects\n' 'based on the sequence of values they define (instead of ' 'comparing\n' 'based on object identity).\n' '\n' 'New in version 3.3: The "start", "stop" and "step" attributes.\n' '\n' 'See also:\n' '\n' ' * The linspace recipe shows how to implement a lazy version of ' 'range\n' ' suitable for floating point applications.\n', 'typesseq-mutable': 'Mutable Sequence Types\n' '**********************\n' '\n' 'The operations in the following table are defined on ' 'mutable sequence\n' 'types. The "collections.abc.MutableSequence" ABC is ' 'provided to make\n' 'it easier to correctly implement these operations on ' 'custom sequence\n' 'types.\n' '\n' 'In the table *s* is an instance of a mutable sequence ' 'type, *t* is any\n' 'iterable object and *x* is an arbitrary object that ' 'meets any type and\n' 'value restrictions imposed by *s* (for example, ' '"bytearray" only\n' 'accepts integers that meet the value restriction "0 <= x ' '<= 255").\n' '\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| Operation | ' 'Result | Notes ' '|\n' '|================================|==================================|=======================|\n' '| "s[i] = x" | item *i* of *s* is ' 'replaced by | |\n' '| | ' '*x* | ' '|\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s[i:j] = t" | slice of *s* from *i* ' 'to *j* is | |\n' '| | replaced by the ' 'contents of the | |\n' '| | iterable ' '*t* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "del s[i:j]" | same as "s[i:j] = ' '[]" | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s[i:j:k] = t" | the elements of ' '"s[i:j:k]" are | (1) |\n' '| | replaced by those of ' '*t* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "del s[i:j:k]" | removes the elements ' 'of | |\n' '| | "s[i:j:k]" from the ' 'list | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.append(x)" | appends *x* to the ' 'end of the | |\n' '| | sequence (same ' 'as | |\n' '| | "s[len(s):len(s)] = ' '[x]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.clear()" | removes all items ' 'from *s* (same | (5) |\n' '| | as "del ' 's[:]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.copy()" | creates a shallow ' 'copy of *s* | (5) |\n' '| | (same as ' '"s[:]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.extend(t)" or "s += t" | extends *s* with the ' 'contents of | |\n' '| | *t* (for the most ' 'part the same | |\n' '| | as "s[len(s):len(s)] ' '= t") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s *= n" | updates *s* with its ' 'contents | (6) |\n' '| | repeated *n* ' 'times | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.insert(i, x)" | inserts *x* into *s* ' 'at the | |\n' '| | index given by *i* ' '(same as | |\n' '| | "s[i:i] = ' '[x]") | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.pop([i])" | retrieves the item at ' '*i* and | (2) |\n' '| | also removes it from ' '*s* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.remove(x)" | remove the first item ' 'from *s* | (3) |\n' '| | where "s[i] == ' 'x" | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.reverse()" | reverses the items of ' '*s* in | (4) |\n' '| | ' 'place | ' '|\n' '+--------------------------------+----------------------------------+-----------------------+\n' '\n' 'Notes:\n' '\n' '1. *t* must have the same length as the slice it is ' 'replacing.\n' '\n' '2. The optional argument *i* defaults to "-1", so that ' 'by default the\n' ' last item is removed and returned.\n' '\n' '3. "remove" raises "ValueError" when *x* is not found in ' '*s*.\n' '\n' '4. The "reverse()" method modifies the sequence in place ' 'for economy\n' ' of space when reversing a large sequence. To remind ' 'users that it\n' ' operates by side effect, it does not return the ' 'reversed sequence.\n' '\n' '5. "clear()" and "copy()" are included for consistency ' 'with the\n' ' interfaces of mutable containers that don’t support ' 'slicing\n' ' operations (such as "dict" and "set")\n' '\n' ' New in version 3.3: "clear()" and "copy()" methods.\n' '\n' '6. The value *n* is an integer, or an object ' 'implementing\n' ' "__index__()". Zero and negative values of *n* clear ' 'the sequence.\n' ' Items in the sequence are not copied; they are ' 'referenced multiple\n' ' times, as explained for "s * n" under Common Sequence ' 'Operations.\n', 'unary': 'Unary arithmetic and bitwise operations\n' '***************************************\n' '\n' 'All unary arithmetic and bitwise operations have the same ' 'priority:\n' '\n' ' u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n' '\n' 'The unary "-" (minus) operator yields the negation of its numeric\n' 'argument.\n' '\n' 'The unary "+" (plus) operator yields its numeric argument ' 'unchanged.\n' '\n' 'The unary "~" (invert) operator yields the bitwise inversion of ' 'its\n' 'integer argument. The bitwise inversion of "x" is defined as\n' '"-(x+1)". It only applies to integral numbers.\n' '\n' 'In all three cases, if the argument does not have the proper type, ' 'a\n' '"TypeError" exception is raised.\n', 'while': 'The "while" statement\n' '*********************\n' '\n' 'The "while" statement is used for repeated execution as long as an\n' 'expression is true:\n' '\n' ' while_stmt ::= "while" expression ":" suite\n' ' ["else" ":" suite]\n' '\n' 'This repeatedly tests the expression and, if it is true, executes ' 'the\n' 'first suite; if the expression is false (which may be the first ' 'time\n' 'it is tested) the suite of the "else" clause, if present, is ' 'executed\n' 'and the loop terminates.\n' '\n' 'A "break" statement executed in the first suite terminates the ' 'loop\n' 'without executing the "else" clause’s suite. A "continue" ' 'statement\n' 'executed in the first suite skips the rest of the suite and goes ' 'back\n' 'to testing the expression.\n', 'with': 'The "with" statement\n' '********************\n' '\n' 'The "with" statement is used to wrap the execution of a block with\n' 'methods defined by a context manager (see section With Statement\n' 'Context Managers). This allows common "try"…"except"…"finally" ' 'usage\n' 'patterns to be encapsulated for convenient reuse.\n' '\n' ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' ' with_item ::= expression ["as" target]\n' '\n' 'The execution of the "with" statement with one “item” proceeds as\n' 'follows:\n' '\n' '1. The context expression (the expression given in the "with_item") ' 'is\n' ' evaluated to obtain a context manager.\n' '\n' '2. The context manager’s "__exit__()" is loaded for later use.\n' '\n' '3. The context manager’s "__enter__()" method is invoked.\n' '\n' '4. If a target was included in the "with" statement, the return ' 'value\n' ' from "__enter__()" is assigned to it.\n' '\n' ' Note:\n' '\n' ' The "with" statement guarantees that if the "__enter__()" ' 'method\n' ' returns without an error, then "__exit__()" will always be\n' ' called. Thus, if an error occurs during the assignment to the\n' ' target list, it will be treated the same as an error occurring\n' ' within the suite would be. See step 6 below.\n' '\n' '5. The suite is executed.\n' '\n' '6. The context manager’s "__exit__()" method is invoked. If an\n' ' exception caused the suite to be exited, its type, value, and\n' ' traceback are passed as arguments to "__exit__()". Otherwise, ' 'three\n' ' "None" arguments are supplied.\n' '\n' ' If the suite was exited due to an exception, and the return ' 'value\n' ' from the "__exit__()" method was false, the exception is ' 'reraised.\n' ' If the return value was true, the exception is suppressed, and\n' ' execution continues with the statement following the "with"\n' ' statement.\n' '\n' ' If the suite was exited for any reason other than an exception, ' 'the\n' ' return value from "__exit__()" is ignored, and execution ' 'proceeds\n' ' at the normal location for the kind of exit that was taken.\n' '\n' 'With more than one item, the context managers are processed as if\n' 'multiple "with" statements were nested:\n' '\n' ' with A() as a, B() as b:\n' ' suite\n' '\n' 'is equivalent to\n' '\n' ' with A() as a:\n' ' with B() as b:\n' ' suite\n' '\n' 'Changed in version 3.1: Support for multiple context expressions.\n' '\n' 'See also:\n' '\n' ' **PEP 343** - The “with” statement\n' ' The specification, background, and examples for the Python ' '"with"\n' ' statement.\n', 'yield': 'The "yield" statement\n' '*********************\n' '\n' ' yield_stmt ::= yield_expression\n' '\n' 'A "yield" statement is semantically equivalent to a yield ' 'expression.\n' 'The yield statement can be used to omit the parentheses that would\n' 'otherwise be required in the equivalent yield expression ' 'statement.\n' 'For example, the yield statements\n' '\n' ' yield <expr>\n' ' yield from <expr>\n' '\n' 'are equivalent to the yield expression statements\n' '\n' ' (yield <expr>)\n' ' (yield from <expr>)\n' '\n' 'Yield expressions and statements are only used when defining a\n' '*generator* function, and are only used in the body of the ' 'generator\n' 'function. Using yield in a function definition is sufficient to ' 'cause\n' 'that definition to create a generator function instead of a normal\n' 'function.\n' '\n' 'For full details of "yield" semantics, refer to the Yield ' 'expressions\n' 'section.\n'}
644,588
13,127
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/pydoc_data/_pydoc.css
/* CSS file for pydoc. Contents of this file are subject to change without notice. */
94
5
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/pydoc_data/__init__.py
0
1
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/__main__.py
import sys from . import main rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc)
145
11
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/__init__.py
""" Virtual environment (venv) package for Python. Based on PEP 405. Copyright (C) 2011-2014 Vinay Sajip. Licensed to the PSF under a contributor agreement. """ import logging import os import shutil import subprocess import sys import types logger = logging.getLogger(__name__) class EnvBuilder: """ This class exists to allow virtual environment creation to be customized. The constructor parameters determine the builder's behaviour when called upon to create a virtual environment. By default, the builder makes the system (global) site-packages dir *un*available to the created environment. If invoked using the Python -m option, the default is to use copying on Windows platforms but symlinks elsewhere. If instantiated some other way, the default is to *not* use symlinks. :param system_site_packages: If True, the system (global) site-packages dir is available to created environments. :param clear: If True, delete the contents of the environment directory if it already exists, before environment creation. :param symlinks: If True, attempt to symlink rather than copy files into virtual environment. :param upgrade: If True, upgrade an existing virtual environment. :param with_pip: If True, ensure pip is installed in the virtual environment :param prompt: Alternative terminal prefix for the environment. """ def __init__(self, system_site_packages=False, clear=False, symlinks=False, upgrade=False, with_pip=False, prompt=None): self.system_site_packages = system_site_packages self.clear = clear self.symlinks = symlinks self.upgrade = upgrade self.with_pip = with_pip self.prompt = prompt def create(self, env_dir): """ Create a virtual environment in a directory. :param env_dir: The target directory to create an environment in. """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) # See issue 24875. We need system_site_packages to be False # until after pip is installed. true_system_site_packages = self.system_site_packages self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: self._setup_pip(context) if not self.upgrade: self.setup_scripts(context) self.post_setup(context) if true_system_site_packages: # We had set it to False before, now # restore it and rewrite the configuration self.system_site_packages = True self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): fn = os.path.join(path, fn) if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.isdir(fn): shutil.rmtree(fn) def ensure_directories(self, env_dir): """ Create the directories for the environment. Returns a context object which holds paths in the environment, for use by subsequent logic. """ def create_if_needed(d): if not os.path.exists(d): os.makedirs(d) elif os.path.islink(d) or os.path.isfile(d): raise ValueError('Unable to create directory %r' % d) if os.path.exists(env_dir) and self.clear: self.clear_directory(env_dir) context = types.SimpleNamespace() context.env_dir = env_dir context.env_name = os.path.split(env_dir)[1] prompt = self.prompt if self.prompt is not None else context.env_name context.prompt = '(%s) ' % prompt create_if_needed(env_dir) env = os.environ if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env: executable = os.environ['__PYVENV_LAUNCHER__'] else: executable = sys.executable dirname, exename = os.path.split(os.path.abspath(executable)) context.executable = executable context.python_dir = dirname context.python_exe = exename if sys.platform == 'win32': binname = 'Scripts' incpath = 'Include' libpath = os.path.join(env_dir, 'Lib', 'site-packages') else: binname = 'bin' incpath = 'include' libpath = os.path.join(env_dir, 'lib', 'python%d.%d' % sys.version_info[:2], 'site-packages') context.inc_path = path = os.path.join(env_dir, incpath) create_if_needed(path) create_if_needed(libpath) # Issue 21197: create lib64 as a symlink to lib on 64-bit non-OS X POSIX if ((sys.maxsize > 2**32) and (os.name == 'posix') and (sys.platform != 'darwin')): link_path = os.path.join(env_dir, 'lib64') if not os.path.exists(link_path): # Issue #21643 os.symlink('lib', link_path) context.bin_path = binpath = os.path.join(env_dir, binname) context.bin_name = binname context.env_exe = os.path.join(binpath, exename) create_if_needed(binpath) return context def create_configuration(self, context): """ Create a configuration file indicating where the environment's Python was copied from, and whether the system site-packages should be made available in the environment. :param context: The information for the environment creation request being processed. """ context.cfg_path = path = os.path.join(context.env_dir, 'pyvenv.cfg') with open(path, 'w', encoding='utf-8') as f: f.write('home = %s\n' % context.python_dir) if self.system_site_packages: incl = 'true' else: incl = 'false' f.write('include-system-site-packages = %s\n' % incl) f.write('version = %d.%d.%d\n' % sys.version_info[:3]) if os.name == 'nt': def include_binary(self, f): if f.endswith(('.pyd', '.dll')): result = True else: result = f.startswith('python') and f.endswith('.exe') return result def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): """ Try symlinking a file, and if that fails, fall back to copying. """ force_copy = not self.symlinks if not force_copy: try: if not os.path.islink(dst): # can't link to itself! if relative_symlinks_ok: assert os.path.dirname(src) == os.path.dirname(dst) os.symlink(os.path.basename(src), dst) else: os.symlink(src, dst) except Exception: # may need to use a more specific exception logger.warning('Unable to symlink %r to %r', src, dst) force_copy = True if force_copy: shutil.copyfile(src, dst) def setup_python(self, context): """ Set up a Python executable in the environment. :param context: The information for the environment creation request being processed. """ binpath = context.bin_path path = context.env_exe copier = self.symlink_or_copy copier(context.executable, path) dirname = context.python_dir if os.name != 'nt': if not os.path.islink(path): os.chmod(path, 0o755) for suffix in ('python', 'python3'): path = os.path.join(binpath, suffix) if not os.path.exists(path): # Issue 18807: make copies if # symlinks are not wanted copier(context.env_exe, path, relative_symlinks_ok=True) if not os.path.islink(path): os.chmod(path, 0o755) else: subdir = 'DLLs' include = self.include_binary files = [f for f in os.listdir(dirname) if include(f)] for f in files: src = os.path.join(dirname, f) dst = os.path.join(binpath, f) if dst != context.env_exe: # already done, above copier(src, dst) dirname = os.path.join(dirname, subdir) if os.path.isdir(dirname): files = [f for f in os.listdir(dirname) if include(f)] for f in files: src = os.path.join(dirname, f) dst = os.path.join(binpath, f) copier(src, dst) # copy init.tcl over for root, dirs, files in os.walk(context.python_dir): if 'init.tcl' in files: tcldir = os.path.basename(root) tcldir = os.path.join(context.env_dir, 'Lib', tcldir) if not os.path.exists(tcldir): os.makedirs(tcldir) src = os.path.join(root, 'init.tcl') dst = os.path.join(tcldir, 'init.tcl') shutil.copyfile(src, dst) break def _setup_pip(self, context): """Installs or upgrades pip in a virtual environment""" # We run ensurepip in isolated mode to avoid side effects from # environment vars, the current directory and anything else # intended for the global Python environment cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade', '--default-pip'] subprocess.check_output(cmd, stderr=subprocess.STDOUT) def setup_scripts(self, context): """ Set up scripts into the created environment from a directory. This method installs the default scripts into the environment being created. You can prevent the default installation by overriding this method if you really need to, or if you need to specify a different location for the scripts to install. By default, the 'scripts' directory in the venv package is used as the source of scripts to install. """ path = os.path.abspath(os.path.dirname(__file__)) path = os.path.join(path, 'scripts') self.install_scripts(context, path) def post_setup(self, context): """ Hook for post-setup modification of the venv. Subclasses may install additional packages or scripts here, add activation shell scripts, etc. :param context: The information for the environment creation request being processed. """ pass def replace_variables(self, text, context): """ Replace variable placeholders in script text with context-specific variables. Return the text passed in , but with variables replaced. :param text: The text in which to replace placeholder variables. :param context: The information for the environment creation request being processed. """ text = text.replace('__VENV_DIR__', context.env_dir) text = text.replace('__VENV_NAME__', context.env_name) text = text.replace('__VENV_PROMPT__', context.prompt) text = text.replace('__VENV_BIN_NAME__', context.bin_name) text = text.replace('__VENV_PYTHON__', context.env_exe) return text def install_scripts(self, context, path): """ Install scripts into the created environment from a directory. :param context: The information for the environment creation request being processed. :param path: Absolute pathname of a directory containing script. Scripts in the 'common' subdirectory of this directory, and those in the directory named for the platform being run on, are installed in the created environment. Placeholder variables are replaced with environment- specific values. """ binpath = context.bin_path plen = len(path) for root, dirs, files in os.walk(path): if root == path: # at top-level, remove irrelevant dirs for d in dirs[:]: if d not in ('common', os.name): dirs.remove(d) continue # ignore files in top level for f in files: srcfile = os.path.join(root, f) suffix = root[plen:].split(os.sep)[2:] if not suffix: dstdir = binpath else: dstdir = os.path.join(binpath, *suffix) if not os.path.exists(dstdir): os.makedirs(dstdir) dstfile = os.path.join(dstdir, f) with open(srcfile, 'rb') as f: data = f.read() if not srcfile.endswith('.exe'): try: data = data.decode('utf-8') data = self.replace_variables(data, context) data = data.encode('utf-8') except UnicodeError as e: data = None logger.warning('unable to copy script %r, ' 'may be binary: %s', srcfile, e) if data is not None: with open(dstfile, 'wb') as f: f.write(data) shutil.copymode(srcfile, dstfile) def create(env_dir, system_site_packages=False, clear=False, symlinks=False, with_pip=False, prompt=None): """Create a virtual environment in a directory.""" builder = EnvBuilder(system_site_packages=system_site_packages, clear=clear, symlinks=symlinks, with_pip=with_pip, prompt=prompt) builder.create(env_dir) def main(args=None): compatible = True if sys.version_info < (3, 3): compatible = False elif not hasattr(sys, 'base_prefix'): compatible = False if not compatible: raise ValueError('This script is only for use with Python >= 3.3') else: import argparse parser = argparse.ArgumentParser(prog=__name__, description='Creates virtual Python ' 'environments in one or ' 'more target ' 'directories.', epilog='Once an environment has been ' 'created, you may wish to ' 'activate it, e.g. by ' 'sourcing an activate script ' 'in its bin directory.') parser.add_argument('dirs', metavar='ENV_DIR', nargs='+', help='A directory to create the environment in.') parser.add_argument('--system-site-packages', default=False, action='store_true', dest='system_site', help='Give the virtual environment access to the ' 'system site-packages dir.') if os.name == 'nt': use_symlinks = False else: use_symlinks = True group = parser.add_mutually_exclusive_group() group.add_argument('--symlinks', default=use_symlinks, action='store_true', dest='symlinks', help='Try to use symlinks rather than copies, ' 'when symlinks are not the default for ' 'the platform.') group.add_argument('--copies', default=not use_symlinks, action='store_false', dest='symlinks', help='Try to use copies rather than symlinks, ' 'even when symlinks are the default for ' 'the platform.') parser.add_argument('--clear', default=False, action='store_true', dest='clear', help='Delete the contents of the ' 'environment directory if it ' 'already exists, before ' 'environment creation.') parser.add_argument('--upgrade', default=False, action='store_true', dest='upgrade', help='Upgrade the environment ' 'directory to use this version ' 'of Python, assuming Python ' 'has been upgraded in-place.') parser.add_argument('--without-pip', dest='with_pip', default=True, action='store_false', help='Skips installing or upgrading pip in the ' 'virtual environment (pip is bootstrapped ' 'by default)') parser.add_argument('--prompt', help='Provides an alternative prompt prefix for ' 'this environment.') options = parser.parse_args(args) if options.upgrade and options.clear: raise ValueError('you cannot supply --upgrade and --clear together.') builder = EnvBuilder(system_site_packages=options.system_site, clear=options.clear, symlinks=options.symlinks, upgrade=options.upgrade, with_pip=options.with_pip, prompt=options.prompt) for d in options.dirs: builder.create(d) if __name__ == '__main__': rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc)
18,651
426
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/nt/deactivate.bat
@echo off if defined _OLD_VIRTUAL_PROMPT ( set "PROMPT=%_OLD_VIRTUAL_PROMPT%" ) set _OLD_VIRTUAL_PROMPT= if defined _OLD_VIRTUAL_PYTHONHOME ( set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%" set _OLD_VIRTUAL_PYTHONHOME= ) if defined _OLD_VIRTUAL_PATH ( set "PATH=%_OLD_VIRTUAL_PATH%" ) set _OLD_VIRTUAL_PATH= set VIRTUAL_ENV= :END
347
22
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/nt/Activate.ps1
function global:deactivate ([switch]$NonDestructive) { # Revert to original values if (Test-Path function:_OLD_VIRTUAL_PROMPT) { copy-item function:_OLD_VIRTUAL_PROMPT function:prompt remove-item function:_OLD_VIRTUAL_PROMPT } if (Test-Path env:_OLD_VIRTUAL_PYTHONHOME) { copy-item env:_OLD_VIRTUAL_PYTHONHOME env:PYTHONHOME remove-item env:_OLD_VIRTUAL_PYTHONHOME } if (Test-Path env:_OLD_VIRTUAL_PATH) { copy-item env:_OLD_VIRTUAL_PATH env:PATH remove-item env:_OLD_VIRTUAL_PATH } if (Test-Path env:VIRTUAL_ENV) { remove-item env:VIRTUAL_ENV } if (!$NonDestructive) { # Self destruct! remove-item function:deactivate } } deactivate -nondestructive $env:VIRTUAL_ENV="__VENV_DIR__" if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { # Set the prompt to include the env name # Make sure _OLD_VIRTUAL_PROMPT is global function global:_OLD_VIRTUAL_PROMPT {""} copy-item function:prompt function:_OLD_VIRTUAL_PROMPT function global:prompt { Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__' _OLD_VIRTUAL_PROMPT } } # Clear PYTHONHOME if (Test-Path env:PYTHONHOME) { copy-item env:PYTHONHOME env:_OLD_VIRTUAL_PYTHONHOME remove-item env:PYTHONHOME } # Add the venv to the PATH copy-item env:PATH env:_OLD_VIRTUAL_PATH $env:PATH = "$env:VIRTUAL_ENV\__VENV_BIN_NAME__;$env:PATH"
1,447
52
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/nt/activate.bat
@echo off rem This file is UTF-8 encoded, so we need to update the current code page while executing it for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do ( set "_OLD_CODEPAGE=%%a" ) if defined _OLD_CODEPAGE ( "%SystemRoot%\System32\chcp.com" 65001 > nul ) set "VIRTUAL_ENV=__VENV_DIR__" if not defined PROMPT ( set "PROMPT=$P$G" ) if defined _OLD_VIRTUAL_PROMPT ( set "PROMPT=%_OLD_VIRTUAL_PROMPT%" ) if defined _OLD_VIRTUAL_PYTHONHOME ( set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%" ) set "_OLD_VIRTUAL_PROMPT=%PROMPT%" set "PROMPT=__VENV_PROMPT__%PROMPT%" if defined PYTHONHOME ( set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%" set PYTHONHOME= ) if defined _OLD_VIRTUAL_PATH ( set "PATH=%_OLD_VIRTUAL_PATH%" ) else ( set "_OLD_VIRTUAL_PATH=%PATH%" ) set "PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%" :END if defined _OLD_CODEPAGE ( "%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul set "_OLD_CODEPAGE=" )
982
46
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/posix/activate.csh
# This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. # Created by Davide Di Blasi <[email protected]>. # Ported to Python 3.3 venv by Andrew Svetlov <[email protected]> alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. deactivate nondestructive setenv VIRTUAL_ENV "__VENV_DIR__" set _OLD_VIRTUAL_PATH="$PATH" setenv PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" set _OLD_VIRTUAL_PROMPT="$prompt" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then if ("__VENV_NAME__" != "") then set env_name = "__VENV_NAME__" else if (`basename "VIRTUAL_ENV"` == "__") then # special case for Aspen magic directories # see http://www.zetadev.com/software/aspen/ set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` else set env_name = `basename "$VIRTUAL_ENV"` endif endif set prompt = "[$env_name] $prompt" unset env_name endif alias pydoc python -m pydoc rehash
1,276
38
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/posix/activate.fish
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) # you cannot run it directly function deactivate -d "Exit virtualenv and return to normal shell environment" # reset old environment variables if test -n "$_OLD_VIRTUAL_PATH" set -gx PATH $_OLD_VIRTUAL_PATH set -e _OLD_VIRTUAL_PATH end if test -n "$_OLD_VIRTUAL_PYTHONHOME" set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME set -e _OLD_VIRTUAL_PYTHONHOME end if test -n "$_OLD_FISH_PROMPT_OVERRIDE" functions -e fish_prompt set -e _OLD_FISH_PROMPT_OVERRIDE functions -c _old_fish_prompt fish_prompt functions -e _old_fish_prompt end set -e VIRTUAL_ENV if test "$argv[1]" != "nondestructive" # Self destruct! functions -e deactivate end end # unset irrelevant variables deactivate nondestructive set -gx VIRTUAL_ENV "__VENV_DIR__" set -gx _OLD_VIRTUAL_PATH $PATH set -gx PATH "$VIRTUAL_ENV/__VENV_BIN_NAME__" $PATH # unset PYTHONHOME if set if set -q PYTHONHOME set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME set -e PYTHONHOME end if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" # fish uses a function instead of an env var to generate the prompt. # save the current fish_prompt function as the function _old_fish_prompt functions -c fish_prompt _old_fish_prompt # with the original prompt function renamed, we can override with our own. function fish_prompt # Save the return status of the last command set -l old_status $status # Prompt override? if test -n "__VENV_PROMPT__" printf "%s%s" "__VENV_PROMPT__" (set_color normal) else # ...Otherwise, prepend env set -l _checkbase (basename "$VIRTUAL_ENV") if test $_checkbase = "__" # special case for Aspen magic directories # see http://www.zetadev.com/software/aspen/ printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) else printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) end end # Restore the return status of the previous command. echo "exit $old_status" | . _old_fish_prompt end set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" end
2,438
76
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/venv/scripts/common/activate
# This file must be used with "source bin/activate" *from bash* # you cannot run it directly deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH fi if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" export PYTHONHOME unset _OLD_VIRTUAL_PYTHONHOME fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r fi if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then PS1="${_OLD_VIRTUAL_PS1:-}" export PS1 unset _OLD_VIRTUAL_PS1 fi unset VIRTUAL_ENV if [ ! "$1" = "nondestructive" ] ; then # Self destruct! unset -f deactivate fi } # unset irrelevant variables deactivate nondestructive VIRTUAL_ENV="__VENV_DIR__" export VIRTUAL_ENV _OLD_VIRTUAL_PATH="$PATH" PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" export PATH # unset PYTHONHOME if set # this will fail if PYTHONHOME is set to the empty string (which is bad anyway) # could use `if (set -u; : $PYTHONHOME) ;` in bash if [ -n "${PYTHONHOME:-}" ] ; then _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" unset PYTHONHOME fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" if [ "x__VENV_PROMPT__" != x ] ; then PS1="__VENV_PROMPT__${PS1:-}" else if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then # special case for Aspen magic directories # see http://www.zetadev.com/software/aspen/ PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" else PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" fi fi export PS1 fi # This should detect bash and zsh, which have a hash command that must # be called to get it to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r fi
2,218
77
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/pool.py
# # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = ['Pool', 'ThreadPool'] # # Imports # import threading import queue import itertools import collections import os import time import traceback # If threading is available then ThreadPool should be provided. Therefore # we avoid top-level imports which are liable to fail on some systems. from . import util from . import get_context, TimeoutError # # Constants representing the state of a pool # RUN = 0 CLOSE = 1 TERMINATE = 2 # # Miscellaneous # job_counter = itertools.count() def mapstar(args): return list(map(*args)) def starmapstar(args): return list(itertools.starmap(args[0], args[1])) # # Hack to embed stringification of remote traceback in local traceback # class RemoteTraceback(Exception): def __init__(self, tb): self.tb = tb def __str__(self): return self.tb class ExceptionWithTraceback: def __init__(self, exc, tb): tb = traceback.format_exception(type(exc), exc, tb) tb = ''.join(tb) self.exc = exc self.tb = '\n"""\n%s"""' % tb def __reduce__(self): return rebuild_exc, (self.exc, self.tb) def rebuild_exc(exc, tb): exc.__cause__ = RemoteTraceback(tb) return exc # # Code run by worker processes # class MaybeEncodingError(Exception): """Wraps possible unpickleable errors, so they can be safely sent through the socket.""" def __init__(self, exc, value): self.exc = repr(exc) self.value = repr(value) super(MaybeEncodingError, self).__init__(self.exc, self.value) def __str__(self): return "Error sending result: '%s'. Reason: '%s'" % (self.value, self.exc) def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self) def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None, wrap_exception=False): assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0) put = outqueue.put get = inqueue.get if hasattr(inqueue, '_writer'): inqueue._writer.close() outqueue._reader.close() if initializer is not None: initializer(*initargs) completed = 0 while maxtasks is None or (maxtasks and completed < maxtasks): try: task = get() except (EOFError, OSError): util.debug('worker got EOFError or OSError -- exiting') break if task is None: util.debug('worker got sentinel -- exiting') break job, i, func, args, kwds = task try: result = (True, func(*args, **kwds)) except Exception as e: if wrap_exception and func is not _helper_reraises_exception: e = ExceptionWithTraceback(e, e.__traceback__) result = (False, e) try: put((job, i, result)) except Exception as e: wrapped = MaybeEncodingError(e, result[1]) util.debug("Possible encoding error while sending result: %s" % ( wrapped)) put((job, i, (False, wrapped))) task = job = result = func = args = kwds = None completed += 1 util.debug('worker exiting after %d tasks' % completed) def _helper_reraises_exception(ex): 'Pickle-able helper function for use by _guarded_task_generation.' raise ex # # Class representing a process pool # class Pool(object): ''' Class which supports an async version of applying functions to arguments. ''' _wrap_exception = True def Process(self, *args, **kwds): return self._ctx.Process(*args, **kwds) def __init__(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None, context=None): self._ctx = context or get_context() self._setup_queues() self._taskqueue = queue.Queue() self._cache = {} self._state = RUN self._maxtasksperchild = maxtasksperchild self._initializer = initializer self._initargs = initargs if processes is None: processes = os.cpu_count() or 1 if processes < 1: raise ValueError("Number of processes must be at least 1") if initializer is not None and not callable(initializer): raise TypeError('initializer must be a callable') self._processes = processes self._pool = [] self._repopulate_pool() self._worker_handler = threading.Thread( target=Pool._handle_workers, args=(self, ) ) self._worker_handler.daemon = True self._worker_handler._state = RUN self._worker_handler.start() self._task_handler = threading.Thread( target=Pool._handle_tasks, args=(self._taskqueue, self._quick_put, self._outqueue, self._pool, self._cache) ) self._task_handler.daemon = True self._task_handler._state = RUN self._task_handler.start() self._result_handler = threading.Thread( target=Pool._handle_results, args=(self._outqueue, self._quick_get, self._cache) ) self._result_handler.daemon = True self._result_handler._state = RUN self._result_handler.start() self._terminate = util.Finalize( self, self._terminate_pool, args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, self._worker_handler, self._task_handler, self._result_handler, self._cache), exitpriority=15 ) def _join_exited_workers(self): """Cleanup after any worker processes which have exited due to reaching their specified lifetime. Returns True if any workers were cleaned up. """ cleaned = False for i in reversed(range(len(self._pool))): worker = self._pool[i] if worker.exitcode is not None: # worker exited util.debug('cleaning up worker %d' % i) worker.join() cleaned = True del self._pool[i] return cleaned def _repopulate_pool(self): """Bring the number of pool processes up to the specified number, for use after reaping workers which have exited. """ for i in range(self._processes - len(self._pool)): w = self.Process(target=worker, args=(self._inqueue, self._outqueue, self._initializer, self._initargs, self._maxtasksperchild, self._wrap_exception) ) self._pool.append(w) w.name = w.name.replace('Process', 'PoolWorker') w.daemon = True w.start() util.debug('added worker') def _maintain_pool(self): """Clean up any exited workers and start replacements for them. """ if self._join_exited_workers(): self._repopulate_pool() def _setup_queues(self): self._inqueue = self._ctx.SimpleQueue() self._outqueue = self._ctx.SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv def apply(self, func, args=(), kwds={}): ''' Equivalent of `func(*args, **kwds)`. ''' assert self._state == RUN return self.apply_async(func, args, kwds).get() def map(self, func, iterable, chunksize=None): ''' Apply `func` to each element in `iterable`, collecting the results in a list that is returned. ''' return self._map_async(func, iterable, mapstar, chunksize).get() def starmap(self, func, iterable, chunksize=None): ''' Like `map()` method but the elements of the `iterable` are expected to be iterables as well and will be unpacked as arguments. Hence `func` and (a, b) becomes func(a, b). ''' return self._map_async(func, iterable, starmapstar, chunksize).get() def starmap_async(self, func, iterable, chunksize=None, callback=None, error_callback=None): ''' Asynchronous version of `starmap()` method. ''' return self._map_async(func, iterable, starmapstar, chunksize, callback, error_callback) def _guarded_task_generation(self, result_job, func, iterable): '''Provides a generator of tasks for imap and imap_unordered with appropriate handling for iterables which throw exceptions during iteration.''' try: i = -1 for i, x in enumerate(iterable): yield (result_job, i, func, (x,), {}) except Exception as e: yield (result_job, i+1, _helper_reraises_exception, (e,), {}) def imap(self, func, iterable, chunksize=1): ''' Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. ''' if self._state != RUN: raise ValueError("Pool not running") if chunksize == 1: result = IMapIterator(self._cache) self._taskqueue.put( ( self._guarded_task_generation(result._job, func, iterable), result._set_length )) return result else: assert chunksize > 1 task_batches = Pool._get_tasks(func, iterable, chunksize) result = IMapIterator(self._cache) self._taskqueue.put( ( self._guarded_task_generation(result._job, mapstar, task_batches), result._set_length )) return (item for chunk in result for item in chunk) def imap_unordered(self, func, iterable, chunksize=1): ''' Like `imap()` method but ordering of results is arbitrary. ''' if self._state != RUN: raise ValueError("Pool not running") if chunksize == 1: result = IMapUnorderedIterator(self._cache) self._taskqueue.put( ( self._guarded_task_generation(result._job, func, iterable), result._set_length )) return result else: assert chunksize > 1 task_batches = Pool._get_tasks(func, iterable, chunksize) result = IMapUnorderedIterator(self._cache) self._taskqueue.put( ( self._guarded_task_generation(result._job, mapstar, task_batches), result._set_length )) return (item for chunk in result for item in chunk) def apply_async(self, func, args=(), kwds={}, callback=None, error_callback=None): ''' Asynchronous version of `apply()` method. ''' if self._state != RUN: raise ValueError("Pool not running") result = ApplyResult(self._cache, callback, error_callback) self._taskqueue.put(([(result._job, 0, func, args, kwds)], None)) return result def map_async(self, func, iterable, chunksize=None, callback=None, error_callback=None): ''' Asynchronous version of `map()` method. ''' return self._map_async(func, iterable, mapstar, chunksize, callback, error_callback) def _map_async(self, func, iterable, mapper, chunksize=None, callback=None, error_callback=None): ''' Helper function to implement map, starmap and their async counterparts. ''' if self._state != RUN: raise ValueError("Pool not running") if not hasattr(iterable, '__len__'): iterable = list(iterable) if chunksize is None: chunksize, extra = divmod(len(iterable), len(self._pool) * 4) if extra: chunksize += 1 if len(iterable) == 0: chunksize = 0 task_batches = Pool._get_tasks(func, iterable, chunksize) result = MapResult(self._cache, chunksize, len(iterable), callback, error_callback=error_callback) self._taskqueue.put( ( self._guarded_task_generation(result._job, mapper, task_batches), None ) ) return result @staticmethod def _handle_workers(pool): thread = threading.current_thread() # Keep maintaining workers until the cache gets drained, unless the pool # is terminated. while thread._state == RUN or (pool._cache and thread._state != TERMINATE): pool._maintain_pool() time.sleep(0.1) # send sentinel to stop workers pool._taskqueue.put(None) util.debug('worker handler exiting') @staticmethod def _handle_tasks(taskqueue, put, outqueue, pool, cache): thread = threading.current_thread() for taskseq, set_length in iter(taskqueue.get, None): task = None try: # iterating taskseq cannot fail for task in taskseq: if thread._state: util.debug('task handler found thread._state != RUN') break try: put(task) except Exception as e: job, idx = task[:2] try: cache[job]._set(idx, (False, e)) except KeyError: pass else: if set_length: util.debug('doing set_length()') idx = task[1] if task else -1 set_length(idx + 1) continue break finally: task = taskseq = job = None else: util.debug('task handler got sentinel') try: # tell result handler to finish when cache is empty util.debug('task handler sending sentinel to result handler') outqueue.put(None) # tell workers there is no more work util.debug('task handler sending sentinel to workers') for p in pool: put(None) except OSError: util.debug('task handler got OSError when sending sentinels') util.debug('task handler exiting') @staticmethod def _handle_results(outqueue, get, cache): thread = threading.current_thread() while 1: try: task = get() except (OSError, EOFError): util.debug('result handler got EOFError/OSError -- exiting') return if thread._state: assert thread._state == TERMINATE util.debug('result handler found thread._state=TERMINATE') break if task is None: util.debug('result handler got sentinel') break job, i, obj = task try: cache[job]._set(i, obj) except KeyError: pass task = job = obj = None while cache and thread._state != TERMINATE: try: task = get() except (OSError, EOFError): util.debug('result handler got EOFError/OSError -- exiting') return if task is None: util.debug('result handler ignoring extra sentinel') continue job, i, obj = task try: cache[job]._set(i, obj) except KeyError: pass task = job = obj = None if hasattr(outqueue, '_reader'): util.debug('ensuring that outqueue is not full') # If we don't make room available in outqueue then # attempts to add the sentinel (None) to outqueue may # block. There is guaranteed to be no more than 2 sentinels. try: for i in range(10): if not outqueue._reader.poll(): break get() except (OSError, EOFError): pass util.debug('result handler exiting: len(cache)=%s, thread._state=%s', len(cache), thread._state) @staticmethod def _get_tasks(func, it, size): it = iter(it) while 1: x = tuple(itertools.islice(it, size)) if not x: return yield (func, x) def __reduce__(self): raise NotImplementedError( 'pool objects cannot be passed between processes or pickled' ) def close(self): util.debug('closing pool') if self._state == RUN: self._state = CLOSE self._worker_handler._state = CLOSE def terminate(self): util.debug('terminating pool') self._state = TERMINATE self._worker_handler._state = TERMINATE self._terminate() def join(self): util.debug('joining pool') assert self._state in (CLOSE, TERMINATE) self._worker_handler.join() self._task_handler.join() self._result_handler.join() for p in self._pool: p.join() @staticmethod def _help_stuff_finish(inqueue, task_handler, size): # task_handler may be blocked trying to put items on inqueue util.debug('removing tasks from inqueue until task handler finished') inqueue._rlock.acquire() while task_handler.is_alive() and inqueue._reader.poll(): inqueue._reader.recv() time.sleep(0) @classmethod def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, worker_handler, task_handler, result_handler, cache): # this is guaranteed to only be called once util.debug('finalizing pool') worker_handler._state = TERMINATE task_handler._state = TERMINATE util.debug('helping task handler/workers to finish') cls._help_stuff_finish(inqueue, task_handler, len(pool)) assert result_handler.is_alive() or len(cache) == 0 result_handler._state = TERMINATE outqueue.put(None) # sentinel # We must wait for the worker handler to exit before terminating # workers because we don't want workers to be restarted behind our back. util.debug('joining worker handler') if threading.current_thread() is not worker_handler: worker_handler.join() # Terminate workers which haven't already finished. if pool and hasattr(pool[0], 'terminate'): util.debug('terminating workers') for p in pool: if p.exitcode is None: p.terminate() util.debug('joining task handler') if threading.current_thread() is not task_handler: task_handler.join() util.debug('joining result handler') if threading.current_thread() is not result_handler: result_handler.join() if pool and hasattr(pool[0], 'terminate'): util.debug('joining pool workers') for p in pool: if p.is_alive(): # worker has not yet exited util.debug('cleaning up worker %d' % p.pid) p.join() def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): self.terminate() # # Class whose instances are returned by `Pool.apply_async()` # class ApplyResult(object): def __init__(self, cache, callback, error_callback): self._event = threading.Event() self._job = next(job_counter) self._cache = cache self._callback = callback self._error_callback = error_callback cache[self._job] = self def ready(self): return self._event.is_set() def successful(self): assert self.ready() return self._success def wait(self, timeout=None): self._event.wait(timeout) def get(self, timeout=None): self.wait(timeout) if not self.ready(): raise TimeoutError if self._success: return self._value else: raise self._value def _set(self, i, obj): self._success, self._value = obj if self._callback and self._success: self._callback(self._value) if self._error_callback and not self._success: self._error_callback(self._value) self._event.set() del self._cache[self._job] AsyncResult = ApplyResult # create alias -- see #17805 # # Class whose instances are returned by `Pool.map_async()` # class MapResult(ApplyResult): def __init__(self, cache, chunksize, length, callback, error_callback): ApplyResult.__init__(self, cache, callback, error_callback=error_callback) self._success = True self._value = [None] * length self._chunksize = chunksize if chunksize <= 0: self._number_left = 0 self._event.set() del cache[self._job] else: self._number_left = length//chunksize + bool(length % chunksize) def _set(self, i, success_result): self._number_left -= 1 success, result = success_result if success and self._success: self._value[i*self._chunksize:(i+1)*self._chunksize] = result if self._number_left == 0: if self._callback: self._callback(self._value) del self._cache[self._job] self._event.set() else: if not success and self._success: # only store first exception self._success = False self._value = result if self._number_left == 0: # only consider the result ready once all jobs are done if self._error_callback: self._error_callback(self._value) del self._cache[self._job] self._event.set() # # Class whose instances are returned by `Pool.imap()` # class IMapIterator(object): def __init__(self, cache): self._cond = threading.Condition(threading.Lock()) self._job = next(job_counter) self._cache = cache self._items = collections.deque() self._index = 0 self._length = None self._unsorted = {} cache[self._job] = self def __iter__(self): return self def next(self, timeout=None): with self._cond: try: item = self._items.popleft() except IndexError: if self._index == self._length: raise StopIteration self._cond.wait(timeout) try: item = self._items.popleft() except IndexError: if self._index == self._length: raise StopIteration raise TimeoutError success, value = item if success: return value raise value __next__ = next # XXX def _set(self, i, obj): with self._cond: if self._index == i: self._items.append(obj) self._index += 1 while self._index in self._unsorted: obj = self._unsorted.pop(self._index) self._items.append(obj) self._index += 1 self._cond.notify() else: self._unsorted[i] = obj if self._index == self._length: del self._cache[self._job] def _set_length(self, length): with self._cond: self._length = length if self._index == self._length: self._cond.notify() del self._cache[self._job] # # Class whose instances are returned by `Pool.imap_unordered()` # class IMapUnorderedIterator(IMapIterator): def _set(self, i, obj): with self._cond: self._items.append(obj) self._index += 1 self._cond.notify() if self._index == self._length: del self._cache[self._job] # # # class ThreadPool(Pool): _wrap_exception = False @staticmethod def Process(*args, **kwds): from .dummy import Process return Process(*args, **kwds) def __init__(self, processes=None, initializer=None, initargs=()): Pool.__init__(self, processes, initializer, initargs) def _setup_queues(self): self._inqueue = queue.Queue() self._outqueue = queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get @staticmethod def _help_stuff_finish(inqueue, task_handler, size): # put sentinels at head of inqueue to make workers finish with inqueue.not_empty: inqueue.queue.clear() inqueue.queue.extend([None] * size) inqueue.not_empty.notify_all()
26,059
804
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] # # Imports # import sys import threading import array import queue import time from traceback import format_exc from . import connection from .context import reduction, get_spawning_popen from . import pool from . import process from . import util from . import get_context # # Register some things for pickling # def reduce_array(a): return array.array, (a.typecode, a.tobytes()) reduction.register(array.array, reduce_array) view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] if view_types[0] is not list: # only needed in Py3.0 def rebuild_as_list(obj): return list, (list(obj),) for view_type in view_types: reduction.register(view_type, rebuild_as_list) # # Type for identifying shared objects # class Token(object): ''' Type to uniquely indentify a shared object ''' __slots__ = ('typeid', 'address', 'id') def __init__(self, typeid, address, id): (self.typeid, self.address, self.id) = (typeid, address, id) def __getstate__(self): return (self.typeid, self.address, self.id) def __setstate__(self, state): (self.typeid, self.address, self.id) = state def __repr__(self): return '%s(typeid=%r, address=%r, id=%r)' % \ (self.__class__.__name__, self.typeid, self.address, self.id) # # Function for communication with a manager's server process # def dispatch(c, id, methodname, args=(), kwds={}): ''' Send a message to manager using connection `c` and return response ''' c.send((id, methodname, args, kwds)) kind, result = c.recv() if kind == '#RETURN': return result raise convert_to_error(kind, result) def convert_to_error(kind, result): if kind == '#ERROR': return result elif kind == '#TRACEBACK': assert type(result) is str return RemoteError(result) elif kind == '#UNSERIALIZABLE': assert type(result) is str return RemoteError('Unserializable message: %s\n' % result) else: return ValueError('Unrecognized message type') class RemoteError(Exception): def __str__(self): return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) # # Functions for finding the method names of an object # def all_methods(obj): ''' Return a list of names of methods of `obj` ''' temp = [] for name in dir(obj): func = getattr(obj, name) if callable(func): temp.append(name) return temp def public_methods(obj): ''' Return a list of names of methods of `obj` which do not start with '_' ''' return [name for name in all_methods(obj) if name[0] != '_'] # # Server which is run in a process controlled by a manager # class Server(object): ''' Server class which runs in a process controlled by a manager object ''' public = ['shutdown', 'create', 'accept_connection', 'get_methods', 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] def __init__(self, registry, address, authkey, serializer): assert isinstance(authkey, bytes) self.registry = registry self.authkey = process.AuthenticationString(authkey) Listener, Client = listener_client[serializer] # do authentication later self.listener = Listener(address=address, backlog=16) self.address = self.listener.address self.id_to_obj = {'0': (None, ())} self.id_to_refcount = {} self.id_to_local_proxy_obj = {} self.mutex = threading.Lock() def serve_forever(self): ''' Run the server forever ''' self.stop_event = threading.Event() process.current_process()._manager_server = self try: accepter = threading.Thread(target=self.accepter) accepter.daemon = True accepter.start() try: while not self.stop_event.is_set(): self.stop_event.wait(1) except (KeyboardInterrupt, SystemExit): pass finally: if sys.stdout != sys.__stdout__: util.debug('resetting stdout, stderr') sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ sys.exit(0) def accepter(self): while True: try: c = self.listener.accept() except OSError: continue t = threading.Thread(target=self.handle_request, args=(c,)) t.daemon = True t.start() def handle_request(self, c): ''' Handle a new connection ''' funcname = result = request = None try: connection.deliver_challenge(c, self.authkey) connection.answer_challenge(c, self.authkey) request = c.recv() ignore, funcname, args, kwds = request assert funcname in self.public, '%r unrecognized' % funcname func = getattr(self, funcname) except Exception: msg = ('#TRACEBACK', format_exc()) else: try: result = func(c, *args, **kwds) except Exception: msg = ('#TRACEBACK', format_exc()) else: msg = ('#RETURN', result) try: c.send(msg) except Exception as e: try: c.send(('#TRACEBACK', format_exc())) except Exception: pass util.info('Failure to send message: %r', msg) util.info(' ... request was %r', request) util.info(' ... exception was %r', e) c.close() def serve_client(self, conn): ''' Handle requests from the proxies in a particular process/thread ''' util.debug('starting server thread to service %r', threading.current_thread().name) recv = conn.recv send = conn.send id_to_obj = self.id_to_obj while not self.stop_event.is_set(): try: methodname = obj = None request = recv() ident, methodname, args, kwds = request try: obj, exposed, gettypeid = id_to_obj[ident] except KeyError as ke: try: obj, exposed, gettypeid = \ self.id_to_local_proxy_obj[ident] except KeyError as second_ke: raise ke if methodname not in exposed: raise AttributeError( 'method %r of %r object is not in exposed=%r' % (methodname, type(obj), exposed) ) function = getattr(obj, methodname) try: res = function(*args, **kwds) except Exception as e: msg = ('#ERROR', e) else: typeid = gettypeid and gettypeid.get(methodname, None) if typeid: rident, rexposed = self.create(conn, typeid, res) token = Token(typeid, self.address, rident) msg = ('#PROXY', (rexposed, token)) else: msg = ('#RETURN', res) except AttributeError: if methodname is None: msg = ('#TRACEBACK', format_exc()) else: try: fallback_func = self.fallback_mapping[methodname] result = fallback_func( self, conn, ident, obj, *args, **kwds ) msg = ('#RETURN', result) except Exception: msg = ('#TRACEBACK', format_exc()) except EOFError: util.debug('got EOF -- exiting thread serving %r', threading.current_thread().name) sys.exit(0) except Exception: msg = ('#TRACEBACK', format_exc()) try: try: send(msg) except Exception as e: send(('#UNSERIALIZABLE', format_exc())) except Exception as e: util.info('exception in thread serving %r', threading.current_thread().name) util.info(' ... message was %r', msg) util.info(' ... exception was %r', e) conn.close() sys.exit(1) def fallback_getvalue(self, conn, ident, obj): return obj def fallback_str(self, conn, ident, obj): return str(obj) def fallback_repr(self, conn, ident, obj): return repr(obj) fallback_mapping = { '__str__':fallback_str, '__repr__':fallback_repr, '#GETVALUE':fallback_getvalue } def dummy(self, c): pass def debug_info(self, c): ''' Return some info --- useful to spot problems with refcounting ''' with self.mutex: result = [] keys = list(self.id_to_refcount.keys()) keys.sort() for ident in keys: if ident != '0': result.append(' %s: refcount=%s\n %s' % (ident, self.id_to_refcount[ident], str(self.id_to_obj[ident][0])[:75])) return '\n'.join(result) def number_of_objects(self, c): ''' Number of shared objects ''' # Doesn't use (len(self.id_to_obj) - 1) as we shouldn't count ident='0' return len(self.id_to_refcount) def shutdown(self, c): ''' Shutdown this process ''' try: util.debug('manager received shutdown message') c.send(('#RETURN', None)) except: import traceback traceback.print_exc() finally: self.stop_event.set() def create(self, c, typeid, *args, **kwds): ''' Create a new shared object and return its id ''' with self.mutex: callable, exposed, method_to_typeid, proxytype = \ self.registry[typeid] if callable is None: assert len(args) == 1 and not kwds obj = args[0] else: obj = callable(*args, **kwds) if exposed is None: exposed = public_methods(obj) if method_to_typeid is not None: assert type(method_to_typeid) is dict exposed = list(exposed) + list(method_to_typeid) ident = '%x' % id(obj) # convert to string because xmlrpclib # only has 32 bit signed integers util.debug('%r callable returned object with id %r', typeid, ident) self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) if ident not in self.id_to_refcount: self.id_to_refcount[ident] = 0 self.incref(c, ident) return ident, tuple(exposed) def get_methods(self, c, token): ''' Return the methods of the shared object indicated by token ''' return tuple(self.id_to_obj[token.id][1]) def accept_connection(self, c, name): ''' Spawn a new thread to serve this connection ''' threading.current_thread().name = name c.send(('#RETURN', None)) self.serve_client(c) def incref(self, c, ident): with self.mutex: try: self.id_to_refcount[ident] += 1 except KeyError as ke: # If no external references exist but an internal (to the # manager) still does and a new external reference is created # from it, restore the manager's tracking of it from the # previously stashed internal ref. if ident in self.id_to_local_proxy_obj: self.id_to_refcount[ident] = 1 self.id_to_obj[ident] = \ self.id_to_local_proxy_obj[ident] obj, exposed, gettypeid = self.id_to_obj[ident] util.debug('Server re-enabled tracking & INCREF %r', ident) else: raise ke def decref(self, c, ident): if ident not in self.id_to_refcount and \ ident in self.id_to_local_proxy_obj: util.debug('Server DECREF skipping %r', ident) return with self.mutex: assert self.id_to_refcount[ident] >= 1 self.id_to_refcount[ident] -= 1 if self.id_to_refcount[ident] == 0: del self.id_to_refcount[ident] if ident not in self.id_to_refcount: # Two-step process in case the object turns out to contain other # proxy objects (e.g. a managed list of managed lists). # Otherwise, deleting self.id_to_obj[ident] would trigger the # deleting of the stored value (another managed object) which would # in turn attempt to acquire the mutex that is already held here. self.id_to_obj[ident] = (None, (), None) # thread-safe util.debug('disposing of obj with id %r', ident) with self.mutex: del self.id_to_obj[ident] # # Class to represent state of a manager # class State(object): __slots__ = ['value'] INITIAL = 0 STARTED = 1 SHUTDOWN = 2 # # Mapping from serializer name to Listener and Client types # listener_client = { 'pickle' : (connection.Listener, connection.Client), 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) } # # Definition of BaseManager # class BaseManager(object): ''' Base class for managers ''' _registry = {} _Server = Server def __init__(self, address=None, authkey=None, serializer='pickle', ctx=None): if authkey is None: authkey = process.current_process().authkey self._address = address # XXX not final address if eg ('', 0) self._authkey = process.AuthenticationString(authkey) self._state = State() self._state.value = State.INITIAL self._serializer = serializer self._Listener, self._Client = listener_client[serializer] self._ctx = ctx or get_context() def get_server(self): ''' Return server object with serve_forever() method and address attribute ''' assert self._state.value == State.INITIAL return Server(self._registry, self._address, self._authkey, self._serializer) def connect(self): ''' Connect manager object to the server process ''' Listener, Client = listener_client[self._serializer] conn = Client(self._address, authkey=self._authkey) dispatch(conn, None, 'dummy') self._state.value = State.STARTED def start(self, initializer=None, initargs=()): ''' Spawn a server process for this manager object ''' assert self._state.value == State.INITIAL if initializer is not None and not callable(initializer): raise TypeError('initializer must be a callable') # pipe over which we will retrieve address of server reader, writer = connection.Pipe(duplex=False) # spawn process which runs a server self._process = self._ctx.Process( target=type(self)._run_server, args=(self._registry, self._address, self._authkey, self._serializer, writer, initializer, initargs), ) ident = ':'.join(str(i) for i in self._process._identity) self._process.name = type(self).__name__ + '-' + ident self._process.start() # get address of server writer.close() self._address = reader.recv() reader.close() # register a finalizer self._state.value = State.STARTED self.shutdown = util.Finalize( self, type(self)._finalize_manager, args=(self._process, self._address, self._authkey, self._state, self._Client), exitpriority=0 ) @classmethod def _run_server(cls, registry, address, authkey, serializer, writer, initializer=None, initargs=()): ''' Create a server, report its address and run it ''' if initializer is not None: initializer(*initargs) # create server server = cls._Server(registry, address, authkey, serializer) # inform parent process of the server's address writer.send(server.address) writer.close() # run the manager util.info('manager serving at %r', server.address) server.serve_forever() def _create(self, typeid, *args, **kwds): ''' Create a new shared object; return the token and exposed tuple ''' assert self._state.value == State.STARTED, 'server not yet started' conn = self._Client(self._address, authkey=self._authkey) try: id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) finally: conn.close() return Token(typeid, self._address, id), exposed def join(self, timeout=None): ''' Join the manager process (if it has been spawned) ''' if self._process is not None: self._process.join(timeout) if not self._process.is_alive(): self._process = None def _debug_info(self): ''' Return some info about the servers shared objects and connections ''' conn = self._Client(self._address, authkey=self._authkey) try: return dispatch(conn, None, 'debug_info') finally: conn.close() def _number_of_objects(self): ''' Return the number of shared objects ''' conn = self._Client(self._address, authkey=self._authkey) try: return dispatch(conn, None, 'number_of_objects') finally: conn.close() def __enter__(self): if self._state.value == State.INITIAL: self.start() assert self._state.value == State.STARTED return self def __exit__(self, exc_type, exc_val, exc_tb): self.shutdown() @staticmethod def _finalize_manager(process, address, authkey, state, _Client): ''' Shutdown the manager process; will be registered as a finalizer ''' if process.is_alive(): util.info('sending shutdown message to manager') try: conn = _Client(address, authkey=authkey) try: dispatch(conn, None, 'shutdown') finally: conn.close() except Exception: pass process.join(timeout=1.0) if process.is_alive(): util.info('manager still alive') if hasattr(process, 'terminate'): util.info('trying to `terminate()` manager process') process.terminate() process.join(timeout=0.1) if process.is_alive(): util.info('manager still alive after terminate') state.value = State.SHUTDOWN try: del BaseProxy._address_to_local[address] except KeyError: pass address = property(lambda self: self._address) @classmethod def register(cls, typeid, callable=None, proxytype=None, exposed=None, method_to_typeid=None, create_method=True): ''' Register a typeid with the manager type ''' if '_registry' not in cls.__dict__: cls._registry = cls._registry.copy() if proxytype is None: proxytype = AutoProxy exposed = exposed or getattr(proxytype, '_exposed_', None) method_to_typeid = method_to_typeid or \ getattr(proxytype, '_method_to_typeid_', None) if method_to_typeid: for key, value in list(method_to_typeid.items()): assert type(key) is str, '%r is not a string' % key assert type(value) is str, '%r is not a string' % value cls._registry[typeid] = ( callable, exposed, method_to_typeid, proxytype ) if create_method: def temp(self, *args, **kwds): util.debug('requesting creation of a shared %r object', typeid) token, exp = self._create(typeid, *args, **kwds) proxy = proxytype( token, self._serializer, manager=self, authkey=self._authkey, exposed=exp ) conn = self._Client(token.address, authkey=self._authkey) dispatch(conn, None, 'decref', (token.id,)) return proxy temp.__name__ = typeid setattr(cls, typeid, temp) # # Subclass of set which get cleared after a fork # class ProcessLocalSet(set): def __init__(self): util.register_after_fork(self, lambda obj: obj.clear()) def __reduce__(self): return type(self), () # # Definition of BaseProxy # class BaseProxy(object): ''' A base for proxies of shared objects ''' _address_to_local = {} _mutex = util.ForkAwareThreadLock() def __init__(self, token, serializer, manager=None, authkey=None, exposed=None, incref=True, manager_owned=False): with BaseProxy._mutex: tls_idset = BaseProxy._address_to_local.get(token.address, None) if tls_idset is None: tls_idset = util.ForkAwareLocal(), ProcessLocalSet() BaseProxy._address_to_local[token.address] = tls_idset # self._tls is used to record the connection used by this # thread to communicate with the manager at token.address self._tls = tls_idset[0] # self._idset is used to record the identities of all shared # objects for which the current process owns references and # which are in the manager at token.address self._idset = tls_idset[1] self._token = token self._id = self._token.id self._manager = manager self._serializer = serializer self._Client = listener_client[serializer][1] # Should be set to True only when a proxy object is being created # on the manager server; primary use case: nested proxy objects. # RebuildProxy detects when a proxy is being created on the manager # and sets this value appropriately. self._owned_by_manager = manager_owned if authkey is not None: self._authkey = process.AuthenticationString(authkey) elif self._manager is not None: self._authkey = self._manager._authkey else: self._authkey = process.current_process().authkey if incref: self._incref() util.register_after_fork(self, BaseProxy._after_fork) def _connect(self): util.debug('making connection to manager') name = process.current_process().name if threading.current_thread().name != 'MainThread': name += '|' + threading.current_thread().name conn = self._Client(self._token.address, authkey=self._authkey) dispatch(conn, None, 'accept_connection', (name,)) self._tls.connection = conn def _callmethod(self, methodname, args=(), kwds={}): ''' Try to call a method of the referrent and return a copy of the result ''' try: conn = self._tls.connection except AttributeError: util.debug('thread %r does not own a connection', threading.current_thread().name) self._connect() conn = self._tls.connection conn.send((self._id, methodname, args, kwds)) kind, result = conn.recv() if kind == '#RETURN': return result elif kind == '#PROXY': exposed, token = result proxytype = self._manager._registry[token.typeid][-1] token.address = self._token.address proxy = proxytype( token, self._serializer, manager=self._manager, authkey=self._authkey, exposed=exposed ) conn = self._Client(token.address, authkey=self._authkey) dispatch(conn, None, 'decref', (token.id,)) return proxy raise convert_to_error(kind, result) def _getvalue(self): ''' Get a copy of the value of the referent ''' return self._callmethod('#GETVALUE') def _incref(self): if self._owned_by_manager: util.debug('owned_by_manager skipped INCREF of %r', self._token.id) return conn = self._Client(self._token.address, authkey=self._authkey) dispatch(conn, None, 'incref', (self._id,)) util.debug('INCREF %r', self._token.id) self._idset.add(self._id) state = self._manager and self._manager._state self._close = util.Finalize( self, BaseProxy._decref, args=(self._token, self._authkey, state, self._tls, self._idset, self._Client), exitpriority=10 ) @staticmethod def _decref(token, authkey, state, tls, idset, _Client): idset.discard(token.id) # check whether manager is still alive if state is None or state.value == State.STARTED: # tell manager this process no longer cares about referent try: util.debug('DECREF %r', token.id) conn = _Client(token.address, authkey=authkey) dispatch(conn, None, 'decref', (token.id,)) except Exception as e: util.debug('... decref failed %s', e) else: util.debug('DECREF %r -- manager already shutdown', token.id) # check whether we can close this thread's connection because # the process owns no more references to objects for this manager if not idset and hasattr(tls, 'connection'): util.debug('thread %r has no more proxies so closing conn', threading.current_thread().name) tls.connection.close() del tls.connection def _after_fork(self): self._manager = None try: self._incref() except Exception as e: # the proxy may just be for a manager which has shutdown util.info('incref failed: %s' % e) def __reduce__(self): kwds = {} if get_spawning_popen() is not None: kwds['authkey'] = self._authkey if getattr(self, '_isauto', False): kwds['exposed'] = self._exposed_ return (RebuildProxy, (AutoProxy, self._token, self._serializer, kwds)) else: return (RebuildProxy, (type(self), self._token, self._serializer, kwds)) def __deepcopy__(self, memo): return self._getvalue() def __repr__(self): return '<%s object, typeid %r at %#x>' % \ (type(self).__name__, self._token.typeid, id(self)) def __str__(self): ''' Return representation of the referent (or a fall-back if that fails) ''' try: return self._callmethod('__repr__') except Exception: return repr(self)[:-1] + "; '__str__()' failed>" # # Function used for unpickling # def RebuildProxy(func, token, serializer, kwds): ''' Function used for unpickling proxy objects. ''' server = getattr(process.current_process(), '_manager_server', None) if server and server.address == token.address: util.debug('Rebuild a proxy owned by manager, token=%r', token) kwds['manager_owned'] = True if token.id not in server.id_to_local_proxy_obj: server.id_to_local_proxy_obj[token.id] = \ server.id_to_obj[token.id] incref = ( kwds.pop('incref', True) and not getattr(process.current_process(), '_inheriting', False) ) return func(token, serializer, incref=incref, **kwds) # # Functions to create proxies and proxy types # def MakeProxyType(name, exposed, _cache={}): ''' Return a proxy type whose methods are given by `exposed` ''' exposed = tuple(exposed) try: return _cache[(name, exposed)] except KeyError: pass dic = {} for meth in exposed: exec('''def %s(self, *args, **kwds): return self._callmethod(%r, args, kwds)''' % (meth, meth), dic) ProxyType = type(name, (BaseProxy,), dic) ProxyType._exposed_ = exposed _cache[(name, exposed)] = ProxyType return ProxyType def AutoProxy(token, serializer, manager=None, authkey=None, exposed=None, incref=True): ''' Return an auto-proxy for `token` ''' _Client = listener_client[serializer][1] if exposed is None: conn = _Client(token.address, authkey=authkey) try: exposed = dispatch(conn, None, 'get_methods', (token,)) finally: conn.close() if authkey is None and manager is not None: authkey = manager._authkey if authkey is None: authkey = process.current_process().authkey ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, incref=incref) proxy._isauto = True return proxy # # Types/callables which we will register with SyncManager # class Namespace(object): def __init__(self, **kwds): self.__dict__.update(kwds) def __repr__(self): items = list(self.__dict__.items()) temp = [] for name, value in items: if not name.startswith('_'): temp.append('%s=%r' % (name, value)) temp.sort() return '%s(%s)' % (self.__class__.__name__, ', '.join(temp)) class Value(object): def __init__(self, typecode, value, lock=True): self._typecode = typecode self._value = value def get(self): return self._value def set(self, value): self._value = value def __repr__(self): return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) value = property(get, set) def Array(typecode, sequence, lock=True): return array.array(typecode, sequence) # # Proxy types used by SyncManager # class IteratorProxy(BaseProxy): _exposed_ = ('__next__', 'send', 'throw', 'close') def __iter__(self): return self def __next__(self, *args): return self._callmethod('__next__', args) def send(self, *args): return self._callmethod('send', args) def throw(self, *args): return self._callmethod('throw', args) def close(self, *args): return self._callmethod('close', args) class AcquirerProxy(BaseProxy): _exposed_ = ('acquire', 'release') def acquire(self, blocking=True, timeout=None): args = (blocking,) if timeout is None else (blocking, timeout) return self._callmethod('acquire', args) def release(self): return self._callmethod('release') def __enter__(self): return self._callmethod('acquire') def __exit__(self, exc_type, exc_val, exc_tb): return self._callmethod('release') class ConditionProxy(AcquirerProxy): _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') def wait(self, timeout=None): return self._callmethod('wait', (timeout,)) def notify(self): return self._callmethod('notify') def notify_all(self): return self._callmethod('notify_all') def wait_for(self, predicate, timeout=None): result = predicate() if result: return result if timeout is not None: endtime = time.monotonic() + timeout else: endtime = None waittime = None while not result: if endtime is not None: waittime = endtime - time.monotonic() if waittime <= 0: break self.wait(waittime) result = predicate() return result class EventProxy(BaseProxy): _exposed_ = ('is_set', 'set', 'clear', 'wait') def is_set(self): return self._callmethod('is_set') def set(self): return self._callmethod('set') def clear(self): return self._callmethod('clear') def wait(self, timeout=None): return self._callmethod('wait', (timeout,)) class BarrierProxy(BaseProxy): _exposed_ = ('__getattribute__', 'wait', 'abort', 'reset') def wait(self, timeout=None): return self._callmethod('wait', (timeout,)) def abort(self): return self._callmethod('abort') def reset(self): return self._callmethod('reset') @property def parties(self): return self._callmethod('__getattribute__', ('parties',)) @property def n_waiting(self): return self._callmethod('__getattribute__', ('n_waiting',)) @property def broken(self): return self._callmethod('__getattribute__', ('broken',)) class NamespaceProxy(BaseProxy): _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') def __getattr__(self, key): if key[0] == '_': return object.__getattribute__(self, key) callmethod = object.__getattribute__(self, '_callmethod') return callmethod('__getattribute__', (key,)) def __setattr__(self, key, value): if key[0] == '_': return object.__setattr__(self, key, value) callmethod = object.__getattribute__(self, '_callmethod') return callmethod('__setattr__', (key, value)) def __delattr__(self, key): if key[0] == '_': return object.__delattr__(self, key) callmethod = object.__getattribute__(self, '_callmethod') return callmethod('__delattr__', (key,)) class ValueProxy(BaseProxy): _exposed_ = ('get', 'set') def get(self): return self._callmethod('get') def set(self, value): return self._callmethod('set', (value,)) value = property(get, set) BaseListProxy = MakeProxyType('BaseListProxy', ( '__add__', '__contains__', '__delitem__', '__getitem__', '__len__', '__mul__', '__reversed__', '__rmul__', '__setitem__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort', '__imul__' )) class ListProxy(BaseListProxy): def __iadd__(self, value): self._callmethod('extend', (value,)) return self def __imul__(self, value): self._callmethod('__imul__', (value,)) return self DictProxy = MakeProxyType('DictProxy', ( '__contains__', '__delitem__', '__getitem__', '__iter__', '__len__', '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' )) DictProxy._method_to_typeid_ = { '__iter__': 'Iterator', } ArrayProxy = MakeProxyType('ArrayProxy', ( '__len__', '__getitem__', '__setitem__' )) BasePoolProxy = MakeProxyType('PoolProxy', ( 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', 'map', 'map_async', 'starmap', 'starmap_async', 'terminate', )) BasePoolProxy._method_to_typeid_ = { 'apply_async': 'AsyncResult', 'map_async': 'AsyncResult', 'starmap_async': 'AsyncResult', 'imap': 'Iterator', 'imap_unordered': 'Iterator' } class PoolProxy(BasePoolProxy): def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): self.terminate() # # Definition of SyncManager # class SyncManager(BaseManager): ''' Subclass of `BaseManager` which supports a number of shared object types. The types registered are those intended for the synchronization of threads, plus `dict`, `list` and `Namespace`. The `multiprocessing.Manager()` function creates started instances of this class. ''' SyncManager.register('Queue', queue.Queue) SyncManager.register('JoinableQueue', queue.Queue) SyncManager.register('Event', threading.Event, EventProxy) SyncManager.register('Lock', threading.Lock, AcquirerProxy) SyncManager.register('RLock', threading.RLock, AcquirerProxy) SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, AcquirerProxy) SyncManager.register('Condition', threading.Condition, ConditionProxy) SyncManager.register('Barrier', threading.Barrier, BarrierProxy) SyncManager.register('Pool', pool.Pool, PoolProxy) SyncManager.register('list', list, ListProxy) SyncManager.register('dict', dict, DictProxy) SyncManager.register('Value', Value, ValueProxy) SyncManager.register('Array', Array, ArrayProxy) SyncManager.register('Namespace', Namespace, NamespaceProxy) # types returned by methods of PoolProxy SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) SyncManager.register('AsyncResult', create_method=False)
38,151
1,164
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/popen_forkserver.py
import io import os from .context import reduction, set_spawning_popen if not reduction.HAVE_SEND_HANDLE: raise ImportError('No support for sending fds between processes') from . import forkserver from . import popen_fork from . import spawn from . import util __all__ = ['Popen'] # # Wrapper for an fd used while launching a process # class _DupFd(object): def __init__(self, ind): self.ind = ind def detach(self): return forkserver.get_inherited_fds()[self.ind] # # Start child process using a server process # class Popen(popen_fork.Popen): method = 'forkserver' DupFd = _DupFd def __init__(self, process_obj): self._fds = [] super().__init__(process_obj) def duplicate_for_child(self, fd): self._fds.append(fd) return len(self._fds) - 1 def _launch(self, process_obj): prep_data = spawn.get_preparation_data(process_obj._name) buf = io.BytesIO() set_spawning_popen(self) try: reduction.dump(prep_data, buf) reduction.dump(process_obj, buf) finally: set_spawning_popen(None) self.sentinel, w = forkserver.connect_to_new_process(self._fds) util.Finalize(self, os.close, (self.sentinel,)) with open(w, 'wb', closefd=True) as f: f.write(buf.getbuffer()) self.pid = forkserver.read_unsigned(self.sentinel) def poll(self, flag=os.WNOHANG): if self.returncode is None: from multiprocessing.connection import wait timeout = 0 if flag == os.WNOHANG else None if not wait([self.sentinel], timeout): return None try: self.returncode = forkserver.read_unsigned(self.sentinel) except (OSError, EOFError): # The process ended abnormally perhaps because of a signal self.returncode = 255 return self.returncode
1,956
69
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/connection.py
# # A higher level module for using sockets (or Windows named pipes) # # multiprocessing/connection.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'Client', 'Listener', 'Pipe', 'wait' ] import io import os import sys import socket import struct import time import tempfile import itertools import _multiprocessing from . import util from . import AuthenticationError, BufferTooShort from .context import reduction _ForkingPickler = reduction.ForkingPickler try: import _winapi from _winapi import WAIT_OBJECT_0, WAIT_ABANDONED_0, WAIT_TIMEOUT, INFINITE except ImportError: if sys.platform == 'win32': raise _winapi = None # # # BUFSIZE = 8192 # A very generous timeout when it comes to local connections... CONNECTION_TIMEOUT = 20. _mmap_counter = itertools.count() default_family = 'AF_INET' families = ['AF_INET'] if hasattr(socket, 'AF_UNIX'): default_family = 'AF_UNIX' families += ['AF_UNIX'] if sys.platform == 'win32': default_family = 'AF_PIPE' families += ['AF_PIPE'] def _init_timeout(timeout=CONNECTION_TIMEOUT): return time.monotonic() + timeout def _check_timeout(t): return time.monotonic() > t # # # def arbitrary_address(family): ''' Return an arbitrary free address for the given family ''' if family == 'AF_INET': return ('localhost', 0) elif family == 'AF_UNIX': return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir()) elif family == 'AF_PIPE': return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % (os.getpid(), next(_mmap_counter)), dir="") else: raise ValueError('unrecognized family') def _validate_family(family): ''' Checks if the family is valid for the current environment. ''' if sys.platform != 'win32' and family == 'AF_PIPE': raise ValueError('Family %s is not recognized.' % family) if sys.platform == 'win32' and family == 'AF_UNIX': # double check if not hasattr(socket, family): raise ValueError('Family %s is not recognized.' % family) def address_type(address): ''' Return the types of the address This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' ''' if type(address) == tuple: return 'AF_INET' elif type(address) is str and address.startswith('\\\\'): return 'AF_PIPE' elif type(address) is str: return 'AF_UNIX' else: raise ValueError('address type of %r unrecognized' % address) # # Connection classes # class _ConnectionBase: _handle = None def __init__(self, handle, readable=True, writable=True): handle = handle.__index__() if handle < 0: raise ValueError("invalid handle") if not readable and not writable: raise ValueError( "at least one of `readable` and `writable` must be True") self._handle = handle self._readable = readable self._writable = writable # XXX should we use util.Finalize instead of a __del__? def __del__(self): if self._handle is not None: self._close() def _check_closed(self): if self._handle is None: raise OSError("handle is closed") def _check_readable(self): if not self._readable: raise OSError("connection is write-only") def _check_writable(self): if not self._writable: raise OSError("connection is read-only") def _bad_message_length(self): if self._writable: self._readable = False else: self.close() raise OSError("bad message length") @property def closed(self): """True if the connection is closed""" return self._handle is None @property def readable(self): """True if the connection is readable""" return self._readable @property def writable(self): """True if the connection is writable""" return self._writable def fileno(self): """File descriptor or handle of the connection""" self._check_closed() return self._handle def close(self): """Close the connection""" if self._handle is not None: try: self._close() finally: self._handle = None def send_bytes(self, buf, offset=0, size=None): """Send the bytes data from a bytes-like object""" self._check_closed() self._check_writable() m = memoryview(buf) # HACK for byte-indexing of non-bytewise buffers (e.g. array.array) if m.itemsize > 1: m = memoryview(bytes(m)) n = len(m) if offset < 0: raise ValueError("offset is negative") if n < offset: raise ValueError("buffer length < offset") if size is None: size = n - offset elif size < 0: raise ValueError("size is negative") elif offset + size > n: raise ValueError("buffer length < offset + size") self._send_bytes(m[offset:offset + size]) def send(self, obj): """Send a (picklable) object""" self._check_closed() self._check_writable() self._send_bytes(_ForkingPickler.dumps(obj)) def recv_bytes(self, maxlength=None): """ Receive bytes data as a bytes object. """ self._check_closed() self._check_readable() if maxlength is not None and maxlength < 0: raise ValueError("negative maxlength") buf = self._recv_bytes(maxlength) if buf is None: self._bad_message_length() return buf.getvalue() def recv_bytes_into(self, buf, offset=0): """ Receive bytes data into a writeable bytes-like object. Return the number of bytes read. """ self._check_closed() self._check_readable() with memoryview(buf) as m: # Get bytesize of arbitrary buffer itemsize = m.itemsize bytesize = itemsize * len(m) if offset < 0: raise ValueError("negative offset") elif offset > bytesize: raise ValueError("offset too large") result = self._recv_bytes() size = result.tell() if bytesize < offset + size: raise BufferTooShort(result.getvalue()) # Message can fit in dest result.seek(0) result.readinto(m[offset // itemsize : (offset + size) // itemsize]) return size def recv(self): """Receive a (picklable) object""" self._check_closed() self._check_readable() buf = self._recv_bytes() return _ForkingPickler.loads(buf.getbuffer()) def poll(self, timeout=0.0): """Whether there is any input available to be read""" self._check_closed() self._check_readable() return self._poll(timeout) def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): self.close() if _winapi: class PipeConnection(_ConnectionBase): """ Connection class based on a Windows named pipe. Overlapped I/O is used, so the handles must have been created with FILE_FLAG_OVERLAPPED. """ _got_empty_message = False def _close(self, _CloseHandle=_winapi.CloseHandle): _CloseHandle(self._handle) def _send_bytes(self, buf): ov, err = _winapi.WriteFile(self._handle, buf, overlapped=True) try: if err == _winapi.ERROR_IO_PENDING: waitres = _winapi.WaitForMultipleObjects( [ov.event], False, INFINITE) assert waitres == WAIT_OBJECT_0 except: ov.cancel() raise finally: nwritten, err = ov.GetOverlappedResult(True) assert err == 0 assert nwritten == len(buf) def _recv_bytes(self, maxsize=None): if self._got_empty_message: self._got_empty_message = False return io.BytesIO() else: bsize = 128 if maxsize is None else min(maxsize, 128) try: ov, err = _winapi.ReadFile(self._handle, bsize, overlapped=True) try: if err == _winapi.ERROR_IO_PENDING: waitres = _winapi.WaitForMultipleObjects( [ov.event], False, INFINITE) assert waitres == WAIT_OBJECT_0 except: ov.cancel() raise finally: nread, err = ov.GetOverlappedResult(True) if err == 0: f = io.BytesIO() f.write(ov.getbuffer()) return f elif err == _winapi.ERROR_MORE_DATA: return self._get_more_data(ov, maxsize) except OSError as e: if e.winerror == _winapi.ERROR_BROKEN_PIPE: raise EOFError else: raise raise RuntimeError("shouldn't get here; expected KeyboardInterrupt") def _poll(self, timeout): if (self._got_empty_message or _winapi.PeekNamedPipe(self._handle)[0] != 0): return True return bool(wait([self], timeout)) def _get_more_data(self, ov, maxsize): buf = ov.getbuffer() f = io.BytesIO() f.write(buf) left = _winapi.PeekNamedPipe(self._handle)[1] assert left > 0 if maxsize is not None and len(buf) + left > maxsize: self._bad_message_length() ov, err = _winapi.ReadFile(self._handle, left, overlapped=True) rbytes, err = ov.GetOverlappedResult(True) assert err == 0 assert rbytes == left f.write(ov.getbuffer()) return f class Connection(_ConnectionBase): """ Connection class based on an arbitrary file descriptor (Unix only), or a socket handle (Windows). """ if _winapi: def _close(self, _close=_multiprocessing.closesocket): _close(self._handle) _write = _multiprocessing.send _read = _multiprocessing.recv else: def _close(self, _close=os.close): _close(self._handle) _write = os.write _read = os.read def _send(self, buf, write=_write): remaining = len(buf) while True: n = write(self._handle, buf) remaining -= n if remaining == 0: break buf = buf[n:] def _recv(self, size, read=_read): buf = io.BytesIO() handle = self._handle remaining = size while remaining > 0: chunk = read(handle, remaining) n = len(chunk) if n == 0: if remaining == size: raise EOFError else: raise OSError("got end of file during message") buf.write(chunk) remaining -= n return buf def _send_bytes(self, buf): n = len(buf) # For wire compatibility with 3.2 and lower header = struct.pack("!i", n) if n > 16384: # The payload is large so Nagle's algorithm won't be triggered # and we'd better avoid the cost of concatenation. self._send(header) self._send(buf) else: # Issue #20540: concatenate before sending, to avoid delays due # to Nagle's algorithm on a TCP socket. # Also note we want to avoid sending a 0-length buffer separately, # to avoid "broken pipe" errors if the other end closed the pipe. self._send(header + buf) def _recv_bytes(self, maxsize=None): buf = self._recv(4) size, = struct.unpack("!i", buf.getvalue()) if maxsize is not None and size > maxsize: return None return self._recv(size) def _poll(self, timeout): r = wait([self], timeout) return bool(r) # # Public functions # class Listener(object): ''' Returns a listener object. This is a wrapper for a bound socket which is 'listening' for connections, or for a Windows named pipe. ''' def __init__(self, address=None, family=None, backlog=1, authkey=None): family = family or (address and address_type(address)) \ or default_family address = address or arbitrary_address(family) _validate_family(family) if family == 'AF_PIPE': self._listener = PipeListener(address, backlog) else: self._listener = SocketListener(address, family, backlog) if authkey is not None and not isinstance(authkey, bytes): raise TypeError('authkey should be a byte string') self._authkey = authkey def accept(self): ''' Accept a connection on the bound socket or named pipe of `self`. Returns a `Connection` object. ''' if self._listener is None: raise OSError('listener is closed') c = self._listener.accept() if self._authkey: deliver_challenge(c, self._authkey) answer_challenge(c, self._authkey) return c def close(self): ''' Close the bound socket or named pipe of `self`. ''' listener = self._listener if listener is not None: self._listener = None listener.close() address = property(lambda self: self._listener._address) last_accepted = property(lambda self: self._listener._last_accepted) def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): self.close() def Client(address, family=None, authkey=None): ''' Returns a connection to the address of a `Listener` ''' family = family or address_type(address) _validate_family(family) if family == 'AF_PIPE': c = PipeClient(address) else: c = SocketClient(address) if authkey is not None and not isinstance(authkey, bytes): raise TypeError('authkey should be a byte string') if authkey is not None: answer_challenge(c, authkey) deliver_challenge(c, authkey) return c if sys.platform != 'win32': def Pipe(duplex=True): ''' Returns pair of connection objects at either end of a pipe ''' if duplex: s1, s2 = socket.socketpair() s1.setblocking(True) s2.setblocking(True) c1 = Connection(s1.detach()) c2 = Connection(s2.detach()) else: fd1, fd2 = os.pipe() c1 = Connection(fd1, writable=False) c2 = Connection(fd2, readable=False) return c1, c2 else: def Pipe(duplex=True): ''' Returns pair of connection objects at either end of a pipe ''' address = arbitrary_address('AF_PIPE') if duplex: openmode = _winapi.PIPE_ACCESS_DUPLEX access = _winapi.GENERIC_READ | _winapi.GENERIC_WRITE obsize, ibsize = BUFSIZE, BUFSIZE else: openmode = _winapi.PIPE_ACCESS_INBOUND access = _winapi.GENERIC_WRITE obsize, ibsize = 0, BUFSIZE h1 = _winapi.CreateNamedPipe( address, openmode | _winapi.FILE_FLAG_OVERLAPPED | _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE, _winapi.PIPE_TYPE_MESSAGE | _winapi.PIPE_READMODE_MESSAGE | _winapi.PIPE_WAIT, 1, obsize, ibsize, _winapi.NMPWAIT_WAIT_FOREVER, # default security descriptor: the handle cannot be inherited _winapi.NULL ) h2 = _winapi.CreateFile( address, access, 0, _winapi.NULL, _winapi.OPEN_EXISTING, _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL ) _winapi.SetNamedPipeHandleState( h2, _winapi.PIPE_READMODE_MESSAGE, None, None ) overlapped = _winapi.ConnectNamedPipe(h1, overlapped=True) _, err = overlapped.GetOverlappedResult(True) assert err == 0 c1 = PipeConnection(h1, writable=duplex) c2 = PipeConnection(h2, readable=duplex) return c1, c2 # # Definitions for connections based on sockets # class SocketListener(object): ''' Representation of a socket which is bound to an address and listening ''' def __init__(self, address, family, backlog=1): self._socket = socket.socket(getattr(socket, family)) try: # SO_REUSEADDR has different semantics on Windows (issue #2550). if os.name == 'posix': self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self._socket.setblocking(True) self._socket.bind(address) self._socket.listen(backlog) self._address = self._socket.getsockname() except OSError: self._socket.close() raise self._family = family self._last_accepted = None if family == 'AF_UNIX': self._unlink = util.Finalize( self, os.unlink, args=(address,), exitpriority=0 ) else: self._unlink = None def accept(self): s, self._last_accepted = self._socket.accept() s.setblocking(True) return Connection(s.detach()) def close(self): try: self._socket.close() finally: unlink = self._unlink if unlink is not None: self._unlink = None unlink() def SocketClient(address): ''' Return a connection object connected to the socket given by `address` ''' family = address_type(address) with socket.socket( getattr(socket, family) ) as s: s.setblocking(True) s.connect(address) return Connection(s.detach()) # # Definitions for connections based on named pipes # if sys.platform == 'win32': class PipeListener(object): ''' Representation of a named pipe ''' def __init__(self, address, backlog=None): self._address = address self._handle_queue = [self._new_handle(first=True)] self._last_accepted = None util.sub_debug('listener created with address=%r', self._address) self.close = util.Finalize( self, PipeListener._finalize_pipe_listener, args=(self._handle_queue, self._address), exitpriority=0 ) def _new_handle(self, first=False): flags = _winapi.PIPE_ACCESS_DUPLEX | _winapi.FILE_FLAG_OVERLAPPED if first: flags |= _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE return _winapi.CreateNamedPipe( self._address, flags, _winapi.PIPE_TYPE_MESSAGE | _winapi.PIPE_READMODE_MESSAGE | _winapi.PIPE_WAIT, _winapi.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, _winapi.NMPWAIT_WAIT_FOREVER, _winapi.NULL ) def accept(self): self._handle_queue.append(self._new_handle()) handle = self._handle_queue.pop(0) try: ov = _winapi.ConnectNamedPipe(handle, overlapped=True) except OSError as e: if e.winerror != _winapi.ERROR_NO_DATA: raise # ERROR_NO_DATA can occur if a client has already connected, # written data and then disconnected -- see Issue 14725. else: try: res = _winapi.WaitForMultipleObjects( [ov.event], False, INFINITE) except: ov.cancel() _winapi.CloseHandle(handle) raise finally: _, err = ov.GetOverlappedResult(True) assert err == 0 return PipeConnection(handle) @staticmethod def _finalize_pipe_listener(queue, address): util.sub_debug('closing listener with address=%r', address) for handle in queue: _winapi.CloseHandle(handle) def PipeClient(address): ''' Return a connection object connected to the pipe given by `address` ''' t = _init_timeout() while 1: try: _winapi.WaitNamedPipe(address, 1000) h = _winapi.CreateFile( address, _winapi.GENERIC_READ | _winapi.GENERIC_WRITE, 0, _winapi.NULL, _winapi.OPEN_EXISTING, _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL ) except OSError as e: if e.winerror not in (_winapi.ERROR_SEM_TIMEOUT, _winapi.ERROR_PIPE_BUSY) or _check_timeout(t): raise else: break else: raise _winapi.SetNamedPipeHandleState( h, _winapi.PIPE_READMODE_MESSAGE, None, None ) return PipeConnection(h) # # Authentication stuff # MESSAGE_LENGTH = 20 CHALLENGE = b'#CHALLENGE#' WELCOME = b'#WELCOME#' FAILURE = b'#FAILURE#' def deliver_challenge(connection, authkey): import hmac assert isinstance(authkey, bytes) message = os.urandom(MESSAGE_LENGTH) connection.send_bytes(CHALLENGE + message) digest = hmac.new(authkey, message, 'md5').digest() response = connection.recv_bytes(256) # reject large message if response == digest: connection.send_bytes(WELCOME) else: connection.send_bytes(FAILURE) raise AuthenticationError('digest received was wrong') def answer_challenge(connection, authkey): import hmac assert isinstance(authkey, bytes) message = connection.recv_bytes(256) # reject large message assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message message = message[len(CHALLENGE):] digest = hmac.new(authkey, message, 'md5').digest() connection.send_bytes(digest) response = connection.recv_bytes(256) # reject large message if response != WELCOME: raise AuthenticationError('digest sent was rejected') # # Support for using xmlrpclib for serialization # class ConnectionWrapper(object): def __init__(self, conn, dumps, loads): self._conn = conn self._dumps = dumps self._loads = loads for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): obj = getattr(conn, attr) setattr(self, attr, obj) def send(self, obj): s = self._dumps(obj) self._conn.send_bytes(s) def recv(self): s = self._conn.recv_bytes() return self._loads(s) def _xml_dumps(obj): return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf-8') def _xml_loads(s): (obj,), method = xmlrpclib.loads(s.decode('utf-8')) return obj class XmlListener(Listener): def accept(self): global xmlrpclib import xmlrpc.client as xmlrpclib obj = Listener.accept(self) return ConnectionWrapper(obj, _xml_dumps, _xml_loads) def XmlClient(*args, **kwds): global xmlrpclib import xmlrpc.client as xmlrpclib return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) # # Wait # if sys.platform == 'win32': def _exhaustive_wait(handles, timeout): # Return ALL handles which are currently signalled. (Only # returning the first signalled might create starvation issues.) L = list(handles) ready = [] while L: res = _winapi.WaitForMultipleObjects(L, False, timeout) if res == WAIT_TIMEOUT: break elif WAIT_OBJECT_0 <= res < WAIT_OBJECT_0 + len(L): res -= WAIT_OBJECT_0 elif WAIT_ABANDONED_0 <= res < WAIT_ABANDONED_0 + len(L): res -= WAIT_ABANDONED_0 else: raise RuntimeError('Should not get here') ready.append(L[res]) L = L[res+1:] timeout = 0 return ready _ready_errors = {_winapi.ERROR_BROKEN_PIPE, _winapi.ERROR_NETNAME_DELETED} def wait(object_list, timeout=None): ''' Wait till an object in object_list is ready/readable. Returns list of those objects in object_list which are ready/readable. ''' if timeout is None: timeout = INFINITE elif timeout < 0: timeout = 0 else: timeout = int(timeout * 1000 + 0.5) object_list = list(object_list) waithandle_to_obj = {} ov_list = [] ready_objects = set() ready_handles = set() try: for o in object_list: try: fileno = getattr(o, 'fileno') except AttributeError: waithandle_to_obj[o.__index__()] = o else: # start an overlapped read of length zero try: ov, err = _winapi.ReadFile(fileno(), 0, True) except OSError as e: ov, err = None, e.winerror if err not in _ready_errors: raise if err == _winapi.ERROR_IO_PENDING: ov_list.append(ov) waithandle_to_obj[ov.event] = o else: # If o.fileno() is an overlapped pipe handle and # err == 0 then there is a zero length message # in the pipe, but it HAS NOT been consumed... if ov and sys.getwindowsversion()[:2] >= (6, 2): # ... except on Windows 8 and later, where # the message HAS been consumed. try: _, err = ov.GetOverlappedResult(False) except OSError as e: err = e.winerror if not err and hasattr(o, '_got_empty_message'): o._got_empty_message = True ready_objects.add(o) timeout = 0 ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout) finally: # request that overlapped reads stop for ov in ov_list: ov.cancel() # wait for all overlapped reads to stop for ov in ov_list: try: _, err = ov.GetOverlappedResult(True) except OSError as e: err = e.winerror if err not in _ready_errors: raise if err != _winapi.ERROR_OPERATION_ABORTED: o = waithandle_to_obj[ov.event] ready_objects.add(o) if err == 0: # If o.fileno() is an overlapped pipe handle then # a zero length message HAS been consumed. if hasattr(o, '_got_empty_message'): o._got_empty_message = True ready_objects.update(waithandle_to_obj[h] for h in ready_handles) return [o for o in object_list if o in ready_objects] else: import selectors # poll/select have the advantage of not requiring any extra file # descriptor, contrarily to epoll/kqueue (also, they require a single # syscall). if hasattr(selectors, 'PollSelector'): _WaitSelector = selectors.PollSelector else: _WaitSelector = selectors.SelectSelector def wait(object_list, timeout=None): ''' Wait till an object in object_list is ready/readable. Returns list of those objects in object_list which are ready/readable. ''' with _WaitSelector() as selector: for obj in object_list: selector.register(obj, selectors.EVENT_READ) if timeout is not None: deadline = time.monotonic() + timeout while True: ready = selector.select(timeout) if ready: return [key.fileobj for (key, events) in ready] else: if timeout is not None: timeout = deadline - time.monotonic() if timeout < 0: return ready # # Make connection and socket objects sharable if possible # if sys.platform == 'win32': def reduce_connection(conn): handle = conn.fileno() with socket.fromfd(handle, socket.AF_INET, socket.SOCK_STREAM) as s: from . import resource_sharer ds = resource_sharer.DupSocket(s) return rebuild_connection, (ds, conn.readable, conn.writable) def rebuild_connection(ds, readable, writable): sock = ds.detach() return Connection(sock.detach(), readable, writable) reduction.register(Connection, reduce_connection) def reduce_pipe_connection(conn): access = ((_winapi.FILE_GENERIC_READ if conn.readable else 0) | (_winapi.FILE_GENERIC_WRITE if conn.writable else 0)) dh = reduction.DupHandle(conn.fileno(), access) return rebuild_pipe_connection, (dh, conn.readable, conn.writable) def rebuild_pipe_connection(dh, readable, writable): handle = dh.detach() return PipeConnection(handle, readable, writable) reduction.register(PipeConnection, reduce_pipe_connection) else: def reduce_connection(conn): df = reduction.DupFd(conn.fileno()) return rebuild_connection, (df, conn.readable, conn.writable) def rebuild_connection(df, readable, writable): fd = df.detach() return Connection(fd, readable, writable) reduction.register(Connection, reduce_connection)
30,891
954
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/resource_sharer.py
# # We use a background thread for sharing fds on Unix, and for sharing sockets on # Windows. # # A client which wants to pickle a resource registers it with the resource # sharer and gets an identifier in return. The unpickling process will connect # to the resource sharer, sends the identifier and its pid, and then receives # the resource. # import os import signal import socket import sys import threading from . import process from .context import reduction from . import util __all__ = ['stop'] if sys.platform == 'win32': __all__ += ['DupSocket'] class DupSocket(object): '''Picklable wrapper for a socket.''' def __init__(self, sock): new_sock = sock.dup() def send(conn, pid): share = new_sock.share(pid) conn.send_bytes(share) self._id = _resource_sharer.register(send, new_sock.close) def detach(self): '''Get the socket. This should only be called once.''' with _resource_sharer.get_connection(self._id) as conn: share = conn.recv_bytes() return socket.fromshare(share) else: __all__ += ['DupFd'] class DupFd(object): '''Wrapper for fd which can be used at any time.''' def __init__(self, fd): new_fd = os.dup(fd) def send(conn, pid): reduction.send_handle(conn, new_fd, pid) def close(): os.close(new_fd) self._id = _resource_sharer.register(send, close) def detach(self): '''Get the fd. This should only be called once.''' with _resource_sharer.get_connection(self._id) as conn: return reduction.recv_handle(conn) class _ResourceSharer(object): '''Manager for resouces using background thread.''' def __init__(self): self._key = 0 self._cache = {} self._old_locks = [] self._lock = threading.Lock() self._listener = None self._address = None self._thread = None util.register_after_fork(self, _ResourceSharer._afterfork) def register(self, send, close): '''Register resource, returning an identifier.''' with self._lock: if self._address is None: self._start() self._key += 1 self._cache[self._key] = (send, close) return (self._address, self._key) @staticmethod def get_connection(ident): '''Return connection from which to receive identified resource.''' from .connection import Client address, key = ident c = Client(address, authkey=process.current_process().authkey) c.send((key, os.getpid())) return c def stop(self, timeout=None): '''Stop the background thread and clear registered resources.''' from .connection import Client with self._lock: if self._address is not None: c = Client(self._address, authkey=process.current_process().authkey) c.send(None) c.close() self._thread.join(timeout) if self._thread.is_alive(): util.sub_warning('_ResourceSharer thread did ' 'not stop when asked') self._listener.close() self._thread = None self._address = None self._listener = None for key, (send, close) in self._cache.items(): close() self._cache.clear() def _afterfork(self): for key, (send, close) in self._cache.items(): close() self._cache.clear() # If self._lock was locked at the time of the fork, it may be broken # -- see issue 6721. Replace it without letting it be gc'ed. self._old_locks.append(self._lock) self._lock = threading.Lock() if self._listener is not None: self._listener.close() self._listener = None self._address = None self._thread = None def _start(self): from .connection import Listener assert self._listener is None util.debug('starting listener and thread for sending handles') self._listener = Listener(authkey=process.current_process().authkey) self._address = self._listener.address t = threading.Thread(target=self._serve) t.daemon = True t.start() self._thread = t def _serve(self): if hasattr(signal, 'pthread_sigmask'): signal.pthread_sigmask(signal.SIG_BLOCK, range(1, signal.NSIG)) while 1: try: with self._listener.accept() as conn: msg = conn.recv() if msg is None: break key, destination_pid = msg send, close = self._cache.pop(key) try: send(conn, destination_pid) finally: close() except: if not util.is_exiting(): sys.excepthook(*sys.exc_info()) _resource_sharer = _ResourceSharer() stop = _resource_sharer.stop
5,325
159
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/popen_spawn_win32.py
import os import msvcrt import signal import sys import _winapi from .context import reduction, get_spawning_popen, set_spawning_popen from . import spawn from . import util __all__ = ['Popen'] # # # TERMINATE = 0x10000 WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) WINSERVICE = sys.executable.lower().endswith("pythonservice.exe") # # We define a Popen class similar to the one from subprocess, but # whose constructor takes a process object as its argument. # class Popen(object): ''' Start a subprocess to run the code of a process object ''' method = 'spawn' def __init__(self, process_obj): prep_data = spawn.get_preparation_data(process_obj._name) # read end of pipe will be "stolen" by the child process # -- see spawn_main() in spawn.py. rhandle, whandle = _winapi.CreatePipe(None, 0) wfd = msvcrt.open_osfhandle(whandle, 0) cmd = spawn.get_command_line(parent_pid=os.getpid(), pipe_handle=rhandle) cmd = ' '.join('"%s"' % x for x in cmd) with open(wfd, 'wb', closefd=True) as to_child: # start process try: hp, ht, pid, tid = _winapi.CreateProcess( spawn.get_executable(), cmd, None, None, False, 0, None, None, None) _winapi.CloseHandle(ht) except: _winapi.CloseHandle(rhandle) raise # set attributes of self self.pid = pid self.returncode = None self._handle = hp self.sentinel = int(hp) util.Finalize(self, _winapi.CloseHandle, (self.sentinel,)) # send information to child set_spawning_popen(self) try: reduction.dump(prep_data, to_child) reduction.dump(process_obj, to_child) finally: set_spawning_popen(None) def duplicate_for_child(self, handle): assert self is get_spawning_popen() return reduction.duplicate(handle, self.sentinel) def wait(self, timeout=None): if self.returncode is None: if timeout is None: msecs = _winapi.INFINITE else: msecs = max(0, int(timeout * 1000 + 0.5)) res = _winapi.WaitForSingleObject(int(self._handle), msecs) if res == _winapi.WAIT_OBJECT_0: code = _winapi.GetExitCodeProcess(self._handle) if code == TERMINATE: code = -signal.SIGTERM self.returncode = code return self.returncode def poll(self): return self.wait(timeout=0) def terminate(self): if self.returncode is None: try: _winapi.TerminateProcess(int(self._handle), TERMINATE) except OSError: if self.wait(timeout=1.0) is None: raise
2,999
99
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/heap.py
# # Module which supports allocation of memory from an mmap # # multiprocessing/heap.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # import bisect import mmap import os import sys import tempfile import threading from .context import reduction, assert_spawning from . import util __all__ = ['BufferWrapper'] # # Inheritable class which wraps an mmap, and from which blocks can be allocated # if sys.platform == 'win32': import _winapi class Arena(object): _rand = tempfile._RandomNameSequence() def __init__(self, size): self.size = size for i in range(100): name = 'pym-%d-%s' % (os.getpid(), next(self._rand)) buf = mmap.mmap(-1, size, tagname=name) if _winapi.GetLastError() == 0: break # We have reopened a preexisting mmap. buf.close() else: raise FileExistsError('Cannot find name for new mmap') self.name = name self.buffer = buf self._state = (self.size, self.name) def __getstate__(self): assert_spawning(self) return self._state def __setstate__(self, state): self.size, self.name = self._state = state self.buffer = mmap.mmap(-1, self.size, tagname=self.name) # XXX Temporarily preventing buildbot failures while determining # XXX the correct long-term fix. See issue 23060 #assert _winapi.GetLastError() == _winapi.ERROR_ALREADY_EXISTS else: class Arena(object): def __init__(self, size, fd=-1): self.size = size self.fd = fd if fd == -1: self.fd, name = tempfile.mkstemp( prefix='pym-%d-'%os.getpid(), dir=util.get_temp_dir()) os.unlink(name) util.Finalize(self, os.close, (self.fd,)) with open(self.fd, 'wb', closefd=False) as f: bs = 1024 * 1024 if size >= bs: zeros = b'\0' * bs for _ in range(size // bs): f.write(zeros) del zeros f.write(b'\0' * (size % bs)) assert f.tell() == size self.buffer = mmap.mmap(self.fd, self.size) def reduce_arena(a): if a.fd == -1: raise ValueError('Arena is unpicklable because ' 'forking was enabled when it was created') return rebuild_arena, (a.size, reduction.DupFd(a.fd)) def rebuild_arena(size, dupfd): return Arena(size, dupfd.detach()) reduction.register(Arena, reduce_arena) # # Class allowing allocation of chunks of memory from arenas # class Heap(object): _alignment = 8 def __init__(self, size=mmap.PAGESIZE): self._lastpid = os.getpid() self._lock = threading.Lock() self._size = size self._lengths = [] self._len_to_seq = {} self._start_to_block = {} self._stop_to_block = {} self._allocated_blocks = set() self._arenas = [] # list of pending blocks to free - see free() comment below self._pending_free_blocks = [] @staticmethod def _roundup(n, alignment): # alignment must be a power of 2 mask = alignment - 1 return (n + mask) & ~mask def _malloc(self, size): # returns a large enough block -- it might be much larger i = bisect.bisect_left(self._lengths, size) if i == len(self._lengths): length = self._roundup(max(self._size, size), mmap.PAGESIZE) self._size *= 2 util.info('allocating a new mmap of length %d', length) arena = Arena(length) self._arenas.append(arena) return (arena, 0, length) else: length = self._lengths[i] seq = self._len_to_seq[length] block = seq.pop() if not seq: del self._len_to_seq[length], self._lengths[i] (arena, start, stop) = block del self._start_to_block[(arena, start)] del self._stop_to_block[(arena, stop)] return block def _free(self, block): # free location and try to merge with neighbours (arena, start, stop) = block try: prev_block = self._stop_to_block[(arena, start)] except KeyError: pass else: start, _ = self._absorb(prev_block) try: next_block = self._start_to_block[(arena, stop)] except KeyError: pass else: _, stop = self._absorb(next_block) block = (arena, start, stop) length = stop - start try: self._len_to_seq[length].append(block) except KeyError: self._len_to_seq[length] = [block] bisect.insort(self._lengths, length) self._start_to_block[(arena, start)] = block self._stop_to_block[(arena, stop)] = block def _absorb(self, block): # deregister this block so it can be merged with a neighbour (arena, start, stop) = block del self._start_to_block[(arena, start)] del self._stop_to_block[(arena, stop)] length = stop - start seq = self._len_to_seq[length] seq.remove(block) if not seq: del self._len_to_seq[length] self._lengths.remove(length) return start, stop def _free_pending_blocks(self): # Free all the blocks in the pending list - called with the lock held. while True: try: block = self._pending_free_blocks.pop() except IndexError: break self._allocated_blocks.remove(block) self._free(block) def free(self, block): # free a block returned by malloc() # Since free() can be called asynchronously by the GC, it could happen # that it's called while self._lock is held: in that case, # self._lock.acquire() would deadlock (issue #12352). To avoid that, a # trylock is used instead, and if the lock can't be acquired # immediately, the block is added to a list of blocks to be freed # synchronously sometimes later from malloc() or free(), by calling # _free_pending_blocks() (appending and retrieving from a list is not # strictly thread-safe but under cPython it's atomic thanks to the GIL). assert os.getpid() == self._lastpid if not self._lock.acquire(False): # can't acquire the lock right now, add the block to the list of # pending blocks to free self._pending_free_blocks.append(block) else: # we hold the lock try: self._free_pending_blocks() self._allocated_blocks.remove(block) self._free(block) finally: self._lock.release() def malloc(self, size): # return a block of right size (possibly rounded up) assert 0 <= size < sys.maxsize if os.getpid() != self._lastpid: self.__init__() # reinitialize after fork with self._lock: self._free_pending_blocks() size = self._roundup(max(size,1), self._alignment) (arena, start, stop) = self._malloc(size) new_stop = start + size if new_stop < stop: self._free((arena, new_stop, stop)) block = (arena, start, new_stop) self._allocated_blocks.add(block) return block # # Class representing a chunk of an mmap -- can be inherited by child process # class BufferWrapper(object): _heap = Heap() def __init__(self, size): assert 0 <= size < sys.maxsize block = BufferWrapper._heap.malloc(size) self._state = (block, size) util.Finalize(self, BufferWrapper._heap.free, args=(block,)) def create_memoryview(self): (arena, start, stop), size = self._state return memoryview(arena.buffer)[start:start+size]
8,319
255
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/sharedctypes.py
# # Module which supports allocation of ctypes objects from shared memory # # multiprocessing/sharedctypes.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # import ctypes import weakref from . import heap from . import get_context from .context import reduction, assert_spawning _ForkingPickler = reduction.ForkingPickler __all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] # # # typecode_to_type = { 'c': ctypes.c_char, 'u': ctypes.c_wchar, 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, 'h': ctypes.c_short, 'H': ctypes.c_ushort, 'i': ctypes.c_int, 'I': ctypes.c_uint, 'l': ctypes.c_long, 'L': ctypes.c_ulong, 'f': ctypes.c_float, 'd': ctypes.c_double } # # # def _new_value(type_): size = ctypes.sizeof(type_) wrapper = heap.BufferWrapper(size) return rebuild_ctype(type_, wrapper, None) def RawValue(typecode_or_type, *args): ''' Returns a ctypes object allocated from shared memory ''' type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) obj = _new_value(type_) ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) obj.__init__(*args) return obj def RawArray(typecode_or_type, size_or_initializer): ''' Returns a ctypes array allocated from shared memory ''' type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) if isinstance(size_or_initializer, int): type_ = type_ * size_or_initializer obj = _new_value(type_) ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) return obj else: type_ = type_ * len(size_or_initializer) result = _new_value(type_) result.__init__(*size_or_initializer) return result def Value(typecode_or_type, *args, lock=True, ctx=None): ''' Return a synchronization wrapper for a Value ''' obj = RawValue(typecode_or_type, *args) if lock is False: return obj if lock in (True, None): ctx = ctx or get_context() lock = ctx.RLock() if not hasattr(lock, 'acquire'): raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock, ctx=ctx) def Array(typecode_or_type, size_or_initializer, *, lock=True, ctx=None): ''' Return a synchronization wrapper for a RawArray ''' obj = RawArray(typecode_or_type, size_or_initializer) if lock is False: return obj if lock in (True, None): ctx = ctx or get_context() lock = ctx.RLock() if not hasattr(lock, 'acquire'): raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock, ctx=ctx) def copy(obj): new_obj = _new_value(type(obj)) ctypes.pointer(new_obj)[0] = obj return new_obj def synchronized(obj, lock=None, ctx=None): assert not isinstance(obj, SynchronizedBase), 'object already synchronized' ctx = ctx or get_context() if isinstance(obj, ctypes._SimpleCData): return Synchronized(obj, lock, ctx) elif isinstance(obj, ctypes.Array): if obj._type_ is ctypes.c_char: return SynchronizedString(obj, lock, ctx) return SynchronizedArray(obj, lock, ctx) else: cls = type(obj) try: scls = class_cache[cls] except KeyError: names = [field[0] for field in cls._fields_] d = dict((name, make_property(name)) for name in names) classname = 'Synchronized' + cls.__name__ scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) return scls(obj, lock, ctx) # # Functions for pickling/unpickling # def reduce_ctype(obj): assert_spawning(obj) if isinstance(obj, ctypes.Array): return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) else: return rebuild_ctype, (type(obj), obj._wrapper, None) def rebuild_ctype(type_, wrapper, length): if length is not None: type_ = type_ * length _ForkingPickler.register(type_, reduce_ctype) buf = wrapper.create_memoryview() obj = type_.from_buffer(buf) obj._wrapper = wrapper return obj # # Function to create properties # def make_property(name): try: return prop_cache[name] except KeyError: d = {} exec(template % ((name,)*7), d) prop_cache[name] = d[name] return d[name] template = ''' def get%s(self): self.acquire() try: return self._obj.%s finally: self.release() def set%s(self, value): self.acquire() try: self._obj.%s = value finally: self.release() %s = property(get%s, set%s) ''' prop_cache = {} class_cache = weakref.WeakKeyDictionary() # # Synchronized wrappers # class SynchronizedBase(object): def __init__(self, obj, lock=None, ctx=None): self._obj = obj if lock: self._lock = lock else: ctx = ctx or get_context(force=True) self._lock = ctx.RLock() self.acquire = self._lock.acquire self.release = self._lock.release def __enter__(self): return self._lock.__enter__() def __exit__(self, *args): return self._lock.__exit__(*args) def __reduce__(self): assert_spawning(self) return synchronized, (self._obj, self._lock) def get_obj(self): return self._obj def get_lock(self): return self._lock def __repr__(self): return '<%s wrapper for %s>' % (type(self).__name__, self._obj) class Synchronized(SynchronizedBase): value = make_property('value') class SynchronizedArray(SynchronizedBase): def __len__(self): return len(self._obj) def __getitem__(self, i): with self: return self._obj[i] def __setitem__(self, i, value): with self: self._obj[i] = value def __getslice__(self, start, stop): with self: return self._obj[start:stop] def __setslice__(self, start, stop, values): with self: self._obj[start:stop] = values class SynchronizedString(SynchronizedArray): value = make_property('value') raw = make_property('raw')
6,245
240
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/popen_fork.py
import os import sys import signal from . import util __all__ = ['Popen'] # # Start child process using fork # class Popen(object): method = 'fork' def __init__(self, process_obj): util._flush_std_streams() self.returncode = None self._launch(process_obj) def duplicate_for_child(self, fd): return fd def poll(self, flag=os.WNOHANG): if self.returncode is None: while True: try: pid, sts = os.waitpid(self.pid, flag) except OSError as e: # Child process not yet created. See #1731717 # e.errno == errno.ECHILD == 10 return None else: break if pid == self.pid: if os.WIFSIGNALED(sts): self.returncode = -os.WTERMSIG(sts) else: assert os.WIFEXITED(sts) self.returncode = os.WEXITSTATUS(sts) return self.returncode def wait(self, timeout=None): if self.returncode is None: if timeout is not None: from multiprocessing.connection import wait if not wait([self.sentinel], timeout): return None # This shouldn't block if wait() returned successfully. return self.poll(os.WNOHANG if timeout == 0.0 else 0) return self.returncode def terminate(self): if self.returncode is None: try: os.kill(self.pid, signal.SIGTERM) except ProcessLookupError: pass except OSError: if self.wait(timeout=0.1) is None: raise def _launch(self, process_obj): code = 1 parent_r, child_w = os.pipe() self.pid = os.fork() if self.pid == 0: try: os.close(parent_r) if 'random' in sys.modules: import random random.seed() code = process_obj._bootstrap() finally: os._exit(code) else: os.close(child_w) util.Finalize(self, os.close, (parent_r,)) self.sentinel = parent_r
2,307
80
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/semaphore_tracker.py
# # On Unix we run a server process which keeps track of unlinked # semaphores. The server ignores SIGINT and SIGTERM and reads from a # pipe. Every other process of the program has a copy of the writable # end of the pipe, so we get EOF when all other processes have exited. # Then the server process unlinks any remaining semaphore names. # # This is important because the system only supports a limited number # of named semaphores, and they will not be automatically removed till # the next reboot. Without this semaphore tracker process, "killall # python" would probably leave unlinked semaphores. # import os import signal import sys import threading import warnings import _multiprocessing from . import spawn from . import util __all__ = ['ensure_running', 'register', 'unregister'] class SemaphoreTracker(object): def __init__(self): self._lock = threading.Lock() self._fd = None self._pid = None def getfd(self): self.ensure_running() return self._fd def ensure_running(self): '''Make sure that semaphore tracker process is running. This can be run from any process. Usually a child process will use the semaphore created by its parent.''' with self._lock: if self._pid is not None: # semaphore tracker was launched before, is it still running? pid, status = os.waitpid(self._pid, os.WNOHANG) if not pid: # => still alive return # => dead, launch it again os.close(self._fd) self._fd = None self._pid = None warnings.warn('semaphore_tracker: process died unexpectedly, ' 'relaunching. Some semaphores might leak.') fds_to_pass = [] try: fds_to_pass.append(sys.stderr.fileno()) except Exception: pass cmd = 'from multiprocessing.semaphore_tracker import main;main(%d)' r, w = os.pipe() try: fds_to_pass.append(r) # process will out live us, so no need to wait on pid exe = spawn.get_executable() args = [exe] + util._args_from_interpreter_flags() args += ['-c', cmd % r] pid = util.spawnv_passfds(exe, args, fds_to_pass) except: os.close(w) raise else: self._fd = w self._pid = pid finally: os.close(r) def register(self, name): '''Register name of semaphore with semaphore tracker.''' self._send('REGISTER', name) def unregister(self, name): '''Unregister name of semaphore with semaphore tracker.''' self._send('UNREGISTER', name) def _send(self, cmd, name): self.ensure_running() msg = '{0}:{1}\n'.format(cmd, name).encode('ascii') if len(name) > 512: # posix guarantees that writes to a pipe of less than PIPE_BUF # bytes are atomic, and that PIPE_BUF >= 512 raise ValueError('name too long') nbytes = os.write(self._fd, msg) assert nbytes == len(msg) _semaphore_tracker = SemaphoreTracker() ensure_running = _semaphore_tracker.ensure_running register = _semaphore_tracker.register unregister = _semaphore_tracker.unregister getfd = _semaphore_tracker.getfd def main(fd): '''Run semaphore tracker.''' # protect the process from ^C and "killall python" etc signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTERM, signal.SIG_IGN) for f in (sys.stdin, sys.stdout): try: f.close() except Exception: pass cache = set() try: # keep track of registered/unregistered semaphores with open(fd, 'rb') as f: for line in f: try: cmd, name = line.strip().split(b':') if cmd == b'REGISTER': cache.add(name) elif cmd == b'UNREGISTER': cache.remove(name) else: raise RuntimeError('unrecognized command %r' % cmd) except Exception: try: sys.excepthook(*sys.exc_info()) except: pass finally: # all processes have terminated; cleanup any remaining semaphores if cache: try: warnings.warn('semaphore_tracker: There appear to be %d ' 'leaked semaphores to clean up at shutdown' % len(cache)) except Exception: pass for name in cache: # For some reason the process which created and registered this # semaphore has failed to unregister it. Presumably it has died. # We therefore unlink it. try: name = name.decode('ascii') try: _multiprocessing.sem_unlink(name) except Exception as e: warnings.warn('semaphore_tracker: %r: %s' % (name, e)) finally: pass
5,394
158
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/forkserver.py
import errno import os import selectors import signal import socket import struct import sys import threading from . import connection from . import process from .context import reduction from . import semaphore_tracker from . import spawn from . import util __all__ = ['ensure_running', 'get_inherited_fds', 'connect_to_new_process', 'set_forkserver_preload'] # # # MAXFDS_TO_SEND = 256 UNSIGNED_STRUCT = struct.Struct('Q') # large enough for pid_t # # Forkserver class # class ForkServer(object): def __init__(self): self._forkserver_address = None self._forkserver_alive_fd = None self._forkserver_pid = None self._inherited_fds = None self._lock = threading.Lock() self._preload_modules = ['__main__'] def set_forkserver_preload(self, modules_names): '''Set list of module names to try to load in forkserver process.''' if not all(type(mod) is str for mod in self._preload_modules): raise TypeError('module_names must be a list of strings') self._preload_modules = modules_names def get_inherited_fds(self): '''Return list of fds inherited from parent process. This returns None if the current process was not started by fork server. ''' return self._inherited_fds def connect_to_new_process(self, fds): '''Request forkserver to create a child process. Returns a pair of fds (status_r, data_w). The calling process can read the child process's pid and (eventually) its returncode from status_r. The calling process should write to data_w the pickled preparation and process data. ''' self.ensure_running() if len(fds) + 4 >= MAXFDS_TO_SEND: raise ValueError('too many fds') with socket.socket(socket.AF_UNIX) as client: client.connect(self._forkserver_address) parent_r, child_w = os.pipe() child_r, parent_w = os.pipe() allfds = [child_r, child_w, self._forkserver_alive_fd, semaphore_tracker.getfd()] allfds += fds try: reduction.sendfds(client, allfds) return parent_r, parent_w except: os.close(parent_r) os.close(parent_w) raise finally: os.close(child_r) os.close(child_w) def ensure_running(self): '''Make sure that a fork server is running. This can be called from any process. Note that usually a child process will just reuse the forkserver started by its parent, so ensure_running() will do nothing. ''' with self._lock: semaphore_tracker.ensure_running() if self._forkserver_pid is not None: # forkserver was launched before, is it still running? pid, status = os.waitpid(self._forkserver_pid, os.WNOHANG) if not pid: # still alive return # dead, launch it again os.close(self._forkserver_alive_fd) self._forkserver_address = None self._forkserver_alive_fd = None self._forkserver_pid = None cmd = ('from multiprocessing.forkserver import main; ' + 'main(%d, %d, %r, **%r)') if self._preload_modules: desired_keys = {'main_path', 'sys_path'} data = spawn.get_preparation_data('ignore') data = dict((x,y) for (x,y) in data.items() if x in desired_keys) else: data = {} with socket.socket(socket.AF_UNIX) as listener: address = connection.arbitrary_address('AF_UNIX') listener.bind(address) os.chmod(address, 0o600) listener.listen() # all client processes own the write end of the "alive" pipe; # when they all terminate the read end becomes ready. alive_r, alive_w = os.pipe() try: fds_to_pass = [listener.fileno(), alive_r] cmd %= (listener.fileno(), alive_r, self._preload_modules, data) exe = spawn.get_executable() args = [exe] + util._args_from_interpreter_flags() args += ['-c', cmd] pid = util.spawnv_passfds(exe, args, fds_to_pass) except: os.close(alive_w) raise finally: os.close(alive_r) self._forkserver_address = address self._forkserver_alive_fd = alive_w self._forkserver_pid = pid # # # def main(listener_fd, alive_r, preload, main_path=None, sys_path=None): '''Run forkserver.''' if preload: if '__main__' in preload and main_path is not None: process.current_process()._inheriting = True try: spawn.import_main_path(main_path) finally: del process.current_process()._inheriting for modname in preload: try: __import__(modname) except ImportError: pass util._close_stdin() handlers = { # no need to reap zombie processes; signal.SIGCHLD: signal.SIG_IGN, # protect the process from ^C signal.SIGINT: signal.SIG_IGN, } old_handlers = {sig: signal.signal(sig, val) for (sig, val) in handlers.items()} with socket.socket(socket.AF_UNIX, fileno=listener_fd) as listener, \ selectors.DefaultSelector() as selector: _forkserver._forkserver_address = listener.getsockname() selector.register(listener, selectors.EVENT_READ) selector.register(alive_r, selectors.EVENT_READ) while True: try: while True: rfds = [key.fileobj for (key, events) in selector.select()] if rfds: break if alive_r in rfds: # EOF because no more client processes left assert os.read(alive_r, 1) == b'' raise SystemExit assert listener in rfds with listener.accept()[0] as s: code = 1 if os.fork() == 0: try: _serve_one(s, listener, alive_r, old_handlers) except Exception: sys.excepthook(*sys.exc_info()) sys.stderr.flush() finally: os._exit(code) except OSError as e: if e.errno != errno.ECONNABORTED: raise def _serve_one(s, listener, alive_r, handlers): # close unnecessary stuff and reset signal handlers listener.close() os.close(alive_r) for sig, val in handlers.items(): signal.signal(sig, val) # receive fds from parent process fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1) s.close() assert len(fds) <= MAXFDS_TO_SEND (child_r, child_w, _forkserver._forkserver_alive_fd, stfd, *_forkserver._inherited_fds) = fds semaphore_tracker._semaphore_tracker._fd = stfd # send pid to client processes write_unsigned(child_w, os.getpid()) # reseed random number generator if 'random' in sys.modules: import random random.seed() # run process object received over pipe code = spawn._main(child_r) # write the exit code to the pipe write_unsigned(child_w, code) # # Read and write unsigned numbers # def read_unsigned(fd): data = b'' length = UNSIGNED_STRUCT.size while len(data) < length: s = os.read(fd, length - len(data)) if not s: raise EOFError('unexpected EOF') data += s return UNSIGNED_STRUCT.unpack(data)[0] def write_unsigned(fd, n): msg = UNSIGNED_STRUCT.pack(n) while msg: nbytes = os.write(fd, msg) if nbytes == 0: raise RuntimeError('should not get here') msg = msg[nbytes:] # # # _forkserver = ForkServer() ensure_running = _forkserver.ensure_running get_inherited_fds = _forkserver.get_inherited_fds connect_to_new_process = _forkserver.connect_to_new_process set_forkserver_preload = _forkserver.set_forkserver_preload
8,694
267
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/queues.py
# # Module implementing queues # # multiprocessing/queues.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = ['Queue', 'SimpleQueue', 'JoinableQueue'] import sys import os import threading import collections import time import weakref import errno from queue import Empty, Full import _multiprocessing from . import connection from . import context _ForkingPickler = context.reduction.ForkingPickler from .util import debug, info, Finalize, register_after_fork, is_exiting # # Queue type using a pipe, buffer and thread # class Queue(object): def __init__(self, maxsize=0, *, ctx): if maxsize <= 0: # Can raise ImportError (see issues #3770 and #23400) from .synchronize import SEM_VALUE_MAX as maxsize self._maxsize = maxsize self._reader, self._writer = connection.Pipe(duplex=False) self._rlock = ctx.Lock() self._opid = os.getpid() if sys.platform == 'win32': self._wlock = None else: self._wlock = ctx.Lock() self._sem = ctx.BoundedSemaphore(maxsize) # For use by concurrent.futures self._ignore_epipe = False self._after_fork() if sys.platform != 'win32': register_after_fork(self, Queue._after_fork) def __getstate__(self): context.assert_spawning(self) return (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) def __setstate__(self, state): (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) = state self._after_fork() def _after_fork(self): debug('Queue._after_fork()') self._notempty = threading.Condition(threading.Lock()) self._buffer = collections.deque() self._thread = None self._jointhread = None self._joincancelled = False self._closed = False self._close = None self._send_bytes = self._writer.send_bytes self._recv_bytes = self._reader.recv_bytes self._poll = self._reader.poll def put(self, obj, block=True, timeout=None): assert not self._closed if not self._sem.acquire(block, timeout): raise Full with self._notempty: if self._thread is None: self._start_thread() self._buffer.append(obj) self._notempty.notify() def get(self, block=True, timeout=None): if block and timeout is None: with self._rlock: res = self._recv_bytes() self._sem.release() else: if block: deadline = time.monotonic() + timeout if not self._rlock.acquire(block, timeout): raise Empty try: if block: timeout = deadline - time.monotonic() if not self._poll(timeout): raise Empty elif not self._poll(): raise Empty res = self._recv_bytes() self._sem.release() finally: self._rlock.release() # unserialize the data after having released the lock return _ForkingPickler.loads(res) def qsize(self): # Raises NotImplementedError on Mac OSX because of broken sem_getvalue() return self._maxsize - self._sem._semlock._get_value() def empty(self): return not self._poll() def full(self): return self._sem._semlock._is_zero() def get_nowait(self): return self.get(False) def put_nowait(self, obj): return self.put(obj, False) def close(self): self._closed = True try: self._reader.close() finally: close = self._close if close: self._close = None close() def join_thread(self): debug('Queue.join_thread()') assert self._closed if self._jointhread: self._jointhread() def cancel_join_thread(self): debug('Queue.cancel_join_thread()') self._joincancelled = True try: self._jointhread.cancel() except AttributeError: pass def _start_thread(self): debug('Queue._start_thread()') # Start thread which transfers data from buffer to pipe self._buffer.clear() self._thread = threading.Thread( target=Queue._feed, args=(self._buffer, self._notempty, self._send_bytes, self._wlock, self._writer.close, self._ignore_epipe), name='QueueFeederThread' ) self._thread.daemon = True debug('doing self._thread.start()') self._thread.start() debug('... done self._thread.start()') if not self._joincancelled: self._jointhread = Finalize( self._thread, Queue._finalize_join, [weakref.ref(self._thread)], exitpriority=-5 ) # Send sentinel to the thread queue object when garbage collected self._close = Finalize( self, Queue._finalize_close, [self._buffer, self._notempty], exitpriority=10 ) @staticmethod def _finalize_join(twr): debug('joining queue thread') thread = twr() if thread is not None: thread.join() debug('... queue thread joined') else: debug('... queue thread already dead') @staticmethod def _finalize_close(buffer, notempty): debug('telling queue thread to quit') with notempty: buffer.append(_sentinel) notempty.notify() @staticmethod def _feed(buffer, notempty, send_bytes, writelock, close, ignore_epipe): debug('starting thread to feed data to pipe') nacquire = notempty.acquire nrelease = notempty.release nwait = notempty.wait bpopleft = buffer.popleft sentinel = _sentinel if sys.platform != 'win32': wacquire = writelock.acquire wrelease = writelock.release else: wacquire = None while 1: try: nacquire() try: if not buffer: nwait() finally: nrelease() try: while 1: obj = bpopleft() if obj is sentinel: debug('feeder thread got sentinel -- exiting') close() return # serialize the data before acquiring the lock obj = _ForkingPickler.dumps(obj) if wacquire is None: send_bytes(obj) else: wacquire() try: send_bytes(obj) finally: wrelease() except IndexError: pass except Exception as e: if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: return # Since this runs in a daemon thread the resources it uses # may be become unusable while the process is cleaning up. # We ignore errors which happen after the process has # started to cleanup. if is_exiting(): info('error in queue thread: %s', e) return else: import traceback traceback.print_exc() _sentinel = object() # # A queue type which also supports join() and task_done() methods # # Note that if you do not call task_done() for each finished task then # eventually the counter's semaphore may overflow causing Bad Things # to happen. # class JoinableQueue(Queue): def __init__(self, maxsize=0, *, ctx): Queue.__init__(self, maxsize, ctx=ctx) self._unfinished_tasks = ctx.Semaphore(0) self._cond = ctx.Condition() def __getstate__(self): return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) def __setstate__(self, state): Queue.__setstate__(self, state[:-2]) self._cond, self._unfinished_tasks = state[-2:] def put(self, obj, block=True, timeout=None): assert not self._closed if not self._sem.acquire(block, timeout): raise Full with self._notempty, self._cond: if self._thread is None: self._start_thread() self._buffer.append(obj) self._unfinished_tasks.release() self._notempty.notify() def task_done(self): with self._cond: if not self._unfinished_tasks.acquire(False): raise ValueError('task_done() called too many times') if self._unfinished_tasks._semlock._is_zero(): self._cond.notify_all() def join(self): with self._cond: if not self._unfinished_tasks._semlock._is_zero(): self._cond.wait() # # Simplified Queue type -- really just a locked pipe # class SimpleQueue(object): def __init__(self, *, ctx): self._reader, self._writer = connection.Pipe(duplex=False) self._rlock = ctx.Lock() self._poll = self._reader.poll if sys.platform == 'win32': self._wlock = None else: self._wlock = ctx.Lock() def empty(self): return not self._poll() def __getstate__(self): context.assert_spawning(self) return (self._reader, self._writer, self._rlock, self._wlock) def __setstate__(self, state): (self._reader, self._writer, self._rlock, self._wlock) = state self._poll = self._reader.poll def get(self): with self._rlock: res = self._reader.recv_bytes() # unserialize the data after having released the lock return _ForkingPickler.loads(res) def put(self, obj): # serialize the data before acquiring the lock obj = _ForkingPickler.dumps(obj) if self._wlock is None: # writes to a message oriented win32 pipe are atomic self._writer.send_bytes(obj) else: with self._wlock: self._writer.send_bytes(obj)
10,763
348
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/reduction.py
# # Module which deals with pickling of objects. # # multiprocessing/reduction.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from abc import ABCMeta, abstractmethod import copyreg import functools import io import os import pickle import socket import sys from . import context __all__ = ['send_handle', 'recv_handle', 'ForkingPickler', 'register', 'dump'] HAVE_SEND_HANDLE = (sys.platform == 'win32' or (hasattr(socket, 'CMSG_LEN') and hasattr(socket, 'SCM_RIGHTS') and hasattr(socket.socket, 'sendmsg'))) # # Pickler subclass # class ForkingPickler(pickle.Pickler): '''Pickler subclass used by multiprocessing.''' _extra_reducers = {} _copyreg_dispatch_table = copyreg.dispatch_table def __init__(self, *args): super().__init__(*args) self.dispatch_table = self._copyreg_dispatch_table.copy() self.dispatch_table.update(self._extra_reducers) @classmethod def register(cls, type, reduce): '''Register a reduce function for a type.''' cls._extra_reducers[type] = reduce @classmethod def dumps(cls, obj, protocol=None): buf = io.BytesIO() cls(buf, protocol).dump(obj) return buf.getbuffer() loads = pickle.loads register = ForkingPickler.register def dump(obj, file, protocol=None): '''Replacement for pickle.dump() using ForkingPickler.''' ForkingPickler(file, protocol).dump(obj) # # Platform specific definitions # if sys.platform == 'win32': # Windows __all__ += ['DupHandle', 'duplicate', 'steal_handle'] import _winapi def duplicate(handle, target_process=None, inheritable=False): '''Duplicate a handle. (target_process is a handle not a pid!)''' if target_process is None: target_process = _winapi.GetCurrentProcess() return _winapi.DuplicateHandle( _winapi.GetCurrentProcess(), handle, target_process, 0, inheritable, _winapi.DUPLICATE_SAME_ACCESS) def steal_handle(source_pid, handle): '''Steal a handle from process identified by source_pid.''' source_process_handle = _winapi.OpenProcess( _winapi.PROCESS_DUP_HANDLE, False, source_pid) try: return _winapi.DuplicateHandle( source_process_handle, handle, _winapi.GetCurrentProcess(), 0, False, _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE) finally: _winapi.CloseHandle(source_process_handle) def send_handle(conn, handle, destination_pid): '''Send a handle over a local connection.''' dh = DupHandle(handle, _winapi.DUPLICATE_SAME_ACCESS, destination_pid) conn.send(dh) def recv_handle(conn): '''Receive a handle over a local connection.''' return conn.recv().detach() class DupHandle(object): '''Picklable wrapper for a handle.''' def __init__(self, handle, access, pid=None): if pid is None: # We just duplicate the handle in the current process and # let the receiving process steal the handle. pid = os.getpid() proc = _winapi.OpenProcess(_winapi.PROCESS_DUP_HANDLE, False, pid) try: self._handle = _winapi.DuplicateHandle( _winapi.GetCurrentProcess(), handle, proc, access, False, 0) finally: _winapi.CloseHandle(proc) self._access = access self._pid = pid def detach(self): '''Get the handle. This should only be called once.''' # retrieve handle from process which currently owns it if self._pid == os.getpid(): # The handle has already been duplicated for this process. return self._handle # We must steal the handle from the process whose pid is self._pid. proc = _winapi.OpenProcess(_winapi.PROCESS_DUP_HANDLE, False, self._pid) try: return _winapi.DuplicateHandle( proc, self._handle, _winapi.GetCurrentProcess(), self._access, False, _winapi.DUPLICATE_CLOSE_SOURCE) finally: _winapi.CloseHandle(proc) else: # Unix __all__ += ['DupFd', 'sendfds', 'recvfds'] import array # On MacOSX we should acknowledge receipt of fds -- see Issue14669 ACKNOWLEDGE = sys.platform == 'darwin' def sendfds(sock, fds): '''Send an array of fds over an AF_UNIX socket.''' fds = array.array('i', fds) msg = bytes([len(fds) % 256]) sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)]) if ACKNOWLEDGE and sock.recv(1) != b'A': raise RuntimeError('did not receive acknowledgement of fd') def recvfds(sock, size): '''Receive an array of fds over an AF_UNIX socket.''' a = array.array('i') bytes_size = a.itemsize * size msg, ancdata, flags, addr = sock.recvmsg(1, socket.CMSG_SPACE(bytes_size)) if not msg and not ancdata: raise EOFError try: if ACKNOWLEDGE: sock.send(b'A') if len(ancdata) != 1: raise RuntimeError('received %d items of ancdata' % len(ancdata)) cmsg_level, cmsg_type, cmsg_data = ancdata[0] if (cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS): if len(cmsg_data) % a.itemsize != 0: raise ValueError a.frombytes(cmsg_data) assert len(a) % 256 == msg[0] return list(a) except (ValueError, IndexError): pass raise RuntimeError('Invalid data received') def send_handle(conn, handle, destination_pid): '''Send a handle over a local connection.''' with socket.fromfd(conn.fileno(), socket.AF_UNIX, socket.SOCK_STREAM) as s: sendfds(s, [handle]) def recv_handle(conn): '''Receive a handle over a local connection.''' with socket.fromfd(conn.fileno(), socket.AF_UNIX, socket.SOCK_STREAM) as s: return recvfds(s, 1)[0] def DupFd(fd): '''Return a wrapper for an fd.''' popen_obj = context.get_spawning_popen() if popen_obj is not None: return popen_obj.DupFd(popen_obj.duplicate_for_child(fd)) elif HAVE_SEND_HANDLE: from . import resource_sharer return resource_sharer.DupFd(fd) else: raise ValueError('SCM_RIGHTS appears not to be available') # # Try making some callable types picklable # def _reduce_method(m): if m.__self__ is None: return getattr, (m.__class__, m.__func__.__name__) else: return getattr, (m.__self__, m.__func__.__name__) class _C: def f(self): pass register(type(_C().f), _reduce_method) def _reduce_method_descriptor(m): return getattr, (m.__objclass__, m.__name__) register(type(list.append), _reduce_method_descriptor) register(type(int.__add__), _reduce_method_descriptor) def _reduce_partial(p): return _rebuild_partial, (p.func, p.args, p.keywords or {}) def _rebuild_partial(func, args, keywords): return functools.partial(func, *args, **keywords) register(functools.partial, _reduce_partial) # # Make sockets picklable # if sys.platform == 'win32': def _reduce_socket(s): from .resource_sharer import DupSocket return _rebuild_socket, (DupSocket(s),) def _rebuild_socket(ds): return ds.detach() register(socket.socket, _reduce_socket) else: def _reduce_socket(s): df = DupFd(s.fileno()) return _rebuild_socket, (df, s.family, s.type, s.proto) def _rebuild_socket(df, family, type, proto): fd = df.detach() return socket.socket(family, type, proto, fileno=fd) register(socket.socket, _reduce_socket) class AbstractReducer(metaclass=ABCMeta): '''Abstract base class for use in implementing a Reduction class suitable for use in replacing the standard reduction mechanism used in multiprocessing.''' ForkingPickler = ForkingPickler register = register dump = dump send_handle = send_handle recv_handle = recv_handle if sys.platform == 'win32': steal_handle = steal_handle duplicate = duplicate DupHandle = DupHandle else: sendfds = sendfds recvfds = recvfds DupFd = DupFd _reduce_method = _reduce_method _reduce_method_descriptor = _reduce_method_descriptor _rebuild_partial = _rebuild_partial _reduce_socket = _reduce_socket _rebuild_socket = _rebuild_socket def __init__(self, *args): register(type(_C().f), _reduce_method) register(type(list.append), _reduce_method_descriptor) register(type(int.__add__), _reduce_method_descriptor) register(functools.partial, _reduce_partial) register(socket.socket, _reduce_socket)
9,226
275
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/context.py
import os import sys import threading from . import process from . import reduction __all__ = [] # things are copied from here to __init__.py # # Exceptions # class ProcessError(Exception): pass class BufferTooShort(ProcessError): pass class TimeoutError(ProcessError): pass class AuthenticationError(ProcessError): pass # # Base type for contexts # class BaseContext(object): ProcessError = ProcessError BufferTooShort = BufferTooShort TimeoutError = TimeoutError AuthenticationError = AuthenticationError current_process = staticmethod(process.current_process) active_children = staticmethod(process.active_children) def cpu_count(self): '''Returns the number of CPUs in the system''' num = os.cpu_count() if num is None: raise NotImplementedError('cannot determine number of cpus') else: return num def Manager(self): '''Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects. ''' from .managers import SyncManager m = SyncManager(ctx=self.get_context()) m.start() return m def Pipe(self, duplex=True): '''Returns two connection object connected by a pipe''' from .connection import Pipe return Pipe(duplex) def Lock(self): '''Returns a non-recursive lock object''' from .synchronize import Lock return Lock(ctx=self.get_context()) def RLock(self): '''Returns a recursive lock object''' from .synchronize import RLock return RLock(ctx=self.get_context()) def Condition(self, lock=None): '''Returns a condition object''' from .synchronize import Condition return Condition(lock, ctx=self.get_context()) def Semaphore(self, value=1): '''Returns a semaphore object''' from .synchronize import Semaphore return Semaphore(value, ctx=self.get_context()) def BoundedSemaphore(self, value=1): '''Returns a bounded semaphore object''' from .synchronize import BoundedSemaphore return BoundedSemaphore(value, ctx=self.get_context()) def Event(self): '''Returns an event object''' from .synchronize import Event return Event(ctx=self.get_context()) def Barrier(self, parties, action=None, timeout=None): '''Returns a barrier object''' from .synchronize import Barrier return Barrier(parties, action, timeout, ctx=self.get_context()) def Queue(self, maxsize=0): '''Returns a queue object''' from .queues import Queue return Queue(maxsize, ctx=self.get_context()) def JoinableQueue(self, maxsize=0): '''Returns a queue object''' from .queues import JoinableQueue return JoinableQueue(maxsize, ctx=self.get_context()) def SimpleQueue(self): '''Returns a queue object''' from .queues import SimpleQueue return SimpleQueue(ctx=self.get_context()) def Pool(self, processes=None, initializer=None, initargs=(), maxtasksperchild=None): '''Returns a process pool object''' from .pool import Pool return Pool(processes, initializer, initargs, maxtasksperchild, context=self.get_context()) def RawValue(self, typecode_or_type, *args): '''Returns a shared object''' # from .sharedctypes import RawValue return RawValue(typecode_or_type, *args) def RawArray(self, typecode_or_type, size_or_initializer): '''Returns a shared array''' # from .sharedctypes import RawArray return RawArray(typecode_or_type, size_or_initializer) def Value(self, typecode_or_type, *args, lock=True): '''Returns a synchronized shared object''' # from .sharedctypes import Value return Value(typecode_or_type, *args, lock=lock, ctx=self.get_context()) def Array(self, typecode_or_type, size_or_initializer, *, lock=True): '''Returns a synchronized shared array''' # from .sharedctypes import Array return Array(typecode_or_type, size_or_initializer, lock=lock, ctx=self.get_context()) def freeze_support(self): '''Check whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit. ''' if sys.platform == 'win32' and getattr(sys, 'frozen', False): from .spawn import freeze_support freeze_support() def get_logger(self): '''Return package logger -- if it does not already exist then it is created. ''' from .util import get_logger return get_logger() def log_to_stderr(self, level=None): '''Turn on logging and add a handler which prints to stderr''' from .util import log_to_stderr return log_to_stderr(level) def allow_connection_pickling(self): '''Install support for sending connections and sockets between processes ''' # This is undocumented. In previous versions of multiprocessing # its only effect was to make socket objects inheritable on Windows. from . import connection def set_executable(self, executable): '''Sets the path to a python.exe or pythonw.exe binary used to run child processes instead of sys.executable when using the 'spawn' start method. Useful for people embedding Python. ''' from .spawn import set_executable set_executable(executable) def set_forkserver_preload(self, module_names): '''Set list of module names to try to load in forkserver process. This is really just a hint. ''' from .forkserver import set_forkserver_preload set_forkserver_preload(module_names) def get_context(self, method=None): if method is None: return self try: ctx = _concrete_contexts[method] except KeyError: raise ValueError('cannot find context for %r' % method) ctx._check_available() return ctx def get_start_method(self, allow_none=False): return self._name def set_start_method(self, method, force=False): raise ValueError('cannot set start method of concrete context') @property def reducer(self): '''Controls how objects will be reduced to a form that can be shared with other processes.''' return globals().get('reduction') @reducer.setter def reducer(self, reduction): globals()['reduction'] = reduction def _check_available(self): pass # # Type of default context -- underlying context can be set at most once # class Process(process.BaseProcess): _start_method = None @staticmethod def _Popen(process_obj): return _default_context.get_context().Process._Popen(process_obj) class DefaultContext(BaseContext): Process = Process def __init__(self, context): self._default_context = context self._actual_context = None def get_context(self, method=None): if method is None: if self._actual_context is None: self._actual_context = self._default_context return self._actual_context else: return super().get_context(method) def set_start_method(self, method, force=False): if self._actual_context is not None and not force: raise RuntimeError('context has already been set') if method is None and force: self._actual_context = None return self._actual_context = self.get_context(method) def get_start_method(self, allow_none=False): if self._actual_context is None: if allow_none: return None self._actual_context = self._default_context return self._actual_context._name def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] else: if reduction.HAVE_SEND_HANDLE: return ['fork', 'spawn', 'forkserver'] else: return ['fork', 'spawn'] DefaultContext.__all__ = list(x for x in dir(DefaultContext) if x[0] != '_') # # Context types for fixed start method # class ForkProcess(process.BaseProcess): _start_method = 'fork' @staticmethod def _Popen(process_obj): from .popen_fork import Popen return Popen(process_obj) class SpawnProcess(process.BaseProcess): _start_method = 'spawn' @staticmethod def _Popen(process_obj): from .popen_spawn_posix import Popen return Popen(process_obj) class ForkServerProcess(process.BaseProcess): _start_method = 'forkserver' @staticmethod def _Popen(process_obj): from .popen_forkserver import Popen return Popen(process_obj) class ForkContext(BaseContext): _name = 'fork' Process = ForkProcess class SpawnContext(BaseContext): _name = 'spawn' Process = SpawnProcess class ForkServerContext(BaseContext): _name = 'forkserver' Process = ForkServerProcess def _check_available(self): if not reduction.HAVE_SEND_HANDLE: raise ValueError('forkserver start method not available') _concrete_contexts = { 'fork': ForkContext(), 'spawn': SpawnContext(), 'forkserver': ForkServerContext(), } _default_context = DefaultContext(_concrete_contexts['fork']) # # Force the start method # def _force_start_method(method): _default_context._actual_context = _concrete_contexts[method] # # Check that the current thread is spawning a child process # _tls = threading.local() def get_spawning_popen(): return getattr(_tls, 'spawning_popen', None) def set_spawning_popen(popen): _tls.spawning_popen = popen def assert_spawning(obj): if get_spawning_popen() is None: raise RuntimeError( '%s objects should only be shared between processes' ' through inheritance' % type(obj).__name__ )
10,298
338
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/util.py
# # Module providing various facilities to other parts of the package # # multiprocessing/util.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # import os import itertools import sys import weakref import atexit import threading # we want threading to install it's # cleanup function before multiprocessing does from subprocess import _args_from_interpreter_flags from . import process __all__ = [ 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', 'log_to_stderr', 'get_temp_dir', 'register_after_fork', 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal', 'close_all_fds_except', 'SUBDEBUG', 'SUBWARNING', ] # # Logging # NOTSET = 0 SUBDEBUG = 5 DEBUG = 10 INFO = 20 SUBWARNING = 25 LOGGER_NAME = 'multiprocessing' DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' _logger = None _log_to_stderr = False def sub_debug(msg, *args): if _logger: _logger.log(SUBDEBUG, msg, *args) def debug(msg, *args): if _logger: _logger.log(DEBUG, msg, *args) def info(msg, *args): if _logger: _logger.log(INFO, msg, *args) def sub_warning(msg, *args): if _logger: _logger.log(SUBWARNING, msg, *args) def get_logger(): ''' Returns logger used by multiprocessing ''' global _logger import logging logging._acquireLock() try: if not _logger: _logger = logging.getLogger(LOGGER_NAME) _logger.propagate = 0 # XXX multiprocessing should cleanup before logging if hasattr(atexit, 'unregister'): atexit.unregister(_exit_function) atexit.register(_exit_function) else: atexit._exithandlers.remove((_exit_function, (), {})) atexit._exithandlers.append((_exit_function, (), {})) finally: logging._releaseLock() return _logger def log_to_stderr(level=None): ''' Turn on logging and add a handler which prints to stderr ''' global _log_to_stderr import logging logger = get_logger() formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) handler = logging.StreamHandler() handler.setFormatter(formatter) logger.addHandler(handler) if level: logger.setLevel(level) _log_to_stderr = True return _logger # # Function returning a temp directory which will be removed on exit # def get_temp_dir(): # get name of a temp directory which will be automatically cleaned up tempdir = process.current_process()._config.get('tempdir') if tempdir is None: import shutil, tempfile tempdir = tempfile.mkdtemp(prefix='pymp-') info('created temp directory %s', tempdir) Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) process.current_process()._config['tempdir'] = tempdir return tempdir # # Support for reinitialization of objects when bootstrapping a child process # _afterfork_registry = weakref.WeakValueDictionary() _afterfork_counter = itertools.count() def _run_after_forkers(): items = list(_afterfork_registry.items()) items.sort() for (index, ident, func), obj in items: try: func(obj) except Exception as e: info('after forker raised exception %s', e) def register_after_fork(obj, func): _afterfork_registry[(next(_afterfork_counter), id(obj), func)] = obj # # Finalization using weakrefs # _finalizer_registry = {} _finalizer_counter = itertools.count() class Finalize(object): ''' Class which supports object finalization using weakrefs ''' def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): assert exitpriority is None or type(exitpriority) is int if obj is not None: self._weakref = weakref.ref(obj, self) else: assert exitpriority is not None self._callback = callback self._args = args self._kwargs = kwargs or {} self._key = (exitpriority, next(_finalizer_counter)) self._pid = os.getpid() _finalizer_registry[self._key] = self def __call__(self, wr=None, # Need to bind these locally because the globals can have # been cleared at shutdown _finalizer_registry=_finalizer_registry, sub_debug=sub_debug, getpid=os.getpid): ''' Run the callback unless it has already been called or cancelled ''' try: del _finalizer_registry[self._key] except KeyError: sub_debug('finalizer no longer registered') else: if self._pid != getpid(): sub_debug('finalizer ignored because different process') res = None else: sub_debug('finalizer calling %s with args %s and kwargs %s', self._callback, self._args, self._kwargs) res = self._callback(*self._args, **self._kwargs) self._weakref = self._callback = self._args = \ self._kwargs = self._key = None return res def cancel(self): ''' Cancel finalization of the object ''' try: del _finalizer_registry[self._key] except KeyError: pass else: self._weakref = self._callback = self._args = \ self._kwargs = self._key = None def still_active(self): ''' Return whether this finalizer is still waiting to invoke callback ''' return self._key in _finalizer_registry def __repr__(self): try: obj = self._weakref() except (AttributeError, TypeError): obj = None if obj is None: return '<%s object, dead>' % self.__class__.__name__ x = '<%s object, callback=%s' % ( self.__class__.__name__, getattr(self._callback, '__name__', self._callback)) if self._args: x += ', args=' + str(self._args) if self._kwargs: x += ', kwargs=' + str(self._kwargs) if self._key[0] is not None: x += ', exitprority=' + str(self._key[0]) return x + '>' def _run_finalizers(minpriority=None): ''' Run all finalizers whose exit priority is not None and at least minpriority Finalizers with highest priority are called first; finalizers with the same priority will be called in reverse order of creation. ''' if _finalizer_registry is None: # This function may be called after this module's globals are # destroyed. See the _exit_function function in this module for more # notes. return if minpriority is None: f = lambda p : p[0] is not None else: f = lambda p : p[0] is not None and p[0] >= minpriority # Careful: _finalizer_registry may be mutated while this function # is running (either by a GC run or by another thread). # list(_finalizer_registry) should be atomic, while # list(_finalizer_registry.items()) is not. keys = [key for key in list(_finalizer_registry) if f(key)] keys.sort(reverse=True) for key in keys: finalizer = _finalizer_registry.get(key) # key may have been removed from the registry if finalizer is not None: sub_debug('calling %s', finalizer) try: finalizer() except Exception: import traceback traceback.print_exc() if minpriority is None: _finalizer_registry.clear() # # Clean up on exit # def is_exiting(): ''' Returns true if the process is shutting down ''' return _exiting or _exiting is None _exiting = False def _exit_function(info=info, debug=debug, _run_finalizers=_run_finalizers, active_children=process.active_children, current_process=process.current_process): # We hold on to references to functions in the arglist due to the # situation described below, where this function is called after this # module's globals are destroyed. global _exiting if not _exiting: _exiting = True info('process shutting down') debug('running all "atexit" finalizers with priority >= 0') _run_finalizers(0) if current_process() is not None: # We check if the current process is None here because if # it's None, any call to ``active_children()`` will raise # an AttributeError (active_children winds up trying to # get attributes from util._current_process). One # situation where this can happen is if someone has # manipulated sys.modules, causing this module to be # garbage collected. The destructor for the module type # then replaces all values in the module dict with None. # For instance, after setuptools runs a test it replaces # sys.modules with a copy created earlier. See issues # #9775 and #15881. Also related: #4106, #9205, and # #9207. for p in active_children(): if p.daemon: info('calling terminate() for daemon %s', p.name) p._popen.terminate() for p in active_children(): info('calling join() for process %s', p.name) p.join() debug('running the remaining "atexit" finalizers') _run_finalizers() atexit.register(_exit_function) # # Some fork aware types # class ForkAwareThreadLock(object): def __init__(self): self._reset() register_after_fork(self, ForkAwareThreadLock._reset) def _reset(self): self._lock = threading.Lock() self.acquire = self._lock.acquire self.release = self._lock.release def __enter__(self): return self._lock.__enter__() def __exit__(self, *args): return self._lock.__exit__(*args) class ForkAwareLocal(threading.local): def __init__(self): register_after_fork(self, lambda obj : obj.__dict__.clear()) def __reduce__(self): return type(self), () # # Close fds except those specified # try: MAXFD = os.sysconf("SC_OPEN_MAX") except Exception: MAXFD = 256 def close_all_fds_except(fds): fds = list(fds) + [-1, MAXFD] fds.sort() assert fds[-1] == MAXFD, 'fd too large' for i in range(len(fds) - 1): os.closerange(fds[i]+1, fds[i+1]) # # Close sys.stdin and replace stdin with os.devnull # def _close_stdin(): if sys.stdin is None: return try: sys.stdin.close() except (OSError, ValueError): pass try: fd = os.open(os.devnull, os.O_RDONLY) try: sys.stdin = open(fd, closefd=False) except: os.close(fd) raise except (OSError, ValueError): pass # # Flush standard streams, if any # def _flush_std_streams(): try: sys.stdout.flush() except (AttributeError, ValueError): pass try: sys.stderr.flush() except (AttributeError, ValueError): pass # # Start a program with only specified fds kept open # def spawnv_passfds(path, args, passfds): import _posixsubprocess passfds = tuple(sorted(map(int, passfds))) errpipe_read, errpipe_write = os.pipe() try: return _posixsubprocess.fork_exec( args, [os.fsencode(path)], True, passfds, None, None, -1, -1, -1, -1, -1, -1, errpipe_read, errpipe_write, False, False, None) finally: os.close(errpipe_read) os.close(errpipe_write)
11,886
421
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/synchronize.py
# # Module implementing synchronization primitives # # multiprocessing/synchronize.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' ] import threading import sys import tempfile import _multiprocessing import time from . import context from . import process from . import util # Try to import the mp.synchronize module cleanly, if it fails # raise ImportError for platforms lacking a working sem_open implementation. # See issue 3770 try: from _multiprocessing import SemLock, sem_unlink except (ImportError): raise ImportError("This platform lacks a functioning sem_open" + " implementation, therefore, the required" + " synchronization primitives needed will not" + " function, see issue 3770.") # # Constants # RECURSIVE_MUTEX, SEMAPHORE = list(range(2)) SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX # # Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` # class SemLock(object): _rand = tempfile._RandomNameSequence() def __init__(self, kind, value, maxvalue, *, ctx): if ctx is None: ctx = context._default_context.get_context() name = ctx.get_start_method() unlink_now = sys.platform == 'win32' or name == 'fork' for i in range(100): try: sl = self._semlock = _multiprocessing.SemLock( kind, value, maxvalue, self._make_name(), unlink_now) except FileExistsError: pass else: break else: raise FileExistsError('cannot find name for semaphore') util.debug('created semlock with handle %s' % sl.handle) self._make_methods() if sys.platform != 'win32': def _after_fork(obj): obj._semlock._after_fork() util.register_after_fork(self, _after_fork) if self._semlock.name is not None: # We only get here if we are on Unix with forking # disabled. When the object is garbage collected or the # process shuts down we unlink the semaphore name from .semaphore_tracker import register register(self._semlock.name) util.Finalize(self, SemLock._cleanup, (self._semlock.name,), exitpriority=0) @staticmethod def _cleanup(name): from .semaphore_tracker import unregister sem_unlink(name) unregister(name) def _make_methods(self): self.acquire = self._semlock.acquire self.release = self._semlock.release def __enter__(self): return self._semlock.__enter__() def __exit__(self, *args): return self._semlock.__exit__(*args) def __getstate__(self): context.assert_spawning(self) sl = self._semlock if sys.platform == 'win32': h = context.get_spawning_popen().duplicate_for_child(sl.handle) else: h = sl.handle return (h, sl.kind, sl.maxvalue, sl.name) def __setstate__(self, state): self._semlock = _multiprocessing.SemLock._rebuild(*state) util.debug('recreated blocker with handle %r' % state[0]) self._make_methods() @staticmethod def _make_name(): return '%s-%s' % (process.current_process()._config['semprefix'], next(SemLock._rand)) # # Semaphore # class Semaphore(SemLock): def __init__(self, value=1, *, ctx): SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx) def get_value(self): return self._semlock._get_value() def __repr__(self): try: value = self._semlock._get_value() except Exception: value = 'unknown' return '<%s(value=%s)>' % (self.__class__.__name__, value) # # Bounded semaphore # class BoundedSemaphore(Semaphore): def __init__(self, value=1, *, ctx): SemLock.__init__(self, SEMAPHORE, value, value, ctx=ctx) def __repr__(self): try: value = self._semlock._get_value() except Exception: value = 'unknown' return '<%s(value=%s, maxvalue=%s)>' % \ (self.__class__.__name__, value, self._semlock.maxvalue) # # Non-recursive lock # class Lock(SemLock): def __init__(self, *, ctx): SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx) def __repr__(self): try: if self._semlock._is_mine(): name = process.current_process().name if threading.current_thread().name != 'MainThread': name += '|' + threading.current_thread().name elif self._semlock._get_value() == 1: name = 'None' elif self._semlock._count() > 0: name = 'SomeOtherThread' else: name = 'SomeOtherProcess' except Exception: name = 'unknown' return '<%s(owner=%s)>' % (self.__class__.__name__, name) # # Recursive lock # class RLock(SemLock): def __init__(self, *, ctx): SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1, ctx=ctx) def __repr__(self): try: if self._semlock._is_mine(): name = process.current_process().name if threading.current_thread().name != 'MainThread': name += '|' + threading.current_thread().name count = self._semlock._count() elif self._semlock._get_value() == 1: name, count = 'None', 0 elif self._semlock._count() > 0: name, count = 'SomeOtherThread', 'nonzero' else: name, count = 'SomeOtherProcess', 'nonzero' except Exception: name, count = 'unknown', 'unknown' return '<%s(%s, %s)>' % (self.__class__.__name__, name, count) # # Condition variable # class Condition(object): def __init__(self, lock=None, *, ctx): self._lock = lock or ctx.RLock() self._sleeping_count = ctx.Semaphore(0) self._woken_count = ctx.Semaphore(0) self._wait_semaphore = ctx.Semaphore(0) self._make_methods() def __getstate__(self): context.assert_spawning(self) return (self._lock, self._sleeping_count, self._woken_count, self._wait_semaphore) def __setstate__(self, state): (self._lock, self._sleeping_count, self._woken_count, self._wait_semaphore) = state self._make_methods() def __enter__(self): return self._lock.__enter__() def __exit__(self, *args): return self._lock.__exit__(*args) def _make_methods(self): self.acquire = self._lock.acquire self.release = self._lock.release def __repr__(self): try: num_waiters = (self._sleeping_count._semlock._get_value() - self._woken_count._semlock._get_value()) except Exception: num_waiters = 'unknown' return '<%s(%s, %s)>' % (self.__class__.__name__, self._lock, num_waiters) def wait(self, timeout=None): assert self._lock._semlock._is_mine(), \ 'must acquire() condition before using wait()' # indicate that this thread is going to sleep self._sleeping_count.release() # release lock count = self._lock._semlock._count() for i in range(count): self._lock.release() try: # wait for notification or timeout return self._wait_semaphore.acquire(True, timeout) finally: # indicate that this thread has woken self._woken_count.release() # reacquire lock for i in range(count): self._lock.acquire() def notify(self): assert self._lock._semlock._is_mine(), 'lock is not owned' assert not self._wait_semaphore.acquire(False) # to take account of timeouts since last notify() we subtract # woken_count from sleeping_count and rezero woken_count while self._woken_count.acquire(False): res = self._sleeping_count.acquire(False) assert res if self._sleeping_count.acquire(False): # try grabbing a sleeper self._wait_semaphore.release() # wake up one sleeper self._woken_count.acquire() # wait for the sleeper to wake # rezero _wait_semaphore in case a timeout just happened self._wait_semaphore.acquire(False) def notify_all(self): assert self._lock._semlock._is_mine(), 'lock is not owned' assert not self._wait_semaphore.acquire(False) # to take account of timeouts since last notify*() we subtract # woken_count from sleeping_count and rezero woken_count while self._woken_count.acquire(False): res = self._sleeping_count.acquire(False) assert res sleepers = 0 while self._sleeping_count.acquire(False): self._wait_semaphore.release() # wake up one sleeper sleepers += 1 if sleepers: for i in range(sleepers): self._woken_count.acquire() # wait for a sleeper to wake # rezero wait_semaphore in case some timeouts just happened while self._wait_semaphore.acquire(False): pass def wait_for(self, predicate, timeout=None): result = predicate() if result: return result if timeout is not None: endtime = time.monotonic() + timeout else: endtime = None waittime = None while not result: if endtime is not None: waittime = endtime - time.monotonic() if waittime <= 0: break self.wait(waittime) result = predicate() return result # # Event # class Event(object): def __init__(self, *, ctx): self._cond = ctx.Condition(ctx.Lock()) self._flag = ctx.Semaphore(0) def is_set(self): with self._cond: if self._flag.acquire(False): self._flag.release() return True return False def set(self): with self._cond: self._flag.acquire(False) self._flag.release() self._cond.notify_all() def clear(self): with self._cond: self._flag.acquire(False) def wait(self, timeout=None): with self._cond: if self._flag.acquire(False): self._flag.release() else: self._cond.wait(timeout) if self._flag.acquire(False): self._flag.release() return True return False # # Barrier # class Barrier(threading.Barrier): def __init__(self, parties, action=None, timeout=None, *, ctx): import struct from .heap import BufferWrapper wrapper = BufferWrapper(struct.calcsize('i') * 2) cond = ctx.Condition() self.__setstate__((parties, action, timeout, cond, wrapper)) self._state = 0 self._count = 0 def __setstate__(self, state): (self._parties, self._action, self._timeout, self._cond, self._wrapper) = state self._array = self._wrapper.create_memoryview().cast('i') def __getstate__(self): return (self._parties, self._action, self._timeout, self._cond, self._wrapper) @property def _state(self): return self._array[0] @_state.setter def _state(self, value): self._array[0] = value @property def _count(self): return self._array[1] @_count.setter def _count(self, value): self._array[1] = value
12,050
406
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/process.py
# # Module providing the `Process` class which emulates `threading.Thread` # # multiprocessing/process.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = ['BaseProcess', 'current_process', 'active_children'] # # Imports # import os import sys import signal import itertools from _weakrefset import WeakSet # # # try: ORIGINAL_DIR = os.path.abspath(os.getcwd()) except OSError: ORIGINAL_DIR = None # # Public functions # def current_process(): ''' Return process object representing the current process ''' return _current_process def active_children(): ''' Return list of process objects corresponding to live child processes ''' _cleanup() return list(_children) # # # def _cleanup(): # check for processes which have finished for p in list(_children): if p._popen.poll() is not None: _children.discard(p) # # The `Process` class # class BaseProcess(object): ''' Process objects represent activity that is run in a separate process The class is analogous to `threading.Thread` ''' def _Popen(self): raise NotImplementedError def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, *, daemon=None): assert group is None, 'group argument must be None for now' count = next(_process_counter) self._identity = _current_process._identity + (count,) self._config = _current_process._config.copy() self._parent_pid = os.getpid() self._popen = None self._target = target self._args = tuple(args) self._kwargs = dict(kwargs) self._name = name or type(self).__name__ + '-' + \ ':'.join(str(i) for i in self._identity) if daemon is not None: self.daemon = daemon _dangling.add(self) def run(self): ''' Method to be run in sub-process; can be overridden in sub-class ''' if self._target: self._target(*self._args, **self._kwargs) def start(self): ''' Start child process ''' assert self._popen is None, 'cannot start a process twice' assert self._parent_pid == os.getpid(), \ 'can only start a process object created by current process' assert not _current_process._config.get('daemon'), \ 'daemonic processes are not allowed to have children' _cleanup() self._popen = self._Popen(self) self._sentinel = self._popen.sentinel # Avoid a refcycle if the target function holds an indirect # reference to the process object (see bpo-30775) del self._target, self._args, self._kwargs _children.add(self) def terminate(self): ''' Terminate process; sends SIGTERM signal or uses TerminateProcess() ''' self._popen.terminate() def join(self, timeout=None): ''' Wait until child process terminates ''' assert self._parent_pid == os.getpid(), 'can only join a child process' assert self._popen is not None, 'can only join a started process' res = self._popen.wait(timeout) if res is not None: _children.discard(self) def is_alive(self): ''' Return whether process is alive ''' if self is _current_process: return True assert self._parent_pid == os.getpid(), 'can only test a child process' if self._popen is None: return False returncode = self._popen.poll() if returncode is None: return True else: _children.discard(self) return False @property def name(self): return self._name @name.setter def name(self, name): assert isinstance(name, str), 'name must be a string' self._name = name @property def daemon(self): ''' Return whether process is a daemon ''' return self._config.get('daemon', False) @daemon.setter def daemon(self, daemonic): ''' Set whether process is a daemon ''' assert self._popen is None, 'process has already started' self._config['daemon'] = daemonic @property def authkey(self): return self._config['authkey'] @authkey.setter def authkey(self, authkey): ''' Set authorization key of process ''' self._config['authkey'] = AuthenticationString(authkey) @property def exitcode(self): ''' Return exit code of process or `None` if it has yet to stop ''' if self._popen is None: return self._popen return self._popen.poll() @property def ident(self): ''' Return identifier (PID) of process or `None` if it has yet to start ''' if self is _current_process: return os.getpid() else: return self._popen and self._popen.pid pid = ident @property def sentinel(self): ''' Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination. ''' try: return self._sentinel except AttributeError: raise ValueError("process not started") def __repr__(self): if self is _current_process: status = 'started' elif self._parent_pid != os.getpid(): status = 'unknown' elif self._popen is None: status = 'initial' else: if self._popen.poll() is not None: status = self.exitcode else: status = 'started' if type(status) is int: if status == 0: status = 'stopped' else: status = 'stopped[%s]' % _exitcode_to_name.get(status, status) return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, status, self.daemon and ' daemon' or '') ## def _bootstrap(self): from . import util, context global _current_process, _process_counter, _children try: if self._start_method is not None: context._force_start_method(self._start_method) _process_counter = itertools.count(1) _children = set() util._close_stdin() old_process = _current_process _current_process = self try: util._finalizer_registry.clear() util._run_after_forkers() finally: # delay finalization of the old process object until after # _run_after_forkers() is executed del old_process util.info('child process calling self.run()') try: self.run() exitcode = 0 finally: util._exit_function() except SystemExit as e: if not e.args: exitcode = 1 elif isinstance(e.args[0], int): exitcode = e.args[0] else: sys.stderr.write(str(e.args[0]) + '\n') exitcode = 1 except: exitcode = 1 import traceback sys.stderr.write('Process %s:\n' % self.name) traceback.print_exc() finally: util.info('process exiting with exitcode %d' % exitcode) util._flush_std_streams() return exitcode # # We subclass bytes to avoid accidental transmission of auth keys over network # class AuthenticationString(bytes): def __reduce__(self): from .context import get_spawning_popen if get_spawning_popen() is None: raise TypeError( 'Pickling an AuthenticationString object is ' 'disallowed for security reasons' ) return AuthenticationString, (bytes(self),) # # Create object representing the main process # class _MainProcess(BaseProcess): def __init__(self): self._identity = () self._name = 'MainProcess' self._parent_pid = None self._popen = None self._config = {'authkey': AuthenticationString(os.urandom(32)), 'semprefix': '/mp'} # Note that some versions of FreeBSD only allow named # semaphores to have names of up to 14 characters. Therefore # we choose a short prefix. # # On MacOSX in a sandbox it may be necessary to use a # different prefix -- see #19478. # # Everything in self._config will be inherited by descendant # processes. _current_process = _MainProcess() _process_counter = itertools.count(1) _children = set() del _MainProcess # # Give names to some return codes # _exitcode_to_name = {} for name, signum in list(signal.__dict__.items()): if name[:3]=='SIG' and '_' not in name: _exitcode_to_name[-signum] = name # For debug and leak testing _dangling = WeakSet()
9,211
336
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/popen_spawn_posix.py
import io import os from .context import reduction, set_spawning_popen from . import popen_fork from . import spawn from . import util __all__ = ['Popen'] # # Wrapper for an fd used while launching a process # class _DupFd(object): def __init__(self, fd): self.fd = fd def detach(self): return self.fd # # Start child process using a fresh interpreter # class Popen(popen_fork.Popen): method = 'spawn' DupFd = _DupFd def __init__(self, process_obj): self._fds = [] super().__init__(process_obj) def duplicate_for_child(self, fd): self._fds.append(fd) return fd def _launch(self, process_obj): from . import semaphore_tracker tracker_fd = semaphore_tracker.getfd() self._fds.append(tracker_fd) prep_data = spawn.get_preparation_data(process_obj._name) fp = io.BytesIO() set_spawning_popen(self) try: reduction.dump(prep_data, fp) reduction.dump(process_obj, fp) finally: set_spawning_popen(None) parent_r = child_w = child_r = parent_w = None try: parent_r, child_w = os.pipe() child_r, parent_w = os.pipe() cmd = spawn.get_command_line(tracker_fd=tracker_fd, pipe_handle=child_r) self._fds.extend([child_r, child_w]) self.pid = util.spawnv_passfds(spawn.get_executable(), cmd, self._fds) self.sentinel = parent_r with open(parent_w, 'wb', closefd=False) as f: f.write(fp.getbuffer()) finally: if parent_r is not None: util.Finalize(self, os.close, (parent_r,)) for fd in (child_r, child_w, parent_w): if fd is not None: os.close(fd)
1,904
69
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/spawn.py
# # Code used to start processes when using the spawn or forkserver # start methods. # # multiprocessing/spawn.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # import os import sys import runpy import types from . import get_start_method, set_start_method from . import process from .context import reduction from . import util __all__ = ['_main', 'freeze_support', 'set_executable', 'get_executable', 'get_preparation_data', 'get_command_line', 'import_main_path'] # # _python_exe is the assumed path to the python executable. # People embedding Python want to modify it. # if sys.platform != 'win32': WINEXE = False WINSERVICE = False else: WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) WINSERVICE = sys.executable.lower().endswith("pythonservice.exe") if WINSERVICE: _python_exe = os.path.join(sys.exec_prefix, 'python.exe') else: _python_exe = sys.executable def set_executable(exe): global _python_exe _python_exe = exe def get_executable(): return _python_exe # # # def is_forking(argv): ''' Return whether commandline indicates we are forking ''' if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': return True else: return False def freeze_support(): ''' Run code for process object if this in not the main process ''' if is_forking(sys.argv): kwds = {} for arg in sys.argv[2:]: name, value = arg.split('=') if value == 'None': kwds[name] = None else: kwds[name] = int(value) spawn_main(**kwds) sys.exit() def get_command_line(**kwds): ''' Returns prefix of command line used for spawning a child process ''' if getattr(sys, 'frozen', False): return ([sys.executable, '--multiprocessing-fork'] + ['%s=%r' % item for item in kwds.items()]) else: prog = 'from multiprocessing.spawn import spawn_main; spawn_main(%s)' prog %= ', '.join('%s=%r' % item for item in kwds.items()) opts = util._args_from_interpreter_flags() return [_python_exe] + opts + ['-c', prog, '--multiprocessing-fork'] def spawn_main(pipe_handle, parent_pid=None, tracker_fd=None): ''' Run code specified by data received over pipe ''' assert is_forking(sys.argv) if sys.platform == 'win32': import msvcrt new_handle = reduction.steal_handle(parent_pid, pipe_handle) fd = msvcrt.open_osfhandle(new_handle, os.O_RDONLY) else: from . import semaphore_tracker semaphore_tracker._semaphore_tracker._fd = tracker_fd fd = pipe_handle exitcode = _main(fd) sys.exit(exitcode) def _main(fd): with os.fdopen(fd, 'rb', closefd=True) as from_parent: process.current_process()._inheriting = True try: preparation_data = reduction.pickle.load(from_parent) prepare(preparation_data) self = reduction.pickle.load(from_parent) finally: del process.current_process()._inheriting return self._bootstrap() def _check_not_importing_main(): if getattr(process.current_process(), '_inheriting', False): raise RuntimeError(''' An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__main__': freeze_support() ... The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable.''') def get_preparation_data(name): ''' Return info about parent needed by child to unpickle process object ''' _check_not_importing_main() d = dict( log_to_stderr=util._log_to_stderr, authkey=process.current_process().authkey, ) if util._logger is not None: d['log_level'] = util._logger.getEffectiveLevel() sys_path=sys.path.copy() try: i = sys_path.index('') except ValueError: pass else: sys_path[i] = process.ORIGINAL_DIR d.update( name=name, sys_path=sys_path, sys_argv=sys.argv, orig_dir=process.ORIGINAL_DIR, dir=os.getcwd(), start_method=get_start_method(), ) # Figure out whether to initialise main in the subprocess as a module # or through direct execution (or to leave it alone entirely) main_module = sys.modules['__main__'] main_mod_name = getattr(main_module.__spec__, "name", None) if main_mod_name is not None: d['init_main_from_name'] = main_mod_name elif sys.platform != 'win32' or (not WINEXE and not WINSERVICE): main_path = getattr(main_module, '__file__', None) if main_path is not None: if (not os.path.isabs(main_path) and process.ORIGINAL_DIR is not None): main_path = os.path.join(process.ORIGINAL_DIR, main_path) d['init_main_from_path'] = os.path.normpath(main_path) return d # # Prepare current process # old_main_modules = [] def prepare(data): ''' Try to get current process ready to unpickle process object ''' if 'name' in data: process.current_process().name = data['name'] if 'authkey' in data: process.current_process().authkey = data['authkey'] if 'log_to_stderr' in data and data['log_to_stderr']: util.log_to_stderr() if 'log_level' in data: util.get_logger().setLevel(data['log_level']) if 'sys_path' in data: sys.path = data['sys_path'] if 'sys_argv' in data: sys.argv = data['sys_argv'] if 'dir' in data: os.chdir(data['dir']) if 'orig_dir' in data: process.ORIGINAL_DIR = data['orig_dir'] if 'start_method' in data: set_start_method(data['start_method'], force=True) if 'init_main_from_name' in data: _fixup_main_from_name(data['init_main_from_name']) elif 'init_main_from_path' in data: _fixup_main_from_path(data['init_main_from_path']) # Multiprocessing module helpers to fix up the main module in # spawned subprocesses def _fixup_main_from_name(mod_name): # __main__.py files for packages, directories, zip archives, etc, run # their "main only" code unconditionally, so we don't even try to # populate anything in __main__, nor do we make any changes to # __main__ attributes current_main = sys.modules['__main__'] if mod_name == "__main__" or mod_name.endswith(".__main__"): return # If this process was forked, __main__ may already be populated if getattr(current_main.__spec__, "name", None) == mod_name: return # Otherwise, __main__ may contain some non-main code where we need to # support unpickling it properly. We rerun it as __mp_main__ and make # the normal __main__ an alias to that old_main_modules.append(current_main) main_module = types.ModuleType("__mp_main__") main_content = runpy.run_module(mod_name, run_name="__mp_main__", alter_sys=True) main_module.__dict__.update(main_content) sys.modules['__main__'] = sys.modules['__mp_main__'] = main_module def _fixup_main_from_path(main_path): # If this process was forked, __main__ may already be populated current_main = sys.modules['__main__'] # Unfortunately, the main ipython launch script historically had no # "if __name__ == '__main__'" guard, so we work around that # by treating it like a __main__.py file # See https://github.com/ipython/ipython/issues/4698 main_name = os.path.splitext(os.path.basename(main_path))[0] if main_name == 'ipython': return # Otherwise, if __file__ already has the setting we expect, # there's nothing more to do if getattr(current_main, '__file__', None) == main_path: return # If the parent process has sent a path through rather than a module # name we assume it is an executable script that may contain # non-main code that needs to be executed old_main_modules.append(current_main) main_module = types.ModuleType("__mp_main__") main_content = runpy.run_path(main_path, run_name="__mp_main__") main_module.__dict__.update(main_content) sys.modules['__main__'] = sys.modules['__mp_main__'] = main_module def import_main_path(main_path): ''' Set sys.modules['__main__'] to module at main_path ''' _fixup_main_from_path(main_path)
8,863
287
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/__init__.py
# # Package analogous to 'threading.py' but using processes # # multiprocessing/__init__.py # # This package is intended to duplicate the functionality (and much of # the API) of threading.py but uses processes instead of threads. A # subpackage 'multiprocessing.dummy' has the same API but is a simple # wrapper for 'threading'. # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # import sys from . import context # # Copy stuff from default context # Array = context._default_context.Array AuthenticationError = context._default_context.AuthenticationError Barrier = context._default_context.Barrier BoundedSemaphore = context._default_context.BoundedSemaphore BufferTooShort = context._default_context.BufferTooShort Condition = context._default_context.Condition Event = context._default_context.Event JoinableQueue = context._default_context.JoinableQueue Lock = context._default_context.Lock Manager = context._default_context.Manager Pipe = context._default_context.Pipe Pool = context._default_context.Pool Process = context._default_context.Process ProcessError = context._default_context.ProcessError Queue = context._default_context.Queue RLock = context._default_context.RLock RawArray = context._default_context.RawArray RawValue = context._default_context.RawValue Semaphore = context._default_context.Semaphore SimpleQueue = context._default_context.SimpleQueue TimeoutError = context._default_context.TimeoutError Value = context._default_context.Value active_children = context._default_context.active_children allow_connection_pickling = context._default_context.allow_connection_pickling cpu_count = context._default_context.cpu_count current_process = context._default_context.current_process freeze_support = context._default_context.freeze_support get_all_start_methods = context._default_context.get_all_start_methods get_context = context._default_context.get_context get_logger = context._default_context.get_logger get_start_method = context._default_context.get_start_method log_to_stderr = context._default_context.log_to_stderr reducer = context._default_context.reducer set_executable = context._default_context.set_executable set_forkserver_preload = context._default_context.set_forkserver_preload set_start_method = context._default_context.set_start_method # # XXX These should not really be documented or public. # SUBDEBUG = 5 SUBWARNING = 25 # # Alias for main module -- will be reset by bootstrapping child processes # if '__main__' in sys.modules: sys.modules['__mp_main__'] = sys.modules['__main__']
2,590
72
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/dummy/connection.py
# # Analogue of `multiprocessing.connection` which uses queues instead of sockets # # multiprocessing/dummy/connection.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'Client', 'Listener', 'Pipe' ] from queue import Queue families = [None] class Listener(object): def __init__(self, address=None, family=None, backlog=1): self._backlog_queue = Queue(backlog) def accept(self): return Connection(*self._backlog_queue.get()) def close(self): self._backlog_queue = None address = property(lambda self: self._backlog_queue) def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): self.close() def Client(address): _in, _out = Queue(), Queue() address.put((_out, _in)) return Connection(_in, _out) def Pipe(duplex=True): a, b = Queue(), Queue() return Connection(a, b), Connection(b, a) class Connection(object): def __init__(self, _in, _out): self._out = _out self._in = _in self.send = self.send_bytes = _out.put self.recv = self.recv_bytes = _in.get def poll(self, timeout=0.0): if self._in.qsize() > 0: return True if timeout <= 0.0: return False with self._in.not_empty: self._in.not_empty.wait(timeout) return self._in.qsize() > 0 def close(self): pass def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): self.close()
1,583
74
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/multiprocessing/dummy/__init__.py
# # Support for the API of the multiprocessing package using threads # # multiprocessing/dummy/__init__.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'Process', 'current_process', 'active_children', 'freeze_support', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event', 'Barrier', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' ] # # Imports # import threading import sys import weakref import array from .connection import Pipe from threading import Lock, RLock, Semaphore, BoundedSemaphore from threading import Event, Condition, Barrier from queue import Queue # # # class DummyProcess(threading.Thread): def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): threading.Thread.__init__(self, group, target, name, args, kwargs) self._pid = None self._children = weakref.WeakKeyDictionary() self._start_called = False self._parent = current_process() def start(self): assert self._parent is current_process() self._start_called = True if hasattr(self._parent, '_children'): self._parent._children[self] = None threading.Thread.start(self) @property def exitcode(self): if self._start_called and not self.is_alive(): return 0 else: return None # # # Process = DummyProcess current_process = threading.current_thread current_process()._children = weakref.WeakKeyDictionary() def active_children(): children = current_process()._children for p in list(children): if not p.is_alive(): children.pop(p, None) return list(children) def freeze_support(): pass # # # class Namespace(object): def __init__(self, **kwds): self.__dict__.update(kwds) def __repr__(self): items = list(self.__dict__.items()) temp = [] for name, value in items: if not name.startswith('_'): temp.append('%s=%r' % (name, value)) temp.sort() return '%s(%s)' % (self.__class__.__name__, ', '.join(temp)) dict = dict list = list def Array(typecode, sequence, lock=True): return array.array(typecode, sequence) class Value(object): def __init__(self, typecode, value, lock=True): self._typecode = typecode self._value = value def _get(self): return self._value def _set(self, value): self._value = value value = property(_get, _set) def __repr__(self): return '<%s(%r, %r)>'%(type(self).__name__,self._typecode,self._value) def Manager(): return sys.modules[__name__] def shutdown(): pass def Pool(processes=None, initializer=None, initargs=()): from ..pool import ThreadPool return ThreadPool(processes, initializer, initargs) JoinableQueue = Queue
2,896
120
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/dbm/ndbm.py
"""Provide the _dbm module as a dbm submodule.""" from _dbm import *
70
4
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/dbm/gnu.py
"""Provide the _gdbm module as a dbm submodule.""" from _gdbm import *
72
4
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/dbm/dumb.py
"""A dumb and slow but simple dbm clone. For database spam, spam.dir contains the index (a text file), spam.bak *may* contain a backup of the index (also a text file), while spam.dat contains the data (a binary file). XXX TO DO: - seems to contain a bug when updating... - reclaim free space (currently, space once occupied by deleted or expanded items is never reused) - support concurrent access (currently, if two processes take turns making updates, they can mess up the index) - support efficient access to large databases (currently, the whole index is read when the database is opened, and some updates rewrite the whole index) - support opening for read-only (flag = 'm') """ import ast as _ast import io as _io import os as _os import collections __all__ = ["error", "open"] _BLOCKSIZE = 512 error = OSError class _Database(collections.MutableMapping): # The on-disk directory and data files can remain in mutually # inconsistent states for an arbitrarily long time (see comments # at the end of __setitem__). This is only repaired when _commit() # gets called. One place _commit() gets called is from __del__(), # and if that occurs at program shutdown time, module globals may # already have gotten rebound to None. Since it's crucial that # _commit() finish successfully, we can't ignore shutdown races # here, and _commit() must not reference any globals. _os = _os # for _commit() _io = _io # for _commit() def __init__(self, filebasename, mode, flag='c'): self._mode = mode self._readonly = (flag == 'r') # The directory file is a text file. Each line looks like # "%r, (%d, %d)\n" % (key, pos, siz) # where key is the string key, pos is the offset into the dat # file of the associated value's first byte, and siz is the number # of bytes in the associated value. self._dirfile = filebasename + '.dir' # The data file is a binary file pointed into by the directory # file, and holds the values associated with keys. Each value # begins at a _BLOCKSIZE-aligned byte offset, and is a raw # binary 8-bit string value. self._datfile = filebasename + '.dat' self._bakfile = filebasename + '.bak' # The index is an in-memory dict, mirroring the directory file. self._index = None # maps keys to (pos, siz) pairs # Handle the creation self._create(flag) self._update() def _create(self, flag): if flag == 'n': for filename in (self._datfile, self._bakfile, self._dirfile): try: _os.remove(filename) except OSError: pass # Mod by Jack: create data file if needed try: f = _io.open(self._datfile, 'r', encoding="Latin-1") except OSError: if flag not in ('c', 'n'): import warnings warnings.warn("The database file is missing, the " "semantics of the 'c' flag will be used.", DeprecationWarning, stacklevel=4) with _io.open(self._datfile, 'w', encoding="Latin-1") as f: self._chmod(self._datfile) else: f.close() # Read directory file into the in-memory index dict. def _update(self): self._index = {} try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: self._modified = not self._readonly else: self._modified = False with f: for line in f: line = line.rstrip() key, pos_and_siz_pair = _ast.literal_eval(line) key = key.encode('Latin-1') self._index[key] = pos_and_siz_pair # Write the index dict to the directory file. The original directory # file (if any) is renamed with a .bak extension first. If a .bak # file currently exists, it's deleted. def _commit(self): # CAUTION: It's vital that _commit() succeed, and _commit() can # be called from __del__(). Therefore we must never reference a # global in this routine. if self._index is None or not self._modified: return # nothing to do try: self._os.unlink(self._bakfile) except OSError: pass try: self._os.rename(self._dirfile, self._bakfile) except OSError: pass with self._io.open(self._dirfile, 'w', encoding="Latin-1") as f: self._chmod(self._dirfile) for key, pos_and_siz_pair in self._index.items(): # Use Latin-1 since it has no qualms with any value in any # position; UTF-8, though, does care sometimes. entry = "%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair) f.write(entry) sync = _commit def _verify_open(self): if self._index is None: raise error('DBM object has already been closed') def __getitem__(self, key): if isinstance(key, str): key = key.encode('utf-8') self._verify_open() pos, siz = self._index[key] # may raise KeyError with _io.open(self._datfile, 'rb') as f: f.seek(pos) dat = f.read(siz) return dat # Append val to the data file, starting at a _BLOCKSIZE-aligned # offset. The data file is first padded with NUL bytes (if needed) # to get to an aligned offset. Return pair # (starting offset of val, len(val)) def _addval(self, val): with _io.open(self._datfile, 'rb+') as f: f.seek(0, 2) pos = int(f.tell()) npos = ((pos + _BLOCKSIZE - 1) // _BLOCKSIZE) * _BLOCKSIZE f.write(b'\0'*(npos-pos)) pos = npos f.write(val) return (pos, len(val)) # Write val to the data file, starting at offset pos. The caller # is responsible for ensuring that there's enough room starting at # pos to hold val, without overwriting some other value. Return # pair (pos, len(val)). def _setval(self, pos, val): with _io.open(self._datfile, 'rb+') as f: f.seek(pos) f.write(val) return (pos, len(val)) # key is a new key whose associated value starts in the data file # at offset pos and with length siz. Add an index record to # the in-memory index dict, and append one to the directory file. def _addkey(self, key, pos_and_siz_pair): self._index[key] = pos_and_siz_pair with _io.open(self._dirfile, 'a', encoding="Latin-1") as f: self._chmod(self._dirfile) f.write("%r, %r\n" % (key.decode("Latin-1"), pos_and_siz_pair)) def __setitem__(self, key, val): if self._readonly: import warnings warnings.warn('The database is opened for reading only', DeprecationWarning, stacklevel=2) if isinstance(key, str): key = key.encode('utf-8') elif not isinstance(key, (bytes, bytearray)): raise TypeError("keys must be bytes or strings") if isinstance(val, str): val = val.encode('utf-8') elif not isinstance(val, (bytes, bytearray)): raise TypeError("values must be bytes or strings") self._verify_open() self._modified = True if key not in self._index: self._addkey(key, self._addval(val)) else: # See whether the new value is small enough to fit in the # (padded) space currently occupied by the old value. pos, siz = self._index[key] oldblocks = (siz + _BLOCKSIZE - 1) // _BLOCKSIZE newblocks = (len(val) + _BLOCKSIZE - 1) // _BLOCKSIZE if newblocks <= oldblocks: self._index[key] = self._setval(pos, val) else: # The new value doesn't fit in the (padded) space used # by the old value. The blocks used by the old value are # forever lost. self._index[key] = self._addval(val) # Note that _index may be out of synch with the directory # file now: _setval() and _addval() don't update the directory # file. This also means that the on-disk directory and data # files are in a mutually inconsistent state, and they'll # remain that way until _commit() is called. Note that this # is a disaster (for the database) if the program crashes # (so that _commit() never gets called). def __delitem__(self, key): if self._readonly: import warnings warnings.warn('The database is opened for reading only', DeprecationWarning, stacklevel=2) if isinstance(key, str): key = key.encode('utf-8') self._verify_open() self._modified = True # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always # XXX has, so I'm not changing it). __setitem__ doesn't try to # XXX keep the directory file in synch. Why should we? Or # XXX why shouldn't __setitem__? self._commit() def keys(self): try: return list(self._index) except TypeError: raise error('DBM object has already been closed') from None def items(self): self._verify_open() return [(key, self[key]) for key in self._index.keys()] def __contains__(self, key): if isinstance(key, str): key = key.encode('utf-8') try: return key in self._index except TypeError: if self._index is None: raise error('DBM object has already been closed') from None else: raise def iterkeys(self): try: return iter(self._index) except TypeError: raise error('DBM object has already been closed') from None __iter__ = iterkeys def __len__(self): try: return len(self._index) except TypeError: raise error('DBM object has already been closed') from None def close(self): try: self._commit() finally: self._index = self._datfile = self._dirfile = self._bakfile = None __del__ = close def _chmod(self, file): if hasattr(self._os, 'chmod'): self._os.chmod(file, self._mode) def __enter__(self): return self def __exit__(self, *args): self.close() def open(file, flag='c', mode=0o666): """Open the database file, filename, and return corresponding object. The flag argument, used to control how the database is opened in the other DBM implementations, supports only the semantics of 'c' and 'n' values. Other values will default to the semantics of 'c' value: the database will always opened for update and will be created if it does not exist. The optional mode argument is the UNIX mode of the file, used only when the database has to be created. It defaults to octal code 0o666 (and will be modified by the prevailing umask). """ # Modify mode depending on the umask try: um = _os.umask(0) _os.umask(um) except AttributeError: pass else: # Turn off any bits that are set in the umask mode = mode & (~um) if flag not in ('r', 'w', 'c', 'n'): import warnings warnings.warn("Flag must be one of 'r', 'w', 'c', or 'n'", DeprecationWarning, stacklevel=2) return _Database(file, mode, flag=flag)
11,989
325
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/dbm/__init__.py
"""Generic interface to all dbm clones. Use import dbm d = dbm.open(file, 'w', 0o666) The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the type of database being opened (determined by the whichdb function) in the case of an existing dbm. If the dbm does not exist and the create or new flag ('c' or 'n') was specified, the dbm type will be determined by the availability of the modules (tested in the above order). It has the following interface (key and data are strings): d[key] = data # store data at key (may override data at # existing key) data = d[key] # retrieve data at key (raise KeyError if no # such key) del d[key] # delete data stored at key (raises KeyError # if no such key) flag = key in d # true if the key exists list = d.keys() # return a list of all existing keys (slow!) Future versions may change the order in which implementations are tested for existence, and add interfaces to other dbm-like implementations. """ __all__ = ['open', 'whichdb', 'error'] import io import os import struct import sys class error(Exception): pass _names = ['dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] _defaultmod = None _modules = {} error = (error, OSError) try: from dbm import ndbm except ImportError: ndbm = None def open(file, flag='r', mode=0o666): """Open or create database at path given by *file*. Optional argument *flag* can be 'r' (default) for read-only access, 'w' for read-write access of an existing database, 'c' for read-write access to a new or existing database, and 'n' for read-write access to a new database. Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it only if it doesn't exist; and 'n' always creates a new database. """ global _defaultmod if _defaultmod is None: for name in _names: try: mod = __import__(name, fromlist=['open']) except ImportError: continue if not _defaultmod: _defaultmod = mod _modules[name] = mod if not _defaultmod: raise ImportError("no dbm clone found; tried %s" % _names) # guess the type of an existing database, if not creating a new one result = whichdb(file) if 'n' not in flag else None if result is None: # db doesn't exist or 'n' flag was specified to create a new db if 'c' in flag or 'n' in flag: # file doesn't exist and the new flag was used so use default type mod = _defaultmod else: raise error[0]("need 'c' or 'n' flag to open new db") elif result == "": # db type cannot be determined raise error[0]("db type could not be determined") elif result not in _modules: raise error[0]("db type is {0}, but the module is not " "available".format(result)) else: mod = _modules[result] return mod.open(file, flag, mode) def whichdb(filename): """Guess which db package to use to open a db file. Return values: - None if the database file can't be read; - empty string if the file can be read but can't be recognized - the name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized. Importing the given module may still fail, and opening the database using that module may still fail. """ # Check for ndbm first -- this has a .pag and a .dir file try: f = io.open(filename + ".pag", "rb") f.close() f = io.open(filename + ".dir", "rb") f.close() return "dbm.ndbm" except OSError: # some dbm emulations based on Berkeley DB generate a .db file # some do not, but they should be caught by the bsd checks try: f = io.open(filename + ".db", "rb") f.close() # guarantee we can actually open the file using dbm # kind of overkill, but since we are dealing with emulations # it seems like a prudent step if ndbm is not None: d = ndbm.open(filename) d.close() return "dbm.ndbm" except OSError: pass # Check for dumbdbm next -- this has a .dir and a .dat file try: # First check for presence of files os.stat(filename + ".dat") size = os.stat(filename + ".dir").st_size # dumbdbm files with no keys are empty if size == 0: return "dbm.dumb" f = io.open(filename + ".dir", "rb") try: if f.read(1) in (b"'", b'"'): return "dbm.dumb" finally: f.close() except OSError: pass # See if the file exists, return None if not try: f = io.open(filename, "rb") except OSError: return None with f: # Read the start of the file -- the magic number s16 = f.read(16) s = s16[0:4] # Return "" if not at least 4 bytes if len(s) != 4: return "" # Convert to 4-byte int in native byte order -- return "" if impossible try: (magic,) = struct.unpack("=l", s) except struct.error: return "" # Check for GNU dbm if magic in (0x13579ace, 0x13579acd, 0x13579acf): return "dbm.gnu" # Later versions of Berkeley db hash file have a 12-byte pad in # front of the file type try: (magic,) = struct.unpack("=l", s16[-4:]) except struct.error: return "" # Unknown return "" if __name__ == "__main__": for filename in sys.argv[1:]: print(whichdb(filename) or "UNKNOWN", filename)
5,783
189
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/parse.py
"""Parse (absolute and relative) URLs. urlparse module is based upon the following RFC specifications. RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding and L. Masinter, January 2005. RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter and L.Masinter, December 1999. RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T. Berners-Lee, R. Fielding, and L. Masinter, August 1998. RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998. RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June 1995. RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M. McCahill, December 1994 RFC 3986 is considered the current standard and any future changes to urlparse module should conform with it. The urlparse module is currently not entirely compliant with this RFC due to defacto scenarios for parsing, and for backward compatibility purposes, some parsing quirks from older RFCs are retained. The testcases in test_urlparse.py provides a good indicator of parsing behavior. """ import re import sys import collections __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", "urlsplit", "urlunsplit", "urlencode", "parse_qs", "parse_qsl", "quote", "quote_plus", "quote_from_bytes", "unquote", "unquote_plus", "unquote_to_bytes", "DefragResult", "ParseResult", "SplitResult", "DefragResultBytes", "ParseResultBytes", "SplitResultBytes"] # A classification of schemes. # The empty string classifies URLs with no scheme specified, # being the default value returned by “urlsplit” and “urlparse”. uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', 'prospero', 'rtsp', 'rtspu', 'sftp', 'svn', 'svn+ssh', 'ws', 'wss'] uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh', 'ws', 'wss'] uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', 'mms', 'sftp', 'tel'] # These are not actually used anymore, but should stay for backwards # compatibility. (They are undocumented, but have a public-looking name.) non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms', 'gopher', 'rtsp', 'rtspu', 'sip', 'sips'] uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', 'file', 'prospero'] # Characters valid in scheme names scheme_chars = ('abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' '0123456789' '+-.') # Unsafe bytes to be removed per WHATWG spec _UNSAFE_URL_BYTES_TO_REMOVE = ['\t', '\r', '\n'] # XXX: Consider replacing with functools.lru_cache MAX_CACHE_SIZE = 20 _parse_cache = {} def clear_cache(): """Clear the parse cache and the quoters cache.""" _parse_cache.clear() _safe_quoters.clear() # Helpers for bytes handling # For 3.2, we deliberately require applications that # handle improperly quoted URLs to do their own # decoding and encoding. If valid use cases are # presented, we may relax this by using latin-1 # decoding internally for 3.3 _implicit_encoding = 'ascii' _implicit_errors = 'strict' def _noop(obj): return obj def _encode_result(obj, encoding=_implicit_encoding, errors=_implicit_errors): return obj.encode(encoding, errors) def _decode_args(args, encoding=_implicit_encoding, errors=_implicit_errors): return tuple(x.decode(encoding, errors) if x else '' for x in args) def _coerce_args(*args): # Invokes decode if necessary to create str args # and returns the coerced inputs along with # an appropriate result coercion function # - noop for str inputs # - encoding function otherwise str_input = isinstance(args[0], str) for arg in args[1:]: # We special-case the empty string to support the # "scheme=''" default argument to some functions if arg and isinstance(arg, str) != str_input: raise TypeError("Cannot mix str and non-str arguments") if str_input: return args + (_noop,) return _decode_args(args) + (_encode_result,) # Result objects are more helpful than simple tuples class _ResultMixinStr(object): """Standard approach to encoding parsed results from str to bytes""" __slots__ = () def encode(self, encoding='ascii', errors='strict'): return self._encoded_counterpart(*(x.encode(encoding, errors) for x in self)) class _ResultMixinBytes(object): """Standard approach to decoding parsed results from bytes to str""" __slots__ = () def decode(self, encoding='ascii', errors='strict'): return self._decoded_counterpart(*(x.decode(encoding, errors) for x in self)) class _NetlocResultMixinBase(object): """Shared methods for the parsed result objects containing a netloc element""" __slots__ = () @property def username(self): return self._userinfo[0] @property def password(self): return self._userinfo[1] @property def hostname(self): hostname = self._hostinfo[0] if not hostname: return None # Scoped IPv6 address may have zone info, which must not be lowercased # like http://[fe80::822a:a8ff:fe49:470c%tESt]:1234/keys separator = '%' if isinstance(hostname, str) else b'%' hostname, percent, zone = hostname.partition(separator) return hostname.lower() + percent + zone @property def port(self): port = self._hostinfo[1] if port is not None: port = int(port, 10) if not ( 0 <= port <= 65535): raise ValueError("Port out of range 0-65535") return port class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr): __slots__ = () @property def _userinfo(self): netloc = self.netloc userinfo, have_info, hostinfo = netloc.rpartition('@') if have_info: username, have_password, password = userinfo.partition(':') if not have_password: password = None else: username = password = None return username, password @property def _hostinfo(self): netloc = self.netloc _, _, hostinfo = netloc.rpartition('@') _, have_open_br, bracketed = hostinfo.partition('[') if have_open_br: hostname, _, port = bracketed.partition(']') _, _, port = port.partition(':') else: hostname, _, port = hostinfo.partition(':') if not port: port = None return hostname, port class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes): __slots__ = () @property def _userinfo(self): netloc = self.netloc userinfo, have_info, hostinfo = netloc.rpartition(b'@') if have_info: username, have_password, password = userinfo.partition(b':') if not have_password: password = None else: username = password = None return username, password @property def _hostinfo(self): netloc = self.netloc _, _, hostinfo = netloc.rpartition(b'@') _, have_open_br, bracketed = hostinfo.partition(b'[') if have_open_br: hostname, _, port = bracketed.partition(b']') _, _, port = port.partition(b':') else: hostname, _, port = hostinfo.partition(b':') if not port: port = None return hostname, port from collections import namedtuple _DefragResultBase = namedtuple('DefragResult', 'url fragment') _SplitResultBase = namedtuple( 'SplitResult', 'scheme netloc path query fragment') _ParseResultBase = namedtuple( 'ParseResult', 'scheme netloc path params query fragment') _DefragResultBase.__doc__ = """ DefragResult(url, fragment) A 2-tuple that contains the url without fragment identifier and the fragment identifier as a separate argument. """ _DefragResultBase.url.__doc__ = """The URL with no fragment identifier.""" _DefragResultBase.fragment.__doc__ = """ Fragment identifier separated from URL, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. """ _SplitResultBase.__doc__ = """ SplitResult(scheme, netloc, path, query, fragment) A 5-tuple that contains the different components of a URL. Similar to ParseResult, but does not split params. """ _SplitResultBase.scheme.__doc__ = """Specifies URL scheme for the request.""" _SplitResultBase.netloc.__doc__ = """ Network location where the request is made to. """ _SplitResultBase.path.__doc__ = """ The hierarchical path, such as the path to a file to download. """ _SplitResultBase.query.__doc__ = """ The query component, that contains non-hierarchical data, that along with data in path component, identifies a resource in the scope of URI's scheme and network location. """ _SplitResultBase.fragment.__doc__ = """ Fragment identifier, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. """ _ParseResultBase.__doc__ = """ ParseResult(scheme, netloc, path, params, query, fragment) A 6-tuple that contains components of a parsed URL. """ _ParseResultBase.scheme.__doc__ = _SplitResultBase.scheme.__doc__ _ParseResultBase.netloc.__doc__ = _SplitResultBase.netloc.__doc__ _ParseResultBase.path.__doc__ = _SplitResultBase.path.__doc__ _ParseResultBase.params.__doc__ = """ Parameters for last path element used to dereference the URI in order to provide access to perform some operation on the resource. """ _ParseResultBase.query.__doc__ = _SplitResultBase.query.__doc__ _ParseResultBase.fragment.__doc__ = _SplitResultBase.fragment.__doc__ # For backwards compatibility, alias _NetlocResultMixinStr # ResultBase is no longer part of the documented API, but it is # retained since deprecating it isn't worth the hassle ResultBase = _NetlocResultMixinStr # Structured result objects for string data class DefragResult(_DefragResultBase, _ResultMixinStr): __slots__ = () def geturl(self): if self.fragment: return self.url + '#' + self.fragment else: return self.url class SplitResult(_SplitResultBase, _NetlocResultMixinStr): __slots__ = () def geturl(self): return urlunsplit(self) class ParseResult(_ParseResultBase, _NetlocResultMixinStr): __slots__ = () def geturl(self): return urlunparse(self) # Structured result objects for bytes data class DefragResultBytes(_DefragResultBase, _ResultMixinBytes): __slots__ = () def geturl(self): if self.fragment: return self.url + b'#' + self.fragment else: return self.url class SplitResultBytes(_SplitResultBase, _NetlocResultMixinBytes): __slots__ = () def geturl(self): return urlunsplit(self) class ParseResultBytes(_ParseResultBase, _NetlocResultMixinBytes): __slots__ = () def geturl(self): return urlunparse(self) # Set up the encode/decode result pairs def _fix_result_transcoding(): _result_pairs = ( (DefragResult, DefragResultBytes), (SplitResult, SplitResultBytes), (ParseResult, ParseResultBytes), ) for _decoded, _encoded in _result_pairs: _decoded._encoded_counterpart = _encoded _encoded._decoded_counterpart = _decoded _fix_result_transcoding() del _fix_result_transcoding def urlparse(url, scheme='', allow_fragments=True): """Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.""" url, scheme, _coerce_result = _coerce_args(url, scheme) splitresult = urlsplit(url, scheme, allow_fragments) scheme, netloc, url, query, fragment = splitresult if scheme in uses_params and ';' in url: url, params = _splitparams(url) else: params = '' result = ParseResult(scheme, netloc, url, params, query, fragment) return _coerce_result(result) def _splitparams(url): if '/' in url: i = url.find(';', url.rfind('/')) if i < 0: return url, '' else: i = url.find(';') return url[:i], url[i+1:] def _splitnetloc(url, start=0): delim = len(url) # position of end of domain part of url, default is end for c in '/?#': # look for delimiters; the order is NOT important wdelim = url.find(c, start) # find first of this delim if wdelim >= 0: # if found delim = min(delim, wdelim) # use earliest delim position return url[start:delim], url[delim:] # return (domain, rest) def _checknetloc(netloc): if not netloc or not any(ord(c) > 127 for c in netloc): return # looking for characters like \u2100 that expand to 'a/c' # IDNA uses NFKC equivalence, so normalize for this check import unicodedata n = netloc.replace('@', '') # ignore characters already included n = n.replace(':', '') # but not the surrounding text n = n.replace('#', '') n = n.replace('?', '') netloc2 = unicodedata.normalize('NFKC', n) if n == netloc2: return for c in '/?#@:': if c in netloc2: raise ValueError("netloc '" + netloc + "' contains invalid " + "characters under NFKC normalization") def _remove_unsafe_bytes_from_url(url): for b in _UNSAFE_URL_BYTES_TO_REMOVE: url = url.replace(b, "") return url def urlsplit(url, scheme='', allow_fragments=True): """Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.""" url, scheme, _coerce_result = _coerce_args(url, scheme) url = _remove_unsafe_bytes_from_url(url) scheme = _remove_unsafe_bytes_from_url(scheme) allow_fragments = bool(allow_fragments) key = url, scheme, allow_fragments, type(url), type(scheme) cached = _parse_cache.get(key, None) if cached: return _coerce_result(cached) if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() netloc = query = fragment = '' i = url.find(':') if i > 0: if url[:i] == 'http': # optimize the common case scheme = url[:i].lower() url = url[i+1:] if url[:2] == '//': netloc, url = _splitnetloc(url, 2) if (('[' in netloc and ']' not in netloc) or (']' in netloc and '[' not in netloc)): raise ValueError("Invalid IPv6 URL") if allow_fragments and '#' in url: url, fragment = url.split('#', 1) if '?' in url: url, query = url.split('?', 1) _checknetloc(netloc) v = SplitResult(scheme, netloc, url, query, fragment) _parse_cache[key] = v return _coerce_result(v) for c in url[:i]: if c not in scheme_chars: break else: # make sure "url" is not actually a port number (in which case # "scheme" is really part of the path) rest = url[i+1:] if not rest or any(c not in '0123456789' for c in rest): # not a port number scheme, url = url[:i].lower(), rest if url[:2] == '//': netloc, url = _splitnetloc(url, 2) if (('[' in netloc and ']' not in netloc) or (']' in netloc and '[' not in netloc)): raise ValueError("Invalid IPv6 URL") if allow_fragments and '#' in url: url, fragment = url.split('#', 1) if '?' in url: url, query = url.split('?', 1) _checknetloc(netloc) v = SplitResult(scheme, netloc, url, query, fragment) _parse_cache[key] = v return _coerce_result(v) def urlunparse(components): """Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).""" scheme, netloc, url, params, query, fragment, _coerce_result = ( _coerce_args(*components)) if params: url = "%s;%s" % (url, params) return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment))) def urlunsplit(components): """Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example, a ? with an empty query; the RFC states that these are equivalent).""" scheme, netloc, url, query, fragment, _coerce_result = ( _coerce_args(*components)) if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url if scheme: url = scheme + ':' + url if query: url = url + '?' + query if fragment: url = url + '#' + fragment return _coerce_result(url) def urljoin(base, url, allow_fragments=True): """Join a base URL and a possibly relative URL to form an absolute interpretation of the latter.""" if not base: return url if not url: return base base, url, _coerce_result = _coerce_args(base, url) bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ urlparse(base, '', allow_fragments) scheme, netloc, path, params, query, fragment = \ urlparse(url, bscheme, allow_fragments) if scheme != bscheme or scheme not in uses_relative: return _coerce_result(url) if scheme in uses_netloc: if netloc: return _coerce_result(urlunparse((scheme, netloc, path, params, query, fragment))) netloc = bnetloc if not path and not params: path = bpath params = bparams if not query: query = bquery return _coerce_result(urlunparse((scheme, netloc, path, params, query, fragment))) base_parts = bpath.split('/') if base_parts[-1] != '': # the last item is not a directory, so will not be taken into account # in resolving the relative path del base_parts[-1] # for rfc3986, ignore all base path should the first character be root. if path[:1] == '/': segments = path.split('/') else: segments = base_parts + path.split('/') # filter out elements that would cause redundant slashes on re-joining # the resolved_path segments[1:-1] = filter(None, segments[1:-1]) resolved_path = [] for seg in segments: if seg == '..': try: resolved_path.pop() except IndexError: # ignore any .. segments that would otherwise cause an IndexError # when popped from resolved_path if resolving for rfc3986 pass elif seg == '.': continue else: resolved_path.append(seg) if segments[-1] in ('.', '..'): # do some post-processing here. if the last segment was a relative dir, # then we need to append the trailing '/' resolved_path.append('') return _coerce_result(urlunparse((scheme, netloc, '/'.join( resolved_path) or '/', params, query, fragment))) def urldefrag(url): """Removes any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string. """ url, _coerce_result = _coerce_args(url) if '#' in url: s, n, p, a, q, frag = urlparse(url) defrag = urlunparse((s, n, p, a, q, '')) else: frag = '' defrag = url return _coerce_result(DefragResult(defrag, frag)) _hexdig = '0123456789ABCDEFabcdef' _hextobyte = None def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains # unescaped non-ASCII characters, which URIs should not. if not string: # Is it a string-like object? string.split return b'' if isinstance(string, str): string = string.encode('utf-8') bits = string.split(b'%') if len(bits) == 1: return string res = [bits[0]] append = res.append # Delay the initialization of the table to not waste memory # if the function is never called global _hextobyte if _hextobyte is None: _hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) for a in _hexdig for b in _hexdig} for item in bits[1:]: try: append(_hextobyte[item[:2]]) append(item[2:]) except KeyError: append(b'%') append(item) return b''.join(res) _asciire = re.compile('([\x00-\x7f]+)') def unquote(string, encoding='utf-8', errors='replace'): """Replace %xx escapes by their single-character equivalent. The optional encoding and errors parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. By default, percent-encoded sequences are decoded with UTF-8, and invalid sequences are replaced by a placeholder character. unquote('abc%20def') -> 'abc def'. """ if '%' not in string: string.split return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'replace' bits = _asciire.split(string) res = [bits[0]] append = res.append for i in range(1, len(bits), 2): append(unquote_to_bytes(bits[i]).decode(encoding, errors)) append(bits[i + 1]) return ''.join(res) def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): """Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a dictionary. """ parsed_result = {} pairs = parse_qsl(qs, keep_blank_values, strict_parsing, encoding=encoding, errors=errors, max_num_fields=max_num_fields, separator=separator) for name, value in pairs: if name in parsed_result: parsed_result[name].append(value) else: parsed_result[name] = [value] return parsed_result def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): """Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a list, as G-d intended. """ qs, _coerce_result = _coerce_args(qs) if not separator or (not isinstance(separator, (str, bytes))): raise ValueError("Separator must be of type string or bytes.") # If max_num_fields is defined then check that the number of fields # is less than max_num_fields. This prevents a memory exhaustion DOS # attack via post bodies with many fields. if max_num_fields is not None: num_fields = 1 + qs.count(separator) if max_num_fields < num_fields: raise ValueError('Max number of fields exceeded') pairs = [s1 for s1 in qs.split(separator)] r = [] for name_value in pairs: if not name_value and not strict_parsing: continue nv = name_value.split('=', 1) if len(nv) != 2: if strict_parsing: raise ValueError("bad query field: %r" % (name_value,)) # Handle case of a control-name with no equal sign if keep_blank_values: nv.append('') else: continue if len(nv[1]) or keep_blank_values: name = nv[0].replace('+', ' ') name = unquote(name, encoding=encoding, errors=errors) name = _coerce_result(name) value = nv[1].replace('+', ' ') value = unquote(value, encoding=encoding, errors=errors) value = _coerce_result(value) r.append((name, value)) return r def unquote_plus(string, encoding='utf-8', errors='replace'): """Like unquote(), but also replace plus signs by spaces, as required for unquoting HTML form values. unquote_plus('%7e/abc+def') -> '~/abc def' """ string = string.replace('+', ' ') return unquote(string, encoding, errors) _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' b'abcdefghijklmnopqrstuvwxyz' b'0123456789' b'_.-') _ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE) _safe_quoters = {} class Quoter(collections.defaultdict): """A mapping from bytes (in range(0,256)) to strings. String values are percent-encoded byte values, unless the key < 128, and in the "safe" set (either the specified safe set, or default set). """ # Keeps a cache internally, using defaultdict, for efficiency (lookups # of cached keys don't call Python code at all). def __init__(self, safe): """safe: bytes object.""" self.safe = _ALWAYS_SAFE.union(safe) def __repr__(self): # Without this, will just display as a defaultdict return "<%s %r>" % (self.__class__.__name__, dict(self)) def __missing__(self, b): # Handle a cache miss. Store quoted string in cache and return. res = chr(b) if b in self.safe else '%{:02X}'.format(b) self[b] = res return res def quote(string, safe='/', encoding=None, errors=None): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," Each of these characters is reserved in some component of a URL, but not necessarily in all of them. By default, the quote function is intended for quoting the path section of a URL. Thus, it will not encode '/'. This character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are used as reserved characters. string and safe may be either str or bytes objects. encoding and errors must not be specified if string is a bytes object. The optional encoding and errors parameters specify how to deal with non-ASCII characters, as accepted by the str.encode method. By default, encoding='utf-8' (characters are encoded with UTF-8), and errors='strict' (unsupported characters raise a UnicodeEncodeError). """ if isinstance(string, str): if not string: return string if encoding is None: encoding = 'utf-8' if errors is None: errors = 'strict' string = string.encode(encoding, errors) else: if encoding is not None: raise TypeError("quote() doesn't support 'encoding' for bytes") if errors is not None: raise TypeError("quote() doesn't support 'errors' for bytes") return quote_from_bytes(string, safe) def quote_plus(string, safe='', encoding=None, errors=None): """Like quote(), but also replace ' ' with '+', as required for quoting HTML form values. Plus signs in the original string are escaped unless they are included in safe. It also does not have safe default to '/'. """ # Check if ' ' in string, where string may either be a str or bytes. If # there are no spaces, the regular quote will produce the right answer. if ((isinstance(string, str) and ' ' not in string) or (isinstance(string, bytes) and b' ' not in string)): return quote(string, safe, encoding, errors) if isinstance(safe, str): space = ' ' else: space = b' ' string = quote(string, safe + space, encoding, errors) return string.replace(' ', '+') def quote_from_bytes(bs, safe='/'): """Like quote(), but accepts a bytes object rather than a str, and does not perform string-to-bytes encoding. It always returns an ASCII string. quote_from_bytes(b'abc def\x3f') -> 'abc%20def%3f' """ if not isinstance(bs, (bytes, bytearray)): raise TypeError("quote_from_bytes() expected bytes") if not bs: return '' if isinstance(safe, str): # Normalize 'safe' by converting to bytes and removing non-ASCII chars safe = safe.encode('ascii', 'ignore') else: safe = bytes([c for c in safe if c < 128]) if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe): return bs.decode() try: quoter = _safe_quoters[safe] except KeyError: _safe_quoters[safe] = quoter = Quoter(safe).__getitem__ return ''.join([quoter(char) for char in bs]) def urlencode(query, doseq=False, safe='', encoding=None, errors=None, quote_via=quote_plus): """Encode a dict or sequence of two-element tuples into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order of the parameters in the output will match the order of parameters in the input. The components of a query arg may each be either a string or a bytes type. The safe, encoding, and errors parameters are passed down to the function specified by quote_via (encoding and errors only if a component is a str). """ if hasattr(query, "items"): query = query.items() else: # It's a bother at times that strings and string-like objects are # sequences. try: # non-sequence items should not work with len() # non-empty strings will fail this if len(query) and not isinstance(query[0], tuple): raise TypeError # Zero-length sequences of all types will get here and succeed, # but that's a minor nit. Since the original implementation # allowed empty dicts that type of behavior probably should be # preserved for consistency except TypeError: ty, va, tb = sys.exc_info() raise TypeError("not a valid non-string sequence " "or mapping object").with_traceback(tb) l = [] if not doseq: for k, v in query: if isinstance(k, bytes): k = quote_via(k, safe) else: k = quote_via(str(k), safe, encoding, errors) if isinstance(v, bytes): v = quote_via(v, safe) else: v = quote_via(str(v), safe, encoding, errors) l.append(k + '=' + v) else: for k, v in query: if isinstance(k, bytes): k = quote_via(k, safe) else: k = quote_via(str(k), safe, encoding, errors) if isinstance(v, bytes): v = quote_via(v, safe) l.append(k + '=' + v) elif isinstance(v, str): v = quote_via(v, safe, encoding, errors) l.append(k + '=' + v) else: try: # Is this a sufficient test for sequence-ness? x = len(v) except TypeError: # not a sequence v = quote_via(str(v), safe, encoding, errors) l.append(k + '=' + v) else: # loop over the sequence for elt in v: if isinstance(elt, bytes): elt = quote_via(elt, safe) else: elt = quote_via(str(elt), safe, encoding, errors) l.append(k + '=' + elt) return '&'.join(l) def to_bytes(url): """to_bytes(u"URL") --> 'URL'.""" # Most URL schemes require ASCII. If that changes, the conversion # can be relaxed. # XXX get rid of to_bytes() if isinstance(url, str): try: url = url.encode("ASCII").decode() except UnicodeError: raise UnicodeError("URL " + repr(url) + " contains non-ASCII characters") return url def unwrap(url): """unwrap('<URL:type://host/path>') --> 'type://host/path'.""" url = str(url).strip() if url[:1] == '<' and url[-1:] == '>': url = url[1:-1].strip() if url[:4] == 'URL:': url = url[4:].strip() return url _typeprog = None def splittype(url): """splittype('type:opaquestring') --> 'type', 'opaquestring'.""" global _typeprog if _typeprog is None: _typeprog = re.compile('([^/:]+):(.*)', re.DOTALL) match = _typeprog.match(url) if match: scheme, data = match.groups() return scheme.lower(), data return None, url _hostprog = None def splithost(url): """splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" global _hostprog if _hostprog is None: _hostprog = re.compile('//([^/#?]*)(.*)', re.DOTALL) match = _hostprog.match(url) if match: host_port, path = match.groups() if path and path[0] != '/': path = '/' + path return host_port, path return None, url def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" user, delim, host = host.rpartition('@') return (user if delim else None), host def splitpasswd(user): """splitpasswd('user:passwd') -> 'user', 'passwd'.""" user, delim, passwd = user.partition(':') return user, (passwd if delim else None) # splittag('/path#tag') --> '/path', 'tag' _portprog = None def splitport(host): """splitport('host:port') --> 'host', 'port'.""" global _portprog if _portprog is None: _portprog = re.compile('(.*):([0-9]*)$', re.DOTALL) match = _portprog.match(host) if match: host, port = match.groups() if port: return host, port return host, None def splitnport(host, defport=-1): """Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.""" host, delim, port = host.rpartition(':') if not delim: host = port elif port: try: nport = int(port) except ValueError: nport = None return host, nport return host, defport def splitquery(url): """splitquery('/path?query') --> '/path', 'query'.""" path, delim, query = url.rpartition('?') if delim: return path, query return url, None def splittag(url): """splittag('/path#tag') --> '/path', 'tag'.""" path, delim, tag = url.rpartition('#') if delim: return path, tag return url, None def splitattr(url): """splitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].""" words = url.split(';') return words[0], words[1:] def splitvalue(attr): """splitvalue('attr=value') --> 'attr', 'value'.""" attr, delim, value = attr.partition('=') return attr, (value if delim else None)
39,023
1,079
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/response.py
"""Response classes used by urllib. The base class, addbase, defines a minimal file-like interface, including read() and readline(). The typical response object is an addinfourl instance, which defines an info() method that returns headers and a geturl() method that returns the url. """ import tempfile __all__ = ['addbase', 'addclosehook', 'addinfo', 'addinfourl'] class addbase(tempfile._TemporaryFileWrapper): """Base class for addinfo and addclosehook. Is a good idea for garbage collection.""" # XXX Add a method to expose the timeout on the underlying socket? def __init__(self, fp): super(addbase, self).__init__(fp, '<urllib response>', delete=False) # Keep reference around as this was part of the original API. self.fp = fp def __repr__(self): return '<%s at %r whose fp = %r>' % (self.__class__.__name__, id(self), self.file) def __enter__(self): if self.fp.closed: raise ValueError("I/O operation on closed file") return self def __exit__(self, type, value, traceback): self.close() class addclosehook(addbase): """Class to add a close hook to an open file.""" def __init__(self, fp, closehook, *hookargs): super(addclosehook, self).__init__(fp) self.closehook = closehook self.hookargs = hookargs def close(self): try: closehook = self.closehook hookargs = self.hookargs if closehook: self.closehook = None self.hookargs = None closehook(*hookargs) finally: super(addclosehook, self).close() class addinfo(addbase): """class to add an info() method to an open file.""" def __init__(self, fp, headers): super(addinfo, self).__init__(fp) self.headers = headers def info(self): return self.headers class addinfourl(addinfo): """class to add info() and geturl() methods to an open file.""" def __init__(self, fp, headers, url, code=None): super(addinfourl, self).__init__(fp, headers) self.url = url self.code = code def getcode(self): return self.code def geturl(self): return self.url
2,299
81
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/robotparser.py
""" robotparser.py Copyright (C) 2000 Bastian Kleineidam You can choose between two licenses when using this package: 1) GNU GPLv2 2) PSF license for Python 2.2 The robots.txt Exclusion Protocol is implemented as specified in http://www.robotstxt.org/norobots-rfc.txt """ import collections import urllib.parse import urllib.request __all__ = ["RobotFileParser"] RequestRate = collections.namedtuple("RequestRate", "requests seconds") class RobotFileParser: """ This class provides a set of methods to read, parse and answer questions about a single robots.txt file. """ def __init__(self, url=''): self.entries = [] self.default_entry = None self.disallow_all = False self.allow_all = False self.set_url(url) self.last_checked = 0 def mtime(self): """Returns the time the robots.txt file was last fetched. This is useful for long-running web spiders that need to check for new robots.txt files periodically. """ return self.last_checked def modified(self): """Sets the time the robots.txt file was last fetched to the current time. """ import time self.last_checked = time.time() def set_url(self, url): """Sets the URL referring to a robots.txt file.""" self.url = url self.host, self.path = urllib.parse.urlparse(url)[1:3] def read(self): """Reads the robots.txt URL and feeds it to the parser.""" try: f = urllib.request.urlopen(self.url) except urllib.error.HTTPError as err: if err.code in (401, 403): self.disallow_all = True elif err.code >= 400 and err.code < 500: self.allow_all = True else: raw = f.read() self.parse(raw.decode("utf-8").splitlines()) def _add_entry(self, entry): if "*" in entry.useragents: # the default entry is considered last if self.default_entry is None: # the first default entry wins self.default_entry = entry else: self.entries.append(entry) def parse(self, lines): """Parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines. """ # states: # 0: start state # 1: saw user-agent line # 2: saw an allow or disallow line state = 0 entry = Entry() self.modified() for line in lines: if not line: if state == 1: entry = Entry() state = 0 elif state == 2: self._add_entry(entry) entry = Entry() state = 0 # remove optional comment and strip line i = line.find('#') if i >= 0: line = line[:i] line = line.strip() if not line: continue line = line.split(':', 1) if len(line) == 2: line[0] = line[0].strip().lower() line[1] = urllib.parse.unquote(line[1].strip()) if line[0] == "user-agent": if state == 2: self._add_entry(entry) entry = Entry() entry.useragents.append(line[1]) state = 1 elif line[0] == "disallow": if state != 0: entry.rulelines.append(RuleLine(line[1], False)) state = 2 elif line[0] == "allow": if state != 0: entry.rulelines.append(RuleLine(line[1], True)) state = 2 elif line[0] == "crawl-delay": if state != 0: # before trying to convert to int we need to make # sure that robots.txt has valid syntax otherwise # it will crash if line[1].strip().isdigit(): entry.delay = int(line[1]) state = 2 elif line[0] == "request-rate": if state != 0: numbers = line[1].split('/') # check if all values are sane if (len(numbers) == 2 and numbers[0].strip().isdigit() and numbers[1].strip().isdigit()): entry.req_rate = RequestRate(int(numbers[0]), int(numbers[1])) state = 2 if state == 2: self._add_entry(entry) def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" if self.disallow_all: return False if self.allow_all: return True # Until the robots.txt file has been read or found not # to exist, we must assume that no url is allowable. # This prevents false positives when a user erroneously # calls can_fetch() before calling read(). if not self.last_checked: return False # search for given user agent matches # the first match counts parsed_url = urllib.parse.urlparse(urllib.parse.unquote(url)) url = urllib.parse.urlunparse(('','',parsed_url.path, parsed_url.params,parsed_url.query, parsed_url.fragment)) url = urllib.parse.quote(url) if not url: url = "/" for entry in self.entries: if entry.applies_to(useragent): return entry.allowance(url) # try the default entry last if self.default_entry: return self.default_entry.allowance(url) # agent not found ==> access granted return True def crawl_delay(self, useragent): if not self.mtime(): return None for entry in self.entries: if entry.applies_to(useragent): return entry.delay return self.default_entry.delay def request_rate(self, useragent): if not self.mtime(): return None for entry in self.entries: if entry.applies_to(useragent): return entry.req_rate return self.default_entry.req_rate def __str__(self): entries = self.entries if self.default_entry is not None: entries = entries + [self.default_entry] return '\n'.join(map(str, entries)) + '\n' class RuleLine: """A rule line is a single "Allow:" (allowance==True) or "Disallow:" (allowance==False) followed by a path.""" def __init__(self, path, allowance): if path == '' and not allowance: # an empty value means allow all allowance = True path = urllib.parse.urlunparse(urllib.parse.urlparse(path)) self.path = urllib.parse.quote(path) self.allowance = allowance def applies_to(self, filename): return self.path == "*" or filename.startswith(self.path) def __str__(self): return ("Allow" if self.allowance else "Disallow") + ": " + self.path class Entry: """An entry has one or more user-agents and zero or more rulelines""" def __init__(self): self.useragents = [] self.rulelines = [] self.delay = None self.req_rate = None def __str__(self): ret = [] for agent in self.useragents: ret.append(f"User-agent: {agent}") if self.delay is not None: ret.append(f"Crawl-delay: {self.delay}") if self.req_rate is not None: rate = self.req_rate ret.append(f"Request-rate: {rate.requests}/{rate.seconds}") ret.extend(map(str, self.rulelines)) ret.append('') # for compatibility return '\n'.join(ret) def applies_to(self, useragent): """check if this entry applies to the specified agent""" # split the name token and make it lower case useragent = useragent.split("/")[0].lower() for agent in self.useragents: if agent == '*': # we have the catch-all agent return True agent = agent.lower() if agent in useragent: return True return False def allowance(self, filename): """Preconditions: - our agent applies to this entry - filename is URL decoded""" for line in self.rulelines: if line.applies_to(filename): return line.allowance return True
8,832
259
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/request.py
"""An extensible library for opening URLs using a variety of protocols The simplest way to use this module is to call the urlopen function, which accepts a string containing a URL or a Request object (described below). It opens the URL and returns the results as file-like object; the returned object has some extra methods described below. The OpenerDirector manages a collection of Handler objects that do all the actual work. Each Handler implements a particular protocol or option. The OpenerDirector is a composite object that invokes the Handlers needed to open the requested URL. For example, the HTTPHandler performs HTTP GET and POST requests and deals with non-error returns. The HTTPRedirectHandler automatically deals with HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler deals with digest authentication. urlopen(url, data=None) -- Basic usage is the same as original urllib. pass the url and optionally data to post to an HTTP URL, and get a file-like object back. One difference is that you can also pass a Request instance instead of URL. Raises a URLError (subclass of OSError); for HTTP errors, raises an HTTPError, which can also be treated as a valid response. build_opener -- Function that creates a new OpenerDirector instance. Will install the default handlers. Accepts one or more Handlers as arguments, either instances or Handler classes that it will instantiate. If one of the argument is a subclass of the default handler, the argument will be installed instead of the default. install_opener -- Installs a new opener as the default opener. objects of interest: OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages the Handler classes, while dealing with requests and responses. Request -- An object that encapsulates the state of a request. The state can be as simple as the URL. It can also include extra HTTP headers, e.g. a User-Agent. BaseHandler -- internals: BaseHandler and parent _call_chain conventions Example usage: import urllib.request # set up authentication info authinfo = urllib.request.HTTPBasicAuthHandler() authinfo.add_password(realm='PDQ Application', uri='https://mahler:8092/site-updates.py', user='klem', passwd='geheim$parole') proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"}) # build a new opener that adds authentication and caching FTP handlers opener = urllib.request.build_opener(proxy_support, authinfo, urllib.request.CacheFTPHandler) # install it urllib.request.install_opener(opener) f = urllib.request.urlopen('http://www.python.org/') """ # XXX issues: # If an authentication error handler that tries to perform # authentication for some reason but fails, how should the error be # signalled? The client needs to know the HTTP error code. But if # the handler knows that the problem was, e.g., that it didn't know # that hash algo that requested in the challenge, it would be good to # pass that information along to the client, too. # ftp errors aren't handled cleanly # check digest against correct (i.e. non-apache) implementation # Possible extensions: # complex proxies XXX not sure what exactly was meant by this # abstract factory for opener import base64 import bisect import email import hashlib import http.client import io import os import posixpath import re import socket import string import sys import time import collections import tempfile import contextlib import warnings from urllib.error import URLError, HTTPError, ContentTooShortError from urllib.parse import ( urlparse, urlsplit, urljoin, unwrap, quote, unquote, splittype, splithost, splitport, splituser, splitpasswd, splitattr, splitquery, splitvalue, splittag, to_bytes, unquote_to_bytes, urlunparse) from urllib.response import addinfourl, addclosehook # check for SSL try: import ssl except ImportError: _have_ssl = False else: _have_ssl = True __all__ = [ # Classes 'Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErrorHandler', 'HTTPRedirectHandler', 'HTTPCookieProcessor', 'ProxyHandler', 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm', 'HTTPPasswordMgrWithPriorAuth', 'AbstractBasicAuthHandler', 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', 'AbstractDigestAuthHandler', 'HTTPDigestAuthHandler', 'ProxyDigestAuthHandler', 'HTTPHandler', 'FileHandler', 'FTPHandler', 'CacheFTPHandler', 'DataHandler', 'UnknownHandler', 'HTTPErrorProcessor', # Functions 'urlopen', 'install_opener', 'build_opener', 'pathname2url', 'url2pathname', 'getproxies', # Legacy interface 'urlretrieve', 'urlcleanup', 'URLopener', 'FancyURLopener', # wut 'HTTPError', ] # used in User-Agent header sent __version__ = '%d.%d' % sys.version_info[:2] _opener = None def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *, cafile=None, capath=None, cadefault=False, context=None): '''Open the URL url, which can be either a string or a Request object. *data* must be an object specifying additional data to be sent to the server, or None if no such data is needed. See Request for details. urllib.request module uses HTTP/1.1 and includes a "Connection:close" header in its HTTP requests. The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). This only works for HTTP, HTTPS and FTP connections. If *context* is specified, it must be a ssl.SSLContext instance describing the various SSL options. See HTTPSConnection for more details. The optional *cafile* and *capath* parameters specify a set of trusted CA certificates for HTTPS requests. cafile should point to a single file containing a bundle of CA certificates, whereas capath should point to a directory of hashed certificate files. More information can be found in ssl.SSLContext.load_verify_locations(). The *cadefault* parameter is ignored. This function always returns an object which can work as a context manager and has methods such as * geturl() - return the URL of the resource retrieved, commonly used to determine if a redirect was followed * info() - return the meta-information of the page, such as headers, in the form of an email.message_from_string() instance (see Quick Reference to HTTP Headers) * getcode() - return the HTTP status code of the response. Raises URLError on errors. For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse object slightly modified. In addition to the three new methods above, the msg attribute contains the same information as the reason attribute --- the reason phrase returned by the server --- instead of the response headers as it is specified in the documentation for HTTPResponse. For FTP, file, and data URLs and requests explicitly handled by legacy URLopener and FancyURLopener classes, this function returns a urllib.response.addinfourl object. Note that None may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens). In addition, if proxy settings are detected (for example, when a *_proxy environment variable like http_proxy is set), ProxyHandler is default installed and makes sure the requests are handled through the proxy. ''' global _opener if cafile or capath or cadefault: import warnings warnings.warn("cafile, capath and cadefault are deprecated, use a " "custom context instead.", DeprecationWarning, 2) if context is not None: raise ValueError( "You can't pass both context and any of cafile, capath, and " "cadefault" ) if not _have_ssl: raise ValueError('SSL support not available') context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=cafile, capath=capath) https_handler = HTTPSHandler(context=context) opener = build_opener(https_handler) elif context: https_handler = HTTPSHandler(context=context) opener = build_opener(https_handler) elif _opener is None: _opener = opener = build_opener() else: opener = _opener return opener.open(url, data, timeout) def install_opener(opener): global _opener _opener = opener _url_tempfiles = [] def urlretrieve(url, filename=None, reporthook=None, data=None): """ Retrieve a URL into a temporary location on disk. Requires a URL argument. If a filename is passed, it is used as the temporary file location. The reporthook argument should be a callable that accepts a block number, a read size, and the total file size of the URL target. The data argument should be valid URL encoded data. If a filename is passed and the URL points to a local resource, the result is a copy from local file to new file. Returns a tuple containing the path to the newly created data file as well as the resulting HTTPMessage object. """ url_type, path = splittype(url) with contextlib.closing(urlopen(url, data)) as fp: headers = fp.info() # Just return the local path and the "headers" for file:// # URLs. No sense in performing a copy unless requested. if url_type == "file" and not filename: return os.path.normpath(path), headers # Handle temporary file setup. if filename: tfp = open(filename, 'wb') else: tfp = tempfile.NamedTemporaryFile(delete=False) filename = tfp.name _url_tempfiles.append(filename) with tfp: result = filename, headers bs = 1024*8 size = -1 read = 0 blocknum = 0 if "content-length" in headers: size = int(headers["Content-Length"]) if reporthook: reporthook(blocknum, bs, size) while True: block = fp.read(bs) if not block: break read += len(block) tfp.write(block) blocknum += 1 if reporthook: reporthook(blocknum, bs, size) if size >= 0 and read < size: raise ContentTooShortError( "retrieval incomplete: got only %i out of %i bytes" % (read, size), result) return result def urlcleanup(): """Clean up temporary files from urlretrieve calls.""" for temp_file in _url_tempfiles: try: os.unlink(temp_file) except OSError: pass del _url_tempfiles[:] global _opener if _opener: _opener = None # copied from cookielib.py _cut_port_re = re.compile(r":\d+$", re.ASCII) def request_host(request): """Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. """ url = request.full_url host = urlparse(url)[1] if host == "": host = request.get_header("Host", "") # remove port, if present host = _cut_port_re.sub("", host, 1) return host.lower() class Request: def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None): self.full_url = url self.headers = {} self.unredirected_hdrs = {} self._data = None self.data = data self._tunnel_host = None for key, value in headers.items(): self.add_header(key, value) if origin_req_host is None: origin_req_host = request_host(self) self.origin_req_host = origin_req_host self.unverifiable = unverifiable if method: self.method = method @property def full_url(self): if self.fragment: return '{}#{}'.format(self._full_url, self.fragment) return self._full_url @full_url.setter def full_url(self, url): # unwrap('<URL:type://host/path>') --> 'type://host/path' self._full_url = unwrap(url) self._full_url, self.fragment = splittag(self._full_url) self._parse() @full_url.deleter def full_url(self): self._full_url = None self.fragment = None self.selector = '' @property def data(self): return self._data @data.setter def data(self, data): if data != self._data: self._data = data # issue 16464 # if we change data we need to remove content-length header # (cause it's most probably calculated for previous value) if self.has_header("Content-length"): self.remove_header("Content-length") @data.deleter def data(self): self.data = None def _parse(self): self.type, rest = splittype(self._full_url) if self.type is None: raise ValueError("unknown url type: %r" % self.full_url) self.host, self.selector = splithost(rest) if self.host: self.host = unquote(self.host) def get_method(self): """Return a string indicating the HTTP request method.""" default_method = "POST" if self.data is not None else "GET" return getattr(self, 'method', default_method) def get_full_url(self): return self.full_url def set_proxy(self, host, type): if self.type == 'https' and not self._tunnel_host: self._tunnel_host = self.host else: self.type= type self.selector = self.full_url self.host = host def has_proxy(self): return self.selector == self.full_url def add_header(self, key, val): # useful for something like authentication self.headers[key.capitalize()] = val def add_unredirected_header(self, key, val): # will not be added to a redirected request self.unredirected_hdrs[key.capitalize()] = val def has_header(self, header_name): return (header_name in self.headers or header_name in self.unredirected_hdrs) def get_header(self, header_name, default=None): return self.headers.get( header_name, self.unredirected_hdrs.get(header_name, default)) def remove_header(self, header_name): self.headers.pop(header_name, None) self.unredirected_hdrs.pop(header_name, None) def header_items(self): hdrs = self.unredirected_hdrs.copy() hdrs.update(self.headers) return list(hdrs.items()) class OpenerDirector: def __init__(self): client_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', client_version)] # self.handlers is retained only for backward compatibility self.handlers = [] # manage the individual handlers self.handle_open = {} self.handle_error = {} self.process_response = {} self.process_request = {} def add_handler(self, handler): if not hasattr(handler, "add_parent"): raise TypeError("expected BaseHandler instance, got %r" % type(handler)) added = False for meth in dir(handler): if meth in ["redirect_request", "do_open", "proxy_open"]: # oops, coincidental match continue i = meth.find("_") protocol = meth[:i] condition = meth[i+1:] if condition.startswith("error"): j = condition.find("_") + i + 1 kind = meth[j+1:] try: kind = int(kind) except ValueError: pass lookup = self.handle_error.get(protocol, {}) self.handle_error[protocol] = lookup elif condition == "open": kind = protocol lookup = self.handle_open elif condition == "response": kind = protocol lookup = self.process_response elif condition == "request": kind = protocol lookup = self.process_request else: continue handlers = lookup.setdefault(kind, []) if handlers: bisect.insort(handlers, handler) else: handlers.append(handler) added = True if added: bisect.insort(self.handlers, handler) handler.add_parent(self) def close(self): # Only exists for backwards compatibility. pass def _call_chain(self, chain, kind, meth_name, *args): # Handlers raise an exception if no one else should try to handle # the request, or return None if they can't but another handler # could. Otherwise, they return the response. handlers = chain.get(kind, ()) for handler in handlers: func = getattr(handler, meth_name) result = func(*args) if result is not None: return result def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): # accept a URL or a Request object if isinstance(fullurl, str): req = Request(fullurl, data) else: req = fullurl if data is not None: req.data = data req.timeout = timeout protocol = req.type # pre-process request meth_name = protocol+"_request" for processor in self.process_request.get(protocol, []): meth = getattr(processor, meth_name) req = meth(req) response = self._open(req, data) # post-process response meth_name = protocol+"_response" for processor in self.process_response.get(protocol, []): meth = getattr(processor, meth_name) response = meth(req, response) return response def _open(self, req, data=None): result = self._call_chain(self.handle_open, 'default', 'default_open', req) if result: return result protocol = req.type result = self._call_chain(self.handle_open, protocol, protocol + '_open', req) if result: return result return self._call_chain(self.handle_open, 'unknown', 'unknown_open', req) def error(self, proto, *args): if proto in ('http', 'https'): # XXX http[s] protocols are special-cased dict = self.handle_error['http'] # https is not different than http proto = args[2] # YUCK! meth_name = 'http_error_%s' % proto http_err = 1 orig_args = args else: dict = self.handle_error meth_name = proto + '_error' http_err = 0 args = (dict, proto, meth_name) + args result = self._call_chain(*args) if result: return result if http_err: args = (dict, 'default', 'http_error_default') + orig_args return self._call_chain(*args) # XXX probably also want an abstract factory that knows when it makes # sense to skip a superclass in favor of a subclass and when it might # make sense to include both def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP, FTP and when applicable HTTPS. If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler, HTTPErrorProcessor, DataHandler] if hasattr(http.client, "HTTPSConnection"): default_classes.append(HTTPSHandler) skip = set() for klass in default_classes: for check in handlers: if isinstance(check, type): if issubclass(check, klass): skip.add(klass) elif isinstance(check, klass): skip.add(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if isinstance(h, type): h = h() opener.add_handler(h) return opener class BaseHandler: handler_order = 500 def add_parent(self, parent): self.parent = parent def close(self): # Only exists for backwards compatibility pass def __lt__(self, other): if not hasattr(other, "handler_order"): # Try to preserve the old behavior of having custom classes # inserted after default ones (works only for custom user # classes which are not aware of handler_order). return True return self.handler_order < other.handler_order class HTTPErrorProcessor(BaseHandler): """Process HTTP error responses.""" handler_order = 1000 # after all other processing def http_response(self, request, response): code, msg, hdrs = response.code, response.msg, response.info() # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. if not (200 <= code < 300): response = self.parent.error( 'http', request, response, code, msg, hdrs) return response https_response = http_response class HTTPDefaultErrorHandler(BaseHandler): def http_error_default(self, req, fp, code, msg, hdrs): raise HTTPError(req.full_url, code, msg, hdrs, fp) class HTTPRedirectHandler(BaseHandler): # maximum number of redirections to any single URL # this is needed because of the state that cookies introduce max_repeats = 4 # maximum total number of redirections (regardless of URL) before # assuming we're in a loop max_redirections = 10 def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. This is called by the http_error_30x methods when a redirection response is received. If a redirection should take place, return a new Request to allow http_error_30x to perform the redirect. Otherwise, raise HTTPError if no-one else should try to handle this url. Return None if you can't but another Handler might. """ m = req.get_method() if (not (code in (301, 302, 303, 307) and m in ("GET", "HEAD") or code in (301, 302, 303) and m == "POST")): raise HTTPError(req.full_url, code, msg, headers, fp) # Strictly (according to RFC 2616), 301 or 302 in response to # a POST MUST NOT cause a redirection without confirmation # from the user (of urllib.request, in this case). In practice, # essentially all clients do redirect in this case, so we do # the same. # Be conciliant with URIs containing a space. This is mainly # redundant with the more complete encoding done in http_error_302(), # but it is kept for compatibility with other callers. newurl = newurl.replace(' ', '%20') CONTENT_HEADERS = ("content-length", "content-type") newheaders = dict((k, v) for k, v in req.headers.items() if k.lower() not in CONTENT_HEADERS) return Request(newurl, headers=newheaders, origin_req_host=req.origin_req_host, unverifiable=True) # Implementation note: To avoid the server sending us into an # infinite loop, the request object needs to track what URLs we # have already seen. Do this by adding a handler-specific # attribute to the Request object. def http_error_302(self, req, fp, code, msg, headers): # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. if "location" in headers: newurl = headers["location"] elif "uri" in headers: newurl = headers["uri"] else: return # fix a possible malformed URL urlparts = urlparse(newurl) # For security reasons we don't allow redirection to anything other # than http, https or ftp. if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError( newurl, code, "%s - Redirection to url '%s' is not allowed" % (msg, newurl), headers, fp) if not urlparts.path and urlparts.netloc: urlparts = list(urlparts) urlparts[2] = "/" newurl = urlunparse(urlparts) # http.client.parse_headers() decodes as ISO-8859-1. Recover the # original bytes and percent-encode non-ASCII bytes, and any special # characters such as the space. newurl = quote( newurl, encoding="iso-8859-1", safe=string.punctuation) newurl = urljoin(req.full_url, newurl) # XXX Probably want to forget about the state of the current # request, although that might interact poorly with other # handlers that also use handler-specific request attributes new = self.redirect_request(req, fp, code, msg, headers, newurl) if new is None: return # loop detection # .redirect_dict has a key url if url was previously visited. if hasattr(req, 'redirect_dict'): visited = new.redirect_dict = req.redirect_dict if (visited.get(newurl, 0) >= self.max_repeats or len(visited) >= self.max_redirections): raise HTTPError(req.full_url, code, self.inf_msg + msg, headers, fp) else: visited = new.redirect_dict = req.redirect_dict = {} visited[newurl] = visited.get(newurl, 0) + 1 # Don't close the fp until we are sure that we won't use it # with HTTPError. fp.read() fp.close() return self.parent.open(new, timeout=req.timeout) http_error_301 = http_error_303 = http_error_307 = http_error_302 inf_msg = "The HTTP server returned a redirect error that would " \ "lead to an infinite loop.\n" \ "The last 30x error message was:\n" def _parse_proxy(proxy): """Return (scheme, user, password, host/port) given a URL or an authority. If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must have two slashes after the scheme. """ scheme, r_scheme = splittype(proxy) if not r_scheme.startswith("/"): # authority scheme = None authority = proxy else: # URL if not r_scheme.startswith("//"): raise ValueError("proxy URL with no authority: %r" % proxy) # We have an authority, so for RFC 3986-compliant URLs (by ss 3. # and 3.3.), path is empty or starts with '/' end = r_scheme.find("/", 2) if end == -1: end = None authority = r_scheme[2:end] userinfo, hostport = splituser(authority) if userinfo is not None: user, password = splitpasswd(userinfo) else: user = password = None return scheme, user, password, hostport class ProxyHandler(BaseHandler): # Proxies must be in front handler_order = 100 def __init__(self, proxies=None): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'keys'), "proxies must be a mapping" self.proxies = proxies for type, url in proxies.items(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: meth(r, proxy, type)) def proxy_open(self, req, proxy, type): orig_type = req.type proxy_type, user, password, hostport = _parse_proxy(proxy) if proxy_type is None: proxy_type = orig_type if req.host and proxy_bypass(req.host): return None if user and password: user_pass = '%s:%s' % (unquote(user), unquote(password)) creds = base64.b64encode(user_pass.encode()).decode("ascii") req.add_header('Proxy-authorization', 'Basic ' + creds) hostport = unquote(hostport) req.set_proxy(hostport, proxy_type) if orig_type == proxy_type or orig_type == 'https': # let other handlers take care of it return None else: # need to start over, because the other handlers don't # grok the proxy's URL type # e.g. if we have a constructor arg proxies like so: # {'http': 'ftp://proxy.example.com'}, we may end up turning # a request for http://acme.example.com/a into one for # ftp://proxy.example.com/a return self.parent.open(req, timeout=req.timeout) class HTTPPasswordMgr: def __init__(self): self.passwd = {} def add_password(self, realm, uri, user, passwd): # uri could be a single URI or a sequence if isinstance(uri, str): uri = [uri] if realm not in self.passwd: self.passwd[realm] = {} for default_port in True, False: reduced_uri = tuple( [self.reduce_uri(u, default_port) for u in uri]) self.passwd[realm][reduced_uri] = (user, passwd) def find_user_password(self, realm, authuri): domains = self.passwd.get(realm, {}) for default_port in True, False: reduced_authuri = self.reduce_uri(authuri, default_port) for uris, authinfo in domains.items(): for uri in uris: if self.is_suburi(uri, reduced_authuri): return authinfo return None, None def reduce_uri(self, uri, default_port=True): """Accept authority or URI and extract only the authority and path.""" # note HTTP URLs do not have a userinfo component parts = urlsplit(uri) if parts[1]: # URI scheme = parts[0] authority = parts[1] path = parts[2] or '/' else: # host or host:port scheme = None authority = uri path = '/' host, port = splitport(authority) if default_port and port is None and scheme is not None: dport = {"http": 80, "https": 443, }.get(scheme) if dport is not None: authority = "%s:%d" % (host, dport) return authority, path def is_suburi(self, base, test): """Check if test is below base in a URI tree Both args must be URIs in reduced form. """ if base == test: return True if base[0] != test[0]: return False common = posixpath.commonprefix((base[1], test[1])) if len(common) == len(base[1]): return True return False class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): def find_user_password(self, realm, authuri): user, password = HTTPPasswordMgr.find_user_password(self, realm, authuri) if user is not None: return user, password return HTTPPasswordMgr.find_user_password(self, None, authuri) class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): def __init__(self, *args, **kwargs): self.authenticated = {} super().__init__(*args, **kwargs) def add_password(self, realm, uri, user, passwd, is_authenticated=False): self.update_authenticated(uri, is_authenticated) # Add a default for prior auth requests if realm is not None: super().add_password(None, uri, user, passwd) super().add_password(realm, uri, user, passwd) def update_authenticated(self, uri, is_authenticated=False): # uri could be a single URI or a sequence if isinstance(uri, str): uri = [uri] for default_port in True, False: for u in uri: reduced_uri = self.reduce_uri(u, default_port) self.authenticated[reduced_uri] = is_authenticated def is_authenticated(self, authuri): for default_port in True, False: reduced_authuri = self.reduce_uri(authuri, default_port) for uri in self.authenticated: if self.is_suburi(uri, reduced_authuri): return self.authenticated[uri] class AbstractBasicAuthHandler: # XXX this allows for multiple auth-schemes, but will stupidly pick # the last one with a realm specified. # allow for double- and single-quoted realm values # (single quotes are a violation of the RFC, but appear in the wild) rx = re.compile('(?:^|,)' # start of the string or ',' '[ \t]*' # optional whitespaces '([^ \t,]+)' # scheme like "Basic" '[ \t]+' # mandatory whitespaces # realm=xxx # realm='xxx' # realm="xxx" 'realm=(["\']?)([^"\']*)\\2', re.I) # XXX could pre-emptively send auth info already accepted (RFC 2617, # end of section 2, and section 1.2 immediately after "credentials" # production). def __init__(self, password_mgr=None): if password_mgr is None: password_mgr = HTTPPasswordMgr() self.passwd = password_mgr self.add_password = self.passwd.add_password def _parse_realm(self, header): # parse WWW-Authenticate header: accept multiple challenges per header found_challenge = False for mo in AbstractBasicAuthHandler.rx.finditer(header): scheme, quote, realm = mo.groups() if quote not in ['"', "'"]: warnings.warn("Basic Auth Realm was unquoted", UserWarning, 3) yield (scheme, realm) found_challenge = True if not found_challenge: if header: scheme = header.split()[0] else: scheme = '' yield (scheme, None) def http_error_auth_reqed(self, authreq, host, req, headers): # host may be an authority (without userinfo) or a URL with an # authority headers = headers.get_all(authreq) if not headers: # no header found return unsupported = None for header in headers: for scheme, realm in self._parse_realm(header): if scheme.lower() != 'basic': unsupported = scheme continue if realm is not None: # Use the first matching Basic challenge. # Ignore following challenges even if they use the Basic # scheme. return self.retry_http_basic_auth(host, req, realm) if unsupported is not None: raise ValueError("AbstractBasicAuthHandler does not " "support the following scheme: %r" % (scheme,)) def retry_http_basic_auth(self, host, req, realm): user, pw = self.passwd.find_user_password(realm, host) if pw is not None: raw = "%s:%s" % (user, pw) auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii") if req.get_header(self.auth_header, None) == auth: return None req.add_unredirected_header(self.auth_header, auth) return self.parent.open(req, timeout=req.timeout) else: return None def http_request(self, req): if (not hasattr(self.passwd, 'is_authenticated') or not self.passwd.is_authenticated(req.full_url)): return req if not req.has_header('Authorization'): user, passwd = self.passwd.find_user_password(None, req.full_url) credentials = '{0}:{1}'.format(user, passwd).encode() auth_str = base64.standard_b64encode(credentials).decode() req.add_unredirected_header('Authorization', 'Basic {}'.format(auth_str.strip())) return req def http_response(self, req, response): if hasattr(self.passwd, 'is_authenticated'): if 200 <= response.code < 300: self.passwd.update_authenticated(req.full_url, True) else: self.passwd.update_authenticated(req.full_url, False) return response https_request = http_request https_response = http_response class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): auth_header = 'Authorization' def http_error_401(self, req, fp, code, msg, headers): url = req.full_url response = self.http_error_auth_reqed('www-authenticate', url, req, headers) return response class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): auth_header = 'Proxy-authorization' def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib.request does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.host response = self.http_error_auth_reqed('proxy-authenticate', authority, req, headers) return response # Return n random bytes. _randombytes = os.urandom class AbstractDigestAuthHandler: # Digest authentication is specified in RFC 2617. # XXX The client does not inspect the Authentication-Info header # in a successful response. # XXX It should be possible to test this implementation against # a mock server that just generates a static set of challenges. # XXX qop="auth-int" supports is shaky def __init__(self, passwd=None): if passwd is None: passwd = HTTPPasswordMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.retried = 0 self.nonce_count = 0 self.last_nonce = None def reset_retry_count(self): self.retried = 0 def http_error_auth_reqed(self, auth_header, host, req, headers): authreq = headers.get(auth_header, None) if self.retried > 5: # Don't fail endlessly - if we failed once, we'll probably # fail a second time. Hm. Unless the Password Manager is # prompting for the information. Crap. This isn't great # but it's better than the current 'repeat until recursion # depth exceeded' approach <wink> raise HTTPError(req.full_url, 401, "digest auth failed", headers, None) else: self.retried += 1 if authreq: scheme = authreq.split()[0] if scheme.lower() == 'digest': return self.retry_http_digest_auth(req, authreq) elif scheme.lower() != 'basic': raise ValueError("AbstractDigestAuthHandler does not support" " the following scheme: '%s'" % scheme) def retry_http_digest_auth(self, req, auth): token, challenge = auth.split(' ', 1) chal = parse_keqv_list(filter(None, parse_http_list(challenge))) auth = self.get_authorization(req, chal) if auth: auth_val = 'Digest %s' % auth if req.headers.get(self.auth_header, None) == auth_val: return None req.add_unredirected_header(self.auth_header, auth_val) resp = self.parent.open(req, timeout=req.timeout) return resp def get_cnonce(self, nonce): # The cnonce-value is an opaque # quoted string value provided by the client and used by both client # and server to avoid chosen plaintext attacks, to provide mutual # authentication, and to provide some message integrity protection. # This isn't a fabulous effort, but it's probably Good Enough. s = "%s:%s:%s:" % (self.nonce_count, nonce, time.ctime()) b = s.encode("ascii") + _randombytes(8) dig = hashlib.sha1(b).hexdigest() return dig[:16] def get_authorization(self, req, chal): try: realm = chal['realm'] nonce = chal['nonce'] qop = chal.get('qop') algorithm = chal.get('algorithm', 'MD5') # mod_digest doesn't send an opaque, even though it isn't # supposed to be optional opaque = chal.get('opaque', None) except KeyError: return None H, KD = self.get_algorithm_impls(algorithm) if H is None: return None user, pw = self.passwd.find_user_password(realm, req.full_url) if user is None: return None # XXX not implemented yet if req.data is not None: entdig = self.get_entity_digest(req.data, chal) else: entdig = None A1 = "%s:%s:%s" % (user, realm, pw) A2 = "%s:%s" % (req.get_method(), # XXX selector: what about proxies and full urls req.selector) if qop == 'auth': if nonce == self.last_nonce: self.nonce_count += 1 else: self.nonce_count = 1 self.last_nonce = nonce ncvalue = '%08x' % self.nonce_count cnonce = self.get_cnonce(nonce) noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2)) respdig = KD(H(A1), noncebit) elif qop is None: respdig = KD(H(A1), "%s:%s" % (nonce, H(A2))) else: # XXX handle auth-int. raise URLError("qop '%s' is not supported." % qop) # XXX should the partial digests be encoded too? base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \ 'response="%s"' % (user, realm, nonce, req.selector, respdig) if opaque: base += ', opaque="%s"' % opaque if entdig: base += ', digest="%s"' % entdig base += ', algorithm="%s"' % algorithm if qop: base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce) return base def get_algorithm_impls(self, algorithm): # lambdas assume digest modules are imported at the top level if algorithm == 'MD5': H = lambda x: hashlib.md5(x.encode("ascii")).hexdigest() elif algorithm == 'SHA': H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest() # XXX MD5-sess else: raise ValueError("Unsupported digest authentication " "algorithm %r" % algorithm) KD = lambda s, d: H("%s:%s" % (s, d)) return H, KD def get_entity_digest(self, data, chal): # XXX not implemented yet return None class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): """An authentication protocol defined by RFC 2069 Digest authentication improves on basic authentication because it does not transmit passwords in the clear. """ auth_header = 'Authorization' handler_order = 490 # before Basic auth def http_error_401(self, req, fp, code, msg, headers): host = urlparse(req.full_url)[1] retry = self.http_error_auth_reqed('www-authenticate', host, req, headers) self.reset_retry_count() return retry class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): auth_header = 'Proxy-Authorization' handler_order = 490 # before Basic auth def http_error_407(self, req, fp, code, msg, headers): host = req.host retry = self.http_error_auth_reqed('proxy-authenticate', host, req, headers) self.reset_retry_count() return retry class AbstractHTTPHandler(BaseHandler): def __init__(self, debuglevel=0): self._debuglevel = debuglevel def set_http_debuglevel(self, level): self._debuglevel = level def _get_content_length(self, request): return http.client.HTTPConnection._get_content_length( request.data, request.get_method()) def do_request_(self, request): host = request.host if not host: raise URLError('no host given') if request.data is not None: # POST data = request.data if isinstance(data, str): msg = "POST data should be bytes, an iterable of bytes, " \ "or a file object. It cannot be of type str." raise TypeError(msg) if not request.has_header('Content-type'): request.add_unredirected_header( 'Content-type', 'application/x-www-form-urlencoded') if (not request.has_header('Content-length') and not request.has_header('Transfer-encoding')): content_length = self._get_content_length(request) if content_length is not None: request.add_unredirected_header( 'Content-length', str(content_length)) else: request.add_unredirected_header( 'Transfer-encoding', 'chunked') sel_host = host if request.has_proxy(): scheme, sel = splittype(request.selector) sel_host, sel_path = splithost(sel) if not request.has_header('Host'): request.add_unredirected_header('Host', sel_host) for name, value in self.parent.addheaders: name = name.capitalize() if not request.has_header(name): request.add_unredirected_header(name, value) return request def do_open(self, http_class, req, **http_conn_args): """Return an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. """ host = req.host if not host: raise URLError('no host given') # will parse host:port h = http_class(host, timeout=req.timeout, **http_conn_args) h.set_debuglevel(self._debuglevel) headers = dict(req.unredirected_hdrs) headers.update(dict((k, v) for k, v in req.headers.items() if k not in headers)) # TODO(jhylton): Should this be redesigned to handle # persistent connections? # We want to make an HTTP/1.1 request, but the addinfourl # class isn't prepared to deal with a persistent connection. # It will try to read all remaining data from the socket, # which will block while the server waits for the next request. # So make sure the connection gets closed after the (only) # request. headers["Connection"] = "close" headers = dict((name.title(), val) for name, val in headers.items()) if req._tunnel_host: tunnel_headers = {} proxy_auth_hdr = "Proxy-Authorization" if proxy_auth_hdr in headers: tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] # Proxy-Authorization should not be sent to origin # server. del headers[proxy_auth_hdr] h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: try: h.request(req.get_method(), req.selector, req.data, headers, encode_chunked=req.has_header('Transfer-encoding')) except OSError as err: # timeout error raise URLError(err) r = h.getresponse() except: h.close() raise # If the server does not send us a 'Connection: close' header, # HTTPConnection assumes the socket should be left open. Manually # mark the socket to be closed when this response object goes away. if h.sock: h.sock.close() h.sock = None r.url = req.get_full_url() # This line replaces the .msg attribute of the HTTPResponse # with .headers, because urllib clients expect the response to # have the reason in .msg. It would be good to mark this # attribute is deprecated and get then to use info() or # .headers. r.msg = r.reason return r class HTTPHandler(AbstractHTTPHandler): def http_open(self, req): return self.do_open(http.client.HTTPConnection, req) http_request = AbstractHTTPHandler.do_request_ if hasattr(http.client, 'HTTPSConnection'): class HTTPSHandler(AbstractHTTPHandler): def __init__(self, debuglevel=0, context=None, check_hostname=None): AbstractHTTPHandler.__init__(self, debuglevel) self._context = context self._check_hostname = check_hostname def https_open(self, req): return self.do_open(http.client.HTTPSConnection, req, context=self._context, check_hostname=self._check_hostname) https_request = AbstractHTTPHandler.do_request_ __all__.append('HTTPSHandler') class HTTPCookieProcessor(BaseHandler): def __init__(self, cookiejar=None): import http.cookiejar if cookiejar is None: cookiejar = http.cookiejar.CookieJar() self.cookiejar = cookiejar def http_request(self, request): self.cookiejar.add_cookie_header(request) return request def http_response(self, request, response): self.cookiejar.extract_cookies(response, request) return response https_request = http_request https_response = http_response class UnknownHandler(BaseHandler): def unknown_open(self, req): type = req.type raise URLError('unknown url type: %s' % type) def parse_keqv_list(l): """Parse list of key=value strings where keys are not duplicated.""" parsed = {} for elt in l: k, v = elt.split('=', 1) if v[0] == '"' and v[-1] == '"': v = v[1:-1] parsed[k] = v return parsed def parse_http_list(s): """Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes count if they are escaped. Only double-quotes count, not single-quotes. """ res = [] part = '' escape = quote = False for cur in s: if escape: part += cur escape = False continue if quote: if cur == '\\': escape = True continue elif cur == '"': quote = False part += cur continue if cur == ',': res.append(part) part = '' continue if cur == '"': quote = True part += cur # append last part if part: res.append(part) return [part.strip() for part in res] class FileHandler(BaseHandler): # Use local file or FTP depending on form of URL def file_open(self, req): url = req.selector if url[:2] == '//' and url[2:3] != '/' and (req.host and req.host != 'localhost'): if not req.host in self.get_names(): raise URLError("file:// scheme is supported only on localhost") else: return self.open_local_file(req) # names for the localhost names = None def get_names(self): if FileHandler.names is None: try: FileHandler.names = tuple( socket.gethostbyname_ex('localhost')[2] + socket.gethostbyname_ex(socket.gethostname())[2]) except socket.gaierror: FileHandler.names = (socket.gethostbyname('localhost'),) return FileHandler.names # not entirely sure what the rules are here def open_local_file(self, req): import email.utils import mimetypes host = req.host filename = req.selector localfile = url2pathname(filename) try: stats = os.stat(localfile) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(filename)[0] headers = email.message_from_string( 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified)) if host: host, port = splitport(host) if not host or \ (not port and _safe_gethostbyname(host) in self.get_names()): if host: origurl = 'file://' + host + filename else: origurl = 'file://' + filename return addinfourl(open(localfile, 'rb'), headers, origurl) except OSError as exp: raise URLError(exp) raise URLError('file not on local host') def _safe_gethostbyname(host): try: return socket.gethostbyname(host) except socket.gaierror: return None class FTPHandler(BaseHandler): def ftp_open(self, req): import ftplib import mimetypes host = req.host if not host: raise URLError('ftp error: no host given') host, port = splitport(host) if port is None: port = ftplib.FTP_PORT else: port = int(port) # username/password handling user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = user or '' passwd = passwd or '' try: host = socket.gethostbyname(host) except OSError as msg: raise URLError(msg) path, attrs = splitattr(req.selector) dirs = path.split('/') dirs = list(map(unquote, dirs)) dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] try: fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout) type = file and 'I' or 'D' for attr in attrs: attr, value = splitvalue(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.full_url)[0] if mtype: headers += "Content-type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-length: %d\n" % retrlen headers = email.message_from_string(headers) return addinfourl(fp, headers, req.full_url) except ftplib.all_errors as exp: exc = URLError('ftp error: %r' % exp) raise exc.with_traceback(sys.exc_info()[2]) def connect_ftp(self, user, passwd, host, port, dirs, timeout): return ftpwrapper(user, passwd, host, port, dirs, timeout, persistent=False) class CacheFTPHandler(FTPHandler): # XXX would be nice to have pluggable cache strategies # XXX this stuff is definitely not thread safe def __init__(self): self.cache = {} self.timeout = {} self.soonest = 0 self.delay = 60 self.max_conns = 16 def setTimeout(self, t): self.delay = t def setMaxConns(self, m): self.max_conns = m def connect_ftp(self, user, passwd, host, port, dirs, timeout): key = user, host, port, '/'.join(dirs), timeout if key in self.cache: self.timeout[key] = time.time() + self.delay else: self.cache[key] = ftpwrapper(user, passwd, host, port, dirs, timeout) self.timeout[key] = time.time() + self.delay self.check_cache() return self.cache[key] def check_cache(self): # first check for old ones t = time.time() if self.soonest <= t: for k, v in list(self.timeout.items()): if v < t: self.cache[k].close() del self.cache[k] del self.timeout[k] self.soonest = min(list(self.timeout.values())) # then check the size if len(self.cache) == self.max_conns: for k, v in list(self.timeout.items()): if v == self.soonest: del self.cache[k] del self.timeout[k] break self.soonest = min(list(self.timeout.values())) def clear_cache(self): for conn in self.cache.values(): conn.close() self.cache.clear() self.timeout.clear() class DataHandler(BaseHandler): def data_open(self, req): # data URLs as specified in RFC 2397. # # ignores POSTed data # # syntax: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value url = req.full_url scheme, data = url.split(":",1) mediatype, data = data.split(",",1) # even base64 encoded data URLs might be quoted so unquote in any case: data = unquote_to_bytes(data) if mediatype.endswith(";base64"): data = base64.decodebytes(data) mediatype = mediatype[:-7] if not mediatype: mediatype = "text/plain;charset=US-ASCII" headers = email.message_from_string("Content-type: %s\nContent-length: %d\n" % (mediatype, len(data))) return addinfourl(io.BytesIO(data), headers, url) # Code move from the old urllib module MAXFTPCACHE = 10 # Trim the ftp cache beyond this size # Helper for non-unix systems if os.name == 'nt': from nturl2path import url2pathname, pathname2url else: def url2pathname(pathname): """OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.""" return unquote(pathname) def pathname2url(pathname): """OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.""" return quote(pathname) ftpcache = {} class URLopener: """Class to open URLs. This is a class rather than just a subroutine because we may need more than one set of global protocol-specific options. Note -- this is a base class for those who don't want the automatic handling of errors type 302 (relocated) and 401 (authorization needed).""" __tempfiles = None version = "Python-urllib/%s" % __version__ # Constructor def __init__(self, proxies=None, **x509): msg = "%(class)s style of invoking requests is deprecated. " \ "Use newer urlopen functions/methods" % {'class': self.__class__.__name__} warnings.warn(msg, DeprecationWarning, stacklevel=3) if proxies is None: proxies = getproxies() assert hasattr(proxies, 'keys'), "proxies must be a mapping" self.proxies = proxies self.key_file = x509.get('key_file') self.cert_file = x509.get('cert_file') self.addheaders = [('User-Agent', self.version), ('Accept', '*/*')] self.__tempfiles = [] self.__unlink = os.unlink # See cleanup() self.tempcache = None # Undocumented feature: if you assign {} to tempcache, # it is used to cache files retrieved with # self.retrieve(). This is not enabled by default # since it does not work for changing documents (and I # haven't got the logic to check expiration headers # yet). self.ftpcache = ftpcache # Undocumented feature: you can use a different # ftp cache by assigning to the .ftpcache member; # in case you want logically independent URL openers # XXX This is not threadsafe. Bah. def __del__(self): self.close() def close(self): self.cleanup() def cleanup(self): # This code sometimes runs when the rest of this module # has already been deleted, so it can't use any globals # or import anything. if self.__tempfiles: for file in self.__tempfiles: try: self.__unlink(file) except OSError: pass del self.__tempfiles[:] if self.tempcache: self.tempcache.clear() def addheader(self, *args): """Add a header to be used by the HTTP interface only e.g. u.addheader('Accept', 'sound/basic')""" self.addheaders.append(args) # External interface def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(to_bytes(fullurl)) fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|") if self.tempcache and fullurl in self.tempcache: filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) urltype, url = splittype(fullurl) if not urltype: urltype = 'file' if urltype in self.proxies: proxy = self.proxies[urltype] urltype, proxyhost = splittype(proxy) host, selector = splithost(proxyhost) url = (host, fullurl) # Signal special case to open_*() else: proxy = None name = 'open_' + urltype self.type = urltype name = name.replace('-', '_') if not hasattr(self, name) or name == 'open_local_file': if proxy: return self.open_unknown_proxy(proxy, fullurl, data) else: return self.open_unknown(fullurl, data) try: if data is None: return getattr(self, name)(url) else: return getattr(self, name)(url, data) except (HTTPError, URLError): raise except OSError as msg: raise OSError('socket error', msg).with_traceback(sys.exc_info()[2]) def open_unknown(self, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) raise OSError('url error', 'unknown url type', type) def open_unknown_proxy(self, proxy, fullurl, data=None): """Overridable interface to open unknown URL type.""" type, url = splittype(fullurl) raise OSError('url error', 'invalid proxy for %s' % type, proxy) # External interface def retrieve(self, url, filename=None, reporthook=None, data=None): """retrieve(url) returns (filename, headers) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(to_bytes(url)) if self.tempcache and url in self.tempcache: return self.tempcache[url] type, url1 = splittype(url) if filename is None and (not type or type == 'file'): try: fp = self.open_local_file(url1) hdrs = fp.info() fp.close() return url2pathname(splithost(url1)[1]), hdrs except OSError as msg: pass fp = self.open(url, data) try: headers = fp.info() if filename: tfp = open(filename, 'wb') else: import tempfile garbage, path = splittype(url) garbage, path = splithost(path or "") path, garbage = splitquery(path or "") path, garbage = splitattr(path or "") suffix = os.path.splitext(path)[1] (fd, filename) = tempfile.mkstemp(suffix) self.__tempfiles.append(filename) tfp = os.fdopen(fd, 'wb') try: result = filename, headers if self.tempcache is not None: self.tempcache[url] = result bs = 1024*8 size = -1 read = 0 blocknum = 0 if "content-length" in headers: size = int(headers["Content-Length"]) if reporthook: reporthook(blocknum, bs, size) while 1: block = fp.read(bs) if not block: break read += len(block) tfp.write(block) blocknum += 1 if reporthook: reporthook(blocknum, bs, size) finally: tfp.close() finally: fp.close() # raise exception if actual size does not match content-length header if size >= 0 and read < size: raise ContentTooShortError( "retrieval incomplete: got only %i out of %i bytes" % (read, size), result) return result # Each method named open_<type> knows how to open that type of URL def _open_generic_http(self, connection_factory, url, data): """Make an HTTP connection using connection_class. This is an internal method that should be called from open_http() or open_https(). Arguments: - connection_factory should take a host name and return an HTTPConnection instance. - url is the url to retrieval or a host, relative-path pair. - data is payload for a POST request or None. """ user_passwd = None proxy_passwd= None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url # check whether the proxy contains authorization information proxy_passwd, host = splituser(host) # now we proceed with the url we want to obtain urltype, rest = splittype(selector) url = rest user_passwd = None if urltype.lower() != 'http': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) if proxy_bypass(realhost): host = realhost if not host: raise OSError('http error', 'no host given') if proxy_passwd: proxy_passwd = unquote(proxy_passwd) proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii') else: proxy_auth = None if user_passwd: user_passwd = unquote(user_passwd) auth = base64.b64encode(user_passwd.encode()).decode('ascii') else: auth = None http_conn = connection_factory(host) headers = {} if proxy_auth: headers["Proxy-Authorization"] = "Basic %s" % proxy_auth if auth: headers["Authorization"] = "Basic %s" % auth if realhost: headers["Host"] = realhost # Add Connection:close as we don't support persistent connections yet. # This helps in closing the socket and avoiding ResourceWarning headers["Connection"] = "close" for header, value in self.addheaders: headers[header] = value if data is not None: headers["Content-Type"] = "application/x-www-form-urlencoded" http_conn.request("POST", selector, data, headers) else: http_conn.request("GET", selector, headers=headers) try: response = http_conn.getresponse() except http.client.BadStatusLine: # something went wrong with the HTTP status line raise URLError("http protocol error: bad status line") # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. if 200 <= response.status < 300: return addinfourl(response, response.msg, "http:" + url, response.status) else: return self.http_error( url, response.fp, response.status, response.reason, response.msg, data) def open_http(self, url, data=None): """Use HTTP protocol.""" return self._open_generic_http(http.client.HTTPConnection, url, data) def http_error(self, url, fp, errcode, errmsg, headers, data=None): """Handle http errors. Derived class can override this, or provide specific handlers named http_error_DDD where DDD is the 3-digit error code.""" # First check if there's a specific handler for this error name = 'http_error_%d' % errcode if hasattr(self, name): method = getattr(self, name) if data is None: result = method(url, fp, errcode, errmsg, headers) else: result = method(url, fp, errcode, errmsg, headers, data) if result: return result return self.http_error_default(url, fp, errcode, errmsg, headers) def http_error_default(self, url, fp, errcode, errmsg, headers): """Default error handler: close the connection and raise OSError.""" fp.close() raise HTTPError(url, errcode, errmsg, headers, None) if _have_ssl: def _https_connection(self, host): return http.client.HTTPSConnection(host, key_file=self.key_file, cert_file=self.cert_file) def open_https(self, url, data=None): """Use HTTPS protocol.""" return self._open_generic_http(self._https_connection, url, data) def open_file(self, url): """Use local file or FTP depending on form of URL.""" if not isinstance(url, str): raise URLError('file error: proxy support for file protocol currently not implemented') if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': raise ValueError("file:// scheme is supported only on localhost") else: return self.open_local_file(url) def open_local_file(self, url): """Use local file.""" import email.utils import mimetypes host, file = splithost(url) localname = url2pathname(file) try: stats = os.stat(localname) except OSError as e: raise URLError(e.strerror, e.filename) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(url)[0] headers = email.message_from_string( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified)) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://' + file return addinfourl(open(localname, 'rb'), headers, urlfile) host, port = splitport(host) if (not port and socket.gethostbyname(host) in ((localhost(),) + thishost())): urlfile = file if file[:1] == '/': urlfile = 'file://' + file elif file[:2] == './': raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url) return addinfourl(open(localname, 'rb'), headers, urlfile) raise URLError('local file error: not on local host') def open_ftp(self, url): """Use FTP protocol.""" if not isinstance(url, str): raise URLError('ftp error: proxy support for ftp protocol currently not implemented') import mimetypes host, path = splithost(url) if not host: raise URLError('ftp error: no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote(passwd or '') host = socket.gethostbyname(host) if not port: import ftplib port = ftplib.FTP_PORT else: port = int(port) path, attrs = splitattr(path) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] if dirs and not dirs[0]: dirs[0] = '/' key = user, host, port, '/'.join(dirs) # XXX thread unsafe! if len(self.ftpcache) > MAXFTPCACHE: # Prune the cache, rather arbitrarily for k in list(self.ftpcache): if k != key: v = self.ftpcache[k] del self.ftpcache[k] v.close() try: if key not in self.ftpcache: self.ftpcache[key] = \ ftpwrapper(user, passwd, host, port, dirs) if not file: type = 'D' else: type = 'I' for attr in attrs: attr, value = splitvalue(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() (fp, retrlen) = self.ftpcache[key].retrfile(file, type) mtype = mimetypes.guess_type("ftp:" + url)[0] headers = "" if mtype: headers += "Content-Type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-Length: %d\n" % retrlen headers = email.message_from_string(headers) return addinfourl(fp, headers, "ftp:" + url) except ftperrors() as exp: raise URLError('ftp error %r' % exp).with_traceback(sys.exc_info()[2]) def open_data(self, url, data=None): """Use "data" URL.""" if not isinstance(url, str): raise URLError('data error: proxy support for data protocol currently not implemented') # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value try: [type, data] = url.split(',', 1) except ValueError: raise OSError('data error', 'bad data URL') if not type: type = 'text/plain;charset=US-ASCII' semi = type.rfind(';') if semi >= 0 and '=' not in type[semi:]: encoding = type[semi+1:] type = type[:semi] else: encoding = '' msg = [] msg.append('Date: %s'%time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(time.time()))) msg.append('Content-type: %s' % type) if encoding == 'base64': # XXX is this encoding/decoding ok? data = base64.decodebytes(data.encode('ascii')).decode('latin-1') else: data = unquote(data) msg.append('Content-Length: %d' % len(data)) msg.append('') msg.append(data) msg = '\n'.join(msg) headers = email.message_from_string(msg) f = io.StringIO(msg) #f.fileno = None # needed for addinfourl return addinfourl(f, headers, url) class FancyURLopener(URLopener): """Derived class with handlers for errors we can handle (perhaps).""" def __init__(self, *args, **kwargs): URLopener.__init__(self, *args, **kwargs) self.auth_cache = {} self.tries = 0 self.maxtries = 10 def http_error_default(self, url, fp, errcode, errmsg, headers): """Default error handling -- don't raise an exception.""" return addinfourl(fp, headers, "http:" + url, errcode) def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): """Error 302 -- relocated (temporarily).""" self.tries += 1 try: if self.maxtries and self.tries >= self.maxtries: if hasattr(self, "http_error_500"): meth = self.http_error_500 else: meth = self.http_error_default return meth(url, fp, 500, "Internal Server Error: Redirect Recursion", headers) result = self.redirect_internal(url, fp, errcode, errmsg, headers, data) return result finally: self.tries = 0 def redirect_internal(self, url, fp, errcode, errmsg, headers, data): if 'location' in headers: newurl = headers['location'] elif 'uri' in headers: newurl = headers['uri'] else: return fp.close() # In case the server sent a relative URL, join with original: newurl = urljoin(self.type + ":" + url, newurl) urlparts = urlparse(newurl) # For security reasons, we don't allow redirection to anything other # than http, https and ftp. # We are using newer HTTPError with older redirect_internal method # This older method will get deprecated in 3.3 if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError(newurl, errcode, errmsg + " Redirection to url '%s' is not allowed." % newurl, headers, fp) return self.open(newurl) def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): """Error 301 -- also relocated (permanently).""" return self.http_error_302(url, fp, errcode, errmsg, headers, data) def http_error_303(self, url, fp, errcode, errmsg, headers, data=None): """Error 303 -- also relocated (essentially identical to 302).""" return self.http_error_302(url, fp, errcode, errmsg, headers, data) def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): """Error 307 -- relocated, but turn POST into error.""" if data is None: return self.http_error_302(url, fp, errcode, errmsg, headers, data) else: return self.http_error_default(url, fp, errcode, errmsg, headers) def http_error_401(self, url, fp, errcode, errmsg, headers, data=None, retry=False): """Error 401 -- authentication required. This function supports Basic authentication only.""" if 'www-authenticate' not in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['www-authenticate'] match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) if not retry: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) def http_error_407(self, url, fp, errcode, errmsg, headers, data=None, retry=False): """Error 407 -- proxy authentication required. This function supports Basic authentication only.""" if 'proxy-authenticate' not in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['proxy-authenticate'] match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) if not retry: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_proxy_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) def retry_proxy_http_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'http://' + host + selector proxy = self.proxies['http'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = "%s:%s@%s" % (quote(user, safe=''), quote(passwd, safe=''), proxyhost) self.proxies['http'] = 'http://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data) def retry_proxy_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'https://' + host + selector proxy = self.proxies['https'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = "%s:%s@%s" % (quote(user, safe=''), quote(passwd, safe=''), proxyhost) self.proxies['https'] = 'https://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data) def retry_http_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = host.find('@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = "%s:%s@%s" % (quote(user, safe=''), quote(passwd, safe=''), host) newurl = 'http://' + host + selector if data is None: return self.open(newurl) else: return self.open(newurl, data) def retry_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = host.find('@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = "%s:%s@%s" % (quote(user, safe=''), quote(passwd, safe=''), host) newurl = 'https://' + host + selector if data is None: return self.open(newurl) else: return self.open(newurl, data) def get_user_passwd(self, host, realm, clear_cache=0): key = realm + '@' + host.lower() if key in self.auth_cache: if clear_cache: del self.auth_cache[key] else: return self.auth_cache[key] user, passwd = self.prompt_user_passwd(host, realm) if user or passwd: self.auth_cache[key] = (user, passwd) return user, passwd def prompt_user_passwd(self, host, realm): """Override this in a GUI environment!""" import getpass try: user = input("Enter username for %s at %s: " % (realm, host)) passwd = getpass.getpass("Enter password for %s in %s at %s: " % (user, realm, host)) return user, passwd except KeyboardInterrupt: print() return None, None # Utility functions _localhost = None def localhost(): """Return the IP address of the magic hostname 'localhost'.""" global _localhost if _localhost is None: _localhost = socket.gethostbyname('localhost') return _localhost _thishost = None def thishost(): """Return the IP addresses of the current host.""" global _thishost if _thishost is None: try: _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2]) except socket.gaierror: _thishost = tuple(socket.gethostbyname_ex('localhost')[2]) return _thishost _ftperrors = None def ftperrors(): """Return the set of errors raised by the FTP class.""" global _ftperrors if _ftperrors is None: import ftplib _ftperrors = ftplib.all_errors return _ftperrors _noheaders = None def noheaders(): """Return an empty email Message object.""" global _noheaders if _noheaders is None: _noheaders = email.message_from_string("") return _noheaders # Utility classes class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" def __init__(self, user, passwd, host, port, dirs, timeout=None, persistent=True): self.user = user self.passwd = passwd self.host = host self.port = port self.dirs = dirs self.timeout = timeout self.refcount = 0 self.keepalive = persistent try: self.init() except: self.close() raise def init(self): import ftplib self.busy = 0 self.ftp = ftplib.FTP() self.ftp.connect(self.host, self.port, self.timeout) self.ftp.login(self.user, self.passwd) _target = '/'.join(self.dirs) self.ftp.cwd(_target) def retrfile(self, file, type): import ftplib self.endtransfer() if type in ('d', 'D'): cmd = 'TYPE A'; isdir = 1 else: cmd = 'TYPE ' + type; isdir = 0 try: self.ftp.voidcmd(cmd) except ftplib.all_errors: self.init() self.ftp.voidcmd(cmd) conn = None if file and not isdir: # Try to retrieve as a file try: cmd = 'RETR ' + file conn, retrlen = self.ftp.ntransfercmd(cmd) except ftplib.error_perm as reason: if str(reason)[:3] != '550': raise URLError('ftp error: %r' % reason).with_traceback( sys.exc_info()[2]) if not conn: # Set transfer mode to ASCII! self.ftp.voidcmd('TYPE A') # Try a directory listing. Verify that directory exists. if file: pwd = self.ftp.pwd() try: try: self.ftp.cwd(file) except ftplib.error_perm as reason: raise URLError('ftp error: %r' % reason) from reason finally: self.ftp.cwd(pwd) cmd = 'LIST ' + file else: cmd = 'LIST' conn, retrlen = self.ftp.ntransfercmd(cmd) self.busy = 1 ftpobj = addclosehook(conn.makefile('rb'), self.file_close) self.refcount += 1 conn.close() # Pass back both a suitably decorated object and a retrieval length return (ftpobj, retrlen) def endtransfer(self): self.busy = 0 def close(self): self.keepalive = False if self.refcount <= 0: self.real_close() def file_close(self): self.endtransfer() self.refcount -= 1 if self.refcount <= 0 and not self.keepalive: self.real_close() def real_close(self): self.endtransfer() try: self.ftp.close() except ftperrors(): pass # Proxy handling def getproxies_environment(): """Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor. """ proxies = {} # in order to prefer lowercase variables, process environment in # two passes: first matches any, second pass matches lowercase only for name, value in os.environ.items(): name = name.lower() if value and name[-6:] == '_proxy': proxies[name[:-6]] = value # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY # (non-all-lowercase) as it may be set from the web server by a "Proxy:" # header from the client # If "proxy" is lowercase, it will still be used thanks to the next block if 'REQUEST_METHOD' in os.environ: proxies.pop('http', None) for name, value in os.environ.items(): if name[-6:] == '_proxy': name = name.lower() if value: proxies[name[:-6]] = value else: proxies.pop(name[:-6], None) return proxies def proxy_bypass_environment(host, proxies=None): """Test if proxies should not be used for a particular host. Checks the proxy dict for the value of no_proxy, which should be a list of comma separated DNS suffixes, or '*' for all hosts. """ if proxies is None: proxies = getproxies_environment() # don't bypass, if no_proxy isn't specified try: no_proxy = proxies['no'] except KeyError: return 0 # '*' is special case for always bypass if no_proxy == '*': return 1 # strip port off host hostonly, port = splitport(host) # check if the host ends with any of the DNS suffixes no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')] for name in no_proxy_list: if name: name = name.lstrip('.') # ignore leading dots name = re.escape(name) pattern = r'(.+\.)?%s$' % name if (re.match(pattern, hostonly, re.I) or re.match(pattern, host, re.I)): return 1 # otherwise, don't bypass return 0 # This code tests an OSX specific data structure but is testable on all # platforms def _proxy_bypass_macosx_sysconf(host, proxy_settings): """ Return True iff this host shouldn't be accessed using a proxy This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. proxy_settings come from _scproxy._get_proxy_settings or get mocked ie: { 'exclude_simple': bool, 'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16'] } """ from fnmatch import fnmatch hostonly, port = splitport(host) def ip2num(ipAddr): parts = ipAddr.split('.') parts = list(map(int, parts)) if len(parts) != 4: parts = (parts + [0, 0, 0, 0])[:4] return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3] # Check for simple host names: if '.' not in host: if proxy_settings['exclude_simple']: return True hostIP = None for value in proxy_settings.get('exceptions', ()): # Items in the list are strings like these: *.local, 169.254/16 if not value: continue m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value) if m is not None: if hostIP is None: try: hostIP = socket.gethostbyname(hostonly) hostIP = ip2num(hostIP) except OSError: continue base = ip2num(m.group(1)) mask = m.group(2) if mask is None: mask = 8 * (m.group(1).count('.') + 1) else: mask = int(mask[1:]) mask = 32 - mask if (hostIP >> mask) == (base >> mask): return True elif fnmatch(host, value): return True return False getproxies = getproxies_environment proxy_bypass = proxy_bypass_environment
95,206
2,618
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/__init__.py
0
1
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/urllib/error.py
"""Exception classes raised by urllib. The base exception class is URLError, which inherits from OSError. It doesn't define any behavior of its own, but is the base class for all exceptions defined in this package. HTTPError is an exception class that is also a valid HTTP response instance. It behaves this way because HTTP protocol errors are valid responses, with a status code, headers, and a body. In some contexts, an application may want to handle an exception like a regular response. """ import urllib.response __all__ = ['URLError', 'HTTPError', 'ContentTooShortError'] class URLError(OSError): # URLError is a sub-type of OSError, but it doesn't share any of # the implementation. need to override __init__ and __str__. # It sets self.args for compatibility with other EnvironmentError # subclasses, but args doesn't have the typical format with errno in # slot 0 and strerror in slot 1. This may be better than nothing. def __init__(self, reason, filename=None): self.args = reason, self.reason = reason if filename is not None: self.filename = filename def __str__(self): return '<urlopen error %s>' % self.reason class HTTPError(URLError, urllib.response.addinfourl): """Raised when HTTP error occurs, but also acts like non-error return""" __super_init = urllib.response.addinfourl.__init__ def __init__(self, url, code, msg, hdrs, fp): self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp self.filename = url # The addinfourl classes depend on fp being a valid file # object. In some cases, the HTTPError may not have a valid # file object. If this happens, the simplest workaround is to # not initialize the base classes. if fp is not None: self.__super_init(fp, hdrs, url, code) def __str__(self): return 'HTTP Error %s: %s' % (self.code, self.msg) def __repr__(self): return '<HTTPError %s: %r>' % (self.code, self.msg) # since URLError specifies a .reason attribute, HTTPError should also # provide this attribute. See issue13211 for discussion. @property def reason(self): return self.msg @property def headers(self): return self.hdrs @headers.setter def headers(self, headers): self.hdrs = headers class ContentTooShortError(URLError): """Exception raised when downloaded size does not match content-length.""" def __init__(self, message, content): URLError.__init__(self, message) self.content = content
2,641
78
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/EUC-JISX0213.TXT
00 0000 01 0001 02 0002 03 0003 04 0004 05 0005 06 0006 07 0007 08 0008 09 0009 0A 000A 0B 000B 0C 000C 0D 000D 0E 000E 0F 000F 10 0010 11 0011 12 0012 13 0013 14 0014 15 0015 16 0016 17 0017 18 0018 19 0019 1A 001A 1B 001B 1C 001C 1D 001D 1E 001E 1F 001F 20 0020 21 0021 22 0022 23 0023 24 0024 25 0025 26 0026 27 0027 28 0028 29 0029 2A 002A 2B 002B 2C 002C 2D 002D 2E 002E 2F 002F 30 0030 31 0031 32 0032 33 0033 34 0034 35 0035 36 0036 37 0037 38 0038 39 0039 3A 003A 3B 003B 3C 003C 3D 003D 3E 003E 3F 003F 40 0040 41 0041 42 0042 43 0043 44 0044 45 0045 46 0046 47 0047 48 0048 49 0049 4A 004A 4B 004B 4C 004C 4D 004D 4E 004E 4F 004F 50 0050 51 0051 52 0052 53 0053 54 0054 55 0055 56 0056 57 0057 58 0058 59 0059 5A 005A 5B 005B 5C 005C 5D 005D 5E 005E 5F 005F 60 0060 61 0061 62 0062 63 0063 64 0064 65 0065 66 0066 67 0067 68 0068 69 0069 6A 006A 6B 006B 6C 006C 6D 006D 6E 006E 6F 006F 70 0070 71 0071 72 0072 73 0073 74 0074 75 0075 76 0076 77 0077 78 0078 79 0079 7A 007A 7B 007B 7C 007C 7D 007D 7E 007E 7F 007F 8EA1 FF61 8EA2 FF62 8EA3 FF63 8EA4 FF64 8EA5 FF65 8EA6 FF66 8EA7 FF67 8EA8 FF68 8EA9 FF69 8EAA FF6A 8EAB FF6B 8EAC FF6C 8EAD FF6D 8EAE FF6E 8EAF FF6F 8EB0 FF70 8EB1 FF71 8EB2 FF72 8EB3 FF73 8EB4 FF74 8EB5 FF75 8EB6 FF76 8EB7 FF77 8EB8 FF78 8EB9 FF79 8EBA FF7A 8EBB FF7B 8EBC FF7C 8EBD FF7D 8EBE FF7E 8EBF FF7F 8EC0 FF80 8EC1 FF81 8EC2 FF82 8EC3 FF83 8EC4 FF84 8EC5 FF85 8EC6 FF86 8EC7 FF87 8EC8 FF88 8EC9 FF89 8ECA FF8A 8ECB FF8B 8ECC FF8C 8ECD FF8D 8ECE FF8E 8ECF FF8F 8ED0 FF90 8ED1 FF91 8ED2 FF92 8ED3 FF93 8ED4 FF94 8ED5 FF95 8ED6 FF96 8ED7 FF97 8ED8 FF98 8ED9 FF99 8EDA FF9A 8EDB FF9B 8EDC FF9C 8EDD FF9D 8EDE FF9E 8EDF FF9F 8FA1A1 20089 8FA1A2 4E02 8FA1A3 4E0F 8FA1A4 4E12 8FA1A5 4E29 8FA1A6 4E2B 8FA1A7 4E2E 8FA1A8 4E40 8FA1A9 4E47 8FA1AA 4E48 8FA1AB 200A2 8FA1AC 4E51 8FA1AD 3406 8FA1AE 200A4 8FA1AF 4E5A 8FA1B0 4E69 8FA1B1 4E9D 8FA1B2 342C 8FA1B3 342E 8FA1B4 4EB9 8FA1B5 4EBB 8FA1B6 201A2 8FA1B7 4EBC 8FA1B8 4EC3 8FA1B9 4EC8 8FA1BA 4ED0 8FA1BB 4EEB 8FA1BC 4EDA 8FA1BD 4EF1 8FA1BE 4EF5 8FA1BF 4F00 8FA1C0 4F16 8FA1C1 4F64 8FA1C2 4F37 8FA1C3 4F3E 8FA1C4 4F54 8FA1C5 4F58 8FA1C6 20213 8FA1C7 4F77 8FA1C8 4F78 8FA1C9 4F7A 8FA1CA 4F7D 8FA1CB 4F82 8FA1CC 4F85 8FA1CD 4F92 8FA1CE 4F9A 8FA1CF 4FE6 8FA1D0 4FB2 8FA1D1 4FBE 8FA1D2 4FC5 8FA1D3 4FCB 8FA1D4 4FCF 8FA1D5 4FD2 8FA1D6 346A 8FA1D7 4FF2 8FA1D8 5000 8FA1D9 5010 8FA1DA 5013 8FA1DB 501C 8FA1DC 501E 8FA1DD 5022 8FA1DE 3468 8FA1DF 5042 8FA1E0 5046 8FA1E1 504E 8FA1E2 5053 8FA1E3 5057 8FA1E4 5063 8FA1E5 5066 8FA1E6 506A 8FA1E7 5070 8FA1E8 50A3 8FA1E9 5088 8FA1EA 5092 8FA1EB 5093 8FA1EC 5095 8FA1ED 5096 8FA1EE 509C 8FA1EF 50AA 8FA1F0 2032B 8FA1F1 50B1 8FA1F2 50BA 8FA1F3 50BB 8FA1F4 50C4 8FA1F5 50C7 8FA1F6 50F3 8FA1F7 20381 8FA1F8 50CE 8FA1F9 20371 8FA1FA 50D4 8FA1FB 50D9 8FA1FC 50E1 8FA1FD 50E9 8FA1FE 3492 8FA3A1 5108 8FA3A2 203F9 8FA3A3 5117 8FA3A4 511B 8FA3A5 2044A 8FA3A6 5160 8FA3A7 20509 8FA3A8 5173 8FA3A9 5183 8FA3AA 518B 8FA3AB 34BC 8FA3AC 5198 8FA3AD 51A3 8FA3AE 51AD 8FA3AF 34C7 8FA3B0 51BC 8FA3B1 205D6 8FA3B2 20628 8FA3B3 51F3 8FA3B4 51F4 8FA3B5 5202 8FA3B6 5212 8FA3B7 5216 8FA3B8 2074F 8FA3B9 5255 8FA3BA 525C 8FA3BB 526C 8FA3BC 5277 8FA3BD 5284 8FA3BE 5282 8FA3BF 20807 8FA3C0 5298 8FA3C1 2083A 8FA3C2 52A4 8FA3C3 52A6 8FA3C4 52AF 8FA3C5 52BA 8FA3C6 52BB 8FA3C7 52CA 8FA3C8 351F 8FA3C9 52D1 8FA3CA 208B9 8FA3CB 52F7 8FA3CC 530A 8FA3CD 530B 8FA3CE 5324 8FA3CF 5335 8FA3D0 533E 8FA3D1 5342 8FA3D2 2097C 8FA3D3 2099D 8FA3D4 5367 8FA3D5 536C 8FA3D6 537A 8FA3D7 53A4 8FA3D8 53B4 8FA3D9 20AD3 8FA3DA 53B7 8FA3DB 53C0 8FA3DC 20B1D 8FA3DD 355D 8FA3DE 355E 8FA3DF 53D5 8FA3E0 53DA 8FA3E1 3563 8FA3E2 53F4 8FA3E3 53F5 8FA3E4 5455 8FA3E5 5424 8FA3E6 5428 8FA3E7 356E 8FA3E8 5443 8FA3E9 5462 8FA3EA 5466 8FA3EB 546C 8FA3EC 548A 8FA3ED 548D 8FA3EE 5495 8FA3EF 54A0 8FA3F0 54A6 8FA3F1 54AD 8FA3F2 54AE 8FA3F3 54B7 8FA3F4 54BA 8FA3F5 54BF 8FA3F6 54C3 8FA3F7 20D45 8FA3F8 54EC 8FA3F9 54EF 8FA3FA 54F1 8FA3FB 54F3 8FA3FC 5500 8FA3FD 5501 8FA3FE 5509 8FA4A1 553C 8FA4A2 5541 8FA4A3 35A6 8FA4A4 5547 8FA4A5 554A 8FA4A6 35A8 8FA4A7 5560 8FA4A8 5561 8FA4A9 5564 8FA4AA 20DE1 8FA4AB 557D 8FA4AC 5582 8FA4AD 5588 8FA4AE 5591 8FA4AF 35C5 8FA4B0 55D2 8FA4B1 20E95 8FA4B2 20E6D 8FA4B3 55BF 8FA4B4 55C9 8FA4B5 55CC 8FA4B6 55D1 8FA4B7 55DD 8FA4B8 35DA 8FA4B9 55E2 8FA4BA 20E64 8FA4BB 55E9 8FA4BC 5628 8FA4BD 20F5F 8FA4BE 5607 8FA4BF 5610 8FA4C0 5630 8FA4C1 5637 8FA4C2 35F4 8FA4C3 563D 8FA4C4 563F 8FA4C5 5640 8FA4C6 5647 8FA4C7 565E 8FA4C8 5660 8FA4C9 566D 8FA4CA 3605 8FA4CB 5688 8FA4CC 568C 8FA4CD 5695 8FA4CE 569A 8FA4CF 569D 8FA4D0 56A8 8FA4D1 56AD 8FA4D2 56B2 8FA4D3 56C5 8FA4D4 56CD 8FA4D5 56DF 8FA4D6 56E8 8FA4D7 56F6 8FA4D8 56F7 8FA4D9 21201 8FA4DA 5715 8FA4DB 5723 8FA4DC 21255 8FA4DD 5729 8FA4DE 2127B 8FA4DF 5745 8FA4E0 5746 8FA4E1 574C 8FA4E2 574D 8FA4E3 21274 8FA4E4 5768 8FA4E5 576F 8FA4E6 5773 8FA4E7 5774 8FA4E8 5775 8FA4E9 577B 8FA4EA 212E4 8FA4EB 212D7 8FA4EC 57AC 8FA4ED 579A 8FA4EE 579D 8FA4EF 579E 8FA4F0 57A8 8FA4F1 57D7 8FA4F2 212FD 8FA4F3 57CC 8FA4F4 21336 8FA4F5 21344 8FA4F6 57DE 8FA4F7 57E6 8FA4F8 57F0 8FA4F9 364A 8FA4FA 57F8 8FA4FB 57FB 8FA4FC 57FD 8FA4FD 5804 8FA4FE 581E 8FA5A1 5820 8FA5A2 5827 8FA5A3 5832 8FA5A4 5839 8FA5A5 213C4 8FA5A6 5849 8FA5A7 584C 8FA5A8 5867 8FA5A9 588A 8FA5AA 588B 8FA5AB 588D 8FA5AC 588F 8FA5AD 5890 8FA5AE 5894 8FA5AF 589D 8FA5B0 58AA 8FA5B1 58B1 8FA5B2 2146D 8FA5B3 58C3 8FA5B4 58CD 8FA5B5 58E2 8FA5B6 58F3 8FA5B7 58F4 8FA5B8 5905 8FA5B9 5906 8FA5BA 590B 8FA5BB 590D 8FA5BC 5914 8FA5BD 5924 8FA5BE 215D7 8FA5BF 3691 8FA5C0 593D 8FA5C1 3699 8FA5C2 5946 8FA5C3 3696 8FA5C4 26C29 8FA5C5 595B 8FA5C6 595F 8FA5C7 21647 8FA5C8 5975 8FA5C9 5976 8FA5CA 597C 8FA5CB 599F 8FA5CC 59AE 8FA5CD 59BC 8FA5CE 59C8 8FA5CF 59CD 8FA5D0 59DE 8FA5D1 59E3 8FA5D2 59E4 8FA5D3 59E7 8FA5D4 59EE 8FA5D5 21706 8FA5D6 21742 8FA5D7 36CF 8FA5D8 5A0C 8FA5D9 5A0D 8FA5DA 5A17 8FA5DB 5A27 8FA5DC 5A2D 8FA5DD 5A55 8FA5DE 5A65 8FA5DF 5A7A 8FA5E0 5A8B 8FA5E1 5A9C 8FA5E2 5A9F 8FA5E3 5AA0 8FA5E4 5AA2 8FA5E5 5AB1 8FA5E6 5AB3 8FA5E7 5AB5 8FA5E8 5ABA 8FA5E9 5ABF 8FA5EA 5ADA 8FA5EB 5ADC 8FA5EC 5AE0 8FA5ED 5AE5 8FA5EE 5AF0 8FA5EF 5AEE 8FA5F0 5AF5 8FA5F1 5B00 8FA5F2 5B08 8FA5F3 5B17 8FA5F4 5B34 8FA5F5 5B2D 8FA5F6 5B4C 8FA5F7 5B52 8FA5F8 5B68 8FA5F9 5B6F 8FA5FA 5B7C 8FA5FB 5B7F 8FA5FC 5B81 8FA5FD 5B84 8FA5FE 219C3 8FA8A1 5B96 8FA8A2 5BAC 8FA8A3 3761 8FA8A4 5BC0 8FA8A5 3762 8FA8A6 5BCE 8FA8A7 5BD6 8FA8A8 376C 8FA8A9 376B 8FA8AA 5BF1 8FA8AB 5BFD 8FA8AC 3775 8FA8AD 5C03 8FA8AE 5C29 8FA8AF 5C30 8FA8B0 21C56 8FA8B1 5C5F 8FA8B2 5C63 8FA8B3 5C67 8FA8B4 5C68 8FA8B5 5C69 8FA8B6 5C70 8FA8B7 21D2D 8FA8B8 21D45 8FA8B9 5C7C 8FA8BA 21D78 8FA8BB 21D62 8FA8BC 5C88 8FA8BD 5C8A 8FA8BE 37C1 8FA8BF 21DA1 8FA8C0 21D9C 8FA8C1 5CA0 8FA8C2 5CA2 8FA8C3 5CA6 8FA8C4 5CA7 8FA8C5 21D92 8FA8C6 5CAD 8FA8C7 5CB5 8FA8C8 21DB7 8FA8C9 5CC9 8FA8CA 21DE0 8FA8CB 21E33 8FA8CC 5D06 8FA8CD 5D10 8FA8CE 5D2B 8FA8CF 5D1D 8FA8D0 5D20 8FA8D1 5D24 8FA8D2 5D26 8FA8D3 5D31 8FA8D4 5D39 8FA8D5 5D42 8FA8D6 37E8 8FA8D7 5D61 8FA8D8 5D6A 8FA8D9 37F4 8FA8DA 5D70 8FA8DB 21F1E 8FA8DC 37FD 8FA8DD 5D88 8FA8DE 3800 8FA8DF 5D92 8FA8E0 5D94 8FA8E1 5D97 8FA8E2 5D99 8FA8E3 5DB0 8FA8E4 5DB2 8FA8E5 5DB4 8FA8E6 21F76 8FA8E7 5DB9 8FA8E8 5DD1 8FA8E9 5DD7 8FA8EA 5DD8 8FA8EB 5DE0 8FA8EC 21FFA 8FA8ED 5DE4 8FA8EE 5DE9 8FA8EF 382F 8FA8F0 5E00 8FA8F1 3836 8FA8F2 5E12 8FA8F3 5E15 8FA8F4 3840 8FA8F5 5E1F 8FA8F6 5E2E 8FA8F7 5E3E 8FA8F8 5E49 8FA8F9 385C 8FA8FA 5E56 8FA8FB 3861 8FA8FC 5E6B 8FA8FD 5E6C 8FA8FE 5E6D 8FACA1 5E6E 8FACA2 2217B 8FACA3 5EA5 8FACA4 5EAA 8FACA5 5EAC 8FACA6 5EB9 8FACA7 5EBF 8FACA8 5EC6 8FACA9 5ED2 8FACAA 5ED9 8FACAB 2231E 8FACAC 5EFD 8FACAD 5F08 8FACAE 5F0E 8FACAF 5F1C 8FACB0 223AD 8FACB1 5F1E 8FACB2 5F47 8FACB3 5F63 8FACB4 5F72 8FACB5 5F7E 8FACB6 5F8F 8FACB7 5FA2 8FACB8 5FA4 8FACB9 5FB8 8FACBA 5FC4 8FACBB 38FA 8FACBC 5FC7 8FACBD 5FCB 8FACBE 5FD2 8FACBF 5FD3 8FACC0 5FD4 8FACC1 5FE2 8FACC2 5FEE 8FACC3 5FEF 8FACC4 5FF3 8FACC5 5FFC 8FACC6 3917 8FACC7 6017 8FACC8 6022 8FACC9 6024 8FACCA 391A 8FACCB 604C 8FACCC 607F 8FACCD 608A 8FACCE 6095 8FACCF 60A8 8FACD0 226F3 8FACD1 60B0 8FACD2 60B1 8FACD3 60BE 8FACD4 60C8 8FACD5 60D9 8FACD6 60DB 8FACD7 60EE 8FACD8 60F2 8FACD9 60F5 8FACDA 6110 8FACDB 6112 8FACDC 6113 8FACDD 6119 8FACDE 611E 8FACDF 613A 8FACE0 396F 8FACE1 6141 8FACE2 6146 8FACE3 6160 8FACE4 617C 8FACE5 2285B 8FACE6 6192 8FACE7 6193 8FACE8 6197 8FACE9 6198 8FACEA 61A5 8FACEB 61A8 8FACEC 61AD 8FACED 228AB 8FACEE 61D5 8FACEF 61DD 8FACF0 61DF 8FACF1 61F5 8FACF2 2298F 8FACF3 6215 8FACF4 6223 8FACF5 6229 8FACF6 6246 8FACF7 624C 8FACF8 6251 8FACF9 6252 8FACFA 6261 8FACFB 6264 8FACFC 627B 8FACFD 626D 8FACFE 6273 8FADA1 6299 8FADA2 62A6 8FADA3 62D5 8FADA4 22AB8 8FADA5 62FD 8FADA6 6303 8FADA7 630D 8FADA8 6310 8FADA9 22B4F 8FADAA 22B50 8FADAB 6332 8FADAC 6335 8FADAD 633B 8FADAE 633C 8FADAF 6341 8FADB0 6344 8FADB1 634E 8FADB2 22B46 8FADB3 6359 8FADB4 22C1D 8FADB5 22BA6 8FADB6 636C 8FADB7 6384 8FADB8 6399 8FADB9 22C24 8FADBA 6394 8FADBB 63BD 8FADBC 63F7 8FADBD 63D4 8FADBE 63D5 8FADBF 63DC 8FADC0 63E0 8FADC1 63EB 8FADC2 63EC 8FADC3 63F2 8FADC4 6409 8FADC5 641E 8FADC6 6425 8FADC7 6429 8FADC8 642F 8FADC9 645A 8FADCA 645B 8FADCB 645D 8FADCC 6473 8FADCD 647D 8FADCE 6487 8FADCF 6491 8FADD0 649D 8FADD1 649F 8FADD2 64CB 8FADD3 64CC 8FADD4 64D5 8FADD5 64D7 8FADD6 22DE1 8FADD7 64E4 8FADD8 64E5 8FADD9 64FF 8FADDA 6504 8FADDB 3A6E 8FADDC 650F 8FADDD 6514 8FADDE 6516 8FADDF 3A73 8FADE0 651E 8FADE1 6532 8FADE2 6544 8FADE3 6554 8FADE4 656B 8FADE5 657A 8FADE6 6581 8FADE7 6584 8FADE8 6585 8FADE9 658A 8FADEA 65B2 8FADEB 65B5 8FADEC 65B8 8FADED 65BF 8FADEE 65C2 8FADEF 65C9 8FADF0 65D4 8FADF1 3AD6 8FADF2 65F2 8FADF3 65F9 8FADF4 65FC 8FADF5 6604 8FADF6 6608 8FADF7 6621 8FADF8 662A 8FADF9 6645 8FADFA 6651 8FADFB 664E 8FADFC 3AEA 8FADFD 231C3 8FADFE 6657 8FAEA1 665B 8FAEA2 6663 8FAEA3 231F5 8FAEA4 231B6 8FAEA5 666A 8FAEA6 666B 8FAEA7 666C 8FAEA8 666D 8FAEA9 667B 8FAEAA 6680 8FAEAB 6690 8FAEAC 6692 8FAEAD 6699 8FAEAE 3B0E 8FAEAF 66AD 8FAEB0 66B1 8FAEB1 66B5 8FAEB2 3B1A 8FAEB3 66BF 8FAEB4 3B1C 8FAEB5 66EC 8FAEB6 3AD7 8FAEB7 6701 8FAEB8 6705 8FAEB9 6712 8FAEBA 23372 8FAEBB 6719 8FAEBC 233D3 8FAEBD 233D2 8FAEBE 674C 8FAEBF 674D 8FAEC0 6754 8FAEC1 675D 8FAEC2 233D0 8FAEC3 233E4 8FAEC4 233D5 8FAEC5 6774 8FAEC6 6776 8FAEC7 233DA 8FAEC8 6792 8FAEC9 233DF 8FAECA 8363 8FAECB 6810 8FAECC 67B0 8FAECD 67B2 8FAECE 67C3 8FAECF 67C8 8FAED0 67D2 8FAED1 67D9 8FAED2 67DB 8FAED3 67F0 8FAED4 67F7 8FAED5 2344A 8FAED6 23451 8FAED7 2344B 8FAED8 6818 8FAED9 681F 8FAEDA 682D 8FAEDB 23465 8FAEDC 6833 8FAEDD 683B 8FAEDE 683E 8FAEDF 6844 8FAEE0 6845 8FAEE1 6849 8FAEE2 684C 8FAEE3 6855 8FAEE4 6857 8FAEE5 3B77 8FAEE6 686B 8FAEE7 686E 8FAEE8 687A 8FAEE9 687C 8FAEEA 6882 8FAEEB 6890 8FAEEC 6896 8FAEED 3B6D 8FAEEE 6898 8FAEEF 6899 8FAEF0 689A 8FAEF1 689C 8FAEF2 68AA 8FAEF3 68AB 8FAEF4 68B4 8FAEF5 68BB 8FAEF6 68FB 8FAEF7 234E4 8FAEF8 2355A 8FAEF9 FA13 8FAEFA 68C3 8FAEFB 68C5 8FAEFC 68CC 8FAEFD 68CF 8FAEFE 68D6 8FAFA1 68D9 8FAFA2 68E4 8FAFA3 68E5 8FAFA4 68EC 8FAFA5 68F7 8FAFA6 6903 8FAFA7 6907 8FAFA8 3B87 8FAFA9 3B88 8FAFAA 23594 8FAFAB 693B 8FAFAC 3B8D 8FAFAD 6946 8FAFAE 6969 8FAFAF 696C 8FAFB0 6972 8FAFB1 697A 8FAFB2 697F 8FAFB3 6992 8FAFB4 3BA4 8FAFB5 6996 8FAFB6 6998 8FAFB7 69A6 8FAFB8 69B0 8FAFB9 69B7 8FAFBA 69BA 8FAFBB 69BC 8FAFBC 69C0 8FAFBD 69D1 8FAFBE 69D6 8FAFBF 23639 8FAFC0 23647 8FAFC1 6A30 8FAFC2 23638 8FAFC3 2363A 8FAFC4 69E3 8FAFC5 69EE 8FAFC6 69EF 8FAFC7 69F3 8FAFC8 3BCD 8FAFC9 69F4 8FAFCA 69FE 8FAFCB 6A11 8FAFCC 6A1A 8FAFCD 6A1D 8FAFCE 2371C 8FAFCF 6A32 8FAFD0 6A33 8FAFD1 6A34 8FAFD2 6A3F 8FAFD3 6A46 8FAFD4 6A49 8FAFD5 6A7A 8FAFD6 6A4E 8FAFD7 6A52 8FAFD8 6A64 8FAFD9 2370C 8FAFDA 6A7E 8FAFDB 6A83 8FAFDC 6A8B 8FAFDD 3BF0 8FAFDE 6A91 8FAFDF 6A9F 8FAFE0 6AA1 8FAFE1 23764 8FAFE2 6AAB 8FAFE3 6ABD 8FAFE4 6AC6 8FAFE5 6AD4 8FAFE6 6AD0 8FAFE7 6ADC 8FAFE8 6ADD 8FAFE9 237FF 8FAFEA 237E7 8FAFEB 6AEC 8FAFEC 6AF1 8FAFED 6AF2 8FAFEE 6AF3 8FAFEF 6AFD 8FAFF0 23824 8FAFF1 6B0B 8FAFF2 6B0F 8FAFF3 6B10 8FAFF4 6B11 8FAFF5 2383D 8FAFF6 6B17 8FAFF7 3C26 8FAFF8 6B2F 8FAFF9 6B4A 8FAFFA 6B58 8FAFFB 6B6C 8FAFFC 6B75 8FAFFD 6B7A 8FAFFE 6B81 8FEEA1 6B9B 8FEEA2 6BAE 8FEEA3 23A98 8FEEA4 6BBD 8FEEA5 6BBE 8FEEA6 6BC7 8FEEA7 6BC8 8FEEA8 6BC9 8FEEA9 6BDA 8FEEAA 6BE6 8FEEAB 6BE7 8FEEAC 6BEE 8FEEAD 6BF1 8FEEAE 6C02 8FEEAF 6C0A 8FEEB0 6C0E 8FEEB1 6C35 8FEEB2 6C36 8FEEB3 6C3A 8FEEB4 23C7F 8FEEB5 6C3F 8FEEB6 6C4D 8FEEB7 6C5B 8FEEB8 6C6D 8FEEB9 6C84 8FEEBA 6C89 8FEEBB 3CC3 8FEEBC 6C94 8FEEBD 6C95 8FEEBE 6C97 8FEEBF 6CAD 8FEEC0 6CC2 8FEEC1 6CD0 8FEEC2 3CD2 8FEEC3 6CD6 8FEEC4 6CDA 8FEEC5 6CDC 8FEEC6 6CE9 8FEEC7 6CEC 8FEEC8 6CED 8FEEC9 23D00 8FEECA 6D00 8FEECB 6D0A 8FEECC 6D24 8FEECD 6D26 8FEECE 6D27 8FEECF 6C67 8FEED0 6D2F 8FEED1 6D3C 8FEED2 6D5B 8FEED3 6D5E 8FEED4 6D60 8FEED5 6D70 8FEED6 6D80 8FEED7 6D81 8FEED8 6D8A 8FEED9 6D8D 8FEEDA 6D91 8FEEDB 6D98 8FEEDC 23D40 8FEEDD 6E17 8FEEDE 23DFA 8FEEDF 23DF9 8FEEE0 23DD3 8FEEE1 6DAB 8FEEE2 6DAE 8FEEE3 6DB4 8FEEE4 6DC2 8FEEE5 6D34 8FEEE6 6DC8 8FEEE7 6DCE 8FEEE8 6DCF 8FEEE9 6DD0 8FEEEA 6DDF 8FEEEB 6DE9 8FEEEC 6DF6 8FEEED 6E36 8FEEEE 6E1E 8FEEEF 6E22 8FEEF0 6E27 8FEEF1 3D11 8FEEF2 6E32 8FEEF3 6E3C 8FEEF4 6E48 8FEEF5 6E49 8FEEF6 6E4B 8FEEF7 6E4C 8FEEF8 6E4F 8FEEF9 6E51 8FEEFA 6E53 8FEEFB 6E54 8FEEFC 6E57 8FEEFD 6E63 8FEEFE 3D1E 8FEFA1 6E93 8FEFA2 6EA7 8FEFA3 6EB4 8FEFA4 6EBF 8FEFA5 6EC3 8FEFA6 6ECA 8FEFA7 6ED9 8FEFA8 6F35 8FEFA9 6EEB 8FEFAA 6EF9 8FEFAB 6EFB 8FEFAC 6F0A 8FEFAD 6F0C 8FEFAE 6F18 8FEFAF 6F25 8FEFB0 6F36 8FEFB1 6F3C 8FEFB2 23F7E 8FEFB3 6F52 8FEFB4 6F57 8FEFB5 6F5A 8FEFB6 6F60 8FEFB7 6F68 8FEFB8 6F98 8FEFB9 6F7D 8FEFBA 6F90 8FEFBB 6F96 8FEFBC 6FBE 8FEFBD 6F9F 8FEFBE 6FA5 8FEFBF 6FAF 8FEFC0 3D64 8FEFC1 6FB5 8FEFC2 6FC8 8FEFC3 6FC9 8FEFC4 6FDA 8FEFC5 6FDE 8FEFC6 6FE9 8FEFC7 24096 8FEFC8 6FFC 8FEFC9 7000 8FEFCA 7007 8FEFCB 700A 8FEFCC 7023 8FEFCD 24103 8FEFCE 7039 8FEFCF 703A 8FEFD0 703C 8FEFD1 7043 8FEFD2 7047 8FEFD3 704B 8FEFD4 3D9A 8FEFD5 7054 8FEFD6 7065 8FEFD7 7069 8FEFD8 706C 8FEFD9 706E 8FEFDA 7076 8FEFDB 707E 8FEFDC 7081 8FEFDD 7086 8FEFDE 7095 8FEFDF 7097 8FEFE0 70BB 8FEFE1 241C6 8FEFE2 709F 8FEFE3 70B1 8FEFE4 241FE 8FEFE5 70EC 8FEFE6 70CA 8FEFE7 70D1 8FEFE8 70D3 8FEFE9 70DC 8FEFEA 7103 8FEFEB 7104 8FEFEC 7106 8FEFED 7107 8FEFEE 7108 8FEFEF 710C 8FEFF0 3DC0 8FEFF1 712F 8FEFF2 7131 8FEFF3 7150 8FEFF4 714A 8FEFF5 7153 8FEFF6 715E 8FEFF7 3DD4 8FEFF8 7196 8FEFF9 7180 8FEFFA 719B 8FEFFB 71A0 8FEFFC 71A2 8FEFFD 71AE 8FEFFE 71AF 8FF0A1 71B3 8FF0A2 243BC 8FF0A3 71CB 8FF0A4 71D3 8FF0A5 71D9 8FF0A6 71DC 8FF0A7 7207 8FF0A8 3E05 8FF0A9 FA49 8FF0AA 722B 8FF0AB 7234 8FF0AC 7238 8FF0AD 7239 8FF0AE 4E2C 8FF0AF 7242 8FF0B0 7253 8FF0B1 7257 8FF0B2 7263 8FF0B3 24629 8FF0B4 726E 8FF0B5 726F 8FF0B6 7278 8FF0B7 727F 8FF0B8 728E 8FF0B9 246A5 8FF0BA 72AD 8FF0BB 72AE 8FF0BC 72B0 8FF0BD 72B1 8FF0BE 72C1 8FF0BF 3E60 8FF0C0 72CC 8FF0C1 3E66 8FF0C2 3E68 8FF0C3 72F3 8FF0C4 72FA 8FF0C5 7307 8FF0C6 7312 8FF0C7 7318 8FF0C8 7319 8FF0C9 3E83 8FF0CA 7339 8FF0CB 732C 8FF0CC 7331 8FF0CD 7333 8FF0CE 733D 8FF0CF 7352 8FF0D0 3E94 8FF0D1 736B 8FF0D2 736C 8FF0D3 24896 8FF0D4 736E 8FF0D5 736F 8FF0D6 7371 8FF0D7 7377 8FF0D8 7381 8FF0D9 7385 8FF0DA 738A 8FF0DB 7394 8FF0DC 7398 8FF0DD 739C 8FF0DE 739E 8FF0DF 73A5 8FF0E0 73A8 8FF0E1 73B5 8FF0E2 73B7 8FF0E3 73B9 8FF0E4 73BC 8FF0E5 73BF 8FF0E6 73C5 8FF0E7 73CB 8FF0E8 73E1 8FF0E9 73E7 8FF0EA 73F9 8FF0EB 7413 8FF0EC 73FA 8FF0ED 7401 8FF0EE 7424 8FF0EF 7431 8FF0F0 7439 8FF0F1 7453 8FF0F2 7440 8FF0F3 7443 8FF0F4 744D 8FF0F5 7452 8FF0F6 745D 8FF0F7 7471 8FF0F8 7481 8FF0F9 7485 8FF0FA 7488 8FF0FB 24A4D 8FF0FC 7492 8FF0FD 7497 8FF0FE 7499 8FF1A1 74A0 8FF1A2 74A1 8FF1A3 74A5 8FF1A4 74AA 8FF1A5 74AB 8FF1A6 74B9 8FF1A7 74BB 8FF1A8 74BA 8FF1A9 74D6 8FF1AA 74D8 8FF1AB 74DE 8FF1AC 74EF 8FF1AD 74EB 8FF1AE 24B56 8FF1AF 74FA 8FF1B0 24B6F 8FF1B1 7520 8FF1B2 7524 8FF1B3 752A 8FF1B4 3F57 8FF1B5 24C16 8FF1B6 753D 8FF1B7 753E 8FF1B8 7540 8FF1B9 7548 8FF1BA 754E 8FF1BB 7550 8FF1BC 7552 8FF1BD 756C 8FF1BE 7572 8FF1BF 7571 8FF1C0 757A 8FF1C1 757D 8FF1C2 757E 8FF1C3 7581 8FF1C4 24D14 8FF1C5 758C 8FF1C6 3F75 8FF1C7 75A2 8FF1C8 3F77 8FF1C9 75B0 8FF1CA 75B7 8FF1CB 75BF 8FF1CC 75C0 8FF1CD 75C6 8FF1CE 75CF 8FF1CF 75D3 8FF1D0 75DD 8FF1D1 75DF 8FF1D2 75E0 8FF1D3 75E7 8FF1D4 75EC 8FF1D5 75EE 8FF1D6 75F1 8FF1D7 75F9 8FF1D8 7603 8FF1D9 7618 8FF1DA 7607 8FF1DB 760F 8FF1DC 3FAE 8FF1DD 24E0E 8FF1DE 7613 8FF1DF 761B 8FF1E0 761C 8FF1E1 24E37 8FF1E2 7625 8FF1E3 7628 8FF1E4 763C 8FF1E5 7633 8FF1E6 24E6A 8FF1E7 3FC9 8FF1E8 7641 8FF1E9 24E8B 8FF1EA 7649 8FF1EB 7655 8FF1EC 3FD7 8FF1ED 766E 8FF1EE 7695 8FF1EF 769C 8FF1F0 76A1 8FF1F1 76A0 8FF1F2 76A7 8FF1F3 76A8 8FF1F4 76AF 8FF1F5 2504A 8FF1F6 76C9 8FF1F7 25055 8FF1F8 76E8 8FF1F9 76EC 8FF1FA 25122 8FF1FB 7717 8FF1FC 771A 8FF1FD 772D 8FF1FE 7735 8FF2A1 251A9 8FF2A2 4039 8FF2A3 251E5 8FF2A4 251CD 8FF2A5 7758 8FF2A6 7760 8FF2A7 776A 8FF2A8 2521E 8FF2A9 7772 8FF2AA 777C 8FF2AB 777D 8FF2AC 2524C 8FF2AD 4058 8FF2AE 779A 8FF2AF 779F 8FF2B0 77A2 8FF2B1 77A4 8FF2B2 77A9 8FF2B3 77DE 8FF2B4 77DF 8FF2B5 77E4 8FF2B6 77E6 8FF2B7 77EA 8FF2B8 77EC 8FF2B9 4093 8FF2BA 77F0 8FF2BB 77F4 8FF2BC 77FB 8FF2BD 2542E 8FF2BE 7805 8FF2BF 7806 8FF2C0 7809 8FF2C1 780D 8FF2C2 7819 8FF2C3 7821 8FF2C4 782C 8FF2C5 7847 8FF2C6 7864 8FF2C7 786A 8FF2C8 254D9 8FF2C9 788A 8FF2CA 7894 8FF2CB 78A4 8FF2CC 789D 8FF2CD 789E 8FF2CE 789F 8FF2CF 78BB 8FF2D0 78C8 8FF2D1 78CC 8FF2D2 78CE 8FF2D3 78D5 8FF2D4 78E0 8FF2D5 78E1 8FF2D6 78E6 8FF2D7 78F9 8FF2D8 78FA 8FF2D9 78FB 8FF2DA 78FE 8FF2DB 255A7 8FF2DC 7910 8FF2DD 791B 8FF2DE 7930 8FF2DF 7925 8FF2E0 793B 8FF2E1 794A 8FF2E2 7958 8FF2E3 795B 8FF2E4 4105 8FF2E5 7967 8FF2E6 7972 8FF2E7 7994 8FF2E8 7995 8FF2E9 7996 8FF2EA 799B 8FF2EB 79A1 8FF2EC 79A9 8FF2ED 79B4 8FF2EE 79BB 8FF2EF 79C2 8FF2F0 79C7 8FF2F1 79CC 8FF2F2 79CD 8FF2F3 79D6 8FF2F4 4148 8FF2F5 257A9 8FF2F6 257B4 8FF2F7 414F 8FF2F8 7A0A 8FF2F9 7A11 8FF2FA 7A15 8FF2FB 7A1B 8FF2FC 7A1E 8FF2FD 4163 8FF2FE 7A2D 8FF3A1 7A38 8FF3A2 7A47 8FF3A3 7A4C 8FF3A4 7A56 8FF3A5 7A59 8FF3A6 7A5C 8FF3A7 7A5F 8FF3A8 7A60 8FF3A9 7A67 8FF3AA 7A6A 8FF3AB 7A75 8FF3AC 7A78 8FF3AD 7A82 8FF3AE 7A8A 8FF3AF 7A90 8FF3B0 7AA3 8FF3B1 7AAC 8FF3B2 259D4 8FF3B3 41B4 8FF3B4 7AB9 8FF3B5 7ABC 8FF3B6 7ABE 8FF3B7 41BF 8FF3B8 7ACC 8FF3B9 7AD1 8FF3BA 7AE7 8FF3BB 7AE8 8FF3BC 7AF4 8FF3BD 25AE4 8FF3BE 25AE3 8FF3BF 7B07 8FF3C0 25AF1 8FF3C1 7B3D 8FF3C2 7B27 8FF3C3 7B2A 8FF3C4 7B2E 8FF3C5 7B2F 8FF3C6 7B31 8FF3C7 41E6 8FF3C8 41F3 8FF3C9 7B7F 8FF3CA 7B41 8FF3CB 41EE 8FF3CC 7B55 8FF3CD 7B79 8FF3CE 7B64 8FF3CF 7B66 8FF3D0 7B69 8FF3D1 7B73 8FF3D2 25BB2 8FF3D3 4207 8FF3D4 7B90 8FF3D5 7B91 8FF3D6 7B9B 8FF3D7 420E 8FF3D8 7BAF 8FF3D9 7BB5 8FF3DA 7BBC 8FF3DB 7BC5 8FF3DC 7BCA 8FF3DD 25C4B 8FF3DE 25C64 8FF3DF 7BD4 8FF3E0 7BD6 8FF3E1 7BDA 8FF3E2 7BEA 8FF3E3 7BF0 8FF3E4 7C03 8FF3E5 7C0B 8FF3E6 7C0E 8FF3E7 7C0F 8FF3E8 7C26 8FF3E9 7C45 8FF3EA 7C4A 8FF3EB 7C51 8FF3EC 7C57 8FF3ED 7C5E 8FF3EE 7C61 8FF3EF 7C69 8FF3F0 7C6E 8FF3F1 7C6F 8FF3F2 7C70 8FF3F3 25E2E 8FF3F4 25E56 8FF3F5 25E65 8FF3F6 7CA6 8FF3F7 25E62 8FF3F8 7CB6 8FF3F9 7CB7 8FF3FA 7CBF 8FF3FB 25ED8 8FF3FC 7CC4 8FF3FD 25EC2 8FF3FE 7CC8 8FF4A1 7CCD 8FF4A2 25EE8 8FF4A3 7CD7 8FF4A4 25F23 8FF4A5 7CE6 8FF4A6 7CEB 8FF4A7 25F5C 8FF4A8 7CF5 8FF4A9 7D03 8FF4AA 7D09 8FF4AB 42C6 8FF4AC 7D12 8FF4AD 7D1E 8FF4AE 25FE0 8FF4AF 25FD4 8FF4B0 7D3D 8FF4B1 7D3E 8FF4B2 7D40 8FF4B3 7D47 8FF4B4 2600C 8FF4B5 25FFB 8FF4B6 42D6 8FF4B7 7D59 8FF4B8 7D5A 8FF4B9 7D6A 8FF4BA 7D70 8FF4BB 42DD 8FF4BC 7D7F 8FF4BD 26017 8FF4BE 7D86 8FF4BF 7D88 8FF4C0 7D8C 8FF4C1 7D97 8FF4C2 26060 8FF4C3 7D9D 8FF4C4 7DA7 8FF4C5 7DAA 8FF4C6 7DB6 8FF4C7 7DB7 8FF4C8 7DC0 8FF4C9 7DD7 8FF4CA 7DD9 8FF4CB 7DE6 8FF4CC 7DF1 8FF4CD 7DF9 8FF4CE 4302 8FF4CF 260ED 8FF4D0 FA58 8FF4D1 7E10 8FF4D2 7E17 8FF4D3 7E1D 8FF4D4 7E20 8FF4D5 7E27 8FF4D6 7E2C 8FF4D7 7E45 8FF4D8 7E73 8FF4D9 7E75 8FF4DA 7E7E 8FF4DB 7E86 8FF4DC 7E87 8FF4DD 432B 8FF4DE 7E91 8FF4DF 7E98 8FF4E0 7E9A 8FF4E1 4343 8FF4E2 7F3C 8FF4E3 7F3B 8FF4E4 7F3E 8FF4E5 7F43 8FF4E6 7F44 8FF4E7 7F4F 8FF4E8 34C1 8FF4E9 26270 8FF4EA 7F52 8FF4EB 26286 8FF4EC 7F61 8FF4ED 7F63 8FF4EE 7F64 8FF4EF 7F6D 8FF4F0 7F7D 8FF4F1 7F7E 8FF4F2 2634C 8FF4F3 7F90 8FF4F4 517B 8FF4F5 23D0E 8FF4F6 7F96 8FF4F7 7F9C 8FF4F8 7FAD 8FF4F9 26402 8FF4FA 7FC3 8FF4FB 7FCF 8FF4FC 7FE3 8FF4FD 7FE5 8FF4FE 7FEF 8FF5A1 7FF2 8FF5A2 8002 8FF5A3 800A 8FF5A4 8008 8FF5A5 800E 8FF5A6 8011 8FF5A7 8016 8FF5A8 8024 8FF5A9 802C 8FF5AA 8030 8FF5AB 8043 8FF5AC 8066 8FF5AD 8071 8FF5AE 8075 8FF5AF 807B 8FF5B0 8099 8FF5B1 809C 8FF5B2 80A4 8FF5B3 80A7 8FF5B4 80B8 8FF5B5 2667E 8FF5B6 80C5 8FF5B7 80D5 8FF5B8 80D8 8FF5B9 80E6 8FF5BA 266B0 8FF5BB 810D 8FF5BC 80F5 8FF5BD 80FB 8FF5BE 43EE 8FF5BF 8135 8FF5C0 8116 8FF5C1 811E 8FF5C2 43F0 8FF5C3 8124 8FF5C4 8127 8FF5C5 812C 8FF5C6 2671D 8FF5C7 813D 8FF5C8 4408 8FF5C9 8169 8FF5CA 4417 8FF5CB 8181 8FF5CC 441C 8FF5CD 8184 8FF5CE 8185 8FF5CF 4422 8FF5D0 8198 8FF5D1 81B2 8FF5D2 81C1 8FF5D3 81C3 8FF5D4 81D6 8FF5D5 81DB 8FF5D6 268DD 8FF5D7 81E4 8FF5D8 268EA 8FF5D9 81EC 8FF5DA 26951 8FF5DB 81FD 8FF5DC 81FF 8FF5DD 2696F 8FF5DE 8204 8FF5DF 269DD 8FF5E0 8219 8FF5E1 8221 8FF5E2 8222 8FF5E3 26A1E 8FF5E4 8232 8FF5E5 8234 8FF5E6 823C 8FF5E7 8246 8FF5E8 8249 8FF5E9 8245 8FF5EA 26A58 8FF5EB 824B 8FF5EC 4476 8FF5ED 824F 8FF5EE 447A 8FF5EF 8257 8FF5F0 26A8C 8FF5F1 825C 8FF5F2 8263 8FF5F3 26AB7 8FF5F4 FA5D 8FF5F5 FA5E 8FF5F6 8279 8FF5F7 4491 8FF5F8 827D 8FF5F9 827F 8FF5FA 8283 8FF5FB 828A 8FF5FC 8293 8FF5FD 82A7 8FF5FE 82A8 8FF6A1 82B2 8FF6A2 82B4 8FF6A3 82BA 8FF6A4 82BC 8FF6A5 82E2 8FF6A6 82E8 8FF6A7 82F7 8FF6A8 8307 8FF6A9 8308 8FF6AA 830C 8FF6AB 8354 8FF6AC 831B 8FF6AD 831D 8FF6AE 8330 8FF6AF 833C 8FF6B0 8344 8FF6B1 8357 8FF6B2 44BE 8FF6B3 837F 8FF6B4 44D4 8FF6B5 44B3 8FF6B6 838D 8FF6B7 8394 8FF6B8 8395 8FF6B9 839B 8FF6BA 839D 8FF6BB 83C9 8FF6BC 83D0 8FF6BD 83D4 8FF6BE 83DD 8FF6BF 83E5 8FF6C0 83F9 8FF6C1 840F 8FF6C2 8411 8FF6C3 8415 8FF6C4 26C73 8FF6C5 8417 8FF6C6 8439 8FF6C7 844A 8FF6C8 844F 8FF6C9 8451 8FF6CA 8452 8FF6CB 8459 8FF6CC 845A 8FF6CD 845C 8FF6CE 26CDD 8FF6CF 8465 8FF6D0 8476 8FF6D1 8478 8FF6D2 847C 8FF6D3 8481 8FF6D4 450D 8FF6D5 84DC 8FF6D6 8497 8FF6D7 84A6 8FF6D8 84BE 8FF6D9 4508 8FF6DA 84CE 8FF6DB 84CF 8FF6DC 84D3 8FF6DD 26E65 8FF6DE 84E7 8FF6DF 84EA 8FF6E0 84EF 8FF6E1 84F0 8FF6E2 84F1 8FF6E3 84FA 8FF6E4 84FD 8FF6E5 850C 8FF6E6 851B 8FF6E7 8524 8FF6E8 8525 8FF6E9 852B 8FF6EA 8534 8FF6EB 854F 8FF6EC 856F 8FF6ED 4525 8FF6EE 4543 8FF6EF 853E 8FF6F0 8551 8FF6F1 8553 8FF6F2 855E 8FF6F3 8561 8FF6F4 8562 8FF6F5 26F94 8FF6F6 857B 8FF6F7 857D 8FF6F8 857F 8FF6F9 8581 8FF6FA 8586 8FF6FB 8593 8FF6FC 859D 8FF6FD 859F 8FF6FE 26FF8 8FF7A1 26FF6 8FF7A2 26FF7 8FF7A3 85B7 8FF7A4 85BC 8FF7A5 85C7 8FF7A6 85CA 8FF7A7 85D8 8FF7A8 85D9 8FF7A9 85DF 8FF7AA 85E1 8FF7AB 85E6 8FF7AC 85F6 8FF7AD 8600 8FF7AE 8611 8FF7AF 861E 8FF7B0 8621 8FF7B1 8624 8FF7B2 8627 8FF7B3 2710D 8FF7B4 8639 8FF7B5 863C 8FF7B6 27139 8FF7B7 8640 8FF7B8 FA20 8FF7B9 8653 8FF7BA 8656 8FF7BB 866F 8FF7BC 8677 8FF7BD 867A 8FF7BE 8687 8FF7BF 8689 8FF7C0 868D 8FF7C1 8691 8FF7C2 869C 8FF7C3 869D 8FF7C4 86A8 8FF7C5 FA21 8FF7C6 86B1 8FF7C7 86B3 8FF7C8 86C1 8FF7C9 86C3 8FF7CA 86D1 8FF7CB 86D5 8FF7CC 86D7 8FF7CD 86E3 8FF7CE 86E6 8FF7CF 45B8 8FF7D0 8705 8FF7D1 8707 8FF7D2 870E 8FF7D3 8710 8FF7D4 8713 8FF7D5 8719 8FF7D6 871F 8FF7D7 8721 8FF7D8 8723 8FF7D9 8731 8FF7DA 873A 8FF7DB 873E 8FF7DC 8740 8FF7DD 8743 8FF7DE 8751 8FF7DF 8758 8FF7E0 8764 8FF7E1 8765 8FF7E2 8772 8FF7E3 877C 8FF7E4 273DB 8FF7E5 273DA 8FF7E6 87A7 8FF7E7 8789 8FF7E8 878B 8FF7E9 8793 8FF7EA 87A0 8FF7EB 273FE 8FF7EC 45E5 8FF7ED 87BE 8FF7EE 27410 8FF7EF 87C1 8FF7F0 87CE 8FF7F1 87F5 8FF7F2 87DF 8FF7F3 27449 8FF7F4 87E3 8FF7F5 87E5 8FF7F6 87E6 8FF7F7 87EA 8FF7F8 87EB 8FF7F9 87ED 8FF7FA 8801 8FF7FB 8803 8FF7FC 880B 8FF7FD 8813 8FF7FE 8828 8FF8A1 882E 8FF8A2 8832 8FF8A3 883C 8FF8A4 460F 8FF8A5 884A 8FF8A6 8858 8FF8A7 885F 8FF8A8 8864 8FF8A9 27615 8FF8AA 27614 8FF8AB 8869 8FF8AC 27631 8FF8AD 886F 8FF8AE 88A0 8FF8AF 88BC 8FF8B0 88BD 8FF8B1 88BE 8FF8B2 88C0 8FF8B3 88D2 8FF8B4 27693 8FF8B5 88D1 8FF8B6 88D3 8FF8B7 88DB 8FF8B8 88F0 8FF8B9 88F1 8FF8BA 4641 8FF8BB 8901 8FF8BC 2770E 8FF8BD 8937 8FF8BE 27723 8FF8BF 8942 8FF8C0 8945 8FF8C1 8949 8FF8C2 27752 8FF8C3 4665 8FF8C4 8962 8FF8C5 8980 8FF8C6 8989 8FF8C7 8990 8FF8C8 899F 8FF8C9 89B0 8FF8CA 89B7 8FF8CB 89D6 8FF8CC 89D8 8FF8CD 89EB 8FF8CE 46A1 8FF8CF 89F1 8FF8D0 89F3 8FF8D1 89FD 8FF8D2 89FF 8FF8D3 46AF 8FF8D4 8A11 8FF8D5 8A14 8FF8D6 27985 8FF8D7 8A21 8FF8D8 8A35 8FF8D9 8A3E 8FF8DA 8A45 8FF8DB 8A4D 8FF8DC 8A58 8FF8DD 8AAE 8FF8DE 8A90 8FF8DF 8AB7 8FF8E0 8ABE 8FF8E1 8AD7 8FF8E2 8AFC 8FF8E3 27A84 8FF8E4 8B0A 8FF8E5 8B05 8FF8E6 8B0D 8FF8E7 8B1C 8FF8E8 8B1F 8FF8E9 8B2D 8FF8EA 8B43 8FF8EB 470C 8FF8EC 8B51 8FF8ED 8B5E 8FF8EE 8B76 8FF8EF 8B7F 8FF8F0 8B81 8FF8F1 8B8B 8FF8F2 8B94 8FF8F3 8B95 8FF8F4 8B9C 8FF8F5 8B9E 8FF8F6 8C39 8FF8F7 27BB3 8FF8F8 8C3D 8FF8F9 27BBE 8FF8FA 27BC7 8FF8FB 8C45 8FF8FC 8C47 8FF8FD 8C4F 8FF8FE 8C54 8FF9A1 8C57 8FF9A2 8C69 8FF9A3 8C6D 8FF9A4 8C73 8FF9A5 27CB8 8FF9A6 8C93 8FF9A7 8C92 8FF9A8 8C99 8FF9A9 4764 8FF9AA 8C9B 8FF9AB 8CA4 8FF9AC 8CD6 8FF9AD 8CD5 8FF9AE 8CD9 8FF9AF 27DA0 8FF9B0 8CF0 8FF9B1 8CF1 8FF9B2 27E10 8FF9B3 8D09 8FF9B4 8D0E 8FF9B5 8D6C 8FF9B6 8D84 8FF9B7 8D95 8FF9B8 8DA6 8FF9B9 27FB7 8FF9BA 8DC6 8FF9BB 8DC8 8FF9BC 8DD9 8FF9BD 8DEC 8FF9BE 8E0C 8FF9BF 47FD 8FF9C0 8DFD 8FF9C1 8E06 8FF9C2 2808A 8FF9C3 8E14 8FF9C4 8E16 8FF9C5 8E21 8FF9C6 8E22 8FF9C7 8E27 8FF9C8 280BB 8FF9C9 4816 8FF9CA 8E36 8FF9CB 8E39 8FF9CC 8E4B 8FF9CD 8E54 8FF9CE 8E62 8FF9CF 8E6C 8FF9D0 8E6D 8FF9D1 8E6F 8FF9D2 8E98 8FF9D3 8E9E 8FF9D4 8EAE 8FF9D5 8EB3 8FF9D6 8EB5 8FF9D7 8EB6 8FF9D8 8EBB 8FF9D9 28282 8FF9DA 8ED1 8FF9DB 8ED4 8FF9DC 484E 8FF9DD 8EF9 8FF9DE 282F3 8FF9DF 8F00 8FF9E0 8F08 8FF9E1 8F17 8FF9E2 8F2B 8FF9E3 8F40 8FF9E4 8F4A 8FF9E5 8F58 8FF9E6 2840C 8FF9E7 8FA4 8FF9E8 8FB4 8FF9E9 FA66 8FF9EA 8FB6 8FF9EB 28455 8FF9EC 8FC1 8FF9ED 8FC6 8FF9EE FA24 8FF9EF 8FCA 8FF9F0 8FCD 8FF9F1 8FD3 8FF9F2 8FD5 8FF9F3 8FE0 8FF9F4 8FF1 8FF9F5 8FF5 8FF9F6 8FFB 8FF9F7 9002 8FF9F8 900C 8FF9F9 9037 8FF9FA 2856B 8FF9FB 9043 8FF9FC 9044 8FF9FD 905D 8FF9FE 285C8 8FFAA1 285C9 8FFAA2 9085 8FFAA3 908C 8FFAA4 9090 8FFAA5 961D 8FFAA6 90A1 8FFAA7 48B5 8FFAA8 90B0 8FFAA9 90B6 8FFAAA 90C3 8FFAAB 90C8 8FFAAC 286D7 8FFAAD 90DC 8FFAAE 90DF 8FFAAF 286FA 8FFAB0 90F6 8FFAB1 90F2 8FFAB2 9100 8FFAB3 90EB 8FFAB4 90FE 8FFAB5 90FF 8FFAB6 9104 8FFAB7 9106 8FFAB8 9118 8FFAB9 911C 8FFABA 911E 8FFABB 9137 8FFABC 9139 8FFABD 913A 8FFABE 9146 8FFABF 9147 8FFAC0 9157 8FFAC1 9159 8FFAC2 9161 8FFAC3 9164 8FFAC4 9174 8FFAC5 9179 8FFAC6 9185 8FFAC7 918E 8FFAC8 91A8 8FFAC9 91AE 8FFACA 91B3 8FFACB 91B6 8FFACC 91C3 8FFACD 91C4 8FFACE 91DA 8FFACF 28949 8FFAD0 28946 8FFAD1 91EC 8FFAD2 91EE 8FFAD3 9201 8FFAD4 920A 8FFAD5 9216 8FFAD6 9217 8FFAD7 2896B 8FFAD8 9233 8FFAD9 9242 8FFADA 9247 8FFADB 924A 8FFADC 924E 8FFADD 9251 8FFADE 9256 8FFADF 9259 8FFAE0 9260 8FFAE1 9261 8FFAE2 9265 8FFAE3 9267 8FFAE4 9268 8FFAE5 28987 8FFAE6 28988 8FFAE7 927C 8FFAE8 927D 8FFAE9 927F 8FFAEA 9289 8FFAEB 928D 8FFAEC 9297 8FFAED 9299 8FFAEE 929F 8FFAEF 92A7 8FFAF0 92AB 8FFAF1 289BA 8FFAF2 289BB 8FFAF3 92B2 8FFAF4 92BF 8FFAF5 92C0 8FFAF6 92C6 8FFAF7 92CE 8FFAF8 92D0 8FFAF9 92D7 8FFAFA 92D9 8FFAFB 92E5 8FFAFC 92E7 8FFAFD 9311 8FFAFE 28A1E 8FFBA1 28A29 8FFBA2 92F7 8FFBA3 92F9 8FFBA4 92FB 8FFBA5 9302 8FFBA6 930D 8FFBA7 9315 8FFBA8 931D 8FFBA9 931E 8FFBAA 9327 8FFBAB 9329 8FFBAC 28A71 8FFBAD 28A43 8FFBAE 9347 8FFBAF 9351 8FFBB0 9357 8FFBB1 935A 8FFBB2 936B 8FFBB3 9371 8FFBB4 9373 8FFBB5 93A1 8FFBB6 28A99 8FFBB7 28ACD 8FFBB8 9388 8FFBB9 938B 8FFBBA 938F 8FFBBB 939E 8FFBBC 93F5 8FFBBD 28AE4 8FFBBE 28ADD 8FFBBF 93F1 8FFBC0 93C1 8FFBC1 93C7 8FFBC2 93DC 8FFBC3 93E2 8FFBC4 93E7 8FFBC5 9409 8FFBC6 940F 8FFBC7 9416 8FFBC8 9417 8FFBC9 93FB 8FFBCA 9432 8FFBCB 9434 8FFBCC 943B 8FFBCD 9445 8FFBCE 28BC1 8FFBCF 28BEF 8FFBD0 946D 8FFBD1 946F 8FFBD2 9578 8FFBD3 9579 8FFBD4 9586 8FFBD5 958C 8FFBD6 958D 8FFBD7 28D10 8FFBD8 95AB 8FFBD9 95B4 8FFBDA 28D71 8FFBDB 95C8 8FFBDC 28DFB 8FFBDD 28E1F 8FFBDE 962C 8FFBDF 9633 8FFBE0 9634 8FFBE1 28E36 8FFBE2 963C 8FFBE3 9641 8FFBE4 9661 8FFBE5 28E89 8FFBE6 9682 8FFBE7 28EEB 8FFBE8 969A 8FFBE9 28F32 8FFBEA 49E7 8FFBEB 96A9 8FFBEC 96AF 8FFBED 96B3 8FFBEE 96BA 8FFBEF 96BD 8FFBF0 49FA 8FFBF1 28FF8 8FFBF2 96D8 8FFBF3 96DA 8FFBF4 96DD 8FFBF5 4A04 8FFBF6 9714 8FFBF7 9723 8FFBF8 4A29 8FFBF9 9736 8FFBFA 9741 8FFBFB 9747 8FFBFC 9755 8FFBFD 9757 8FFBFE 975B 8FFCA1 976A 8FFCA2 292A0 8FFCA3 292B1 8FFCA4 9796 8FFCA5 979A 8FFCA6 979E 8FFCA7 97A2 8FFCA8 97B1 8FFCA9 97B2 8FFCAA 97BE 8FFCAB 97CC 8FFCAC 97D1 8FFCAD 97D4 8FFCAE 97D8 8FFCAF 97D9 8FFCB0 97E1 8FFCB1 97F1 8FFCB2 9804 8FFCB3 980D 8FFCB4 980E 8FFCB5 9814 8FFCB6 9816 8FFCB7 4ABC 8FFCB8 29490 8FFCB9 9823 8FFCBA 9832 8FFCBB 9833 8FFCBC 9825 8FFCBD 9847 8FFCBE 9866 8FFCBF 98AB 8FFCC0 98AD 8FFCC1 98B0 8FFCC2 295CF 8FFCC3 98B7 8FFCC4 98B8 8FFCC5 98BB 8FFCC6 98BC 8FFCC7 98BF 8FFCC8 98C2 8FFCC9 98C7 8FFCCA 98CB 8FFCCB 98E0 8FFCCC 2967F 8FFCCD 98E1 8FFCCE 98E3 8FFCCF 98E5 8FFCD0 98EA 8FFCD1 98F0 8FFCD2 98F1 8FFCD3 98F3 8FFCD4 9908 8FFCD5 4B3B 8FFCD6 296F0 8FFCD7 9916 8FFCD8 9917 8FFCD9 29719 8FFCDA 991A 8FFCDB 991B 8FFCDC 991C 8FFCDD 29750 8FFCDE 9931 8FFCDF 9932 8FFCE0 9933 8FFCE1 993A 8FFCE2 993B 8FFCE3 993C 8FFCE4 9940 8FFCE5 9941 8FFCE6 9946 8FFCE7 994D 8FFCE8 994E 8FFCE9 995C 8FFCEA 995F 8FFCEB 9960 8FFCEC 99A3 8FFCED 99A6 8FFCEE 99B9 8FFCEF 99BD 8FFCF0 99BF 8FFCF1 99C3 8FFCF2 99C9 8FFCF3 99D4 8FFCF4 99D9 8FFCF5 99DE 8FFCF6 298C6 8FFCF7 99F0 8FFCF8 99F9 8FFCF9 99FC 8FFCFA 9A0A 8FFCFB 9A11 8FFCFC 9A16 8FFCFD 9A1A 8FFCFE 9A20 8FFDA1 9A31 8FFDA2 9A36 8FFDA3 9A44 8FFDA4 9A4C 8FFDA5 9A58 8FFDA6 4BC2 8FFDA7 9AAF 8FFDA8 4BCA 8FFDA9 9AB7 8FFDAA 4BD2 8FFDAB 9AB9 8FFDAC 29A72 8FFDAD 9AC6 8FFDAE 9AD0 8FFDAF 9AD2 8FFDB0 9AD5 8FFDB1 4BE8 8FFDB2 9ADC 8FFDB3 9AE0 8FFDB4 9AE5 8FFDB5 9AE9 8FFDB6 9B03 8FFDB7 9B0C 8FFDB8 9B10 8FFDB9 9B12 8FFDBA 9B16 8FFDBC 9B2B 8FFDBD 9B33 8FFDBE 9B3D 8FFDBF 4C20 8FFDC0 9B4B 8FFDC1 9B63 8FFDC2 9B65 8FFDC3 9B6B 8FFDC4 9B6C 8FFDC5 9B73 8FFDC6 9B76 8FFDC7 9B77 8FFDC8 9BA6 8FFDC9 9BAC 8FFDCA 9BB1 8FFDCB 29DDB 8FFDCC 29E3D 8FFDCD 9BB2 8FFDCE 9BB8 8FFDCF 9BBE 8FFDD0 9BC7 8FFDD1 9BF3 8FFDD2 9BD8 8FFDD3 9BDD 8FFDD4 9BE7 8FFDD5 9BEA 8FFDD6 9BEB 8FFDD7 9BEF 8FFDD8 9BEE 8FFDD9 29E15 8FFDDA 9BFA 8FFDDB 29E8A 8FFDDC 9BF7 8FFDDD 29E49 8FFDDE 9C16 8FFDDF 9C18 8FFDE0 9C19 8FFDE1 9C1A 8FFDE2 9C1D 8FFDE3 9C22 8FFDE4 9C27 8FFDE5 9C29 8FFDE6 9C2A 8FFDE7 29EC4 8FFDE8 9C31 8FFDE9 9C36 8FFDEA 9C37 8FFDEB 9C45 8FFDEC 9C5C 8FFDED 29EE9 8FFDEE 9C49 8FFDEF 9C4A 8FFDF0 29EDB 8FFDF1 9C54 8FFDF2 9C58 8FFDF3 9C5B 8FFDF4 9C5D 8FFDF5 9C5F 8FFDF6 9C69 8FFDF7 9C6A 8FFDF8 9C6B 8FFDF9 9C6D 8FFDFA 9C6E 8FFDFB 9C70 8FFDFC 9C72 8FFDFD 9C75 8FFDFE 9C7A 8FFEA1 9CE6 8FFEA2 9CF2 8FFEA3 9D0B 8FFEA4 9D02 8FFEA5 29FCE 8FFEA6 9D11 8FFEA7 9D17 8FFEA8 9D18 8FFEA9 2A02F 8FFEAA 4CC4 8FFEAB 2A01A 8FFEAC 9D32 8FFEAD 4CD1 8FFEAE 9D42 8FFEAF 9D4A 8FFEB0 9D5F 8FFEB1 9D62 8FFEB2 2A0F9 8FFEB3 9D69 8FFEB4 9D6B 8FFEB5 2A082 8FFEB6 9D73 8FFEB7 9D76 8FFEB8 9D77 8FFEB9 9D7E 8FFEBA 9D84 8FFEBB 9D8D 8FFEBC 9D99 8FFEBD 9DA1 8FFEBE 9DBF 8FFEBF 9DB5 8FFEC0 9DB9 8FFEC1 9DBD 8FFEC2 9DC3 8FFEC3 9DC7 8FFEC4 9DC9 8FFEC5 9DD6 8FFEC6 9DDA 8FFEC7 9DDF 8FFEC8 9DE0 8FFEC9 9DE3 8FFECA 9DF4 8FFECB 4D07 8FFECC 9E0A 8FFECD 9E02 8FFECE 9E0D 8FFECF 9E19 8FFED0 9E1C 8FFED1 9E1D 8FFED2 9E7B 8FFED3 22218 8FFED4 9E80 8FFED5 9E85 8FFED6 9E9B 8FFED7 9EA8 8FFED8 2A38C 8FFED9 9EBD 8FFEDA 2A437 8FFEDB 9EDF 8FFEDC 9EE7 8FFEDD 9EEE 8FFEDE 9EFF 8FFEDF 9F02 8FFEE0 4D77 8FFEE1 9F03 8FFEE2 9F17 8FFEE3 9F19 8FFEE4 9F2F 8FFEE5 9F37 8FFEE6 9F3A 8FFEE7 9F3D 8FFEE8 9F41 8FFEE9 9F45 8FFEEA 9F46 8FFEEB 9F53 8FFEEC 9F55 8FFEED 9F58 8FFEEE 2A5F1 8FFEEF 9F5D 8FFEF0 2A602 8FFEF1 9F69 8FFEF2 2A61A 8FFEF3 9F6D 8FFEF4 9F70 8FFEF5 9F75 8FFEF6 2A6B2 A1A1 3000 A1A2 3001 A1A3 3002 A1A4 FF0C A1A5 FF0E A1A6 30FB A1A7 FF1A A1A8 FF1B A1A9 FF1F A1AA FF01 A1AB 309B A1AC 309C A1AD 00B4 A1AE FF40 A1AF 00A8 A1B0 FF3E A1B1 FFE3 A1B2 FF3F A1B3 30FD A1B4 30FE A1B5 309D A1B6 309E A1B7 3003 A1B8 4EDD A1B9 3005 A1BA 3006 A1BB 3007 A1BC 30FC A1BD 2015 A1BE 2010 A1BF FF0F A1C0 5C A1C1 301C A1C2 2016 A1C3 FF5C A1C4 2026 A1C5 2025 A1C6 2018 A1C7 2019 A1C8 201C A1C9 201D A1CA FF08 A1CB FF09 A1CC 3014 A1CD 3015 A1CE FF3B A1CF FF3D A1D0 FF5B A1D1 FF5D A1D2 3008 A1D3 3009 A1D4 300A A1D5 300B A1D6 300C A1D7 300D A1D8 300E A1D9 300F A1DA 3010 A1DB 3011 A1DC FF0B A1DD 2212 A1DE 00B1 A1DF 00D7 A1E0 00F7 A1E1 FF1D A1E2 2260 A1E3 FF1C A1E4 FF1E A1E5 2266 A1E6 2267 A1E7 221E A1E8 2234 A1E9 2642 A1EA 2640 A1EB 00B0 A1EC 2032 A1ED 2033 A1EE 2103 A1EF FFE5 A1F0 FF04 A1F1 00A2 A1F2 00A3 A1F3 FF05 A1F4 FF03 A1F5 FF06 A1F6 FF0A A1F7 FF20 A1F8 00A7 A1F9 2606 A1FA 2605 A1FB 25CB A1FC 25CF A1FD 25CE A1FE 25C7 A2A1 25C6 A2A2 25A1 A2A3 25A0 A2A4 25B3 A2A5 25B2 A2A6 25BD A2A7 25BC A2A8 203B A2A9 3012 A2AA 2192 A2AB 2190 A2AC 2191 A2AD 2193 A2AE 3013 A2AF FF07 A2B0 FF02 A2B1 FF0D A2B2 FF5E A2B3 3033 A2B4 3034 A2B5 3035 A2B6 303B A2B7 303C A2B8 30FF A2B9 309F A2BA 2208 A2BB 220B A2BC 2286 A2BD 2287 A2BE 2282 A2BF 2283 A2C0 222A A2C1 2229 A2C2 2284 A2C3 2285 A2C4 228A A2C5 228B A2C6 2209 A2C7 2205 A2C8 2305 A2C9 2306 A2CA 2227 A2CB 2228 A2CC 00AC A2CD 21D2 A2CE 21D4 A2CF 2200 A2D0 2203 A2D1 2295 A2D2 2296 A2D3 2297 A2D4 2225 A2D5 2226 A2D6 2985 A2D7 2986 A2D8 3018 A2D9 3019 A2DA 3016 A2DB 3017 A2DC 2220 A2DD 22A5 A2DE 2312 A2DF 2202 A2E0 2207 A2E1 2261 A2E2 2252 A2E3 226A A2E4 226B A2E5 221A A2E6 223D A2E7 221D A2E8 2235 A2E9 222B A2EA 222C A2EB 2262 A2EC 2243 A2ED 2245 A2EE 2248 A2EF 2276 A2F0 2277 A2F1 2194 A2F2 212B A2F3 2030 A2F4 266F A2F5 266D A2F6 266A A2F7 2020 A2F8 2021 A2F9 00B6 A2FA 266E A2FB 266B A2FC 266C A2FD 2669 A2FE 25EF A3A1 25B7 A3A2 25B6 A3A3 25C1 A3A4 25C0 A3A5 2197 A3A6 2198 A3A7 2196 A3A8 2199 A3A9 21C4 A3AA 21E8 A3AB 21E6 A3AC 21E7 A3AD 21E9 A3AE 2934 A3AF 2935 A3B0 FF10 A3B1 FF11 A3B2 FF12 A3B3 FF13 A3B4 FF14 A3B5 FF15 A3B6 FF16 A3B7 FF17 A3B8 FF18 A3B9 FF19 A3BA 29BF A3BB 25C9 A3BC 303D A3BD FE46 A3BE FE45 A3BF 25E6 A3C0 2022 A3C1 FF21 A3C2 FF22 A3C3 FF23 A3C4 FF24 A3C5 FF25 A3C6 FF26 A3C7 FF27 A3C8 FF28 A3C9 FF29 A3CA FF2A A3CB FF2B A3CC FF2C A3CD FF2D A3CE FF2E A3CF FF2F A3D0 FF30 A3D1 FF31 A3D2 FF32 A3D3 FF33 A3D4 FF34 A3D5 FF35 A3D6 FF36 A3D7 FF37 A3D8 FF38 A3D9 FF39 A3DA FF3A A3DB 2213 A3DC 2135 A3DD 210F A3DE 33CB A3DF 2113 A3E0 2127 A3E1 FF41 A3E2 FF42 A3E3 FF43 A3E4 FF44 A3E5 FF45 A3E6 FF46 A3E7 FF47 A3E8 FF48 A3E9 FF49 A3EA FF4A A3EB FF4B A3EC FF4C A3ED FF4D A3EE FF4E A3EF FF4F A3F0 FF50 A3F1 FF51 A3F2 FF52 A3F3 FF53 A3F4 FF54 A3F5 FF55 A3F6 FF56 A3F7 FF57 A3F8 FF58 A3F9 FF59 A3FA FF5A A3FB 30A0 A3FC 2013 A3FD 29FA A3FE 29FB A4A1 3041 A4A2 3042 A4A3 3043 A4A4 3044 A4A5 3045 A4A6 3046 A4A7 3047 A4A8 3048 A4A9 3049 A4AA 304A A4AB 304B A4AC 304C A4AD 304D A4AE 304E A4AF 304F A4B0 3050 A4B1 3051 A4B2 3052 A4B3 3053 A4B4 3054 A4B5 3055 A4B6 3056 A4B7 3057 A4B8 3058 A4B9 3059 A4BA 305A A4BB 305B A4BC 305C A4BD 305D A4BE 305E A4BF 305F A4C0 3060 A4C1 3061 A4C2 3062 A4C3 3063 A4C4 3064 A4C5 3065 A4C6 3066 A4C7 3067 A4C8 3068 A4C9 3069 A4CA 306A A4CB 306B A4CC 306C A4CD 306D A4CE 306E A4CF 306F A4D0 3070 A4D1 3071 A4D2 3072 A4D3 3073 A4D4 3074 A4D5 3075 A4D6 3076 A4D7 3077 A4D8 3078 A4D9 3079 A4DA 307A A4DB 307B A4DC 307C A4DD 307D A4DE 307E A4DF 307F A4E0 3080 A4E1 3081 A4E2 3082 A4E3 3083 A4E4 3084 A4E5 3085 A4E6 3086 A4E7 3087 A4E8 3088 A4E9 3089 A4EA 308A A4EB 308B A4EC 308C A4ED 308D A4EE 308E A4EF 308F A4F0 3090 A4F1 3091 A4F2 3092 A4F3 3093 A4F4 3094 A4F5 3095 A4F6 3096 A4F7 304B 309A A4F8 304D 309A A4F9 304F 309A A4FA 3051 309A A4FB 3053 309A A5A1 30A1 A5A2 30A2 A5A3 30A3 A5A4 30A4 A5A5 30A5 A5A6 30A6 A5A7 30A7 A5A8 30A8 A5A9 30A9 A5AA 30AA A5AB 30AB A5AC 30AC A5AD 30AD A5AE 30AE A5AF 30AF A5B0 30B0 A5B1 30B1 A5B2 30B2 A5B3 30B3 A5B4 30B4 A5B5 30B5 A5B6 30B6 A5B7 30B7 A5B8 30B8 A5B9 30B9 A5BA 30BA A5BB 30BB A5BC 30BC A5BD 30BD A5BE 30BE A5BF 30BF A5C0 30C0 A5C1 30C1 A5C2 30C2 A5C3 30C3 A5C4 30C4 A5C5 30C5 A5C6 30C6 A5C7 30C7 A5C8 30C8 A5C9 30C9 A5CA 30CA A5CB 30CB A5CC 30CC A5CD 30CD A5CE 30CE A5CF 30CF A5D0 30D0 A5D1 30D1 A5D2 30D2 A5D3 30D3 A5D4 30D4 A5D5 30D5 A5D6 30D6 A5D7 30D7 A5D8 30D8 A5D9 30D9 A5DA 30DA A5DB 30DB A5DC 30DC A5DD 30DD A5DE 30DE A5DF 30DF A5E0 30E0 A5E1 30E1 A5E2 30E2 A5E3 30E3 A5E4 30E4 A5E5 30E5 A5E6 30E6 A5E7 30E7 A5E8 30E8 A5E9 30E9 A5EA 30EA A5EB 30EB A5EC 30EC A5ED 30ED A5EE 30EE A5EF 30EF A5F0 30F0 A5F1 30F1 A5F2 30F2 A5F3 30F3 A5F4 30F4 A5F5 30F5 A5F6 30F6 A5F7 30AB 309A A5F8 30AD 309A A5F9 30AF 309A A5FA 30B1 309A A5FB 30B3 309A A5FC 30BB 309A A5FD 30C4 309A A5FE 30C8 309A A6A1 0391 A6A2 0392 A6A3 0393 A6A4 0394 A6A5 0395 A6A6 0396 A6A7 0397 A6A8 0398 A6A9 0399 A6AA 039A A6AB 039B A6AC 039C A6AD 039D A6AE 039E A6AF 039F A6B0 03A0 A6B1 03A1 A6B2 03A3 A6B3 03A4 A6B4 03A5 A6B5 03A6 A6B6 03A7 A6B7 03A8 A6B8 03A9 A6B9 2664 A6BA 2660 A6BB 2662 A6BC 2666 A6BD 2661 A6BE 2665 A6BF 2667 A6C0 2663 A6C1 03B1 A6C2 03B2 A6C3 03B3 A6C4 03B4 A6C5 03B5 A6C6 03B6 A6C7 03B7 A6C8 03B8 A6C9 03B9 A6CA 03BA A6CB 03BB A6CC 03BC A6CD 03BD A6CE 03BE A6CF 03BF A6D0 03C0 A6D1 03C1 A6D2 03C3 A6D3 03C4 A6D4 03C5 A6D5 03C6 A6D6 03C7 A6D7 03C8 A6D8 03C9 A6D9 03C2 A6DA 24F5 A6DB 24F6 A6DC 24F7 A6DD 24F8 A6DE 24F9 A6DF 24FA A6E0 24FB A6E1 24FC A6E2 24FD A6E3 24FE A6E4 2616 A6E5 2617 A6E6 3020 A6E7 260E A6E8 2600 A6E9 2601 A6EA 2602 A6EB 2603 A6EC 2668 A6ED 25B1 A6EE 31F0 A6EF 31F1 A6F0 31F2 A6F1 31F3 A6F2 31F4 A6F3 31F5 A6F4 31F6 A6F5 31F7 A6F6 31F8 A6F7 31F9 A6F8 31F7 309A A6F9 31FA A6FA 31FB A6FB 31FC A6FC 31FD A6FD 31FE A6FE 31FF A7A1 0410 A7A2 0411 A7A3 0412 A7A4 0413 A7A5 0414 A7A6 0415 A7A7 0401 A7A8 0416 A7A9 0417 A7AA 0418 A7AB 0419 A7AC 041A A7AD 041B A7AE 041C A7AF 041D A7B0 041E A7B1 041F A7B2 0420 A7B3 0421 A7B4 0422 A7B5 0423 A7B6 0424 A7B7 0425 A7B8 0426 A7B9 0427 A7BA 0428 A7BB 0429 A7BC 042A A7BD 042B A7BE 042C A7BF 042D A7C0 042E A7C1 042F A7C2 23BE A7C3 23BF A7C4 23C0 A7C5 23C1 A7C6 23C2 A7C7 23C3 A7C8 23C4 A7C9 23C5 A7CA 23C6 A7CB 23C7 A7CC 23C8 A7CD 23C9 A7CE 23CA A7CF 23CB A7D0 23CC A7D1 0430 A7D2 0431 A7D3 0432 A7D4 0433 A7D5 0434 A7D6 0435 A7D7 0451 A7D8 0436 A7D9 0437 A7DA 0438 A7DB 0439 A7DC 043A A7DD 043B A7DE 043C A7DF 043D A7E0 043E A7E1 043F A7E2 0440 A7E3 0441 A7E4 0442 A7E5 0443 A7E6 0444 A7E7 0445 A7E8 0446 A7E9 0447 A7EA 0448 A7EB 0449 A7EC 044A A7ED 044B A7EE 044C A7EF 044D A7F0 044E A7F1 044F A7F2 30F7 A7F3 30F8 A7F4 30F9 A7F5 30FA A7F6 22DA A7F7 22DB A7F8 2153 A7F9 2154 A7FA 2155 A7FB 2713 A7FC 2318 A7FD 2423 A7FE 23CE A8A1 2500 A8A2 2502 A8A3 250C A8A4 2510 A8A5 2518 A8A6 2514 A8A7 251C A8A8 252C A8A9 2524 A8AA 2534 A8AB 253C A8AC 2501 A8AD 2503 A8AE 250F A8AF 2513 A8B0 251B A8B1 2517 A8B2 2523 A8B3 2533 A8B4 252B A8B5 253B A8B6 254B A8B7 2520 A8B8 252F A8B9 2528 A8BA 2537 A8BB 253F A8BC 251D A8BD 2530 A8BE 2525 A8BF 2538 A8C0 2542 A8C1 3251 A8C2 3252 A8C3 3253 A8C4 3254 A8C5 3255 A8C6 3256 A8C7 3257 A8C8 3258 A8C9 3259 A8CA 325A A8CB 325B A8CC 325C A8CD 325D A8CE 325E A8CF 325F A8D0 32B1 A8D1 32B2 A8D2 32B3 A8D3 32B4 A8D4 32B5 A8D5 32B6 A8D6 32B7 A8D7 32B8 A8D8 32B9 A8D9 32BA A8DA 32BB A8DB 32BC A8DC 32BD A8DD 32BE A8DE 32BF A8E7 25D0 A8E8 25D1 A8E9 25D2 A8EA 25D3 A8EB 203C A8EC 2047 A8ED 2048 A8EE 2049 A8EF 01CD A8F0 01CE A8F1 01D0 A8F2 1E3E A8F3 1E3F A8F4 01F8 A8F5 01F9 A8F6 01D1 A8F7 01D2 A8F8 01D4 A8F9 01D6 A8FA 01D8 A8FB 01DA A8FC 01DC A9A1 20AC A9A2 00A0 A9A3 00A1 A9A4 00A4 A9A5 00A6 A9A6 00A9 A9A7 00AA A9A8 00AB A9A9 00AD A9AA 00AE A9AB 00AF A9AC 00B2 A9AD 00B3 A9AE 00B7 A9AF 00B8 A9B0 00B9 A9B1 00BA A9B2 00BB A9B3 00BC A9B4 00BD A9B5 00BE A9B6 00BF A9B7 00C0 A9B8 00C1 A9B9 00C2 A9BA 00C3 A9BB 00C4 A9BC 00C5 A9BD 00C6 A9BE 00C7 A9BF 00C8 A9C0 00C9 A9C1 00CA A9C2 00CB A9C3 00CC A9C4 00CD A9C5 00CE A9C6 00CF A9C7 00D0 A9C8 00D1 A9C9 00D2 A9CA 00D3 A9CB 00D4 A9CC 00D5 A9CD 00D6 A9CE 00D8 A9CF 00D9 A9D0 00DA A9D1 00DB A9D2 00DC A9D3 00DD A9D4 00DE A9D5 00DF A9D6 00E0 A9D7 00E1 A9D8 00E2 A9D9 00E3 A9DA 00E4 A9DB 00E5 A9DC 00E6 A9DD 00E7 A9DE 00E8 A9DF 00E9 A9E0 00EA A9E1 00EB A9E2 00EC A9E3 00ED A9E4 00EE A9E5 00EF A9E6 00F0 A9E7 00F1 A9E8 00F2 A9E9 00F3 A9EA 00F4 A9EB 00F5 A9EC 00F6 A9ED 00F8 A9EE 00F9 A9EF 00FA A9F0 00FB A9F1 00FC A9F2 00FD A9F3 00FE A9F4 00FF A9F5 0100 A9F6 012A A9F7 016A A9F8 0112 A9F9 014C A9FA 0101 A9FB 012B A9FC 016B A9FD 0113 A9FE 014D AAA1 0104 AAA2 02D8 AAA3 0141 AAA4 013D AAA5 015A AAA6 0160 AAA7 015E AAA8 0164 AAA9 0179 AAAA 017D AAAB 017B AAAC 0105 AAAD 02DB AAAE 0142 AAAF 013E AAB0 015B AAB1 02C7 AAB2 0161 AAB3 015F AAB4 0165 AAB5 017A AAB6 02DD AAB7 017E AAB8 017C AAB9 0154 AABA 0102 AABB 0139 AABC 0106 AABD 010C AABE 0118 AABF 011A AAC0 010E AAC1 0143 AAC2 0147 AAC3 0150 AAC4 0158 AAC5 016E AAC6 0170 AAC7 0162 AAC8 0155 AAC9 0103 AACA 013A AACB 0107 AACC 010D AACD 0119 AACE 011B AACF 010F AAD0 0111 AAD1 0144 AAD2 0148 AAD3 0151 AAD4 0159 AAD5 016F AAD6 0171 AAD7 0163 AAD8 02D9 AAD9 0108 AADA 011C AADB 0124 AADC 0134 AADD 015C AADE 016C AADF 0109 AAE0 011D AAE1 0125 AAE2 0135 AAE3 015D AAE4 016D AAE5 0271 AAE6 028B AAE7 027E AAE8 0283 AAE9 0292 AAEA 026C AAEB 026E AAEC 0279 AAED 0288 AAEE 0256 AAEF 0273 AAF0 027D AAF1 0282 AAF2 0290 AAF3 027B AAF4 026D AAF5 025F AAF6 0272 AAF7 029D AAF8 028E AAF9 0261 AAFA 014B AAFB 0270 AAFC 0281 AAFD 0127 AAFE 0295 ABA1 0294 ABA2 0266 ABA3 0298 ABA4 01C2 ABA5 0253 ABA6 0257 ABA7 0284 ABA8 0260 ABA9 0193 ABAA 0153 ABAB 0152 ABAC 0268 ABAD 0289 ABAE 0258 ABAF 0275 ABB0 0259 ABB1 025C ABB2 025E ABB3 0250 ABB4 026F ABB5 028A ABB6 0264 ABB7 028C ABB8 0254 ABB9 0251 ABBA 0252 ABBB 028D ABBC 0265 ABBD 02A2 ABBE 02A1 ABBF 0255 ABC0 0291 ABC1 027A ABC2 0267 ABC3 025A ABC4 00E6 0300 ABC5 01FD ABC6 1F70 ABC7 1F71 ABC8 0254 0300 ABC9 0254 0301 ABCA 028C 0300 ABCB 028C 0301 ABCC 0259 0300 ABCD 0259 0301 ABCE 025A 0300 ABCF 025A 0301 ABD0 1F72 ABD1 1F73 ABD2 0361 ABD3 02C8 ABD4 02CC ABD5 02D0 ABD6 02D1 ABD7 0306 ABD8 203F ABD9 030B ABDA 0301 ABDB 0304 ABDC 0300 ABDD 030F ABDE 030C ABDF 0302 ABE0 02E5 ABE1 02E6 ABE2 02E7 ABE3 02E8 ABE4 02E9 ABE5 02E9 02E5 ABE6 02E5 02E9 ABE7 0325 ABE8 032C ABE9 0339 ABEA 031C ABEB 031F ABEC 0320 ABED 0308 ABEE 033D ABEF 0329 ABF0 032F ABF1 02DE ABF2 0324 ABF3 0330 ABF4 033C ABF5 0334 ABF6 031D ABF7 031E ABF8 0318 ABF9 0319 ABFA 032A ABFB 033A ABFC 033B ABFD 0303 ABFE 031A ACA1 2776 ACA2 2777 ACA3 2778 ACA4 2779 ACA5 277A ACA6 277B ACA7 277C ACA8 277D ACA9 277E ACAA 277F ACAB 24EB ACAC 24EC ACAD 24ED ACAE 24EE ACAF 24EF ACB0 24F0 ACB1 24F1 ACB2 24F2 ACB3 24F3 ACB4 24F4 ACB5 2170 ACB6 2171 ACB7 2172 ACB8 2173 ACB9 2174 ACBA 2175 ACBB 2176 ACBC 2177 ACBD 2178 ACBE 2179 ACBF 217A ACC0 217B ACC1 24D0 ACC2 24D1 ACC3 24D2 ACC4 24D3 ACC5 24D4 ACC6 24D5 ACC7 24D6 ACC8 24D7 ACC9 24D8 ACCA 24D9 ACCB 24DA ACCC 24DB ACCD 24DC ACCE 24DD ACCF 24DE ACD0 24DF ACD1 24E0 ACD2 24E1 ACD3 24E2 ACD4 24E3 ACD5 24E4 ACD6 24E5 ACD7 24E6 ACD8 24E7 ACD9 24E8 ACDA 24E9 ACDB 32D0 ACDC 32D1 ACDD 32D2 ACDE 32D3 ACDF 32D4 ACE0 32D5 ACE1 32D6 ACE2 32D7 ACE3 32D8 ACE4 32D9 ACE5 32DA ACE6 32DB ACE7 32DC ACE8 32DD ACE9 32DE ACEA 32DF ACEB 32E0 ACEC 32E1 ACED 32E2 ACEE 32E3 ACEF 32FA ACF0 32E9 ACF1 32E5 ACF2 32ED ACF3 32EC ACFD 2051 ACFE 2042 ADA1 2460 ADA2 2461 ADA3 2462 ADA4 2463 ADA5 2464 ADA6 2465 ADA7 2466 ADA8 2467 ADA9 2468 ADAA 2469 ADAB 246A ADAC 246B ADAD 246C ADAE 246D ADAF 246E ADB0 246F ADB1 2470 ADB2 2471 ADB3 2472 ADB4 2473 ADB5 2160 ADB6 2161 ADB7 2162 ADB8 2163 ADB9 2164 ADBA 2165 ADBB 2166 ADBC 2167 ADBD 2168 ADBE 2169 ADBF 216A ADC0 3349 ADC1 3314 ADC2 3322 ADC3 334D ADC4 3318 ADC5 3327 ADC6 3303 ADC7 3336 ADC8 3351 ADC9 3357 ADCA 330D ADCB 3326 ADCC 3323 ADCD 332B ADCE 334A ADCF 333B ADD0 339C ADD1 339D ADD2 339E ADD3 338E ADD4 338F ADD5 33C4 ADD6 33A1 ADD7 216B ADDF 337B ADE0 301D ADE1 301F ADE2 2116 ADE3 33CD ADE4 2121 ADE5 32A4 ADE6 32A5 ADE7 32A6 ADE8 32A7 ADE9 32A8 ADEA 3231 ADEB 3232 ADEC 3239 ADED 337E ADEE 337D ADEF 337C ADF3 222E ADF8 221F ADF9 22BF ADFD 2756 ADFE 261E AEA2 2000B AEA3 3402 AEA4 4E28 AEA5 4E2F AEA6 4E30 AEA7 4E8D AEA8 4EE1 AEA9 4EFD AEAA 4EFF AEAB 4F03 AEAC 4F0B AEAD 4F60 AEAE 4F48 AEAF 4F49 AEB0 4F56 AEB1 4F5F AEB2 4F6A AEB3 4F6C AEB4 4F7E AEB5 4F8A AEB6 4F94 AEB7 4F97 AEB8 FA30 AEB9 4FC9 AEBA 4FE0 AEBB 5001 AEBC 5002 AEBD 500E AEBE 5018 AEBF 5027 AEC0 502E AEC1 5040 AEC2 503B AEC3 5041 AEC4 5094 AEC5 50CC AEC6 50F2 AEC7 50D0 AEC8 50E6 AEC9 FA31 AECA 5106 AECB 5103 AECC 510B AECD 511E AECE 5135 AECF 514A AED0 FA32 AED1 5155 AED2 5157 AED3 34B5 AED4 519D AED5 51C3 AED6 51CA AED7 51DE AED8 51E2 AED9 51EE AEDA 5201 AEDB 34DB AEDC 5213 AEDD 5215 AEDE 5249 AEDF 5257 AEE0 5261 AEE1 5293 AEE2 52C8 AEE3 FA33 AEE4 52CC AEE5 52D0 AEE6 52D6 AEE7 52DB AEE8 FA34 AEE9 52F0 AEEA 52FB AEEB 5300 AEEC 5307 AEED 531C AEEE FA35 AEEF 5361 AEF0 5363 AEF1 537D AEF2 5393 AEF3 539D AEF4 53B2 AEF5 5412 AEF6 5427 AEF7 544D AEF8 549C AEF9 546B AEFA 5474 AEFB 547F AEFC 5488 AEFD 5496 AEFE 54A1 AFA1 54A9 AFA2 54C6 AFA3 54FF AFA4 550E AFA5 552B AFA6 5535 AFA7 5550 AFA8 555E AFA9 5581 AFAA 5586 AFAB 558E AFAC FA36 AFAD 55AD AFAE 55CE AFAF FA37 AFB0 5608 AFB1 560E AFB2 563B AFB3 5649 AFB4 5676 AFB5 5666 AFB6 FA38 AFB7 566F AFB8 5671 AFB9 5672 AFBA 5699 AFBB 569E AFBC 56A9 AFBD 56AC AFBE 56B3 AFBF 56C9 AFC0 56CA AFC1 570A AFC2 2123D AFC3 5721 AFC4 572F AFC5 5733 AFC6 5734 AFC7 5770 AFC8 5777 AFC9 577C AFCA 579C AFCB FA0F AFCC 2131B AFCD 57B8 AFCE 57C7 AFCF 57C8 AFD0 57CF AFD1 57E4 AFD2 57ED AFD3 57F5 AFD4 57F6 AFD5 57FF AFD6 5809 AFD7 FA10 AFD8 5861 AFD9 5864 AFDA FA39 AFDB 587C AFDC 5889 AFDD 589E AFDE FA3A AFDF 58A9 AFE0 2146E AFE1 58D2 AFE2 58CE AFE3 58D4 AFE4 58DA AFE5 58E0 AFE6 58E9 AFE7 590C AFE8 8641 AFE9 595D AFEA 596D AFEB 598B AFEC 5992 AFED 59A4 AFEE 59C3 AFEF 59D2 AFF0 59DD AFF1 5A13 AFF2 5A23 AFF3 5A67 AFF4 5A6D AFF5 5A77 AFF6 5A7E AFF7 5A84 AFF8 5A9E AFF9 5AA7 AFFA 5AC4 AFFB 218BD AFFC 5B19 AFFD 5B25 B0A1 4E9C B0A2 5516 B0A3 5A03 B0A4 963F B0A5 54C0 B0A6 611B B0A7 6328 B0A8 59F6 B0A9 9022 B0AA 8475 B0AB 831C B0AC 7A50 B0AD 60AA B0AE 63E1 B0AF 6E25 B0B0 65ED B0B1 8466 B0B2 82A6 B0B3 9BF5 B0B4 6893 B0B5 5727 B0B6 65A1 B0B7 6271 B0B8 5B9B B0B9 59D0 B0BA 867B B0BB 98F4 B0BC 7D62 B0BD 7DBE B0BE 9B8E B0BF 6216 B0C0 7C9F B0C1 88B7 B0C2 5B89 B0C3 5EB5 B0C4 6309 B0C5 6697 B0C6 6848 B0C7 95C7 B0C8 978D B0C9 674F B0CA 4EE5 B0CB 4F0A B0CC 4F4D B0CD 4F9D B0CE 5049 B0CF 56F2 B0D0 5937 B0D1 59D4 B0D2 5A01 B0D3 5C09 B0D4 60DF B0D5 610F B0D6 6170 B0D7 6613 B0D8 6905 B0D9 70BA B0DA 754F B0DB 7570 B0DC 79FB B0DD 7DAD B0DE 7DEF B0DF 80C3 B0E0 840E B0E1 8863 B0E2 8B02 B0E3 9055 B0E4 907A B0E5 533B B0E6 4E95 B0E7 4EA5 B0E8 57DF B0E9 80B2 B0EA 90C1 B0EB 78EF B0EC 4E00 B0ED 58F1 B0EE 6EA2 B0EF 9038 B0F0 7A32 B0F1 8328 B0F2 828B B0F3 9C2F B0F4 5141 B0F5 5370 B0F6 54BD B0F7 54E1 B0F8 56E0 B0F9 59FB B0FA 5F15 B0FB 98F2 B0FC 6DEB B0FD 80E4 B0FE 852D B1A1 9662 B1A2 9670 B1A3 96A0 B1A4 97FB B1A5 540B B1A6 53F3 B1A7 5B87 B1A8 70CF B1A9 7FBD B1AA 8FC2 B1AB 96E8 B1AC 536F B1AD 9D5C B1AE 7ABA B1AF 4E11 B1B0 7893 B1B1 81FC B1B2 6E26 B1B3 5618 B1B4 5504 B1B5 6B1D B1B6 851A B1B7 9C3B B1B8 59E5 B1B9 53A9 B1BA 6D66 B1BB 74DC B1BC 958F B1BD 5642 B1BE 4E91 B1BF 904B B1C0 96F2 B1C1 834F B1C2 990C B1C3 53E1 B1C4 55B6 B1C5 5B30 B1C6 5F71 B1C7 6620 B1C8 66F3 B1C9 6804 B1CA 6C38 B1CB 6CF3 B1CC 6D29 B1CD 745B B1CE 76C8 B1CF 7A4E B1D0 9834 B1D1 82F1 B1D2 885B B1D3 8A60 B1D4 92ED B1D5 6DB2 B1D6 75AB B1D7 76CA B1D8 99C5 B1D9 60A6 B1DA 8B01 B1DB 8D8A B1DC 95B2 B1DD 698E B1DE 53AD B1DF 5186 B1E0 5712 B1E1 5830 B1E2 5944 B1E3 5BB4 B1E4 5EF6 B1E5 6028 B1E6 63A9 B1E7 63F4 B1E8 6CBF B1E9 6F14 B1EA 708E B1EB 7114 B1EC 7159 B1ED 71D5 B1EE 733F B1EF 7E01 B1F0 8276 B1F1 82D1 B1F2 8597 B1F3 9060 B1F4 925B B1F5 9D1B B1F6 5869 B1F7 65BC B1F8 6C5A B1F9 7525 B1FA 51F9 B1FB 592E B1FC 5965 B1FD 5F80 B1FE 5FDC B2A1 62BC B2A2 65FA B2A3 6A2A B2A4 6B27 B2A5 6BB4 B2A6 738B B2A7 7FC1 B2A8 8956 B2A9 9D2C B2AA 9D0E B2AB 9EC4 B2AC 5CA1 B2AD 6C96 B2AE 837B B2AF 5104 B2B0 5C4B B2B1 61B6 B2B2 81C6 B2B3 6876 B2B4 7261 B2B5 4E59 B2B6 4FFA B2B7 5378 B2B8 6069 B2B9 6E29 B2BA 7A4F B2BB 97F3 B2BC 4E0B B2BD 5316 B2BE 4EEE B2BF 4F55 B2C0 4F3D B2C1 4FA1 B2C2 4F73 B2C3 52A0 B2C4 53EF B2C5 5609 B2C6 590F B2C7 5AC1 B2C8 5BB6 B2C9 5BE1 B2CA 79D1 B2CB 6687 B2CC 679C B2CD 67B6 B2CE 6B4C B2CF 6CB3 B2D0 706B B2D1 73C2 B2D2 798D B2D3 79BE B2D4 7A3C B2D5 7B87 B2D6 82B1 B2D7 82DB B2D8 8304 B2D9 8377 B2DA 83EF B2DB 83D3 B2DC 8766 B2DD 8AB2 B2DE 5629 B2DF 8CA8 B2E0 8FE6 B2E1 904E B2E2 971E B2E3 868A B2E4 4FC4 B2E5 5CE8 B2E6 6211 B2E7 7259 B2E8 753B B2E9 81E5 B2EA 82BD B2EB 86FE B2EC 8CC0 B2ED 96C5 B2EE 9913 B2EF 99D5 B2F0 4ECB B2F1 4F1A B2F2 89E3 B2F3 56DE B2F4 584A B2F5 58CA B2F6 5EFB B2F7 5FEB B2F8 602A B2F9 6094 B2FA 6062 B2FB 61D0 B2FC 6212 B2FD 62D0 B2FE 6539 B3A1 9B41 B3A2 6666 B3A3 68B0 B3A4 6D77 B3A5 7070 B3A6 754C B3A7 7686 B3A8 7D75 B3A9 82A5 B3AA 87F9 B3AB 958B B3AC 968E B3AD 8C9D B3AE 51F1 B3AF 52BE B3B0 5916 B3B1 54B3 B3B2 5BB3 B3B3 5D16 B3B4 6168 B3B5 6982 B3B6 6DAF B3B7 788D B3B8 84CB B3B9 8857 B3BA 8A72 B3BB 93A7 B3BC 9AB8 B3BD 6D6C B3BE 99A8 B3BF 86D9 B3C0 57A3 B3C1 67FF B3C2 86CE B3C3 920E B3C4 5283 B3C5 5687 B3C6 5404 B3C7 5ED3 B3C8 62E1 B3C9 64B9 B3CA 683C B3CB 6838 B3CC 6BBB B3CD 7372 B3CE 78BA B3CF 7A6B B3D0 899A B3D1 89D2 B3D2 8D6B B3D3 8F03 B3D4 90ED B3D5 95A3 B3D6 9694 B3D7 9769 B3D8 5B66 B3D9 5CB3 B3DA 697D B3DB 984D B3DC 984E B3DD 639B B3DE 7B20 B3DF 6A2B B3E0 6A7F B3E1 68B6 B3E2 9C0D B3E3 6F5F B3E4 5272 B3E5 559D B3E6 6070 B3E7 62EC B3E8 6D3B B3E9 6E07 B3EA 6ED1 B3EB 845B B3EC 8910 B3ED 8F44 B3EE 4E14 B3EF 9C39 B3F0 53F6 B3F1 691B B3F2 6A3A B3F3 9784 B3F4 682A B3F5 515C B3F6 7AC3 B3F7 84B2 B3F8 91DC B3F9 938C B3FA 565B B3FB 9D28 B3FC 6822 B3FD 8305 B3FE 8431 B4A1 7CA5 B4A2 5208 B4A3 82C5 B4A4 74E6 B4A5 4E7E B4A6 4F83 B4A7 51A0 B4A8 5BD2 B4A9 520A B4AA 52D8 B4AB 52E7 B4AC 5DFB B4AD 559A B4AE 582A B4AF 59E6 B4B0 5B8C B4B1 5B98 B4B2 5BDB B4B3 5E72 B4B4 5E79 B4B5 60A3 B4B6 611F B4B7 6163 B4B8 61BE B4B9 63DB B4BA 6562 B4BB 67D1 B4BC 6853 B4BD 68FA B4BE 6B3E B4BF 6B53 B4C0 6C57 B4C1 6F22 B4C2 6F97 B4C3 6F45 B4C4 74B0 B4C5 7518 B4C6 76E3 B4C7 770B B4C8 7AFF B4C9 7BA1 B4CA 7C21 B4CB 7DE9 B4CC 7F36 B4CD 7FF0 B4CE 809D B4CF 8266 B4D0 839E B4D1 89B3 B4D2 8ACC B4D3 8CAB B4D4 9084 B4D5 9451 B4D6 9593 B4D7 9591 B4D8 95A2 B4D9 9665 B4DA 97D3 B4DB 9928 B4DC 8218 B4DD 4E38 B4DE 542B B4DF 5CB8 B4E0 5DCC B4E1 73A9 B4E2 764C B4E3 773C B4E4 5CA9 B4E5 7FEB B4E6 8D0B B4E7 96C1 B4E8 9811 B4E9 9854 B4EA 9858 B4EB 4F01 B4EC 4F0E B4ED 5371 B4EE 559C B4EF 5668 B4F0 57FA B4F1 5947 B4F2 5B09 B4F3 5BC4 B4F4 5C90 B4F5 5E0C B4F6 5E7E B4F7 5FCC B4F8 63EE B4F9 673A B4FA 65D7 B4FB 65E2 B4FC 671F B4FD 68CB B4FE 68C4 B5A1 6A5F B5A2 5E30 B5A3 6BC5 B5A4 6C17 B5A5 6C7D B5A6 757F B5A7 7948 B5A8 5B63 B5A9 7A00 B5AA 7D00 B5AB 5FBD B5AC 898F B5AD 8A18 B5AE 8CB4 B5AF 8D77 B5B0 8ECC B5B1 8F1D B5B2 98E2 B5B3 9A0E B5B4 9B3C B5B5 4E80 B5B6 507D B5B7 5100 B5B8 5993 B5B9 5B9C B5BA 622F B5BB 6280 B5BC 64EC B5BD 6B3A B5BE 72A0 B5BF 7591 B5C0 7947 B5C1 7FA9 B5C2 87FB B5C3 8ABC B5C4 8B70 B5C5 63AC B5C6 83CA B5C7 97A0 B5C8 5409 B5C9 5403 B5CA 55AB B5CB 6854 B5CC 6A58 B5CD 8A70 B5CE 7827 B5CF 6775 B5D0 9ECD B5D1 5374 B5D2 5BA2 B5D3 811A B5D4 8650 B5D5 9006 B5D6 4E18 B5D7 4E45 B5D8 4EC7 B5D9 4F11 B5DA 53CA B5DB 5438 B5DC 5BAE B5DD 5F13 B5DE 6025 B5DF 6551 B5E0 673D B5E1 6C42 B5E2 6C72 B5E3 6CE3 B5E4 7078 B5E5 7403 B5E6 7A76 B5E7 7AAE B5E8 7B08 B5E9 7D1A B5EA 7CFE B5EB 7D66 B5EC 65E7 B5ED 725B B5EE 53BB B5EF 5C45 B5F0 5DE8 B5F1 62D2 B5F2 62E0 B5F3 6319 B5F4 6E20 B5F5 865A B5F6 8A31 B5F7 8DDD B5F8 92F8 B5F9 6F01 B5FA 79A6 B5FB 9B5A B5FC 4EA8 B5FD 4EAB B5FE 4EAC B6A1 4F9B B6A2 4FA0 B6A3 50D1 B6A4 5147 B6A5 7AF6 B6A6 5171 B6A7 51F6 B6A8 5354 B6A9 5321 B6AA 537F B6AB 53EB B6AC 55AC B6AD 5883 B6AE 5CE1 B6AF 5F37 B6B0 5F4A B6B1 602F B6B2 6050 B6B3 606D B6B4 631F B6B5 6559 B6B6 6A4B B6B7 6CC1 B6B8 72C2 B6B9 72ED B6BA 77EF B6BB 80F8 B6BC 8105 B6BD 8208 B6BE 854E B6BF 90F7 B6C0 93E1 B6C1 97FF B6C2 9957 B6C3 9A5A B6C4 4EF0 B6C5 51DD B6C6 5C2D B6C7 6681 B6C8 696D B6C9 5C40 B6CA 66F2 B6CB 6975 B6CC 7389 B6CD 6850 B6CE 7C81 B6CF 50C5 B6D0 52E4 B6D1 5747 B6D2 5DFE B6D3 9326 B6D4 65A4 B6D5 6B23 B6D6 6B3D B6D7 7434 B6D8 7981 B6D9 79BD B6DA 7B4B B6DB 7DCA B6DC 82B9 B6DD 83CC B6DE 887F B6DF 895F B6E0 8B39 B6E1 8FD1 B6E2 91D1 B6E3 541F B6E4 9280 B6E5 4E5D B6E6 5036 B6E7 53E5 B6E8 533A B6E9 72D7 B6EA 7396 B6EB 77E9 B6EC 82E6 B6ED 8EAF B6EE 99C6 B6EF 99C8 B6F0 99D2 B6F1 5177 B6F2 611A B6F3 865E B6F4 55B0 B6F5 7A7A B6F6 5076 B6F7 5BD3 B6F8 9047 B6F9 9685 B6FA 4E32 B6FB 6ADB B6FC 91E7 B6FD 5C51 B6FE 5C48 B7A1 6398 B7A2 7A9F B7A3 6C93 B7A4 9774 B7A5 8F61 B7A6 7AAA B7A7 718A B7A8 9688 B7A9 7C82 B7AA 6817 B7AB 7E70 B7AC 6851 B7AD 936C B7AE 52F2 B7AF 541B B7B0 85AB B7B1 8A13 B7B2 7FA4 B7B3 8ECD B7B4 90E1 B7B5 5366 B7B6 8888 B7B7 7941 B7B8 4FC2 B7B9 50BE B7BA 5211 B7BB 5144 B7BC 5553 B7BD 572D B7BE 73EA B7BF 578B B7C0 5951 B7C1 5F62 B7C2 5F84 B7C3 6075 B7C4 6176 B7C5 6167 B7C6 61A9 B7C7 63B2 B7C8 643A B7C9 656C B7CA 666F B7CB 6842 B7CC 6E13 B7CD 7566 B7CE 7A3D B7CF 7CFB B7D0 7D4C B7D1 7D99 B7D2 7E4B B7D3 7F6B B7D4 830E B7D5 834A B7D6 86CD B7D7 8A08 B7D8 8A63 B7D9 8B66 B7DA 8EFD B7DB 981A B7DC 9D8F B7DD 82B8 B7DE 8FCE B7DF 9BE8 B7E0 5287 B7E1 621F B7E2 6483 B7E3 6FC0 B7E4 9699 B7E5 6841 B7E6 5091 B7E7 6B20 B7E8 6C7A B7E9 6F54 B7EA 7A74 B7EB 7D50 B7EC 8840 B7ED 8A23 B7EE 6708 B7EF 4EF6 B7F0 5039 B7F1 5026 B7F2 5065 B7F3 517C B7F4 5238 B7F5 5263 B7F6 55A7 B7F7 570F B7F8 5805 B7F9 5ACC B7FA 5EFA B7FB 61B2 B7FC 61F8 B7FD 62F3 B7FE 6372 B8A1 691C B8A2 6A29 B8A3 727D B8A4 72AC B8A5 732E B8A6 7814 B8A7 786F B8A8 7D79 B8A9 770C B8AA 80A9 B8AB 898B B8AC 8B19 B8AD 8CE2 B8AE 8ED2 B8AF 9063 B8B0 9375 B8B1 967A B8B2 9855 B8B3 9A13 B8B4 9E78 B8B5 5143 B8B6 539F B8B7 53B3 B8B8 5E7B B8B9 5F26 B8BA 6E1B B8BB 6E90 B8BC 7384 B8BD 73FE B8BE 7D43 B8BF 8237 B8C0 8A00 B8C1 8AFA B8C2 9650 B8C3 4E4E B8C4 500B B8C5 53E4 B8C6 547C B8C7 56FA B8C8 59D1 B8C9 5B64 B8CA 5DF1 B8CB 5EAB B8CC 5F27 B8CD 6238 B8CE 6545 B8CF 67AF B8D0 6E56 B8D1 72D0 B8D2 7CCA B8D3 88B4 B8D4 80A1 B8D5 80E1 B8D6 83F0 B8D7 864E B8D8 8A87 B8D9 8DE8 B8DA 9237 B8DB 96C7 B8DC 9867 B8DD 9F13 B8DE 4E94 B8DF 4E92 B8E0 4F0D B8E1 5348 B8E2 5449 B8E3 543E B8E4 5A2F B8E5 5F8C B8E6 5FA1 B8E7 609F B8E8 68A7 B8E9 6A8E B8EA 745A B8EB 7881 B8EC 8A9E B8ED 8AA4 B8EE 8B77 B8EF 9190 B8F0 4E5E B8F1 9BC9 B8F2 4EA4 B8F3 4F7C B8F4 4FAF B8F5 5019 B8F6 5016 B8F7 5149 B8F8 516C B8F9 529F B8FA 52B9 B8FB 52FE B8FC 539A B8FD 53E3 B8FE 5411 B9A1 540E B9A2 5589 B9A3 5751 B9A4 57A2 B9A5 597D B9A6 5B54 B9A7 5B5D B9A8 5B8F B9A9 5DE5 B9AA 5DE7 B9AB 5DF7 B9AC 5E78 B9AD 5E83 B9AE 5E9A B9AF 5EB7 B9B0 5F18 B9B1 6052 B9B2 614C B9B3 6297 B9B4 62D8 B9B5 63A7 B9B6 653B B9B7 6602 B9B8 6643 B9B9 66F4 B9BA 676D B9BB 6821 B9BC 6897 B9BD 69CB B9BE 6C5F B9BF 6D2A B9C0 6D69 B9C1 6E2F B9C2 6E9D B9C3 7532 B9C4 7687 B9C5 786C B9C6 7A3F B9C7 7CE0 B9C8 7D05 B9C9 7D18 B9CA 7D5E B9CB 7DB1 B9CC 8015 B9CD 8003 B9CE 80AF B9CF 80B1 B9D0 8154 B9D1 818F B9D2 822A B9D3 8352 B9D4 884C B9D5 8861 B9D6 8B1B B9D7 8CA2 B9D8 8CFC B9D9 90CA B9DA 9175 B9DB 9271 B9DC 783F B9DD 92FC B9DE 95A4 B9DF 964D B9E0 9805 B9E1 9999 B9E2 9AD8 B9E3 9D3B B9E4 525B B9E5 52AB B9E6 53F7 B9E7 5408 B9E8 58D5 B9E9 62F7 B9EA 6FE0 B9EB 8C6A B9EC 8F5F B9ED 9EB9 B9EE 514B B9EF 523B B9F0 544A B9F1 56FD B9F2 7A40 B9F3 9177 B9F4 9D60 B9F5 9ED2 B9F6 7344 B9F7 6F09 B9F8 8170 B9F9 7511 B9FA 5FFD B9FB 60DA B9FC 9AA8 B9FD 72DB B9FE 8FBC BAA1 6B64 BAA2 9803 BAA3 4ECA BAA4 56F0 BAA5 5764 BAA6 58BE BAA7 5A5A BAA8 6068 BAA9 61C7 BAAA 660F BAAB 6606 BAAC 6839 BAAD 68B1 BAAE 6DF7 BAAF 75D5 BAB0 7D3A BAB1 826E BAB2 9B42 BAB3 4E9B BAB4 4F50 BAB5 53C9 BAB6 5506 BAB7 5D6F BAB8 5DE6 BAB9 5DEE BABA 67FB BABB 6C99 BABC 7473 BABD 7802 BABE 8A50 BABF 9396 BAC0 88DF BAC1 5750 BAC2 5EA7 BAC3 632B BAC4 50B5 BAC5 50AC BAC6 518D BAC7 6700 BAC8 54C9 BAC9 585E BACA 59BB BACB 5BB0 BACC 5F69 BACD 624D BACE 63A1 BACF 683D BAD0 6B73 BAD1 6E08 BAD2 707D BAD3 91C7 BAD4 7280 BAD5 7815 BAD6 7826 BAD7 796D BAD8 658E BAD9 7D30 BADA 83DC BADB 88C1 BADC 8F09 BADD 969B BADE 5264 BADF 5728 BAE0 6750 BAE1 7F6A BAE2 8CA1 BAE3 51B4 BAE4 5742 BAE5 962A BAE6 583A BAE7 698A BAE8 80B4 BAE9 54B2 BAEA 5D0E BAEB 57FC BAEC 7895 BAED 9DFA BAEE 4F5C BAEF 524A BAF0 548B BAF1 643E BAF2 6628 BAF3 6714 BAF4 67F5 BAF5 7A84 BAF6 7B56 BAF7 7D22 BAF8 932F BAF9 685C BAFA 9BAD BAFB 7B39 BAFC 5319 BAFD 518A BAFE 5237 BBA1 5BDF BBA2 62F6 BBA3 64AE BBA4 64E6 BBA5 672D BBA6 6BBA BBA7 85A9 BBA8 96D1 BBA9 7690 BBAA 9BD6 BBAB 634C BBAC 9306 BBAD 9BAB BBAE 76BF BBAF 6652 BBB0 4E09 BBB1 5098 BBB2 53C2 BBB3 5C71 BBB4 60E8 BBB5 6492 BBB6 6563 BBB7 685F BBB8 71E6 BBB9 73CA BBBA 7523 BBBB 7B97 BBBC 7E82 BBBD 8695 BBBE 8B83 BBBF 8CDB BBC0 9178 BBC1 9910 BBC2 65AC BBC3 66AB BBC4 6B8B BBC5 4ED5 BBC6 4ED4 BBC7 4F3A BBC8 4F7F BBC9 523A BBCA 53F8 BBCB 53F2 BBCC 55E3 BBCD 56DB BBCE 58EB BBCF 59CB BBD0 59C9 BBD1 59FF BBD2 5B50 BBD3 5C4D BBD4 5E02 BBD5 5E2B BBD6 5FD7 BBD7 601D BBD8 6307 BBD9 652F BBDA 5B5C BBDB 65AF BBDC 65BD BBDD 65E8 BBDE 679D BBDF 6B62 BBE0 6B7B BBE1 6C0F BBE2 7345 BBE3 7949 BBE4 79C1 BBE5 7CF8 BBE6 7D19 BBE7 7D2B BBE8 80A2 BBE9 8102 BBEA 81F3 BBEB 8996 BBEC 8A5E BBED 8A69 BBEE 8A66 BBEF 8A8C BBF0 8AEE BBF1 8CC7 BBF2 8CDC BBF3 96CC BBF4 98FC BBF5 6B6F BBF6 4E8B BBF7 4F3C BBF8 4F8D BBF9 5150 BBFA 5B57 BBFB 5BFA BBFC 6148 BBFD 6301 BBFE 6642 BCA1 6B21 BCA2 6ECB BCA3 6CBB BCA4 723E BCA5 74BD BCA6 75D4 BCA7 78C1 BCA8 793A BCA9 800C BCAA 8033 BCAB 81EA BCAC 8494 BCAD 8F9E BCAE 6C50 BCAF 9E7F BCB0 5F0F BCB1 8B58 BCB2 9D2B BCB3 7AFA BCB4 8EF8 BCB5 5B8D BCB6 96EB BCB7 4E03 BCB8 53F1 BCB9 57F7 BCBA 5931 BCBB 5AC9 BCBC 5BA4 BCBD 6089 BCBE 6E7F BCBF 6F06 BCC0 75BE BCC1 8CEA BCC2 5B9F BCC3 8500 BCC4 7BE0 BCC5 5072 BCC6 67F4 BCC7 829D BCC8 5C61 BCC9 854A BCCA 7E1E BCCB 820E BCCC 5199 BCCD 5C04 BCCE 6368 BCCF 8D66 BCD0 659C BCD1 716E BCD2 793E BCD3 7D17 BCD4 8005 BCD5 8B1D BCD6 8ECA BCD7 906E BCD8 86C7 BCD9 90AA BCDA 501F BCDB 52FA BCDC 5C3A BCDD 6753 BCDE 707C BCDF 7235 BCE0 914C BCE1 91C8 BCE2 932B BCE3 82E5 BCE4 5BC2 BCE5 5F31 BCE6 60F9 BCE7 4E3B BCE8 53D6 BCE9 5B88 BCEA 624B BCEB 6731 BCEC 6B8A BCED 72E9 BCEE 73E0 BCEF 7A2E BCF0 816B BCF1 8DA3 BCF2 9152 BCF3 9996 BCF4 5112 BCF5 53D7 BCF6 546A BCF7 5BFF BCF8 6388 BCF9 6A39 BCFA 7DAC BCFB 9700 BCFC 56DA BCFD 53CE BCFE 5468 BDA1 5B97 BDA2 5C31 BDA3 5DDE BDA4 4FEE BDA5 6101 BDA6 62FE BDA7 6D32 BDA8 79C0 BDA9 79CB BDAA 7D42 BDAB 7E4D BDAC 7FD2 BDAD 81ED BDAE 821F BDAF 8490 BDB0 8846 BDB1 8972 BDB2 8B90 BDB3 8E74 BDB4 8F2F BDB5 9031 BDB6 914B BDB7 916C BDB8 96C6 BDB9 919C BDBA 4EC0 BDBB 4F4F BDBC 5145 BDBD 5341 BDBE 5F93 BDBF 620E BDC0 67D4 BDC1 6C41 BDC2 6E0B BDC3 7363 BDC4 7E26 BDC5 91CD BDC6 9283 BDC7 53D4 BDC8 5919 BDC9 5BBF BDCA 6DD1 BDCB 795D BDCC 7E2E BDCD 7C9B BDCE 587E BDCF 719F BDD0 51FA BDD1 8853 BDD2 8FF0 BDD3 4FCA BDD4 5CFB BDD5 6625 BDD6 77AC BDD7 7AE3 BDD8 821C BDD9 99FF BDDA 51C6 BDDB 5FAA BDDC 65EC BDDD 696F BDDE 6B89 BDDF 6DF3 BDE0 6E96 BDE1 6F64 BDE2 76FE BDE3 7D14 BDE4 5DE1 BDE5 9075 BDE6 9187 BDE7 9806 BDE8 51E6 BDE9 521D BDEA 6240 BDEB 6691 BDEC 66D9 BDED 6E1A BDEE 5EB6 BDEF 7DD2 BDF0 7F72 BDF1 66F8 BDF2 85AF BDF3 85F7 BDF4 8AF8 BDF5 52A9 BDF6 53D9 BDF7 5973 BDF8 5E8F BDF9 5F90 BDFA 6055 BDFB 92E4 BDFC 9664 BDFD 50B7 BDFE 511F BEA1 52DD BEA2 5320 BEA3 5347 BEA4 53EC BEA5 54E8 BEA6 5546 BEA7 5531 BEA8 5617 BEA9 5968 BEAA 59BE BEAB 5A3C BEAC 5BB5 BEAD 5C06 BEAE 5C0F BEAF 5C11 BEB0 5C1A BEB1 5E84 BEB2 5E8A BEB3 5EE0 BEB4 5F70 BEB5 627F BEB6 6284 BEB7 62DB BEB8 638C BEB9 6377 BEBA 6607 BEBB 660C BEBC 662D BEBD 6676 BEBE 677E BEBF 68A2 BEC0 6A1F BEC1 6A35 BEC2 6CBC BEC3 6D88 BEC4 6E09 BEC5 6E58 BEC6 713C BEC7 7126 BEC8 7167 BEC9 75C7 BECA 7701 BECB 785D BECC 7901 BECD 7965 BECE 79F0 BECF 7AE0 BED0 7B11 BED1 7CA7 BED2 7D39 BED3 8096 BED4 83D6 BED5 848B BED6 8549 BED7 885D BED8 88F3 BED9 8A1F BEDA 8A3C BEDB 8A54 BEDC 8A73 BEDD 8C61 BEDE 8CDE BEDF 91A4 BEE0 9266 BEE1 937E BEE2 9418 BEE3 969C BEE4 9798 BEE5 4E0A BEE6 4E08 BEE7 4E1E BEE8 4E57 BEE9 5197 BEEA 5270 BEEB 57CE BEEC 5834 BEED 58CC BEEE 5B22 BEEF 5E38 BEF0 60C5 BEF1 64FE BEF2 6761 BEF3 6756 BEF4 6D44 BEF5 72B6 BEF6 7573 BEF7 7A63 BEF8 84B8 BEF9 8B72 BEFA 91B8 BEFB 9320 BEFC 5631 BEFD 57F4 BEFE 98FE BFA1 62ED BFA2 690D BFA3 6B96 BFA4 71ED BFA5 7E54 BFA6 8077 BFA7 8272 BFA8 89E6 BFA9 98DF BFAA 8755 BFAB 8FB1 BFAC 5C3B BFAD 4F38 BFAE 4FE1 BFAF 4FB5 BFB0 5507 BFB1 5A20 BFB2 5BDD BFB3 5BE9 BFB4 5FC3 BFB5 614E BFB6 632F BFB7 65B0 BFB8 664B BFB9 68EE BFBA 699B BFBB 6D78 BFBC 6DF1 BFBD 7533 BFBE 75B9 BFBF 771F BFC0 795E BFC1 79E6 BFC2 7D33 BFC3 81E3 BFC4 82AF BFC5 85AA BFC6 89AA BFC7 8A3A BFC8 8EAB BFC9 8F9B BFCA 9032 BFCB 91DD BFCC 9707 BFCD 4EBA BFCE 4EC1 BFCF 5203 BFD0 5875 BFD1 58EC BFD2 5C0B BFD3 751A BFD4 5C3D BFD5 814E BFD6 8A0A BFD7 8FC5 BFD8 9663 BFD9 976D BFDA 7B25 BFDB 8ACF BFDC 9808 BFDD 9162 BFDE 56F3 BFDF 53A8 BFE0 9017 BFE1 5439 BFE2 5782 BFE3 5E25 BFE4 63A8 BFE5 6C34 BFE6 708A BFE7 7761 BFE8 7C8B BFE9 7FE0 BFEA 8870 BFEB 9042 BFEC 9154 BFED 9310 BFEE 9318 BFEF 968F BFF0 745E BFF1 9AC4 BFF2 5D07 BFF3 5D69 BFF4 6570 BFF5 67A2 BFF6 8DA8 BFF7 96DB BFF8 636E BFF9 6749 BFFA 6919 BFFB 83C5 BFFC 9817 BFFD 96C0 BFFE 88FE C0A1 6F84 C0A2 647A C0A3 5BF8 C0A4 4E16 C0A5 702C C0A6 755D C0A7 662F C0A8 51C4 C0A9 5236 C0AA 52E2 C0AB 59D3 C0AC 5F81 C0AD 6027 C0AE 6210 C0AF 653F C0B0 6574 C0B1 661F C0B2 6674 C0B3 68F2 C0B4 6816 C0B5 6B63 C0B6 6E05 C0B7 7272 C0B8 751F C0B9 76DB C0BA 7CBE C0BB 8056 C0BC 58F0 C0BD 88FD C0BE 897F C0BF 8AA0 C0C0 8A93 C0C1 8ACB C0C2 901D C0C3 9192 C0C4 9752 C0C5 9759 C0C6 6589 C0C7 7A0E C0C8 8106 C0C9 96BB C0CA 5E2D C0CB 60DC C0CC 621A C0CD 65A5 C0CE 6614 C0CF 6790 C0D0 77F3 C0D1 7A4D C0D2 7C4D C0D3 7E3E C0D4 810A C0D5 8CAC C0D6 8D64 C0D7 8DE1 C0D8 8E5F C0D9 78A9 C0DA 5207 C0DB 62D9 C0DC 63A5 C0DD 6442 C0DE 6298 C0DF 8A2D C0E0 7A83 C0E1 7BC0 C0E2 8AAC C0E3 96EA C0E4 7D76 C0E5 820C C0E6 8749 C0E7 4ED9 C0E8 5148 C0E9 5343 C0EA 5360 C0EB 5BA3 C0EC 5C02 C0ED 5C16 C0EE 5DDD C0EF 6226 C0F0 6247 C0F1 64B0 C0F2 6813 C0F3 6834 C0F4 6CC9 C0F5 6D45 C0F6 6D17 C0F7 67D3 C0F8 6F5C C0F9 714E C0FA 717D C0FB 65CB C0FC 7A7F C0FD 7BAD C0FE 7DDA C1A1 7E4A C1A2 7FA8 C1A3 817A C1A4 821B C1A5 8239 C1A6 85A6 C1A7 8A6E C1A8 8CCE C1A9 8DF5 C1AA 9078 C1AB 9077 C1AC 92AD C1AD 9291 C1AE 9583 C1AF 9BAE C1B0 524D C1B1 5584 C1B2 6F38 C1B3 7136 C1B4 5168 C1B5 7985 C1B6 7E55 C1B7 81B3 C1B8 7CCE C1B9 564C C1BA 5851 C1BB 5CA8 C1BC 63AA C1BD 66FE C1BE 66FD C1BF 695A C1C0 72D9 C1C1 758F C1C2 758E C1C3 790E C1C4 7956 C1C5 79DF C1C6 7C97 C1C7 7D20 C1C8 7D44 C1C9 8607 C1CA 8A34 C1CB 963B C1CC 9061 C1CD 9F20 C1CE 50E7 C1CF 5275 C1D0 53CC C1D1 53E2 C1D2 5009 C1D3 55AA C1D4 58EE C1D5 594F C1D6 723D C1D7 5B8B C1D8 5C64 C1D9 531D C1DA 60E3 C1DB 60F3 C1DC 635C C1DD 6383 C1DE 633F C1DF 63BB C1E0 64CD C1E1 65E9 C1E2 66F9 C1E3 5DE3 C1E4 69CD C1E5 69FD C1E6 6F15 C1E7 71E5 C1E8 4E89 C1E9 75E9 C1EA 76F8 C1EB 7A93 C1EC 7CDF C1ED 7DCF C1EE 7D9C C1EF 8061 C1F0 8349 C1F1 8358 C1F2 846C C1F3 84BC C1F4 85FB C1F5 88C5 C1F6 8D70 C1F7 9001 C1F8 906D C1F9 9397 C1FA 971C C1FB 9A12 C1FC 50CF C1FD 5897 C1FE 618E C2A1 81D3 C2A2 8535 C2A3 8D08 C2A4 9020 C2A5 4FC3 C2A6 5074 C2A7 5247 C2A8 5373 C2A9 606F C2AA 6349 C2AB 675F C2AC 6E2C C2AD 8DB3 C2AE 901F C2AF 4FD7 C2B0 5C5E C2B1 8CCA C2B2 65CF C2B3 7D9A C2B4 5352 C2B5 8896 C2B6 5176 C2B7 63C3 C2B8 5B58 C2B9 5B6B C2BA 5C0A C2BB 640D C2BC 6751 C2BD 905C C2BE 4ED6 C2BF 591A C2C0 592A C2C1 6C70 C2C2 8A51 C2C3 553E C2C4 5815 C2C5 59A5 C2C6 60F0 C2C7 6253 C2C8 67C1 C2C9 8235 C2CA 6955 C2CB 9640 C2CC 99C4 C2CD 9A28 C2CE 4F53 C2CF 5806 C2D0 5BFE C2D1 8010 C2D2 5CB1 C2D3 5E2F C2D4 5F85 C2D5 6020 C2D6 614B C2D7 6234 C2D8 66FF C2D9 6CF0 C2DA 6EDE C2DB 80CE C2DC 817F C2DD 82D4 C2DE 888B C2DF 8CB8 C2E0 9000 C2E1 902E C2E2 968A C2E3 9EDB C2E4 9BDB C2E5 4EE3 C2E6 53F0 C2E7 5927 C2E8 7B2C C2E9 918D C2EA 984C C2EB 9DF9 C2EC 6EDD C2ED 7027 C2EE 5353 C2EF 5544 C2F0 5B85 C2F1 6258 C2F2 629E C2F3 62D3 C2F4 6CA2 C2F5 6FEF C2F6 7422 C2F7 8A17 C2F8 9438 C2F9 6FC1 C2FA 8AFE C2FB 8338 C2FC 51E7 C2FD 86F8 C2FE 53EA C3A1 53E9 C3A2 4F46 C3A3 9054 C3A4 8FB0 C3A5 596A C3A6 8131 C3A7 5DFD C3A8 7AEA C3A9 8FBF C3AA 68DA C3AB 8C37 C3AC 72F8 C3AD 9C48 C3AE 6A3D C3AF 8AB0 C3B0 4E39 C3B1 5358 C3B2 5606 C3B3 5766 C3B4 62C5 C3B5 63A2 C3B6 65E6 C3B7 6B4E C3B8 6DE1 C3B9 6E5B C3BA 70AD C3BB 77ED C3BC 7AEF C3BD 7BAA C3BE 7DBB C3BF 803D C3C0 80C6 C3C1 86CB C3C2 8A95 C3C3 935B C3C4 56E3 C3C5 58C7 C3C6 5F3E C3C7 65AD C3C8 6696 C3C9 6A80 C3CA 6BB5 C3CB 7537 C3CC 8AC7 C3CD 5024 C3CE 77E5 C3CF 5730 C3D0 5F1B C3D1 6065 C3D2 667A C3D3 6C60 C3D4 75F4 C3D5 7A1A C3D6 7F6E C3D7 81F4 C3D8 8718 C3D9 9045 C3DA 99B3 C3DB 7BC9 C3DC 755C C3DD 7AF9 C3DE 7B51 C3DF 84C4 C3E0 9010 C3E1 79E9 C3E2 7A92 C3E3 8336 C3E4 5AE1 C3E5 7740 C3E6 4E2D C3E7 4EF2 C3E8 5B99 C3E9 5FE0 C3EA 62BD C3EB 663C C3EC 67F1 C3ED 6CE8 C3EE 866B C3EF 8877 C3F0 8A3B C3F1 914E C3F2 92F3 C3F3 99D0 C3F4 6A17 C3F5 7026 C3F6 732A C3F7 82E7 C3F8 8457 C3F9 8CAF C3FA 4E01 C3FB 5146 C3FC 51CB C3FD 558B C3FE 5BF5 C4A1 5E16 C4A2 5E33 C4A3 5E81 C4A4 5F14 C4A5 5F35 C4A6 5F6B C4A7 5FB4 C4A8 61F2 C4A9 6311 C4AA 66A2 C4AB 671D C4AC 6F6E C4AD 7252 C4AE 753A C4AF 773A C4B0 8074 C4B1 8139 C4B2 8178 C4B3 8776 C4B4 8ABF C4B5 8ADC C4B6 8D85 C4B7 8DF3 C4B8 929A C4B9 9577 C4BA 9802 C4BB 9CE5 C4BC 52C5 C4BD 6357 C4BE 76F4 C4BF 6715 C4C0 6C88 C4C1 73CD C4C2 8CC3 C4C3 93AE C4C4 9673 C4C5 6D25 C4C6 589C C4C7 690E C4C8 69CC C4C9 8FFD C4CA 939A C4CB 75DB C4CC 901A C4CD 585A C4CE 6802 C4CF 63B4 C4D0 69FB C4D1 4F43 C4D2 6F2C C4D3 67D8 C4D4 8FBB C4D5 8526 C4D6 7DB4 C4D7 9354 C4D8 693F C4D9 6F70 C4DA 576A C4DB 58F7 C4DC 5B2C C4DD 7D2C C4DE 722A C4DF 540A C4E0 91E3 C4E1 9DB4 C4E2 4EAD C4E3 4F4E C4E4 505C C4E5 5075 C4E6 5243 C4E7 8C9E C4E8 5448 C4E9 5824 C4EA 5B9A C4EB 5E1D C4EC 5E95 C4ED 5EAD C4EE 5EF7 C4EF 5F1F C4F0 608C C4F1 62B5 C4F2 633A C4F3 63D0 C4F4 68AF C4F5 6C40 C4F6 7887 C4F7 798E C4F8 7A0B C4F9 7DE0 C4FA 8247 C4FB 8A02 C4FC 8AE6 C4FD 8E44 C4FE 9013 C5A1 90B8 C5A2 912D C5A3 91D8 C5A4 9F0E C5A5 6CE5 C5A6 6458 C5A7 64E2 C5A8 6575 C5A9 6EF4 C5AA 7684 C5AB 7B1B C5AC 9069 C5AD 93D1 C5AE 6EBA C5AF 54F2 C5B0 5FB9 C5B1 64A4 C5B2 8F4D C5B3 8FED C5B4 9244 C5B5 5178 C5B6 586B C5B7 5929 C5B8 5C55 C5B9 5E97 C5BA 6DFB C5BB 7E8F C5BC 751C C5BD 8CBC C5BE 8EE2 C5BF 985B C5C0 70B9 C5C1 4F1D C5C2 6BBF C5C3 6FB1 C5C4 7530 C5C5 96FB C5C6 514E C5C7 5410 C5C8 5835 C5C9 5857 C5CA 59AC C5CB 5C60 C5CC 5F92 C5CD 6597 C5CE 675C C5CF 6E21 C5D0 767B C5D1 83DF C5D2 8CED C5D3 9014 C5D4 90FD C5D5 934D C5D6 7825 C5D7 783A C5D8 52AA C5D9 5EA6 C5DA 571F C5DB 5974 C5DC 6012 C5DD 5012 C5DE 515A C5DF 51AC C5E0 51CD C5E1 5200 C5E2 5510 C5E3 5854 C5E4 5858 C5E5 5957 C5E6 5B95 C5E7 5CF6 C5E8 5D8B C5E9 60BC C5EA 6295 C5EB 642D C5EC 6771 C5ED 6843 C5EE 68BC C5EF 68DF C5F0 76D7 C5F1 6DD8 C5F2 6E6F C5F3 6D9B C5F4 706F C5F5 71C8 C5F6 5F53 C5F7 75D8 C5F8 7977 C5F9 7B49 C5FA 7B54 C5FB 7B52 C5FC 7CD6 C5FD 7D71 C5FE 5230 C6A1 8463 C6A2 8569 C6A3 85E4 C6A4 8A0E C6A5 8B04 C6A6 8C46 C6A7 8E0F C6A8 9003 C6A9 900F C6AA 9419 C6AB 9676 C6AC 982D C6AD 9A30 C6AE 95D8 C6AF 50CD C6B0 52D5 C6B1 540C C6B2 5802 C6B3 5C0E C6B4 61A7 C6B5 649E C6B6 6D1E C6B7 77B3 C6B8 7AE5 C6B9 80F4 C6BA 8404 C6BB 9053 C6BC 9285 C6BD 5CE0 C6BE 9D07 C6BF 533F C6C0 5F97 C6C1 5FB3 C6C2 6D9C C6C3 7279 C6C4 7763 C6C5 79BF C6C6 7BE4 C6C7 6BD2 C6C8 72EC C6C9 8AAD C6CA 6803 C6CB 6A61 C6CC 51F8 C6CD 7A81 C6CE 6934 C6CF 5C4A C6D0 9CF6 C6D1 82EB C6D2 5BC5 C6D3 9149 C6D4 701E C6D5 5678 C6D6 5C6F C6D7 60C7 C6D8 6566 C6D9 6C8C C6DA 8C5A C6DB 9041 C6DC 9813 C6DD 5451 C6DE 66C7 C6DF 920D C6E0 5948 C6E1 90A3 C6E2 5185 C6E3 4E4D C6E4 51EA C6E5 8599 C6E6 8B0E C6E7 7058 C6E8 637A C6E9 934B C6EA 6962 C6EB 99B4 C6EC 7E04 C6ED 7577 C6EE 5357 C6EF 6960 C6F0 8EDF C6F1 96E3 C6F2 6C5D C6F3 4E8C C6F4 5C3C C6F5 5F10 C6F6 8FE9 C6F7 5302 C6F8 8CD1 C6F9 8089 C6FA 8679 C6FB 5EFF C6FC 65E5 C6FD 4E73 C6FE 5165 C7A1 5982 C7A2 5C3F C7A3 97EE C7A4 4EFB C7A5 598A C7A6 5FCD C7A7 8A8D C7A8 6FE1 C7A9 79B0 C7AA 7962 C7AB 5BE7 C7AC 8471 C7AD 732B C7AE 71B1 C7AF 5E74 C7B0 5FF5 C7B1 637B C7B2 649A C7B3 71C3 C7B4 7C98 C7B5 4E43 C7B6 5EFC C7B7 4E4B C7B8 57DC C7B9 56A2 C7BA 60A9 C7BB 6FC3 C7BC 7D0D C7BD 80FD C7BE 8133 C7BF 81BF C7C0 8FB2 C7C1 8997 C7C2 86A4 C7C3 5DF4 C7C4 628A C7C5 64AD C7C6 8987 C7C7 6777 C7C8 6CE2 C7C9 6D3E C7CA 7436 C7CB 7834 C7CC 5A46 C7CD 7F75 C7CE 82AD C7CF 99AC C7D0 4FF3 C7D1 5EC3 C7D2 62DD C7D3 6392 C7D4 6557 C7D5 676F C7D6 76C3 C7D7 724C C7D8 80CC C7D9 80BA C7DA 8F29 C7DB 914D C7DC 500D C7DD 57F9 C7DE 5A92 C7DF 6885 C7E0 6973 C7E1 7164 C7E2 72FD C7E3 8CB7 C7E4 58F2 C7E5 8CE0 C7E6 966A C7E7 9019 C7E8 877F C7E9 79E4 C7EA 77E7 C7EB 8429 C7EC 4F2F C7ED 5265 C7EE 535A C7EF 62CD C7F0 67CF C7F1 6CCA C7F2 767D C7F3 7B94 C7F4 7C95 C7F5 8236 C7F6 8584 C7F7 8FEB C7F8 66DD C7F9 6F20 C7FA 7206 C7FB 7E1B C7FC 83AB C7FD 99C1 C7FE 9EA6 C8A1 51FD C8A2 7BB1 C8A3 7872 C8A4 7BB8 C8A5 8087 C8A6 7B48 C8A7 6AE8 C8A8 5E61 C8A9 808C C8AA 7551 C8AB 7560 C8AC 516B C8AD 9262 C8AE 6E8C C8AF 767A C8B0 9197 C8B1 9AEA C8B2 4F10 C8B3 7F70 C8B4 629C C8B5 7B4F C8B6 95A5 C8B7 9CE9 C8B8 567A C8B9 5859 C8BA 86E4 C8BB 96BC C8BC 4F34 C8BD 5224 C8BE 534A C8BF 53CD C8C0 53DB C8C1 5E06 C8C2 642C C8C3 6591 C8C4 677F C8C5 6C3E C8C6 6C4E C8C7 7248 C8C8 72AF C8C9 73ED C8CA 7554 C8CB 7E41 C8CC 822C C8CD 85E9 C8CE 8CA9 C8CF 7BC4 C8D0 91C6 C8D1 7169 C8D2 9812 C8D3 98EF C8D4 633D C8D5 6669 C8D6 756A C8D7 76E4 C8D8 78D0 C8D9 8543 C8DA 86EE C8DB 532A C8DC 5351 C8DD 5426 C8DE 5983 C8DF 5E87 C8E0 5F7C C8E1 60B2 C8E2 6249 C8E3 6279 C8E4 62AB C8E5 6590 C8E6 6BD4 C8E7 6CCC C8E8 75B2 C8E9 76AE C8EA 7891 C8EB 79D8 C8EC 7DCB C8ED 7F77 C8EE 80A5 C8EF 88AB C8F0 8AB9 C8F1 8CBB C8F2 907F C8F3 975E C8F4 98DB C8F5 6A0B C8F6 7C38 C8F7 5099 C8F8 5C3E C8F9 5FAE C8FA 6787 C8FB 6BD8 C8FC 7435 C8FD 7709 C8FE 7F8E C9A1 9F3B C9A2 67CA C9A3 7A17 C9A4 5339 C9A5 758B C9A6 9AED C9A7 5F66 C9A8 819D C9A9 83F1 C9AA 8098 C9AB 5F3C C9AC 5FC5 C9AD 7562 C9AE 7B46 C9AF 903C C9B0 6867 C9B1 59EB C9B2 5A9B C9B3 7D10 C9B4 767E C9B5 8B2C C9B6 4FF5 C9B7 5F6A C9B8 6A19 C9B9 6C37 C9BA 6F02 C9BB 74E2 C9BC 7968 C9BD 8868 C9BE 8A55 C9BF 8C79 C9C0 5EDF C9C1 63CF C9C2 75C5 C9C3 79D2 C9C4 82D7 C9C5 9328 C9C6 92F2 C9C7 849C C9C8 86ED C9C9 9C2D C9CA 54C1 C9CB 5F6C C9CC 658C C9CD 6D5C C9CE 7015 C9CF 8CA7 C9D0 8CD3 C9D1 983B C9D2 654F C9D3 74F6 C9D4 4E0D C9D5 4ED8 C9D6 57E0 C9D7 592B C9D8 5A66 C9D9 5BCC C9DA 51A8 C9DB 5E03 C9DC 5E9C C9DD 6016 C9DE 6276 C9DF 6577 C9E0 65A7 C9E1 666E C9E2 6D6E C9E3 7236 C9E4 7B26 C9E5 8150 C9E6 819A C9E7 8299 C9E8 8B5C C9E9 8CA0 C9EA 8CE6 C9EB 8D74 C9EC 961C C9ED 9644 C9EE 4FAE C9EF 64AB C9F0 6B66 C9F1 821E C9F2 8461 C9F3 856A C9F4 90E8 C9F5 5C01 C9F6 6953 C9F7 98A8 C9F8 847A C9F9 8557 C9FA 4F0F C9FB 526F C9FC 5FA9 C9FD 5E45 C9FE 670D CAA1 798F CAA2 8179 CAA3 8907 CAA4 8986 CAA5 6DF5 CAA6 5F17 CAA7 6255 CAA8 6CB8 CAA9 4ECF CAAA 7269 CAAB 9B92 CAAC 5206 CAAD 543B CAAE 5674 CAAF 58B3 CAB0 61A4 CAB1 626E CAB2 711A CAB3 596E CAB4 7C89 CAB5 7CDE CAB6 7D1B CAB7 96F0 CAB8 6587 CAB9 805E CABA 4E19 CABB 4F75 CABC 5175 CABD 5840 CABE 5E63 CABF 5E73 CAC0 5F0A CAC1 67C4 CAC2 4E26 CAC3 853D CAC4 9589 CAC5 965B CAC6 7C73 CAC7 9801 CAC8 50FB CAC9 58C1 CACA 7656 CACB 78A7 CACC 5225 CACD 77A5 CACE 8511 CACF 7B86 CAD0 504F CAD1 5909 CAD2 7247 CAD3 7BC7 CAD4 7DE8 CAD5 8FBA CAD6 8FD4 CAD7 904D CAD8 4FBF CAD9 52C9 CADA 5A29 CADB 5F01 CADC 97AD CADD 4FDD CADE 8217 CADF 92EA CAE0 5703 CAE1 6355 CAE2 6B69 CAE3 752B CAE4 88DC CAE5 8F14 CAE6 7A42 CAE7 52DF CAE8 5893 CAE9 6155 CAEA 620A CAEB 66AE CAEC 6BCD CAED 7C3F CAEE 83E9 CAEF 5023 CAF0 4FF8 CAF1 5305 CAF2 5446 CAF3 5831 CAF4 5949 CAF5 5B9D CAF6 5CF0 CAF7 5CEF CAF8 5D29 CAF9 5E96 CAFA 62B1 CAFB 6367 CAFC 653E CAFD 65B9 CAFE 670B CBA1 6CD5 CBA2 6CE1 CBA3 70F9 CBA4 7832 CBA5 7E2B CBA6 80DE CBA7 82B3 CBA8 840C CBA9 84EC CBAA 8702 CBAB 8912 CBAC 8A2A CBAD 8C4A CBAE 90A6 CBAF 92D2 CBB0 98FD CBB1 9CF3 CBB2 9D6C CBB3 4E4F CBB4 4EA1 CBB5 508D CBB6 5256 CBB7 574A CBB8 59A8 CBB9 5E3D CBBA 5FD8 CBBB 5FD9 CBBC 623F CBBD 66B4 CBBE 671B CBBF 67D0 CBC0 68D2 CBC1 5192 CBC2 7D21 CBC3 80AA CBC4 81A8 CBC5 8B00 CBC6 8C8C CBC7 8CBF CBC8 927E CBC9 9632 CBCA 5420 CBCB 982C CBCC 5317 CBCD 50D5 CBCE 535C CBCF 58A8 CBD0 64B2 CBD1 6734 CBD2 7267 CBD3 7766 CBD4 7A46 CBD5 91E6 CBD6 52C3 CBD7 6CA1 CBD8 6B86 CBD9 5800 CBDA 5E4C CBDB 5954 CBDC 672C CBDD 7FFB CBDE 51E1 CBDF 76C6 CBE0 6469 CBE1 78E8 CBE2 9B54 CBE3 9EBB CBE4 57CB CBE5 59B9 CBE6 6627 CBE7 679A CBE8 6BCE CBE9 54E9 CBEA 69D9 CBEB 5E55 CBEC 819C CBED 6795 CBEE 9BAA CBEF 67FE CBF0 9C52 CBF1 685D CBF2 4EA6 CBF3 4FE3 CBF4 53C8 CBF5 62B9 CBF6 672B CBF7 6CAB CBF8 8FC4 CBF9 4FAD CBFA 7E6D CBFB 9EBF CBFC 4E07 CBFD 6162 CBFE 6E80 CCA1 6F2B CCA2 8513 CCA3 5473 CCA4 672A CCA5 9B45 CCA6 5DF3 CCA7 7B95 CCA8 5CAC CCA9 5BC6 CCAA 871C CCAB 6E4A CCAC 84D1 CCAD 7A14 CCAE 8108 CCAF 5999 CCB0 7C8D CCB1 6C11 CCB2 7720 CCB3 52D9 CCB4 5922 CCB5 7121 CCB6 725F CCB7 77DB CCB8 9727 CCB9 9D61 CCBA 690B CCBB 5A7F CCBC 5A18 CCBD 51A5 CCBE 540D CCBF 547D CCC0 660E CCC1 76DF CCC2 8FF7 CCC3 9298 CCC4 9CF4 CCC5 59EA CCC6 725D CCC7 6EC5 CCC8 514D CCC9 68C9 CCCA 7DBF CCCB 7DEC CCCC 9762 CCCD 9EBA CCCE 6478 CCCF 6A21 CCD0 8302 CCD1 5984 CCD2 5B5F CCD3 6BDB CCD4 731B CCD5 76F2 CCD6 7DB2 CCD7 8017 CCD8 8499 CCD9 5132 CCDA 6728 CCDB 9ED9 CCDC 76EE CCDD 6762 CCDE 52FF CCDF 9905 CCE0 5C24 CCE1 623B CCE2 7C7E CCE3 8CB0 CCE4 554F CCE5 60B6 CCE6 7D0B CCE7 9580 CCE8 5301 CCE9 4E5F CCEA 51B6 CCEB 591C CCEC 723A CCED 8036 CCEE 91CE CCEF 5F25 CCF0 77E2 CCF1 5384 CCF2 5F79 CCF3 7D04 CCF4 85AC CCF5 8A33 CCF6 8E8D CCF7 9756 CCF8 67F3 CCF9 85AE CCFA 9453 CCFB 6109 CCFC 6108 CCFD 6CB9 CCFE 7652 CDA1 8AED CDA2 8F38 CDA3 552F CDA4 4F51 CDA5 512A CDA6 52C7 CDA7 53CB CDA8 5BA5 CDA9 5E7D CDAA 60A0 CDAB 6182 CDAC 63D6 CDAD 6709 CDAE 67DA CDAF 6E67 CDB0 6D8C CDB1 7336 CDB2 7337 CDB3 7531 CDB4 7950 CDB5 88D5 CDB6 8A98 CDB7 904A CDB8 9091 CDB9 90F5 CDBA 96C4 CDBB 878D CDBC 5915 CDBD 4E88 CDBE 4F59 CDBF 4E0E CDC0 8A89 CDC1 8F3F CDC2 9810 CDC3 50AD CDC4 5E7C CDC5 5996 CDC6 5BB9 CDC7 5EB8 CDC8 63DA CDC9 63FA CDCA 64C1 CDCB 66DC CDCC 694A CDCD 69D8 CDCE 6D0B CDCF 6EB6 CDD0 7194 CDD1 7528 CDD2 7AAF CDD3 7F8A CDD4 8000 CDD5 8449 CDD6 84C9 CDD7 8981 CDD8 8B21 CDD9 8E0A CDDA 9065 CDDB 967D CDDC 990A CDDD 617E CDDE 6291 CDDF 6B32 CDE0 6C83 CDE1 6D74 CDE2 7FCC CDE3 7FFC CDE4 6DC0 CDE5 7F85 CDE6 87BA CDE7 88F8 CDE8 6765 CDE9 83B1 CDEA 983C CDEB 96F7 CDEC 6D1B CDED 7D61 CDEE 843D CDEF 916A CDF0 4E71 CDF1 5375 CDF2 5D50 CDF3 6B04 CDF4 6FEB CDF5 85CD CDF6 862D CDF7 89A7 CDF8 5229 CDF9 540F CDFA 5C65 CDFB 674E CDFC 68A8 CDFD 7406 CDFE 7483 CEA1 75E2 CEA2 88CF CEA3 88E1 CEA4 91CC CEA5 96E2 CEA6 9678 CEA7 5F8B CEA8 7387 CEA9 7ACB CEAA 844E CEAB 63A0 CEAC 7565 CEAD 5289 CEAE 6D41 CEAF 6E9C CEB0 7409 CEB1 7559 CEB2 786B CEB3 7C92 CEB4 9686 CEB5 7ADC CEB6 9F8D CEB7 4FB6 CEB8 616E CEB9 65C5 CEBA 865C CEBB 4E86 CEBC 4EAE CEBD 50DA CEBE 4E21 CEBF 51CC CEC0 5BEE CEC1 6599 CEC2 6881 CEC3 6DBC CEC4 731F CEC5 7642 CEC6 77AD CEC7 7A1C CEC8 7CE7 CEC9 826F CECA 8AD2 CECB 907C CECC 91CF CECD 9675 CECE 9818 CECF 529B CED0 7DD1 CED1 502B CED2 5398 CED3 6797 CED4 6DCB CED5 71D0 CED6 7433 CED7 81E8 CED8 8F2A CED9 96A3 CEDA 9C57 CEDB 9E9F CEDC 7460 CEDD 5841 CEDE 6D99 CEDF 7D2F CEE0 985E CEE1 4EE4 CEE2 4F36 CEE3 4F8B CEE4 51B7 CEE5 52B1 CEE6 5DBA CEE7 601C CEE8 73B2 CEE9 793C CEEA 82D3 CEEB 9234 CEEC 96B7 CEED 96F6 CEEE 970A CEEF 9E97 CEF0 9F62 CEF1 66A6 CEF2 6B74 CEF3 5217 CEF4 52A3 CEF5 70C8 CEF6 88C2 CEF7 5EC9 CEF8 604B CEF9 6190 CEFA 6F23 CEFB 7149 CEFC 7C3E CEFD 7DF4 CEFE 806F CFA1 84EE CFA2 9023 CFA3 932C CFA4 5442 CFA5 9B6F CFA6 6AD3 CFA7 7089 CFA8 8CC2 CFA9 8DEF CFAA 9732 CFAB 52B4 CFAC 5A41 CFAD 5ECA CFAE 5F04 CFAF 6717 CFB0 697C CFB1 6994 CFB2 6D6A CFB3 6F0F CFB4 7262 CFB5 72FC CFB6 7BED CFB7 8001 CFB8 807E CFB9 874B CFBA 90CE CFBB 516D CFBC 9E93 CFBD 7984 CFBE 808B CFBF 9332 CFC0 8AD6 CFC1 502D CFC2 548C CFC3 8A71 CFC4 6B6A CFC5 8CC4 CFC6 8107 CFC7 60D1 CFC8 67A0 CFC9 9DF2 CFCA 4E99 CFCB 4E98 CFCC 9C10 CFCD 8A6B CFCE 85C1 CFCF 8568 CFD0 6900 CFD1 6E7E CFD2 7897 CFD3 8155 CFD5 5B41 CFD6 5B56 CFD7 5B7D CFD8 5B93 CFD9 5BD8 CFDA 5BEC CFDB 5C12 CFDC 5C1E CFDD 5C23 CFDE 5C2B CFDF 378D CFE0 5C62 CFE1 FA3B CFE2 FA3C CFE3 216B4 CFE4 5C7A CFE5 5C8F CFE6 5C9F CFE7 5CA3 CFE8 5CAA CFE9 5CBA CFEA 5CCB CFEB 5CD0 CFEC 5CD2 CFED 5CF4 CFEE 21E34 CFEF 37E2 CFF0 5D0D CFF1 5D27 CFF2 FA11 CFF3 5D46 CFF4 5D47 CFF5 5D53 CFF6 5D4A CFF7 5D6D CFF8 5D81 CFF9 5DA0 CFFA 5DA4 CFFB 5DA7 CFFC 5DB8 CFFD 5DCB D0A1 5F0C D0A2 4E10 D0A3 4E15 D0A4 4E2A D0A5 4E31 D0A6 4E36 D0A7 4E3C D0A8 4E3F D0A9 4E42 D0AA 4E56 D0AB 4E58 D0AC 4E82 D0AD 4E85 D0AE 8C6B D0AF 4E8A D0B0 8212 D0B1 5F0D D0B2 4E8E D0B3 4E9E D0B4 4E9F D0B5 4EA0 D0B6 4EA2 D0B7 4EB0 D0B8 4EB3 D0B9 4EB6 D0BA 4ECE D0BB 4ECD D0BC 4EC4 D0BD 4EC6 D0BE 4EC2 D0BF 4ED7 D0C0 4EDE D0C1 4EED D0C2 4EDF D0C3 4EF7 D0C4 4F09 D0C5 4F5A D0C6 4F30 D0C7 4F5B D0C8 4F5D D0C9 4F57 D0CA 4F47 D0CB 4F76 D0CC 4F88 D0CD 4F8F D0CE 4F98 D0CF 4F7B D0D0 4F69 D0D1 4F70 D0D2 4F91 D0D3 4F6F D0D4 4F86 D0D5 4F96 D0D6 5118 D0D7 4FD4 D0D8 4FDF D0D9 4FCE D0DA 4FD8 D0DB 4FDB D0DC 4FD1 D0DD 4FDA D0DE 4FD0 D0DF 4FE4 D0E0 4FE5 D0E1 501A D0E2 5028 D0E3 5014 D0E4 502A D0E5 5025 D0E6 5005 D0E7 4F1C D0E8 4FF6 D0E9 5021 D0EA 5029 D0EB 502C D0EC 4FFE D0ED 4FEF D0EE 5011 D0EF 5006 D0F0 5043 D0F1 5047 D0F2 6703 D0F3 5055 D0F4 5050 D0F5 5048 D0F6 505A D0F7 5056 D0F8 506C D0F9 5078 D0FA 5080 D0FB 509A D0FC 5085 D0FD 50B4 D0FE 50B2 D1A1 50C9 D1A2 50CA D1A3 50B3 D1A4 50C2 D1A5 50D6 D1A6 50DE D1A7 50E5 D1A8 50ED D1A9 50E3 D1AA 50EE D1AB 50F9 D1AC 50F5 D1AD 5109 D1AE 5101 D1AF 5102 D1B0 5116 D1B1 5115 D1B2 5114 D1B3 511A D1B4 5121 D1B5 513A D1B6 5137 D1B7 513C D1B8 513B D1B9 513F D1BA 5140 D1BB 5152 D1BC 514C D1BD 5154 D1BE 5162 D1BF 7AF8 D1C0 5169 D1C1 516A D1C2 516E D1C3 5180 D1C4 5182 D1C5 56D8 D1C6 518C D1C7 5189 D1C8 518F D1C9 5191 D1CA 5193 D1CB 5195 D1CC 5196 D1CD 51A4 D1CE 51A6 D1CF 51A2 D1D0 51A9 D1D1 51AA D1D2 51AB D1D3 51B3 D1D4 51B1 D1D5 51B2 D1D6 51B0 D1D7 51B5 D1D8 51BD D1D9 51C5 D1DA 51C9 D1DB 51DB D1DC 51E0 D1DD 8655 D1DE 51E9 D1DF 51ED D1E0 51F0 D1E1 51F5 D1E2 51FE D1E3 5204 D1E4 520B D1E5 5214 D1E6 520E D1E7 5227 D1E8 522A D1E9 522E D1EA 5233 D1EB 5239 D1EC 524F D1ED 5244 D1EE 524B D1EF 524C D1F0 525E D1F1 5254 D1F2 526A D1F3 5274 D1F4 5269 D1F5 5273 D1F6 527F D1F7 527D D1F8 528D D1F9 5294 D1FA 5292 D1FB 5271 D1FC 5288 D1FD 5291 D1FE 8FA8 D2A1 8FA7 D2A2 52AC D2A3 52AD D2A4 52BC D2A5 52B5 D2A6 52C1 D2A7 52CD D2A8 52D7 D2A9 52DE D2AA 52E3 D2AB 52E6 D2AC 98ED D2AD 52E0 D2AE 52F3 D2AF 52F5 D2B0 52F8 D2B1 52F9 D2B2 5306 D2B3 5308 D2B4 7538 D2B5 530D D2B6 5310 D2B7 530F D2B8 5315 D2B9 531A D2BA 5323 D2BB 532F D2BC 5331 D2BD 5333 D2BE 5338 D2BF 5340 D2C0 5346 D2C1 5345 D2C2 4E17 D2C3 5349 D2C4 534D D2C5 51D6 D2C6 535E D2C7 5369 D2C8 536E D2C9 5918 D2CA 537B D2CB 5377 D2CC 5382 D2CD 5396 D2CE 53A0 D2CF 53A6 D2D0 53A5 D2D1 53AE D2D2 53B0 D2D3 53B6 D2D4 53C3 D2D5 7C12 D2D6 96D9 D2D7 53DF D2D8 66FC D2D9 71EE D2DA 53EE D2DB 53E8 D2DC 53ED D2DD 53FA D2DE 5401 D2DF 543D D2E0 5440 D2E1 542C D2E2 542D D2E3 543C D2E4 542E D2E5 5436 D2E6 5429 D2E7 541D D2E8 544E D2E9 548F D2EA 5475 D2EB 548E D2EC 545F D2ED 5471 D2EE 5477 D2EF 5470 D2F0 5492 D2F1 547B D2F2 5480 D2F3 5476 D2F4 5484 D2F5 5490 D2F6 5486 D2F7 54C7 D2F8 54A2 D2F9 54B8 D2FA 54A5 D2FB 54AC D2FC 54C4 D2FD 54C8 D2FE 54A8 D3A1 54AB D3A2 54C2 D3A3 54A4 D3A4 54BE D3A5 54BC D3A6 54D8 D3A7 54E5 D3A8 54E6 D3A9 550F D3AA 5514 D3AB 54FD D3AC 54EE D3AD 54ED D3AE 54FA D3AF 54E2 D3B0 5539 D3B1 5540 D3B2 5563 D3B3 554C D3B4 552E D3B5 555C D3B6 5545 D3B7 5556 D3B8 5557 D3B9 5538 D3BA 5533 D3BB 555D D3BC 5599 D3BD 5580 D3BE 54AF D3BF 558A D3C0 559F D3C1 557B D3C2 557E D3C3 5598 D3C4 559E D3C5 55AE D3C6 557C D3C7 5583 D3C8 55A9 D3C9 5587 D3CA 55A8 D3CB 55DA D3CC 55C5 D3CD 55DF D3CE 55C4 D3CF 55DC D3D0 55E4 D3D1 55D4 D3D2 5614 D3D3 55F7 D3D4 5616 D3D5 55FE D3D6 55FD D3D7 561B D3D8 55F9 D3D9 564E D3DA 5650 D3DB 71DF D3DC 5634 D3DD 5636 D3DE 5632 D3DF 5638 D3E0 566B D3E1 5664 D3E2 562F D3E3 566C D3E4 566A D3E5 5686 D3E6 5680 D3E7 568A D3E8 56A0 D3E9 5694 D3EA 568F D3EB 56A5 D3EC 56AE D3ED 56B6 D3EE 56B4 D3EF 56C2 D3F0 56BC D3F1 56C1 D3F2 56C3 D3F3 56C0 D3F4 56C8 D3F5 56CE D3F6 56D1 D3F7 56D3 D3F8 56D7 D3F9 56EE D3FA 56F9 D3FB 5700 D3FC 56FF D3FD 5704 D3FE 5709 D4A1 5708 D4A2 570B D4A3 570D D4A4 5713 D4A5 5718 D4A6 5716 D4A7 55C7 D4A8 571C D4A9 5726 D4AA 5737 D4AB 5738 D4AC 574E D4AD 573B D4AE 5740 D4AF 574F D4B0 5769 D4B1 57C0 D4B2 5788 D4B3 5761 D4B4 577F D4B5 5789 D4B6 5793 D4B7 57A0 D4B8 57B3 D4B9 57A4 D4BA 57AA D4BB 57B0 D4BC 57C3 D4BD 57C6 D4BE 57D4 D4BF 57D2 D4C0 57D3 D4C1 580A D4C2 57D6 D4C3 57E3 D4C4 580B D4C5 5819 D4C6 581D D4C7 5872 D4C8 5821 D4C9 5862 D4CA 584B D4CB 5870 D4CC 6BC0 D4CD 5852 D4CE 583D D4CF 5879 D4D0 5885 D4D1 58B9 D4D2 589F D4D3 58AB D4D4 58BA D4D5 58DE D4D6 58BB D4D7 58B8 D4D8 58AE D4D9 58C5 D4DA 58D3 D4DB 58D1 D4DC 58D7 D4DD 58D9 D4DE 58D8 D4DF 58E5 D4E0 58DC D4E1 58E4 D4E2 58DF D4E3 58EF D4E4 58FA D4E5 58F9 D4E6 58FB D4E7 58FC D4E8 58FD D4E9 5902 D4EA 590A D4EB 5910 D4EC 591B D4ED 68A6 D4EE 5925 D4EF 592C D4F0 592D D4F1 5932 D4F2 5938 D4F3 593E D4F4 7AD2 D4F5 5955 D4F6 5950 D4F7 594E D4F8 595A D4F9 5958 D4FA 5962 D4FB 5960 D4FC 5967 D4FD 596C D4FE 5969 D5A1 5978 D5A2 5981 D5A3 599D D5A4 4F5E D5A5 4FAB D5A6 59A3 D5A7 59B2 D5A8 59C6 D5A9 59E8 D5AA 59DC D5AB 598D D5AC 59D9 D5AD 59DA D5AE 5A25 D5AF 5A1F D5B0 5A11 D5B1 5A1C D5B2 5A09 D5B3 5A1A D5B4 5A40 D5B5 5A6C D5B6 5A49 D5B7 5A35 D5B8 5A36 D5B9 5A62 D5BA 5A6A D5BB 5A9A D5BC 5ABC D5BD 5ABE D5BE 5ACB D5BF 5AC2 D5C0 5ABD D5C1 5AE3 D5C2 5AD7 D5C3 5AE6 D5C4 5AE9 D5C5 5AD6 D5C6 5AFA D5C7 5AFB D5C8 5B0C D5C9 5B0B D5CA 5B16 D5CB 5B32 D5CC 5AD0 D5CD 5B2A D5CE 5B36 D5CF 5B3E D5D0 5B43 D5D1 5B45 D5D2 5B40 D5D3 5B51 D5D4 5B55 D5D5 5B5A D5D6 5B5B D5D7 5B65 D5D8 5B69 D5D9 5B70 D5DA 5B73 D5DB 5B75 D5DC 5B78 D5DD 6588 D5DE 5B7A D5DF 5B80 D5E0 5B83 D5E1 5BA6 D5E2 5BB8 D5E3 5BC3 D5E4 5BC7 D5E5 5BC9 D5E6 5BD4 D5E7 5BD0 D5E8 5BE4 D5E9 5BE6 D5EA 5BE2 D5EB 5BDE D5EC 5BE5 D5ED 5BEB D5EE 5BF0 D5EF 5BF6 D5F0 5BF3 D5F1 5C05 D5F2 5C07 D5F3 5C08 D5F4 5C0D D5F5 5C13 D5F6 5C20 D5F7 5C22 D5F8 5C28 D5F9 5C38 D5FA 5C39 D5FB 5C41 D5FC 5C46 D5FD 5C4E D5FE 5C53 D6A1 5C50 D6A2 5C4F D6A3 5B71 D6A4 5C6C D6A5 5C6E D6A6 4E62 D6A7 5C76 D6A8 5C79 D6A9 5C8C D6AA 5C91 D6AB 5C94 D6AC 599B D6AD 5CAB D6AE 5CBB D6AF 5CB6 D6B0 5CBC D6B1 5CB7 D6B2 5CC5 D6B3 5CBE D6B4 5CC7 D6B5 5CD9 D6B6 5CE9 D6B7 5CFD D6B8 5CFA D6B9 5CED D6BA 5D8C D6BB 5CEA D6BC 5D0B D6BD 5D15 D6BE 5D17 D6BF 5D5C D6C0 5D1F D6C1 5D1B D6C2 5D11 D6C3 5D14 D6C4 5D22 D6C5 5D1A D6C6 5D19 D6C7 5D18 D6C8 5D4C D6C9 5D52 D6CA 5D4E D6CB 5D4B D6CC 5D6C D6CD 5D73 D6CE 5D76 D6CF 5D87 D6D0 5D84 D6D1 5D82 D6D2 5DA2 D6D3 5D9D D6D4 5DAC D6D5 5DAE D6D6 5DBD D6D7 5D90 D6D8 5DB7 D6D9 5DBC D6DA 5DC9 D6DB 5DCD D6DC 5DD3 D6DD 5DD2 D6DE 5DD6 D6DF 5DDB D6E0 5DEB D6E1 5DF2 D6E2 5DF5 D6E3 5E0B D6E4 5E1A D6E5 5E19 D6E6 5E11 D6E7 5E1B D6E8 5E36 D6E9 5E37 D6EA 5E44 D6EB 5E43 D6EC 5E40 D6ED 5E4E D6EE 5E57 D6EF 5E54 D6F0 5E5F D6F1 5E62 D6F2 5E64 D6F3 5E47 D6F4 5E75 D6F5 5E76 D6F6 5E7A D6F7 9EBC D6F8 5E7F D6F9 5EA0 D6FA 5EC1 D6FB 5EC2 D6FC 5EC8 D6FD 5ED0 D6FE 5ECF D7A1 5ED6 D7A2 5EE3 D7A3 5EDD D7A4 5EDA D7A5 5EDB D7A6 5EE2 D7A7 5EE1 D7A8 5EE8 D7A9 5EE9 D7AA 5EEC D7AB 5EF1 D7AC 5EF3 D7AD 5EF0 D7AE 5EF4 D7AF 5EF8 D7B0 5EFE D7B1 5F03 D7B2 5F09 D7B3 5F5D D7B4 5F5C D7B5 5F0B D7B6 5F11 D7B7 5F16 D7B8 5F29 D7B9 5F2D D7BA 5F38 D7BB 5F41 D7BC 5F48 D7BD 5F4C D7BE 5F4E D7BF 5F2F D7C0 5F51 D7C1 5F56 D7C2 5F57 D7C3 5F59 D7C4 5F61 D7C5 5F6D D7C6 5F73 D7C7 5F77 D7C8 5F83 D7C9 5F82 D7CA 5F7F D7CB 5F8A D7CC 5F88 D7CD 5F91 D7CE 5F87 D7CF 5F9E D7D0 5F99 D7D1 5F98 D7D2 5FA0 D7D3 5FA8 D7D4 5FAD D7D5 5FBC D7D6 5FD6 D7D7 5FFB D7D8 5FE4 D7D9 5FF8 D7DA 5FF1 D7DB 5FDD D7DC 60B3 D7DD 5FFF D7DE 6021 D7DF 6060 D7E0 6019 D7E1 6010 D7E2 6029 D7E3 600E D7E4 6031 D7E5 601B D7E6 6015 D7E7 602B D7E8 6026 D7E9 600F D7EA 603A D7EB 605A D7EC 6041 D7ED 606A D7EE 6077 D7EF 605F D7F0 604A D7F1 6046 D7F2 604D D7F3 6063 D7F4 6043 D7F5 6064 D7F6 6042 D7F7 606C D7F8 606B D7F9 6059 D7FA 6081 D7FB 608D D7FC 60E7 D7FD 6083 D7FE 609A D8A1 6084 D8A2 609B D8A3 6096 D8A4 6097 D8A5 6092 D8A6 60A7 D8A7 608B D8A8 60E1 D8A9 60B8 D8AA 60E0 D8AB 60D3 D8AC 60B4 D8AD 5FF0 D8AE 60BD D8AF 60C6 D8B0 60B5 D8B1 60D8 D8B2 614D D8B3 6115 D8B4 6106 D8B5 60F6 D8B6 60F7 D8B7 6100 D8B8 60F4 D8B9 60FA D8BA 6103 D8BB 6121 D8BC 60FB D8BD 60F1 D8BE 610D D8BF 610E D8C0 6147 D8C1 613E D8C2 6128 D8C3 6127 D8C4 614A D8C5 613F D8C6 613C D8C7 612C D8C8 6134 D8C9 613D D8CA 6142 D8CB 6144 D8CC 6173 D8CD 6177 D8CE 6158 D8CF 6159 D8D0 615A D8D1 616B D8D2 6174 D8D3 616F D8D4 6165 D8D5 6171 D8D6 615F D8D7 615D D8D8 6153 D8D9 6175 D8DA 6199 D8DB 6196 D8DC 6187 D8DD 61AC D8DE 6194 D8DF 619A D8E0 618A D8E1 6191 D8E2 61AB D8E3 61AE D8E4 61CC D8E5 61CA D8E6 61C9 D8E7 61F7 D8E8 61C8 D8E9 61C3 D8EA 61C6 D8EB 61BA D8EC 61CB D8ED 7F79 D8EE 61CD D8EF 61E6 D8F0 61E3 D8F1 61F6 D8F2 61FA D8F3 61F4 D8F4 61FF D8F5 61FD D8F6 61FC D8F7 61FE D8F8 6200 D8F9 6208 D8FA 6209 D8FB 620D D8FC 620C D8FD 6214 D8FE 621B D9A1 621E D9A2 6221 D9A3 622A D9A4 622E D9A5 6230 D9A6 6232 D9A7 6233 D9A8 6241 D9A9 624E D9AA 625E D9AB 6263 D9AC 625B D9AD 6260 D9AE 6268 D9AF 627C D9B0 6282 D9B1 6289 D9B2 627E D9B3 6292 D9B4 6293 D9B5 6296 D9B6 62D4 D9B7 6283 D9B8 6294 D9B9 62D7 D9BA 62D1 D9BB 62BB D9BC 62CF D9BD 62FF D9BE 62C6 D9BF 64D4 D9C0 62C8 D9C1 62DC D9C2 62CC D9C3 62CA D9C4 62C2 D9C5 62C7 D9C6 629B D9C7 62C9 D9C8 630C D9C9 62EE D9CA 62F1 D9CB 6327 D9CC 6302 D9CD 6308 D9CE 62EF D9CF 62F5 D9D0 6350 D9D1 633E D9D2 634D D9D3 641C D9D4 634F D9D5 6396 D9D6 638E D9D7 6380 D9D8 63AB D9D9 6376 D9DA 63A3 D9DB 638F D9DC 6389 D9DD 639F D9DE 63B5 D9DF 636B D9E0 6369 D9E1 63BE D9E2 63E9 D9E3 63C0 D9E4 63C6 D9E5 63E3 D9E6 63C9 D9E7 63D2 D9E8 63F6 D9E9 63C4 D9EA 6416 D9EB 6434 D9EC 6406 D9ED 6413 D9EE 6426 D9EF 6436 D9F0 651D D9F1 6417 D9F2 6428 D9F3 640F D9F4 6467 D9F5 646F D9F6 6476 D9F7 644E D9F8 652A D9F9 6495 D9FA 6493 D9FB 64A5 D9FC 64A9 D9FD 6488 D9FE 64BC DAA1 64DA DAA2 64D2 DAA3 64C5 DAA4 64C7 DAA5 64BB DAA6 64D8 DAA7 64C2 DAA8 64F1 DAA9 64E7 DAAA 8209 DAAB 64E0 DAAC 64E1 DAAD 62AC DAAE 64E3 DAAF 64EF DAB0 652C DAB1 64F6 DAB2 64F4 DAB3 64F2 DAB4 64FA DAB5 6500 DAB6 64FD DAB7 6518 DAB8 651C DAB9 6505 DABA 6524 DABB 6523 DABC 652B DABD 6534 DABE 6535 DABF 6537 DAC0 6536 DAC1 6538 DAC2 754B DAC3 6548 DAC4 6556 DAC5 6555 DAC6 654D DAC7 6558 DAC8 655E DAC9 655D DACA 6572 DACB 6578 DACC 6582 DACD 6583 DACE 8B8A DACF 659B DAD0 659F DAD1 65AB DAD2 65B7 DAD3 65C3 DAD4 65C6 DAD5 65C1 DAD6 65C4 DAD7 65CC DAD8 65D2 DAD9 65DB DADA 65D9 DADB 65E0 DADC 65E1 DADD 65F1 DADE 6772 DADF 660A DAE0 6603 DAE1 65FB DAE2 6773 DAE3 6635 DAE4 6636 DAE5 6634 DAE6 661C DAE7 664F DAE8 6644 DAE9 6649 DAEA 6641 DAEB 665E DAEC 665D DAED 6664 DAEE 6667 DAEF 6668 DAF0 665F DAF1 6662 DAF2 6670 DAF3 6683 DAF4 6688 DAF5 668E DAF6 6689 DAF7 6684 DAF8 6698 DAF9 669D DAFA 66C1 DAFB 66B9 DAFC 66C9 DAFD 66BE DAFE 66BC DBA1 66C4 DBA2 66B8 DBA3 66D6 DBA4 66DA DBA5 66E0 DBA6 663F DBA7 66E6 DBA8 66E9 DBA9 66F0 DBAA 66F5 DBAB 66F7 DBAC 670F DBAD 6716 DBAE 671E DBAF 6726 DBB0 6727 DBB1 9738 DBB2 672E DBB3 673F DBB4 6736 DBB5 6741 DBB6 6738 DBB7 6737 DBB8 6746 DBB9 675E DBBA 6760 DBBB 6759 DBBC 6763 DBBD 6764 DBBE 6789 DBBF 6770 DBC0 67A9 DBC1 677C DBC2 676A DBC3 678C DBC4 678B DBC5 67A6 DBC6 67A1 DBC7 6785 DBC8 67B7 DBC9 67EF DBCA 67B4 DBCB 67EC DBCC 67B3 DBCD 67E9 DBCE 67B8 DBCF 67E4 DBD0 67DE DBD1 67DD DBD2 67E2 DBD3 67EE DBD4 67B9 DBD5 67CE DBD6 67C6 DBD7 67E7 DBD8 6A9C DBD9 681E DBDA 6846 DBDB 6829 DBDC 6840 DBDD 684D DBDE 6832 DBDF 684E DBE0 68B3 DBE1 682B DBE2 6859 DBE3 6863 DBE4 6877 DBE5 687F DBE6 689F DBE7 688F DBE8 68AD DBE9 6894 DBEA 689D DBEB 689B DBEC 6883 DBED 6AAE DBEE 68B9 DBEF 6874 DBF0 68B5 DBF1 68A0 DBF2 68BA DBF3 690F DBF4 688D DBF5 687E DBF6 6901 DBF7 68CA DBF8 6908 DBF9 68D8 DBFA 6922 DBFB 6926 DBFC 68E1 DBFD 690C DBFE 68CD DCA1 68D4 DCA2 68E7 DCA3 68D5 DCA4 6936 DCA5 6912 DCA6 6904 DCA7 68D7 DCA8 68E3 DCA9 6925 DCAA 68F9 DCAB 68E0 DCAC 68EF DCAD 6928 DCAE 692A DCAF 691A DCB0 6923 DCB1 6921 DCB2 68C6 DCB3 6979 DCB4 6977 DCB5 695C DCB6 6978 DCB7 696B DCB8 6954 DCB9 697E DCBA 696E DCBB 6939 DCBC 6974 DCBD 693D DCBE 6959 DCBF 6930 DCC0 6961 DCC1 695E DCC2 695D DCC3 6981 DCC4 696A DCC5 69B2 DCC6 69AE DCC7 69D0 DCC8 69BF DCC9 69C1 DCCA 69D3 DCCB 69BE DCCC 69CE DCCD 5BE8 DCCE 69CA DCCF 69DD DCD0 69BB DCD1 69C3 DCD2 69A7 DCD3 6A2E DCD4 6991 DCD5 69A0 DCD6 699C DCD7 6995 DCD8 69B4 DCD9 69DE DCDA 69E8 DCDB 6A02 DCDC 6A1B DCDD 69FF DCDE 6B0A DCDF 69F9 DCE0 69F2 DCE1 69E7 DCE2 6A05 DCE3 69B1 DCE4 6A1E DCE5 69ED DCE6 6A14 DCE7 69EB DCE8 6A0A DCE9 6A12 DCEA 6AC1 DCEB 6A23 DCEC 6A13 DCED 6A44 DCEE 6A0C DCEF 6A72 DCF0 6A36 DCF1 6A78 DCF2 6A47 DCF3 6A62 DCF4 6A59 DCF5 6A66 DCF6 6A48 DCF7 6A38 DCF8 6A22 DCF9 6A90 DCFA 6A8D DCFB 6AA0 DCFC 6A84 DCFD 6AA2 DCFE 6AA3 DDA1 6A97 DDA2 8617 DDA3 6ABB DDA4 6AC3 DDA5 6AC2 DDA6 6AB8 DDA7 6AB3 DDA8 6AAC DDA9 6ADE DDAA 6AD1 DDAB 6ADF DDAC 6AAA DDAD 6ADA DDAE 6AEA DDAF 6AFB DDB0 6B05 DDB1 8616 DDB2 6AFA DDB3 6B12 DDB4 6B16 DDB5 9B31 DDB6 6B1F DDB7 6B38 DDB8 6B37 DDB9 76DC DDBA 6B39 DDBB 98EE DDBC 6B47 DDBD 6B43 DDBE 6B49 DDBF 6B50 DDC0 6B59 DDC1 6B54 DDC2 6B5B DDC3 6B5F DDC4 6B61 DDC5 6B78 DDC6 6B79 DDC7 6B7F DDC8 6B80 DDC9 6B84 DDCA 6B83 DDCB 6B8D DDCC 6B98 DDCD 6B95 DDCE 6B9E DDCF 6BA4 DDD0 6BAA DDD1 6BAB DDD2 6BAF DDD3 6BB2 DDD4 6BB1 DDD5 6BB3 DDD6 6BB7 DDD7 6BBC DDD8 6BC6 DDD9 6BCB DDDA 6BD3 DDDB 6BDF DDDC 6BEC DDDD 6BEB DDDE 6BF3 DDDF 6BEF DDE0 9EBE DDE1 6C08 DDE2 6C13 DDE3 6C14 DDE4 6C1B DDE5 6C24 DDE6 6C23 DDE7 6C5E DDE8 6C55 DDE9 6C62 DDEA 6C6A DDEB 6C82 DDEC 6C8D DDED 6C9A DDEE 6C81 DDEF 6C9B DDF0 6C7E DDF1 6C68 DDF2 6C73 DDF3 6C92 DDF4 6C90 DDF5 6CC4 DDF6 6CF1 DDF7 6CD3 DDF8 6CBD DDF9 6CD7 DDFA 6CC5 DDFB 6CDD DDFC 6CAE DDFD 6CB1 DDFE 6CBE DEA1 6CBA DEA2 6CDB DEA3 6CEF DEA4 6CD9 DEA5 6CEA DEA6 6D1F DEA7 884D DEA8 6D36 DEA9 6D2B DEAA 6D3D DEAB 6D38 DEAC 6D19 DEAD 6D35 DEAE 6D33 DEAF 6D12 DEB0 6D0C DEB1 6D63 DEB2 6D93 DEB3 6D64 DEB4 6D5A DEB5 6D79 DEB6 6D59 DEB7 6D8E DEB8 6D95 DEB9 6FE4 DEBA 6D85 DEBB 6DF9 DEBC 6E15 DEBD 6E0A DEBE 6DB5 DEBF 6DC7 DEC0 6DE6 DEC1 6DB8 DEC2 6DC6 DEC3 6DEC DEC4 6DDE DEC5 6DCC DEC6 6DE8 DEC7 6DD2 DEC8 6DC5 DEC9 6DFA DECA 6DD9 DECB 6DE4 DECC 6DD5 DECD 6DEA DECE 6DEE DECF 6E2D DED0 6E6E DED1 6E2E DED2 6E19 DED3 6E72 DED4 6E5F DED5 6E3E DED6 6E23 DED7 6E6B DED8 6E2B DED9 6E76 DEDA 6E4D DEDB 6E1F DEDC 6E43 DEDD 6E3A DEDE 6E4E DEDF 6E24 DEE0 6EFF DEE1 6E1D DEE2 6E38 DEE3 6E82 DEE4 6EAA DEE5 6E98 DEE6 6EC9 DEE7 6EB7 DEE8 6ED3 DEE9 6EBD DEEA 6EAF DEEB 6EC4 DEEC 6EB2 DEED 6ED4 DEEE 6ED5 DEEF 6E8F DEF0 6EA5 DEF1 6EC2 DEF2 6E9F DEF3 6F41 DEF4 6F11 DEF5 704C DEF6 6EEC DEF7 6EF8 DEF8 6EFE DEF9 6F3F DEFA 6EF2 DEFB 6F31 DEFC 6EEF DEFD 6F32 DEFE 6ECC DFA1 6F3E DFA2 6F13 DFA3 6EF7 DFA4 6F86 DFA5 6F7A DFA6 6F78 DFA7 6F81 DFA8 6F80 DFA9 6F6F DFAA 6F5B DFAB 6FF3 DFAC 6F6D DFAD 6F82 DFAE 6F7C DFAF 6F58 DFB0 6F8E DFB1 6F91 DFB2 6FC2 DFB3 6F66 DFB4 6FB3 DFB5 6FA3 DFB6 6FA1 DFB7 6FA4 DFB8 6FB9 DFB9 6FC6 DFBA 6FAA DFBB 6FDF DFBC 6FD5 DFBD 6FEC DFBE 6FD4 DFBF 6FD8 DFC0 6FF1 DFC1 6FEE DFC2 6FDB DFC3 7009 DFC4 700B DFC5 6FFA DFC6 7011 DFC7 7001 DFC8 700F DFC9 6FFE DFCA 701B DFCB 701A DFCC 6F74 DFCD 701D DFCE 7018 DFCF 701F DFD0 7030 DFD1 703E DFD2 7032 DFD3 7051 DFD4 7063 DFD5 7099 DFD6 7092 DFD7 70AF DFD8 70F1 DFD9 70AC DFDA 70B8 DFDB 70B3 DFDC 70AE DFDD 70DF DFDE 70CB DFDF 70DD DFE0 70D9 DFE1 7109 DFE2 70FD DFE3 711C DFE4 7119 DFE5 7165 DFE6 7155 DFE7 7188 DFE8 7166 DFE9 7162 DFEA 714C DFEB 7156 DFEC 716C DFED 718F DFEE 71FB DFEF 7184 DFF0 7195 DFF1 71A8 DFF2 71AC DFF3 71D7 DFF4 71B9 DFF5 71BE DFF6 71D2 DFF7 71C9 DFF8 71D4 DFF9 71CE DFFA 71E0 DFFB 71EC DFFC 71E7 DFFD 71F5 DFFE 71FC E0A1 71F9 E0A2 71FF E0A3 720D E0A4 7210 E0A5 721B E0A6 7228 E0A7 722D E0A8 722C E0A9 7230 E0AA 7232 E0AB 723B E0AC 723C E0AD 723F E0AE 7240 E0AF 7246 E0B0 724B E0B1 7258 E0B2 7274 E0B3 727E E0B4 7282 E0B5 7281 E0B6 7287 E0B7 7292 E0B8 7296 E0B9 72A2 E0BA 72A7 E0BB 72B9 E0BC 72B2 E0BD 72C3 E0BE 72C6 E0BF 72C4 E0C0 72CE E0C1 72D2 E0C2 72E2 E0C3 72E0 E0C4 72E1 E0C5 72F9 E0C6 72F7 E0C7 500F E0C8 7317 E0C9 730A E0CA 731C E0CB 7316 E0CC 731D E0CD 7334 E0CE 732F E0CF 7329 E0D0 7325 E0D1 733E E0D2 734E E0D3 734F E0D4 9ED8 E0D5 7357 E0D6 736A E0D7 7368 E0D8 7370 E0D9 7378 E0DA 7375 E0DB 737B E0DC 737A E0DD 73C8 E0DE 73B3 E0DF 73CE E0E0 73BB E0E1 73C0 E0E2 73E5 E0E3 73EE E0E4 73DE E0E5 74A2 E0E6 7405 E0E7 746F E0E8 7425 E0E9 73F8 E0EA 7432 E0EB 743A E0EC 7455 E0ED 743F E0EE 745F E0EF 7459 E0F0 7441 E0F1 745C E0F2 7469 E0F3 7470 E0F4 7463 E0F5 746A E0F6 7476 E0F7 747E E0F8 748B E0F9 749E E0FA 74A7 E0FB 74CA E0FC 74CF E0FD 74D4 E0FE 73F1 E1A1 74E0 E1A2 74E3 E1A3 74E7 E1A4 74E9 E1A5 74EE E1A6 74F2 E1A7 74F0 E1A8 74F1 E1A9 74F8 E1AA 74F7 E1AB 7504 E1AC 7503 E1AD 7505 E1AE 750C E1AF 750E E1B0 750D E1B1 7515 E1B2 7513 E1B3 751E E1B4 7526 E1B5 752C E1B6 753C E1B7 7544 E1B8 754D E1B9 754A E1BA 7549 E1BB 755B E1BC 7546 E1BD 755A E1BE 7569 E1BF 7564 E1C0 7567 E1C1 756B E1C2 756D E1C3 7578 E1C4 7576 E1C5 7586 E1C6 7587 E1C7 7574 E1C8 758A E1C9 7589 E1CA 7582 E1CB 7594 E1CC 759A E1CD 759D E1CE 75A5 E1CF 75A3 E1D0 75C2 E1D1 75B3 E1D2 75C3 E1D3 75B5 E1D4 75BD E1D5 75B8 E1D6 75BC E1D7 75B1 E1D8 75CD E1D9 75CA E1DA 75D2 E1DB 75D9 E1DC 75E3 E1DD 75DE E1DE 75FE E1DF 75FF E1E0 75FC E1E1 7601 E1E2 75F0 E1E3 75FA E1E4 75F2 E1E5 75F3 E1E6 760B E1E7 760D E1E8 7609 E1E9 761F E1EA 7627 E1EB 7620 E1EC 7621 E1ED 7622 E1EE 7624 E1EF 7634 E1F0 7630 E1F1 763B E1F2 7647 E1F3 7648 E1F4 7646 E1F5 765C E1F6 7658 E1F7 7661 E1F8 7662 E1F9 7668 E1FA 7669 E1FB 766A E1FC 7667 E1FD 766C E1FE 7670 E2A1 7672 E2A2 7676 E2A3 7678 E2A4 767C E2A5 7680 E2A6 7683 E2A7 7688 E2A8 768B E2A9 768E E2AA 7696 E2AB 7693 E2AC 7699 E2AD 769A E2AE 76B0 E2AF 76B4 E2B0 76B8 E2B1 76B9 E2B2 76BA E2B3 76C2 E2B4 76CD E2B5 76D6 E2B6 76D2 E2B7 76DE E2B8 76E1 E2B9 76E5 E2BA 76E7 E2BB 76EA E2BC 862F E2BD 76FB E2BE 7708 E2BF 7707 E2C0 7704 E2C1 7729 E2C2 7724 E2C3 771E E2C4 7725 E2C5 7726 E2C6 771B E2C7 7737 E2C8 7738 E2C9 7747 E2CA 775A E2CB 7768 E2CC 776B E2CD 775B E2CE 7765 E2CF 777F E2D0 777E E2D1 7779 E2D2 778E E2D3 778B E2D4 7791 E2D5 77A0 E2D6 779E E2D7 77B0 E2D8 77B6 E2D9 77B9 E2DA 77BF E2DB 77BC E2DC 77BD E2DD 77BB E2DE 77C7 E2DF 77CD E2E0 77D7 E2E1 77DA E2E2 77DC E2E3 77E3 E2E4 77EE E2E5 77FC E2E6 780C E2E7 7812 E2E8 7926 E2E9 7820 E2EA 792A E2EB 7845 E2EC 788E E2ED 7874 E2EE 7886 E2EF 787C E2F0 789A E2F1 788C E2F2 78A3 E2F3 78B5 E2F4 78AA E2F5 78AF E2F6 78D1 E2F7 78C6 E2F8 78CB E2F9 78D4 E2FA 78BE E2FB 78BC E2FC 78C5 E2FD 78CA E2FE 78EC E3A1 78E7 E3A2 78DA E3A3 78FD E3A4 78F4 E3A5 7907 E3A6 7912 E3A7 7911 E3A8 7919 E3A9 792C E3AA 792B E3AB 7940 E3AC 7960 E3AD 7957 E3AE 795F E3AF 795A E3B0 7955 E3B1 7953 E3B2 797A E3B3 797F E3B4 798A E3B5 799D E3B6 79A7 E3B7 9F4B E3B8 79AA E3B9 79AE E3BA 79B3 E3BB 79B9 E3BC 79BA E3BD 79C9 E3BE 79D5 E3BF 79E7 E3C0 79EC E3C1 79E1 E3C2 79E3 E3C3 7A08 E3C4 7A0D E3C5 7A18 E3C6 7A19 E3C7 7A20 E3C8 7A1F E3C9 7980 E3CA 7A31 E3CB 7A3B E3CC 7A3E E3CD 7A37 E3CE 7A43 E3CF 7A57 E3D0 7A49 E3D1 7A61 E3D2 7A62 E3D3 7A69 E3D4 9F9D E3D5 7A70 E3D6 7A79 E3D7 7A7D E3D8 7A88 E3D9 7A97 E3DA 7A95 E3DB 7A98 E3DC 7A96 E3DD 7AA9 E3DE 7AC8 E3DF 7AB0 E3E0 7AB6 E3E1 7AC5 E3E2 7AC4 E3E3 7ABF E3E4 9083 E3E5 7AC7 E3E6 7ACA E3E7 7ACD E3E8 7ACF E3E9 7AD5 E3EA 7AD3 E3EB 7AD9 E3EC 7ADA E3ED 7ADD E3EE 7AE1 E3EF 7AE2 E3F0 7AE6 E3F1 7AED E3F2 7AF0 E3F3 7B02 E3F4 7B0F E3F5 7B0A E3F6 7B06 E3F7 7B33 E3F8 7B18 E3F9 7B19 E3FA 7B1E E3FB 7B35 E3FC 7B28 E3FD 7B36 E3FE 7B50 E4A1 7B7A E4A2 7B04 E4A3 7B4D E4A4 7B0B E4A5 7B4C E4A6 7B45 E4A7 7B75 E4A8 7B65 E4A9 7B74 E4AA 7B67 E4AB 7B70 E4AC 7B71 E4AD 7B6C E4AE 7B6E E4AF 7B9D E4B0 7B98 E4B1 7B9F E4B2 7B8D E4B3 7B9C E4B4 7B9A E4B5 7B8B E4B6 7B92 E4B7 7B8F E4B8 7B5D E4B9 7B99 E4BA 7BCB E4BB 7BC1 E4BC 7BCC E4BD 7BCF E4BE 7BB4 E4BF 7BC6 E4C0 7BDD E4C1 7BE9 E4C2 7C11 E4C3 7C14 E4C4 7BE6 E4C5 7BE5 E4C6 7C60 E4C7 7C00 E4C8 7C07 E4C9 7C13 E4CA 7BF3 E4CB 7BF7 E4CC 7C17 E4CD 7C0D E4CE 7BF6 E4CF 7C23 E4D0 7C27 E4D1 7C2A E4D2 7C1F E4D3 7C37 E4D4 7C2B E4D5 7C3D E4D6 7C4C E4D7 7C43 E4D8 7C54 E4D9 7C4F E4DA 7C40 E4DB 7C50 E4DC 7C58 E4DD 7C5F E4DE 7C64 E4DF 7C56 E4E0 7C65 E4E1 7C6C E4E2 7C75 E4E3 7C83 E4E4 7C90 E4E5 7CA4 E4E6 7CAD E4E7 7CA2 E4E8 7CAB E4E9 7CA1 E4EA 7CA8 E4EB 7CB3 E4EC 7CB2 E4ED 7CB1 E4EE 7CAE E4EF 7CB9 E4F0 7CBD E4F1 7CC0 E4F2 7CC5 E4F3 7CC2 E4F4 7CD8 E4F5 7CD2 E4F6 7CDC E4F7 7CE2 E4F8 9B3B E4F9 7CEF E4FA 7CF2 E4FB 7CF4 E4FC 7CF6 E4FD 7CFA E4FE 7D06 E5A1 7D02 E5A2 7D1C E5A3 7D15 E5A4 7D0A E5A5 7D45 E5A6 7D4B E5A7 7D2E E5A8 7D32 E5A9 7D3F E5AA 7D35 E5AB 7D46 E5AC 7D73 E5AD 7D56 E5AE 7D4E E5AF 7D72 E5B0 7D68 E5B1 7D6E E5B2 7D4F E5B3 7D63 E5B4 7D93 E5B5 7D89 E5B6 7D5B E5B7 7D8F E5B8 7D7D E5B9 7D9B E5BA 7DBA E5BB 7DAE E5BC 7DA3 E5BD 7DB5 E5BE 7DC7 E5BF 7DBD E5C0 7DAB E5C1 7E3D E5C2 7DA2 E5C3 7DAF E5C4 7DDC E5C5 7DB8 E5C6 7D9F E5C7 7DB0 E5C8 7DD8 E5C9 7DDD E5CA 7DE4 E5CB 7DDE E5CC 7DFB E5CD 7DF2 E5CE 7DE1 E5CF 7E05 E5D0 7E0A E5D1 7E23 E5D2 7E21 E5D3 7E12 E5D4 7E31 E5D5 7E1F E5D6 7E09 E5D7 7E0B E5D8 7E22 E5D9 7E46 E5DA 7E66 E5DB 7E3B E5DC 7E35 E5DD 7E39 E5DE 7E43 E5DF 7E37 E5E0 7E32 E5E1 7E3A E5E2 7E67 E5E3 7E5D E5E4 7E56 E5E5 7E5E E5E6 7E59 E5E7 7E5A E5E8 7E79 E5E9 7E6A E5EA 7E69 E5EB 7E7C E5EC 7E7B E5ED 7E83 E5EE 7DD5 E5EF 7E7D E5F0 8FAE E5F1 7E7F E5F2 7E88 E5F3 7E89 E5F4 7E8C E5F5 7E92 E5F6 7E90 E5F7 7E93 E5F8 7E94 E5F9 7E96 E5FA 7E8E E5FB 7E9B E5FC 7E9C E5FD 7F38 E5FE 7F3A E6A1 7F45 E6A2 7F4C E6A3 7F4D E6A4 7F4E E6A5 7F50 E6A6 7F51 E6A7 7F55 E6A8 7F54 E6A9 7F58 E6AA 7F5F E6AB 7F60 E6AC 7F68 E6AD 7F69 E6AE 7F67 E6AF 7F78 E6B0 7F82 E6B1 7F86 E6B2 7F83 E6B3 7F88 E6B4 7F87 E6B5 7F8C E6B6 7F94 E6B7 7F9E E6B8 7F9D E6B9 7F9A E6BA 7FA3 E6BB 7FAF E6BC 7FB2 E6BD 7FB9 E6BE 7FAE E6BF 7FB6 E6C0 7FB8 E6C1 8B71 E6C2 7FC5 E6C3 7FC6 E6C4 7FCA E6C5 7FD5 E6C6 7FD4 E6C7 7FE1 E6C8 7FE6 E6C9 7FE9 E6CA 7FF3 E6CB 7FF9 E6CC 98DC E6CD 8006 E6CE 8004 E6CF 800B E6D0 8012 E6D1 8018 E6D2 8019 E6D3 801C E6D4 8021 E6D5 8028 E6D6 803F E6D7 803B E6D8 804A E6D9 8046 E6DA 8052 E6DB 8058 E6DC 805A E6DD 805F E6DE 8062 E6DF 8068 E6E0 8073 E6E1 8072 E6E2 8070 E6E3 8076 E6E4 8079 E6E5 807D E6E6 807F E6E7 8084 E6E8 8086 E6E9 8085 E6EA 809B E6EB 8093 E6EC 809A E6ED 80AD E6EE 5190 E6EF 80AC E6F0 80DB E6F1 80E5 E6F2 80D9 E6F3 80DD E6F4 80C4 E6F5 80DA E6F6 80D6 E6F7 8109 E6F8 80EF E6F9 80F1 E6FA 811B E6FB 8129 E6FC 8123 E6FD 812F E6FE 814B E7A1 968B E7A2 8146 E7A3 813E E7A4 8153 E7A5 8151 E7A6 80FC E7A7 8171 E7A8 816E E7A9 8165 E7AA 8166 E7AB 8174 E7AC 8183 E7AD 8188 E7AE 818A E7AF 8180 E7B0 8182 E7B1 81A0 E7B2 8195 E7B3 81A4 E7B4 81A3 E7B5 815F E7B6 8193 E7B7 81A9 E7B8 81B0 E7B9 81B5 E7BA 81BE E7BB 81B8 E7BC 81BD E7BD 81C0 E7BE 81C2 E7BF 81BA E7C0 81C9 E7C1 81CD E7C2 81D1 E7C3 81D9 E7C4 81D8 E7C5 81C8 E7C6 81DA E7C7 81DF E7C8 81E0 E7C9 81E7 E7CA 81FA E7CB 81FB E7CC 81FE E7CD 8201 E7CE 8202 E7CF 8205 E7D0 8207 E7D1 820A E7D2 820D E7D3 8210 E7D4 8216 E7D5 8229 E7D6 822B E7D7 8238 E7D8 8233 E7D9 8240 E7DA 8259 E7DB 8258 E7DC 825D E7DD 825A E7DE 825F E7DF 8264 E7E0 8262 E7E1 8268 E7E2 826A E7E3 826B E7E4 822E E7E5 8271 E7E6 8277 E7E7 8278 E7E8 827E E7E9 828D E7EA 8292 E7EB 82AB E7EC 829F E7ED 82BB E7EE 82AC E7EF 82E1 E7F0 82E3 E7F1 82DF E7F2 82D2 E7F3 82F4 E7F4 82F3 E7F5 82FA E7F6 8393 E7F7 8303 E7F8 82FB E7F9 82F9 E7FA 82DE E7FB 8306 E7FC 82DC E7FD 8309 E7FE 82D9 E8A1 8335 E8A2 8334 E8A3 8316 E8A4 8332 E8A5 8331 E8A6 8340 E8A7 8339 E8A8 8350 E8A9 8345 E8AA 832F E8AB 832B E8AC 8317 E8AD 8318 E8AE 8385 E8AF 839A E8B0 83AA E8B1 839F E8B2 83A2 E8B3 8396 E8B4 8323 E8B5 838E E8B6 8387 E8B7 838A E8B8 837C E8B9 83B5 E8BA 8373 E8BB 8375 E8BC 83A0 E8BD 8389 E8BE 83A8 E8BF 83F4 E8C0 8413 E8C1 83EB E8C2 83CE E8C3 83FD E8C4 8403 E8C5 83D8 E8C6 840B E8C7 83C1 E8C8 83F7 E8C9 8407 E8CA 83E0 E8CB 83F2 E8CC 840D E8CD 8422 E8CE 8420 E8CF 83BD E8D0 8438 E8D1 8506 E8D2 83FB E8D3 846D E8D4 842A E8D5 843C E8D6 855A E8D7 8484 E8D8 8477 E8D9 846B E8DA 84AD E8DB 846E E8DC 8482 E8DD 8469 E8DE 8446 E8DF 842C E8E0 846F E8E1 8479 E8E2 8435 E8E3 84CA E8E4 8462 E8E5 84B9 E8E6 84BF E8E7 849F E8E8 84D9 E8E9 84CD E8EA 84BB E8EB 84DA E8EC 84D0 E8ED 84C1 E8EE 84C6 E8EF 84D6 E8F0 84A1 E8F1 8521 E8F2 84FF E8F3 84F4 E8F4 8517 E8F5 8518 E8F6 852C E8F7 851F E8F8 8515 E8F9 8514 E8FA 84FC E8FB 8540 E8FC 8563 E8FD 8558 E8FE 8548 E9A1 8541 E9A2 8602 E9A3 854B E9A4 8555 E9A5 8580 E9A6 85A4 E9A7 8588 E9A8 8591 E9A9 858A E9AA 85A8 E9AB 856D E9AC 8594 E9AD 859B E9AE 85EA E9AF 8587 E9B0 859C E9B1 8577 E9B2 857E E9B3 8590 E9B4 85C9 E9B5 85BA E9B6 85CF E9B7 85B9 E9B8 85D0 E9B9 85D5 E9BA 85DD E9BB 85E5 E9BC 85DC E9BD 85F9 E9BE 860A E9BF 8613 E9C0 860B E9C1 85FE E9C2 85FA E9C3 8606 E9C4 8622 E9C5 861A E9C6 8630 E9C7 863F E9C8 864D E9C9 4E55 E9CA 8654 E9CB 865F E9CC 8667 E9CD 8671 E9CE 8693 E9CF 86A3 E9D0 86A9 E9D1 86AA E9D2 868B E9D3 868C E9D4 86B6 E9D5 86AF E9D6 86C4 E9D7 86C6 E9D8 86B0 E9D9 86C9 E9DA 8823 E9DB 86AB E9DC 86D4 E9DD 86DE E9DE 86E9 E9DF 86EC E9E0 86DF E9E1 86DB E9E2 86EF E9E3 8712 E9E4 8706 E9E5 8708 E9E6 8700 E9E7 8703 E9E8 86FB E9E9 8711 E9EA 8709 E9EB 870D E9EC 86F9 E9ED 870A E9EE 8734 E9EF 873F E9F0 8737 E9F1 873B E9F2 8725 E9F3 8729 E9F4 871A E9F5 8760 E9F6 875F E9F7 8778 E9F8 874C E9F9 874E E9FA 8774 E9FB 8757 E9FC 8768 E9FD 876E E9FE 8759 EAA1 8753 EAA2 8763 EAA3 876A EAA4 8805 EAA5 87A2 EAA6 879F EAA7 8782 EAA8 87AF EAA9 87CB EAAA 87BD EAAB 87C0 EAAC 87D0 EAAD 96D6 EAAE 87AB EAAF 87C4 EAB0 87B3 EAB1 87C7 EAB2 87C6 EAB3 87BB EAB4 87EF EAB5 87F2 EAB6 87E0 EAB7 880F EAB8 880D EAB9 87FE EABA 87F6 EABB 87F7 EABC 880E EABD 87D2 EABE 8811 EABF 8816 EAC0 8815 EAC1 8822 EAC2 8821 EAC3 8831 EAC4 8836 EAC5 8839 EAC6 8827 EAC7 883B EAC8 8844 EAC9 8842 EACA 8852 EACB 8859 EACC 885E EACD 8862 EACE 886B EACF 8881 EAD0 887E EAD1 889E EAD2 8875 EAD3 887D EAD4 88B5 EAD5 8872 EAD6 8882 EAD7 8897 EAD8 8892 EAD9 88AE EADA 8899 EADB 88A2 EADC 888D EADD 88A4 EADE 88B0 EADF 88BF EAE0 88B1 EAE1 88C3 EAE2 88C4 EAE3 88D4 EAE4 88D8 EAE5 88D9 EAE6 88DD EAE7 88F9 EAE8 8902 EAE9 88FC EAEA 88F4 EAEB 88E8 EAEC 88F2 EAED 8904 EAEE 890C EAEF 890A EAF0 8913 EAF1 8943 EAF2 891E EAF3 8925 EAF4 892A EAF5 892B EAF6 8941 EAF7 8944 EAF8 893B EAF9 8936 EAFA 8938 EAFB 894C EAFC 891D EAFD 8960 EAFE 895E EBA1 8966 EBA2 8964 EBA3 896D EBA4 896A EBA5 896F EBA6 8974 EBA7 8977 EBA8 897E EBA9 8983 EBAA 8988 EBAB 898A EBAC 8993 EBAD 8998 EBAE 89A1 EBAF 89A9 EBB0 89A6 EBB1 89AC EBB2 89AF EBB3 89B2 EBB4 89BA EBB5 89BD EBB6 89BF EBB7 89C0 EBB8 89DA EBB9 89DC EBBA 89DD EBBB 89E7 EBBC 89F4 EBBD 89F8 EBBE 8A03 EBBF 8A16 EBC0 8A10 EBC1 8A0C EBC2 8A1B EBC3 8A1D EBC4 8A25 EBC5 8A36 EBC6 8A41 EBC7 8A5B EBC8 8A52 EBC9 8A46 EBCA 8A48 EBCB 8A7C EBCC 8A6D EBCD 8A6C EBCE 8A62 EBCF 8A85 EBD0 8A82 EBD1 8A84 EBD2 8AA8 EBD3 8AA1 EBD4 8A91 EBD5 8AA5 EBD6 8AA6 EBD7 8A9A EBD8 8AA3 EBD9 8AC4 EBDA 8ACD EBDB 8AC2 EBDC 8ADA EBDD 8AEB EBDE 8AF3 EBDF 8AE7 EBE0 8AE4 EBE1 8AF1 EBE2 8B14 EBE3 8AE0 EBE4 8AE2 EBE5 8AF7 EBE6 8ADE EBE7 8ADB EBE8 8B0C EBE9 8B07 EBEA 8B1A EBEB 8AE1 EBEC 8B16 EBED 8B10 EBEE 8B17 EBEF 8B20 EBF0 8B33 EBF1 97AB EBF2 8B26 EBF3 8B2B EBF4 8B3E EBF5 8B28 EBF6 8B41 EBF7 8B4C EBF8 8B4F EBF9 8B4E EBFA 8B49 EBFB 8B56 EBFC 8B5B EBFD 8B5A EBFE 8B6B ECA1 8B5F ECA2 8B6C ECA3 8B6F ECA4 8B74 ECA5 8B7D ECA6 8B80 ECA7 8B8C ECA8 8B8E ECA9 8B92 ECAA 8B93 ECAB 8B96 ECAC 8B99 ECAD 8B9A ECAE 8C3A ECAF 8C41 ECB0 8C3F ECB1 8C48 ECB2 8C4C ECB3 8C4E ECB4 8C50 ECB5 8C55 ECB6 8C62 ECB7 8C6C ECB8 8C78 ECB9 8C7A ECBA 8C82 ECBB 8C89 ECBC 8C85 ECBD 8C8A ECBE 8C8D ECBF 8C8E ECC0 8C94 ECC1 8C7C ECC2 8C98 ECC3 621D ECC4 8CAD ECC5 8CAA ECC6 8CBD ECC7 8CB2 ECC8 8CB3 ECC9 8CAE ECCA 8CB6 ECCB 8CC8 ECCC 8CC1 ECCD 8CE4 ECCE 8CE3 ECCF 8CDA ECD0 8CFD ECD1 8CFA ECD2 8CFB ECD3 8D04 ECD4 8D05 ECD5 8D0A ECD6 8D07 ECD7 8D0F ECD8 8D0D ECD9 8D10 ECDA 9F4E ECDB 8D13 ECDC 8CCD ECDD 8D14 ECDE 8D16 ECDF 8D67 ECE0 8D6D ECE1 8D71 ECE2 8D73 ECE3 8D81 ECE4 8D99 ECE5 8DC2 ECE6 8DBE ECE7 8DBA ECE8 8DCF ECE9 8DDA ECEA 8DD6 ECEB 8DCC ECEC 8DDB ECED 8DCB ECEE 8DEA ECEF 8DEB ECF0 8DDF ECF1 8DE3 ECF2 8DFC ECF3 8E08 ECF4 8E09 ECF5 8DFF ECF6 8E1D ECF7 8E1E ECF8 8E10 ECF9 8E1F ECFA 8E42 ECFB 8E35 ECFC 8E30 ECFD 8E34 ECFE 8E4A EDA1 8E47 EDA2 8E49 EDA3 8E4C EDA4 8E50 EDA5 8E48 EDA6 8E59 EDA7 8E64 EDA8 8E60 EDA9 8E2A EDAA 8E63 EDAB 8E55 EDAC 8E76 EDAD 8E72 EDAE 8E7C EDAF 8E81 EDB0 8E87 EDB1 8E85 EDB2 8E84 EDB3 8E8B EDB4 8E8A EDB5 8E93 EDB6 8E91 EDB7 8E94 EDB8 8E99 EDB9 8EAA EDBA 8EA1 EDBB 8EAC EDBC 8EB0 EDBD 8EC6 EDBE 8EB1 EDBF 8EBE EDC0 8EC5 EDC1 8EC8 EDC2 8ECB EDC3 8EDB EDC4 8EE3 EDC5 8EFC EDC6 8EFB EDC7 8EEB EDC8 8EFE EDC9 8F0A EDCA 8F05 EDCB 8F15 EDCC 8F12 EDCD 8F19 EDCE 8F13 EDCF 8F1C EDD0 8F1F EDD1 8F1B EDD2 8F0C EDD3 8F26 EDD4 8F33 EDD5 8F3B EDD6 8F39 EDD7 8F45 EDD8 8F42 EDD9 8F3E EDDA 8F4C EDDB 8F49 EDDC 8F46 EDDD 8F4E EDDE 8F57 EDDF 8F5C EDE0 8F62 EDE1 8F63 EDE2 8F64 EDE3 8F9C EDE4 8F9F EDE5 8FA3 EDE6 8FAD EDE7 8FAF EDE8 8FB7 EDE9 8FDA EDEA 8FE5 EDEB 8FE2 EDEC 8FEA EDED 8FEF EDEE 9087 EDEF 8FF4 EDF0 9005 EDF1 8FF9 EDF2 8FFA EDF3 9011 EDF4 9015 EDF5 9021 EDF6 900D EDF7 901E EDF8 9016 EDF9 900B EDFA 9027 EDFB 9036 EDFC 9035 EDFD 9039 EDFE 8FF8 EEA1 904F EEA2 9050 EEA3 9051 EEA4 9052 EEA5 900E EEA6 9049 EEA7 903E EEA8 9056 EEA9 9058 EEAA 905E EEAB 9068 EEAC 906F EEAD 9076 EEAE 96A8 EEAF 9072 EEB0 9082 EEB1 907D EEB2 9081 EEB3 9080 EEB4 908A EEB5 9089 EEB6 908F EEB7 90A8 EEB8 90AF EEB9 90B1 EEBA 90B5 EEBB 90E2 EEBC 90E4 EEBD 6248 EEBE 90DB EEBF 9102 EEC0 9112 EEC1 9119 EEC2 9132 EEC3 9130 EEC4 914A EEC5 9156 EEC6 9158 EEC7 9163 EEC8 9165 EEC9 9169 EECA 9173 EECB 9172 EECC 918B EECD 9189 EECE 9182 EECF 91A2 EED0 91AB EED1 91AF EED2 91AA EED3 91B5 EED4 91B4 EED5 91BA EED6 91C0 EED7 91C1 EED8 91C9 EED9 91CB EEDA 91D0 EEDB 91D6 EEDC 91DF EEDD 91E1 EEDE 91DB EEDF 91FC EEE0 91F5 EEE1 91F6 EEE2 921E EEE3 91FF EEE4 9214 EEE5 922C EEE6 9215 EEE7 9211 EEE8 925E EEE9 9257 EEEA 9245 EEEB 9249 EEEC 9264 EEED 9248 EEEE 9295 EEEF 923F EEF0 924B EEF1 9250 EEF2 929C EEF3 9296 EEF4 9293 EEF5 929B EEF6 925A EEF7 92CF EEF8 92B9 EEF9 92B7 EEFA 92E9 EEFB 930F EEFC 92FA EEFD 9344 EEFE 932E EFA1 9319 EFA2 9322 EFA3 931A EFA4 9323 EFA5 933A EFA6 9335 EFA7 933B EFA8 935C EFA9 9360 EFAA 937C EFAB 936E EFAC 9356 EFAD 93B0 EFAE 93AC EFAF 93AD EFB0 9394 EFB1 93B9 EFB2 93D6 EFB3 93D7 EFB4 93E8 EFB5 93E5 EFB6 93D8 EFB7 93C3 EFB8 93DD EFB9 93D0 EFBA 93C8 EFBB 93E4 EFBC 941A EFBD 9414 EFBE 9413 EFBF 9403 EFC0 9407 EFC1 9410 EFC2 9436 EFC3 942B EFC4 9435 EFC5 9421 EFC6 943A EFC7 9441 EFC8 9452 EFC9 9444 EFCA 945B EFCB 9460 EFCC 9462 EFCD 945E EFCE 946A EFCF 9229 EFD0 9470 EFD1 9475 EFD2 9477 EFD3 947D EFD4 945A EFD5 947C EFD6 947E EFD7 9481 EFD8 947F EFD9 9582 EFDA 9587 EFDB 958A EFDC 9594 EFDD 9596 EFDE 9598 EFDF 9599 EFE0 95A0 EFE1 95A8 EFE2 95A7 EFE3 95AD EFE4 95BC EFE5 95BB EFE6 95B9 EFE7 95BE EFE8 95CA EFE9 6FF6 EFEA 95C3 EFEB 95CD EFEC 95CC EFED 95D5 EFEE 95D4 EFEF 95D6 EFF0 95DC EFF1 95E1 EFF2 95E5 EFF3 95E2 EFF4 9621 EFF5 9628 EFF6 962E EFF7 962F EFF8 9642 EFF9 964C EFFA 964F EFFB 964B EFFC 9677 EFFD 965C EFFE 965E F0A1 965D F0A2 965F F0A3 9666 F0A4 9672 F0A5 966C F0A6 968D F0A7 9698 F0A8 9695 F0A9 9697 F0AA 96AA F0AB 96A7 F0AC 96B1 F0AD 96B2 F0AE 96B0 F0AF 96B4 F0B0 96B6 F0B1 96B8 F0B2 96B9 F0B3 96CE F0B4 96CB F0B5 96C9 F0B6 96CD F0B7 894D F0B8 96DC F0B9 970D F0BA 96D5 F0BB 96F9 F0BC 9704 F0BD 9706 F0BE 9708 F0BF 9713 F0C0 970E F0C1 9711 F0C2 970F F0C3 9716 F0C4 9719 F0C5 9724 F0C6 972A F0C7 9730 F0C8 9739 F0C9 973D F0CA 973E F0CB 9744 F0CC 9746 F0CD 9748 F0CE 9742 F0CF 9749 F0D0 975C F0D1 9760 F0D2 9764 F0D3 9766 F0D4 9768 F0D5 52D2 F0D6 976B F0D7 9771 F0D8 9779 F0D9 9785 F0DA 977C F0DB 9781 F0DC 977A F0DD 9786 F0DE 978B F0DF 978F F0E0 9790 F0E1 979C F0E2 97A8 F0E3 97A6 F0E4 97A3 F0E5 97B3 F0E6 97B4 F0E7 97C3 F0E8 97C6 F0E9 97C8 F0EA 97CB F0EB 97DC F0EC 97ED F0ED 9F4F F0EE 97F2 F0EF 7ADF F0F0 97F6 F0F1 97F5 F0F2 980F F0F3 980C F0F4 9838 F0F5 9824 F0F6 9821 F0F7 9837 F0F8 983D F0F9 9846 F0FA 984F F0FB 984B F0FC 986B F0FD 986F F0FE 9870 F1A1 9871 F1A2 9874 F1A3 9873 F1A4 98AA F1A5 98AF F1A6 98B1 F1A7 98B6 F1A8 98C4 F1A9 98C3 F1AA 98C6 F1AB 98E9 F1AC 98EB F1AD 9903 F1AE 9909 F1AF 9912 F1B0 9914 F1B1 9918 F1B2 9921 F1B3 991D F1B4 991E F1B5 9924 F1B6 9920 F1B7 992C F1B8 992E F1B9 993D F1BA 993E F1BB 9942 F1BC 9949 F1BD 9945 F1BE 9950 F1BF 994B F1C0 9951 F1C1 9952 F1C2 994C F1C3 9955 F1C4 9997 F1C5 9998 F1C6 99A5 F1C7 99AD F1C8 99AE F1C9 99BC F1CA 99DF F1CB 99DB F1CC 99DD F1CD 99D8 F1CE 99D1 F1CF 99ED F1D0 99EE F1D1 99F1 F1D2 99F2 F1D3 99FB F1D4 99F8 F1D5 9A01 F1D6 9A0F F1D7 9A05 F1D8 99E2 F1D9 9A19 F1DA 9A2B F1DB 9A37 F1DC 9A45 F1DD 9A42 F1DE 9A40 F1DF 9A43 F1E0 9A3E F1E1 9A55 F1E2 9A4D F1E3 9A5B F1E4 9A57 F1E5 9A5F F1E6 9A62 F1E7 9A65 F1E8 9A64 F1E9 9A69 F1EA 9A6B F1EB 9A6A F1EC 9AAD F1ED 9AB0 F1EE 9ABC F1EF 9AC0 F1F0 9ACF F1F1 9AD1 F1F2 9AD3 F1F3 9AD4 F1F4 9ADE F1F5 9ADF F1F6 9AE2 F1F7 9AE3 F1F8 9AE6 F1F9 9AEF F1FA 9AEB F1FB 9AEE F1FC 9AF4 F1FD 9AF1 F1FE 9AF7 F2A1 9AFB F2A2 9B06 F2A3 9B18 F2A4 9B1A F2A5 9B1F F2A6 9B22 F2A7 9B23 F2A8 9B25 F2A9 9B27 F2AA 9B28 F2AB 9B29 F2AC 9B2A F2AD 9B2E F2AE 9B2F F2AF 9B32 F2B0 9B44 F2B1 9B43 F2B2 9B4F F2B3 9B4D F2B4 9B4E F2B5 9B51 F2B6 9B58 F2B7 9B74 F2B8 9B93 F2B9 9B83 F2BA 9B91 F2BB 9B96 F2BC 9B97 F2BD 9B9F F2BE 9BA0 F2BF 9BA8 F2C0 9BB4 F2C1 9BC0 F2C2 9BCA F2C3 9BB9 F2C4 9BC6 F2C5 9BCF F2C6 9BD1 F2C7 9BD2 F2C8 9BE3 F2C9 9BE2 F2CA 9BE4 F2CB 9BD4 F2CC 9BE1 F2CD 9C3A F2CE 9BF2 F2CF 9BF1 F2D0 9BF0 F2D1 9C15 F2D2 9C14 F2D3 9C09 F2D4 9C13 F2D5 9C0C F2D6 9C06 F2D7 9C08 F2D8 9C12 F2D9 9C0A F2DA 9C04 F2DB 9C2E F2DC 9C1B F2DD 9C25 F2DE 9C24 F2DF 9C21 F2E0 9C30 F2E1 9C47 F2E2 9C32 F2E3 9C46 F2E4 9C3E F2E5 9C5A F2E6 9C60 F2E7 9C67 F2E8 9C76 F2E9 9C78 F2EA 9CE7 F2EB 9CEC F2EC 9CF0 F2ED 9D09 F2EE 9D08 F2EF 9CEB F2F0 9D03 F2F1 9D06 F2F2 9D2A F2F3 9D26 F2F4 9DAF F2F5 9D23 F2F6 9D1F F2F7 9D44 F2F8 9D15 F2F9 9D12 F2FA 9D41 F2FB 9D3F F2FC 9D3E F2FD 9D46 F2FE 9D48 F3A1 9D5D F3A2 9D5E F3A3 9D64 F3A4 9D51 F3A5 9D50 F3A6 9D59 F3A7 9D72 F3A8 9D89 F3A9 9D87 F3AA 9DAB F3AB 9D6F F3AC 9D7A F3AD 9D9A F3AE 9DA4 F3AF 9DA9 F3B0 9DB2 F3B1 9DC4 F3B2 9DC1 F3B3 9DBB F3B4 9DB8 F3B5 9DBA F3B6 9DC6 F3B7 9DCF F3B8 9DC2 F3B9 9DD9 F3BA 9DD3 F3BB 9DF8 F3BC 9DE6 F3BD 9DED F3BE 9DEF F3BF 9DFD F3C0 9E1A F3C1 9E1B F3C2 9E1E F3C3 9E75 F3C4 9E79 F3C5 9E7D F3C6 9E81 F3C7 9E88 F3C8 9E8B F3C9 9E8C F3CA 9E92 F3CB 9E95 F3CC 9E91 F3CD 9E9D F3CE 9EA5 F3CF 9EA9 F3D0 9EB8 F3D1 9EAA F3D2 9EAD F3D3 9761 F3D4 9ECC F3D5 9ECE F3D6 9ECF F3D7 9ED0 F3D8 9ED4 F3D9 9EDC F3DA 9EDE F3DB 9EDD F3DC 9EE0 F3DD 9EE5 F3DE 9EE8 F3DF 9EEF F3E0 9EF4 F3E1 9EF6 F3E2 9EF7 F3E3 9EF9 F3E4 9EFB F3E5 9EFC F3E6 9EFD F3E7 9F07 F3E8 9F08 F3E9 76B7 F3EA 9F15 F3EB 9F21 F3EC 9F2C F3ED 9F3E F3EE 9F4A F3EF 9F52 F3F0 9F54 F3F1 9F63 F3F2 9F5F F3F3 9F60 F3F4 9F61 F3F5 9F66 F3F6 9F67 F3F7 9F6C F3F8 9F6A F3F9 9F77 F3FA 9F72 F3FB 9F76 F3FC 9F95 F3FD 9F9C F3FE 9FA0 F4A1 582F F4A2 69C7 F4A3 9059 F4A4 7464 F4A5 51DC F4A6 7199 F4A8 5DE2 F4A9 5E14 F4AA 5E18 F4AB 5E58 F4AC 5E5E F4AD 5EBE F4AE F928 F4AF 5ECB F4B0 5EF9 F4B1 5F00 F4B2 5F02 F4B3 5F07 F4B4 5F1D F4B5 5F23 F4B6 5F34 F4B7 5F36 F4B8 5F3D F4B9 5F40 F4BA 5F45 F4BB 5F54 F4BC 5F58 F4BD 5F64 F4BE 5F67 F4BF 5F7D F4C0 5F89 F4C1 5F9C F4C2 5FA7 F4C3 5FAF F4C4 5FB5 F4C5 5FB7 F4C6 5FC9 F4C7 5FDE F4C8 5FE1 F4C9 5FE9 F4CA 600D F4CB 6014 F4CC 6018 F4CD 6033 F4CE 6035 F4CF 6047 F4D0 FA3D F4D1 609D F4D2 609E F4D3 60CB F4D4 60D4 F4D5 60D5 F4D6 60DD F4D7 60F8 F4D8 611C F4D9 612B F4DA 6130 F4DB 6137 F4DC FA3E F4DD 618D F4DE FA3F F4DF 61BC F4E0 61B9 F4E1 FA40 F4E2 6222 F4E3 623E F4E4 6243 F4E5 6256 F4E6 625A F4E7 626F F4E8 6285 F4E9 62C4 F4EA 62D6 F4EB 62FC F4EC 630A F4ED 6318 F4EE 6339 F4EF 6343 F4F0 6365 F4F1 637C F4F2 63E5 F4F3 63ED F4F4 63F5 F4F5 6410 F4F6 6414 F4F7 6422 F4F8 6479 F4F9 6451 F4FA 6460 F4FB 646D F4FC 64CE F4FD 64BE F4FE 64BF F5A1 64C4 F5A2 64CA F5A3 64D0 F5A4 64F7 F5A5 64FB F5A6 6522 F5A7 6529 F5A8 FA41 F5A9 6567 F5AA 659D F5AB FA42 F5AC 6600 F5AD 6609 F5AE 6615 F5AF 661E F5B0 663A F5B1 6622 F5B2 6624 F5B3 662B F5B4 6630 F5B5 6631 F5B6 6633 F5B7 66FB F5B8 6648 F5B9 664C F5BA 231C4 F5BB 6659 F5BC 665A F5BD 6661 F5BE 6665 F5BF 6673 F5C0 6677 F5C1 6678 F5C2 668D F5C3 FA43 F5C4 66A0 F5C5 66B2 F5C6 66BB F5C7 66C6 F5C8 66C8 F5C9 3B22 F5CA 66DB F5CB 66E8 F5CC 66FA F5CD 6713 F5CE F929 F5CF 6733 F5D0 6766 F5D1 6747 F5D2 6748 F5D3 677B F5D4 6781 F5D5 6793 F5D6 6798 F5D7 679B F5D8 67BB F5D9 67F9 F5DA 67C0 F5DB 67D7 F5DC 67FC F5DD 6801 F5DE 6852 F5DF 681D F5E0 682C F5E1 6831 F5E2 685B F5E3 6872 F5E4 6875 F5E5 FA44 F5E6 68A3 F5E7 68A5 F5E8 68B2 F5E9 68C8 F5EA 68D0 F5EB 68E8 F5EC 68ED F5ED 68F0 F5EE 68F1 F5EF 68FC F5F0 690A F5F1 6949 F5F2 235C4 F5F3 6935 F5F4 6942 F5F5 6957 F5F6 6963 F5F7 6964 F5F8 6968 F5F9 6980 F5FA FA14 F5FB 69A5 F5FC 69AD F5FD 69CF F5FE 3BB6 F6A1 3BC3 F6A2 69E2 F6A3 69E9 F6A4 69EA F6A5 69F5 F6A6 69F6 F6A7 6A0F F6A8 6A15 F6A9 2373F F6AA 6A3B F6AB 6A3E F6AC 6A45 F6AD 6A50 F6AE 6A56 F6AF 6A5B F6B0 6A6B F6B1 6A73 F6B2 23763 F6B3 6A89 F6B4 6A94 F6B5 6A9D F6B6 6A9E F6B7 6AA5 F6B8 6AE4 F6B9 6AE7 F6BA 3C0F F6BB F91D F6BC 6B1B F6BD 6B1E F6BE 6B2C F6BF 6B35 F6C0 6B46 F6C1 6B56 F6C2 6B60 F6C3 6B65 F6C4 6B67 F6C5 6B77 F6C6 6B82 F6C7 6BA9 F6C8 6BAD F6C9 F970 F6CA 6BCF F6CB 6BD6 F6CC 6BD7 F6CD 6BFF F6CE 6C05 F6CF 6C10 F6D0 6C33 F6D1 6C59 F6D2 6C5C F6D3 6CAA F6D4 6C74 F6D5 6C76 F6D6 6C85 F6D7 6C86 F6D8 6C98 F6D9 6C9C F6DA 6CFB F6DB 6CC6 F6DC 6CD4 F6DD 6CE0 F6DE 6CEB F6DF 6CEE F6E0 23CFE F6E1 6D04 F6E2 6D0E F6E3 6D2E F6E4 6D31 F6E5 6D39 F6E6 6D3F F6E7 6D58 F6E8 6D65 F6E9 FA45 F6EA 6D82 F6EB 6D87 F6EC 6D89 F6ED 6D94 F6EE 6DAA F6EF 6DAC F6F0 6DBF F6F1 6DC4 F6F2 6DD6 F6F3 6DDA F6F4 6DDB F6F5 6DDD F6F6 6DFC F6F7 FA46 F6F8 6E34 F6F9 6E44 F6FA 6E5C F6FB 6E5E F6FC 6EAB F6FD 6EB1 F6FE 6EC1 F7A1 6EC7 F7A2 6ECE F7A3 6F10 F7A4 6F1A F7A5 FA47 F7A6 6F2A F7A7 6F2F F7A8 6F33 F7A9 6F51 F7AA 6F59 F7AB 6F5E F7AC 6F61 F7AD 6F62 F7AE 6F7E F7AF 6F88 F7B0 6F8C F7B1 6F8D F7B2 6F94 F7B3 6FA0 F7B4 6FA7 F7B5 6FB6 F7B6 6FBC F7B7 6FC7 F7B8 6FCA F7B9 6FF9 F7BA 6FF0 F7BB 6FF5 F7BC 7005 F7BD 7006 F7BE 7028 F7BF 704A F7C0 705D F7C1 705E F7C2 704E F7C3 7064 F7C4 7075 F7C5 7085 F7C6 70A4 F7C7 70AB F7C8 70B7 F7C9 70D4 F7CA 70D8 F7CB 70E4 F7CC 710F F7CD 712B F7CE 711E F7CF 7120 F7D0 712E F7D1 7130 F7D2 7146 F7D3 7147 F7D4 7151 F7D5 FA48 F7D6 7152 F7D7 715C F7D8 7160 F7D9 7168 F7DA FA15 F7DB 7185 F7DC 7187 F7DD 7192 F7DE 71C1 F7DF 71BA F7E0 71C4 F7E1 71FE F7E2 7200 F7E3 7215 F7E4 7255 F7E5 7256 F7E6 3E3F F7E7 728D F7E8 729B F7E9 72BE F7EA 72C0 F7EB 72FB F7EC 247F1 F7ED 7327 F7EE 7328 F7EF FA16 F7F0 7350 F7F1 7366 F7F2 737C F7F3 7395 F7F4 739F F7F5 73A0 F7F6 73A2 F7F7 73A6 F7F8 73AB F7F9 73C9 F7FA 73CF F7FB 73D6 F7FC 73D9 F7FD 73E3 F7FE 73E9 F8A1 7407 F8A2 740A F8A3 741A F8A4 741B F8A5 FA4A F8A6 7426 F8A7 7428 F8A8 742A F8A9 742B F8AA 742C F8AB 742E F8AC 742F F8AD 7430 F8AE 7444 F8AF 7446 F8B0 7447 F8B1 744B F8B2 7457 F8B3 7462 F8B4 746B F8B5 746D F8B6 7486 F8B7 7487 F8B8 7489 F8B9 7498 F8BA 749C F8BB 749F F8BC 74A3 F8BD 7490 F8BE 74A6 F8BF 74A8 F8C0 74A9 F8C1 74B5 F8C2 74BF F8C3 74C8 F8C4 74C9 F8C5 74DA F8C6 74FF F8C7 7501 F8C8 7517 F8C9 752F F8CA 756F F8CB 7579 F8CC 7592 F8CD 3F72 F8CE 75CE F8CF 75E4 F8D0 7600 F8D1 7602 F8D2 7608 F8D3 7615 F8D4 7616 F8D5 7619 F8D6 761E F8D7 762D F8D8 7635 F8D9 7643 F8DA 764B F8DB 7664 F8DC 7665 F8DD 766D F8DE 766F F8DF 7671 F8E0 7681 F8E1 769B F8E2 769D F8E3 769E F8E4 76A6 F8E5 76AA F8E6 76B6 F8E7 76C5 F8E8 76CC F8E9 76CE F8EA 76D4 F8EB 76E6 F8EC 76F1 F8ED 76FC F8EE 770A F8EF 7719 F8F0 7734 F8F1 7736 F8F2 7746 F8F3 774D F8F4 774E F8F5 775C F8F6 775F F8F7 7762 F8F8 777A F8F9 7780 F8FA 7794 F8FB 77AA F8FC 77E0 F8FD 782D F8FE 2548E F9A1 7843 F9A2 784E F9A3 784F F9A4 7851 F9A5 7868 F9A6 786E F9A7 FA4B F9A8 78B0 F9A9 2550E F9AA 78AD F9AB 78E4 F9AC 78F2 F9AD 7900 F9AE 78F7 F9AF 791C F9B0 792E F9B1 7931 F9B2 7934 F9B3 FA4C F9B4 FA4D F9B5 7945 F9B6 7946 F9B7 FA4E F9B8 FA4F F9B9 FA50 F9BA 795C F9BB FA51 F9BC FA19 F9BD FA1A F9BE 7979 F9BF FA52 F9C0 FA53 F9C1 FA1B F9C2 7998 F9C3 79B1 F9C4 79B8 F9C5 79C8 F9C6 79CA F9C7 25771 F9C8 79D4 F9C9 79DE F9CA 79EB F9CB 79ED F9CC 7A03 F9CD FA54 F9CE 7A39 F9CF 7A5D F9D0 7A6D F9D1 FA55 F9D2 7A85 F9D3 7AA0 F9D4 259C4 F9D5 7AB3 F9D6 7ABB F9D7 7ACE F9D8 7AEB F9D9 7AFD F9DA 7B12 F9DB 7B2D F9DC 7B3B F9DD 7B47 F9DE 7B4E F9DF 7B60 F9E0 7B6D F9E1 7B6F F9E2 7B72 F9E3 7B9E F9E4 FA56 F9E5 7BD7 F9E6 7BD9 F9E7 7C01 F9E8 7C31 F9E9 7C1E F9EA 7C20 F9EB 7C33 F9EC 7C36 F9ED 4264 F9EE 25DA1 F9EF 7C59 F9F0 7C6D F9F1 7C79 F9F2 7C8F F9F3 7C94 F9F4 7CA0 F9F5 7CBC F9F6 7CD5 F9F7 7CD9 F9F8 7CDD F9F9 7D07 F9FA 7D08 F9FB 7D13 F9FC 7D1D F9FD 7D23 F9FE 7D31 FAA1 7D41 FAA2 7D48 FAA3 7D53 FAA4 7D5C FAA5 7D7A FAA6 7D83 FAA7 7D8B FAA8 7DA0 FAA9 7DA6 FAAA 7DC2 FAAB 7DCC FAAC 7DD6 FAAD 7DE3 FAAE FA57 FAAF 7E28 FAB0 7E08 FAB1 7E11 FAB2 7E15 FAB3 FA59 FAB4 7E47 FAB5 7E52 FAB6 7E61 FAB7 7E8A FAB8 7E8D FAB9 7F47 FABA FA5A FABB 7F91 FABC 7F97 FABD 7FBF FABE 7FCE FABF 7FDB FAC0 7FDF FAC1 7FEC FAC2 7FEE FAC3 7FFA FAC4 FA5B FAC5 8014 FAC6 8026 FAC7 8035 FAC8 8037 FAC9 803C FACA 80CA FACB 80D7 FACC 80E0 FACD 80F3 FACE 8118 FACF 814A FAD0 8160 FAD1 8167 FAD2 8168 FAD3 816D FAD4 81BB FAD5 81CA FAD6 81CF FAD7 81D7 FAD8 FA5C FAD9 4453 FADA 445B FADB 8260 FADC 8274 FADD 26AFF FADE 828E FADF 82A1 FAE0 82A3 FAE1 82A4 FAE2 82A9 FAE3 82AE FAE4 82B7 FAE5 82BE FAE6 82BF FAE7 82C6 FAE8 82D5 FAE9 82FD FAEA 82FE FAEB 8300 FAEC 8301 FAED 8362 FAEE 8322 FAEF 832D FAF0 833A FAF1 8343 FAF2 8347 FAF3 8351 FAF4 8355 FAF5 837D FAF6 8386 FAF7 8392 FAF8 8398 FAF9 83A7 FAFA 83A9 FAFB 83BF FAFC 83C0 FAFD 83C7 FAFE 83CF FBA1 83D1 FBA2 83E1 FBA3 83EA FBA4 8401 FBA5 8406 FBA6 840A FBA7 FA5F FBA8 8448 FBA9 845F FBAA 8470 FBAB 8473 FBAC 8485 FBAD 849E FBAE 84AF FBAF 84B4 FBB0 84BA FBB1 84C0 FBB2 84C2 FBB3 26E40 FBB4 8532 FBB5 851E FBB6 8523 FBB7 852F FBB8 8559 FBB9 8564 FBBA FA1F FBBB 85AD FBBC 857A FBBD 858C FBBE 858F FBBF 85A2 FBC0 85B0 FBC1 85CB FBC2 85CE FBC3 85ED FBC4 8612 FBC5 85FF FBC6 8604 FBC7 8605 FBC8 8610 FBC9 270F4 FBCA 8618 FBCB 8629 FBCC 8638 FBCD 8657 FBCE 865B FBCF F936 FBD0 8662 FBD1 459D FBD2 866C FBD3 8675 FBD4 8698 FBD5 86B8 FBD6 86FA FBD7 86FC FBD8 86FD FBD9 870B FBDA 8771 FBDB 8787 FBDC 8788 FBDD 87AC FBDE 87AD FBDF 87B5 FBE0 45EA FBE1 87D6 FBE2 87EC FBE3 8806 FBE4 880A FBE5 8810 FBE6 8814 FBE7 881F FBE8 8898 FBE9 88AA FBEA 88CA FBEB 88CE FBEC 27684 FBED 88F5 FBEE 891C FBEF FA60 FBF0 8918 FBF1 8919 FBF2 891A FBF3 8927 FBF4 8930 FBF5 8932 FBF6 8939 FBF7 8940 FBF8 8994 FBF9 FA61 FBFA 89D4 FBFB 89E5 FBFC 89F6 FBFD 8A12 FBFE 8A15 FCA1 8A22 FCA2 8A37 FCA3 8A47 FCA4 8A4E FCA5 8A5D FCA6 8A61 FCA7 8A75 FCA8 8A79 FCA9 8AA7 FCAA 8AD0 FCAB 8ADF FCAC 8AF4 FCAD 8AF6 FCAE FA22 FCAF FA62 FCB0 FA63 FCB1 8B46 FCB2 8B54 FCB3 8B59 FCB4 8B69 FCB5 8B9D FCB6 8C49 FCB7 8C68 FCB8 FA64 FCB9 8CE1 FCBA 8CF4 FCBB 8CF8 FCBC 8CFE FCBD FA65 FCBE 8D12 FCBF 8D1B FCC0 8DAF FCC1 8DCE FCC2 8DD1 FCC3 8DD7 FCC4 8E20 FCC5 8E23 FCC6 8E3D FCC7 8E70 FCC8 8E7B FCC9 28277 FCCA 8EC0 FCCB 4844 FCCC 8EFA FCCD 8F1E FCCE 8F2D FCCF 8F36 FCD0 8F54 FCD1 283CD FCD2 8FA6 FCD3 8FB5 FCD4 8FE4 FCD5 8FE8 FCD6 8FEE FCD7 9008 FCD8 902D FCD9 FA67 FCDA 9088 FCDB 9095 FCDC 9097 FCDD 9099 FCDE 909B FCDF 90A2 FCE0 90B3 FCE1 90BE FCE2 90C4 FCE3 90C5 FCE4 90C7 FCE5 90D7 FCE6 90DD FCE7 90DE FCE8 90EF FCE9 90F4 FCEA FA26 FCEB 9114 FCEC 9115 FCED 9116 FCEE 9122 FCEF 9123 FCF0 9127 FCF1 912F FCF2 9131 FCF3 9134 FCF4 913D FCF5 9148 FCF6 915B FCF7 9183 FCF8 919E FCF9 91AC FCFA 91B1 FCFB 91BC FCFC 91D7 FCFD 91FB FCFE 91E4 FDA1 91E5 FDA2 91ED FDA3 91F1 FDA4 9207 FDA5 9210 FDA6 9238 FDA7 9239 FDA8 923A FDA9 923C FDAA 9240 FDAB 9243 FDAC 924F FDAD 9278 FDAE 9288 FDAF 92C2 FDB0 92CB FDB1 92CC FDB2 92D3 FDB3 92E0 FDB4 92FF FDB5 9304 FDB6 931F FDB7 9321 FDB8 9325 FDB9 9348 FDBA 9349 FDBB 934A FDBC 9364 FDBD 9365 FDBE 936A FDBF 9370 FDC0 939B FDC1 93A3 FDC2 93BA FDC3 93C6 FDC4 93DE FDC5 93DF FDC6 9404 FDC7 93FD FDC8 9433 FDC9 944A FDCA 9463 FDCB 946B FDCC 9471 FDCD 9472 FDCE 958E FDCF 959F FDD0 95A6 FDD1 95A9 FDD2 95AC FDD3 95B6 FDD4 95BD FDD5 95CB FDD6 95D0 FDD7 95D3 FDD8 49B0 FDD9 95DA FDDA 95DE FDDB 9658 FDDC 9684 FDDD F9DC FDDE 969D FDDF 96A4 FDE0 96A5 FDE1 96D2 FDE2 96DE FDE3 FA68 FDE4 96E9 FDE5 96EF FDE6 9733 FDE7 973B FDE8 974D FDE9 974E FDEA 974F FDEB 975A FDEC 976E FDED 9773 FDEE 9795 FDEF 97AE FDF0 97BA FDF1 97C1 FDF2 97C9 FDF3 97DE FDF4 97DB FDF5 97F4 FDF6 FA69 FDF7 980A FDF8 981E FDF9 982B FDFA 9830 FDFB FA6A FDFC 9852 FDFD 9853 FDFE 9856 FEA1 9857 FEA2 9859 FEA3 985A FEA4 F9D0 FEA5 9865 FEA6 986C FEA7 98BA FEA8 98C8 FEA9 98E7 FEAA 9958 FEAB 999E FEAC 9A02 FEAD 9A03 FEAE 9A24 FEAF 9A2D FEB0 9A2E FEB1 9A38 FEB2 9A4A FEB3 9A4E FEB4 9A52 FEB5 9AB6 FEB6 9AC1 FEB7 9AC3 FEB8 9ACE FEB9 9AD6 FEBA 9AF9 FEBB 9B02 FEBC 9B08 FEBD 9B20 FEBE 4C17 FEBF 9B2D FEC0 9B5E FEC1 9B79 FEC2 9B66 FEC3 9B72 FEC4 9B75 FEC5 9B84 FEC6 9B8A FEC7 9B8F FEC8 9B9E FEC9 9BA7 FECA 9BC1 FECB 9BCE FECC 9BE5 FECD 9BF8 FECE 9BFD FECF 9C00 FED0 9C23 FED1 9C41 FED2 9C4F FED3 9C50 FED4 9C53 FED5 9C63 FED6 9C65 FED7 9C77 FED8 9D1D FED9 9D1E FEDA 9D43 FEDB 9D47 FEDC 9D52 FEDD 9D63 FEDE 9D70 FEDF 9D7C FEE0 9D8A FEE1 9D96 FEE2 9DC0 FEE3 9DAC FEE4 9DBC FEE5 9DD7 FEE6 2A190 FEE7 9DE7 FEE8 9E07 FEE9 9E15 FEEA 9E7C FEEB 9E9E FEEC 9EA4 FEED 9EAC FEEE 9EAF FEEF 9EB4 FEF0 9EB5 FEF1 9EC3 FEF2 9ED1 FEF3 9F10 FEF4 9F39 FEF5 9F57 FEF6 9F90 FEF7 9F94 FEF8 9F97 FEF9 9FA2
119,169
11,414
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/datetimetester.py
"""Test date/time type. See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases """ from test.support import is_resource_enabled import itertools import bisect import copy import decimal import sys import os import pickle import random import struct import unittest from array import array from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod from test import support import datetime as datetime_module from datetime import MINYEAR, MAXYEAR from datetime import timedelta from datetime import tzinfo from datetime import time from datetime import timezone from datetime import date, datetime import time as _time # Needed by test_datetime import _strptime # pickle_loads = {pickle.loads, pickle._loads} pickle_choices = [(pickle, pickle, proto) for proto in range(pickle.HIGHEST_PROTOCOL + 1)] assert len(pickle_choices) == pickle.HIGHEST_PROTOCOL + 1 # An arbitrary collection of objects of non-datetime types, for testing # mixed-type comparisons. OTHERSTUFF = (10, 34.5, "abc", {}, [], ()) # XXX Copied from test_float. INF = float("inf") NAN = float("nan") ############################################################################# # module tests class TestModule(unittest.TestCase): def test_constants(self): datetime = datetime_module self.assertEqual(datetime.MINYEAR, 1) self.assertEqual(datetime.MAXYEAR, 9999) def test_name_cleanup(self): datetime = datetime_module names = set(name for name in dir(datetime) if not name.startswith('__') and not name.endswith('__')) allowed = set(['MAXYEAR', 'MINYEAR', 'date', 'datetime', 'datetime_CAPI', 'time', 'timedelta', 'timezone', 'tzinfo', 'sys']) self.assertEqual(names - allowed, set([])) # def test_divide_and_round(self): # if '_Fast' in self.__class__.__name__: # self.skipTest('Only run for Pure Python implementation') # dar = datetime_module._divide_and_round # self.assertEqual(dar(-10, -3), 3) # self.assertEqual(dar(5, -2), -2) # # four cases: (2 signs of a) x (2 signs of b) # self.assertEqual(dar(7, 3), 2) # self.assertEqual(dar(-7, 3), -2) # self.assertEqual(dar(7, -3), -2) # self.assertEqual(dar(-7, -3), 2) # # ties to even - eight cases: # # (2 signs of a) x (2 signs of b) x (even / odd quotient) # self.assertEqual(dar(10, 4), 2) # self.assertEqual(dar(-10, 4), -2) # self.assertEqual(dar(10, -4), -2) # self.assertEqual(dar(-10, -4), 2) # self.assertEqual(dar(6, 4), 2) # self.assertEqual(dar(-6, 4), -2) # self.assertEqual(dar(6, -4), -2) # self.assertEqual(dar(-6, -4), 2) ############################################################################# # tzinfo tests class FixedOffset(tzinfo): def __init__(self, offset, name, dstoffset=42): if isinstance(offset, int): offset = timedelta(minutes=offset) if isinstance(dstoffset, int): dstoffset = timedelta(minutes=dstoffset) self.__offset = offset self.__name = name self.__dstoffset = dstoffset def __repr__(self): return self.__name.lower() def utcoffset(self, dt): return self.__offset def tzname(self, dt): return self.__name def dst(self, dt): return self.__dstoffset class PicklableFixedOffset(FixedOffset): def __init__(self, offset=None, name=None, dstoffset=None): FixedOffset.__init__(self, offset, name, dstoffset) def __getstate__(self): return self.__dict__ class _TZInfo(tzinfo): def utcoffset(self, datetime_module): return random.random() class TestTZInfo(unittest.TestCase): def test_refcnt_crash_bug_22044(self): tz1 = _TZInfo() dt1 = datetime(2014, 7, 21, 11, 32, 3, 0, tz1) with self.assertRaises(TypeError): dt1.utcoffset() def test_non_abstractness(self): # In order to allow subclasses to get pickled, the C implementation # wasn't able to get away with having __init__ raise # NotImplementedError. useless = tzinfo() dt = datetime.max self.assertRaises(NotImplementedError, useless.tzname, dt) self.assertRaises(NotImplementedError, useless.utcoffset, dt) self.assertRaises(NotImplementedError, useless.dst, dt) def test_subclass_must_override(self): class NotEnough(tzinfo): def __init__(self, offset, name): self.__offset = offset self.__name = name self.assertTrue(issubclass(NotEnough, tzinfo)) ne = NotEnough(3, "NotByALongShot") self.assertIsInstance(ne, tzinfo) dt = datetime.now() self.assertRaises(NotImplementedError, ne.tzname, dt) self.assertRaises(NotImplementedError, ne.utcoffset, dt) self.assertRaises(NotImplementedError, ne.dst, dt) def test_normal(self): fo = FixedOffset(3, "Three") self.assertIsInstance(fo, tzinfo) for dt in datetime.now(), None: self.assertEqual(fo.utcoffset(dt), timedelta(minutes=3)) self.assertEqual(fo.tzname(dt), "Three") self.assertEqual(fo.dst(dt), timedelta(minutes=42)) def test_pickling_base(self): # There's no point to pickling tzinfo objects on their own (they # carry no data), but they need to be picklable anyway else # concrete subclasses can't be pickled. orig = tzinfo.__new__(tzinfo) self.assertIs(type(orig), tzinfo) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertIs(type(derived), tzinfo) def test_pickling_subclass(self): # Make sure we can pickle/unpickle an instance of a subclass. offset = timedelta(minutes=-300) for otype, args in [ (PicklableFixedOffset, (offset, 'cookie')), (timezone, (offset,)), (timezone, (offset, "EST"))]: orig = otype(*args) oname = orig.tzname(None) self.assertIsInstance(orig, tzinfo) self.assertIs(type(orig), otype) self.assertEqual(orig.utcoffset(None), offset) self.assertEqual(orig.tzname(None), oname) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertIsInstance(derived, tzinfo) self.assertIs(type(derived), otype) self.assertEqual(derived.utcoffset(None), offset) self.assertEqual(derived.tzname(None), oname) def test_issue23600(self): DSTDIFF = DSTOFFSET = timedelta(hours=1) class UKSummerTime(tzinfo): """Simple time zone which pretends to always be in summer time, since that's what shows the failure. """ def utcoffset(self, dt): return DSTOFFSET def dst(self, dt): return DSTDIFF def tzname(self, dt): return 'UKSummerTime' tz = UKSummerTime() u = datetime(2014, 4, 26, 12, 1, tzinfo=tz) t = tz.fromutc(u) self.assertEqual(t - t.utcoffset(), u) class TestTimeZone(unittest.TestCase): def setUp(self): self.ACDT = timezone(timedelta(hours=9.5), 'ACDT') self.EST = timezone(-timedelta(hours=5), 'EST') self.DT = datetime(2010, 1, 1) def test_str(self): for tz in [self.ACDT, self.EST, timezone.utc, timezone.min, timezone.max]: self.assertEqual(str(tz), tz.tzname(None)) def test_repr(self): datetime = datetime_module for tz in [self.ACDT, self.EST, timezone.utc, timezone.min, timezone.max]: # test round-trip tzrep = repr(tz) self.assertEqual(tz, eval(tzrep)) def test_class_members(self): limit = timedelta(hours=23, minutes=59) self.assertEqual(timezone.utc.utcoffset(None), ZERO) self.assertEqual(timezone.min.utcoffset(None), -limit) self.assertEqual(timezone.max.utcoffset(None), limit) def test_constructor(self): self.assertIs(timezone.utc, timezone(timedelta(0))) self.assertIsNot(timezone.utc, timezone(timedelta(0), 'UTC')) self.assertEqual(timezone.utc, timezone(timedelta(0), 'UTC')) # invalid offsets for invalid in [timedelta(microseconds=1), timedelta(1, 1), timedelta(seconds=1), timedelta(1), -timedelta(1)]: self.assertRaises(ValueError, timezone, invalid) self.assertRaises(ValueError, timezone, -invalid) with self.assertRaises(TypeError): timezone(None) with self.assertRaises(TypeError): timezone(42) with self.assertRaises(TypeError): timezone(ZERO, None) with self.assertRaises(TypeError): timezone(ZERO, 42) with self.assertRaises(TypeError): timezone(ZERO, 'ABC', 'extra') def test_inheritance(self): self.assertIsInstance(timezone.utc, tzinfo) self.assertIsInstance(self.EST, tzinfo) def test_utcoffset(self): dummy = self.DT for h in [0, 1.5, 12]: offset = h * HOUR self.assertEqual(offset, timezone(offset).utcoffset(dummy)) self.assertEqual(-offset, timezone(-offset).utcoffset(dummy)) with self.assertRaises(TypeError): self.EST.utcoffset('') with self.assertRaises(TypeError): self.EST.utcoffset(5) def test_dst(self): self.assertIsNone(timezone.utc.dst(self.DT)) with self.assertRaises(TypeError): self.EST.dst('') with self.assertRaises(TypeError): self.EST.dst(5) def test_tzname(self): self.assertEqual('UTC', timezone.utc.tzname(None)) self.assertEqual('UTC', timezone(ZERO).tzname(None)) self.assertEqual('UTC-05:00', timezone(-5 * HOUR).tzname(None)) self.assertEqual('UTC+09:30', timezone(9.5 * HOUR).tzname(None)) self.assertEqual('UTC-00:01', timezone(timedelta(minutes=-1)).tzname(None)) self.assertEqual('XYZ', timezone(-5 * HOUR, 'XYZ').tzname(None)) with self.assertRaises(TypeError): self.EST.tzname('') with self.assertRaises(TypeError): self.EST.tzname(5) def test_fromutc(self): with self.assertRaises(ValueError): timezone.utc.fromutc(self.DT) with self.assertRaises(TypeError): timezone.utc.fromutc('not datetime') for tz in [self.EST, self.ACDT, Eastern]: utctime = self.DT.replace(tzinfo=tz) local = tz.fromutc(utctime) self.assertEqual(local - utctime, tz.utcoffset(local)) self.assertEqual(local, self.DT.replace(tzinfo=timezone.utc)) def test_comparison(self): self.assertNotEqual(timezone(ZERO), timezone(HOUR)) self.assertEqual(timezone(HOUR), timezone(HOUR)) self.assertEqual(timezone(-5 * HOUR), timezone(-5 * HOUR, 'EST')) with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO) self.assertIn(timezone(ZERO), {timezone(ZERO)}) self.assertTrue(timezone(ZERO) != None) self.assertFalse(timezone(ZERO) == None) def test_aware_datetime(self): # test that timezone instances can be used by datetime t = datetime(1, 1, 1) for tz in [timezone.min, timezone.max, timezone.utc]: self.assertEqual(tz.tzname(t), t.replace(tzinfo=tz).tzname()) self.assertEqual(tz.utcoffset(t), t.replace(tzinfo=tz).utcoffset()) self.assertEqual(tz.dst(t), t.replace(tzinfo=tz).dst()) def test_pickle(self): for tz in self.ACDT, self.EST, timezone.min, timezone.max: for pickler, unpickler, proto in pickle_choices: tz_copy = unpickler.loads(pickler.dumps(tz, proto)) self.assertEqual(tz_copy, tz) tz = timezone.utc for pickler, unpickler, proto in pickle_choices: tz_copy = unpickler.loads(pickler.dumps(tz, proto)) self.assertIs(tz_copy, tz) def test_copy(self): for tz in self.ACDT, self.EST, timezone.min, timezone.max: tz_copy = copy.copy(tz) self.assertEqual(tz_copy, tz) tz = timezone.utc tz_copy = copy.copy(tz) self.assertIs(tz_copy, tz) def test_deepcopy(self): for tz in self.ACDT, self.EST, timezone.min, timezone.max: tz_copy = copy.deepcopy(tz) self.assertEqual(tz_copy, tz) tz = timezone.utc tz_copy = copy.deepcopy(tz) self.assertIs(tz_copy, tz) ############################################################################# # Base class for testing a particular aspect of timedelta, time, date and # datetime comparisons. class HarmlessMixedComparison: # Test that __eq__ and __ne__ don't complain for mixed-type comparisons. # Subclasses must define 'theclass', and theclass(1, 1, 1) must be a # legit constructor. def test_harmless_mixed_comparison(self): me = self.theclass(1, 1, 1) self.assertFalse(me == ()) self.assertTrue(me != ()) self.assertFalse(() == me) self.assertTrue(() != me) self.assertIn(me, [1, 20, [], me]) self.assertIn([], [me, 1, 20, []]) def test_harmful_mixed_comparison(self): me = self.theclass(1, 1, 1) self.assertRaises(TypeError, lambda: me < ()) self.assertRaises(TypeError, lambda: me <= ()) self.assertRaises(TypeError, lambda: me > ()) self.assertRaises(TypeError, lambda: me >= ()) self.assertRaises(TypeError, lambda: () < me) self.assertRaises(TypeError, lambda: () <= me) self.assertRaises(TypeError, lambda: () > me) self.assertRaises(TypeError, lambda: () >= me) ############################################################################# # timedelta tests class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase): theclass = timedelta def test_constructor(self): eq = self.assertEqual td = timedelta # Check keyword args to constructor eq(td(), td(weeks=0, days=0, hours=0, minutes=0, seconds=0, milliseconds=0, microseconds=0)) eq(td(1), td(days=1)) eq(td(0, 1), td(seconds=1)) eq(td(0, 0, 1), td(microseconds=1)) eq(td(weeks=1), td(days=7)) eq(td(days=1), td(hours=24)) eq(td(hours=1), td(minutes=60)) eq(td(minutes=1), td(seconds=60)) eq(td(seconds=1), td(milliseconds=1000)) eq(td(milliseconds=1), td(microseconds=1000)) # Check float args to constructor eq(td(weeks=1.0/7), td(days=1)) eq(td(days=1.0/24), td(hours=1)) eq(td(hours=1.0/60), td(minutes=1)) eq(td(minutes=1.0/60), td(seconds=1)) eq(td(seconds=0.001), td(milliseconds=1)) eq(td(milliseconds=0.001), td(microseconds=1)) def test_computations(self): eq = self.assertEqual td = timedelta a = td(7) # One week b = td(0, 60) # One minute c = td(0, 0, 1000) # One millisecond eq(a+b+c, td(7, 60, 1000)) eq(a-b, td(6, 24*3600 - 60)) eq(b.__rsub__(a), td(6, 24*3600 - 60)) eq(-a, td(-7)) eq(+a, td(7)) eq(-b, td(-1, 24*3600 - 60)) eq(-c, td(-1, 24*3600 - 1, 999000)) eq(abs(a), a) eq(abs(-a), a) eq(td(6, 24*3600), a) eq(td(0, 0, 60*1000000), b) eq(a*10, td(70)) eq(a*10, 10*a) eq(a*10, 10*a) eq(b*10, td(0, 600)) eq(10*b, td(0, 600)) eq(b*10, td(0, 600)) eq(c*10, td(0, 0, 10000)) eq(10*c, td(0, 0, 10000)) eq(c*10, td(0, 0, 10000)) eq(a*-1, -a) eq(b*-2, -b-b) eq(c*-2, -c+-c) eq(b*(60*24), (b*60)*24) eq(b*(60*24), (60*b)*24) eq(c*1000, td(0, 1)) eq(1000*c, td(0, 1)) eq(a//7, td(1)) eq(b//10, td(0, 6)) eq(c//1000, td(0, 0, 1)) eq(a//10, td(0, 7*24*360)) eq(a//3600000, td(0, 0, 7*24*1000)) eq(a/0.5, td(14)) eq(b/0.5, td(0, 120)) eq(a/7, td(1)) eq(b/10, td(0, 6)) eq(c/1000, td(0, 0, 1)) eq(a/10, td(0, 7*24*360)) eq(a/3600000, td(0, 0, 7*24*1000)) # Multiplication by float us = td(microseconds=1) eq((3*us) * 0.5, 2*us) eq((5*us) * 0.5, 2*us) eq(0.5 * (3*us), 2*us) eq(0.5 * (5*us), 2*us) eq((-3*us) * 0.5, -2*us) eq((-5*us) * 0.5, -2*us) # Issue #23521 eq(td(seconds=1) * 0.123456, td(microseconds=123456)) eq(td(seconds=1) * 0.6112295, td(microseconds=611229)) # Division by int and float eq((3*us) / 2, 2*us) eq((5*us) / 2, 2*us) eq((-3*us) / 2.0, -2*us) eq((-5*us) / 2.0, -2*us) eq((3*us) / -2, -2*us) eq((5*us) / -2, -2*us) eq((3*us) / -2.0, -2*us) eq((5*us) / -2.0, -2*us) for i in range(-10, 10): eq((i*us/3)//us, round(i/3)) for i in range(-10, 10): eq((i*us/-3)//us, round(i/-3)) # Issue #23521 eq(td(seconds=1) / (1 / 0.6112295), td(microseconds=611229)) # Issue #11576 eq(td(999999999, 86399, 999999) - td(999999999, 86399, 999998), td(0, 0, 1)) eq(td(999999999, 1, 1) - td(999999999, 1, 0), td(0, 0, 1)) def test_disallowed_computations(self): a = timedelta(42) # Add/sub ints or floats should be illegal for i in 1, 1.0: self.assertRaises(TypeError, lambda: a+i) self.assertRaises(TypeError, lambda: a-i) self.assertRaises(TypeError, lambda: i+a) self.assertRaises(TypeError, lambda: i-a) # Division of int by timedelta doesn't make sense. # Division by zero doesn't make sense. zero = 0 self.assertRaises(TypeError, lambda: zero // a) self.assertRaises(ZeroDivisionError, lambda: a // zero) self.assertRaises(ZeroDivisionError, lambda: a / zero) self.assertRaises(ZeroDivisionError, lambda: a / 0.0) self.assertRaises(TypeError, lambda: a / '') @support.requires_IEEE_754 def test_disallowed_special(self): a = timedelta(42) self.assertRaises(ValueError, a.__mul__, NAN) self.assertRaises(ValueError, a.__truediv__, NAN) def test_basic_attributes(self): days, seconds, us = 1, 7, 31 td = timedelta(days, seconds, us) self.assertEqual(td.days, days) self.assertEqual(td.seconds, seconds) self.assertEqual(td.microseconds, us) def test_total_seconds(self): td = timedelta(days=365) self.assertEqual(td.total_seconds(), 31536000.0) for total_seconds in [123456.789012, -123456.789012, 0.123456, 0, 1e6]: td = timedelta(seconds=total_seconds) self.assertEqual(td.total_seconds(), total_seconds) # Issue8644: Test that td.total_seconds() has the same # accuracy as td / timedelta(seconds=1). for ms in [-1, -2, -123]: td = timedelta(microseconds=ms) self.assertEqual(td.total_seconds(), td / timedelta(seconds=1)) def test_carries(self): t1 = timedelta(days=100, weeks=-7, hours=-24*(100-49), minutes=-3, seconds=12, microseconds=(3*60 - 12) * 1e6 + 1) t2 = timedelta(microseconds=1) self.assertEqual(t1, t2) def test_hash_equality(self): t1 = timedelta(days=100, weeks=-7, hours=-24*(100-49), minutes=-3, seconds=12, microseconds=(3*60 - 12) * 1000000) t2 = timedelta() self.assertEqual(hash(t1), hash(t2)) t1 += timedelta(weeks=7) t2 += timedelta(days=7*7) self.assertEqual(t1, t2) self.assertEqual(hash(t1), hash(t2)) d = {t1: 1} d[t2] = 2 self.assertEqual(len(d), 1) self.assertEqual(d[t1], 2) def test_pickling(self): args = 12, 34, 56 orig = timedelta(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.assertEqual(t1, t2) self.assertTrue(t1 <= t2) self.assertTrue(t1 >= t2) self.assertFalse(t1 != t2) self.assertFalse(t1 < t2) self.assertFalse(t1 > t2) for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): t2 = timedelta(*args) # this is larger than t1 self.assertTrue(t1 < t2) self.assertTrue(t2 > t1) self.assertTrue(t1 <= t2) self.assertTrue(t2 >= t1) self.assertTrue(t1 != t2) self.assertTrue(t2 != t1) self.assertFalse(t1 == t2) self.assertFalse(t2 == t1) self.assertFalse(t1 > t2) self.assertFalse(t2 < t1) self.assertFalse(t1 >= t2) self.assertFalse(t2 <= t1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) self.assertEqual(t1 != badarg, True) self.assertEqual(badarg == t1, False) self.assertEqual(badarg != t1, True) self.assertRaises(TypeError, lambda: t1 <= badarg) self.assertRaises(TypeError, lambda: t1 < badarg) self.assertRaises(TypeError, lambda: t1 > badarg) self.assertRaises(TypeError, lambda: t1 >= badarg) self.assertRaises(TypeError, lambda: badarg <= t1) self.assertRaises(TypeError, lambda: badarg < t1) self.assertRaises(TypeError, lambda: badarg > t1) self.assertRaises(TypeError, lambda: badarg >= t1) def test_str(self): td = timedelta eq = self.assertEqual eq(str(td(1)), "1 day, 0:00:00") eq(str(td(-1)), "-1 day, 0:00:00") eq(str(td(2)), "2 days, 0:00:00") eq(str(td(-2)), "-2 days, 0:00:00") eq(str(td(hours=12, minutes=58, seconds=59)), "12:58:59") eq(str(td(hours=2, minutes=3, seconds=4)), "2:03:04") eq(str(td(weeks=-30, hours=23, minutes=12, seconds=34)), "-210 days, 23:12:34") eq(str(td(milliseconds=1)), "0:00:00.001000") eq(str(td(microseconds=3)), "0:00:00.000003") eq(str(td(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999)), "999999999 days, 23:59:59.999999") def test_repr(self): name = 'datetime.' + self.theclass.__name__ self.assertEqual(repr(self.theclass(1)), "%s(1)" % name) self.assertEqual(repr(self.theclass(10, 2)), "%s(10, 2)" % name) self.assertEqual(repr(self.theclass(-10, 2, 400000)), "%s(-10, 2, 400000)" % name) def test_roundtrip(self): for td in (timedelta(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999), timedelta(days=-999999999), timedelta(days=-999999999, seconds=1), timedelta(days=1, seconds=2, microseconds=3)): # Verify td -> string -> td identity. s = repr(td) self.assertTrue(s.startswith('datetime.')) s = s[9:] td2 = eval(s) self.assertEqual(td, td2) # Verify identity via reconstructing from pieces. td2 = timedelta(td.days, td.seconds, td.microseconds) self.assertEqual(td, td2) def test_resolution_info(self): self.assertIsInstance(timedelta.min, timedelta) self.assertIsInstance(timedelta.max, timedelta) self.assertIsInstance(timedelta.resolution, timedelta) self.assertTrue(timedelta.max > timedelta.min) self.assertEqual(timedelta.min, timedelta(-999999999)) self.assertEqual(timedelta.max, timedelta(999999999, 24*3600-1, 1e6-1)) self.assertEqual(timedelta.resolution, timedelta(0, 0, 1)) def test_overflow(self): tiny = timedelta.resolution td = timedelta.min + tiny td -= tiny # no problem self.assertRaises(OverflowError, td.__sub__, tiny) self.assertRaises(OverflowError, td.__add__, -tiny) td = timedelta.max - tiny td += tiny # no problem self.assertRaises(OverflowError, td.__add__, tiny) self.assertRaises(OverflowError, td.__sub__, -tiny) self.assertRaises(OverflowError, lambda: -timedelta.max) day = timedelta(1) self.assertRaises(OverflowError, day.__mul__, 10**9) self.assertRaises(OverflowError, day.__mul__, 1e9) self.assertRaises(OverflowError, day.__truediv__, 1e-20) self.assertRaises(OverflowError, day.__truediv__, 1e-10) self.assertRaises(OverflowError, day.__truediv__, 9e-10) @support.requires_IEEE_754 def _test_overflow_special(self): day = timedelta(1) self.assertRaises(OverflowError, day.__mul__, INF) self.assertRaises(OverflowError, day.__mul__, -INF) def test_microsecond_rounding(self): td = timedelta eq = self.assertEqual # Single-field rounding. eq(td(milliseconds=0.4/1000), td(0)) # rounds to 0 eq(td(milliseconds=-0.4/1000), td(0)) # rounds to 0 eq(td(milliseconds=0.5/1000), td(microseconds=0)) eq(td(milliseconds=-0.5/1000), td(microseconds=-0)) eq(td(milliseconds=0.6/1000), td(microseconds=1)) eq(td(milliseconds=-0.6/1000), td(microseconds=-1)) eq(td(milliseconds=1.5/1000), td(microseconds=2)) eq(td(milliseconds=-1.5/1000), td(microseconds=-2)) eq(td(seconds=0.5/10**6), td(microseconds=0)) eq(td(seconds=-0.5/10**6), td(microseconds=-0)) eq(td(seconds=1/2**7), td(microseconds=7812)) eq(td(seconds=-1/2**7), td(microseconds=-7812)) # Rounding due to contributions from more than one field. us_per_hour = 3600e6 us_per_day = us_per_hour * 24 eq(td(days=.4/us_per_day), td(0)) eq(td(hours=.2/us_per_hour), td(0)) eq(td(days=.4/us_per_day, hours=.2/us_per_hour), td(microseconds=1)) eq(td(days=-.4/us_per_day), td(0)) eq(td(hours=-.2/us_per_hour), td(0)) eq(td(days=-.4/us_per_day, hours=-.2/us_per_hour), td(microseconds=-1)) # Test for a patch in Issue 8860 eq(td(microseconds=0.5), 0.5*td(microseconds=1.0)) eq(td(microseconds=0.5)//td.resolution, 0.5*td.resolution//td.resolution) def test_massive_normalization(self): td = timedelta(microseconds=-1) self.assertEqual((td.days, td.seconds, td.microseconds), (-1, 24*3600-1, 999999)) def test_bool(self): self.assertTrue(timedelta(1)) self.assertTrue(timedelta(0, 1)) self.assertTrue(timedelta(0, 0, 1)) self.assertTrue(timedelta(microseconds=1)) self.assertFalse(timedelta(0)) def test_subclass_timedelta(self): class T(timedelta): @staticmethod def from_td(td): return T(td.days, td.seconds, td.microseconds) def as_hours(self): sum = (self.days * 24 + self.seconds / 3600.0 + self.microseconds / 3600e6) return round(sum) t1 = T(days=1) self.assertIs(type(t1), T) self.assertEqual(t1.as_hours(), 24) t2 = T(days=-1, seconds=-3600) self.assertIs(type(t2), T) self.assertEqual(t2.as_hours(), -25) t3 = t1 + t2 self.assertIs(type(t3), timedelta) t4 = T.from_td(t3) self.assertIs(type(t4), T) self.assertEqual(t3.days, t4.days) self.assertEqual(t3.seconds, t4.seconds) self.assertEqual(t3.microseconds, t4.microseconds) self.assertEqual(str(t3), str(t4)) self.assertEqual(t4.as_hours(), -1) def test_division(self): t = timedelta(hours=1, minutes=24, seconds=19) second = timedelta(seconds=1) self.assertEqual(t / second, 5059.0) self.assertEqual(t // second, 5059) t = timedelta(minutes=2, seconds=30) minute = timedelta(minutes=1) self.assertEqual(t / minute, 2.5) self.assertEqual(t // minute, 2) zerotd = timedelta(0) self.assertRaises(ZeroDivisionError, truediv, t, zerotd) self.assertRaises(ZeroDivisionError, floordiv, t, zerotd) # self.assertRaises(TypeError, truediv, t, 2) # note: floor division of a timedelta by an integer *is* # currently permitted. def test_remainder(self): t = timedelta(minutes=2, seconds=30) minute = timedelta(minutes=1) r = t % minute self.assertEqual(r, timedelta(seconds=30)) t = timedelta(minutes=-2, seconds=30) r = t % minute self.assertEqual(r, timedelta(seconds=30)) zerotd = timedelta(0) self.assertRaises(ZeroDivisionError, mod, t, zerotd) self.assertRaises(TypeError, mod, t, 10) def test_divmod(self): t = timedelta(minutes=2, seconds=30) minute = timedelta(minutes=1) q, r = divmod(t, minute) self.assertEqual(q, 2) self.assertEqual(r, timedelta(seconds=30)) t = timedelta(minutes=-2, seconds=30) q, r = divmod(t, minute) self.assertEqual(q, -2) self.assertEqual(r, timedelta(seconds=30)) zerotd = timedelta(0) self.assertRaises(ZeroDivisionError, divmod, t, zerotd) self.assertRaises(TypeError, divmod, t, 10) def test_issue31293(self): # The interpreter shouldn't crash in case a timedelta is divided or # multiplied by a float with a bad as_integer_ratio() method. def get_bad_float(bad_ratio): class BadFloat(float): def as_integer_ratio(self): return bad_ratio return BadFloat() with self.assertRaises(TypeError): timedelta() / get_bad_float(1 << 1000) with self.assertRaises(TypeError): timedelta() * get_bad_float(1 << 1000) for bad_ratio in [(), (42, ), (1, 2, 3)]: with self.assertRaises(ValueError): timedelta() / get_bad_float(bad_ratio) with self.assertRaises(ValueError): timedelta() * get_bad_float(bad_ratio) def test_issue31752(self): # The interpreter shouldn't crash because divmod() returns negative # remainder. class BadInt(int): def __mul__(self, other): return Prod() def __rmul__(self, other): return Prod() def __floordiv__(self, other): return Prod() def __rfloordiv__(self, other): return Prod() class Prod: def __add__(self, other): return Sum() def __radd__(self, other): return Sum() class Sum(int): def __divmod__(self, other): return divmodresult for divmodresult in [None, (), (0, 1, 2), (0, -1)]: with self.subTest(divmodresult=divmodresult): # The following examples should not crash. try: timedelta(microseconds=BadInt(1)) except TypeError: pass try: timedelta(hours=BadInt(1)) except TypeError: pass try: timedelta(weeks=BadInt(1)) except (TypeError, ValueError): pass try: timedelta(1) * BadInt(1) except (TypeError, ValueError): pass try: BadInt(1) * timedelta(1) except TypeError: pass try: timedelta(1) // BadInt(1) except TypeError: pass ############################################################################# # date tests class TestDateOnly(unittest.TestCase): # Tests here won't pass if also run on datetime objects, so don't # subclass this to test datetimes too. def test_delta_non_days_ignored(self): dt = date(2000, 1, 2) delta = timedelta(days=1, hours=2, minutes=3, seconds=4, microseconds=5) days = timedelta(delta.days) self.assertEqual(days, timedelta(1)) dt2 = dt + delta self.assertEqual(dt2, dt + days) dt2 = delta + dt self.assertEqual(dt2, dt + days) dt2 = dt - delta self.assertEqual(dt2, dt - days) delta = -delta days = timedelta(delta.days) self.assertEqual(days, timedelta(-2)) dt2 = dt + delta self.assertEqual(dt2, dt + days) dt2 = delta + dt self.assertEqual(dt2, dt + days) dt2 = dt - delta self.assertEqual(dt2, dt - days) class SubclassDate(date): sub_var = 1 class TestDate(HarmlessMixedComparison, unittest.TestCase): # Tests here should pass for both dates and datetimes, except for a # few tests that TestDateTime overrides. theclass = date def test_basic_attributes(self): dt = self.theclass(2002, 3, 1) self.assertEqual(dt.year, 2002) self.assertEqual(dt.month, 3) self.assertEqual(dt.day, 1) def test_roundtrip(self): for dt in (self.theclass(1, 2, 3), self.theclass.today()): # Verify dt -> string -> date identity. s = repr(dt) self.assertTrue(s.startswith('datetime.')) s = s[9:] dt2 = eval(s) self.assertEqual(dt, dt2) # Verify identity via reconstructing from pieces. dt2 = self.theclass(dt.year, dt.month, dt.day) self.assertEqual(dt, dt2) def test_ordinal_conversions(self): # Check some fixed values. for y, m, d, n in [(1, 1, 1, 1), # calendar origin (1, 12, 31, 365), (2, 1, 1, 366), # first example from "Calendrical Calculations" (1945, 11, 12, 710347)]: d = self.theclass(y, m, d) self.assertEqual(n, d.toordinal()) fromord = self.theclass.fromordinal(n) self.assertEqual(d, fromord) if hasattr(fromord, "hour"): # if we're checking something fancier than a date, verify # the extra fields have been zeroed out self.assertEqual(fromord.hour, 0) self.assertEqual(fromord.minute, 0) self.assertEqual(fromord.second, 0) self.assertEqual(fromord.microsecond, 0) # Check first and last days of year spottily across the whole # range of years supported. for year in range(MINYEAR, MAXYEAR+1, 7): # Verify (year, 1, 1) -> ordinal -> y, m, d is identity. d = self.theclass(year, 1, 1) n = d.toordinal() d2 = self.theclass.fromordinal(n) self.assertEqual(d, d2) # Verify that moving back a day gets to the end of year-1. if year > 1: d = self.theclass.fromordinal(n-1) d2 = self.theclass(year-1, 12, 31) self.assertEqual(d, d2) self.assertEqual(d2.toordinal(), n-1) # Test every day in a leap-year and a non-leap year. dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for year, isleap in (2000, True), (2002, False): n = self.theclass(year, 1, 1).toordinal() for month, maxday in zip(range(1, 13), dim): if month == 2 and isleap: maxday += 1 for day in range(1, maxday+1): d = self.theclass(year, month, day) self.assertEqual(d.toordinal(), n) self.assertEqual(d, self.theclass.fromordinal(n)) n += 1 def test_extreme_ordinals(self): a = self.theclass.min a = self.theclass(a.year, a.month, a.day) # get rid of time parts aord = a.toordinal() b = a.fromordinal(aord) self.assertEqual(a, b) self.assertRaises(ValueError, lambda: a.fromordinal(aord - 1)) b = a + timedelta(days=1) self.assertEqual(b.toordinal(), aord + 1) self.assertEqual(b, self.theclass.fromordinal(aord + 1)) a = self.theclass.max a = self.theclass(a.year, a.month, a.day) # get rid of time parts aord = a.toordinal() b = a.fromordinal(aord) self.assertEqual(a, b) self.assertRaises(ValueError, lambda: a.fromordinal(aord + 1)) b = a - timedelta(days=1) self.assertEqual(b.toordinal(), aord - 1) self.assertEqual(b, self.theclass.fromordinal(aord - 1)) def test_bad_constructor_arguments(self): # bad years self.theclass(MINYEAR, 1, 1) # no exception self.theclass(MAXYEAR, 1, 1) # no exception self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) # bad months self.theclass(2000, 1, 1) # no exception self.theclass(2000, 12, 1) # no exception self.assertRaises(ValueError, self.theclass, 2000, 0, 1) self.assertRaises(ValueError, self.theclass, 2000, 13, 1) # bad days self.theclass(2000, 2, 29) # no exception self.theclass(2004, 2, 29) # no exception self.theclass(2400, 2, 29) # no exception self.assertRaises(ValueError, self.theclass, 2000, 2, 30) self.assertRaises(ValueError, self.theclass, 2001, 2, 29) self.assertRaises(ValueError, self.theclass, 2100, 2, 29) self.assertRaises(ValueError, self.theclass, 1900, 2, 29) self.assertRaises(ValueError, self.theclass, 2000, 1, 0) self.assertRaises(ValueError, self.theclass, 2000, 1, 32) def test_hash_equality(self): d = self.theclass(2000, 12, 31) # same thing e = self.theclass(2000, 12, 31) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) d = self.theclass(2001, 1, 1) # same thing e = self.theclass(2001, 1, 1) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) def test_computations(self): a = self.theclass(2002, 1, 31) b = self.theclass(1956, 1, 31) c = self.theclass(2001,2,1) diff = a-b self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) self.assertEqual(diff.seconds, 0) self.assertEqual(diff.microseconds, 0) day = timedelta(1) week = timedelta(7) a = self.theclass(2002, 3, 2) self.assertEqual(a + day, self.theclass(2002, 3, 3)) self.assertEqual(day + a, self.theclass(2002, 3, 3)) self.assertEqual(a - day, self.theclass(2002, 3, 1)) self.assertEqual(-day + a, self.theclass(2002, 3, 1)) self.assertEqual(a + week, self.theclass(2002, 3, 9)) self.assertEqual(a - week, self.theclass(2002, 2, 23)) self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) self.assertEqual((a + week) - a, week) self.assertEqual((a + day) - a, day) self.assertEqual((a - week) - a, -week) self.assertEqual((a - day) - a, -day) self.assertEqual(a - (a + week), -week) self.assertEqual(a - (a + day), -day) self.assertEqual(a - (a - week), week) self.assertEqual(a - (a - day), day) self.assertEqual(c - (c - day), day) # Add/sub ints or floats should be illegal for i in 1, 1.0: self.assertRaises(TypeError, lambda: a+i) self.assertRaises(TypeError, lambda: a-i) self.assertRaises(TypeError, lambda: i+a) self.assertRaises(TypeError, lambda: i-a) # delta - date is senseless. self.assertRaises(TypeError, lambda: day - a) # mixing date and (delta or date) via * or // is senseless self.assertRaises(TypeError, lambda: day * a) self.assertRaises(TypeError, lambda: a * day) self.assertRaises(TypeError, lambda: day // a) self.assertRaises(TypeError, lambda: a // day) self.assertRaises(TypeError, lambda: a * a) self.assertRaises(TypeError, lambda: a // a) # date + date is senseless self.assertRaises(TypeError, lambda: a + a) def test_overflow(self): tiny = self.theclass.resolution for delta in [tiny, timedelta(1), timedelta(2)]: dt = self.theclass.min + delta dt -= delta # no problem self.assertRaises(OverflowError, dt.__sub__, delta) self.assertRaises(OverflowError, dt.__add__, -delta) dt = self.theclass.max - delta dt += delta # no problem self.assertRaises(OverflowError, dt.__add__, delta) self.assertRaises(OverflowError, dt.__sub__, -delta) def test_fromtimestamp(self): import time # Try an arbitrary fixed value. year, month, day = 1999, 9, 19 ts = time.mktime((year, month, day, 0, 0, 0, 0, 0, -1)) d = self.theclass.fromtimestamp(ts) self.assertEqual(d.year, year) self.assertEqual(d.month, month) self.assertEqual(d.day, day) def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should # exempt such platforms (provided they return reasonable # results!). for insane in -1e200, 1e200: self.assertRaises(OverflowError, self.theclass.fromtimestamp, insane) def test_today(self): import time # We claim that today() is like fromtimestamp(time.time()), so # prove it. for dummy in range(3): today = self.theclass.today() ts = time.time() todayagain = self.theclass.fromtimestamp(ts) if today == todayagain: break # There are several legit reasons that could fail: # 1. It recently became midnight, between the today() and the # time() calls. # 2. The platform time() has such fine resolution that we'll # never get the same value twice. # 3. The platform time() has poor resolution, and we just # happened to call today() right before a resolution quantum # boundary. # 4. The system clock got fiddled between calls. # In any case, wait a little while and try again. time.sleep(0.1) # It worked or it didn't. If it didn't, assume it's reason #2, and # let the test pass if they're within half a second of each other. if today != todayagain: self.assertAlmostEqual(todayagain, today, delta=timedelta(seconds=0.5)) def test_weekday(self): for i in range(7): # March 4, 2002 is a Monday self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) # January 2, 1956 is a Monday self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) def test_isocalendar(self): # Check examples from # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm for i in range(7): d = self.theclass(2003, 12, 22+i) self.assertEqual(d.isocalendar(), (2003, 52, i+1)) d = self.theclass(2003, 12, 29) + timedelta(i) self.assertEqual(d.isocalendar(), (2004, 1, i+1)) d = self.theclass(2004, 1, 5+i) self.assertEqual(d.isocalendar(), (2004, 2, i+1)) d = self.theclass(2009, 12, 21+i) self.assertEqual(d.isocalendar(), (2009, 52, i+1)) d = self.theclass(2009, 12, 28) + timedelta(i) self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) self.assertEqual(d.isocalendar(), (2010, 1, i+1)) def test_iso_long_years(self): # Calculate long ISO years and compare to table from # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm ISO_LONG_YEARS_TABLE = """ 4 32 60 88 9 37 65 93 15 43 71 99 20 48 76 26 54 82 105 133 161 189 111 139 167 195 116 144 172 122 150 178 128 156 184 201 229 257 285 207 235 263 291 212 240 268 296 218 246 274 224 252 280 303 331 359 387 308 336 364 392 314 342 370 398 320 348 376 325 353 381 """ iso_long_years = sorted(map(int, ISO_LONG_YEARS_TABLE.split())) L = [] for i in range(400): d = self.theclass(2000+i, 12, 31) d1 = self.theclass(1600+i, 12, 31) self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) if d.isocalendar()[1] == 53: L.append(i) self.assertEqual(L, iso_long_years) def test_isoformat(self): t = self.theclass(2, 3, 2) self.assertEqual(t.isoformat(), "0002-03-02") def test_ctime(self): t = self.theclass(2002, 3, 2) self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") def test_strftime(self): t = self.theclass(2005, 3, 2) self.assertEqual(t.strftime("m:%m d:%d y:%y"), "m:03 d:02 y:05") self.assertEqual(t.strftime(""), "") # SF bug #761337 self.assertEqual(t.strftime('x'*1000), 'x'*1000) # SF bug #1556784 self.assertRaises(TypeError, t.strftime) # needs an arg self.assertRaises(TypeError, t.strftime, "one", "two") # too many args self.assertRaises(TypeError, t.strftime, 42) # arg wrong type # test that unicode input is allowed (issue 2782) self.assertEqual(t.strftime("%m"), "03") # A naive object replaces %z and %Z w/ empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") #make sure that invalid format specifiers are handled correctly #self.assertRaises(ValueError, t.strftime, "%e") #self.assertRaises(ValueError, t.strftime, "%") #self.assertRaises(ValueError, t.strftime, "%#") #oh well, some systems just ignore those invalid ones. #at least, exercise them to make sure that no crashes #are generated for f in ["%e", "%", "%#"]: try: t.strftime(f) except ValueError: pass #check that this standard extension works t.strftime("%f") def test_format(self): dt = self.theclass(2007, 9, 10) self.assertEqual(dt.__format__(''), str(dt)) with self.assertRaisesRegex(TypeError, 'must be str, not int'): dt.__format__(123) # check that a derived class's __str__() gets called class A(self.theclass): def __str__(self): return 'A' a = A(2007, 9, 10) self.assertEqual(a.__format__(''), 'A') # check that a derived class's strftime gets called class B(self.theclass): def strftime(self, format_spec): return 'B' b = B(2007, 9, 10) self.assertEqual(b.__format__(''), str(dt)) for fmt in ["m:%m d:%d y:%y", "m:%m d:%d y:%y H:%H M:%M S:%S", "%z %Z", ]: self.assertEqual(dt.__format__(fmt), dt.strftime(fmt)) self.assertEqual(a.__format__(fmt), dt.strftime(fmt)) self.assertEqual(b.__format__(fmt), 'B') def test_resolution_info(self): # XXX: Should min and max respect subclassing? if issubclass(self.theclass, datetime): expected_class = datetime else: expected_class = date self.assertIsInstance(self.theclass.min, expected_class) self.assertIsInstance(self.theclass.max, expected_class) self.assertIsInstance(self.theclass.resolution, timedelta) self.assertTrue(self.theclass.max > self.theclass.min) def test_extreme_timedelta(self): big = self.theclass.max - self.theclass.min # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds # n == 315537897599999999 ~= 2**58.13 justasbig = timedelta(0, 0, n) self.assertEqual(big, justasbig) self.assertEqual(self.theclass.min + big, self.theclass.max) self.assertEqual(self.theclass.max - big, self.theclass.min) def test_timetuple(self): for i in range(7): # January 2, 1956 is a Monday (0) d = self.theclass(1956, 1, 2+i) t = d.timetuple() self.assertEqual(t, (1956, 1, 2+i, 0, 0, 0, i, 2+i, -1)) # February 1, 1956 is a Wednesday (2) d = self.theclass(1956, 2, 1+i) t = d.timetuple() self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) # March 1, 1956 is a Thursday (3), and is the 31+29+1 = 61st day # of the year. d = self.theclass(1956, 3, 1+i) t = d.timetuple() self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) self.assertEqual(t.tm_year, 1956) self.assertEqual(t.tm_mon, 3) self.assertEqual(t.tm_mday, 1+i) self.assertEqual(t.tm_hour, 0) self.assertEqual(t.tm_min, 0) self.assertEqual(t.tm_sec, 0) self.assertEqual(t.tm_wday, (3+i)%7) self.assertEqual(t.tm_yday, 61+i) self.assertEqual(t.tm_isdst, -1) def test_pickling(self): args = 6, 7, 23 orig = self.theclass(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) def test_compat_unpickle(self): tests = [ b"cdatetime\ndate\n(S'\\x07\\xdf\\x0b\\x1b'\ntR.", b'cdatetime\ndate\n(U\x04\x07\xdf\x0b\x1btR.', b'\x80\x02cdatetime\ndate\nU\x04\x07\xdf\x0b\x1b\x85R.', ] args = 2015, 11, 27 expected = self.theclass(*args) for data in tests: for loads in pickle_loads: derived = loads(data, encoding='latin1') self.assertEqual(derived, expected) def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.assertEqual(t1, t2) self.assertTrue(t1 <= t2) self.assertTrue(t1 >= t2) self.assertFalse(t1 != t2) self.assertFalse(t1 < t2) self.assertFalse(t1 > t2) for args in (3, 3, 3), (2, 4, 4), (2, 3, 5): t2 = self.theclass(*args) # this is larger than t1 self.assertTrue(t1 < t2) self.assertTrue(t2 > t1) self.assertTrue(t1 <= t2) self.assertTrue(t2 >= t1) self.assertTrue(t1 != t2) self.assertTrue(t2 != t1) self.assertFalse(t1 == t2) self.assertFalse(t2 == t1) self.assertFalse(t1 > t2) self.assertFalse(t2 < t1) self.assertFalse(t1 >= t2) self.assertFalse(t2 <= t1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) self.assertEqual(t1 != badarg, True) self.assertEqual(badarg == t1, False) self.assertEqual(badarg != t1, True) self.assertRaises(TypeError, lambda: t1 < badarg) self.assertRaises(TypeError, lambda: t1 > badarg) self.assertRaises(TypeError, lambda: t1 >= badarg) self.assertRaises(TypeError, lambda: badarg <= t1) self.assertRaises(TypeError, lambda: badarg < t1) self.assertRaises(TypeError, lambda: badarg > t1) self.assertRaises(TypeError, lambda: badarg >= t1) def test_mixed_compare(self): our = self.theclass(2000, 4, 5) # Our class can be compared for equality to other classes self.assertEqual(our == 1, False) self.assertEqual(1 == our, False) self.assertEqual(our != 1, True) self.assertEqual(1 != our, True) # But the ordering is undefined self.assertRaises(TypeError, lambda: our < 1) self.assertRaises(TypeError, lambda: 1 < our) # Repeat those tests with a different class class SomeClass: pass their = SomeClass() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertRaises(TypeError, lambda: our < their) self.assertRaises(TypeError, lambda: their < our) # However, if the other class explicitly defines ordering # relative to our class, it is allowed to do so class LargerThanAnything: def __lt__(self, other): return False def __le__(self, other): return isinstance(other, LargerThanAnything) def __eq__(self, other): return isinstance(other, LargerThanAnything) def __gt__(self, other): return not isinstance(other, LargerThanAnything) def __ge__(self, other): return True their = LargerThanAnything() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertEqual(our < their, True) self.assertEqual(their < our, False) def test_bool(self): # All dates are considered true. self.assertTrue(self.theclass.min) self.assertTrue(self.theclass.max) def test_strftime_y2k(self): for y in (1, 49, 70, 99, 100, 999, 1000, 1970): d = self.theclass(y, 1, 1) # Issue 13305: For years < 1000, the value is not always # padded to 4 digits across platforms. The C standard # assumes year >= 1900, so it does not specify the number # of digits. if d.strftime("%Y") != '%04d' % y: # Year 42 returns '42', not padded self.assertEqual(d.strftime("%Y"), '%d' % y) # '0042' is obtained anyway self.assertEqual(d.strftime("%4Y"), '%04d' % y) def test_replace(self): cls = self.theclass args = [1, 2, 3] base = cls(*args) self.assertEqual(base, base.replace()) i = 0 for name, newval in (("year", 2), ("month", 3), ("day", 4)): newargs = args[:] newargs[i] = newval expected = cls(*newargs) got = base.replace(**{name: newval}) self.assertEqual(expected, got) i += 1 # Out of bounds. base = cls(2000, 2, 29) self.assertRaises(ValueError, base.replace, year=2001) def test_subclass_replace(self): class DateSubclass(self.theclass): pass dt = DateSubclass(2012, 1, 1) self.assertIs(type(dt.replace(year=2013)), DateSubclass) def test_subclass_date(self): class C(self.theclass): theAnswer = 42 def __new__(cls, *args, **kws): temp = kws.copy() extra = temp.pop('extra') result = self.theclass.__new__(cls, *args, **temp) result.extra = extra return result def newmeth(self, start): return start + self.year + self.month args = 2003, 4, 14 dt1 = self.theclass(*args) dt2 = C(*args, **{'extra': 7}) self.assertEqual(dt2.__class__, C) self.assertEqual(dt2.theAnswer, 42) self.assertEqual(dt2.extra, 7) self.assertEqual(dt1.toordinal(), dt2.toordinal()) self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) def test_pickling_subclass_date(self): args = 6, 7, 23 orig = SubclassDate(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) def test_backdoor_resistance(self): # For fast unpickling, the constructor accepts a pickle byte string. # This is a low-overhead backdoor. A user can (by intent or # mistake) pass a string directly, which (if it's the right length) # will get treated like a pickle, and bypass the normal sanity # checks in the constructor. This can create insane objects. # The constructor doesn't want to burn the time to validate all # fields, but does check the month field. This stops, e.g., # datetime.datetime('1995-03-25') from yielding an insane object. base = b'1995-03-25' if not issubclass(self.theclass, datetime): base = base[:4] for month_byte in b'9', b'\0', b'\r', b'\xff': self.assertRaises(TypeError, self.theclass, base[:2] + month_byte + base[3:]) if issubclass(self.theclass, datetime): # Good bytes, but bad tzinfo: with self.assertRaisesRegex(TypeError, '^bad tzinfo state arg$'): self.theclass(bytes([1] * len(base)), 'EST') for ord_byte in range(1, 13): # This shouldn't blow up because of the month byte alone. If # the implementation changes to do more-careful checking, it may # blow up because other fields are insane. self.theclass(base[:2] + bytes([ord_byte]) + base[3:]) ############################################################################# # datetime tests class SubclassDatetime(datetime): sub_var = 1 class TestDateTime(TestDate): theclass = datetime def test_basic_attributes(self): dt = self.theclass(2002, 3, 1, 12, 0) self.assertEqual(dt.year, 2002) self.assertEqual(dt.month, 3) self.assertEqual(dt.day, 1) self.assertEqual(dt.hour, 12) self.assertEqual(dt.minute, 0) self.assertEqual(dt.second, 0) self.assertEqual(dt.microsecond, 0) def test_basic_attributes_nonzero(self): # Make sure all attributes are non-zero so bugs in # bit-shifting access show up. dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000) self.assertEqual(dt.year, 2002) self.assertEqual(dt.month, 3) self.assertEqual(dt.day, 1) self.assertEqual(dt.hour, 12) self.assertEqual(dt.minute, 59) self.assertEqual(dt.second, 59) self.assertEqual(dt.microsecond, 8000) def test_roundtrip(self): for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7), self.theclass.now()): # Verify dt -> string -> datetime identity. s = repr(dt) self.assertTrue(s.startswith('datetime.')) s = s[9:] dt2 = eval(s) self.assertEqual(dt, dt2) # Verify identity via reconstructing from pieces. dt2 = self.theclass(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond) self.assertEqual(dt, dt2) def test_isoformat(self): t = self.theclass(1, 2, 3, 4, 5, 1, 123) self.assertEqual(t.isoformat(), "0001-02-03T04:05:01.000123") self.assertEqual(t.isoformat('T'), "0001-02-03T04:05:01.000123") self.assertEqual(t.isoformat(' '), "0001-02-03 04:05:01.000123") self.assertEqual(t.isoformat('\x00'), "0001-02-03\x0004:05:01.000123") self.assertEqual(t.isoformat(timespec='hours'), "0001-02-03T04") self.assertEqual(t.isoformat(timespec='minutes'), "0001-02-03T04:05") self.assertEqual(t.isoformat(timespec='seconds'), "0001-02-03T04:05:01") self.assertEqual(t.isoformat(timespec='milliseconds'), "0001-02-03T04:05:01.000") self.assertEqual(t.isoformat(timespec='microseconds'), "0001-02-03T04:05:01.000123") self.assertEqual(t.isoformat(timespec='auto'), "0001-02-03T04:05:01.000123") self.assertEqual(t.isoformat(sep=' ', timespec='minutes'), "0001-02-03 04:05") self.assertRaises(ValueError, t.isoformat, timespec='foo') # str is ISO format with the separator forced to a blank. self.assertEqual(str(t), "0001-02-03 04:05:01.000123") t = self.theclass(1, 2, 3, 4, 5, 1, 999500, tzinfo=timezone.utc) self.assertEqual(t.isoformat(timespec='milliseconds'), "0001-02-03T04:05:01.999+00:00") t = self.theclass(1, 2, 3, 4, 5, 1, 999500) self.assertEqual(t.isoformat(timespec='milliseconds'), "0001-02-03T04:05:01.999") t = self.theclass(1, 2, 3, 4, 5, 1) self.assertEqual(t.isoformat(timespec='auto'), "0001-02-03T04:05:01") self.assertEqual(t.isoformat(timespec='milliseconds'), "0001-02-03T04:05:01.000") self.assertEqual(t.isoformat(timespec='microseconds'), "0001-02-03T04:05:01.000000") t = self.theclass(2, 3, 2) self.assertEqual(t.isoformat(), "0002-03-02T00:00:00") self.assertEqual(t.isoformat('T'), "0002-03-02T00:00:00") self.assertEqual(t.isoformat(' '), "0002-03-02 00:00:00") # str is ISO format with the separator forced to a blank. self.assertEqual(str(t), "0002-03-02 00:00:00") # ISO format with timezone tz = FixedOffset(timedelta(seconds=16), 'XXX') t = self.theclass(2, 3, 2, tzinfo=tz) self.assertEqual(t.isoformat(), "0002-03-02T00:00:00+00:00:16") def test_format(self): dt = self.theclass(2007, 9, 10, 4, 5, 1, 123) self.assertEqual(dt.__format__(''), str(dt)) with self.assertRaisesRegex(TypeError, 'must be str, not int'): dt.__format__(123) # check that a derived class's __str__() gets called class A(self.theclass): def __str__(self): return 'A' a = A(2007, 9, 10, 4, 5, 1, 123) self.assertEqual(a.__format__(''), 'A') # check that a derived class's strftime gets called class B(self.theclass): def strftime(self, format_spec): return 'B' b = B(2007, 9, 10, 4, 5, 1, 123) self.assertEqual(b.__format__(''), str(dt)) for fmt in ["m:%m d:%d y:%y", "m:%m d:%d y:%y H:%H M:%M S:%S", "%z %Z", ]: self.assertEqual(dt.__format__(fmt), dt.strftime(fmt)) self.assertEqual(a.__format__(fmt), dt.strftime(fmt)) self.assertEqual(b.__format__(fmt), 'B') def test_more_ctime(self): # Test fields that TestDate doesn't touch. import time t = self.theclass(2002, 3, 2, 18, 3, 5, 123) self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") # Oops! The next line fails on Win2K under MSVC 6, so it's commented # out. The difference is that t.ctime() produces " 2" for the day, # but platform ctime() produces "02" for the day. According to # C99, t.ctime() is correct here. # self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) # So test a case where that difference doesn't matter. t = self.theclass(2002, 3, 22, 18, 3, 5, 123) self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) def test_tz_independent_comparing(self): dt1 = self.theclass(2002, 3, 1, 9, 0, 0) dt2 = self.theclass(2002, 3, 1, 10, 0, 0) dt3 = self.theclass(2002, 3, 1, 9, 0, 0) self.assertEqual(dt1, dt3) self.assertTrue(dt2 > dt3) # Make sure comparison doesn't forget microseconds, and isn't done # via comparing a float timestamp (an IEEE double doesn't have enough # precision to span microsecond resolution across years 1 through 9999, # so comparing via timestamp necessarily calls some distinct values # equal). dt1 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999998) us = timedelta(microseconds=1) dt2 = dt1 + us self.assertEqual(dt2 - dt1, us) self.assertTrue(dt1 < dt2) def test_strftime_with_bad_tzname_replace(self): # verify ok if tzinfo.tzname().replace() returns a non-string class MyTzInfo(FixedOffset): def tzname(self, dt): class MyStr(str): def replace(self, *args): return None return MyStr('name') t = self.theclass(2005, 3, 2, 0, 0, 0, 0, MyTzInfo(3, 'name')) self.assertRaises(TypeError, t.strftime, '%Z') def test_bad_constructor_arguments(self): # bad years self.theclass(MINYEAR, 1, 1) # no exception self.theclass(MAXYEAR, 1, 1) # no exception self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) # bad months self.theclass(2000, 1, 1) # no exception self.theclass(2000, 12, 1) # no exception self.assertRaises(ValueError, self.theclass, 2000, 0, 1) self.assertRaises(ValueError, self.theclass, 2000, 13, 1) # bad days self.theclass(2000, 2, 29) # no exception self.theclass(2004, 2, 29) # no exception self.theclass(2400, 2, 29) # no exception self.assertRaises(ValueError, self.theclass, 2000, 2, 30) self.assertRaises(ValueError, self.theclass, 2001, 2, 29) self.assertRaises(ValueError, self.theclass, 2100, 2, 29) self.assertRaises(ValueError, self.theclass, 1900, 2, 29) self.assertRaises(ValueError, self.theclass, 2000, 1, 0) self.assertRaises(ValueError, self.theclass, 2000, 1, 32) # bad hours self.theclass(2000, 1, 31, 0) # no exception self.theclass(2000, 1, 31, 23) # no exception self.assertRaises(ValueError, self.theclass, 2000, 1, 31, -1) self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 24) # bad minutes self.theclass(2000, 1, 31, 23, 0) # no exception self.theclass(2000, 1, 31, 23, 59) # no exception self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, -1) self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 60) # bad seconds self.theclass(2000, 1, 31, 23, 59, 0) # no exception self.theclass(2000, 1, 31, 23, 59, 59) # no exception self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, -1) self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, 60) # bad microseconds self.theclass(2000, 1, 31, 23, 59, 59, 0) # no exception self.theclass(2000, 1, 31, 23, 59, 59, 999999) # no exception self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, 59, -1) self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, 59, 1000000) # bad fold self.assertRaises(ValueError, self.theclass, 2000, 1, 31, fold=-1) self.assertRaises(ValueError, self.theclass, 2000, 1, 31, fold=2) # Positional fold: self.assertRaises(TypeError, self.theclass, 2000, 1, 31, 23, 59, 59, 0, None, 1) def test_hash_equality(self): d = self.theclass(2000, 12, 31, 23, 30, 17) e = self.theclass(2000, 12, 31, 23, 30, 17) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) d = self.theclass(2001, 1, 1, 0, 5, 17) e = self.theclass(2001, 1, 1, 0, 5, 17) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) def test_computations(self): a = self.theclass(2002, 1, 31) b = self.theclass(1956, 1, 31) diff = a-b self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) self.assertEqual(diff.seconds, 0) self.assertEqual(diff.microseconds, 0) a = self.theclass(2002, 3, 2, 17, 6) millisec = timedelta(0, 0, 1000) hour = timedelta(0, 3600) day = timedelta(1) week = timedelta(7) self.assertEqual(a + hour, self.theclass(2002, 3, 2, 18, 6)) self.assertEqual(hour + a, self.theclass(2002, 3, 2, 18, 6)) self.assertEqual(a + 10*hour, self.theclass(2002, 3, 3, 3, 6)) self.assertEqual(a - hour, self.theclass(2002, 3, 2, 16, 6)) self.assertEqual(-hour + a, self.theclass(2002, 3, 2, 16, 6)) self.assertEqual(a - hour, a + -hour) self.assertEqual(a - 20*hour, self.theclass(2002, 3, 1, 21, 6)) self.assertEqual(a + day, self.theclass(2002, 3, 3, 17, 6)) self.assertEqual(a - day, self.theclass(2002, 3, 1, 17, 6)) self.assertEqual(a + week, self.theclass(2002, 3, 9, 17, 6)) self.assertEqual(a - week, self.theclass(2002, 2, 23, 17, 6)) self.assertEqual(a + 52*week, self.theclass(2003, 3, 1, 17, 6)) self.assertEqual(a - 52*week, self.theclass(2001, 3, 3, 17, 6)) self.assertEqual((a + week) - a, week) self.assertEqual((a + day) - a, day) self.assertEqual((a + hour) - a, hour) self.assertEqual((a + millisec) - a, millisec) self.assertEqual((a - week) - a, -week) self.assertEqual((a - day) - a, -day) self.assertEqual((a - hour) - a, -hour) self.assertEqual((a - millisec) - a, -millisec) self.assertEqual(a - (a + week), -week) self.assertEqual(a - (a + day), -day) self.assertEqual(a - (a + hour), -hour) self.assertEqual(a - (a + millisec), -millisec) self.assertEqual(a - (a - week), week) self.assertEqual(a - (a - day), day) self.assertEqual(a - (a - hour), hour) self.assertEqual(a - (a - millisec), millisec) self.assertEqual(a + (week + day + hour + millisec), self.theclass(2002, 3, 10, 18, 6, 0, 1000)) self.assertEqual(a + (week + day + hour + millisec), (((a + week) + day) + hour) + millisec) self.assertEqual(a - (week + day + hour + millisec), self.theclass(2002, 2, 22, 16, 5, 59, 999000)) self.assertEqual(a - (week + day + hour + millisec), (((a - week) - day) - hour) - millisec) # Add/sub ints or floats should be illegal for i in 1, 1.0: self.assertRaises(TypeError, lambda: a+i) self.assertRaises(TypeError, lambda: a-i) self.assertRaises(TypeError, lambda: i+a) self.assertRaises(TypeError, lambda: i-a) # delta - datetime is senseless. self.assertRaises(TypeError, lambda: day - a) # mixing datetime and (delta or datetime) via * or // is senseless self.assertRaises(TypeError, lambda: day * a) self.assertRaises(TypeError, lambda: a * day) self.assertRaises(TypeError, lambda: day // a) self.assertRaises(TypeError, lambda: a // day) self.assertRaises(TypeError, lambda: a * a) self.assertRaises(TypeError, lambda: a // a) # datetime + datetime is senseless self.assertRaises(TypeError, lambda: a + a) def test_pickling(self): args = 6, 7, 23, 20, 59, 1, 64**2 orig = self.theclass(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) def test_more_pickling(self): a = self.theclass(2003, 2, 7, 16, 48, 37, 444116) for proto in range(pickle.HIGHEST_PROTOCOL + 1): s = pickle.dumps(a, proto) b = pickle.loads(s) self.assertEqual(b.year, 2003) self.assertEqual(b.month, 2) self.assertEqual(b.day, 7) def test_pickling_subclass_datetime(self): args = 6, 7, 23, 20, 59, 1, 64**2 orig = SubclassDatetime(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) def test_compat_unpickle(self): tests = [ b'cdatetime\ndatetime\n(' b"S'\\x07\\xdf\\x0b\\x1b\\x14;\\x01\\x00\\x10\\x00'\ntR.", b'cdatetime\ndatetime\n(' b'U\n\x07\xdf\x0b\x1b\x14;\x01\x00\x10\x00tR.', b'\x80\x02cdatetime\ndatetime\n' b'U\n\x07\xdf\x0b\x1b\x14;\x01\x00\x10\x00\x85R.', ] args = 2015, 11, 27, 20, 59, 1, 64**2 expected = self.theclass(*args) for data in tests: for loads in pickle_loads: derived = loads(data, encoding='latin1') self.assertEqual(derived, expected) def test_more_compare(self): # The test_compare() inherited from TestDate covers the error cases. # We just want to test lexicographic ordering on the members datetime # has that date lacks. args = [2000, 11, 29, 20, 58, 16, 999998] t1 = self.theclass(*args) t2 = self.theclass(*args) self.assertEqual(t1, t2) self.assertTrue(t1 <= t2) self.assertTrue(t1 >= t2) self.assertFalse(t1 != t2) self.assertFalse(t1 < t2) self.assertFalse(t1 > t2) for i in range(len(args)): newargs = args[:] newargs[i] = args[i] + 1 t2 = self.theclass(*newargs) # this is larger than t1 self.assertTrue(t1 < t2) self.assertTrue(t2 > t1) self.assertTrue(t1 <= t2) self.assertTrue(t2 >= t1) self.assertTrue(t1 != t2) self.assertTrue(t2 != t1) self.assertFalse(t1 == t2) self.assertFalse(t2 == t1) self.assertFalse(t1 > t2) self.assertFalse(t2 < t1) self.assertFalse(t1 >= t2) self.assertFalse(t2 <= t1) # A helper for timestamp constructor tests. def verify_field_equality(self, expected, got): self.assertEqual(expected.tm_year, got.year) self.assertEqual(expected.tm_mon, got.month) self.assertEqual(expected.tm_mday, got.day) self.assertEqual(expected.tm_hour, got.hour) self.assertEqual(expected.tm_min, got.minute) self.assertEqual(expected.tm_sec, got.second) def test_fromtimestamp(self): import time ts = time.time() expected = time.localtime(ts) got = self.theclass.fromtimestamp(ts) self.verify_field_equality(expected, got) def test_utcfromtimestamp(self): import time ts = time.time() expected = time.gmtime(ts) got = self.theclass.utcfromtimestamp(ts) self.verify_field_equality(expected, got) # Run with US-style DST rules: DST begins 2 a.m. on second Sunday in # March (M3.2.0) and ends 2 a.m. on first Sunday in November (M11.1.0). @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_timestamp_naive(self): t = self.theclass(1970, 1, 1) self.assertEqual(t.timestamp(), 18000.0) t = self.theclass(1970, 1, 1, 1, 2, 3, 4) self.assertEqual(t.timestamp(), 18000.0 + 3600 + 2*60 + 3 + 4*1e-6) # Missing hour t0 = self.theclass(2012, 3, 11, 2, 30) t1 = t0.replace(fold=1) self.assertEqual(self.theclass.fromtimestamp(t1.timestamp()), t0 - timedelta(hours=1)) self.assertEqual(self.theclass.fromtimestamp(t0.timestamp()), t1 + timedelta(hours=1)) # Ambiguous hour defaults to DST t = self.theclass(2012, 11, 4, 1, 30) self.assertEqual(self.theclass.fromtimestamp(t.timestamp()), t) # Timestamp may raise an overflow error on some platforms # XXX: Do we care to support the first and last year? for t in [self.theclass(2,1,1), self.theclass(9998,12,12)]: try: s = t.timestamp() except OverflowError: pass else: self.assertEqual(self.theclass.fromtimestamp(s), t) def test_timestamp_aware(self): t = self.theclass(1970, 1, 1, tzinfo=timezone.utc) self.assertEqual(t.timestamp(), 0.0) t = self.theclass(1970, 1, 1, 1, 2, 3, 4, tzinfo=timezone.utc) self.assertEqual(t.timestamp(), 3600 + 2*60 + 3 + 4*1e-6) t = self.theclass(1970, 1, 1, 1, 2, 3, 4, tzinfo=timezone(timedelta(hours=-5), 'EST')) self.assertEqual(t.timestamp(), 18000 + 3600 + 2*60 + 3 + 4*1e-6) @support.run_with_tz('MSK-03') # Something east of Greenwich def test_microsecond_rounding(self): for fts in [self.theclass.fromtimestamp, self.theclass.utcfromtimestamp]: zero = fts(0) self.assertEqual(zero.second, 0) self.assertEqual(zero.microsecond, 0) one = fts(1e-6) try: minus_one = fts(-1e-6) except OSError: # localtime(-1) and gmtime(-1) is not supported on Windows pass else: self.assertEqual(minus_one.second, 59) self.assertEqual(minus_one.microsecond, 999999) t = fts(-1e-8) self.assertEqual(t, zero) t = fts(-9e-7) self.assertEqual(t, minus_one) t = fts(-1e-7) self.assertEqual(t, zero) t = fts(-1/2**7) self.assertEqual(t.second, 59) self.assertEqual(t.microsecond, 992188) t = fts(1e-7) self.assertEqual(t, zero) t = fts(9e-7) self.assertEqual(t, one) t = fts(0.99999949) self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 999999) t = fts(0.9999999) self.assertEqual(t.second, 1) self.assertEqual(t.microsecond, 0) t = fts(1/2**7) self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 7812) def test_timestamp_limits(self): # minimum timestamp min_dt = self.theclass.min.replace(tzinfo=timezone.utc) min_ts = min_dt.timestamp() try: # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), min_dt) except (OverflowError, OSError) as exc: # the date 0001-01-01 doesn't fit into 32-bit time_t, # or platform doesn't support such very old date self.skipTest(str(exc)) # maximum timestamp: set seconds to zero to avoid rounding issues max_dt = self.theclass.max.replace(tzinfo=timezone.utc, second=0, microsecond=0) max_ts = max_dt.timestamp() # date 9999-12-31 23:59:00+00:00: timestamp 253402300740 self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc), max_dt) # number of seconds greater than 1 year: make sure that the new date # is not valid in datetime.datetime limits delta = 3600 * 24 * 400 # too small ts = min_ts - delta # converting a Python int to C time_t can raise a OverflowError, # especially on 32-bit platforms. with self.assertRaises((ValueError, OverflowError)): self.theclass.fromtimestamp(ts) with self.assertRaises((ValueError, OverflowError)): self.theclass.utcfromtimestamp(ts) # too big ts = max_dt.timestamp() + delta with self.assertRaises((ValueError, OverflowError)): self.theclass.fromtimestamp(ts) with self.assertRaises((ValueError, OverflowError)): self.theclass.utcfromtimestamp(ts) def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should # exempt such platforms (provided they return reasonable # results!). for insane in -1e200, 1e200: self.assertRaises(OverflowError, self.theclass.fromtimestamp, insane) def test_insane_utcfromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should # exempt such platforms (provided they return reasonable # results!). for insane in -1e200, 1e200: self.assertRaises(OverflowError, self.theclass.utcfromtimestamp, insane) @unittest.skipIf(sys.platform == "win32", "Windows doesn't accept negative timestamps") def test_negative_float_fromtimestamp(self): # The result is tz-dependent; at least test that this doesn't # fail (like it did before bug 1646728 was fixed). self.theclass.fromtimestamp(-1.05) @unittest.skipIf(sys.platform == "win32", "Windows doesn't accept negative timestamps") def test_negative_float_utcfromtimestamp(self): d = self.theclass.utcfromtimestamp(-1.05) self.assertEqual(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000)) def test_utcnow(self): import time # Call it a success if utcnow() and utcfromtimestamp() are within # a second of each other. tolerance = timedelta(seconds=1) for dummy in range(3): from_now = self.theclass.utcnow() from_timestamp = self.theclass.utcfromtimestamp(time.time()) if abs(from_timestamp - from_now) <= tolerance: break # Else try again a few times. self.assertLessEqual(abs(from_timestamp - from_now), tolerance) def test_strptime(self): string = '2004-12-01 13:02:47.197' format = '%Y-%m-%d %H:%M:%S.%f' expected = _strptime._strptime_datetime(self.theclass, string, format) got = self.theclass.strptime(string, format) self.assertEqual(expected, got) self.assertIs(type(expected), self.theclass) self.assertIs(type(got), self.theclass) strptime = self.theclass.strptime self.assertEqual(strptime("+0002", "%z").utcoffset(), 2 * MINUTE) self.assertEqual(strptime("-0002", "%z").utcoffset(), -2 * MINUTE) # Only local timezone and UTC are supported for tzseconds, tzname in ((0, 'UTC'), (0, 'GMT'), (-_time.timezone, _time.tzname[0])): if tzseconds < 0: sign = '-' seconds = -tzseconds else: sign ='+' seconds = tzseconds hours, minutes = divmod(seconds//60, 60) dtstr = "{}{:02d}{:02d} {}".format(sign, hours, minutes, tzname) dt = strptime(dtstr, "%z %Z") self.assertEqual(dt.utcoffset(), timedelta(seconds=tzseconds)) self.assertEqual(dt.tzname(), tzname) # Can produce inconsistent datetime dtstr, fmt = "+1234 UTC", "%z %Z" dt = strptime(dtstr, fmt) self.assertEqual(dt.utcoffset(), 12 * HOUR + 34 * MINUTE) self.assertEqual(dt.tzname(), 'UTC') # yet will roundtrip self.assertEqual(dt.strftime(fmt), dtstr) # Produce naive datetime if no %z is provided self.assertEqual(strptime("UTC", "%Z").tzinfo, None) with self.assertRaises(ValueError): strptime("-2400", "%z") with self.assertRaises(ValueError): strptime("-000", "%z") def test_more_timetuple(self): # This tests fields beyond those tested by the TestDate.test_timetuple. t = self.theclass(2004, 12, 31, 6, 22, 33) self.assertEqual(t.timetuple(), (2004, 12, 31, 6, 22, 33, 4, 366, -1)) self.assertEqual(t.timetuple(), (t.year, t.month, t.day, t.hour, t.minute, t.second, t.weekday(), t.toordinal() - date(t.year, 1, 1).toordinal() + 1, -1)) tt = t.timetuple() self.assertEqual(tt.tm_year, t.year) self.assertEqual(tt.tm_mon, t.month) self.assertEqual(tt.tm_mday, t.day) self.assertEqual(tt.tm_hour, t.hour) self.assertEqual(tt.tm_min, t.minute) self.assertEqual(tt.tm_sec, t.second) self.assertEqual(tt.tm_wday, t.weekday()) self.assertEqual(tt.tm_yday, t.toordinal() - date(t.year, 1, 1).toordinal() + 1) self.assertEqual(tt.tm_isdst, -1) def test_more_strftime(self): # This tests fields beyond those tested by the TestDate.test_strftime. t = self.theclass(2004, 12, 31, 6, 22, 33, 47) self.assertEqual(t.strftime("%m %d %y %f %S %M %H %j"), "12 31 04 000047 33 22 06 366") def test_extract(self): dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234) self.assertEqual(dt.date(), date(2002, 3, 4)) self.assertEqual(dt.time(), time(18, 45, 3, 1234)) def test_combine(self): d = date(2002, 3, 4) t = time(18, 45, 3, 1234) expected = self.theclass(2002, 3, 4, 18, 45, 3, 1234) combine = self.theclass.combine dt = combine(d, t) self.assertEqual(dt, expected) dt = combine(time=t, date=d) self.assertEqual(dt, expected) self.assertEqual(d, dt.date()) self.assertEqual(t, dt.time()) self.assertEqual(dt, combine(dt.date(), dt.time())) self.assertRaises(TypeError, combine) # need an arg self.assertRaises(TypeError, combine, d) # need two args self.assertRaises(TypeError, combine, t, d) # args reversed self.assertRaises(TypeError, combine, d, t, 1) # wrong tzinfo type self.assertRaises(TypeError, combine, d, t, 1, 2) # too many args self.assertRaises(TypeError, combine, "date", "time") # wrong types self.assertRaises(TypeError, combine, d, "time") # wrong type self.assertRaises(TypeError, combine, "date", t) # wrong type # tzinfo= argument dt = combine(d, t, timezone.utc) self.assertIs(dt.tzinfo, timezone.utc) dt = combine(d, t, tzinfo=timezone.utc) self.assertIs(dt.tzinfo, timezone.utc) t = time() dt = combine(dt, t) self.assertEqual(dt.date(), d) self.assertEqual(dt.time(), t) def test_replace(self): cls = self.theclass args = [1, 2, 3, 4, 5, 6, 7] base = cls(*args) self.assertEqual(base, base.replace()) i = 0 for name, newval in (("year", 2), ("month", 3), ("day", 4), ("hour", 5), ("minute", 6), ("second", 7), ("microsecond", 8)): newargs = args[:] newargs[i] = newval expected = cls(*newargs) got = base.replace(**{name: newval}) self.assertEqual(expected, got) i += 1 # Out of bounds. base = cls(2000, 2, 29) self.assertRaises(ValueError, base.replace, year=2001) @support.run_with_tz('EDT4') def test_astimezone(self): dt = self.theclass.now() f = FixedOffset(44, "0044") dt_utc = dt.replace(tzinfo=timezone(timedelta(hours=-4), 'EDT')) self.assertEqual(dt.astimezone(), dt_utc) # naive self.assertRaises(TypeError, dt.astimezone, f, f) # too many args self.assertRaises(TypeError, dt.astimezone, dt) # arg wrong type dt_f = dt.replace(tzinfo=f) + timedelta(hours=4, minutes=44) self.assertEqual(dt.astimezone(f), dt_f) # naive self.assertEqual(dt.astimezone(tz=f), dt_f) # naive class Bogus(tzinfo): def utcoffset(self, dt): return None def dst(self, dt): return timedelta(0) bog = Bogus() self.assertRaises(ValueError, dt.astimezone, bog) # naive self.assertEqual(dt.replace(tzinfo=bog).astimezone(f), dt_f) class AlsoBogus(tzinfo): def utcoffset(self, dt): return timedelta(0) def dst(self, dt): return None alsobog = AlsoBogus() self.assertRaises(ValueError, dt.astimezone, alsobog) # also naive class Broken(tzinfo): def utcoffset(self, dt): return 1 def dst(self, dt): return 1 broken = Broken() dt_broken = dt.replace(tzinfo=broken) with self.assertRaises(TypeError): dt_broken.astimezone() def test_subclass_datetime(self): class C(self.theclass): theAnswer = 42 def __new__(cls, *args, **kws): temp = kws.copy() extra = temp.pop('extra') result = self.theclass.__new__(cls, *args, **temp) result.extra = extra return result def newmeth(self, start): return start + self.year + self.month + self.second args = 2003, 4, 14, 12, 13, 41 dt1 = self.theclass(*args) dt2 = C(*args, **{'extra': 7}) self.assertEqual(dt2.__class__, C) self.assertEqual(dt2.theAnswer, 42) self.assertEqual(dt2.extra, 7) self.assertEqual(dt1.toordinal(), dt2.toordinal()) self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month + dt1.second - 7) class TestSubclassDateTime(TestDateTime): theclass = SubclassDatetime # Override tests not designed for subclass @unittest.skip('not appropriate for subclasses') def test_roundtrip(self): pass class SubclassTime(time): sub_var = 1 class TestTime(HarmlessMixedComparison, unittest.TestCase): theclass = time def test_basic_attributes(self): t = self.theclass(12, 0) self.assertEqual(t.hour, 12) self.assertEqual(t.minute, 0) self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 0) def test_basic_attributes_nonzero(self): # Make sure all attributes are non-zero so bugs in # bit-shifting access show up. t = self.theclass(12, 59, 59, 8000) self.assertEqual(t.hour, 12) self.assertEqual(t.minute, 59) self.assertEqual(t.second, 59) self.assertEqual(t.microsecond, 8000) def test_roundtrip(self): t = self.theclass(1, 2, 3, 4) # Verify t -> string -> time identity. s = repr(t) self.assertTrue(s.startswith('datetime.')) s = s[9:] t2 = eval(s) self.assertEqual(t, t2) # Verify identity via reconstructing from pieces. t2 = self.theclass(t.hour, t.minute, t.second, t.microsecond) self.assertEqual(t, t2) def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.assertEqual(t1, t2) self.assertTrue(t1 <= t2) self.assertTrue(t1 >= t2) self.assertFalse(t1 != t2) self.assertFalse(t1 < t2) self.assertFalse(t1 > t2) for i in range(len(args)): newargs = args[:] newargs[i] = args[i] + 1 t2 = self.theclass(*newargs) # this is larger than t1 self.assertTrue(t1 < t2) self.assertTrue(t2 > t1) self.assertTrue(t1 <= t2) self.assertTrue(t2 >= t1) self.assertTrue(t1 != t2) self.assertTrue(t2 != t1) self.assertFalse(t1 == t2) self.assertFalse(t2 == t1) self.assertFalse(t1 > t2) self.assertFalse(t2 < t1) self.assertFalse(t1 >= t2) self.assertFalse(t2 <= t1) for badarg in OTHERSTUFF: self.assertEqual(t1 == badarg, False) self.assertEqual(t1 != badarg, True) self.assertEqual(badarg == t1, False) self.assertEqual(badarg != t1, True) self.assertRaises(TypeError, lambda: t1 <= badarg) self.assertRaises(TypeError, lambda: t1 < badarg) self.assertRaises(TypeError, lambda: t1 > badarg) self.assertRaises(TypeError, lambda: t1 >= badarg) self.assertRaises(TypeError, lambda: badarg <= t1) self.assertRaises(TypeError, lambda: badarg < t1) self.assertRaises(TypeError, lambda: badarg > t1) self.assertRaises(TypeError, lambda: badarg >= t1) def test_bad_constructor_arguments(self): # bad hours self.theclass(0, 0) # no exception self.theclass(23, 0) # no exception self.assertRaises(ValueError, self.theclass, -1, 0) self.assertRaises(ValueError, self.theclass, 24, 0) # bad minutes self.theclass(23, 0) # no exception self.theclass(23, 59) # no exception self.assertRaises(ValueError, self.theclass, 23, -1) self.assertRaises(ValueError, self.theclass, 23, 60) # bad seconds self.theclass(23, 59, 0) # no exception self.theclass(23, 59, 59) # no exception self.assertRaises(ValueError, self.theclass, 23, 59, -1) self.assertRaises(ValueError, self.theclass, 23, 59, 60) # bad microseconds self.theclass(23, 59, 59, 0) # no exception self.theclass(23, 59, 59, 999999) # no exception self.assertRaises(ValueError, self.theclass, 23, 59, 59, -1) self.assertRaises(ValueError, self.theclass, 23, 59, 59, 1000000) def test_hash_equality(self): d = self.theclass(23, 30, 17) e = self.theclass(23, 30, 17) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) d = self.theclass(0, 5, 17) e = self.theclass(0, 5, 17) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) def test_isoformat(self): t = self.theclass(4, 5, 1, 123) self.assertEqual(t.isoformat(), "04:05:01.000123") self.assertEqual(t.isoformat(), str(t)) t = self.theclass() self.assertEqual(t.isoformat(), "00:00:00") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=1) self.assertEqual(t.isoformat(), "00:00:00.000001") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=10) self.assertEqual(t.isoformat(), "00:00:00.000010") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=100) self.assertEqual(t.isoformat(), "00:00:00.000100") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=1000) self.assertEqual(t.isoformat(), "00:00:00.001000") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=10000) self.assertEqual(t.isoformat(), "00:00:00.010000") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(microsecond=100000) self.assertEqual(t.isoformat(), "00:00:00.100000") self.assertEqual(t.isoformat(), str(t)) t = self.theclass(hour=12, minute=34, second=56, microsecond=123456) self.assertEqual(t.isoformat(timespec='hours'), "12") self.assertEqual(t.isoformat(timespec='minutes'), "12:34") self.assertEqual(t.isoformat(timespec='seconds'), "12:34:56") self.assertEqual(t.isoformat(timespec='milliseconds'), "12:34:56.123") self.assertEqual(t.isoformat(timespec='microseconds'), "12:34:56.123456") self.assertEqual(t.isoformat(timespec='auto'), "12:34:56.123456") self.assertRaises(ValueError, t.isoformat, timespec='monkey') t = self.theclass(hour=12, minute=34, second=56, microsecond=999500) self.assertEqual(t.isoformat(timespec='milliseconds'), "12:34:56.999") t = self.theclass(hour=12, minute=34, second=56, microsecond=0) self.assertEqual(t.isoformat(timespec='milliseconds'), "12:34:56.000") self.assertEqual(t.isoformat(timespec='microseconds'), "12:34:56.000000") self.assertEqual(t.isoformat(timespec='auto'), "12:34:56") def test_1653736(self): # verify it doesn't accept extra keyword arguments t = self.theclass(second=1) self.assertRaises(TypeError, t.isoformat, foo=3) def test_strftime(self): t = self.theclass(1, 2, 3, 4) self.assertEqual(t.strftime('%H %M %S %f'), "01 02 03 000004") # A naive object replaces %z and %Z with empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") def test_format(self): t = self.theclass(1, 2, 3, 4) self.assertEqual(t.__format__(''), str(t)) with self.assertRaisesRegex(TypeError, 'must be str, not int'): t.__format__(123) # check that a derived class's __str__() gets called class A(self.theclass): def __str__(self): return 'A' a = A(1, 2, 3, 4) self.assertEqual(a.__format__(''), 'A') # check that a derived class's strftime gets called class B(self.theclass): def strftime(self, format_spec): return 'B' b = B(1, 2, 3, 4) self.assertEqual(b.__format__(''), str(t)) for fmt in ['%H %M %S', ]: self.assertEqual(t.__format__(fmt), t.strftime(fmt)) self.assertEqual(a.__format__(fmt), t.strftime(fmt)) self.assertEqual(b.__format__(fmt), 'B') def test_str(self): self.assertEqual(str(self.theclass(1, 2, 3, 4)), "01:02:03.000004") self.assertEqual(str(self.theclass(10, 2, 3, 4000)), "10:02:03.004000") self.assertEqual(str(self.theclass(0, 2, 3, 400000)), "00:02:03.400000") self.assertEqual(str(self.theclass(12, 2, 3, 0)), "12:02:03") self.assertEqual(str(self.theclass(23, 15, 0, 0)), "23:15:00") def test_repr(self): name = 'datetime.' + self.theclass.__name__ self.assertEqual(repr(self.theclass(1, 2, 3, 4)), "%s(1, 2, 3, 4)" % name) self.assertEqual(repr(self.theclass(10, 2, 3, 4000)), "%s(10, 2, 3, 4000)" % name) self.assertEqual(repr(self.theclass(0, 2, 3, 400000)), "%s(0, 2, 3, 400000)" % name) self.assertEqual(repr(self.theclass(12, 2, 3, 0)), "%s(12, 2, 3)" % name) self.assertEqual(repr(self.theclass(23, 15, 0, 0)), "%s(23, 15)" % name) def test_resolution_info(self): self.assertIsInstance(self.theclass.min, self.theclass) self.assertIsInstance(self.theclass.max, self.theclass) self.assertIsInstance(self.theclass.resolution, timedelta) self.assertTrue(self.theclass.max > self.theclass.min) def test_pickling(self): args = 20, 59, 16, 64**2 orig = self.theclass(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) def test_pickling_subclass_time(self): args = 20, 59, 16, 64**2 orig = SubclassTime(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) def test_compat_unpickle(self): tests = [ b"cdatetime\ntime\n(S'\\x14;\\x10\\x00\\x10\\x00'\ntR.", b'cdatetime\ntime\n(U\x06\x14;\x10\x00\x10\x00tR.', b'\x80\x02cdatetime\ntime\nU\x06\x14;\x10\x00\x10\x00\x85R.', ] args = 20, 59, 16, 64**2 expected = self.theclass(*args) for data in tests: for loads in pickle_loads: derived = loads(data, encoding='latin1') self.assertEqual(derived, expected) def test_bool(self): # time is always True. cls = self.theclass self.assertTrue(cls(1)) self.assertTrue(cls(0, 1)) self.assertTrue(cls(0, 0, 1)) self.assertTrue(cls(0, 0, 0, 1)) self.assertTrue(cls(0)) self.assertTrue(cls()) def test_replace(self): cls = self.theclass args = [1, 2, 3, 4] base = cls(*args) self.assertEqual(base, base.replace()) i = 0 for name, newval in (("hour", 5), ("minute", 6), ("second", 7), ("microsecond", 8)): newargs = args[:] newargs[i] = newval expected = cls(*newargs) got = base.replace(**{name: newval}) self.assertEqual(expected, got) i += 1 # Out of bounds. base = cls(1) self.assertRaises(ValueError, base.replace, hour=24) self.assertRaises(ValueError, base.replace, minute=-1) self.assertRaises(ValueError, base.replace, second=100) self.assertRaises(ValueError, base.replace, microsecond=1000000) def test_subclass_replace(self): class TimeSubclass(self.theclass): pass ctime = TimeSubclass(12, 30) self.assertIs(type(ctime.replace(hour=10)), TimeSubclass) def test_subclass_time(self): class C(self.theclass): theAnswer = 42 def __new__(cls, *args, **kws): temp = kws.copy() extra = temp.pop('extra') result = self.theclass.__new__(cls, *args, **temp) result.extra = extra return result def newmeth(self, start): return start + self.hour + self.second args = 4, 5, 6 dt1 = self.theclass(*args) dt2 = C(*args, **{'extra': 7}) self.assertEqual(dt2.__class__, C) self.assertEqual(dt2.theAnswer, 42) self.assertEqual(dt2.extra, 7) self.assertEqual(dt1.isoformat(), dt2.isoformat()) self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) def test_backdoor_resistance(self): # see TestDate.test_backdoor_resistance(). base = '2:59.0' for hour_byte in ' ', '9', chr(24), '\xff': self.assertRaises(TypeError, self.theclass, hour_byte + base[1:]) # Good bytes, but bad tzinfo: with self.assertRaisesRegex(TypeError, '^bad tzinfo state arg$'): self.theclass(bytes([1] * len(base)), 'EST') # A mixin for classes with a tzinfo= argument. Subclasses must define # theclass as a class attribute, and theclass(1, 1, 1, tzinfo=whatever) # must be legit (which is true for time and datetime). class TZInfoBase: def test_argument_passing(self): cls = self.theclass # A datetime passes itself on, a time passes None. class introspective(tzinfo): def tzname(self, dt): return dt and "real" or "none" def utcoffset(self, dt): return timedelta(minutes = dt and 42 or -42) dst = utcoffset obj = cls(1, 2, 3, tzinfo=introspective()) expected = cls is time and "none" or "real" self.assertEqual(obj.tzname(), expected) expected = timedelta(minutes=(cls is time and -42 or 42)) self.assertEqual(obj.utcoffset(), expected) self.assertEqual(obj.dst(), expected) def test_bad_tzinfo_classes(self): cls = self.theclass self.assertRaises(TypeError, cls, 1, 1, 1, tzinfo=12) class NiceTry(object): def __init__(self): pass def utcoffset(self, dt): pass self.assertRaises(TypeError, cls, 1, 1, 1, tzinfo=NiceTry) class BetterTry(tzinfo): def __init__(self): pass def utcoffset(self, dt): pass b = BetterTry() t = cls(1, 1, 1, tzinfo=b) self.assertIs(t.tzinfo, b) def test_utc_offset_out_of_bounds(self): class Edgy(tzinfo): def __init__(self, offset): self.offset = timedelta(minutes=offset) def utcoffset(self, dt): return self.offset cls = self.theclass for offset, legit in ((-1440, False), (-1439, True), (1439, True), (1440, False)): if cls is time: t = cls(1, 2, 3, tzinfo=Edgy(offset)) elif cls is datetime: t = cls(6, 6, 6, 1, 2, 3, tzinfo=Edgy(offset)) else: assert 0, "impossible" if legit: aofs = abs(offset) h, m = divmod(aofs, 60) tag = "%c%02d:%02d" % (offset < 0 and '-' or '+', h, m) if isinstance(t, datetime): t = t.timetz() self.assertEqual(str(t), "01:02:03" + tag) else: self.assertRaises(ValueError, str, t) def test_tzinfo_classes(self): cls = self.theclass class C1(tzinfo): def utcoffset(self, dt): return None def dst(self, dt): return None def tzname(self, dt): return None for t in (cls(1, 1, 1), cls(1, 1, 1, tzinfo=None), cls(1, 1, 1, tzinfo=C1())): self.assertIsNone(t.utcoffset()) self.assertIsNone(t.dst()) self.assertIsNone(t.tzname()) class C3(tzinfo): def utcoffset(self, dt): return timedelta(minutes=-1439) def dst(self, dt): return timedelta(minutes=1439) def tzname(self, dt): return "aname" t = cls(1, 1, 1, tzinfo=C3()) self.assertEqual(t.utcoffset(), timedelta(minutes=-1439)) self.assertEqual(t.dst(), timedelta(minutes=1439)) self.assertEqual(t.tzname(), "aname") # Wrong types. class C4(tzinfo): def utcoffset(self, dt): return "aname" def dst(self, dt): return 7 def tzname(self, dt): return 0 t = cls(1, 1, 1, tzinfo=C4()) self.assertRaises(TypeError, t.utcoffset) self.assertRaises(TypeError, t.dst) self.assertRaises(TypeError, t.tzname) # Offset out of range. class C6(tzinfo): def utcoffset(self, dt): return timedelta(hours=-24) def dst(self, dt): return timedelta(hours=24) t = cls(1, 1, 1, tzinfo=C6()) self.assertRaises(ValueError, t.utcoffset) self.assertRaises(ValueError, t.dst) # Not a whole number of seconds. class C7(tzinfo): def utcoffset(self, dt): return timedelta(microseconds=61) def dst(self, dt): return timedelta(microseconds=-81) t = cls(1, 1, 1, tzinfo=C7()) self.assertRaises(ValueError, t.utcoffset) self.assertRaises(ValueError, t.dst) def test_aware_compare(self): cls = self.theclass # Ensure that utcoffset() gets ignored if the comparands have # the same tzinfo member. class OperandDependentOffset(tzinfo): def utcoffset(self, t): if t.minute < 10: # d0 and d1 equal after adjustment return timedelta(minutes=t.minute) else: # d2 off in the weeds return timedelta(minutes=59) base = cls(8, 9, 10, tzinfo=OperandDependentOffset()) d0 = base.replace(minute=3) d1 = base.replace(minute=9) d2 = base.replace(minute=11) for x in d0, d1, d2: for y in d0, d1, d2: for op in lt, le, gt, ge, eq, ne: got = op(x, y) expected = op(x.minute, y.minute) self.assertEqual(got, expected) # However, if they're different members, uctoffset is not ignored. # Note that a time can't actually have an operand-depedent offset, # though (and time.utcoffset() passes None to tzinfo.utcoffset()), # so skip this test for time. if cls is not time: d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) for x in d0, d1, d2: for y in d0, d1, d2: got = (x > y) - (x < y) if (x is d0 or x is d1) and (y is d0 or y is d1): expected = 0 elif x is y is d2: expected = 0 elif x is d2: expected = -1 else: assert y is d2 expected = 1 self.assertEqual(got, expected) # Testing time objects with a non-None tzinfo. class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase): theclass = time def test_empty(self): t = self.theclass() self.assertEqual(t.hour, 0) self.assertEqual(t.minute, 0) self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 0) self.assertIsNone(t.tzinfo) def test_zones(self): est = FixedOffset(-300, "EST", 1) utc = FixedOffset(0, "UTC", -2) met = FixedOffset(60, "MET", 3) t1 = time( 7, 47, tzinfo=est) t2 = time(12, 47, tzinfo=utc) t3 = time(13, 47, tzinfo=met) t4 = time(microsecond=40) t5 = time(microsecond=40, tzinfo=utc) self.assertEqual(t1.tzinfo, est) self.assertEqual(t2.tzinfo, utc) self.assertEqual(t3.tzinfo, met) self.assertIsNone(t4.tzinfo) self.assertEqual(t5.tzinfo, utc) self.assertEqual(t1.utcoffset(), timedelta(minutes=-300)) self.assertEqual(t2.utcoffset(), timedelta(minutes=0)) self.assertEqual(t3.utcoffset(), timedelta(minutes=60)) self.assertIsNone(t4.utcoffset()) self.assertRaises(TypeError, t1.utcoffset, "no args") self.assertEqual(t1.tzname(), "EST") self.assertEqual(t2.tzname(), "UTC") self.assertEqual(t3.tzname(), "MET") self.assertIsNone(t4.tzname()) self.assertRaises(TypeError, t1.tzname, "no args") self.assertEqual(t1.dst(), timedelta(minutes=1)) self.assertEqual(t2.dst(), timedelta(minutes=-2)) self.assertEqual(t3.dst(), timedelta(minutes=3)) self.assertIsNone(t4.dst()) self.assertRaises(TypeError, t1.dst, "no args") self.assertEqual(hash(t1), hash(t2)) self.assertEqual(hash(t1), hash(t3)) self.assertEqual(hash(t2), hash(t3)) self.assertEqual(t1, t2) self.assertEqual(t1, t3) self.assertEqual(t2, t3) self.assertNotEqual(t4, t5) # mixed tz-aware & naive self.assertRaises(TypeError, lambda: t4 < t5) # mixed tz-aware & naive self.assertRaises(TypeError, lambda: t5 < t4) # mixed tz-aware & naive self.assertEqual(str(t1), "07:47:00-05:00") self.assertEqual(str(t2), "12:47:00+00:00") self.assertEqual(str(t3), "13:47:00+01:00") self.assertEqual(str(t4), "00:00:00.000040") self.assertEqual(str(t5), "00:00:00.000040+00:00") self.assertEqual(t1.isoformat(), "07:47:00-05:00") self.assertEqual(t2.isoformat(), "12:47:00+00:00") self.assertEqual(t3.isoformat(), "13:47:00+01:00") self.assertEqual(t4.isoformat(), "00:00:00.000040") self.assertEqual(t5.isoformat(), "00:00:00.000040+00:00") d = 'datetime.time' self.assertEqual(repr(t1), d + "(7, 47, tzinfo=est)") self.assertEqual(repr(t2), d + "(12, 47, tzinfo=utc)") self.assertEqual(repr(t3), d + "(13, 47, tzinfo=met)") self.assertEqual(repr(t4), d + "(0, 0, 0, 40)") self.assertEqual(repr(t5), d + "(0, 0, 0, 40, tzinfo=utc)") self.assertEqual(t1.strftime("%H:%M:%S %%Z=%Z %%z=%z"), "07:47:00 %Z=EST %z=-0500") self.assertEqual(t2.strftime("%H:%M:%S %Z %z"), "12:47:00 UTC +0000") self.assertEqual(t3.strftime("%H:%M:%S %Z %z"), "13:47:00 MET +0100") yuck = FixedOffset(-1439, "%z %Z %%z%%Z") t1 = time(23, 59, tzinfo=yuck) self.assertEqual(t1.strftime("%H:%M %%Z='%Z' %%z='%z'"), "23:59 %Z='%z %Z %%z%%Z' %z='-2359'") # Check that an invalid tzname result raises an exception. class Badtzname(tzinfo): tz = 42 def tzname(self, dt): return self.tz t = time(2, 3, 4, tzinfo=Badtzname()) self.assertEqual(t.strftime("%H:%M:%S"), "02:03:04") self.assertRaises(TypeError, t.strftime, "%Z") # Issue #6697: if '_Fast' in self.__class__.__name__: Badtzname.tz = '\ud800' self.assertRaises(ValueError, t.strftime, "%Z") def test_hash_edge_cases(self): # Offsets that overflow a basic time. t1 = self.theclass(0, 1, 2, 3, tzinfo=FixedOffset(1439, "")) t2 = self.theclass(0, 0, 2, 3, tzinfo=FixedOffset(1438, "")) self.assertEqual(hash(t1), hash(t2)) t1 = self.theclass(23, 58, 6, 100, tzinfo=FixedOffset(-1000, "")) t2 = self.theclass(23, 48, 6, 100, tzinfo=FixedOffset(-1010, "")) self.assertEqual(hash(t1), hash(t2)) def test_pickling(self): # Try one without a tzinfo. args = 20, 59, 16, 64**2 orig = self.theclass(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) # Try one with a tzinfo. tinfo = PicklableFixedOffset(-300, 'cookie') orig = self.theclass(5, 6, 7, tzinfo=tinfo) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertIsInstance(derived.tzinfo, PicklableFixedOffset) self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) self.assertEqual(derived.tzname(), 'cookie') self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) def test_compat_unpickle(self): tests = [ b"cdatetime\ntime\n(S'\\x05\\x06\\x07\\x01\\xe2@'\n" b"ctest.datetimetester\nPicklableFixedOffset\n(tR" b"(dS'_FixedOffset__offset'\ncdatetime\ntimedelta\n" b"(I-1\nI68400\nI0\ntRs" b"S'_FixedOffset__dstoffset'\nNs" b"S'_FixedOffset__name'\nS'cookie'\nsbtR.", b'cdatetime\ntime\n(U\x06\x05\x06\x07\x01\xe2@' b'ctest.datetimetester\nPicklableFixedOffset\n)R' b'}(U\x14_FixedOffset__offsetcdatetime\ntimedelta\n' b'(J\xff\xff\xff\xffJ0\x0b\x01\x00K\x00tR' b'U\x17_FixedOffset__dstoffsetN' b'U\x12_FixedOffset__nameU\x06cookieubtR.', b'\x80\x02cdatetime\ntime\nU\x06\x05\x06\x07\x01\xe2@' b'ctest.datetimetester\nPicklableFixedOffset\n)R' b'}(U\x14_FixedOffset__offsetcdatetime\ntimedelta\n' b'J\xff\xff\xff\xffJ0\x0b\x01\x00K\x00\x87R' b'U\x17_FixedOffset__dstoffsetN' b'U\x12_FixedOffset__nameU\x06cookieub\x86R.', ] tinfo = PicklableFixedOffset(-300, 'cookie') expected = self.theclass(5, 6, 7, 123456, tzinfo=tinfo) for data in tests: for loads in pickle_loads: derived = loads(data, encoding='latin1') self.assertEqual(derived, expected, repr(data)) self.assertIsInstance(derived.tzinfo, PicklableFixedOffset) self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) self.assertEqual(derived.tzname(), 'cookie') def test_more_bool(self): # time is always True. cls = self.theclass t = cls(0, tzinfo=FixedOffset(-300, "")) self.assertTrue(t) t = cls(5, tzinfo=FixedOffset(-300, "")) self.assertTrue(t) t = cls(5, tzinfo=FixedOffset(300, "")) self.assertTrue(t) t = cls(23, 59, tzinfo=FixedOffset(23*60 + 59, "")) self.assertTrue(t) def test_replace(self): cls = self.theclass z100 = FixedOffset(100, "+100") zm200 = FixedOffset(timedelta(minutes=-200), "-200") args = [1, 2, 3, 4, z100] base = cls(*args) self.assertEqual(base, base.replace()) i = 0 for name, newval in (("hour", 5), ("minute", 6), ("second", 7), ("microsecond", 8), ("tzinfo", zm200)): newargs = args[:] newargs[i] = newval expected = cls(*newargs) got = base.replace(**{name: newval}) self.assertEqual(expected, got) i += 1 # Ensure we can get rid of a tzinfo. self.assertEqual(base.tzname(), "+100") base2 = base.replace(tzinfo=None) self.assertIsNone(base2.tzinfo) self.assertIsNone(base2.tzname()) # Ensure we can add one. base3 = base2.replace(tzinfo=z100) self.assertEqual(base, base3) self.assertIs(base.tzinfo, base3.tzinfo) # Out of bounds. base = cls(1) self.assertRaises(ValueError, base.replace, hour=24) self.assertRaises(ValueError, base.replace, minute=-1) self.assertRaises(ValueError, base.replace, second=100) self.assertRaises(ValueError, base.replace, microsecond=1000000) def test_mixed_compare(self): t1 = time(1, 2, 3) t2 = time(1, 2, 3) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertNotEqual(t1, t2) # In time w/ identical tzinfo objects, utcoffset is ignored. class Varies(tzinfo): def __init__(self): self.offset = timedelta(minutes=22) def utcoffset(self, t): self.offset += timedelta(minutes=1) return self.offset v = Varies() t1 = t2.replace(tzinfo=v) t2 = t2.replace(tzinfo=v) self.assertEqual(t1.utcoffset(), timedelta(minutes=23)) self.assertEqual(t2.utcoffset(), timedelta(minutes=24)) self.assertEqual(t1, t2) # But if they're not identical, it isn't ignored. t2 = t2.replace(tzinfo=Varies()) self.assertTrue(t1 < t2) # t1's offset counter still going up def test_subclass_timetz(self): class C(self.theclass): theAnswer = 42 def __new__(cls, *args, **kws): temp = kws.copy() extra = temp.pop('extra') result = self.theclass.__new__(cls, *args, **temp) result.extra = extra return result def newmeth(self, start): return start + self.hour + self.second args = 4, 5, 6, 500, FixedOffset(-300, "EST", 1) dt1 = self.theclass(*args) dt2 = C(*args, **{'extra': 7}) self.assertEqual(dt2.__class__, C) self.assertEqual(dt2.theAnswer, 42) self.assertEqual(dt2.extra, 7) self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) # Testing datetime objects with a non-None tzinfo. class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase): theclass = datetime def test_trivial(self): dt = self.theclass(1, 2, 3, 4, 5, 6, 7) self.assertEqual(dt.year, 1) self.assertEqual(dt.month, 2) self.assertEqual(dt.day, 3) self.assertEqual(dt.hour, 4) self.assertEqual(dt.minute, 5) self.assertEqual(dt.second, 6) self.assertEqual(dt.microsecond, 7) self.assertEqual(dt.tzinfo, None) def test_even_more_compare(self): # The test_compare() and test_more_compare() inherited from TestDate # and TestDateTime covered non-tzinfo cases. # Smallest possible after UTC adjustment. t1 = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "")) # Largest possible after UTC adjustment. t2 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzinfo=FixedOffset(-1439, "")) # Make sure those compare correctly, and w/o overflow. self.assertTrue(t1 < t2) self.assertTrue(t1 != t2) self.assertTrue(t2 > t1) self.assertEqual(t1, t1) self.assertEqual(t2, t2) # Equal afer adjustment. t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, "")) t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, "")) self.assertEqual(t1, t2) # Change t1 not to subtract a minute, and t1 should be larger. t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(0, "")) self.assertTrue(t1 > t2) # Change t1 to subtract 2 minutes, and t1 should be smaller. t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(2, "")) self.assertTrue(t1 < t2) # Back to the original t1, but make seconds resolve it. t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""), second=1) self.assertTrue(t1 > t2) # Likewise, but make microseconds resolve it. t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""), microsecond=1) self.assertTrue(t1 > t2) # Make t2 naive and it should differ. t2 = self.theclass.min self.assertNotEqual(t1, t2) self.assertEqual(t2, t2) # It's also naive if it has tzinfo but tzinfo.utcoffset() is None. class Naive(tzinfo): def utcoffset(self, dt): return None t2 = self.theclass(5, 6, 7, tzinfo=Naive()) self.assertNotEqual(t1, t2) self.assertEqual(t2, t2) # OTOH, it's OK to compare two of these mixing the two ways of being # naive. t1 = self.theclass(5, 6, 7) self.assertEqual(t1, t2) # Try a bogus uctoffset. class Bogus(tzinfo): def utcoffset(self, dt): return timedelta(minutes=1440) # out of bounds t1 = self.theclass(2, 2, 2, tzinfo=Bogus()) t2 = self.theclass(2, 2, 2, tzinfo=FixedOffset(0, "")) self.assertRaises(ValueError, lambda: t1 == t2) def test_pickling(self): # Try one without a tzinfo. args = 6, 7, 23, 20, 59, 1, 64**2 orig = self.theclass(*args) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) # Try one with a tzinfo. tinfo = PicklableFixedOffset(-300, 'cookie') orig = self.theclass(*args, **{'tzinfo': tinfo}) derived = self.theclass(1, 1, 1, tzinfo=FixedOffset(0, "", 0)) for pickler, unpickler, proto in pickle_choices: green = pickler.dumps(orig, proto) derived = unpickler.loads(green) self.assertEqual(orig, derived) self.assertIsInstance(derived.tzinfo, PicklableFixedOffset) self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) self.assertEqual(derived.tzname(), 'cookie') self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2)) def test_compat_unpickle(self): tests = [ b'cdatetime\ndatetime\n' b"(S'\\x07\\xdf\\x0b\\x1b\\x14;\\x01\\x01\\xe2@'\n" b'ctest.datetimetester\nPicklableFixedOffset\n(tR' b"(dS'_FixedOffset__offset'\ncdatetime\ntimedelta\n" b'(I-1\nI68400\nI0\ntRs' b"S'_FixedOffset__dstoffset'\nNs" b"S'_FixedOffset__name'\nS'cookie'\nsbtR.", b'cdatetime\ndatetime\n' b'(U\n\x07\xdf\x0b\x1b\x14;\x01\x01\xe2@' b'ctest.datetimetester\nPicklableFixedOffset\n)R' b'}(U\x14_FixedOffset__offsetcdatetime\ntimedelta\n' b'(J\xff\xff\xff\xffJ0\x0b\x01\x00K\x00tR' b'U\x17_FixedOffset__dstoffsetN' b'U\x12_FixedOffset__nameU\x06cookieubtR.', b'\x80\x02cdatetime\ndatetime\n' b'U\n\x07\xdf\x0b\x1b\x14;\x01\x01\xe2@' b'ctest.datetimetester\nPicklableFixedOffset\n)R' b'}(U\x14_FixedOffset__offsetcdatetime\ntimedelta\n' b'J\xff\xff\xff\xffJ0\x0b\x01\x00K\x00\x87R' b'U\x17_FixedOffset__dstoffsetN' b'U\x12_FixedOffset__nameU\x06cookieub\x86R.', ] args = 2015, 11, 27, 20, 59, 1, 123456 tinfo = PicklableFixedOffset(-300, 'cookie') expected = self.theclass(*args, **{'tzinfo': tinfo}) for data in tests: for loads in pickle_loads: derived = loads(data, encoding='latin1') self.assertEqual(derived, expected) self.assertIsInstance(derived.tzinfo, PicklableFixedOffset) self.assertEqual(derived.utcoffset(), timedelta(minutes=-300)) self.assertEqual(derived.tzname(), 'cookie') def test_extreme_hashes(self): # If an attempt is made to hash these via subtracting the offset # then hashing a datetime object, OverflowError results. The # Python implementation used to blow up here. t = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "")) hash(t) t = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzinfo=FixedOffset(-1439, "")) hash(t) # OTOH, an OOB offset should blow up. t = self.theclass(5, 5, 5, tzinfo=FixedOffset(-1440, "")) self.assertRaises(ValueError, hash, t) def test_zones(self): est = FixedOffset(-300, "EST") utc = FixedOffset(0, "UTC") met = FixedOffset(60, "MET") t1 = datetime(2002, 3, 19, 7, 47, tzinfo=est) t2 = datetime(2002, 3, 19, 12, 47, tzinfo=utc) t3 = datetime(2002, 3, 19, 13, 47, tzinfo=met) self.assertEqual(t1.tzinfo, est) self.assertEqual(t2.tzinfo, utc) self.assertEqual(t3.tzinfo, met) self.assertEqual(t1.utcoffset(), timedelta(minutes=-300)) self.assertEqual(t2.utcoffset(), timedelta(minutes=0)) self.assertEqual(t3.utcoffset(), timedelta(minutes=60)) self.assertEqual(t1.tzname(), "EST") self.assertEqual(t2.tzname(), "UTC") self.assertEqual(t3.tzname(), "MET") self.assertEqual(hash(t1), hash(t2)) self.assertEqual(hash(t1), hash(t3)) self.assertEqual(hash(t2), hash(t3)) self.assertEqual(t1, t2) self.assertEqual(t1, t3) self.assertEqual(t2, t3) self.assertEqual(str(t1), "2002-03-19 07:47:00-05:00") self.assertEqual(str(t2), "2002-03-19 12:47:00+00:00") self.assertEqual(str(t3), "2002-03-19 13:47:00+01:00") d = 'datetime.datetime(2002, 3, 19, ' self.assertEqual(repr(t1), d + "7, 47, tzinfo=est)") self.assertEqual(repr(t2), d + "12, 47, tzinfo=utc)") self.assertEqual(repr(t3), d + "13, 47, tzinfo=met)") def test_combine(self): met = FixedOffset(60, "MET") d = date(2002, 3, 4) tz = time(18, 45, 3, 1234, tzinfo=met) dt = datetime.combine(d, tz) self.assertEqual(dt, datetime(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met)) def test_extract(self): met = FixedOffset(60, "MET") dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met) self.assertEqual(dt.date(), date(2002, 3, 4)) self.assertEqual(dt.time(), time(18, 45, 3, 1234)) self.assertEqual(dt.timetz(), time(18, 45, 3, 1234, tzinfo=met)) def test_tz_aware_arithmetic(self): import random now = self.theclass.now() tz55 = FixedOffset(-330, "west 5:30") timeaware = now.time().replace(tzinfo=tz55) nowaware = self.theclass.combine(now.date(), timeaware) self.assertIs(nowaware.tzinfo, tz55) self.assertEqual(nowaware.timetz(), timeaware) # Can't mix aware and non-aware. self.assertRaises(TypeError, lambda: now - nowaware) self.assertRaises(TypeError, lambda: nowaware - now) # And adding datetime's doesn't make sense, aware or not. self.assertRaises(TypeError, lambda: now + nowaware) self.assertRaises(TypeError, lambda: nowaware + now) self.assertRaises(TypeError, lambda: nowaware + nowaware) # Subtracting should yield 0. self.assertEqual(now - now, timedelta(0)) self.assertEqual(nowaware - nowaware, timedelta(0)) # Adding a delta should preserve tzinfo. delta = timedelta(weeks=1, minutes=12, microseconds=5678) nowawareplus = nowaware + delta self.assertIs(nowaware.tzinfo, tz55) nowawareplus2 = delta + nowaware self.assertIs(nowawareplus2.tzinfo, tz55) self.assertEqual(nowawareplus, nowawareplus2) # that - delta should be what we started with, and that - what we # started with should be delta. diff = nowawareplus - delta self.assertIs(diff.tzinfo, tz55) self.assertEqual(nowaware, diff) self.assertRaises(TypeError, lambda: delta - nowawareplus) self.assertEqual(nowawareplus - nowaware, delta) # Make up a random timezone. tzr = FixedOffset(random.randrange(-1439, 1440), "randomtimezone") # Attach it to nowawareplus. nowawareplus = nowawareplus.replace(tzinfo=tzr) self.assertIs(nowawareplus.tzinfo, tzr) # Make sure the difference takes the timezone adjustments into account. got = nowaware - nowawareplus # Expected: (nowaware base - nowaware offset) - # (nowawareplus base - nowawareplus offset) = # (nowaware base - nowawareplus base) + # (nowawareplus offset - nowaware offset) = # -delta + nowawareplus offset - nowaware offset expected = nowawareplus.utcoffset() - nowaware.utcoffset() - delta self.assertEqual(got, expected) # Try max possible difference. min = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "min")) max = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzinfo=FixedOffset(-1439, "max")) maxdiff = max - min self.assertEqual(maxdiff, self.theclass.max - self.theclass.min + timedelta(minutes=2*1439)) # Different tzinfo, but the same offset tza = timezone(HOUR, 'A') tzb = timezone(HOUR, 'B') delta = min.replace(tzinfo=tza) - max.replace(tzinfo=tzb) self.assertEqual(delta, self.theclass.min - self.theclass.max) def test_tzinfo_now(self): meth = self.theclass.now # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth() # Try with and without naming the keyword. off42 = FixedOffset(42, "42") another = meth(off42) again = meth(tz=off42) self.assertIs(another.tzinfo, again.tzinfo) self.assertEqual(another.utcoffset(), timedelta(minutes=42)) # Bad argument with and w/o naming the keyword. self.assertRaises(TypeError, meth, 16) self.assertRaises(TypeError, meth, tzinfo=16) # Bad keyword name. self.assertRaises(TypeError, meth, tinfo=off42) # Too many args. self.assertRaises(TypeError, meth, off42, off42) # We don't know which time zone we're in, and don't have a tzinfo # class to represent it, so seeing whether a tz argument actually # does a conversion is tricky. utc = FixedOffset(0, "utc", 0) for weirdtz in [FixedOffset(timedelta(hours=15, minutes=58), "weirdtz", 0), timezone(timedelta(hours=15, minutes=58), "weirdtz"),]: for dummy in range(3): now = datetime.now(weirdtz) self.assertIs(now.tzinfo, weirdtz) utcnow = datetime.utcnow().replace(tzinfo=utc) now2 = utcnow.astimezone(weirdtz) if abs(now - now2) < timedelta(seconds=30): break # Else the code is broken, or more than 30 seconds passed between # calls; assuming the latter, just try again. else: # Three strikes and we're out. self.fail("utcnow(), now(tz), or astimezone() may be broken") def test_tzinfo_fromtimestamp(self): import time meth = self.theclass.fromtimestamp ts = time.time() # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth(ts) # Try with and without naming the keyword. off42 = FixedOffset(42, "42") another = meth(ts, off42) again = meth(ts, tz=off42) self.assertIs(another.tzinfo, again.tzinfo) self.assertEqual(another.utcoffset(), timedelta(minutes=42)) # Bad argument with and w/o naming the keyword. self.assertRaises(TypeError, meth, ts, 16) self.assertRaises(TypeError, meth, ts, tzinfo=16) # Bad keyword name. self.assertRaises(TypeError, meth, ts, tinfo=off42) # Too many args. self.assertRaises(TypeError, meth, ts, off42, off42) # Too few args. self.assertRaises(TypeError, meth) # Try to make sure tz= actually does some conversion. timestamp = 1000000000 utcdatetime = datetime.utcfromtimestamp(timestamp) # In POSIX (epoch 1970), that's 2001-09-09 01:46:40 UTC, give or take. # But on some flavor of Mac, it's nowhere near that. So we can't have # any idea here what time that actually is, we can only test that # relative changes match. utcoffset = timedelta(hours=-15, minutes=39) # arbitrary, but not zero tz = FixedOffset(utcoffset, "tz", 0) expected = utcdatetime + utcoffset got = datetime.fromtimestamp(timestamp, tz) self.assertEqual(expected, got.replace(tzinfo=None)) def test_tzinfo_utcnow(self): meth = self.theclass.utcnow # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth() # Try with and without naming the keyword; for whatever reason, # utcnow() doesn't accept a tzinfo argument. off42 = FixedOffset(42, "42") self.assertRaises(TypeError, meth, off42) self.assertRaises(TypeError, meth, tzinfo=off42) def test_tzinfo_utcfromtimestamp(self): import time meth = self.theclass.utcfromtimestamp ts = time.time() # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth(ts) # Try with and without naming the keyword; for whatever reason, # utcfromtimestamp() doesn't accept a tzinfo argument. off42 = FixedOffset(42, "42") self.assertRaises(TypeError, meth, ts, off42) self.assertRaises(TypeError, meth, ts, tzinfo=off42) def test_tzinfo_timetuple(self): # TestDateTime tested most of this. datetime adds a twist to the # DST flag. class DST(tzinfo): def __init__(self, dstvalue): if isinstance(dstvalue, int): dstvalue = timedelta(minutes=dstvalue) self.dstvalue = dstvalue def dst(self, dt): return self.dstvalue cls = self.theclass for dstvalue, flag in (-33, 1), (33, 1), (0, 0), (None, -1): d = cls(1, 1, 1, 10, 20, 30, 40, tzinfo=DST(dstvalue)) t = d.timetuple() self.assertEqual(1, t.tm_year) self.assertEqual(1, t.tm_mon) self.assertEqual(1, t.tm_mday) self.assertEqual(10, t.tm_hour) self.assertEqual(20, t.tm_min) self.assertEqual(30, t.tm_sec) self.assertEqual(0, t.tm_wday) self.assertEqual(1, t.tm_yday) self.assertEqual(flag, t.tm_isdst) # dst() returns wrong type. self.assertRaises(TypeError, cls(1, 1, 1, tzinfo=DST("x")).timetuple) # dst() at the edge. self.assertEqual(cls(1,1,1, tzinfo=DST(1439)).timetuple().tm_isdst, 1) self.assertEqual(cls(1,1,1, tzinfo=DST(-1439)).timetuple().tm_isdst, 1) # dst() out of range. self.assertRaises(ValueError, cls(1,1,1, tzinfo=DST(1440)).timetuple) self.assertRaises(ValueError, cls(1,1,1, tzinfo=DST(-1440)).timetuple) def test_utctimetuple(self): class DST(tzinfo): def __init__(self, dstvalue=0): if isinstance(dstvalue, int): dstvalue = timedelta(minutes=dstvalue) self.dstvalue = dstvalue def dst(self, dt): return self.dstvalue cls = self.theclass # This can't work: DST didn't implement utcoffset. self.assertRaises(NotImplementedError, cls(1, 1, 1, tzinfo=DST(0)).utcoffset) class UOFS(DST): def __init__(self, uofs, dofs=None): DST.__init__(self, dofs) self.uofs = timedelta(minutes=uofs) def utcoffset(self, dt): return self.uofs for dstvalue in -33, 33, 0, None: d = cls(1, 2, 3, 10, 20, 30, 40, tzinfo=UOFS(-53, dstvalue)) t = d.utctimetuple() self.assertEqual(d.year, t.tm_year) self.assertEqual(d.month, t.tm_mon) self.assertEqual(d.day, t.tm_mday) self.assertEqual(11, t.tm_hour) # 20mm + 53mm = 1hn + 13mm self.assertEqual(13, t.tm_min) self.assertEqual(d.second, t.tm_sec) self.assertEqual(d.weekday(), t.tm_wday) self.assertEqual(d.toordinal() - date(1, 1, 1).toordinal() + 1, t.tm_yday) # Ensure tm_isdst is 0 regardless of what dst() says: DST # is never in effect for a UTC time. self.assertEqual(0, t.tm_isdst) # For naive datetime, utctimetuple == timetuple except for isdst d = cls(1, 2, 3, 10, 20, 30, 40) t = d.utctimetuple() self.assertEqual(t[:-1], d.timetuple()[:-1]) self.assertEqual(0, t.tm_isdst) # Same if utcoffset is None class NOFS(DST): def utcoffset(self, dt): return None d = cls(1, 2, 3, 10, 20, 30, 40, tzinfo=NOFS()) t = d.utctimetuple() self.assertEqual(t[:-1], d.timetuple()[:-1]) self.assertEqual(0, t.tm_isdst) # Check that bad tzinfo is detected class BOFS(DST): def utcoffset(self, dt): return "EST" d = cls(1, 2, 3, 10, 20, 30, 40, tzinfo=BOFS()) self.assertRaises(TypeError, d.utctimetuple) # Check that utctimetuple() is the same as # astimezone(utc).timetuple() d = cls(2010, 11, 13, 14, 15, 16, 171819) for tz in [timezone.min, timezone.utc, timezone.max]: dtz = d.replace(tzinfo=tz) self.assertEqual(dtz.utctimetuple()[:-1], dtz.astimezone(timezone.utc).timetuple()[:-1]) # At the edges, UTC adjustment can produce years out-of-range # for a datetime object. Ensure that an OverflowError is # raised. tiny = cls(MINYEAR, 1, 1, 0, 0, 37, tzinfo=UOFS(1439)) # That goes back 1 minute less than a full day. self.assertRaises(OverflowError, tiny.utctimetuple) huge = cls(MAXYEAR, 12, 31, 23, 59, 37, 999999, tzinfo=UOFS(-1439)) # That goes forward 1 minute less than a full day. self.assertRaises(OverflowError, huge.utctimetuple) # More overflow cases tiny = cls.min.replace(tzinfo=timezone(MINUTE)) self.assertRaises(OverflowError, tiny.utctimetuple) huge = cls.max.replace(tzinfo=timezone(-MINUTE)) self.assertRaises(OverflowError, huge.utctimetuple) def test_tzinfo_isoformat(self): zero = FixedOffset(0, "+00:00") plus = FixedOffset(220, "+03:40") minus = FixedOffset(-231, "-03:51") unknown = FixedOffset(None, "") cls = self.theclass datestr = '0001-02-03' for ofs in None, zero, plus, minus, unknown: for us in 0, 987001: d = cls(1, 2, 3, 4, 5, 59, us, tzinfo=ofs) timestr = '04:05:59' + (us and '.987001' or '') ofsstr = ofs is not None and d.tzname() or '' tailstr = timestr + ofsstr iso = d.isoformat() self.assertEqual(iso, datestr + 'T' + tailstr) self.assertEqual(iso, d.isoformat('T')) self.assertEqual(d.isoformat('k'), datestr + 'k' + tailstr) self.assertEqual(d.isoformat('\u1234'), datestr + '\u1234' + tailstr) self.assertEqual(str(d), datestr + ' ' + tailstr) def test_replace(self): cls = self.theclass z100 = FixedOffset(100, "+100") zm200 = FixedOffset(timedelta(minutes=-200), "-200") args = [1, 2, 3, 4, 5, 6, 7, z100] base = cls(*args) self.assertEqual(base, base.replace()) i = 0 for name, newval in (("year", 2), ("month", 3), ("day", 4), ("hour", 5), ("minute", 6), ("second", 7), ("microsecond", 8), ("tzinfo", zm200)): newargs = args[:] newargs[i] = newval expected = cls(*newargs) got = base.replace(**{name: newval}) self.assertEqual(expected, got) i += 1 # Ensure we can get rid of a tzinfo. self.assertEqual(base.tzname(), "+100") base2 = base.replace(tzinfo=None) self.assertIsNone(base2.tzinfo) self.assertIsNone(base2.tzname()) # Ensure we can add one. base3 = base2.replace(tzinfo=z100) self.assertEqual(base, base3) self.assertIs(base.tzinfo, base3.tzinfo) # Out of bounds. base = cls(2000, 2, 29) self.assertRaises(ValueError, base.replace, year=2001) def test_more_astimezone(self): # The inherited test_astimezone covered some trivial and error cases. fnone = FixedOffset(None, "None") f44m = FixedOffset(44, "44") fm5h = FixedOffset(-timedelta(hours=5), "m300") dt = self.theclass.now(tz=f44m) self.assertIs(dt.tzinfo, f44m) # Replacing with degenerate tzinfo raises an exception. self.assertRaises(ValueError, dt.astimezone, fnone) # Replacing with same tzinfo makes no change. x = dt.astimezone(dt.tzinfo) self.assertIs(x.tzinfo, f44m) self.assertEqual(x.date(), dt.date()) self.assertEqual(x.time(), dt.time()) # Replacing with different tzinfo does adjust. got = dt.astimezone(fm5h) self.assertIs(got.tzinfo, fm5h) self.assertEqual(got.utcoffset(), timedelta(hours=-5)) expected = dt - dt.utcoffset() # in effect, convert to UTC expected += fm5h.utcoffset(dt) # and from there to local time expected = expected.replace(tzinfo=fm5h) # and attach new tzinfo self.assertEqual(got.date(), expected.date()) self.assertEqual(got.time(), expected.time()) self.assertEqual(got.timetz(), expected.timetz()) self.assertIs(got.tzinfo, expected.tzinfo) self.assertEqual(got, expected) @support.run_with_tz('UTC') def test_astimezone_default_utc(self): dt = self.theclass.now(timezone.utc) self.assertEqual(dt.astimezone(None), dt) self.assertEqual(dt.astimezone(), dt) # Note that offset in TZ variable has the opposite sign to that # produced by %z directive. @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_astimezone_default_eastern(self): dt = self.theclass(2012, 11, 4, 6, 30, tzinfo=timezone.utc) local = dt.astimezone() self.assertEqual(dt, local) self.assertEqual(local.strftime("%z %Z"), "-0500 EST") dt = self.theclass(2012, 11, 4, 5, 30, tzinfo=timezone.utc) local = dt.astimezone() self.assertEqual(dt, local) self.assertEqual(local.strftime("%z %Z"), "-0400 EDT") @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_astimezone_default_near_fold(self): # Issue #26616. u = datetime(2015, 11, 1, 5, tzinfo=timezone.utc) t = u.astimezone() s = t.astimezone() self.assertEqual(t.tzinfo, s.tzinfo) def test_aware_subtract(self): cls = self.theclass # Ensure that utcoffset() is ignored when the operands have the # same tzinfo member. class OperandDependentOffset(tzinfo): def utcoffset(self, t): if t.minute < 10: # d0 and d1 equal after adjustment return timedelta(minutes=t.minute) else: # d2 off in the weeds return timedelta(minutes=59) base = cls(8, 9, 10, 11, 12, 13, 14, tzinfo=OperandDependentOffset()) d0 = base.replace(minute=3) d1 = base.replace(minute=9) d2 = base.replace(minute=11) for x in d0, d1, d2: for y in d0, d1, d2: got = x - y expected = timedelta(minutes=x.minute - y.minute) self.assertEqual(got, expected) # OTOH, if the tzinfo members are distinct, utcoffsets aren't # ignored. base = cls(8, 9, 10, 11, 12, 13, 14) d0 = base.replace(minute=3, tzinfo=OperandDependentOffset()) d1 = base.replace(minute=9, tzinfo=OperandDependentOffset()) d2 = base.replace(minute=11, tzinfo=OperandDependentOffset()) for x in d0, d1, d2: for y in d0, d1, d2: got = x - y if (x is d0 or x is d1) and (y is d0 or y is d1): expected = timedelta(0) elif x is y is d2: expected = timedelta(0) elif x is d2: expected = timedelta(minutes=(11-59)-0) else: assert y is d2 expected = timedelta(minutes=0-(11-59)) self.assertEqual(got, expected) def test_mixed_compare(self): t1 = datetime(1, 2, 3, 4, 5, 6, 7) t2 = datetime(1, 2, 3, 4, 5, 6, 7) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertNotEqual(t1, t2) # In datetime w/ identical tzinfo objects, utcoffset is ignored. class Varies(tzinfo): def __init__(self): self.offset = timedelta(minutes=22) def utcoffset(self, t): self.offset += timedelta(minutes=1) return self.offset v = Varies() t1 = t2.replace(tzinfo=v) t2 = t2.replace(tzinfo=v) self.assertEqual(t1.utcoffset(), timedelta(minutes=23)) self.assertEqual(t2.utcoffset(), timedelta(minutes=24)) self.assertEqual(t1, t2) # But if they're not identical, it isn't ignored. t2 = t2.replace(tzinfo=Varies()) self.assertTrue(t1 < t2) # t1's offset counter still going up def test_subclass_datetimetz(self): class C(self.theclass): theAnswer = 42 def __new__(cls, *args, **kws): temp = kws.copy() extra = temp.pop('extra') result = self.theclass.__new__(cls, *args, **temp) result.extra = extra return result def newmeth(self, start): return start + self.hour + self.year args = 2002, 12, 31, 4, 5, 6, 500, FixedOffset(-300, "EST", 1) dt1 = self.theclass(*args) dt2 = C(*args, **{'extra': 7}) self.assertEqual(dt2.__class__, C) self.assertEqual(dt2.theAnswer, 42) self.assertEqual(dt2.extra, 7) self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.year - 7) # Pain to set up DST-aware tzinfo classes. def first_sunday_on_or_after(dt): days_to_go = 6 - dt.weekday() if days_to_go: dt += timedelta(days_to_go) return dt ZERO = timedelta(0) MINUTE = timedelta(minutes=1) HOUR = timedelta(hours=1) DAY = timedelta(days=1) # In the US, DST starts at 2am (standard time) on the first Sunday in April. DSTSTART = datetime(1, 4, 1, 2) # and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct, # which is the first Sunday on or after Oct 25. Because we view 1:MM as # being standard time on that day, there is no spelling in local time of # the last hour of DST (that's 1:MM DST, but 1:MM is taken as standard time). DSTEND = datetime(1, 10, 25, 1) class USTimeZone(tzinfo): def __init__(self, hours, reprname, stdname, dstname): self.stdoffset = timedelta(hours=hours) self.reprname = reprname self.stdname = stdname self.dstname = dstname def __repr__(self): return self.reprname def tzname(self, dt): if self.dst(dt): return self.dstname else: return self.stdname def utcoffset(self, dt): return self.stdoffset + self.dst(dt) def dst(self, dt): if dt is None or dt.tzinfo is None: # An exception instead may be sensible here, in one or more of # the cases. return ZERO assert dt.tzinfo is self # Find first Sunday in April. start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) assert start.weekday() == 6 and start.month == 4 and start.day <= 7 # Find last Sunday in October. end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) assert end.weekday() == 6 and end.month == 10 and end.day >= 25 # Can't compare naive to aware objects, so strip the timezone from # dt first. if start <= dt.replace(tzinfo=None) < end: return HOUR else: return ZERO Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") Central = USTimeZone(-6, "Central", "CST", "CDT") Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") utc_real = FixedOffset(0, "UTC", 0) # For better test coverage, we want another flavor of UTC that's west of # the Eastern and Pacific timezones. utc_fake = FixedOffset(-12*60, "UTCfake", 0) class TestTimezoneConversions(unittest.TestCase): # The DST switch times for 2002, in std time. dston = datetime(2002, 4, 7, 2) dstoff = datetime(2002, 10, 27, 1) theclass = datetime # Check a time that's inside DST. def checkinside(self, dt, tz, utc, dston, dstoff): self.assertEqual(dt.dst(), HOUR) # Conversion to our own timezone is always an identity. self.assertEqual(dt.astimezone(tz), dt) asutc = dt.astimezone(utc) there_and_back = asutc.astimezone(tz) # Conversion to UTC and back isn't always an identity here, # because there are redundant spellings (in local time) of # UTC time when DST begins: the clock jumps from 1:59:59 # to 3:00:00, and a local time of 2:MM:SS doesn't really # make sense then. The classes above treat 2:MM:SS as # daylight time then (it's "after 2am"), really an alias # for 1:MM:SS standard time. The latter form is what # conversion back from UTC produces. if dt.date() == dston.date() and dt.hour == 2: # We're in the redundant hour, and coming back from # UTC gives the 1:MM:SS standard-time spelling. self.assertEqual(there_and_back + HOUR, dt) # Although during was considered to be in daylight # time, there_and_back is not. self.assertEqual(there_and_back.dst(), ZERO) # They're the same times in UTC. self.assertEqual(there_and_back.astimezone(utc), dt.astimezone(utc)) else: # We're not in the redundant hour. self.assertEqual(dt, there_and_back) # Because we have a redundant spelling when DST begins, there is # (unfortunately) an hour when DST ends that can't be spelled at all in # local time. When DST ends, the clock jumps from 1:59 back to 1:00 # again. The hour 1:MM DST has no spelling then: 1:MM is taken to be # standard time. 1:MM DST == 0:MM EST, but 0:MM is taken to be # daylight time. The hour 1:MM daylight == 0:MM standard can't be # expressed in local time. Nevertheless, we want conversion back # from UTC to mimic the local clock's "repeat an hour" behavior. nexthour_utc = asutc + HOUR nexthour_tz = nexthour_utc.astimezone(tz) if dt.date() == dstoff.date() and dt.hour == 0: # We're in the hour before the last DST hour. The last DST hour # is ineffable. We want the conversion back to repeat 1:MM. self.assertEqual(nexthour_tz, dt.replace(hour=1)) nexthour_utc += HOUR nexthour_tz = nexthour_utc.astimezone(tz) self.assertEqual(nexthour_tz, dt.replace(hour=1)) else: self.assertEqual(nexthour_tz - dt, HOUR) # Check a time that's outside DST. def checkoutside(self, dt, tz, utc): self.assertEqual(dt.dst(), ZERO) # Conversion to our own timezone is always an identity. self.assertEqual(dt.astimezone(tz), dt) # Converting to UTC and back is an identity too. asutc = dt.astimezone(utc) there_and_back = asutc.astimezone(tz) self.assertEqual(dt, there_and_back) def convert_between_tz_and_utc(self, tz, utc): dston = self.dston.replace(tzinfo=tz) # Because 1:MM on the day DST ends is taken as being standard time, # there is no spelling in tz for the last hour of daylight time. # For purposes of the test, the last hour of DST is 0:MM, which is # taken as being daylight time (and 1:MM is taken as being standard # time). dstoff = self.dstoff.replace(tzinfo=tz) for delta in (timedelta(weeks=13), DAY, HOUR, timedelta(minutes=1), timedelta(microseconds=1)): self.checkinside(dston, tz, utc, dston, dstoff) for during in dston + delta, dstoff - delta: self.checkinside(during, tz, utc, dston, dstoff) self.checkoutside(dstoff, tz, utc) for outside in dston - delta, dstoff + delta: self.checkoutside(outside, tz, utc) def test_easy(self): # Despite the name of this test, the endcases are excruciating. self.convert_between_tz_and_utc(Eastern, utc_real) self.convert_between_tz_and_utc(Pacific, utc_real) self.convert_between_tz_and_utc(Eastern, utc_fake) self.convert_between_tz_and_utc(Pacific, utc_fake) # The next is really dancing near the edge. It works because # Pacific and Eastern are far enough apart that their "problem # hours" don't overlap. self.convert_between_tz_and_utc(Eastern, Pacific) self.convert_between_tz_and_utc(Pacific, Eastern) # OTOH, these fail! Don't enable them. The difficulty is that # the edge case tests assume that every hour is representable in # the "utc" class. This is always true for a fixed-offset tzinfo # class (lke utc_real and utc_fake), but not for Eastern or Central. # For these adjacent DST-aware time zones, the range of time offsets # tested ends up creating hours in the one that aren't representable # in the other. For the same reason, we would see failures in the # Eastern vs Pacific tests too if we added 3*HOUR to the list of # offset deltas in convert_between_tz_and_utc(). # # self.convert_between_tz_and_utc(Eastern, Central) # can't work # self.convert_between_tz_and_utc(Central, Eastern) # can't work def test_tricky(self): # 22:00 on day before daylight starts. fourback = self.dston - timedelta(hours=4) ninewest = FixedOffset(-9*60, "-0900", 0) fourback = fourback.replace(tzinfo=ninewest) # 22:00-0900 is 7:00 UTC == 2:00 EST == 3:00 DST. Since it's "after # 2", we should get the 3 spelling. # If we plug 22:00 the day before into Eastern, it "looks like std # time", so its offset is returned as -5, and -5 - -9 = 4. Adding 4 # to 22:00 lands on 2:00, which makes no sense in local time (the # local clock jumps from 1 to 3). The point here is to make sure we # get the 3 spelling. expected = self.dston.replace(hour=3) got = fourback.astimezone(Eastern).replace(tzinfo=None) self.assertEqual(expected, got) # Similar, but map to 6:00 UTC == 1:00 EST == 2:00 DST. In that # case we want the 1:00 spelling. sixutc = self.dston.replace(hour=6, tzinfo=utc_real) # Now 6:00 "looks like daylight", so the offset wrt Eastern is -4, # and adding -4-0 == -4 gives the 2:00 spelling. We want the 1:00 EST # spelling. expected = self.dston.replace(hour=1) got = sixutc.astimezone(Eastern).replace(tzinfo=None) self.assertEqual(expected, got) # Now on the day DST ends, we want "repeat an hour" behavior. # UTC 4:MM 5:MM 6:MM 7:MM checking these # EST 23:MM 0:MM 1:MM 2:MM # EDT 0:MM 1:MM 2:MM 3:MM # wall 0:MM 1:MM 1:MM 2:MM against these for utc in utc_real, utc_fake: for tz in Eastern, Pacific: first_std_hour = self.dstoff - timedelta(hours=2) # 23:MM # Convert that to UTC. first_std_hour -= tz.utcoffset(None) # Adjust for possibly fake UTC. asutc = first_std_hour + utc.utcoffset(None) # First UTC hour to convert; this is 4:00 when utc=utc_real & # tz=Eastern. asutcbase = asutc.replace(tzinfo=utc) for tzhour in (0, 1, 1, 2): expectedbase = self.dstoff.replace(hour=tzhour) for minute in 0, 30, 59: expected = expectedbase.replace(minute=minute) asutc = asutcbase.replace(minute=minute) astz = asutc.astimezone(tz) self.assertEqual(astz.replace(tzinfo=None), expected) asutcbase += HOUR def test_bogus_dst(self): class ok(tzinfo): def utcoffset(self, dt): return HOUR def dst(self, dt): return HOUR now = self.theclass.now().replace(tzinfo=utc_real) # Doesn't blow up. now.astimezone(ok()) # Does blow up. class notok(ok): def dst(self, dt): return None self.assertRaises(ValueError, now.astimezone, notok()) # Sometimes blow up. In the following, tzinfo.dst() # implementation may return None or not None depending on # whether DST is assumed to be in effect. In this situation, # a ValueError should be raised by astimezone(). class tricky_notok(ok): def dst(self, dt): if dt.year == 2000: return None else: return 10*HOUR dt = self.theclass(2001, 1, 1).replace(tzinfo=utc_real) self.assertRaises(ValueError, dt.astimezone, tricky_notok()) def test_fromutc(self): self.assertRaises(TypeError, Eastern.fromutc) # not enough args now = datetime.utcnow().replace(tzinfo=utc_real) self.assertRaises(ValueError, Eastern.fromutc, now) # wrong tzinfo now = now.replace(tzinfo=Eastern) # insert correct tzinfo enow = Eastern.fromutc(now) # doesn't blow up self.assertEqual(enow.tzinfo, Eastern) # has right tzinfo member self.assertRaises(TypeError, Eastern.fromutc, now, now) # too many args self.assertRaises(TypeError, Eastern.fromutc, date.today()) # wrong type # Always converts UTC to standard time. class FauxUSTimeZone(USTimeZone): def fromutc(self, dt): return dt + self.stdoffset FEastern = FauxUSTimeZone(-5, "FEastern", "FEST", "FEDT") # UTC 4:MM 5:MM 6:MM 7:MM 8:MM 9:MM # EST 23:MM 0:MM 1:MM 2:MM 3:MM 4:MM # EDT 0:MM 1:MM 2:MM 3:MM 4:MM 5:MM # Check around DST start. start = self.dston.replace(hour=4, tzinfo=Eastern) fstart = start.replace(tzinfo=FEastern) for wall in 23, 0, 1, 3, 4, 5: expected = start.replace(hour=wall) if wall == 23: expected -= timedelta(days=1) got = Eastern.fromutc(start) self.assertEqual(expected, got) expected = fstart + FEastern.stdoffset got = FEastern.fromutc(fstart) self.assertEqual(expected, got) # Ensure astimezone() calls fromutc() too. got = fstart.replace(tzinfo=utc_real).astimezone(FEastern) self.assertEqual(expected, got) start += HOUR fstart += HOUR # Check around DST end. start = self.dstoff.replace(hour=4, tzinfo=Eastern) fstart = start.replace(tzinfo=FEastern) for wall in 0, 1, 1, 2, 3, 4: expected = start.replace(hour=wall) got = Eastern.fromutc(start) self.assertEqual(expected, got) expected = fstart + FEastern.stdoffset got = FEastern.fromutc(fstart) self.assertEqual(expected, got) # Ensure astimezone() calls fromutc() too. got = fstart.replace(tzinfo=utc_real).astimezone(FEastern) self.assertEqual(expected, got) start += HOUR fstart += HOUR ############################################################################# # oddballs class Oddballs(unittest.TestCase): def test_bug_1028306(self): # Trying to compare a date to a datetime should act like a mixed- # type comparison, despite that datetime is a subclass of date. as_date = date.today() as_datetime = datetime.combine(as_date, time()) self.assertTrue(as_date != as_datetime) self.assertTrue(as_datetime != as_date) self.assertFalse(as_date == as_datetime) self.assertFalse(as_datetime == as_date) self.assertRaises(TypeError, lambda: as_date < as_datetime) self.assertRaises(TypeError, lambda: as_datetime < as_date) self.assertRaises(TypeError, lambda: as_date <= as_datetime) self.assertRaises(TypeError, lambda: as_datetime <= as_date) self.assertRaises(TypeError, lambda: as_date > as_datetime) self.assertRaises(TypeError, lambda: as_datetime > as_date) self.assertRaises(TypeError, lambda: as_date >= as_datetime) self.assertRaises(TypeError, lambda: as_datetime >= as_date) # Nevertheless, comparison should work with the base-class (date) # projection if use of a date method is forced. self.assertEqual(as_date.__eq__(as_datetime), True) different_day = (as_date.day + 1) % 20 + 1 as_different = as_datetime.replace(day= different_day) self.assertEqual(as_date.__eq__(as_different), False) # And date should compare with other subclasses of date. If a # subclass wants to stop this, it's up to the subclass to do so. date_sc = SubclassDate(as_date.year, as_date.month, as_date.day) self.assertEqual(as_date, date_sc) self.assertEqual(date_sc, as_date) # Ditto for datetimes. datetime_sc = SubclassDatetime(as_datetime.year, as_datetime.month, as_date.day, 0, 0, 0) self.assertEqual(as_datetime, datetime_sc) self.assertEqual(datetime_sc, as_datetime) def test_extra_attributes(self): for x in [date.today(), time(), datetime.utcnow(), timedelta(), tzinfo(), timezone(timedelta())]: with self.assertRaises(AttributeError): x.abc = 1 def test_check_arg_types(self): class Number: def __init__(self, value): self.value = value def __int__(self): return self.value for xx in [decimal.Decimal(10), decimal.Decimal('10.9'), Number(10)]: self.assertEqual(datetime(10, 10, 10, 10, 10, 10, 10), datetime(xx, xx, xx, xx, xx, xx, xx)) with self.assertRaisesRegex(TypeError, '^an integer is required ' r'\(got type str\)$'): datetime(10, 10, '10') f10 = Number(10.9) with self.assertRaisesRegex(TypeError, '^__int__ returned non-int ' r'\(type float\)$'): datetime(10, 10, f10) class Float(float): pass s10 = Float(10.9) with self.assertRaisesRegex(TypeError, '^integer argument expected, ' 'got float$'): datetime(10, 10, s10) with self.assertRaises(TypeError): datetime(10., 10, 10) with self.assertRaises(TypeError): datetime(10, 10., 10) with self.assertRaises(TypeError): datetime(10, 10, 10.) with self.assertRaises(TypeError): datetime(10, 10, 10, 10.) with self.assertRaises(TypeError): datetime(10, 10, 10, 10, 10.) with self.assertRaises(TypeError): datetime(10, 10, 10, 10, 10, 10.) with self.assertRaises(TypeError): datetime(10, 10, 10, 10, 10, 10, 10.) ############################################################################# # Local Time Disambiguation # An experimental reimplementation of fromutc that respects the "fold" flag. class tzinfo2(tzinfo): def fromutc(self, dt): "datetime in UTC -> datetime in local time." if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") # Returned value satisfies # dt + ldt.utcoffset() = ldt off0 = dt.replace(fold=0).utcoffset() off1 = dt.replace(fold=1).utcoffset() if off0 is None or off1 is None or dt.dst() is None: raise ValueError if off0 == off1: ldt = dt + off0 off1 = ldt.utcoffset() if off0 == off1: return ldt # Now, we discovered both possible offsets, so # we can just try four possible solutions: for off in [off0, off1]: ldt = dt + off if ldt.utcoffset() == off: return ldt ldt = ldt.replace(fold=1) if ldt.utcoffset() == off: return ldt raise ValueError("No suitable local time found") # Reimplementing simplified US timezones to respect the "fold" flag: class USTimeZone2(tzinfo2): def __init__(self, hours, reprname, stdname, dstname): self.stdoffset = timedelta(hours=hours) self.reprname = reprname self.stdname = stdname self.dstname = dstname def __repr__(self): return self.reprname def tzname(self, dt): if self.dst(dt): return self.dstname else: return self.stdname def utcoffset(self, dt): return self.stdoffset + self.dst(dt) def dst(self, dt): if dt is None or dt.tzinfo is None: # An exception instead may be sensible here, in one or more of # the cases. return ZERO assert dt.tzinfo is self # Find first Sunday in April. start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) assert start.weekday() == 6 and start.month == 4 and start.day <= 7 # Find last Sunday in October. end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) assert end.weekday() == 6 and end.month == 10 and end.day >= 25 # Can't compare naive to aware objects, so strip the timezone from # dt first. dt = dt.replace(tzinfo=None) if start + HOUR <= dt < end: # DST is in effect. return HOUR elif end <= dt < end + HOUR: # Fold (an ambiguous hour): use dt.fold to disambiguate. return ZERO if dt.fold else HOUR elif start <= dt < start + HOUR: # Gap (a non-existent hour): reverse the fold rule. return HOUR if dt.fold else ZERO else: # DST is off. return ZERO Eastern2 = USTimeZone2(-5, "Eastern2", "EST", "EDT") Central2 = USTimeZone2(-6, "Central2", "CST", "CDT") Mountain2 = USTimeZone2(-7, "Mountain2", "MST", "MDT") Pacific2 = USTimeZone2(-8, "Pacific2", "PST", "PDT") # Europe_Vilnius_1941 tzinfo implementation reproduces the following # 1941 transition from Olson's tzdist: # # Zone NAME GMTOFF RULES FORMAT [UNTIL] # ZoneEurope/Vilnius 1:00 - CET 1940 Aug 3 # 3:00 - MSK 1941 Jun 24 # 1:00 C-Eur CE%sT 1944 Aug # # $ zdump -v Europe/Vilnius | grep 1941 # Europe/Vilnius Mon Jun 23 20:59:59 1941 UTC = Mon Jun 23 23:59:59 1941 MSK isdst=0 gmtoff=10800 # Europe/Vilnius Mon Jun 23 21:00:00 1941 UTC = Mon Jun 23 23:00:00 1941 CEST isdst=1 gmtoff=7200 class Europe_Vilnius_1941(tzinfo): def _utc_fold(self): return [datetime(1941, 6, 23, 21, tzinfo=self), # Mon Jun 23 21:00:00 1941 UTC datetime(1941, 6, 23, 22, tzinfo=self)] # Mon Jun 23 22:00:00 1941 UTC def _loc_fold(self): return [datetime(1941, 6, 23, 23, tzinfo=self), # Mon Jun 23 23:00:00 1941 MSK / CEST datetime(1941, 6, 24, 0, tzinfo=self)] # Mon Jun 24 00:00:00 1941 CEST def utcoffset(self, dt): fold_start, fold_stop = self._loc_fold() if dt < fold_start: return 3 * HOUR if dt < fold_stop: return (2 if dt.fold else 3) * HOUR # if dt >= fold_stop return 2 * HOUR def dst(self, dt): fold_start, fold_stop = self._loc_fold() if dt < fold_start: return 0 * HOUR if dt < fold_stop: return (1 if dt.fold else 0) * HOUR # if dt >= fold_stop return 1 * HOUR def tzname(self, dt): fold_start, fold_stop = self._loc_fold() if dt < fold_start: return 'MSK' if dt < fold_stop: return ('MSK', 'CEST')[dt.fold] # if dt >= fold_stop return 'CEST' def fromutc(self, dt): assert dt.fold == 0 assert dt.tzinfo is self if dt.year != 1941: raise NotImplementedError fold_start, fold_stop = self._utc_fold() if dt < fold_start: return dt + 3 * HOUR if dt < fold_stop: return (dt + 2 * HOUR).replace(fold=1) # if dt >= fold_stop return dt + 2 * HOUR class TestLocalTimeDisambiguation(unittest.TestCase): def test_vilnius_1941_fromutc(self): Vilnius = Europe_Vilnius_1941() gdt = datetime(1941, 6, 23, 20, 59, 59, tzinfo=timezone.utc) ldt = gdt.astimezone(Vilnius) self.assertEqual(ldt.strftime("%c %Z%z"), 'Mon Jun 23 23:59:59 1941 MSK+0300') self.assertEqual(ldt.fold, 0) self.assertFalse(ldt.dst()) gdt = datetime(1941, 6, 23, 21, tzinfo=timezone.utc) ldt = gdt.astimezone(Vilnius) self.assertEqual(ldt.strftime("%c %Z%z"), 'Mon Jun 23 23:00:00 1941 CEST+0200') self.assertEqual(ldt.fold, 1) self.assertTrue(ldt.dst()) gdt = datetime(1941, 6, 23, 22, tzinfo=timezone.utc) ldt = gdt.astimezone(Vilnius) self.assertEqual(ldt.strftime("%c %Z%z"), 'Tue Jun 24 00:00:00 1941 CEST+0200') self.assertEqual(ldt.fold, 0) self.assertTrue(ldt.dst()) def test_vilnius_1941_toutc(self): Vilnius = Europe_Vilnius_1941() ldt = datetime(1941, 6, 23, 22, 59, 59, tzinfo=Vilnius) gdt = ldt.astimezone(timezone.utc) self.assertEqual(gdt.strftime("%c %Z"), 'Mon Jun 23 19:59:59 1941 UTC') ldt = datetime(1941, 6, 23, 23, 59, 59, tzinfo=Vilnius) gdt = ldt.astimezone(timezone.utc) self.assertEqual(gdt.strftime("%c %Z"), 'Mon Jun 23 20:59:59 1941 UTC') ldt = datetime(1941, 6, 23, 23, 59, 59, tzinfo=Vilnius, fold=1) gdt = ldt.astimezone(timezone.utc) self.assertEqual(gdt.strftime("%c %Z"), 'Mon Jun 23 21:59:59 1941 UTC') ldt = datetime(1941, 6, 24, 0, tzinfo=Vilnius) gdt = ldt.astimezone(timezone.utc) self.assertEqual(gdt.strftime("%c %Z"), 'Mon Jun 23 22:00:00 1941 UTC') def test_constructors(self): t = time(0, fold=1) dt = datetime(1, 1, 1, fold=1) self.assertEqual(t.fold, 1) self.assertEqual(dt.fold, 1) with self.assertRaises(TypeError): time(0, 0, 0, 0, None, 0) def test_member(self): dt = datetime(1, 1, 1, fold=1) t = dt.time() self.assertEqual(t.fold, 1) t = dt.timetz() self.assertEqual(t.fold, 1) def test_replace(self): t = time(0) dt = datetime(1, 1, 1) self.assertEqual(t.replace(fold=1).fold, 1) self.assertEqual(dt.replace(fold=1).fold, 1) self.assertEqual(t.replace(fold=0).fold, 0) self.assertEqual(dt.replace(fold=0).fold, 0) # Check that replacement of other fields does not change "fold". t = t.replace(fold=1, tzinfo=Eastern) dt = dt.replace(fold=1, tzinfo=Eastern) self.assertEqual(t.replace(tzinfo=None).fold, 1) self.assertEqual(dt.replace(tzinfo=None).fold, 1) # Out of bounds. with self.assertRaises(ValueError): t.replace(fold=2) with self.assertRaises(ValueError): dt.replace(fold=2) # Check that fold is a keyword-only argument with self.assertRaises(TypeError): t.replace(1, 1, 1, None, 1) with self.assertRaises(TypeError): dt.replace(1, 1, 1, 1, 1, 1, 1, None, 1) def test_comparison(self): t = time(0) dt = datetime(1, 1, 1) self.assertEqual(t, t.replace(fold=1)) self.assertEqual(dt, dt.replace(fold=1)) def test_hash(self): t = time(0) dt = datetime(1, 1, 1) self.assertEqual(hash(t), hash(t.replace(fold=1))) self.assertEqual(hash(dt), hash(dt.replace(fold=1))) @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_fromtimestamp(self): s = 1414906200 dt0 = datetime.fromtimestamp(s) dt1 = datetime.fromtimestamp(s + 3600) self.assertEqual(dt0.fold, 0) self.assertEqual(dt1.fold, 1) @support.run_with_tz('Australia/Lord_Howe') def test_fromtimestamp_lord_howe(self): tm = _time.localtime(1.4e9) if _time.strftime('%Z%z', tm) != 'LHST+1030': self.skipTest('Australia/Lord_Howe timezone is not supported on this platform') # $ TZ=Australia/Lord_Howe date -r 1428158700 # Sun Apr 5 01:45:00 LHDT 2015 # $ TZ=Australia/Lord_Howe date -r 1428160500 # Sun Apr 5 01:45:00 LHST 2015 s = 1428158700 t0 = datetime.fromtimestamp(s) t1 = datetime.fromtimestamp(s + 1800) self.assertEqual(t0, t1) self.assertEqual(t0.fold, 0) self.assertEqual(t1.fold, 1) def test_fromtimestamp_low_fold_detection(self): # Ensure that fold detection doesn't cause an # OSError for really low values, see bpo-29097 self.assertEqual(datetime.fromtimestamp(0).fold, 0) @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_timestamp(self): dt0 = datetime(2014, 11, 2, 1, 30) dt1 = dt0.replace(fold=1) self.assertEqual(dt0.timestamp() + 3600, dt1.timestamp()) @support.run_with_tz('Australia/Lord_Howe') def test_timestamp_lord_howe(self): tm = _time.localtime(1.4e9) if _time.strftime('%Z%z', tm) != 'LHST+1030': self.skipTest('Australia/Lord_Howe timezone is not supported on this platform') t = datetime(2015, 4, 5, 1, 45) s0 = t.replace(fold=0).timestamp() s1 = t.replace(fold=1).timestamp() self.assertEqual(s0 + 1800, s1) @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_astimezone(self): dt0 = datetime(2014, 11, 2, 1, 30) dt1 = dt0.replace(fold=1) # Convert both naive instances to aware. adt0 = dt0.astimezone() adt1 = dt1.astimezone() # Check that the first instance in DST zone and the second in STD self.assertEqual(adt0.tzname(), 'EDT') self.assertEqual(adt1.tzname(), 'EST') self.assertEqual(adt0 + HOUR, adt1) # Aware instances with fixed offset tzinfo's always have fold=0 self.assertEqual(adt0.fold, 0) self.assertEqual(adt1.fold, 0) def test_pickle_fold(self): t = time(fold=1) dt = datetime(1, 1, 1, fold=1) for pickler, unpickler, proto in pickle_choices: for x in [t, dt]: s = pickler.dumps(x, proto) y = unpickler.loads(s) self.assertEqual(x, y) self.assertEqual((0 if proto < 4 else x.fold), y.fold) def test_repr(self): t = time(fold=1) dt = datetime(1, 1, 1, fold=1) self.assertEqual(repr(t), 'datetime.time(0, 0, fold=1)') self.assertEqual(repr(dt), 'datetime.datetime(1, 1, 1, 0, 0, fold=1)') def test_dst(self): # Let's first establish that things work in regular times. dt_summer = datetime(2002, 10, 27, 1, tzinfo=Eastern2) - timedelta.resolution dt_winter = datetime(2002, 10, 27, 2, tzinfo=Eastern2) self.assertEqual(dt_summer.dst(), HOUR) self.assertEqual(dt_winter.dst(), ZERO) # The disambiguation flag is ignored self.assertEqual(dt_summer.replace(fold=1).dst(), HOUR) self.assertEqual(dt_winter.replace(fold=1).dst(), ZERO) # Pick local time in the fold. for minute in [0, 30, 59]: dt = datetime(2002, 10, 27, 1, minute, tzinfo=Eastern2) # With fold=0 (the default) it is in DST. self.assertEqual(dt.dst(), HOUR) # With fold=1 it is in STD. self.assertEqual(dt.replace(fold=1).dst(), ZERO) # Pick local time in the gap. for minute in [0, 30, 59]: dt = datetime(2002, 4, 7, 2, minute, tzinfo=Eastern2) # With fold=0 (the default) it is in STD. self.assertEqual(dt.dst(), ZERO) # With fold=1 it is in DST. self.assertEqual(dt.replace(fold=1).dst(), HOUR) def test_utcoffset(self): # Let's first establish that things work in regular times. dt_summer = datetime(2002, 10, 27, 1, tzinfo=Eastern2) - timedelta.resolution dt_winter = datetime(2002, 10, 27, 2, tzinfo=Eastern2) self.assertEqual(dt_summer.utcoffset(), -4 * HOUR) self.assertEqual(dt_winter.utcoffset(), -5 * HOUR) # The disambiguation flag is ignored self.assertEqual(dt_summer.replace(fold=1).utcoffset(), -4 * HOUR) self.assertEqual(dt_winter.replace(fold=1).utcoffset(), -5 * HOUR) def test_fromutc(self): # Let's first establish that things work in regular times. u_summer = datetime(2002, 10, 27, 6, tzinfo=Eastern2) - timedelta.resolution u_winter = datetime(2002, 10, 27, 7, tzinfo=Eastern2) t_summer = Eastern2.fromutc(u_summer) t_winter = Eastern2.fromutc(u_winter) self.assertEqual(t_summer, u_summer - 4 * HOUR) self.assertEqual(t_winter, u_winter - 5 * HOUR) self.assertEqual(t_summer.fold, 0) self.assertEqual(t_winter.fold, 0) # What happens in the fall-back fold? u = datetime(2002, 10, 27, 5, 30, tzinfo=Eastern2) t0 = Eastern2.fromutc(u) u += HOUR t1 = Eastern2.fromutc(u) self.assertEqual(t0, t1) self.assertEqual(t0.fold, 0) self.assertEqual(t1.fold, 1) # The tricky part is when u is in the local fold: u = datetime(2002, 10, 27, 1, 30, tzinfo=Eastern2) t = Eastern2.fromutc(u) self.assertEqual((t.day, t.hour), (26, 21)) # .. or gets into the local fold after a standard time adjustment u = datetime(2002, 10, 27, 6, 30, tzinfo=Eastern2) t = Eastern2.fromutc(u) self.assertEqual((t.day, t.hour), (27, 1)) # What happens in the spring-forward gap? u = datetime(2002, 4, 7, 2, 0, tzinfo=Eastern2) t = Eastern2.fromutc(u) self.assertEqual((t.day, t.hour), (6, 21)) def test_mixed_compare_regular(self): t = datetime(2000, 1, 1, tzinfo=Eastern2) self.assertEqual(t, t.astimezone(timezone.utc)) t = datetime(2000, 6, 1, tzinfo=Eastern2) self.assertEqual(t, t.astimezone(timezone.utc)) def test_mixed_compare_fold(self): t_fold = datetime(2002, 10, 27, 1, 45, tzinfo=Eastern2) t_fold_utc = t_fold.astimezone(timezone.utc) self.assertNotEqual(t_fold, t_fold_utc) def test_mixed_compare_gap(self): t_gap = datetime(2002, 4, 7, 2, 45, tzinfo=Eastern2) t_gap_utc = t_gap.astimezone(timezone.utc) self.assertNotEqual(t_gap, t_gap_utc) def test_hash_aware(self): t = datetime(2000, 1, 1, tzinfo=Eastern2) self.assertEqual(hash(t), hash(t.replace(fold=1))) t_fold = datetime(2002, 10, 27, 1, 45, tzinfo=Eastern2) t_gap = datetime(2002, 4, 7, 2, 45, tzinfo=Eastern2) self.assertEqual(hash(t_fold), hash(t_fold.replace(fold=1))) self.assertEqual(hash(t_gap), hash(t_gap.replace(fold=1))) SEC = timedelta(0, 1) def pairs(iterable): a, b = itertools.tee(iterable) next(b, None) return zip(a, b) class ZoneInfo(tzinfo): zoneroot = '/zip/usr/share/zoneinfo' def __init__(self, ut, ti): """ :param ut: array Array of transition point timestamps :param ti: list A list of (offset, isdst, abbr) tuples :return: None """ self.ut = ut self.ti = ti self.lt = self.invert(ut, ti) @staticmethod def invert(ut, ti): lt = (array('q', ut), array('q', ut)) if ut: offset = ti[0][0] // SEC lt[0][0] += offset lt[1][0] += offset for i in range(1, len(ut)): lt[0][i] += ti[i-1][0] // SEC lt[1][i] += ti[i][0] // SEC return lt @classmethod def fromfile(cls, fileobj): if fileobj.read(4).decode() != "TZif": raise ValueError("not a zoneinfo file") fileobj.seek(32) counts = array('i') counts.fromfile(fileobj, 3) if sys.byteorder != 'big': counts.byteswap() ut = array('i') ut.fromfile(fileobj, counts[0]) if sys.byteorder != 'big': ut.byteswap() type_indices = array('B') type_indices.fromfile(fileobj, counts[0]) ttis = [] for i in range(counts[1]): ttis.append(struct.unpack(">lbb", fileobj.read(6))) abbrs = fileobj.read(counts[2]) # Convert ttis for i, (gmtoff, isdst, abbrind) in enumerate(ttis): abbr = abbrs[abbrind:abbrs.find(0, abbrind)].decode() ttis[i] = (timedelta(0, gmtoff), isdst, abbr) ti = [None] * len(ut) for i, idx in enumerate(type_indices): ti[i] = ttis[idx] self = cls(ut, ti) return self @classmethod def fromname(cls, name): path = os.path.join(cls.zoneroot, name) with open(path, 'rb') as f: return cls.fromfile(f) EPOCHORDINAL = date(1970, 1, 1).toordinal() def fromutc(self, dt): """datetime in UTC -> datetime in local time.""" if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") timestamp = ((dt.toordinal() - self.EPOCHORDINAL) * 86400 + dt.hour * 3600 + dt.minute * 60 + dt.second) if timestamp < self.ut[1]: tti = self.ti[0] fold = 0 else: idx = bisect.bisect_right(self.ut, timestamp) assert self.ut[idx-1] <= timestamp assert idx == len(self.ut) or timestamp < self.ut[idx] tti_prev, tti = self.ti[idx-2:idx] # Detect fold shift = tti_prev[0] - tti[0] fold = (shift > timedelta(0, timestamp - self.ut[idx-1])) dt += tti[0] if fold: return dt.replace(fold=1) else: return dt def _find_ti(self, dt, i): timestamp = ((dt.toordinal() - self.EPOCHORDINAL) * 86400 + dt.hour * 3600 + dt.minute * 60 + dt.second) lt = self.lt[dt.fold] idx = bisect.bisect_right(lt, timestamp) return self.ti[max(0, idx - 1)][i] def utcoffset(self, dt): return self._find_ti(dt, 0) def dst(self, dt): isdst = self._find_ti(dt, 1) # XXX: We cannot accurately determine the "save" value, # so let's return 1h whenever DST is in effect. Since # we don't use dst() in fromutc(), it is unlikely that # it will be needed for anything more than bool(dst()). return ZERO if isdst else HOUR def tzname(self, dt): return self._find_ti(dt, 2) @classmethod def zonenames(cls, zonedir=None): if zonedir is None: zonedir = cls.zoneroot zone_tab = os.path.join(zonedir, 'zone.tab') try: f = open(zone_tab) except OSError: return with f: for line in f: line = line.strip() if line and not line.startswith('#'): yield line.split()[2] @classmethod def stats(cls, start_year=1): count = gap_count = fold_count = zeros_count = 0 min_gap = min_fold = timedelta.max max_gap = max_fold = ZERO min_gap_datetime = max_gap_datetime = datetime.min min_gap_zone = max_gap_zone = None min_fold_datetime = max_fold_datetime = datetime.min min_fold_zone = max_fold_zone = None stats_since = datetime(start_year, 1, 1) # Starting from 1970 eliminates a lot of noise for zonename in cls.zonenames(): count += 1 tz = cls.fromname(zonename) for dt, shift in tz.transitions(): if dt < stats_since: continue if shift > ZERO: gap_count += 1 if (shift, dt) > (max_gap, max_gap_datetime): max_gap = shift max_gap_zone = zonename max_gap_datetime = dt if (shift, datetime.max - dt) < (min_gap, datetime.max - min_gap_datetime): min_gap = shift min_gap_zone = zonename min_gap_datetime = dt elif shift < ZERO: fold_count += 1 shift = -shift if (shift, dt) > (max_fold, max_fold_datetime): max_fold = shift max_fold_zone = zonename max_fold_datetime = dt if (shift, datetime.max - dt) < (min_fold, datetime.max - min_fold_datetime): min_fold = shift min_fold_zone = zonename min_fold_datetime = dt else: zeros_count += 1 trans_counts = (gap_count, fold_count, zeros_count) print("Number of zones: %5d" % count) print("Number of transitions: %5d = %d (gaps) + %d (folds) + %d (zeros)" % ((sum(trans_counts),) + trans_counts)) print("Min gap: %16s at %s in %s" % (min_gap, min_gap_datetime, min_gap_zone)) print("Max gap: %16s at %s in %s" % (max_gap, max_gap_datetime, max_gap_zone)) print("Min fold: %16s at %s in %s" % (min_fold, min_fold_datetime, min_fold_zone)) print("Max fold: %16s at %s in %s" % (max_fold, max_fold_datetime, max_fold_zone)) def transitions(self): for (_, prev_ti), (t, ti) in pairs(zip(self.ut, self.ti)): shift = ti[0] - prev_ti[0] yield datetime.utcfromtimestamp(t), shift def nondst_folds(self): """Find all folds with the same value of isdst on both sides of the transition.""" for (_, prev_ti), (t, ti) in pairs(zip(self.ut, self.ti)): shift = ti[0] - prev_ti[0] if shift < ZERO and ti[1] == prev_ti[1]: yield datetime.utcfromtimestamp(t), -shift, prev_ti[2], ti[2] @classmethod def print_all_nondst_folds(cls, same_abbr=False, start_year=1): count = 0 for zonename in cls.zonenames(): tz = cls.fromname(zonename) for dt, shift, prev_abbr, abbr in tz.nondst_folds(): if dt.year < start_year or same_abbr and prev_abbr != abbr: continue count += 1 print("%3d) %-30s %s %10s %5s -> %s" % (count, zonename, dt, shift, prev_abbr, abbr)) def folds(self): for t, shift in self.transitions(): if shift < ZERO: yield t, -shift def gaps(self): for t, shift in self.transitions(): if shift > ZERO: yield t, shift def zeros(self): for t, shift in self.transitions(): if not shift: yield t class ZoneInfoTest(unittest.TestCase): zonename = 'America/New_York' def setUp(self): if sys.platform == "win32": self.skipTest("Skipping zoneinfo tests on Windows") try: self.tz = ZoneInfo.fromname(self.zonename) except FileNotFoundError as err: self.skipTest("Skipping %s: %s" % (self.zonename, err)) def assertEquivDatetimes(self, a, b): self.assertEqual((a.replace(tzinfo=None), a.fold, id(a.tzinfo)), (b.replace(tzinfo=None), b.fold, id(b.tzinfo))) def test_folds(self): tz = self.tz for dt, shift in tz.folds(): for x in [0 * shift, 0.5 * shift, shift - timedelta.resolution]: udt = dt + x ldt = tz.fromutc(udt.replace(tzinfo=tz)) self.assertEqual(ldt.fold, 1) adt = udt.replace(tzinfo=timezone.utc).astimezone(tz) self.assertEquivDatetimes(adt, ldt) utcoffset = ldt.utcoffset() self.assertEqual(ldt.replace(tzinfo=None), udt + utcoffset) # Round trip self.assertEquivDatetimes(ldt.astimezone(timezone.utc), udt.replace(tzinfo=timezone.utc)) for x in [-timedelta.resolution, shift]: udt = dt + x udt = udt.replace(tzinfo=tz) ldt = tz.fromutc(udt) self.assertEqual(ldt.fold, 0) def test_gaps(self): tz = self.tz for dt, shift in tz.gaps(): for x in [0 * shift, 0.5 * shift, shift - timedelta.resolution]: udt = dt + x udt = udt.replace(tzinfo=tz) ldt = tz.fromutc(udt) self.assertEqual(ldt.fold, 0) adt = udt.replace(tzinfo=timezone.utc).astimezone(tz) self.assertEquivDatetimes(adt, ldt) utcoffset = ldt.utcoffset() self.assertEqual(ldt.replace(tzinfo=None), udt.replace(tzinfo=None) + utcoffset) # Create a local time inside the gap ldt = tz.fromutc(dt.replace(tzinfo=tz)) - shift + x self.assertLess(ldt.replace(fold=1).utcoffset(), ldt.replace(fold=0).utcoffset(), "At %s." % ldt) for x in [-timedelta.resolution, shift]: udt = dt + x ldt = tz.fromutc(udt.replace(tzinfo=tz)) self.assertEqual(ldt.fold, 0) @unittest.skip def test_system_transitions(self): if ('Riyadh8' in self.zonename or # From tzdata NEWS file: # The files solar87, solar88, and solar89 are no longer distributed. # They were a negative experiment - that is, a demonstration that # tz data can represent solar time only with some difficulty and error. # Their presence in the distribution caused confusion, as Riyadh # civil time was generally not solar time in those years. self.zonename.startswith('right/')): self.skipTest("Skipping %s" % self.zonename) tz = self.tz TZ = os.environ.get('TZ') os.environ['TZ'] = self.zonename try: _time.tzset() for udt, shift in tz.transitions(): if udt.year >= 2037: # System support for times around the end of 32-bit time_t # and later is flaky on many systems. break s0 = (udt - datetime(1970, 1, 1)) // SEC ss = shift // SEC # shift seconds for x in [-40 * 3600, -20*3600, -1, 0, ss - 1, ss + 20 * 3600, ss + 40 * 3600]: s = s0 + x sdt = datetime.fromtimestamp(s) tzdt = datetime.fromtimestamp(s, tz).replace(tzinfo=None) self.assertEquivDatetimes(sdt, tzdt) s1 = sdt.timestamp() self.assertEqual(s, s1) if ss > 0: # gap # Create local time inside the gap dt = datetime.fromtimestamp(s0) - shift / 2 ts0 = dt.timestamp() ts1 = dt.replace(fold=1).timestamp() self.assertEqual(ts0, s0 + ss / 2) self.assertEqual(ts1, s0 - ss / 2) finally: if TZ is None: del os.environ['TZ'] else: os.environ['TZ'] = TZ _time.tzset() @unittest.skip class ZoneInfoCompleteTest(unittest.TestSuite): def __init__(self): tests = [] if is_resource_enabled('tzdata'): for name in ZoneInfo.zonenames(): Test = type('ZoneInfoTest[%s]' % name, (ZoneInfoTest,), {}) Test.zonename = name for method in dir(Test): if method.startswith('test_'): tests.append(Test(method)) super().__init__(tests) # Iran had a sub-minute UTC offset before 1946. class IranTest(ZoneInfoTest): zonename = 'Asia/Tehran' def load_tests(loader, standard_tests, pattern): standard_tests.addTest(ZoneInfoCompleteTest()) return standard_tests if __name__ == "__main__": unittest.main()
201,562
5,081
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/keycert4.pem
-----BEGIN PRIVATE KEY----- MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQDGjpiHzq7ghxhM ZzrnRsGBC/cmw8EREIdbqlrz/l8BFaWeipvO5Hb/MyU8xs2zLUrqIr2JNf+Eii8Y m4bYmZclFra4jomaiSlxTZOe3dMV8m4vAq4eT2mSfZZC1+XAutqdz7WhHxhMVEm3 AyTWvTC3qCbnlbX5VIoQUwFrsSWqDiHyaGdK3rrOTKFUKM8YPiq/BZkm6A4eiFci 5wd/SPD+w0pIscZbQW1MUr5bs54uylWaUmtfI8KJt6BDZQ/uA06c6i863sSCEI6L gq+wyikeJGNMxZMfgu3dzfv4BiZBQX0ZhiRvqseDSdPcuVa2Ifb6CFlg298neweY 4EAIE1O+uqo5h8FF1aUOMZpQEZuzsp9R/TAMBHX1YmVjG/kRdBeaHe3whzB1Pfue PIX2ZTMmLNYbYbfnmxhk1nn8aAvoT98pNw8y3/2k2KNsu24n9uSkkxAoqJ19WKwm mL8MpJKAzLv45tRvhN+QLtnRdu+LJ9m29npQHFmYLbdqRfmidnMCAwEAAQKCAYBd w1C8MRnb5W/QBJ+IP515NxFLOP2e9VM2MkgpGGH8vSAssf/Jv5GCCcD35lmU1zqd PjKK7PjwueBrmmYfOshpN0Sp+oV4eHUdkCi5yL65inYFtRpMLewIxU2D2zgfvx0l kMSQhYKP6O22gsGOtmCfGcTlb4kzaHyaINh25nyGxY26TxsX+/3zFbTJbUv+grzk 39vmx4aDXJbpYHfl36gOZmJZ2bl1tnvKovhJjZSRO/MYoPsbPmPLbO89ZCgVmXFc GVkb5Cram6i3iyutSDjxWN7Fb8uy8pFLPGAXZgF7pQoXPSEHZe8GEWBnWSC9KaDa uM9Ir847/Muy1ceCmxKcI2WrSjoH2AhPcmHgvbPE9Mynr6+uzReSP3q7Wh9PHm23 oFx3DwdCfmjysnpAMBawNmJdWyxVDbZ6eyrhp17ADpsMaDTynZ+fJjgMr+MmWtbU YSRD0wWtl/DrzsaePZsOjCpKYJyulC+rh9/Zz1aiwrGWPbgEAzDrD6Q1Zp0mUCEC gcEA+XskmGIB9rRPy+YQmRgzQ555PsjLWsnQsNktP6KBhlQjFKJZXRZ0DxDTS7h8 NrJrUDBmwfsgzggVbeO55VP5FGwD6DNeO/Bz++Fdevh8uKQFHDfk4sbIUPS91qw4 s7OW7PR7C7Jf7Dnjmsn42o2lO4FsbcEn2F+PHOvoLl/OrSx73lS/RkdOEItW8d8/ ExRohylnba/I2vCE9bNZd4DGjMW87j/THKPadDZWEqWggcrjY8x6ibSQGm2n2Tka 8B+vAoHBAMu+zl8kqFlYDG24dGfVpMaOYj5Osj0cV5f7O2pZ15sCevjiqoKGHH7G O8EiI5pRBZ893+Fsx6YWmcKue88lfGvaoQjV0LUbfMfX/FoD39w/ZLx31yKEiFuc KvMiRV5mO3kQiHBVX9vamzr5NeaErccXY9LnhaKOMX9blgiDQZH7fc3RhodcFWrC 9yfX6ryfidpPnRvK7Ops7hVnFKyyS4FaAarnzH1B2WcVcD4lYYxhMc8VXeU3eKOh j1fI/F5ifQKBwQDpCjB670HqUzAexL9IYqSwSz3yedoK6m24ZIWx5XicI8fJJIXZ QHoVAKB/IMtWxH8dnri+Bnj0O/TYe1pQb4pBm0xjAGjMEKYm6LNLhQXr67qiS0vQ 0eKYTKVv+9vTcLRQj2bI3Exh+wkys+tzK9DmrtS8CSvRICIs3+g4OWJzvRPP8NXj LgQrzBzhPqpKhkvFxdVJTmSOrxFj+a5exLmzEZqT6qanIB+VYpQwQuqVkxGpTX5B V5ssNLYPYRpapx0CgcByCtQixzcAA1u5knR9pkT76ris3YnA0Ptqk3I3XiBjoGjK pL0CICUVBMpvmTdKai12a8DDwgqiOaZJJTchxH63NAHNGzkeFkuq5IdYrzB/bHBr WbzukjZs6KXVv4oKg7ioVAu6rN7iBaO7x8BWzk8i0EHMzFCto1+rRM1e6HEsUBOj v7LIU0+dmZGUGLRIbhhQPR3Yb6ZatSwyiKc23vmKZqHmUqbQOaqBm6te7beDRugF XJVY9sqs9IJyhYpVHlUCgcAPoslwYKeAXagsxdQrH3D9VJDXVOHWKMBqQZDio5dB Q80uWpuxtt6nhZkQO1JIWnYb6v+zbDbcgjByBIDuxCdBW9d+QQnanKmVyrXguK91 C3OcHHOmSduFdWC3/zYW1mW97Tz1sXyam2hly1u3L5kW+GnE1hr9VVPjQNrO9+Ge qW0coaJqKY78q3Rm2dtyZeJSFFI1o/DQ3blyItsFpg/QrR+a5XrS6Nw2ZLIL4Azo J1CTgMwjhwlMNCI4t4dkHd0= -----END PRIVATE KEY----- Certificate: Data: Version: 3 (0x2) Serial Number: cb:2d:80:99:5a:69:52:5d Signature Algorithm: sha256WithRSAEncryption Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server Validity Not Before: Aug 29 14:23:16 2018 GMT Not After : Jul 7 14:23:16 2028 GMT Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=fakehostname Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (3072 bit) Modulus: 00:c6:8e:98:87:ce:ae:e0:87:18:4c:67:3a:e7:46: c1:81:0b:f7:26:c3:c1:11:10:87:5b:aa:5a:f3:fe: 5f:01:15:a5:9e:8a:9b:ce:e4:76:ff:33:25:3c:c6: cd:b3:2d:4a:ea:22:bd:89:35:ff:84:8a:2f:18:9b: 86:d8:99:97:25:16:b6:b8:8e:89:9a:89:29:71:4d: 93:9e:dd:d3:15:f2:6e:2f:02:ae:1e:4f:69:92:7d: 96:42:d7:e5:c0:ba:da:9d:cf:b5:a1:1f:18:4c:54: 49:b7:03:24:d6:bd:30:b7:a8:26:e7:95:b5:f9:54: 8a:10:53:01:6b:b1:25:aa:0e:21:f2:68:67:4a:de: ba:ce:4c:a1:54:28:cf:18:3e:2a:bf:05:99:26:e8: 0e:1e:88:57:22:e7:07:7f:48:f0:fe:c3:4a:48:b1: c6:5b:41:6d:4c:52:be:5b:b3:9e:2e:ca:55:9a:52: 6b:5f:23:c2:89:b7:a0:43:65:0f:ee:03:4e:9c:ea: 2f:3a:de:c4:82:10:8e:8b:82:af:b0:ca:29:1e:24: 63:4c:c5:93:1f:82:ed:dd:cd:fb:f8:06:26:41:41: 7d:19:86:24:6f:aa:c7:83:49:d3:dc:b9:56:b6:21: f6:fa:08:59:60:db:df:27:7b:07:98:e0:40:08:13: 53:be:ba:aa:39:87:c1:45:d5:a5:0e:31:9a:50:11: 9b:b3:b2:9f:51:fd:30:0c:04:75:f5:62:65:63:1b: f9:11:74:17:9a:1d:ed:f0:87:30:75:3d:fb:9e:3c: 85:f6:65:33:26:2c:d6:1b:61:b7:e7:9b:18:64:d6: 79:fc:68:0b:e8:4f:df:29:37:0f:32:df:fd:a4:d8: a3:6c:bb:6e:27:f6:e4:a4:93:10:28:a8:9d:7d:58: ac:26:98:bf:0c:a4:92:80:cc:bb:f8:e6:d4:6f:84: df:90:2e:d9:d1:76:ef:8b:27:d9:b6:f6:7a:50:1c: 59:98:2d:b7:6a:45:f9:a2:76:73 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Alternative Name: DNS:fakehostname X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Server Authentication, TLS Web Client Authentication X509v3 Basic Constraints: critical CA:FALSE X509v3 Subject Key Identifier: 52:E0:93:AA:52:55:B7:BB:E7:A8:E0:8C:DE:41:2E:F4:07:F0:36:FB X509v3 Authority Key Identifier: keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48 DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server serial:CB:2D:80:99:5A:69:52:5B Authority Information Access: CA Issuers - URI:http://testca.pythontest.net/testca/pycacert.cer OCSP - URI:http://testca.pythontest.net/testca/ocsp/ X509v3 CRL Distribution Points: Full Name: URI:http://testca.pythontest.net/testca/revocation.crl Signature Algorithm: sha256WithRSAEncryption 29:d2:3f:82:3f:c1:38:35:a6:bd:81:10:fe:64:ec:ff:7e:e1: c6:6f:7f:86:65:f9:31:6f:fb:ef:32:4e:2f:87:c8:42:de:6c: 8d:b8:06:08:8f:37:70:95:7d:e1:40:d4:82:2b:8d:b3:4a:fd: 34:c5:9e:df:ff:01:53:4a:4f:08:f4:58:e1:74:fc:78:e3:3e: 71:a7:5e:66:07:ea:d2:04:31:e2:75:a8:4c:80:17:86:92:20: d2:32:a7:9a:65:8b:1a:5f:f1:4c:c8:50:6d:00:fc:99:bf:69: b3:48:f3:45:5a:ee:35:50:14:b8:f3:92:92:c6:9f:0e:5d:eb: 0d:e8:ec:f2:a4:09:6b:dc:66:2b:fc:df:4c:fc:65:a1:ae:d3: b5:88:6a:a4:e7:08:1c:94:49:e0:b8:c1:04:8c:21:09:6c:55: 4b:2c:97:10:f1:8c:6c:d0:bb:ba:8d:93:e8:47:8b:4d:8e:7d: 7d:85:53:18:c8:f8:f4:8f:67:3a:b1:aa:3e:18:34:6c:3a:e6: a6:c7:2f:be:83:38:f5:d5:e5:d2:17:28:61:6c:b6:49:99:21: 69:a4:a8:b6:94:76:fd:18:ad:35:52:45:64:fb:f1:5d:8e:bb: c0:21:2e:59:55:24:af:bb:8f:b2:0a:7b:17:f0:34:97:8e:68: a9:f2:d0:3e:f6:73:82:f8:7c:4e:9a:70:7d:d6:b3:8c:cc:85: 04:5c:02:8f:74:da:88:3a:20:a8:7e:c2:9e:b0:dd:56:1f:ce: cd:42:16:c6:14:91:ad:30:e0:dc:76:f2:2c:56:ea:38:45:d8: c0:3e:b8:90:fa:f3:38:99:ec:44:07:35:8f:69:62:0c:f9:ef: b7:9d:e5:15:42:6e:fb:fe:4c:ff:e8:94:5a:1a:b0:80:b2:0e: 17:3d:e1:87:a8:08:84:93:74:68:8d:29:df:ca:0b:6a:44:32: 8a:51:3b:d6:38:db:bd:e3:2a:1b:5e:20:48:81:82:19:91:c6: 87:8c:0f:cd:51:ea -----BEGIN CERTIFICATE----- MIIF9zCCBF+gAwIBAgIJAMstgJlaaVJdMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA3MDcx NDIzMTZaMGIxCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xFTATBgNVBAMMDGZh a2Vob3N0bmFtZTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMaOmIfO ruCHGExnOudGwYEL9ybDwREQh1uqWvP+XwEVpZ6Km87kdv8zJTzGzbMtSuoivYk1 /4SKLxibhtiZlyUWtriOiZqJKXFNk57d0xXybi8Crh5PaZJ9lkLX5cC62p3PtaEf GExUSbcDJNa9MLeoJueVtflUihBTAWuxJaoOIfJoZ0reus5MoVQozxg+Kr8FmSbo Dh6IVyLnB39I8P7DSkixxltBbUxSvluzni7KVZpSa18jwom3oENlD+4DTpzqLzre xIIQjouCr7DKKR4kY0zFkx+C7d3N+/gGJkFBfRmGJG+qx4NJ09y5VrYh9voIWWDb 3yd7B5jgQAgTU766qjmHwUXVpQ4xmlARm7Oyn1H9MAwEdfViZWMb+RF0F5od7fCH MHU9+548hfZlMyYs1htht+ebGGTWefxoC+hP3yk3DzLf/aTYo2y7bif25KSTECio nX1YrCaYvwykkoDMu/jm1G+E35Au2dF274sn2bb2elAcWZgtt2pF+aJ2cwIDAQAB o4IBwzCCAb8wFwYDVR0RBBAwDoIMZmFrZWhvc3RuYW1lMA4GA1UdDwEB/wQEAwIF oDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAd BgNVHQ4EFgQUUuCTqlJVt7vnqOCM3kEu9AfwNvswfQYDVR0jBHYwdIAU3b/K2ubR NLo3dSHKb5oIKPI1tkihUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRo b24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZl coIJAMstgJlaaVJbMIGDBggrBgEFBQcBAQR3MHUwPAYIKwYBBQUHMAKGMGh0dHA6 Ly90ZXN0Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3B5Y2FjZXJ0LmNlcjA1Bggr BgEFBQcwAYYpaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0Y2Evb2Nz cC8wQwYDVR0fBDwwOjA4oDagNIYyaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5l dC90ZXN0Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBACnSP4I/ wTg1pr2BEP5k7P9+4cZvf4Zl+TFv++8yTi+HyELebI24BgiPN3CVfeFA1IIrjbNK /TTFnt//AVNKTwj0WOF0/HjjPnGnXmYH6tIEMeJ1qEyAF4aSINIyp5plixpf8UzI UG0A/Jm/abNI80Va7jVQFLjzkpLGnw5d6w3o7PKkCWvcZiv830z8ZaGu07WIaqTn CByUSeC4wQSMIQlsVUsslxDxjGzQu7qNk+hHi02OfX2FUxjI+PSPZzqxqj4YNGw6 5qbHL76DOPXV5dIXKGFstkmZIWmkqLaUdv0YrTVSRWT78V2Ou8AhLllVJK+7j7IK exfwNJeOaKny0D72c4L4fE6acH3Ws4zMhQRcAo902og6IKh+wp6w3VYfzs1CFsYU ka0w4Nx28ixW6jhF2MA+uJD68ziZ7EQHNY9pYgz577ed5RVCbvv+TP/olFoasICy Dhc94YeoCISTdGiNKd/KC2pEMopRO9Y4273jKhteIEiBghmRxoeMD81R6g== -----END CERTIFICATE-----
9,454
165
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test__locale.py
from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, localeconv, Error) try: from _locale import (RADIXCHAR, THOUSEP, nl_langinfo) except ImportError: nl_langinfo = None import locale import sys import unittest from platform import uname if uname().system == "Darwin": maj, min, mic = [int(part) for part in uname().release.split(".")] if (maj, min, mic) < (8, 0, 0): raise unittest.SkipTest("locale support broken for OS X < 10.4") candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT', 'et_EE', 'es_PY', 'no_NO', 'nl_NL', 'lv_LV', 'el_GR', 'be_BY', 'fr_BE', 'ro_RO', 'ru_UA', 'ru_RU', 'es_VE', 'ca_ES', 'se_NO', 'es_EC', 'id_ID', 'ka_GE', 'es_CL', 'wa_BE', 'hu_HU', 'lt_LT', 'sl_SI', 'hr_HR', 'es_AR', 'es_ES', 'oc_FR', 'gl_ES', 'bg_BG', 'is_IS', 'mk_MK', 'de_AT', 'pt_BR', 'da_DK', 'nn_NO', 'cs_CZ', 'de_LU', 'es_BO', 'sq_AL', 'sk_SK', 'fr_CH', 'de_DE', 'sr_YU', 'br_FR', 'nl_BE', 'sv_FI', 'pl_PL', 'fr_CA', 'fo_FO', 'bs_BA', 'fr_LU', 'kl_GL', 'fa_IR', 'de_BE', 'sv_SE', 'it_CH', 'uk_UA', 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'ps_AF', 'en_US', 'fr_FR.ISO8859-1', 'fr_FR.UTF-8', 'fr_FR.ISO8859-15@euro', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] def setUpModule(): global candidate_locales # Issue #13441: Skip some locales (e.g. cs_CZ and hu_HU) on Solaris to # workaround a mbstowcs() bug. For example, on Solaris, the hu_HU locale uses # the locale encoding ISO-8859-2, the thousauds separator is b'\xA0' and it is # decoded as U+30000020 (an invalid character) by mbstowcs(). if sys.platform == 'sunos5': old_locale = locale.setlocale(locale.LC_ALL) try: locales = [] for loc in candidate_locales: try: locale.setlocale(locale.LC_ALL, loc) except Error: continue encoding = locale.getpreferredencoding(False) try: localeconv() except Exception as err: print("WARNING: Skip locale %s (encoding %s): [%s] %s" % (loc, encoding, type(err), err)) else: locales.append(loc) candidate_locales = locales finally: locale.setlocale(locale.LC_ALL, old_locale) # Workaround for MSVC6(debug) crash bug if "MSC v.1200" in sys.version: def accept(loc): a = loc.split(".") return not(len(a) == 2 and len(a[-1]) >= 9) candidate_locales = [loc for loc in candidate_locales if accept(loc)] # List known locale values to test against when available. # Dict formatted as ``<locale> : (<decimal_point>, <thousands_sep>)``. If a # value is not known, use '' . known_numerics = { 'en_US': ('.', ','), 'de_DE' : (',', '.'), # The French thousands separator may be a breaking or non-breaking space # depending on the platform, so do not test it 'fr_FR' : (',', ''), 'ps_AF': ('\u066b', '\u066c'), } class _LocaleTests(unittest.TestCase): def setUp(self): self.oldlocale = setlocale(LC_ALL) def tearDown(self): setlocale(LC_ALL, self.oldlocale) # Want to know what value was calculated, what it was compared against, # what function was used for the calculation, what type of data was used, # the locale that was supposedly set, and the actual locale that is set. lc_numeric_err_msg = "%s != %s (%s for %s; set to %s, using %s)" def numeric_tester(self, calc_type, calc_value, data_type, used_locale): """Compare calculation against known value, if available""" try: set_locale = setlocale(LC_NUMERIC) except Error: set_locale = "<not able to determine>" known_value = known_numerics.get(used_locale, ('', ''))[data_type == 'thousands_sep'] if known_value and calc_value: self.assertEqual(calc_value, known_value, self.lc_numeric_err_msg % ( calc_value, known_value, calc_type, data_type, set_locale, used_locale)) return True @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_nl_langinfo(self): # Test nl_langinfo against known values tested = False for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) setlocale(LC_CTYPE, loc) except Error: continue for li, lc in ((RADIXCHAR, "decimal_point"), (THOUSEP, "thousands_sep")): if self.numeric_tester('nl_langinfo', nl_langinfo(li), lc, loc): tested = True if not tested: self.skipTest('no suitable locales') def test_lc_numeric_localeconv(self): # Test localeconv against known values tested = False for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) setlocale(LC_CTYPE, loc) except Error: continue formatting = localeconv() for lc in ("decimal_point", "thousands_sep"): if self.numeric_tester('localeconv', formatting[lc], lc, loc): tested = True if not tested: self.skipTest('no suitable locales') @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_basic(self): # Test nl_langinfo against localeconv tested = False for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) setlocale(LC_CTYPE, loc) except Error: continue for li, lc in ((RADIXCHAR, "decimal_point"), (THOUSEP, "thousands_sep")): nl_radixchar = nl_langinfo(li) li_radixchar = localeconv()[lc] try: set_locale = setlocale(LC_NUMERIC) except Error: set_locale = "<not able to determine>" self.assertEqual(nl_radixchar, li_radixchar, "%s (nl_langinfo) != %s (localeconv) " "(set to %s, using %s)" % ( nl_radixchar, li_radixchar, loc, set_locale)) tested = True if not tested: self.skipTest('no suitable locales') def test_float_parsing(self): # Bug #1391872: Test whether float parsing is okay on European # locales. tested = False for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) setlocale(LC_CTYPE, loc) except Error: continue # Ignore buggy locale databases. (Mac OS 10.4 and some other BSDs) if loc == 'eu_ES' and localeconv()['decimal_point'] == "' ": continue self.assertEqual(int(eval('3.14') * 100), 314, "using eval('3.14') failed for %s" % loc) self.assertEqual(int(float('3.14') * 100), 314, "using float('3.14') failed for %s" % loc) if localeconv()['decimal_point'] != '.': self.assertRaises(ValueError, float, localeconv()['decimal_point'].join(['1', '23'])) tested = True if not tested: self.skipTest('no suitable locales') if __name__ == '__main__': unittest.main()
7,895
194
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_tokenize.py
from test import support from tokenize import (tokenize, _tokenize, untokenize, NUMBER, NAME, OP, STRING, ENDMARKER, ENCODING, tok_name, detect_encoding, open as tokenize_open, Untokenizer, generate_tokens, NEWLINE) from io import BytesIO import unittest from unittest import TestCase, mock from test.test_grammar import (VALID_UNDERSCORE_LITERALS, INVALID_UNDERSCORE_LITERALS) import os import token # Converts a source string into a list of textual representation # of the tokens such as: # ` NAME 'if' (1, 0) (1, 2)` # to make writing tests easier. def stringify_tokens_from_source(token_generator, source_string): result = [] num_lines = len(source_string.splitlines()) missing_trailing_nl = source_string[-1] not in '\r\n' for type, token, start, end, line in token_generator: if type == ENDMARKER: break # Ignore the new line on the last line if the input lacks one if missing_trailing_nl and type == NEWLINE and end[0] == num_lines: continue type = tok_name[type] result.append(f" {type:10} {token!r:13} {start} {end}") return result class TokenizeTest(TestCase): # Tests for the tokenize module. # The tests can be really simple. Given a small fragment of source # code, print out a table with tokens. The ENDMARKER, ENCODING and # final NEWLINE are omitted for brevity. def check_tokenize(self, s, expected): # Format the tokens in s in a table format. # The ENDMARKER and final NEWLINE are omitted. f = BytesIO(s.encode('utf-8')) result = stringify_tokens_from_source(tokenize(f.readline), s) self.assertEqual(result, [" ENCODING 'utf-8' (0, 0) (0, 0)"] + expected.rstrip().splitlines()) def test_implicit_newline(self): # Make sure that the tokenizer puts in an implicit NEWLINE # when the input lacks a trailing new line. f = BytesIO("x".encode('utf-8')) tokens = list(tokenize(f.readline)) self.assertEqual(tokens[-2].type, NEWLINE) self.assertEqual(tokens[-1].type, ENDMARKER) def test_basic(self): self.check_tokenize("1 + 1", """\ NUMBER '1' (1, 0) (1, 1) OP '+' (1, 2) (1, 3) NUMBER '1' (1, 4) (1, 5) """) self.check_tokenize("if False:\n" " # NL\n" " True = False # NEWLINE\n", """\ NAME 'if' (1, 0) (1, 2) NAME 'False' (1, 3) (1, 8) OP ':' (1, 8) (1, 9) NEWLINE '\\n' (1, 9) (1, 10) COMMENT '# NL' (2, 4) (2, 8) NL '\\n' (2, 8) (2, 9) INDENT ' ' (3, 0) (3, 4) NAME 'True' (3, 4) (3, 8) OP '=' (3, 9) (3, 10) NAME 'False' (3, 11) (3, 16) COMMENT '# NEWLINE' (3, 17) (3, 26) NEWLINE '\\n' (3, 26) (3, 27) DEDENT '' (4, 0) (4, 0) """) indent_error_file = b"""\ def k(x): x += 2 x += 5 """ readline = BytesIO(indent_error_file).readline with self.assertRaisesRegex(IndentationError, "unindent does not match any " "outer indentation level"): for tok in tokenize(readline): pass def test_int(self): # Ordinary integers and binary operators self.check_tokenize("0xff <= 255", """\ NUMBER '0xff' (1, 0) (1, 4) OP '<=' (1, 5) (1, 7) NUMBER '255' (1, 8) (1, 11) """) self.check_tokenize("0b10 <= 255", """\ NUMBER '0b10' (1, 0) (1, 4) OP '<=' (1, 5) (1, 7) NUMBER '255' (1, 8) (1, 11) """) self.check_tokenize("0o123 <= 0O123", """\ NUMBER '0o123' (1, 0) (1, 5) OP '<=' (1, 6) (1, 8) NUMBER '0O123' (1, 9) (1, 14) """) self.check_tokenize("1234567 > ~0x15", """\ NUMBER '1234567' (1, 0) (1, 7) OP '>' (1, 8) (1, 9) OP '~' (1, 10) (1, 11) NUMBER '0x15' (1, 11) (1, 15) """) self.check_tokenize("2134568 != 1231515", """\ NUMBER '2134568' (1, 0) (1, 7) OP '!=' (1, 8) (1, 10) NUMBER '1231515' (1, 11) (1, 18) """) self.check_tokenize("(-124561-1) & 200000000", """\ OP '(' (1, 0) (1, 1) OP '-' (1, 1) (1, 2) NUMBER '124561' (1, 2) (1, 8) OP '-' (1, 8) (1, 9) NUMBER '1' (1, 9) (1, 10) OP ')' (1, 10) (1, 11) OP '&' (1, 12) (1, 13) NUMBER '200000000' (1, 14) (1, 23) """) self.check_tokenize("0xdeadbeef != -1", """\ NUMBER '0xdeadbeef' (1, 0) (1, 10) OP '!=' (1, 11) (1, 13) OP '-' (1, 14) (1, 15) NUMBER '1' (1, 15) (1, 16) """) self.check_tokenize("0xdeadc0de & 12345", """\ NUMBER '0xdeadc0de' (1, 0) (1, 10) OP '&' (1, 11) (1, 12) NUMBER '12345' (1, 13) (1, 18) """) self.check_tokenize("0xFF & 0x15 | 1234", """\ NUMBER '0xFF' (1, 0) (1, 4) OP '&' (1, 5) (1, 6) NUMBER '0x15' (1, 7) (1, 11) OP '|' (1, 12) (1, 13) NUMBER '1234' (1, 14) (1, 18) """) def test_long(self): # Long integers self.check_tokenize("x = 0", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '0' (1, 4) (1, 5) """) self.check_tokenize("x = 0xfffffffffff", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '0xfffffffffff' (1, 4) (1, 17) """) self.check_tokenize("x = 123141242151251616110", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '123141242151251616110' (1, 4) (1, 25) """) self.check_tokenize("x = -15921590215012591", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) OP '-' (1, 4) (1, 5) NUMBER '15921590215012591' (1, 5) (1, 22) """) def test_float(self): # Floating point numbers self.check_tokenize("x = 3.14159", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '3.14159' (1, 4) (1, 11) """) self.check_tokenize("x = 314159.", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '314159.' (1, 4) (1, 11) """) self.check_tokenize("x = .314159", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '.314159' (1, 4) (1, 11) """) self.check_tokenize("x = 3e14159", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '3e14159' (1, 4) (1, 11) """) self.check_tokenize("x = 3E123", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '3E123' (1, 4) (1, 9) """) self.check_tokenize("x+y = 3e-1230", """\ NAME 'x' (1, 0) (1, 1) OP '+' (1, 1) (1, 2) NAME 'y' (1, 2) (1, 3) OP '=' (1, 4) (1, 5) NUMBER '3e-1230' (1, 6) (1, 13) """) self.check_tokenize("x = 3.14e159", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '3.14e159' (1, 4) (1, 12) """) def test_underscore_literals(self): def number_token(s): f = BytesIO(s.encode('utf-8')) for toktype, token, start, end, line in tokenize(f.readline): if toktype == NUMBER: return token return 'invalid token' for lit in VALID_UNDERSCORE_LITERALS: if '(' in lit: # this won't work with compound complex inputs continue self.assertEqual(number_token(lit), lit) for lit in INVALID_UNDERSCORE_LITERALS: self.assertNotEqual(number_token(lit), lit) def test_string(self): # String literals self.check_tokenize("x = ''; y = \"\"", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING "''" (1, 4) (1, 6) OP ';' (1, 6) (1, 7) NAME 'y' (1, 8) (1, 9) OP '=' (1, 10) (1, 11) STRING '""' (1, 12) (1, 14) """) self.check_tokenize("x = '\"'; y = \"'\"", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING '\\'"\\'' (1, 4) (1, 7) OP ';' (1, 7) (1, 8) NAME 'y' (1, 9) (1, 10) OP '=' (1, 11) (1, 12) STRING '"\\'"' (1, 13) (1, 16) """) self.check_tokenize("x = \"doesn't \"shrink\", does it\"", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING '"doesn\\'t "' (1, 4) (1, 14) NAME 'shrink' (1, 14) (1, 20) STRING '", does it"' (1, 20) (1, 31) """) self.check_tokenize("x = 'abc' + 'ABC'", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING "'abc'" (1, 4) (1, 9) OP '+' (1, 10) (1, 11) STRING "'ABC'" (1, 12) (1, 17) """) self.check_tokenize('y = "ABC" + "ABC"', """\ NAME 'y' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING '"ABC"' (1, 4) (1, 9) OP '+' (1, 10) (1, 11) STRING '"ABC"' (1, 12) (1, 17) """) self.check_tokenize("x = r'abc' + r'ABC' + R'ABC' + R'ABC'", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING "r'abc'" (1, 4) (1, 10) OP '+' (1, 11) (1, 12) STRING "r'ABC'" (1, 13) (1, 19) OP '+' (1, 20) (1, 21) STRING "R'ABC'" (1, 22) (1, 28) OP '+' (1, 29) (1, 30) STRING "R'ABC'" (1, 31) (1, 37) """) self.check_tokenize('y = r"abc" + r"ABC" + R"ABC" + R"ABC"', """\ NAME 'y' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) STRING 'r"abc"' (1, 4) (1, 10) OP '+' (1, 11) (1, 12) STRING 'r"ABC"' (1, 13) (1, 19) OP '+' (1, 20) (1, 21) STRING 'R"ABC"' (1, 22) (1, 28) OP '+' (1, 29) (1, 30) STRING 'R"ABC"' (1, 31) (1, 37) """) self.check_tokenize("u'abc' + U'abc'", """\ STRING "u'abc'" (1, 0) (1, 6) OP '+' (1, 7) (1, 8) STRING "U'abc'" (1, 9) (1, 15) """) self.check_tokenize('u"abc" + U"abc"', """\ STRING 'u"abc"' (1, 0) (1, 6) OP '+' (1, 7) (1, 8) STRING 'U"abc"' (1, 9) (1, 15) """) self.check_tokenize("b'abc' + B'abc'", """\ STRING "b'abc'" (1, 0) (1, 6) OP '+' (1, 7) (1, 8) STRING "B'abc'" (1, 9) (1, 15) """) self.check_tokenize('b"abc" + B"abc"', """\ STRING 'b"abc"' (1, 0) (1, 6) OP '+' (1, 7) (1, 8) STRING 'B"abc"' (1, 9) (1, 15) """) self.check_tokenize("br'abc' + bR'abc' + Br'abc' + BR'abc'", """\ STRING "br'abc'" (1, 0) (1, 7) OP '+' (1, 8) (1, 9) STRING "bR'abc'" (1, 10) (1, 17) OP '+' (1, 18) (1, 19) STRING "Br'abc'" (1, 20) (1, 27) OP '+' (1, 28) (1, 29) STRING "BR'abc'" (1, 30) (1, 37) """) self.check_tokenize('br"abc" + bR"abc" + Br"abc" + BR"abc"', """\ STRING 'br"abc"' (1, 0) (1, 7) OP '+' (1, 8) (1, 9) STRING 'bR"abc"' (1, 10) (1, 17) OP '+' (1, 18) (1, 19) STRING 'Br"abc"' (1, 20) (1, 27) OP '+' (1, 28) (1, 29) STRING 'BR"abc"' (1, 30) (1, 37) """) self.check_tokenize("rb'abc' + rB'abc' + Rb'abc' + RB'abc'", """\ STRING "rb'abc'" (1, 0) (1, 7) OP '+' (1, 8) (1, 9) STRING "rB'abc'" (1, 10) (1, 17) OP '+' (1, 18) (1, 19) STRING "Rb'abc'" (1, 20) (1, 27) OP '+' (1, 28) (1, 29) STRING "RB'abc'" (1, 30) (1, 37) """) self.check_tokenize('rb"abc" + rB"abc" + Rb"abc" + RB"abc"', """\ STRING 'rb"abc"' (1, 0) (1, 7) OP '+' (1, 8) (1, 9) STRING 'rB"abc"' (1, 10) (1, 17) OP '+' (1, 18) (1, 19) STRING 'Rb"abc"' (1, 20) (1, 27) OP '+' (1, 28) (1, 29) STRING 'RB"abc"' (1, 30) (1, 37) """) # Check 0, 1, and 2 character string prefixes. self.check_tokenize(r'"a\ de\ fg"', """\ STRING '"a\\\\\\nde\\\\\\nfg"\' (1, 0) (3, 3) """) self.check_tokenize(r'u"a\ de"', """\ STRING 'u"a\\\\\\nde"\' (1, 0) (2, 3) """) self.check_tokenize(r'rb"a\ d"', """\ STRING 'rb"a\\\\\\nd"\' (1, 0) (2, 2) """) self.check_tokenize(r'"""a\ b"""', """\ STRING '\"\""a\\\\\\nb\"\""' (1, 0) (2, 4) """) self.check_tokenize(r'u"""a\ b"""', """\ STRING 'u\"\""a\\\\\\nb\"\""' (1, 0) (2, 4) """) self.check_tokenize(r'rb"""a\ b\ c"""', """\ STRING 'rb"\""a\\\\\\nb\\\\\\nc"\""' (1, 0) (3, 4) """) self.check_tokenize('f"abc"', """\ STRING 'f"abc"' (1, 0) (1, 6) """) self.check_tokenize('fR"a{b}c"', """\ STRING 'fR"a{b}c"' (1, 0) (1, 9) """) self.check_tokenize('f"""abc"""', """\ STRING 'f\"\"\"abc\"\"\"' (1, 0) (1, 10) """) self.check_tokenize(r'f"abc\ def"', """\ STRING 'f"abc\\\\\\ndef"' (1, 0) (2, 4) """) self.check_tokenize(r'Rf"abc\ def"', """\ STRING 'Rf"abc\\\\\\ndef"' (1, 0) (2, 4) """) def test_function(self): self.check_tokenize("def d22(a, b, c=2, d=2, *k): pass", """\ NAME 'def' (1, 0) (1, 3) NAME 'd22' (1, 4) (1, 7) OP '(' (1, 7) (1, 8) NAME 'a' (1, 8) (1, 9) OP ',' (1, 9) (1, 10) NAME 'b' (1, 11) (1, 12) OP ',' (1, 12) (1, 13) NAME 'c' (1, 14) (1, 15) OP '=' (1, 15) (1, 16) NUMBER '2' (1, 16) (1, 17) OP ',' (1, 17) (1, 18) NAME 'd' (1, 19) (1, 20) OP '=' (1, 20) (1, 21) NUMBER '2' (1, 21) (1, 22) OP ',' (1, 22) (1, 23) OP '*' (1, 24) (1, 25) NAME 'k' (1, 25) (1, 26) OP ')' (1, 26) (1, 27) OP ':' (1, 27) (1, 28) NAME 'pass' (1, 29) (1, 33) """) self.check_tokenize("def d01v_(a=1, *k, **w): pass", """\ NAME 'def' (1, 0) (1, 3) NAME 'd01v_' (1, 4) (1, 9) OP '(' (1, 9) (1, 10) NAME 'a' (1, 10) (1, 11) OP '=' (1, 11) (1, 12) NUMBER '1' (1, 12) (1, 13) OP ',' (1, 13) (1, 14) OP '*' (1, 15) (1, 16) NAME 'k' (1, 16) (1, 17) OP ',' (1, 17) (1, 18) OP '**' (1, 19) (1, 21) NAME 'w' (1, 21) (1, 22) OP ')' (1, 22) (1, 23) OP ':' (1, 23) (1, 24) NAME 'pass' (1, 25) (1, 29) """) def test_comparison(self): # Comparison self.check_tokenize("if 1 < 1 > 1 == 1 >= 5 <= 0x15 <= 0x12 != " "1 and 5 in 1 not in 1 is 1 or 5 is not 1: pass", """\ NAME 'if' (1, 0) (1, 2) NUMBER '1' (1, 3) (1, 4) OP '<' (1, 5) (1, 6) NUMBER '1' (1, 7) (1, 8) OP '>' (1, 9) (1, 10) NUMBER '1' (1, 11) (1, 12) OP '==' (1, 13) (1, 15) NUMBER '1' (1, 16) (1, 17) OP '>=' (1, 18) (1, 20) NUMBER '5' (1, 21) (1, 22) OP '<=' (1, 23) (1, 25) NUMBER '0x15' (1, 26) (1, 30) OP '<=' (1, 31) (1, 33) NUMBER '0x12' (1, 34) (1, 38) OP '!=' (1, 39) (1, 41) NUMBER '1' (1, 42) (1, 43) NAME 'and' (1, 44) (1, 47) NUMBER '5' (1, 48) (1, 49) NAME 'in' (1, 50) (1, 52) NUMBER '1' (1, 53) (1, 54) NAME 'not' (1, 55) (1, 58) NAME 'in' (1, 59) (1, 61) NUMBER '1' (1, 62) (1, 63) NAME 'is' (1, 64) (1, 66) NUMBER '1' (1, 67) (1, 68) NAME 'or' (1, 69) (1, 71) NUMBER '5' (1, 72) (1, 73) NAME 'is' (1, 74) (1, 76) NAME 'not' (1, 77) (1, 80) NUMBER '1' (1, 81) (1, 82) OP ':' (1, 82) (1, 83) NAME 'pass' (1, 84) (1, 88) """) def test_shift(self): # Shift self.check_tokenize("x = 1 << 1 >> 5", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '1' (1, 4) (1, 5) OP '<<' (1, 6) (1, 8) NUMBER '1' (1, 9) (1, 10) OP '>>' (1, 11) (1, 13) NUMBER '5' (1, 14) (1, 15) """) def test_additive(self): # Additive self.check_tokenize("x = 1 - y + 15 - 1 + 0x124 + z + a[5]", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '1' (1, 4) (1, 5) OP '-' (1, 6) (1, 7) NAME 'y' (1, 8) (1, 9) OP '+' (1, 10) (1, 11) NUMBER '15' (1, 12) (1, 14) OP '-' (1, 15) (1, 16) NUMBER '1' (1, 17) (1, 18) OP '+' (1, 19) (1, 20) NUMBER '0x124' (1, 21) (1, 26) OP '+' (1, 27) (1, 28) NAME 'z' (1, 29) (1, 30) OP '+' (1, 31) (1, 32) NAME 'a' (1, 33) (1, 34) OP '[' (1, 34) (1, 35) NUMBER '5' (1, 35) (1, 36) OP ']' (1, 36) (1, 37) """) def test_multiplicative(self): # Multiplicative self.check_tokenize("x = 1//1*1/5*12%0x12@42", """\ NAME 'x' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) NUMBER '1' (1, 4) (1, 5) OP '//' (1, 5) (1, 7) NUMBER '1' (1, 7) (1, 8) OP '*' (1, 8) (1, 9) NUMBER '1' (1, 9) (1, 10) OP '/' (1, 10) (1, 11) NUMBER '5' (1, 11) (1, 12) OP '*' (1, 12) (1, 13) NUMBER '12' (1, 13) (1, 15) OP '%' (1, 15) (1, 16) NUMBER '0x12' (1, 16) (1, 20) OP '@' (1, 20) (1, 21) NUMBER '42' (1, 21) (1, 23) """) def test_unary(self): # Unary self.check_tokenize("~1 ^ 1 & 1 |1 ^ -1", """\ OP '~' (1, 0) (1, 1) NUMBER '1' (1, 1) (1, 2) OP '^' (1, 3) (1, 4) NUMBER '1' (1, 5) (1, 6) OP '&' (1, 7) (1, 8) NUMBER '1' (1, 9) (1, 10) OP '|' (1, 11) (1, 12) NUMBER '1' (1, 12) (1, 13) OP '^' (1, 14) (1, 15) OP '-' (1, 16) (1, 17) NUMBER '1' (1, 17) (1, 18) """) self.check_tokenize("-1*1/1+1*1//1 - ---1**1", """\ OP '-' (1, 0) (1, 1) NUMBER '1' (1, 1) (1, 2) OP '*' (1, 2) (1, 3) NUMBER '1' (1, 3) (1, 4) OP '/' (1, 4) (1, 5) NUMBER '1' (1, 5) (1, 6) OP '+' (1, 6) (1, 7) NUMBER '1' (1, 7) (1, 8) OP '*' (1, 8) (1, 9) NUMBER '1' (1, 9) (1, 10) OP '//' (1, 10) (1, 12) NUMBER '1' (1, 12) (1, 13) OP '-' (1, 14) (1, 15) OP '-' (1, 16) (1, 17) OP '-' (1, 17) (1, 18) OP '-' (1, 18) (1, 19) NUMBER '1' (1, 19) (1, 20) OP '**' (1, 20) (1, 22) NUMBER '1' (1, 22) (1, 23) """) def test_selector(self): # Selector self.check_tokenize("import sys, time\nx = sys.modules['time'].time()", """\ NAME 'import' (1, 0) (1, 6) NAME 'sys' (1, 7) (1, 10) OP ',' (1, 10) (1, 11) NAME 'time' (1, 12) (1, 16) NEWLINE '\\n' (1, 16) (1, 17) NAME 'x' (2, 0) (2, 1) OP '=' (2, 2) (2, 3) NAME 'sys' (2, 4) (2, 7) OP '.' (2, 7) (2, 8) NAME 'modules' (2, 8) (2, 15) OP '[' (2, 15) (2, 16) STRING "'time'" (2, 16) (2, 22) OP ']' (2, 22) (2, 23) OP '.' (2, 23) (2, 24) NAME 'time' (2, 24) (2, 28) OP '(' (2, 28) (2, 29) OP ')' (2, 29) (2, 30) """) def test_method(self): # Methods self.check_tokenize("@staticmethod\ndef foo(x,y): pass", """\ OP '@' (1, 0) (1, 1) NAME 'staticmethod' (1, 1) (1, 13) NEWLINE '\\n' (1, 13) (1, 14) NAME 'def' (2, 0) (2, 3) NAME 'foo' (2, 4) (2, 7) OP '(' (2, 7) (2, 8) NAME 'x' (2, 8) (2, 9) OP ',' (2, 9) (2, 10) NAME 'y' (2, 10) (2, 11) OP ')' (2, 11) (2, 12) OP ':' (2, 12) (2, 13) NAME 'pass' (2, 14) (2, 18) """) def test_tabs(self): # Evil tabs self.check_tokenize("def f():\n" "\tif x\n" " \tpass", """\ NAME 'def' (1, 0) (1, 3) NAME 'f' (1, 4) (1, 5) OP '(' (1, 5) (1, 6) OP ')' (1, 6) (1, 7) OP ':' (1, 7) (1, 8) NEWLINE '\\n' (1, 8) (1, 9) INDENT '\\t' (2, 0) (2, 1) NAME 'if' (2, 1) (2, 3) NAME 'x' (2, 4) (2, 5) NEWLINE '\\n' (2, 5) (2, 6) INDENT ' \\t' (3, 0) (3, 9) NAME 'pass' (3, 9) (3, 13) DEDENT '' (4, 0) (4, 0) DEDENT '' (4, 0) (4, 0) """) def test_non_ascii_identifiers(self): # Non-ascii identifiers self.check_tokenize("Örter = 'places'\ngrün = 'green'", """\ NAME 'Örter' (1, 0) (1, 5) OP '=' (1, 6) (1, 7) STRING "'places'" (1, 8) (1, 16) NEWLINE '\\n' (1, 16) (1, 17) NAME 'grün' (2, 0) (2, 4) OP '=' (2, 5) (2, 6) STRING "'green'" (2, 7) (2, 14) """) def test_unicode(self): # Legacy unicode literals: self.check_tokenize("Örter = u'places'\ngrün = U'green'", """\ NAME 'Örter' (1, 0) (1, 5) OP '=' (1, 6) (1, 7) STRING "u'places'" (1, 8) (1, 17) NEWLINE '\\n' (1, 17) (1, 18) NAME 'grün' (2, 0) (2, 4) OP '=' (2, 5) (2, 6) STRING "U'green'" (2, 7) (2, 15) """) def test_async(self): # Async/await extension: self.check_tokenize("async = 1", """\ NAME 'async' (1, 0) (1, 5) OP '=' (1, 6) (1, 7) NUMBER '1' (1, 8) (1, 9) """) self.check_tokenize("async\\", """\ ERRORTOKEN '\\\\' (1, 5) (1, 6) NAME 'async' (1, 0) (1, 5) """) self.check_tokenize("a = (async = 1)", """\ NAME 'a' (1, 0) (1, 1) OP '=' (1, 2) (1, 3) OP '(' (1, 4) (1, 5) NAME 'async' (1, 5) (1, 10) OP '=' (1, 11) (1, 12) NUMBER '1' (1, 13) (1, 14) OP ')' (1, 14) (1, 15) """) self.check_tokenize("async()", """\ NAME 'async' (1, 0) (1, 5) OP '(' (1, 5) (1, 6) OP ')' (1, 6) (1, 7) """) self.check_tokenize("class async(Bar):pass", """\ NAME 'class' (1, 0) (1, 5) NAME 'async' (1, 6) (1, 11) OP '(' (1, 11) (1, 12) NAME 'Bar' (1, 12) (1, 15) OP ')' (1, 15) (1, 16) OP ':' (1, 16) (1, 17) NAME 'pass' (1, 17) (1, 21) """) self.check_tokenize("class async:pass", """\ NAME 'class' (1, 0) (1, 5) NAME 'async' (1, 6) (1, 11) OP ':' (1, 11) (1, 12) NAME 'pass' (1, 12) (1, 16) """) self.check_tokenize("await = 1", """\ NAME 'await' (1, 0) (1, 5) OP '=' (1, 6) (1, 7) NUMBER '1' (1, 8) (1, 9) """) self.check_tokenize("foo.async", """\ NAME 'foo' (1, 0) (1, 3) OP '.' (1, 3) (1, 4) NAME 'async' (1, 4) (1, 9) """) self.check_tokenize("async for a in b: pass", """\ NAME 'async' (1, 0) (1, 5) NAME 'for' (1, 6) (1, 9) NAME 'a' (1, 10) (1, 11) NAME 'in' (1, 12) (1, 14) NAME 'b' (1, 15) (1, 16) OP ':' (1, 16) (1, 17) NAME 'pass' (1, 18) (1, 22) """) self.check_tokenize("async with a as b: pass", """\ NAME 'async' (1, 0) (1, 5) NAME 'with' (1, 6) (1, 10) NAME 'a' (1, 11) (1, 12) NAME 'as' (1, 13) (1, 15) NAME 'b' (1, 16) (1, 17) OP ':' (1, 17) (1, 18) NAME 'pass' (1, 19) (1, 23) """) self.check_tokenize("async.foo", """\ NAME 'async' (1, 0) (1, 5) OP '.' (1, 5) (1, 6) NAME 'foo' (1, 6) (1, 9) """) self.check_tokenize("async", """\ NAME 'async' (1, 0) (1, 5) """) self.check_tokenize("async\n#comment\nawait", """\ NAME 'async' (1, 0) (1, 5) NEWLINE '\\n' (1, 5) (1, 6) COMMENT '#comment' (2, 0) (2, 8) NL '\\n' (2, 8) (2, 9) NAME 'await' (3, 0) (3, 5) """) self.check_tokenize("async\n...\nawait", """\ NAME 'async' (1, 0) (1, 5) NEWLINE '\\n' (1, 5) (1, 6) OP '...' (2, 0) (2, 3) NEWLINE '\\n' (2, 3) (2, 4) NAME 'await' (3, 0) (3, 5) """) self.check_tokenize("async\nawait", """\ NAME 'async' (1, 0) (1, 5) NEWLINE '\\n' (1, 5) (1, 6) NAME 'await' (2, 0) (2, 5) """) self.check_tokenize("foo.async + 1", """\ NAME 'foo' (1, 0) (1, 3) OP '.' (1, 3) (1, 4) NAME 'async' (1, 4) (1, 9) OP '+' (1, 10) (1, 11) NUMBER '1' (1, 12) (1, 13) """) self.check_tokenize("async def foo(): pass", """\ ASYNC 'async' (1, 0) (1, 5) NAME 'def' (1, 6) (1, 9) NAME 'foo' (1, 10) (1, 13) OP '(' (1, 13) (1, 14) OP ')' (1, 14) (1, 15) OP ':' (1, 15) (1, 16) NAME 'pass' (1, 17) (1, 21) """) self.check_tokenize('''\ async def foo(): def foo(await): await = 1 if 1: await async += 1 ''', """\ ASYNC 'async' (1, 0) (1, 5) NAME 'def' (1, 6) (1, 9) NAME 'foo' (1, 10) (1, 13) OP '(' (1, 13) (1, 14) OP ')' (1, 14) (1, 15) OP ':' (1, 15) (1, 16) NEWLINE '\\n' (1, 16) (1, 17) INDENT ' ' (2, 0) (2, 2) NAME 'def' (2, 2) (2, 5) NAME 'foo' (2, 6) (2, 9) OP '(' (2, 9) (2, 10) AWAIT 'await' (2, 10) (2, 15) OP ')' (2, 15) (2, 16) OP ':' (2, 16) (2, 17) NEWLINE '\\n' (2, 17) (2, 18) INDENT ' ' (3, 0) (3, 4) AWAIT 'await' (3, 4) (3, 9) OP '=' (3, 10) (3, 11) NUMBER '1' (3, 12) (3, 13) NEWLINE '\\n' (3, 13) (3, 14) DEDENT '' (4, 2) (4, 2) NAME 'if' (4, 2) (4, 4) NUMBER '1' (4, 5) (4, 6) OP ':' (4, 6) (4, 7) NEWLINE '\\n' (4, 7) (4, 8) INDENT ' ' (5, 0) (5, 4) AWAIT 'await' (5, 4) (5, 9) NEWLINE '\\n' (5, 9) (5, 10) DEDENT '' (6, 0) (6, 0) DEDENT '' (6, 0) (6, 0) NAME 'async' (6, 0) (6, 5) OP '+=' (6, 6) (6, 8) NUMBER '1' (6, 9) (6, 10) NEWLINE '\\n' (6, 10) (6, 11) """) self.check_tokenize('''\ async def foo(): async for i in 1: pass''', """\ ASYNC 'async' (1, 0) (1, 5) NAME 'def' (1, 6) (1, 9) NAME 'foo' (1, 10) (1, 13) OP '(' (1, 13) (1, 14) OP ')' (1, 14) (1, 15) OP ':' (1, 15) (1, 16) NEWLINE '\\n' (1, 16) (1, 17) INDENT ' ' (2, 0) (2, 2) ASYNC 'async' (2, 2) (2, 7) NAME 'for' (2, 8) (2, 11) NAME 'i' (2, 12) (2, 13) NAME 'in' (2, 14) (2, 16) NUMBER '1' (2, 17) (2, 18) OP ':' (2, 18) (2, 19) NAME 'pass' (2, 20) (2, 24) DEDENT '' (3, 0) (3, 0) """) self.check_tokenize('''async def foo(async): await''', """\ ASYNC 'async' (1, 0) (1, 5) NAME 'def' (1, 6) (1, 9) NAME 'foo' (1, 10) (1, 13) OP '(' (1, 13) (1, 14) ASYNC 'async' (1, 14) (1, 19) OP ')' (1, 19) (1, 20) OP ':' (1, 20) (1, 21) AWAIT 'await' (1, 22) (1, 27) """) self.check_tokenize('''\ def f(): def baz(): pass async def bar(): pass await = 2''', """\ NAME 'def' (1, 0) (1, 3) NAME 'f' (1, 4) (1, 5) OP '(' (1, 5) (1, 6) OP ')' (1, 6) (1, 7) OP ':' (1, 7) (1, 8) NEWLINE '\\n' (1, 8) (1, 9) NL '\\n' (2, 0) (2, 1) INDENT ' ' (3, 0) (3, 2) NAME 'def' (3, 2) (3, 5) NAME 'baz' (3, 6) (3, 9) OP '(' (3, 9) (3, 10) OP ')' (3, 10) (3, 11) OP ':' (3, 11) (3, 12) NAME 'pass' (3, 13) (3, 17) NEWLINE '\\n' (3, 17) (3, 18) ASYNC 'async' (4, 2) (4, 7) NAME 'def' (4, 8) (4, 11) NAME 'bar' (4, 12) (4, 15) OP '(' (4, 15) (4, 16) OP ')' (4, 16) (4, 17) OP ':' (4, 17) (4, 18) NAME 'pass' (4, 19) (4, 23) NEWLINE '\\n' (4, 23) (4, 24) NL '\\n' (5, 0) (5, 1) NAME 'await' (6, 2) (6, 7) OP '=' (6, 8) (6, 9) NUMBER '2' (6, 10) (6, 11) DEDENT '' (7, 0) (7, 0) """) self.check_tokenize('''\ async def f(): def baz(): pass async def bar(): pass await = 2''', """\ ASYNC 'async' (1, 0) (1, 5) NAME 'def' (1, 6) (1, 9) NAME 'f' (1, 10) (1, 11) OP '(' (1, 11) (1, 12) OP ')' (1, 12) (1, 13) OP ':' (1, 13) (1, 14) NEWLINE '\\n' (1, 14) (1, 15) NL '\\n' (2, 0) (2, 1) INDENT ' ' (3, 0) (3, 2) NAME 'def' (3, 2) (3, 5) NAME 'baz' (3, 6) (3, 9) OP '(' (3, 9) (3, 10) OP ')' (3, 10) (3, 11) OP ':' (3, 11) (3, 12) NAME 'pass' (3, 13) (3, 17) NEWLINE '\\n' (3, 17) (3, 18) ASYNC 'async' (4, 2) (4, 7) NAME 'def' (4, 8) (4, 11) NAME 'bar' (4, 12) (4, 15) OP '(' (4, 15) (4, 16) OP ')' (4, 16) (4, 17) OP ':' (4, 17) (4, 18) NAME 'pass' (4, 19) (4, 23) NEWLINE '\\n' (4, 23) (4, 24) NL '\\n' (5, 0) (5, 1) AWAIT 'await' (6, 2) (6, 7) OP '=' (6, 8) (6, 9) NUMBER '2' (6, 10) (6, 11) DEDENT '' (7, 0) (7, 0) """) def decistmt(s): result = [] g = tokenize(BytesIO(s.encode('utf-8')).readline) # tokenize the string for toknum, tokval, _, _, _ in g: if toknum == NUMBER and '.' in tokval: # replace NUMBER tokens result.extend([ (NAME, 'Decimal'), (OP, '('), (STRING, repr(tokval)), (OP, ')') ]) else: result.append((toknum, tokval)) return untokenize(result).decode('utf-8') class TestMisc(TestCase): def test_decistmt(self): # Substitute Decimals for floats in a string of statements. # This is an example from the docs. from decimal import Decimal s = '+21.3e-5*-.1234/81.7' self.assertEqual(decistmt(s), "+Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7')") # The format of the exponent is inherited from the platform C library. # Known cases are "e-007" (Windows) and "e-07" (not Windows). Since # we're only showing 11 digits, and the 12th isn't close to 5, the # rest of the output should be platform-independent. self.assertRegex(repr(eval(s)), '-3.2171603427[0-9]*e-0+7') # Output from calculations with Decimal should be identical across all # platforms. self.assertEqual(eval(decistmt(s)), Decimal('-3.217160342717258261933904529E-7')) class TestTokenizerAdheresToPep0263(TestCase): """ Test that tokenizer adheres to the coding behaviour stipulated in PEP 0263. """ def _testFile(self, filename): path = os.path.join(os.path.dirname(__file__), filename) TestRoundtrip.check_roundtrip(self, open(path, 'rb')) def test_utf8_coding_cookie_and_no_utf8_bom(self): f = 'tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt' self._testFile(f) def test_latin1_coding_cookie_and_utf8_bom(self): """ As per PEP 0263, if a file starts with a utf-8 BOM signature, the only allowed encoding for the comment is 'utf-8'. The text file used in this test starts with a BOM signature, but specifies latin1 as the coding, so verify that a SyntaxError is raised, which matches the behaviour of the interpreter when it encounters a similar condition. """ f = 'tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt' self.assertRaises(SyntaxError, self._testFile, f) def test_no_coding_cookie_and_utf8_bom(self): f = 'tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt' self._testFile(f) def test_utf8_coding_cookie_and_utf8_bom(self): f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt' self._testFile(f) def test_bad_coding_cookie(self): self.assertRaises(SyntaxError, self._testFile, 'bad_coding.py') self.assertRaises(SyntaxError, self._testFile, 'bad_coding2.py') class Test_Tokenize(TestCase): def test__tokenize_decodes_with_specified_encoding(self): literal = '"ЉЊЈЁЂ"' line = literal.encode('utf-8') first = False def readline(): nonlocal first if not first: first = True return line else: return b'' # skip the initial encoding token and the end tokens tokens = list(_tokenize(readline, encoding='utf-8'))[1:-2] expected_tokens = [(3, '"ЉЊЈЁЂ"', (1, 0), (1, 7), '"ЉЊЈЁЂ"')] self.assertEqual(tokens, expected_tokens, "bytes not decoded with encoding") def test__tokenize_does_not_decode_with_encoding_none(self): literal = '"ЉЊЈЁЂ"' first = False def readline(): nonlocal first if not first: first = True return literal else: return b'' # skip the end tokens tokens = list(_tokenize(readline, encoding=None))[:-2] expected_tokens = [(3, '"ЉЊЈЁЂ"', (1, 0), (1, 7), '"ЉЊЈЁЂ"')] self.assertEqual(tokens, expected_tokens, "string not tokenized when encoding is None") class TestDetectEncoding(TestCase): def get_readline(self, lines): index = 0 def readline(): nonlocal index if index == len(lines): raise StopIteration line = lines[index] index += 1 return line return readline def test_no_bom_no_encoding_cookie(self): lines = ( b'# something\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'utf-8') self.assertEqual(consumed_lines, list(lines[:2])) def test_bom_no_cookie(self): lines = ( b'\xef\xbb\xbf# something\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'utf-8-sig') self.assertEqual(consumed_lines, [b'# something\n', b'print(something)\n']) def test_cookie_first_line_no_bom(self): lines = ( b'# -*- coding: latin-1 -*-\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'iso-8859-1') self.assertEqual(consumed_lines, [b'# -*- coding: latin-1 -*-\n']) def test_matched_bom_and_cookie_first_line(self): lines = ( b'\xef\xbb\xbf# coding=utf-8\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'utf-8-sig') self.assertEqual(consumed_lines, [b'# coding=utf-8\n']) def test_mismatched_bom_and_cookie_first_line_raises_syntaxerror(self): lines = ( b'\xef\xbb\xbf# vim: set fileencoding=ascii :\n', b'print(something)\n', b'do_something(else)\n' ) readline = self.get_readline(lines) self.assertRaises(SyntaxError, detect_encoding, readline) def test_cookie_second_line_no_bom(self): return lines = ( b'#! something\n', b'# vim: set fileencoding=ascii :\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'ascii') expected = [b'#! something\n', b'# vim: set fileencoding=ascii :\n'] self.assertEqual(consumed_lines, expected) def test_matched_bom_and_cookie_second_line(self): lines = ( b'\xef\xbb\xbf#! something\n', b'f# coding=utf-8\n', b'print(something)\n', b'do_something(else)\n' ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'utf-8-sig') self.assertEqual(consumed_lines, [b'#! something\n', b'f# coding=utf-8\n']) def test_mismatched_bom_and_cookie_second_line_raises_syntaxerror(self): lines = ( b'\xef\xbb\xbf#! something\n', b'# vim: set fileencoding=ascii :\n', b'print(something)\n', b'do_something(else)\n' ) readline = self.get_readline(lines) self.assertRaises(SyntaxError, detect_encoding, readline) def test_cookie_second_line_noncommented_first_line(self): return lines = ( b"print('\xc2\xa3')\n", b'# vim: set fileencoding=iso8859-15 :\n', b"print('\xe2\x82\xac')\n" ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'utf-8') expected = [b"print('\xc2\xa3')\n"] self.assertEqual(consumed_lines, expected) def test_cookie_second_line_commented_first_line(self): return lines = ( b"#print('\xc2\xa3')\n", b'# vim: set fileencoding=iso8859-15 :\n', b"print('\xe2\x82\xac')\n" ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'iso8859-15') expected = [b"#print('\xc2\xa3')\n", b'# vim: set fileencoding=iso8859-15 :\n'] self.assertEqual(consumed_lines, expected) def test_cookie_second_line_empty_first_line(self): return lines = ( b'\n', b'# vim: set fileencoding=iso8859-15 :\n', b"print('\xe2\x82\xac')\n" ) encoding, consumed_lines = detect_encoding(self.get_readline(lines)) self.assertEqual(encoding, 'iso8859-15') expected = [b'\n', b'# vim: set fileencoding=iso8859-15 :\n'] self.assertEqual(consumed_lines, expected) def test_latin1_normalization(self): # See get_normal_name() in tokenizer.c. encodings = ("latin-1", "iso-8859-1", "iso-latin-1", "latin-1-unix", "iso-8859-1-unix", "iso-latin-1-mac") for encoding in encodings: for rep in ("-", "_"): enc = encoding.replace("-", rep) lines = (b"#!/usr/bin/python\n", b"# coding: " + enc.encode("ascii") + b"\n", b"print(things)\n", b"do_something += 4\n") rl = self.get_readline(lines) found, consumed_lines = detect_encoding(rl) self.assertEqual(found, "iso-8859-1") def test_syntaxerror_latin1(self): # Issue 14629: need to raise SyntaxError if the first # line(s) have non-UTF-8 characters lines = ( b'print("\xdf")', # Latin-1: LATIN SMALL LETTER SHARP S ) readline = self.get_readline(lines) self.assertRaises(SyntaxError, detect_encoding, readline) def test_utf8_normalization(self): # See get_normal_name() in tokenizer.c. encodings = ("utf-8", "utf-8-mac", "utf-8-unix") for encoding in encodings: for rep in ("-", "_"): enc = encoding.replace("-", rep) lines = (b"#!/usr/bin/python\n", b"# coding: " + enc.encode("ascii") + b"\n", b"1 + 3\n") rl = self.get_readline(lines) found, consumed_lines = detect_encoding(rl) self.assertEqual(found, "utf-8") def test_short_files(self): readline = self.get_readline((b'print(something)\n',)) encoding, consumed_lines = detect_encoding(readline) self.assertEqual(encoding, 'utf-8') self.assertEqual(consumed_lines, [b'print(something)\n']) encoding, consumed_lines = detect_encoding(self.get_readline(())) self.assertEqual(encoding, 'utf-8') self.assertEqual(consumed_lines, []) readline = self.get_readline((b'\xef\xbb\xbfprint(something)\n',)) encoding, consumed_lines = detect_encoding(readline) self.assertEqual(encoding, 'utf-8-sig') self.assertEqual(consumed_lines, [b'print(something)\n']) readline = self.get_readline((b'\xef\xbb\xbf',)) encoding, consumed_lines = detect_encoding(readline) self.assertEqual(encoding, 'utf-8-sig') self.assertEqual(consumed_lines, []) readline = self.get_readline((b'# coding: bad\n',)) self.assertRaises(SyntaxError, detect_encoding, readline) def test_false_encoding(self): # Issue 18873: "Encoding" detected in non-comment lines readline = self.get_readline((b'print("#coding=fake")',)) encoding, consumed_lines = detect_encoding(readline) self.assertEqual(encoding, 'utf-8') self.assertEqual(consumed_lines, [b'print("#coding=fake")']) def test_open(self): filename = support.TESTFN + '.py' self.addCleanup(support.unlink, filename) # test coding cookie for encoding in ("utf-8",): #'iso-8859-15', 'utf-8'): with open(filename, 'w', encoding=encoding) as fp: print("# coding: %s" % encoding, file=fp) print("print('euro:\u20ac')", file=fp) with tokenize_open(filename) as fp: self.assertEqual(fp.encoding, encoding) self.assertEqual(fp.mode, 'r') return # test BOM (no coding cookie) with open(filename, 'w', encoding='utf-8-sig') as fp: print("print('euro:\u20ac')", file=fp) with tokenize_open(filename) as fp: self.assertEqual(fp.encoding, 'utf-8-sig') self.assertEqual(fp.mode, 'r') def test_filename_in_exception(self): # When possible, include the file name in the exception. path = 'some_file_path' lines = ( b'print("\xdf")', # Latin-1: LATIN SMALL LETTER SHARP S ) class Bunk: def __init__(self, lines, path): self.name = path self._lines = lines self._index = 0 def readline(self): if self._index == len(lines): raise StopIteration line = lines[self._index] self._index += 1 return line with self.assertRaises(SyntaxError): ins = Bunk(lines, path) # Make sure lacking a name isn't an issue. del ins.name detect_encoding(ins.readline) with self.assertRaisesRegex(SyntaxError, '.*{}'.format(path)): ins = Bunk(lines, path) detect_encoding(ins.readline) def test_open_error(self): # Issue #23840: open() must close the binary file on error m = BytesIO(b'#coding:xxx') with mock.patch('tokenize._builtin_open', return_value=m): self.assertRaises(SyntaxError, tokenize_open, 'foobar') self.assertTrue(m.closed) class TestTokenize(TestCase): def test_tokenize(self): import tokenize as tokenize_module encoding = object() encoding_used = None def mock_detect_encoding(readline): return encoding, [b'first', b'second'] def mock__tokenize(readline, encoding): nonlocal encoding_used encoding_used = encoding out = [] while True: next_line = readline() if next_line: out.append(next_line) continue return out counter = 0 def mock_readline(): nonlocal counter counter += 1 if counter == 5: return b'' return str(counter).encode() orig_detect_encoding = tokenize_module.detect_encoding orig__tokenize = tokenize_module._tokenize tokenize_module.detect_encoding = mock_detect_encoding tokenize_module._tokenize = mock__tokenize try: results = tokenize(mock_readline) self.assertEqual(list(results), [b'first', b'second', b'1', b'2', b'3', b'4']) finally: tokenize_module.detect_encoding = orig_detect_encoding tokenize_module._tokenize = orig__tokenize self.assertEqual(encoding_used, encoding) def test_oneline_defs(self): buf = [] for i in range(500): buf.append('def i{i}(): return {i}'.format(i=i)) buf.append('OK') buf = '\n'.join(buf) # Test that 500 consequent, one-line defs is OK toks = list(tokenize(BytesIO(buf.encode('utf-8')).readline)) self.assertEqual(toks[-3].string, 'OK') # [-1] is always ENDMARKER # [-2] is always NEWLINE def assertExactTypeEqual(self, opstr, *optypes): tokens = list(tokenize(BytesIO(opstr.encode('utf-8')).readline)) num_optypes = len(optypes) self.assertEqual(len(tokens), 3 + num_optypes) self.assertEqual(token.tok_name[tokens[0].exact_type], token.tok_name[ENCODING]) for i in range(num_optypes): self.assertEqual(token.tok_name[tokens[i + 1].exact_type], token.tok_name[optypes[i]]) self.assertEqual(token.tok_name[tokens[1 + num_optypes].exact_type], token.tok_name[token.NEWLINE]) self.assertEqual(token.tok_name[tokens[2 + num_optypes].exact_type], token.tok_name[token.ENDMARKER]) def test_exact_type(self): self.assertExactTypeEqual('()', token.LPAR, token.RPAR) self.assertExactTypeEqual('[]', token.LSQB, token.RSQB) self.assertExactTypeEqual(':', token.COLON) self.assertExactTypeEqual(',', token.COMMA) self.assertExactTypeEqual(';', token.SEMI) self.assertExactTypeEqual('+', token.PLUS) self.assertExactTypeEqual('-', token.MINUS) self.assertExactTypeEqual('*', token.STAR) self.assertExactTypeEqual('/', token.SLASH) self.assertExactTypeEqual('|', token.VBAR) self.assertExactTypeEqual('&', token.AMPER) self.assertExactTypeEqual('<', token.LESS) self.assertExactTypeEqual('>', token.GREATER) self.assertExactTypeEqual('=', token.EQUAL) self.assertExactTypeEqual('.', token.DOT) self.assertExactTypeEqual('%', token.PERCENT) self.assertExactTypeEqual('{}', token.LBRACE, token.RBRACE) self.assertExactTypeEqual('==', token.EQEQUAL) self.assertExactTypeEqual('!=', token.NOTEQUAL) self.assertExactTypeEqual('<=', token.LESSEQUAL) self.assertExactTypeEqual('>=', token.GREATEREQUAL) self.assertExactTypeEqual('~', token.TILDE) self.assertExactTypeEqual('^', token.CIRCUMFLEX) self.assertExactTypeEqual('<<', token.LEFTSHIFT) self.assertExactTypeEqual('>>', token.RIGHTSHIFT) self.assertExactTypeEqual('**', token.DOUBLESTAR) self.assertExactTypeEqual('+=', token.PLUSEQUAL) self.assertExactTypeEqual('-=', token.MINEQUAL) self.assertExactTypeEqual('*=', token.STAREQUAL) self.assertExactTypeEqual('/=', token.SLASHEQUAL) self.assertExactTypeEqual('%=', token.PERCENTEQUAL) self.assertExactTypeEqual('&=', token.AMPEREQUAL) self.assertExactTypeEqual('|=', token.VBAREQUAL) self.assertExactTypeEqual('^=', token.CIRCUMFLEXEQUAL) self.assertExactTypeEqual('^=', token.CIRCUMFLEXEQUAL) self.assertExactTypeEqual('<<=', token.LEFTSHIFTEQUAL) self.assertExactTypeEqual('>>=', token.RIGHTSHIFTEQUAL) self.assertExactTypeEqual('**=', token.DOUBLESTAREQUAL) self.assertExactTypeEqual('//', token.DOUBLESLASH) self.assertExactTypeEqual('//=', token.DOUBLESLASHEQUAL) self.assertExactTypeEqual('@', token.AT) self.assertExactTypeEqual('@=', token.ATEQUAL) self.assertExactTypeEqual('a**2+b**2==c**2', NAME, token.DOUBLESTAR, NUMBER, token.PLUS, NAME, token.DOUBLESTAR, NUMBER, token.EQEQUAL, NAME, token.DOUBLESTAR, NUMBER) self.assertExactTypeEqual('{1, 2, 3}', token.LBRACE, token.NUMBER, token.COMMA, token.NUMBER, token.COMMA, token.NUMBER, token.RBRACE) self.assertExactTypeEqual('^(x & 0x1)', token.CIRCUMFLEX, token.LPAR, token.NAME, token.AMPER, token.NUMBER, token.RPAR) def test_pathological_trailing_whitespace(self): # See http://bugs.python.org/issue16152 self.assertExactTypeEqual('@ ', token.AT) class UntokenizeTest(TestCase): def test_bad_input_order(self): # raise if previous row u = Untokenizer() u.prev_row = 2 u.prev_col = 2 with self.assertRaises(ValueError) as cm: u.add_whitespace((1,3)) self.assertEqual(cm.exception.args[0], 'start (1,3) precedes previous end (2,2)') # raise if previous column in row self.assertRaises(ValueError, u.add_whitespace, (2,1)) def test_backslash_continuation(self): # The problem is that <whitespace>\<newline> leaves no token u = Untokenizer() u.prev_row = 1 u.prev_col = 1 u.tokens = [] u.add_whitespace((2, 0)) self.assertEqual(u.tokens, ['\\\n']) u.prev_row = 2 u.add_whitespace((4, 4)) self.assertEqual(u.tokens, ['\\\n', '\\\n\\\n', ' ']) TestRoundtrip.check_roundtrip(self, 'a\n b\n c\n \\\n c\n') def test_iter_compat(self): u = Untokenizer() token = (NAME, 'Hello') tokens = [(ENCODING, 'utf-8'), token] u.compat(token, iter([])) self.assertEqual(u.tokens, ["Hello "]) u = Untokenizer() self.assertEqual(u.untokenize(iter([token])), 'Hello ') u = Untokenizer() self.assertEqual(u.untokenize(iter(tokens)), 'Hello ') self.assertEqual(u.encoding, 'utf-8') self.assertEqual(untokenize(iter(tokens)), b'Hello ') class TestRoundtrip(TestCase): def check_roundtrip(self, f): """ Test roundtrip for `untokenize`. `f` is an open file or a string. The source code in f is tokenized to both 5- and 2-tuples. Both sequences are converted back to source code via tokenize.untokenize(), and the latter tokenized again to 2-tuples. The test fails if the 3 pair tokenizations do not match. When untokenize bugs are fixed, untokenize with 5-tuples should reproduce code that does not contain a backslash continuation following spaces. A proper test should test this. """ # Get source code and original tokenizations if isinstance(f, str): code = f.encode('utf-8') else: code = f.read() f.close() readline = iter(code.splitlines(keepends=True)).__next__ tokens5 = list(tokenize(readline)) tokens2 = [tok[:2] for tok in tokens5] # Reproduce tokens2 from pairs bytes_from2 = untokenize(tokens2) readline2 = iter(bytes_from2.splitlines(keepends=True)).__next__ tokens2_from2 = [tok[:2] for tok in tokenize(readline2)] self.assertEqual(tokens2_from2, tokens2) # Reproduce tokens2 from 5-tuples bytes_from5 = untokenize(tokens5) readline5 = iter(bytes_from5.splitlines(keepends=True)).__next__ tokens2_from5 = [tok[:2] for tok in tokenize(readline5)] self.assertEqual(tokens2_from5, tokens2) def test_roundtrip(self): # There are some standard formatting practices that are easy to get right. self.check_roundtrip("if x == 1:\n" " print(x)\n") self.check_roundtrip("# This is a comment\n" "# This also\n") # Some people use different formatting conventions, which makes # untokenize a little trickier. Note that this test involves trailing # whitespace after the colon. Note that we use hex escapes to make the # two trailing blanks apparent in the expected output. self.check_roundtrip("if x == 1 : \n" " print(x)\n") fn = support.findfile("tokenize_tests.txt") with open(fn, 'rb') as f: self.check_roundtrip(f) self.check_roundtrip("if x == 1:\n" " # A comment by itself.\n" " print(x) # Comment here, too.\n" " # Another comment.\n" "after_if = True\n") self.check_roundtrip("if (x # The comments need to go in the right place\n" " == 1):\n" " print('x==1')\n") self.check_roundtrip("class Test: # A comment here\n" " # A comment with weird indent\n" " after_com = 5\n" " def x(m): return m*5 # a one liner\n" " def y(m): # A whitespace after the colon\n" " return y*4 # 3-space indent\n") # Some error-handling code self.check_roundtrip("try: import somemodule\n" "except ImportError: # comment\n" " print('Can not import' # comment2\n)" "else: print('Loaded')\n") def test_continuation(self): # Balancing continuation self.check_roundtrip("a = (3,4, \n" "5,6)\n" "y = [3, 4,\n" "5]\n" "z = {'a': 5,\n" "'b':15, 'c':True}\n" "x = len(y) + 5 - a[\n" "3] - a[2]\n" "+ len(z) - z[\n" "'b']\n") def test_backslash_continuation(self): # Backslash means line continuation, except for comments self.check_roundtrip("x=1+\\\n" "1\n" "# This is a comment\\\n" "# This also\n") self.check_roundtrip("# Comment \\\n" "x = 0") def test_string_concatenation(self): # Two string literals on the same line self.check_roundtrip("'' ''") @unittest.skipIf(True, "TODO: check import validity") def test_random_files(self): # Test roundtrip on random python modules. # pass the '-ucpu' option to process the full directory. import glob, random fn = support.findfile("tokenize_tests.txt") tempdir = os.path.dirname(fn) or os.curdir testfiles = glob.glob(os.path.join(tempdir, "test*.py")) # Tokenize is broken on test_pep3131.py because regular expressions are # broken on the obscure unicode identifiers in it. *sigh* # With roundtrip extended to test the 5-tuple mode of untokenize, # 7 more testfiles fail. Remove them also until the failure is diagnosed. testfiles.remove(os.path.join(tempdir, "test_unicode_identifiers.py")) for f in ('buffer', 'builtin', 'fileio', 'inspect', 'os', 'platform', 'sys'): testfiles.remove(os.path.join(tempdir, "test_%s.py") % f) if not support.is_resource_enabled("cpu"): testfiles = random.sample(testfiles, 10) for testfile in testfiles: with open(testfile, 'rb') as f: with self.subTest(file=testfile): self.check_roundtrip(f) def roundtrip(self, code): if isinstance(code, str): code = code.encode('utf-8') return untokenize(tokenize(BytesIO(code).readline)).decode('utf-8') def test_indentation_semantics_retained(self): """ Ensure that although whitespace might be mutated in a roundtrip, the semantic meaning of the indentation remains consistent. """ code = "if False:\n\tx=3\n\tx=3\n" codelines = self.roundtrip(code).split('\n') self.assertEqual(codelines[1], codelines[2]) self.check_roundtrip(code) if __name__ == "__main__": unittest.main()
63,484
1,625
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/testtar.tar
ustar/conttype0000644000175000001440000001554307606136617015171 7ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ustar/regtype0000644000175000001440000001554307606136617014774 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ustar/dirtype/0000755000175000001440000000000007606136617015042 5ustar00tarfiletarfile00000000000000ustar/dirtype-with-size/0000755000175000001440000000037707606136617017004 5ustar00tarfiletarfile00000000000000ustar/lnktype0000644000175000001440000000000007606136617017520 1ustar/regtypeustar00tarfiletarfile00000000000000ustar/symtype0000777000175000001440000000000007606136617016416 2regtypeustar00tarfiletarfile00000000000000ustar/blktype0000660000175000001440000000000007606136617014752 4ustar00tarfiletarfile00000030000000ustar/chrtype0000666000175000001440000000000007606136617014764 3ustar00tarfiletarfile00000010000003ustar/fifotype0000644000175000001440000000000007606136617015126 6ustar00tarfiletarfile00000000000000ustar/sparse0000644000175000001440000025000007606136617014577 0ustar00tarfiletarfile00000000000000ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ustar/umlauts-ÄÖÜäöüß0000644000175000001440000001554307606136617020137 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/1234567/longname0000644 0001750 0000144 00000015543 07606136617 045233 0ustar00tarfiletarfile0000000 0000000 ustar/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ./ustar/linktest2/symtype0000777000175000001440000000000007606136617021323 2../linktest1/regtypeustar tarfiletarfileustar/linktest1/regtype0000644000175000001440000001554307606136617015412 0ustar tarfiletarfileForeword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ./ustar/linktest2/lnktype0000644000175000001440000000000007606136617022347 1./ustar/linktest1/regtypeustar tarfiletarfilesymtype20000777000175000001440000000000007606136617016500 2ustar/regtypeustar00tarfiletarfile00000000000000././@LongLink0000000000000000000000000000100100000000000011555 Lustar rootrootgnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longnamegnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/0000644000175000001440000001554307606136617022717 0ustar tarfiletarfileForeword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ././@LongLink0000000000000000000000000000100100000000000011554 Kustar rootrootgnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longname././@LongLink0000000000000000000000000000100100000000000011555 Lustar rootrootgnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longlinkgnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/0000644000175000001440000000000007606136617034657 1gnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/ustar tarfiletarfilegnu/sparse0000644000175000001440000012000007606136617024245 Sustar tarfiletarfile0000001000000000010000000000300000000001000000000050000000000100000000007000000000010000000002500000000011000000000010000000001300000000001000000000150000000000100000000017000000000010000000002100000000001000000000230000000000100000000025000000000000000ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/gnu/PaxHeaders.18556/sparse-0.00000644000175000001440000000126510554142466014434 xustar000000000000000025 GNU.sparse.size=86016 27 GNU.sparse.numblocks=11 26 GNU.sparse.offset=4096 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=12288 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=20480 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=28672 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=36864 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=45056 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=53248 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=61440 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=69632 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=77824 28 GNU.sparse.numbytes=4096 27 GNU.sparse.offset=86016 25 GNU.sparse.numbytes=0 20 atime=1169212651 20 ctime=1169212651 gnu/sparse-0.00000644000175000001440000012000007606136617014521 0ustar00tarfiletarfile00000000000000ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/gnu/PaxHeaders.18567/sparse-0.10000644000175000001440000000040610554142476014434 xustar000000000000000025 GNU.sparse.size=86016 27 GNU.sparse.numblocks=11 34 GNU.sparse.name=gnu/sparse-0.1 136 GNU.sparse.map=4096,4096,12288,4096,20480,4096,28672,4096,36864,4096,45056,4096,53248,4096,61440,4096,69632,4096,77824,4096,86016,0 20 atime=1169212652 20 ctime=1169212652 gnu/GNUSparseFile.18567/sparse-0.10000644000175000001440000012000007606136617017622 0ustar00tarfiletarfile00000000000000ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/gnu/PaxHeaders.18633/sparse-1.00000644000175000001440000000022310554142507014416 xustar000000000000000022 GNU.sparse.major=1 22 GNU.sparse.minor=0 34 GNU.sparse.name=gnu/sparse-1.0 29 GNU.sparse.realsize=86016 20 atime=1169212642 20 ctime=1169212656 gnu/GNUSparseFile.18633/sparse-1.00000644000175000001440000012100007606136617017615 0ustar00tarfiletarfile0000000000000011 4096 4096 12288 4096 20480 4096 28672 4096 36864 4096 45056 4096 53248 4096 61440 4096 69632 4096 77824 4096 86016 0 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/gnu/regtype-gnu-uid0000644€ÿÿÿÿ€ÿÿÿÿ0000001554307606136617021077 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/regtype-old-v7 644 1750 144 15543 7606136617 007662 Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/regtype-hpux-signed-chksum-ÄÖÜäöüß00006440001750000014400000015543076061366170200420ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/regtype-old-v7-signed-chksum-ÄÖÜäöüß 644 1750 144 15543 7606136617 012151 Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/dirtype-old-v7/ 40755 1750 144 0 7606136617 007667 misc/regtype-suntar01006440000145000001200000000036105507146700020273Xustar00larsstaff00000400000017/tmp/PaxHeaders.37830 mtime=1041808783.000000000 misc/regtype-suntar010064400017500000144000000155431055071467000161110ustar00tarfiletarfile00000400000017Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/regtype-xstar0000644 0001750 0000144 00000015543 07606136617 0020313 0ustar00larsusers0000000 0000000 07606136617 07606136617 tarForeword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ././@PaxHeader0000600 0000000 0000000 00000001144 00000000000 0013633 xustar00rootroot0000000 0000000 30 atime=1041808783.000000000 30 ctime=1041808783.000000000 30 mtime=1041808783.000000000 522 path=pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longname 123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/0000644 0001750 0000144 00000015543 07606136617 024273 0ustar00tarfiletarfile0000000 0000000 Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ././@PaxHeader0000600 0000000 0000000 00000002162 00000000000 0013634 xustar00rootroot0000000 0000000 30 atime=1041808783.000000000 30 ctime=1041808783.000000000 30 mtime=1041808783.000000000 522 path=pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longlink 526 linkpath=pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longname 123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/0000644 0001750 0000144 00000000000 07606136617 036232 1pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/ustar00tarfiletarfile0000000 0000000 pax/PaxHeaders.12814/umlauts-ÄÖÜäöüß0000644000175000001440000000011310550667367017453 xustar000000000000000035 path=pax/umlauts-ÄÖÜäöüß 20 atime=1168337112 20 ctime=1168338674 pax/umlauts-ÄÖÜäöüß0000644000175000001440000001554307606136617017571 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 /tmp/GlobalHead.26030.10000644000175000001440000000007310552150730012753 gustar000000000000000013 gname=bar 13 uname=foo 33 VENDOR.umlauts=ÄÖÜäöüß pax/regtype10000644000175000001440000001554307606136617014507 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 /tmp/GlobalHead.23988.10000644000175000001440000000001110552143626012774 gustar00000000000000009 uname= pax/regtype20000644000175000001440000001554307606136617014510 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 /tmp/GlobalHead.23988.10000644000175000001440000000004210552143626013000 gustar000000000000000017 uname=tarfile 17 gname=tarfile pax/regtype30000644000175000001440000001554307606136617014511 0ustar00tarfiletarfile00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 ././@PaxHeader0000600 0000000 0000000 00000000175 00000000000 013636 xustar00rootroot0000000 0000000 30 atime=1041808783.000000000 30 ctime=1041808783.000000000 30 mtime=1041808783.000000000 11 uid=123 11 gid=123 13 size=7011 pax/regtype40000644 0001750 0000144 00000000000 00000000000 014755 0ustar00tarfiletarfile0000000 0000000 Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 pax/PaxHeaders.16970/bad-pax-äöü0000644000175000017500000000016207606136617015564 xustar000000000000000024 path=pax/bad-pax-äöü 30 mtime=1041808783.000000000 30 atime=1041808783.000000000 30 ctime=1041808783.000000000 pax/bad-pax-äöü0000644000175000017500000001554307606136617014520 0ustar00larslars00000000000000Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 pax/PaxHeader/hdrcharset-äöü000644 000000 000000 00000000304 07606136617 020371 xustar00tarfiletarfile000000 000000 21 hdrcharset=BINARY 27 path=pax/hdrcharset-äöü 30 mtime=1041808783.000000000 30 ctime=1041808783.000000000 30 atime=1041808783.000000000 19 SCHILY.dev=2305 21 SCHILY.ino=268050 18 SCHILY.nlink=1 pax/hdrcharset-äöü000644 000000 000000 00000015543 07606136617 016433 0ustar00tarfiletarfile000000 000000 Foreword for "Programming Python" (1st ed.) As Python's creator, I'd like to say a few words about its origins, adding a bit of personal philosophy. Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office (a government-run research lab in Amsterdam) would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Today, I can safely say that Python has changed my life. I have moved to a different continent. I spend my working days developing large systems in Python, when I'm not hacking on Python or answering Python-related email. There are Python T-shirts, workshops, mailing lists, a newsgroup, and now a book. Frankly, my only unfulfilled wish is to have my picture on the front page of the New York Times. But before I get carried away daydreaming, here are a few tidbits from Python's past. It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here's a likely one: the difficulty of adding new "primitive" operations to ABC. It was a monolithic, "closed system", with only the most basic I/O operations: read a string from the console, write a string to the console. I decided not repeat this mistake in Python. Besides this intention, I had a number of other ideas for improvement over ABC, and was eager to try them out. For instance, ABC's powerful data types turned out to be less efficient than we hoped. There was too much emphasis on theoretically optimal algorithms, and not enough tuning for common cases. I also felt that some of ABC's features, aimed at novice programmers, were less desirable for the (then!) intended audience of experienced Unix/C programmers. For instance: ABC's ideosyncratic syntax (all uppercase keywords!); some terminology (e.g. "how-to" instead of "procedure"); and the integrated structured editor, which its users almost universally hated. Python would rely more on the Unix infrastructure and conventions, without being Unix-bound. And in fact, the first implementation was done on a Mac. As it turned out, Python is remarkably free from many of the hang-ups of conventional programming languages. This is perhaps due to my choice of examples: besides ABC, my main influence was Modula-3. This is another language with remarkable elegance and power, designed by a small, strong-willed team (most of whom I had met during a summer internship at DEC's Systems Research Center in Palo Alto). Imagine what Python would have looked like if I had modelled it after the Unix shell and C instead! (Yes, I borrowed from C too, but only its least controversial features, in my desire to please the Unix/C audience.) Any individual creation has its ideosyncracies, and occasionally its creator has to justify these. Perhaps Python's most controversial feature is its use of indentation for statement grouping, which derives directly from ABC. It is one of the language's features that is dearest to my heart. It makes Python code more readable in two ways. First, the use of indentation reduces visual clutter and makes programs shorter, thus reducing the attention span needed to take in a basic unit of code. Second, it allows the programmer less freedom in formatting, thereby enabling a more uniform style, which makes it easier to read someone else's code. (Compare, for instance, the three or four different conventions for the placement of braces in C, each with strong proponents.) This emphasis on readability is no accident. As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we all wrote perfect documentation all of the time, code can hardly be considered reusable if it's not readable. Many of Python's features, in addition to its use of indentation, conspire to make Python code highly readable. This reflects the philosophy of ABC, which was intended to teach programming in its purest form, and therefore placed a high value on clarity. Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. I will gladly admit that Python is not the fastest running scripting language. It is a good runner-up though. With ever-increasing hardware speed, the accumulated running time of a program during its lifetime is often negligible compared to the programmer time needed to write and debug it. This, of course, is where the real savings can be made. While this is hard to assess objectively, Python is considered a winner in coding time by most who have tried it. In addition, many consider using Python a pleasure -- a better recommendation is hard to imagine. I am solely responsible for Python's strengths and shortcomings, even when some of the code has been written by others. However, its success is the product of a community, starting with the early adopters who picked it up when I first published Python on the net, and who spread the word about it in their own environment. They sent me their praise, criticism, feature requests, code contributions, and personal revelations via email. They were willing to discuss every aspect of Python in the mailing list that I soon set up, and educate me or nudge me in the right direction where my initial intuition failed me. There have been too many contributors to thank individually. I'll make one exception, however: this book's author was one of Python's early adopters and evangelists. With its publication, his longstanding wish (and mine!) of having a more accessible description of Python than the standard set of manuals, is fulfilled. But enough rambling. I highly recommend this book to anyone interested in learning Python, whether for personal improvement or as a career enhancement. Take it away, Eric, the orchestra leader! (If you don't understand this last sentence, you haven't watched enough Monty Python reruns.) Guido van Rossum Reston, VA, May 1996 misc/eof0000644000175000001440000000000007606136617012341 0ustar tarfiletarfile
435,200
2,379
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_timeout.py
"""Unit tests for socket timeout feature.""" import functools import unittest from test import support # This requires the 'network' resource as given on the regrtest command line. skip_expected = not support.is_resource_enabled('network') import time import errno import socket @functools.lru_cache() def resolve_address(host, port): """Resolve an (host, port) to an address. We must perform name resolution before timeout tests, otherwise it will be performed by connect(). """ with support.transient_internet(host): return socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM)[0][4] class CreationTestCase(unittest.TestCase): """Test case for socket.gettimeout() and socket.settimeout()""" def setUp(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def tearDown(self): self.sock.close() def testObjectCreation(self): # Test Socket creation self.assertEqual(self.sock.gettimeout(), None, "timeout not disabled by default") def testFloatReturnValue(self): # Test return value of gettimeout() self.sock.settimeout(7.345) self.assertEqual(self.sock.gettimeout(), 7.345) self.sock.settimeout(3) self.assertEqual(self.sock.gettimeout(), 3) self.sock.settimeout(None) self.assertEqual(self.sock.gettimeout(), None) def testReturnType(self): # Test return type of gettimeout() self.sock.settimeout(1) self.assertEqual(type(self.sock.gettimeout()), type(1.0)) self.sock.settimeout(3.9) self.assertEqual(type(self.sock.gettimeout()), type(1.0)) def testTypeCheck(self): # Test type checking by settimeout() self.sock.settimeout(0) self.sock.settimeout(0) self.sock.settimeout(0.0) self.sock.settimeout(None) self.assertRaises(TypeError, self.sock.settimeout, "") self.assertRaises(TypeError, self.sock.settimeout, "") self.assertRaises(TypeError, self.sock.settimeout, ()) self.assertRaises(TypeError, self.sock.settimeout, []) self.assertRaises(TypeError, self.sock.settimeout, {}) self.assertRaises(TypeError, self.sock.settimeout, 0j) def testRangeCheck(self): # Test range checking by settimeout() self.assertRaises(ValueError, self.sock.settimeout, -1) self.assertRaises(ValueError, self.sock.settimeout, -1) self.assertRaises(ValueError, self.sock.settimeout, -1.0) def testTimeoutThenBlocking(self): # Test settimeout() followed by setblocking() self.sock.settimeout(10) self.sock.setblocking(1) self.assertEqual(self.sock.gettimeout(), None) self.sock.setblocking(0) self.assertEqual(self.sock.gettimeout(), 0.0) self.sock.settimeout(10) self.sock.setblocking(0) self.assertEqual(self.sock.gettimeout(), 0.0) self.sock.setblocking(1) self.assertEqual(self.sock.gettimeout(), None) def testBlockingThenTimeout(self): # Test setblocking() followed by settimeout() self.sock.setblocking(0) self.sock.settimeout(1) self.assertEqual(self.sock.gettimeout(), 1) self.sock.setblocking(1) self.sock.settimeout(1) self.assertEqual(self.sock.gettimeout(), 1) class TimeoutTestCase(unittest.TestCase): # There are a number of tests here trying to make sure that an operation # doesn't take too much longer than expected. But competing machine # activity makes it inevitable that such tests will fail at times. # When fuzz was at 1.0, I (tim) routinely saw bogus failures on Win2K # and Win98SE. Boosting it to 2.0 helped a lot, but isn't a real # solution. fuzz = 2.0 localhost = support.HOST def setUp(self): raise NotImplementedError() tearDown = setUp def _sock_operation(self, count, timeout, method, *args): """ Test the specified socket method. The method is run at most `count` times and must raise a socket.timeout within `timeout` + self.fuzz seconds. """ self.sock.settimeout(timeout) method = getattr(self.sock, method) for i in range(count): t1 = time.time() try: method(*args) except socket.timeout as e: delta = time.time() - t1 break else: self.fail('socket.timeout was not raised') # These checks should account for timing unprecision self.assertLess(delta, timeout + self.fuzz) self.assertGreater(delta, timeout - 1.0) class TCPTimeoutTestCase(TimeoutTestCase): """TCP test case for socket.socket() timeout functions""" def setUp(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.addr_remote = resolve_address('www.python.org.', 80) def tearDown(self): self.sock.close() def testConnectTimeout(self): # Testing connect timeout is tricky: we need to have IP connectivity # to a host that silently drops our packets. We can't simulate this # from Python because it's a function of the underlying TCP/IP stack. # So, the following Snakebite host has been defined: blackhole = resolve_address('blackhole.snakebite.net', 56666) # Blackhole has been configured to silently drop any incoming packets. # No RSTs (for TCP) or ICMP UNREACH (for UDP/ICMP) will be sent back # to hosts that attempt to connect to this address: which is exactly # what we need to confidently test connect timeout. # However, we want to prevent false positives. It's not unreasonable # to expect certain hosts may not be able to reach the blackhole, due # to firewalling or general network configuration. In order to improve # our confidence in testing the blackhole, a corresponding 'whitehole' # has also been set up using one port higher: whitehole = resolve_address('whitehole.snakebite.net', 56667) # This address has been configured to immediately drop any incoming # packets as well, but it does it respectfully with regards to the # incoming protocol. RSTs are sent for TCP packets, and ICMP UNREACH # is sent for UDP/ICMP packets. This means our attempts to connect to # it should be met immediately with ECONNREFUSED. The test case has # been structured around this premise: if we get an ECONNREFUSED from # the whitehole, we proceed with testing connect timeout against the # blackhole. If we don't, we skip the test (with a message about not # getting the required RST from the whitehole within the required # timeframe). # For the records, the whitehole/blackhole configuration has been set # up using the 'pf' firewall (available on BSDs), using the following: # # ext_if="bge0" # # blackhole_ip="35.8.247.6" # whitehole_ip="35.8.247.6" # blackhole_port="56666" # whitehole_port="56667" # # block return in log quick on $ext_if proto { tcp udp } \ # from any to $whitehole_ip port $whitehole_port # block drop in log quick on $ext_if proto { tcp udp } \ # from any to $blackhole_ip port $blackhole_port # skip = True sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Use a timeout of 3 seconds. Why 3? Because it's more than 1, and # less than 5. i.e. no particular reason. Feel free to tweak it if # you feel a different value would be more appropriate. timeout = 3 sock.settimeout(timeout) try: sock.connect((whitehole)) except socket.timeout: pass except OSError as err: if err.errno == errno.ECONNREFUSED: skip = False finally: sock.close() del sock if skip: self.skipTest( "We didn't receive a connection reset (RST) packet from " "{}:{} within {} seconds, so we're unable to test connect " "timeout against the corresponding {}:{} (which is " "configured to silently drop packets)." .format( whitehole[0], whitehole[1], timeout, blackhole[0], blackhole[1], ) ) # All that hard work just to test if connect times out in 0.001s ;-) self.addr_remote = blackhole with support.transient_internet(self.addr_remote[0]): self._sock_operation(1, 0.001, 'connect', self.addr_remote) def testRecvTimeout(self): # Test recv() timeout with support.transient_internet(self.addr_remote[0]): self.sock.connect(self.addr_remote) self._sock_operation(1, 1.5, 'recv', 1024) def testAcceptTimeout(self): # Test accept() timeout support.bind_port(self.sock, self.localhost) self.sock.listen() self._sock_operation(1, 1.5, 'accept') def testSend(self): # Test send() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) serv.listen() self.sock.connect(serv.getsockname()) # Send a lot of data in order to bypass buffering in the TCP stack. self._sock_operation(100, 1.5, 'send', b"X" * 200000) def testSendto(self): # Test sendto() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) serv.listen() self.sock.connect(serv.getsockname()) # The address argument is ignored since we already connected. self._sock_operation(100, 1.5, 'sendto', b"X" * 200000, serv.getsockname()) def testSendall(self): # Test sendall() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) serv.listen() self.sock.connect(serv.getsockname()) # Send a lot of data in order to bypass buffering in the TCP stack. self._sock_operation(100, 1.5, 'sendall', b"X" * 200000) class UDPTimeoutTestCase(TimeoutTestCase): """UDP test case for socket.socket() timeout functions""" def setUp(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def tearDown(self): self.sock.close() def testRecvfromTimeout(self): # Test recvfrom() timeout # Prevent "Address already in use" socket exceptions support.bind_port(self.sock, self.localhost) self._sock_operation(1, 1.5, 'recvfrom', 1024) def test_main(): # support.requires('network') support.run_unittest( CreationTestCase, # TCPTimeoutTestCase, no internet test allowed # UDPTimeoutTestCase, ) if __name__ == "__main__": test_main()
11,406
304
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_xmlrpc_net.py
import collections.abc import unittest from test import support import xmlrpc.client as xmlrpclib @unittest.skip('XXX: buildbot.python.org/all/xmlrpc/ is gone') class PythonBuildersTest(unittest.TestCase): def test_python_builders(self): # Get the list of builders from the XMLRPC buildbot interface at # python.org. server = xmlrpclib.ServerProxy("http://buildbot.python.org/all/xmlrpc/") try: builders = server.getAllBuilders() except OSError as e: self.skipTest("network error: %s" % e) self.addCleanup(lambda: server('close')()) # Perform a minimal sanity check on the result, just to be sure # the request means what we think it means. self.assertIsInstance(builders, collections.abc.Sequence) self.assertTrue([x for x in builders if "3.x" in x], builders) def test_main(): support.requires("network") support.run_unittest(PythonBuildersTest) if __name__ == "__main__": test_main()
1,015
33
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_calendar.py
import calendar import unittest from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import time import locale import sys import datetime import os result_2004_01_text = """\ January 2004 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 """ result_2004_text = """\ 2004 January February March Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 1 1 2 3 4 5 6 7 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14 12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21 19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28 26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31 April May June Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 1 2 1 2 3 4 5 6 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13 12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20 19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27 26 27 28 29 30 24 25 26 27 28 29 30 28 29 30 31 July August September Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 1 1 2 3 4 5 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 30 31 October November December Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 25 26 27 28 29 30 31 29 30 27 28 29 30 31 """ result_2004_html = """\ <?xml version="1.0" encoding="%(e)s"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=%(e)s" /> <link rel="stylesheet" type="text/css" href="calendar.css" /> <title>Calendar for 2004</title> </head> <body> <table border="0" cellpadding="0" cellspacing="0" class="year"> <tr><th colspan="3" class="year">2004</th></tr><tr><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">January</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="thu">1</td><td class="fri">2</td><td class="sat">3</td><td class="sun">4</td></tr> <tr><td class="mon">5</td><td class="tue">6</td><td class="wed">7</td><td class="thu">8</td><td class="fri">9</td><td class="sat">10</td><td class="sun">11</td></tr> <tr><td class="mon">12</td><td class="tue">13</td><td class="wed">14</td><td class="thu">15</td><td class="fri">16</td><td class="sat">17</td><td class="sun">18</td></tr> <tr><td class="mon">19</td><td class="tue">20</td><td class="wed">21</td><td class="thu">22</td><td class="fri">23</td><td class="sat">24</td><td class="sun">25</td></tr> <tr><td class="mon">26</td><td class="tue">27</td><td class="wed">28</td><td class="thu">29</td><td class="fri">30</td><td class="sat">31</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">February</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="sun">1</td></tr> <tr><td class="mon">2</td><td class="tue">3</td><td class="wed">4</td><td class="thu">5</td><td class="fri">6</td><td class="sat">7</td><td class="sun">8</td></tr> <tr><td class="mon">9</td><td class="tue">10</td><td class="wed">11</td><td class="thu">12</td><td class="fri">13</td><td class="sat">14</td><td class="sun">15</td></tr> <tr><td class="mon">16</td><td class="tue">17</td><td class="wed">18</td><td class="thu">19</td><td class="fri">20</td><td class="sat">21</td><td class="sun">22</td></tr> <tr><td class="mon">23</td><td class="tue">24</td><td class="wed">25</td><td class="thu">26</td><td class="fri">27</td><td class="sat">28</td><td class="sun">29</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">March</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="mon">1</td><td class="tue">2</td><td class="wed">3</td><td class="thu">4</td><td class="fri">5</td><td class="sat">6</td><td class="sun">7</td></tr> <tr><td class="mon">8</td><td class="tue">9</td><td class="wed">10</td><td class="thu">11</td><td class="fri">12</td><td class="sat">13</td><td class="sun">14</td></tr> <tr><td class="mon">15</td><td class="tue">16</td><td class="wed">17</td><td class="thu">18</td><td class="fri">19</td><td class="sat">20</td><td class="sun">21</td></tr> <tr><td class="mon">22</td><td class="tue">23</td><td class="wed">24</td><td class="thu">25</td><td class="fri">26</td><td class="sat">27</td><td class="sun">28</td></tr> <tr><td class="mon">29</td><td class="tue">30</td><td class="wed">31</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td></tr><tr><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">April</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="thu">1</td><td class="fri">2</td><td class="sat">3</td><td class="sun">4</td></tr> <tr><td class="mon">5</td><td class="tue">6</td><td class="wed">7</td><td class="thu">8</td><td class="fri">9</td><td class="sat">10</td><td class="sun">11</td></tr> <tr><td class="mon">12</td><td class="tue">13</td><td class="wed">14</td><td class="thu">15</td><td class="fri">16</td><td class="sat">17</td><td class="sun">18</td></tr> <tr><td class="mon">19</td><td class="tue">20</td><td class="wed">21</td><td class="thu">22</td><td class="fri">23</td><td class="sat">24</td><td class="sun">25</td></tr> <tr><td class="mon">26</td><td class="tue">27</td><td class="wed">28</td><td class="thu">29</td><td class="fri">30</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">May</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="sat">1</td><td class="sun">2</td></tr> <tr><td class="mon">3</td><td class="tue">4</td><td class="wed">5</td><td class="thu">6</td><td class="fri">7</td><td class="sat">8</td><td class="sun">9</td></tr> <tr><td class="mon">10</td><td class="tue">11</td><td class="wed">12</td><td class="thu">13</td><td class="fri">14</td><td class="sat">15</td><td class="sun">16</td></tr> <tr><td class="mon">17</td><td class="tue">18</td><td class="wed">19</td><td class="thu">20</td><td class="fri">21</td><td class="sat">22</td><td class="sun">23</td></tr> <tr><td class="mon">24</td><td class="tue">25</td><td class="wed">26</td><td class="thu">27</td><td class="fri">28</td><td class="sat">29</td><td class="sun">30</td></tr> <tr><td class="mon">31</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">June</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="tue">1</td><td class="wed">2</td><td class="thu">3</td><td class="fri">4</td><td class="sat">5</td><td class="sun">6</td></tr> <tr><td class="mon">7</td><td class="tue">8</td><td class="wed">9</td><td class="thu">10</td><td class="fri">11</td><td class="sat">12</td><td class="sun">13</td></tr> <tr><td class="mon">14</td><td class="tue">15</td><td class="wed">16</td><td class="thu">17</td><td class="fri">18</td><td class="sat">19</td><td class="sun">20</td></tr> <tr><td class="mon">21</td><td class="tue">22</td><td class="wed">23</td><td class="thu">24</td><td class="fri">25</td><td class="sat">26</td><td class="sun">27</td></tr> <tr><td class="mon">28</td><td class="tue">29</td><td class="wed">30</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td></tr><tr><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">July</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="thu">1</td><td class="fri">2</td><td class="sat">3</td><td class="sun">4</td></tr> <tr><td class="mon">5</td><td class="tue">6</td><td class="wed">7</td><td class="thu">8</td><td class="fri">9</td><td class="sat">10</td><td class="sun">11</td></tr> <tr><td class="mon">12</td><td class="tue">13</td><td class="wed">14</td><td class="thu">15</td><td class="fri">16</td><td class="sat">17</td><td class="sun">18</td></tr> <tr><td class="mon">19</td><td class="tue">20</td><td class="wed">21</td><td class="thu">22</td><td class="fri">23</td><td class="sat">24</td><td class="sun">25</td></tr> <tr><td class="mon">26</td><td class="tue">27</td><td class="wed">28</td><td class="thu">29</td><td class="fri">30</td><td class="sat">31</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">August</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="sun">1</td></tr> <tr><td class="mon">2</td><td class="tue">3</td><td class="wed">4</td><td class="thu">5</td><td class="fri">6</td><td class="sat">7</td><td class="sun">8</td></tr> <tr><td class="mon">9</td><td class="tue">10</td><td class="wed">11</td><td class="thu">12</td><td class="fri">13</td><td class="sat">14</td><td class="sun">15</td></tr> <tr><td class="mon">16</td><td class="tue">17</td><td class="wed">18</td><td class="thu">19</td><td class="fri">20</td><td class="sat">21</td><td class="sun">22</td></tr> <tr><td class="mon">23</td><td class="tue">24</td><td class="wed">25</td><td class="thu">26</td><td class="fri">27</td><td class="sat">28</td><td class="sun">29</td></tr> <tr><td class="mon">30</td><td class="tue">31</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">September</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="wed">1</td><td class="thu">2</td><td class="fri">3</td><td class="sat">4</td><td class="sun">5</td></tr> <tr><td class="mon">6</td><td class="tue">7</td><td class="wed">8</td><td class="thu">9</td><td class="fri">10</td><td class="sat">11</td><td class="sun">12</td></tr> <tr><td class="mon">13</td><td class="tue">14</td><td class="wed">15</td><td class="thu">16</td><td class="fri">17</td><td class="sat">18</td><td class="sun">19</td></tr> <tr><td class="mon">20</td><td class="tue">21</td><td class="wed">22</td><td class="thu">23</td><td class="fri">24</td><td class="sat">25</td><td class="sun">26</td></tr> <tr><td class="mon">27</td><td class="tue">28</td><td class="wed">29</td><td class="thu">30</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td></tr><tr><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">October</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="fri">1</td><td class="sat">2</td><td class="sun">3</td></tr> <tr><td class="mon">4</td><td class="tue">5</td><td class="wed">6</td><td class="thu">7</td><td class="fri">8</td><td class="sat">9</td><td class="sun">10</td></tr> <tr><td class="mon">11</td><td class="tue">12</td><td class="wed">13</td><td class="thu">14</td><td class="fri">15</td><td class="sat">16</td><td class="sun">17</td></tr> <tr><td class="mon">18</td><td class="tue">19</td><td class="wed">20</td><td class="thu">21</td><td class="fri">22</td><td class="sat">23</td><td class="sun">24</td></tr> <tr><td class="mon">25</td><td class="tue">26</td><td class="wed">27</td><td class="thu">28</td><td class="fri">29</td><td class="sat">30</td><td class="sun">31</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">November</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="mon">1</td><td class="tue">2</td><td class="wed">3</td><td class="thu">4</td><td class="fri">5</td><td class="sat">6</td><td class="sun">7</td></tr> <tr><td class="mon">8</td><td class="tue">9</td><td class="wed">10</td><td class="thu">11</td><td class="fri">12</td><td class="sat">13</td><td class="sun">14</td></tr> <tr><td class="mon">15</td><td class="tue">16</td><td class="wed">17</td><td class="thu">18</td><td class="fri">19</td><td class="sat">20</td><td class="sun">21</td></tr> <tr><td class="mon">22</td><td class="tue">23</td><td class="wed">24</td><td class="thu">25</td><td class="fri">26</td><td class="sat">27</td><td class="sun">28</td></tr> <tr><td class="mon">29</td><td class="tue">30</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td><td><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">December</th></tr> <tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr> <tr><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="wed">1</td><td class="thu">2</td><td class="fri">3</td><td class="sat">4</td><td class="sun">5</td></tr> <tr><td class="mon">6</td><td class="tue">7</td><td class="wed">8</td><td class="thu">9</td><td class="fri">10</td><td class="sat">11</td><td class="sun">12</td></tr> <tr><td class="mon">13</td><td class="tue">14</td><td class="wed">15</td><td class="thu">16</td><td class="fri">17</td><td class="sat">18</td><td class="sun">19</td></tr> <tr><td class="mon">20</td><td class="tue">21</td><td class="wed">22</td><td class="thu">23</td><td class="fri">24</td><td class="sat">25</td><td class="sun">26</td></tr> <tr><td class="mon">27</td><td class="tue">28</td><td class="wed">29</td><td class="thu">30</td><td class="fri">31</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr> </table> </td></tr></table></body> </html> """ result_2004_days = [ [[[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]], [[0, 0, 0, 0, 0, 0, 1], [2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28, 29]], [[1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21], [22, 23, 24, 25, 26, 27, 28], [29, 30, 31, 0, 0, 0, 0]]], [[[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 0, 0]], [[0, 0, 0, 0, 0, 1, 2], [3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29, 30], [31, 0, 0, 0, 0, 0, 0]], [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 0, 0, 0, 0]]], [[[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]], [[0, 0, 0, 0, 0, 0, 1], [2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22], [23, 24, 25, 26, 27, 28, 29], [30, 31, 0, 0, 0, 0, 0]], [[0, 0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26], [27, 28, 29, 30, 0, 0, 0]]], [[[0, 0, 0, 0, 1, 2, 3], [4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30, 31]], [[1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21], [22, 23, 24, 25, 26, 27, 28], [29, 30, 0, 0, 0, 0, 0]], [[0, 0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26], [27, 28, 29, 30, 31, 0, 0]]] ] result_2004_dates = \ [[['12/29/03 12/30/03 12/31/03 01/01/04 01/02/04 01/03/04 01/04/04', '01/05/04 01/06/04 01/07/04 01/08/04 01/09/04 01/10/04 01/11/04', '01/12/04 01/13/04 01/14/04 01/15/04 01/16/04 01/17/04 01/18/04', '01/19/04 01/20/04 01/21/04 01/22/04 01/23/04 01/24/04 01/25/04', '01/26/04 01/27/04 01/28/04 01/29/04 01/30/04 01/31/04 02/01/04'], ['01/26/04 01/27/04 01/28/04 01/29/04 01/30/04 01/31/04 02/01/04', '02/02/04 02/03/04 02/04/04 02/05/04 02/06/04 02/07/04 02/08/04', '02/09/04 02/10/04 02/11/04 02/12/04 02/13/04 02/14/04 02/15/04', '02/16/04 02/17/04 02/18/04 02/19/04 02/20/04 02/21/04 02/22/04', '02/23/04 02/24/04 02/25/04 02/26/04 02/27/04 02/28/04 02/29/04'], ['03/01/04 03/02/04 03/03/04 03/04/04 03/05/04 03/06/04 03/07/04', '03/08/04 03/09/04 03/10/04 03/11/04 03/12/04 03/13/04 03/14/04', '03/15/04 03/16/04 03/17/04 03/18/04 03/19/04 03/20/04 03/21/04', '03/22/04 03/23/04 03/24/04 03/25/04 03/26/04 03/27/04 03/28/04', '03/29/04 03/30/04 03/31/04 04/01/04 04/02/04 04/03/04 04/04/04']], [['03/29/04 03/30/04 03/31/04 04/01/04 04/02/04 04/03/04 04/04/04', '04/05/04 04/06/04 04/07/04 04/08/04 04/09/04 04/10/04 04/11/04', '04/12/04 04/13/04 04/14/04 04/15/04 04/16/04 04/17/04 04/18/04', '04/19/04 04/20/04 04/21/04 04/22/04 04/23/04 04/24/04 04/25/04', '04/26/04 04/27/04 04/28/04 04/29/04 04/30/04 05/01/04 05/02/04'], ['04/26/04 04/27/04 04/28/04 04/29/04 04/30/04 05/01/04 05/02/04', '05/03/04 05/04/04 05/05/04 05/06/04 05/07/04 05/08/04 05/09/04', '05/10/04 05/11/04 05/12/04 05/13/04 05/14/04 05/15/04 05/16/04', '05/17/04 05/18/04 05/19/04 05/20/04 05/21/04 05/22/04 05/23/04', '05/24/04 05/25/04 05/26/04 05/27/04 05/28/04 05/29/04 05/30/04', '05/31/04 06/01/04 06/02/04 06/03/04 06/04/04 06/05/04 06/06/04'], ['05/31/04 06/01/04 06/02/04 06/03/04 06/04/04 06/05/04 06/06/04', '06/07/04 06/08/04 06/09/04 06/10/04 06/11/04 06/12/04 06/13/04', '06/14/04 06/15/04 06/16/04 06/17/04 06/18/04 06/19/04 06/20/04', '06/21/04 06/22/04 06/23/04 06/24/04 06/25/04 06/26/04 06/27/04', '06/28/04 06/29/04 06/30/04 07/01/04 07/02/04 07/03/04 07/04/04']], [['06/28/04 06/29/04 06/30/04 07/01/04 07/02/04 07/03/04 07/04/04', '07/05/04 07/06/04 07/07/04 07/08/04 07/09/04 07/10/04 07/11/04', '07/12/04 07/13/04 07/14/04 07/15/04 07/16/04 07/17/04 07/18/04', '07/19/04 07/20/04 07/21/04 07/22/04 07/23/04 07/24/04 07/25/04', '07/26/04 07/27/04 07/28/04 07/29/04 07/30/04 07/31/04 08/01/04'], ['07/26/04 07/27/04 07/28/04 07/29/04 07/30/04 07/31/04 08/01/04', '08/02/04 08/03/04 08/04/04 08/05/04 08/06/04 08/07/04 08/08/04', '08/09/04 08/10/04 08/11/04 08/12/04 08/13/04 08/14/04 08/15/04', '08/16/04 08/17/04 08/18/04 08/19/04 08/20/04 08/21/04 08/22/04', '08/23/04 08/24/04 08/25/04 08/26/04 08/27/04 08/28/04 08/29/04', '08/30/04 08/31/04 09/01/04 09/02/04 09/03/04 09/04/04 09/05/04'], ['08/30/04 08/31/04 09/01/04 09/02/04 09/03/04 09/04/04 09/05/04', '09/06/04 09/07/04 09/08/04 09/09/04 09/10/04 09/11/04 09/12/04', '09/13/04 09/14/04 09/15/04 09/16/04 09/17/04 09/18/04 09/19/04', '09/20/04 09/21/04 09/22/04 09/23/04 09/24/04 09/25/04 09/26/04', '09/27/04 09/28/04 09/29/04 09/30/04 10/01/04 10/02/04 10/03/04']], [['09/27/04 09/28/04 09/29/04 09/30/04 10/01/04 10/02/04 10/03/04', '10/04/04 10/05/04 10/06/04 10/07/04 10/08/04 10/09/04 10/10/04', '10/11/04 10/12/04 10/13/04 10/14/04 10/15/04 10/16/04 10/17/04', '10/18/04 10/19/04 10/20/04 10/21/04 10/22/04 10/23/04 10/24/04', '10/25/04 10/26/04 10/27/04 10/28/04 10/29/04 10/30/04 10/31/04'], ['11/01/04 11/02/04 11/03/04 11/04/04 11/05/04 11/06/04 11/07/04', '11/08/04 11/09/04 11/10/04 11/11/04 11/12/04 11/13/04 11/14/04', '11/15/04 11/16/04 11/17/04 11/18/04 11/19/04 11/20/04 11/21/04', '11/22/04 11/23/04 11/24/04 11/25/04 11/26/04 11/27/04 11/28/04', '11/29/04 11/30/04 12/01/04 12/02/04 12/03/04 12/04/04 12/05/04'], ['11/29/04 11/30/04 12/01/04 12/02/04 12/03/04 12/04/04 12/05/04', '12/06/04 12/07/04 12/08/04 12/09/04 12/10/04 12/11/04 12/12/04', '12/13/04 12/14/04 12/15/04 12/16/04 12/17/04 12/18/04 12/19/04', '12/20/04 12/21/04 12/22/04 12/23/04 12/24/04 12/25/04 12/26/04', '12/27/04 12/28/04 12/29/04 12/30/04 12/31/04 01/01/05 01/02/05']]] class OutputTestCase(unittest.TestCase): def normalize_calendar(self, s): # Filters out locale dependent strings def neitherspacenordigit(c): return not c.isspace() and not c.isdigit() lines = [] for line in s.splitlines(keepends=False): # Drop texts, as they are locale dependent if line and not filter(neitherspacenordigit, line): lines.append(line) return lines def check_htmlcalendar_encoding(self, req, res): cal = calendar.HTMLCalendar() self.assertEqual( cal.formatyearpage(2004, encoding=req), (result_2004_html % {'e': res}).encode(res) ) def test_output(self): self.assertEqual( self.normalize_calendar(calendar.calendar(2004)), self.normalize_calendar(result_2004_text) ) def test_output_textcalendar(self): self.assertEqual( calendar.TextCalendar().formatyear(2004), result_2004_text ) def test_output_htmlcalendar_encoding_ascii(self): self.check_htmlcalendar_encoding('ascii', 'ascii') def test_output_htmlcalendar_encoding_utf8(self): self.check_htmlcalendar_encoding('utf-8', 'utf-8') def test_output_htmlcalendar_encoding_default(self): self.check_htmlcalendar_encoding(None, sys.getdefaultencoding()) def test_yeardatescalendar(self): def shrink(cal): return [[[' '.join('{:02d}/{:02d}/{}'.format( d.month, d.day, str(d.year)[-2:]) for d in z) for z in y] for y in x] for x in cal] self.assertEqual( shrink(calendar.Calendar().yeardatescalendar(2004)), result_2004_dates ) def test_yeardayscalendar(self): self.assertEqual( calendar.Calendar().yeardayscalendar(2004), result_2004_days ) def test_formatweekheader_short(self): self.assertEqual( calendar.TextCalendar().formatweekheader(2), 'Mo Tu We Th Fr Sa Su' ) def test_formatweekheader_long(self): self.assertEqual( calendar.TextCalendar().formatweekheader(9), ' Monday Tuesday Wednesday Thursday ' ' Friday Saturday Sunday ' ) def test_formatmonth(self): self.assertEqual( calendar.TextCalendar().formatmonth(2004, 1), result_2004_01_text ) def test_formatmonthname_with_year(self): self.assertEqual( calendar.HTMLCalendar().formatmonthname(2004, 1, withyear=True), '<tr><th colspan="7" class="month">January 2004</th></tr>' ) def test_formatmonthname_without_year(self): self.assertEqual( calendar.HTMLCalendar().formatmonthname(2004, 1, withyear=False), '<tr><th colspan="7" class="month">January</th></tr>' ) def test_prweek(self): with support.captured_stdout() as out: week = [(1,0), (2,1), (3,2), (4,3), (5,4), (6,5), (7,6)] calendar.TextCalendar().prweek(week, 1) self.assertEqual(out.getvalue().strip(), "1 2 3 4 5 6 7") def test_prmonth(self): with support.captured_stdout() as out: calendar.TextCalendar().prmonth(2004, 1) self.assertEqual(out.getvalue(), result_2004_01_text) def test_pryear(self): with support.captured_stdout() as out: calendar.TextCalendar().pryear(2004) self.assertEqual(out.getvalue().strip(), result_2004_text.strip()) def test_format(self): with support.captured_stdout() as out: calendar.format(["1", "2", "3"], colwidth=3, spacing=1) self.assertEqual(out.getvalue().strip(), "1 2 3") class CalendarTestCase(unittest.TestCase): def test_isleap(self): # Make sure that the return is right for a few years, and # ensure that the return values are 1 or 0, not just true or # false (see SF bug #485794). Specific additional tests may # be appropriate; this tests a single "cycle". self.assertEqual(calendar.isleap(2000), 1) self.assertEqual(calendar.isleap(2001), 0) self.assertEqual(calendar.isleap(2002), 0) self.assertEqual(calendar.isleap(2003), 0) def test_setfirstweekday(self): self.assertRaises(TypeError, calendar.setfirstweekday, 'flabber') self.assertRaises(ValueError, calendar.setfirstweekday, -1) self.assertRaises(ValueError, calendar.setfirstweekday, 200) orig = calendar.firstweekday() calendar.setfirstweekday(calendar.SUNDAY) self.assertEqual(calendar.firstweekday(), calendar.SUNDAY) calendar.setfirstweekday(calendar.MONDAY) self.assertEqual(calendar.firstweekday(), calendar.MONDAY) calendar.setfirstweekday(orig) def test_illegal_weekday_reported(self): with self.assertRaisesRegex(calendar.IllegalWeekdayError, '123'): calendar.setfirstweekday(123) def test_enumerate_weekdays(self): self.assertRaises(IndexError, calendar.day_abbr.__getitem__, -10) self.assertRaises(IndexError, calendar.day_name.__getitem__, 10) self.assertEqual(len([d for d in calendar.day_abbr]), 7) def test_days(self): for attr in "day_name", "day_abbr": value = getattr(calendar, attr) self.assertEqual(len(value), 7) self.assertEqual(len(value[:]), 7) # ensure they're all unique self.assertEqual(len(set(value)), 7) # verify it "acts like a sequence" in two forms of iteration self.assertEqual(value[::-1], list(reversed(value))) def test_months(self): for attr in "month_name", "month_abbr": value = getattr(calendar, attr) self.assertEqual(len(value), 13) self.assertEqual(len(value[:]), 13) self.assertEqual(value[0], "") # ensure they're all unique self.assertEqual(len(set(value)), 13) # verify it "acts like a sequence" in two forms of iteration self.assertEqual(value[::-1], list(reversed(value))) def test_locale_calendars(self): # ensure that Locale{Text,HTML}Calendar resets the locale properly # (it is still not thread-safe though) old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) try: cal = calendar.LocaleTextCalendar(locale='') local_weekday = cal.formatweekday(1, 10) local_month = cal.formatmonthname(2010, 10, 10) except locale.Error: # cannot set the system default locale -- skip rest of test raise unittest.SkipTest('cannot set the system default locale') self.assertIsInstance(local_weekday, str) self.assertIsInstance(local_month, str) self.assertEqual(len(local_weekday), 10) self.assertGreaterEqual(len(local_month), 10) cal = calendar.LocaleHTMLCalendar(locale='') local_weekday = cal.formatweekday(1) local_month = cal.formatmonthname(2010, 10) self.assertIsInstance(local_weekday, str) self.assertIsInstance(local_month, str) new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) self.assertEqual(old_october, new_october) def test_itermonthdates(self): # ensure itermonthdates doesn't overflow after datetime.MAXYEAR # see #15421 list(calendar.Calendar().itermonthdates(datetime.MAXYEAR, 12)) def test_itermonthdays(self): for firstweekday in range(7): cal = calendar.Calendar(firstweekday) # Test the extremes, see #28253 and #26650 for y, m in [(1, 1), (9999, 12)]: days = list(cal.itermonthdays(y, m)) self.assertIn(len(days), (35, 42)) # Test a short month cal = calendar.Calendar(firstweekday=3) days = list(cal.itermonthdays(2001, 2)) self.assertEqual(days, list(range(1, 29))) def test_itermonthdays2(self): for firstweekday in range(7): cal = calendar.Calendar(firstweekday) # Test the extremes, see #28253 and #26650 for y, m in [(1, 1), (9999, 12)]: days = list(cal.itermonthdays2(y, m)) self.assertEqual(days[0][1], firstweekday) self.assertEqual(days[-1][1], (firstweekday - 1) % 7) class MonthCalendarTestCase(unittest.TestCase): def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday) def tearDown(self): calendar.setfirstweekday(self.oldfirstweekday) def check_weeks(self, year, month, weeks): cal = calendar.monthcalendar(year, month) self.assertEqual(len(cal), len(weeks)) for i in range(len(weeks)): self.assertEqual(weeks[i], sum(day != 0 for day in cal[i])) class MondayTestCase(MonthCalendarTestCase): firstweekday = calendar.MONDAY def test_february(self): # A 28-day february starting on monday (7+7+7+7 days) self.check_weeks(1999, 2, (7, 7, 7, 7)) # A 28-day february starting on tuesday (6+7+7+7+1 days) self.check_weeks(2005, 2, (6, 7, 7, 7, 1)) # A 28-day february starting on sunday (1+7+7+7+6 days) self.check_weeks(1987, 2, (1, 7, 7, 7, 6)) # A 29-day february starting on monday (7+7+7+7+1 days) self.check_weeks(1988, 2, (7, 7, 7, 7, 1)) # A 29-day february starting on tuesday (6+7+7+7+2 days) self.check_weeks(1972, 2, (6, 7, 7, 7, 2)) # A 29-day february starting on sunday (1+7+7+7+7 days) self.check_weeks(2004, 2, (1, 7, 7, 7, 7)) def test_april(self): # A 30-day april starting on monday (7+7+7+7+2 days) self.check_weeks(1935, 4, (7, 7, 7, 7, 2)) # A 30-day april starting on tuesday (6+7+7+7+3 days) self.check_weeks(1975, 4, (6, 7, 7, 7, 3)) # A 30-day april starting on sunday (1+7+7+7+7+1 days) self.check_weeks(1945, 4, (1, 7, 7, 7, 7, 1)) # A 30-day april starting on saturday (2+7+7+7+7 days) self.check_weeks(1995, 4, (2, 7, 7, 7, 7)) # A 30-day april starting on friday (3+7+7+7+6 days) self.check_weeks(1994, 4, (3, 7, 7, 7, 6)) def test_december(self): # A 31-day december starting on monday (7+7+7+7+3 days) self.check_weeks(1980, 12, (7, 7, 7, 7, 3)) # A 31-day december starting on tuesday (6+7+7+7+4 days) self.check_weeks(1987, 12, (6, 7, 7, 7, 4)) # A 31-day december starting on sunday (1+7+7+7+7+2 days) self.check_weeks(1968, 12, (1, 7, 7, 7, 7, 2)) # A 31-day december starting on thursday (4+7+7+7+6 days) self.check_weeks(1988, 12, (4, 7, 7, 7, 6)) # A 31-day december starting on friday (3+7+7+7+7 days) self.check_weeks(2017, 12, (3, 7, 7, 7, 7)) # A 31-day december starting on saturday (2+7+7+7+7+1 days) self.check_weeks(2068, 12, (2, 7, 7, 7, 7, 1)) class SundayTestCase(MonthCalendarTestCase): firstweekday = calendar.SUNDAY def test_february(self): # A 28-day february starting on sunday (7+7+7+7 days) self.check_weeks(2009, 2, (7, 7, 7, 7)) # A 28-day february starting on monday (6+7+7+7+1 days) self.check_weeks(1999, 2, (6, 7, 7, 7, 1)) # A 28-day february starting on saturday (1+7+7+7+6 days) self.check_weeks(1997, 2, (1, 7, 7, 7, 6)) # A 29-day february starting on sunday (7+7+7+7+1 days) self.check_weeks(2004, 2, (7, 7, 7, 7, 1)) # A 29-day february starting on monday (6+7+7+7+2 days) self.check_weeks(1960, 2, (6, 7, 7, 7, 2)) # A 29-day february starting on saturday (1+7+7+7+7 days) self.check_weeks(1964, 2, (1, 7, 7, 7, 7)) def test_april(self): # A 30-day april starting on sunday (7+7+7+7+2 days) self.check_weeks(1923, 4, (7, 7, 7, 7, 2)) # A 30-day april starting on monday (6+7+7+7+3 days) self.check_weeks(1918, 4, (6, 7, 7, 7, 3)) # A 30-day april starting on saturday (1+7+7+7+7+1 days) self.check_weeks(1950, 4, (1, 7, 7, 7, 7, 1)) # A 30-day april starting on friday (2+7+7+7+7 days) self.check_weeks(1960, 4, (2, 7, 7, 7, 7)) # A 30-day april starting on thursday (3+7+7+7+6 days) self.check_weeks(1909, 4, (3, 7, 7, 7, 6)) def test_december(self): # A 31-day december starting on sunday (7+7+7+7+3 days) self.check_weeks(2080, 12, (7, 7, 7, 7, 3)) # A 31-day december starting on monday (6+7+7+7+4 days) self.check_weeks(1941, 12, (6, 7, 7, 7, 4)) # A 31-day december starting on saturday (1+7+7+7+7+2 days) self.check_weeks(1923, 12, (1, 7, 7, 7, 7, 2)) # A 31-day december starting on wednesday (4+7+7+7+6 days) self.check_weeks(1948, 12, (4, 7, 7, 7, 6)) # A 31-day december starting on thursday (3+7+7+7+7 days) self.check_weeks(1927, 12, (3, 7, 7, 7, 7)) # A 31-day december starting on friday (2+7+7+7+7+1 days) self.check_weeks(1995, 12, (2, 7, 7, 7, 7, 1)) class TimegmTestCase(unittest.TestCase): TIMESTAMPS = [0, 10, 100, 1000, 10000, 100000, 1000000, 1234567890, 1262304000, 1275785153,] def test_timegm(self): for secs in self.TIMESTAMPS: tuple = time.gmtime(secs) self.assertEqual(secs, calendar.timegm(tuple)) class MonthRangeTestCase(unittest.TestCase): def test_january(self): # Tests valid lower boundary case. self.assertEqual(calendar.monthrange(2004,1), (3,31)) def test_february_leap(self): # Tests February during leap year. self.assertEqual(calendar.monthrange(2004,2), (6,29)) def test_february_nonleap(self): # Tests February in non-leap year. self.assertEqual(calendar.monthrange(2010,2), (0,28)) def test_december(self): # Tests valid upper boundary case. self.assertEqual(calendar.monthrange(2004,12), (2,31)) def test_zeroth_month(self): # Tests low invalid boundary case. with self.assertRaises(calendar.IllegalMonthError): calendar.monthrange(2004, 0) def test_thirteenth_month(self): # Tests high invalid boundary case. with self.assertRaises(calendar.IllegalMonthError): calendar.monthrange(2004, 13) def test_illegal_month_reported(self): with self.assertRaisesRegex(calendar.IllegalMonthError, '65'): calendar.monthrange(2004, 65) class LeapdaysTestCase(unittest.TestCase): def test_no_range(self): # test when no range i.e. two identical years as args self.assertEqual(calendar.leapdays(2010,2010), 0) def test_no_leapdays(self): # test when no leap years in range self.assertEqual(calendar.leapdays(2010,2011), 0) def test_no_leapdays_upper_boundary(self): # test no leap years in range, when upper boundary is a leap year self.assertEqual(calendar.leapdays(2010,2012), 0) def test_one_leapday_lower_boundary(self): # test when one leap year in range, lower boundary is leap year self.assertEqual(calendar.leapdays(2012,2013), 1) def test_several_leapyears_in_range(self): self.assertEqual(calendar.leapdays(1997,2020), 5) def conv(s): return s.replace('\n', os.linesep).encode() class CommandLineTestCase(unittest.TestCase): def run_ok(self, *args): return assert_python_ok('-m', 'calendar', *args)[1] def assertFailure(self, *args): rc, stdout, stderr = assert_python_failure('-m', 'calendar', *args) self.assertIn(b'usage:', stderr) self.assertEqual(rc, 2) def test_help(self): stdout = self.run_ok('-h') self.assertIn(b'usage:', stdout) self.assertIn(b'calendar.py', stdout) self.assertIn(b'--help', stdout) def test_illegal_arguments(self): self.assertFailure('-z') self.assertFailure('spam') self.assertFailure('2004', 'spam') self.assertFailure('-t', 'html', '2004', '1') def test_output_current_year(self): stdout = self.run_ok() year = datetime.datetime.now().year self.assertIn((' %s' % year).encode(), stdout) self.assertIn(b'January', stdout) self.assertIn(b'Mo Tu We Th Fr Sa Su', stdout) def test_output_year(self): stdout = self.run_ok('2004') self.assertEqual(stdout, conv(result_2004_text)) def test_output_month(self): stdout = self.run_ok('2004', '1') self.assertEqual(stdout, conv(result_2004_01_text)) def test_option_encoding(self): return self.assertFailure('-e') self.assertFailure('--encoding') stdout = self.run_ok('--encoding', 'utf-16-le', '2004') self.assertEqual(stdout, result_2004_text.encode('utf-16-le')) def test_option_locale(self): self.assertFailure('-L') self.assertFailure('--locale') self.assertFailure('-L', 'en') lang, enc = locale.getdefaultlocale() lang = lang or 'C' enc = enc or 'UTF-8' try: oldlocale = locale.getlocale(locale.LC_TIME) try: locale.setlocale(locale.LC_TIME, (lang, enc)) finally: locale.setlocale(locale.LC_TIME, oldlocale) except (locale.Error, ValueError): self.skipTest('cannot set the system default locale') stdout = self.run_ok('--locale', lang, '--encoding', enc, '2004') self.assertIn('2004'.encode(enc), stdout) def test_option_width(self): self.assertFailure('-w') self.assertFailure('--width') self.assertFailure('-w', 'spam') stdout = self.run_ok('--width', '3', '2004') self.assertIn(b'Mon Tue Wed Thu Fri Sat Sun', stdout) def test_option_lines(self): self.assertFailure('-l') self.assertFailure('--lines') self.assertFailure('-l', 'spam') stdout = self.run_ok('--lines', '2', '2004') self.assertIn(conv('December\n\nMo Tu We'), stdout) def test_option_spacing(self): self.assertFailure('-s') self.assertFailure('--spacing') self.assertFailure('-s', 'spam') stdout = self.run_ok('--spacing', '8', '2004') self.assertIn(b'Su Mo', stdout) def test_option_months(self): self.assertFailure('-m') self.assertFailure('--month') self.assertFailure('-m', 'spam') stdout = self.run_ok('--months', '1', '2004') self.assertIn(conv('\nMo Tu We Th Fr Sa Su\n'), stdout) def test_option_type(self): self.assertFailure('-t') self.assertFailure('--type') self.assertFailure('-t', 'spam') stdout = self.run_ok('--type', 'text', '2004') self.assertEqual(stdout, conv(result_2004_text)) stdout = self.run_ok('--type', 'html', '2004') self.assertEqual(stdout[:6], b'<?xml ') self.assertIn(b'<title>Calendar for 2004</title>', stdout) def test_html_output_current_year(self): stdout = self.run_ok('--type', 'html') year = datetime.datetime.now().year self.assertIn(('<title>Calendar for %s</title>' % year).encode(), stdout) self.assertIn(b'<tr><th colspan="7" class="month">January</th></tr>', stdout) def test_html_output_year_encoding(self): stdout = self.run_ok('-t', 'html', '--encoding', 'ascii', '2004') self.assertEqual(stdout, (result_2004_html % {'e': 'ascii'}).encode('ascii')) def test_html_output_year_css(self): self.assertFailure('-t', 'html', '-c') self.assertFailure('-t', 'html', '--css') stdout = self.run_ok('-t', 'html', '--css', 'custom.css', '2004') self.assertIn(b'<link rel="stylesheet" type="text/css" ' b'href="custom.css" />', stdout) class MiscTestCase(unittest.TestCase): def test__all__(self): blacklist = {'mdays', 'January', 'February', 'EPOCH', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY', 'different_locale', 'c', 'prweek', 'week', 'format', 'formatstring', 'main'} support.check__all__(self, calendar, blacklist=blacklist) if __name__ == "__main__": unittest.main()
45,064
850
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_struct.py
from collections import abc import array import math import operator import unittest import struct import sys from test import support ISBIGENDIAN = sys.byteorder == "big" integer_codes = 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q', 'n', 'N' byteorders = '', '@', '=', '<', '>', '!' def iter_integer_formats(byteorders=byteorders): for code in integer_codes: for byteorder in byteorders: if (byteorder not in ('', '@') and code in ('n', 'N')): continue yield code, byteorder def string_reverse(s): return s[::-1] def bigendian_to_native(value): if ISBIGENDIAN: return value else: return string_reverse(value) class StructTest(unittest.TestCase): def test_isbigendian(self): self.assertEqual((struct.pack('=i', 1)[0] == 0), ISBIGENDIAN) def test_consistence(self): self.assertRaises(struct.error, struct.calcsize, 'Z') sz = struct.calcsize('i') self.assertEqual(sz * 3, struct.calcsize('iii')) fmt = 'cbxxxxxxhhhhiillffd?' fmt3 = '3c3b18x12h6i6l6f3d3?' sz = struct.calcsize(fmt) sz3 = struct.calcsize(fmt3) self.assertEqual(sz * 3, sz3) self.assertRaises(struct.error, struct.pack, 'iii', 3) self.assertRaises(struct.error, struct.pack, 'i', 3, 3, 3) self.assertRaises((TypeError, struct.error), struct.pack, 'i', 'foo') self.assertRaises((TypeError, struct.error), struct.pack, 'P', 'foo') self.assertRaises(struct.error, struct.unpack, 'd', b'flap') s = struct.pack('ii', 1, 2) self.assertRaises(struct.error, struct.unpack, 'iii', s) self.assertRaises(struct.error, struct.unpack, 'i', s) def test_transitiveness(self): c = b'a' b = 1 h = 255 i = 65535 l = 65536 f = 3.1415 d = 3.1415 t = True for prefix in ('', '@', '<', '>', '=', '!'): for format in ('xcbhilfd?', 'xcBHILfd?'): format = prefix + format s = struct.pack(format, c, b, h, i, l, f, d, t) cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) self.assertEqual(cp, c) self.assertEqual(bp, b) self.assertEqual(hp, h) self.assertEqual(ip, i) self.assertEqual(lp, l) self.assertEqual(int(100 * fp), int(100 * f)) self.assertEqual(int(100 * dp), int(100 * d)) self.assertEqual(tp, t) def test_new_features(self): # Test some of the new features in detail # (format, argument, big-endian result, little-endian result, asymmetric) tests = [ ('c', b'a', b'a', b'a', 0), ('xc', b'a', b'\0a', b'\0a', 0), ('cx', b'a', b'a\0', b'a\0', 0), ('s', b'a', b'a', b'a', 0), ('0s', b'helloworld', b'', b'', 1), ('1s', b'helloworld', b'h', b'h', 1), ('9s', b'helloworld', b'helloworl', b'helloworl', 1), ('10s', b'helloworld', b'helloworld', b'helloworld', 0), ('11s', b'helloworld', b'helloworld\0', b'helloworld\0', 1), ('20s', b'helloworld', b'helloworld'+10*b'\0', b'helloworld'+10*b'\0', 1), ('b', 7, b'\7', b'\7', 0), ('b', -7, b'\371', b'\371', 0), ('B', 7, b'\7', b'\7', 0), ('B', 249, b'\371', b'\371', 0), ('h', 700, b'\002\274', b'\274\002', 0), ('h', -700, b'\375D', b'D\375', 0), ('H', 700, b'\002\274', b'\274\002', 0), ('H', 0x10000-700, b'\375D', b'D\375', 0), ('i', 70000000, b'\004,\035\200', b'\200\035,\004', 0), ('i', -70000000, b'\373\323\342\200', b'\200\342\323\373', 0), ('I', 70000000, b'\004,\035\200', b'\200\035,\004', 0), ('I', 0x100000000-70000000, b'\373\323\342\200', b'\200\342\323\373', 0), ('l', 70000000, b'\004,\035\200', b'\200\035,\004', 0), ('l', -70000000, b'\373\323\342\200', b'\200\342\323\373', 0), ('L', 70000000, b'\004,\035\200', b'\200\035,\004', 0), ('L', 0x100000000-70000000, b'\373\323\342\200', b'\200\342\323\373', 0), ('f', 2.0, b'@\000\000\000', b'\000\000\000@', 0), ('d', 2.0, b'@\000\000\000\000\000\000\000', b'\000\000\000\000\000\000\000@', 0), ('f', -2.0, b'\300\000\000\000', b'\000\000\000\300', 0), ('d', -2.0, b'\300\000\000\000\000\000\000\000', b'\000\000\000\000\000\000\000\300', 0), ('?', 0, b'\0', b'\0', 0), ('?', 3, b'\1', b'\1', 1), ('?', True, b'\1', b'\1', 0), ('?', [], b'\0', b'\0', 1), ('?', (1,), b'\1', b'\1', 1), ] for fmt, arg, big, lil, asy in tests: for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), ('='+fmt, ISBIGENDIAN and big or lil)]: res = struct.pack(xfmt, arg) self.assertEqual(res, exp) self.assertEqual(struct.calcsize(xfmt), len(res)) rev = struct.unpack(xfmt, res)[0] if rev != arg: self.assertTrue(asy) def test_calcsize(self): expected_size = { 'b': 1, 'B': 1, 'h': 2, 'H': 2, 'i': 4, 'I': 4, 'l': 4, 'L': 4, 'q': 8, 'Q': 8, } # standard integer sizes for code, byteorder in iter_integer_formats(('=', '<', '>', '!')): format = byteorder+code size = struct.calcsize(format) self.assertEqual(size, expected_size[code]) # native integer sizes native_pairs = 'bB', 'hH', 'iI', 'lL', 'nN', 'qQ' for format_pair in native_pairs: for byteorder in '', '@': signed_size = struct.calcsize(byteorder + format_pair[0]) unsigned_size = struct.calcsize(byteorder + format_pair[1]) self.assertEqual(signed_size, unsigned_size) # bounds for native integer sizes self.assertEqual(struct.calcsize('b'), 1) self.assertLessEqual(2, struct.calcsize('h')) self.assertLessEqual(4, struct.calcsize('l')) self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i')) self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l')) self.assertLessEqual(8, struct.calcsize('q')) self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q')) self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('i')) self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('P')) def test_integers(self): # Integer tests (bBhHiIlLqQnN). import binascii class IntTester(unittest.TestCase): def __init__(self, format): super(IntTester, self).__init__(methodName='test_one') self.format = format self.code = format[-1] self.byteorder = format[:-1] if not self.byteorder in byteorders: raise ValueError("unrecognized packing byteorder: %s" % self.byteorder) self.bytesize = struct.calcsize(format) self.bitsize = self.bytesize * 8 if self.code in tuple('bhilqn'): self.signed = True self.min_value = -(2**(self.bitsize-1)) self.max_value = 2**(self.bitsize-1) - 1 elif self.code in tuple('BHILQN'): self.signed = False self.min_value = 0 self.max_value = 2**self.bitsize - 1 else: raise ValueError("unrecognized format code: %s" % self.code) def test_one(self, x, pack=struct.pack, unpack=struct.unpack, unhexlify=binascii.unhexlify): format = self.format if self.min_value <= x <= self.max_value: expected = x if self.signed and x < 0: expected += 1 << self.bitsize self.assertGreaterEqual(expected, 0) expected = '%x' % expected if len(expected) & 1: expected = "0" + expected expected = expected.encode('ascii') expected = unhexlify(expected) expected = (b"\x00" * (self.bytesize - len(expected)) + expected) if (self.byteorder == '<' or self.byteorder in ('', '@', '=') and not ISBIGENDIAN): expected = string_reverse(expected) self.assertEqual(len(expected), self.bytesize) # Pack work? got = pack(format, x) self.assertEqual(got, expected) # Unpack work? retrieved = unpack(format, got)[0] self.assertEqual(x, retrieved) # Adding any byte should cause a "too big" error. self.assertRaises((struct.error, TypeError), unpack, format, b'\x01' + got) else: # x is out of range -- verify pack realizes that. self.assertRaises((OverflowError, ValueError, struct.error), pack, format, x) def run(self): from random import randrange # Create all interesting powers of 2. values = [] for exp in range(self.bitsize + 3): values.append(1 << exp) # Add some random values. for i in range(self.bitsize): val = 0 for j in range(self.bytesize): val = (val << 8) | randrange(256) values.append(val) # Values absorbed from other tests values.extend([300, 700000, sys.maxsize*4]) # Try all those, and their negations, and +-1 from # them. Note that this tests all power-of-2 # boundaries in range, and a few out of range, plus # +-(2**n +- 1). for base in values: for val in -base, base: for incr in -1, 0, 1: x = val + incr self.test_one(x) # Some error cases. class NotAnInt: def __int__(self): return 42 # Objects with an '__index__' method should be allowed # to pack as integers. That is assuming the implemented # '__index__' method returns an 'int'. class Indexable(object): def __init__(self, value): self._value = value def __index__(self): return self._value # If the '__index__' method raises a type error, then # '__int__' should be used with a deprecation warning. class BadIndex(object): def __index__(self): raise TypeError def __int__(self): return 42 self.assertRaises((TypeError, struct.error), struct.pack, self.format, "a string") self.assertRaises((TypeError, struct.error), struct.pack, self.format, randrange) self.assertRaises((TypeError, struct.error), struct.pack, self.format, 3+42j) self.assertRaises((TypeError, struct.error), struct.pack, self.format, NotAnInt()) self.assertRaises((TypeError, struct.error), struct.pack, self.format, BadIndex()) # Check for legitimate values from '__index__'. for obj in (Indexable(0), Indexable(10), Indexable(17), Indexable(42), Indexable(100), Indexable(127)): try: struct.pack(format, obj) except: self.fail("integer code pack failed on object " "with '__index__' method") # Check for bogus values from '__index__'. for obj in (Indexable(b'a'), Indexable('b'), Indexable(None), Indexable({'a': 1}), Indexable([1, 2, 3])): self.assertRaises((TypeError, struct.error), struct.pack, self.format, obj) for code, byteorder in iter_integer_formats(): format = byteorder+code t = IntTester(format) t.run() def test_nN_code(self): # n and N don't exist in standard sizes def assertStructError(func, *args, **kwargs): with self.assertRaises(struct.error) as cm: func(*args, **kwargs) self.assertIn("bad char in struct format", str(cm.exception)) for code in 'nN': for byteorder in ('=', '<', '>', '!'): format = byteorder+code assertStructError(struct.calcsize, format) assertStructError(struct.pack, format, 0) assertStructError(struct.unpack, format, b"") def test_p_code(self): # Test p ("Pascal string") code. for code, input, expected, expectedback in [ ('p', b'abc', b'\x00', b''), ('1p', b'abc', b'\x00', b''), ('2p', b'abc', b'\x01a', b'a'), ('3p', b'abc', b'\x02ab', b'ab'), ('4p', b'abc', b'\x03abc', b'abc'), ('5p', b'abc', b'\x03abc\x00', b'abc'), ('6p', b'abc', b'\x03abc\x00\x00', b'abc'), ('1000p', b'x'*1000, b'\xff' + b'x'*999, b'x'*255)]: got = struct.pack(code, input) self.assertEqual(got, expected) (got,) = struct.unpack(code, got) self.assertEqual(got, expectedback) def test_705836(self): # SF bug 705836. "<f" and ">f" had a severe rounding bug, where a carry # from the low-order discarded bits could propagate into the exponent # field, causing the result to be wrong by a factor of 2. for base in range(1, 33): # smaller <- largest representable float less than base. delta = 0.5 while base - delta / 2.0 != base: delta /= 2.0 smaller = base - delta # Packing this rounds away a solid string of trailing 1 bits. packed = struct.pack("<f", smaller) unpacked = struct.unpack("<f", packed)[0] # This failed at base = 2, 4, and 32, with unpacked = 1, 2, and # 16, respectively. self.assertEqual(base, unpacked) bigpacked = struct.pack(">f", smaller) self.assertEqual(bigpacked, string_reverse(packed)) unpacked = struct.unpack(">f", bigpacked)[0] self.assertEqual(base, unpacked) # Largest finite IEEE single. big = (1 << 24) - 1 big = math.ldexp(big, 127 - 23) packed = struct.pack(">f", big) unpacked = struct.unpack(">f", packed)[0] self.assertEqual(big, unpacked) # The same, but tack on a 1 bit so it rounds up to infinity. big = (1 << 25) - 1 big = math.ldexp(big, 127 - 24) self.assertRaises(OverflowError, struct.pack, ">f", big) def test_1530559(self): for code, byteorder in iter_integer_formats(): format = byteorder + code self.assertRaises(struct.error, struct.pack, format, 1.0) self.assertRaises(struct.error, struct.pack, format, 1.5) self.assertRaises(struct.error, struct.pack, 'P', 1.0) self.assertRaises(struct.error, struct.pack, 'P', 1.5) def test_unpack_from(self): test_string = b'abcd01234' fmt = '4s' s = struct.Struct(fmt) for cls in (bytes, bytearray): data = cls(test_string) self.assertEqual(s.unpack_from(data), (b'abcd',)) self.assertEqual(s.unpack_from(data, 2), (b'cd01',)) self.assertEqual(s.unpack_from(data, 4), (b'0123',)) for i in range(6): self.assertEqual(s.unpack_from(data, i), (data[i:i+4],)) for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, s.unpack_from, data, i) for cls in (bytes, bytearray): data = cls(test_string) self.assertEqual(struct.unpack_from(fmt, data), (b'abcd',)) self.assertEqual(struct.unpack_from(fmt, data, 2), (b'cd01',)) self.assertEqual(struct.unpack_from(fmt, data, 4), (b'0123',)) for i in range(6): self.assertEqual(struct.unpack_from(fmt, data, i), (data[i:i+4],)) for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) # keyword arguments self.assertEqual(s.unpack_from(buffer=test_string, offset=2), (b'cd01',)) def test_pack_into(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) fmt = '21s' s = struct.Struct(fmt) # Test without offset s.pack_into(writable_buf, 0, test_string) from_buf = writable_buf.tobytes()[:len(test_string)] self.assertEqual(from_buf, test_string) # Test with offset. s.pack_into(writable_buf, 10, test_string) from_buf = writable_buf.tobytes()[:len(test_string)+10] self.assertEqual(from_buf, test_string[:10] + test_string) # Go beyond boundaries. small_buf = array.array('b', b' '*10) self.assertRaises((ValueError, struct.error), s.pack_into, small_buf, 0, test_string) self.assertRaises((ValueError, struct.error), s.pack_into, small_buf, 2, test_string) # Test bogus offset (issue 3694) sb = small_buf self.assertRaises((TypeError, struct.error), struct.pack_into, b'', sb, None) def test_pack_into_fn(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) fmt = '21s' pack_into = lambda *args: struct.pack_into(fmt, *args) # Test without offset. pack_into(writable_buf, 0, test_string) from_buf = writable_buf.tobytes()[:len(test_string)] self.assertEqual(from_buf, test_string) # Test with offset. pack_into(writable_buf, 10, test_string) from_buf = writable_buf.tobytes()[:len(test_string)+10] self.assertEqual(from_buf, test_string[:10] + test_string) # Go beyond boundaries. small_buf = array.array('b', b' '*10) self.assertRaises((ValueError, struct.error), pack_into, small_buf, 0, test_string) self.assertRaises((ValueError, struct.error), pack_into, small_buf, 2, test_string) def test_unpack_with_buffer(self): # SF bug 1563759: struct.unpack doesn't support buffer protocol objects data1 = array.array('B', b'\x12\x34\x56\x78') data2 = memoryview(b'\x12\x34\x56\x78') # XXX b'......XXXX......', 6, 4 for data in [data1, data2]: value, = struct.unpack('>I', data) self.assertEqual(value, 0x12345678) def test_bool(self): class ExplodingBool(object): def __bool__(self): raise OSError for prefix in tuple("<>!=")+('',): false = (), [], [], '', 0 true = [1], 'test', 5, -1, 0xffffffff+1, 0xffffffff/2 falseFormat = prefix + '?' * len(false) packedFalse = struct.pack(falseFormat, *false) unpackedFalse = struct.unpack(falseFormat, packedFalse) trueFormat = prefix + '?' * len(true) packedTrue = struct.pack(trueFormat, *true) unpackedTrue = struct.unpack(trueFormat, packedTrue) self.assertEqual(len(true), len(unpackedTrue)) self.assertEqual(len(false), len(unpackedFalse)) for t in unpackedFalse: self.assertFalse(t) for t in unpackedTrue: self.assertTrue(t) packed = struct.pack(prefix+'?', 1) self.assertEqual(len(packed), struct.calcsize(prefix+'?')) if len(packed) != 1: self.assertFalse(prefix, msg='encoded bool is not one byte: %r' %packed) try: struct.pack(prefix + '?', ExplodingBool()) except OSError: pass else: self.fail("Expected OSError: struct.pack(%r, " "ExplodingBool())" % (prefix + '?')) for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']: self.assertTrue(struct.unpack('>?', c)[0]) def test_count_overflow(self): hugecount = '{}b'.format(sys.maxsize+1) self.assertRaises(struct.error, struct.calcsize, hugecount) hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2) self.assertRaises(struct.error, struct.calcsize, hugecount2) def test_trailing_counter(self): store = array.array('b', b' '*100) # format lists containing only count spec should result in an error self.assertRaises(struct.error, struct.pack, '12345') self.assertRaises(struct.error, struct.unpack, '12345', '') self.assertRaises(struct.error, struct.pack_into, '12345', store, 0) self.assertRaises(struct.error, struct.unpack_from, '12345', store, 0) # Format lists with trailing count spec should result in an error self.assertRaises(struct.error, struct.pack, 'c12345', 'x') self.assertRaises(struct.error, struct.unpack, 'c12345', 'x') self.assertRaises(struct.error, struct.pack_into, 'c12345', store, 0, 'x') self.assertRaises(struct.error, struct.unpack_from, 'c12345', store, 0) # Mixed format tests self.assertRaises(struct.error, struct.pack, '14s42', 'spam and eggs') self.assertRaises(struct.error, struct.unpack, '14s42', 'spam and eggs') self.assertRaises(struct.error, struct.pack_into, '14s42', store, 0, 'spam and eggs') self.assertRaises(struct.error, struct.unpack_from, '14s42', store, 0) def test_Struct_reinitialization(self): # Issue 9422: there was a memory leak when reinitializing a # Struct instance. This test can be used to detect the leak # when running with regrtest -L. s = struct.Struct('i') s.__init__('ii') def check_sizeof(self, format_str, number_of_codes): # The size of 'PyStructObject' totalsize = support.calcobjsize('2n3P') # The size taken up by the 'formatcode' dynamic array totalsize += struct.calcsize('P3n0P') * (number_of_codes + 1) support.check_sizeof(self, struct.Struct(format_str), totalsize) @support.cpython_only def test__sizeof__(self): for code in integer_codes: self.check_sizeof(code, 1) self.check_sizeof('BHILfdspP', 9) self.check_sizeof('B' * 1234, 1234) self.check_sizeof('fd', 2) self.check_sizeof('xxxxxxxxxxxxxx', 0) self.check_sizeof('100H', 1) self.check_sizeof('187s', 1) self.check_sizeof('20p', 1) self.check_sizeof('0s', 1) self.check_sizeof('0c', 0) class UnpackIteratorTest(unittest.TestCase): """ Tests for iterative unpacking (struct.Struct.iter_unpack). """ def test_construct(self): def _check_iterator(it): self.assertIsInstance(it, abc.Iterator) self.assertIsInstance(it, abc.Iterable) s = struct.Struct('>ibcp') it = s.iter_unpack(b"") _check_iterator(it) it = s.iter_unpack(b"1234567") _check_iterator(it) # Wrong bytes length with self.assertRaises(struct.error): s.iter_unpack(b"123456") with self.assertRaises(struct.error): s.iter_unpack(b"12345678") # Zero-length struct s = struct.Struct('>') with self.assertRaises(struct.error): s.iter_unpack(b"") with self.assertRaises(struct.error): s.iter_unpack(b"12") def test_iterate(self): s = struct.Struct('>IB') b = bytes(range(1, 16)) it = s.iter_unpack(b) self.assertEqual(next(it), (0x01020304, 5)) self.assertEqual(next(it), (0x06070809, 10)) self.assertEqual(next(it), (0x0b0c0d0e, 15)) self.assertRaises(StopIteration, next, it) self.assertRaises(StopIteration, next, it) def test_arbitrary_buffer(self): s = struct.Struct('>IB') b = bytes(range(1, 11)) it = s.iter_unpack(memoryview(b)) self.assertEqual(next(it), (0x01020304, 5)) self.assertEqual(next(it), (0x06070809, 10)) self.assertRaises(StopIteration, next, it) self.assertRaises(StopIteration, next, it) def test_length_hint(self): lh = operator.length_hint s = struct.Struct('>IB') b = bytes(range(1, 16)) it = s.iter_unpack(b) self.assertEqual(lh(it), 3) next(it) self.assertEqual(lh(it), 2) next(it) self.assertEqual(lh(it), 1) next(it) self.assertEqual(lh(it), 0) self.assertRaises(StopIteration, next, it) self.assertEqual(lh(it), 0) def test_module_func(self): # Sanity check for the global struct.iter_unpack() it = struct.iter_unpack('>IB', bytes(range(1, 11))) self.assertEqual(next(it), (0x01020304, 5)) self.assertEqual(next(it), (0x06070809, 10)) self.assertRaises(StopIteration, next, it) self.assertRaises(StopIteration, next, it) def test_half_float(self): # Little-endian examples from: # http://en.wikipedia.org/wiki/Half_precision_floating-point_format format_bits_float__cleanRoundtrip_list = [ (b'\x00\x3c', 1.0), (b'\x00\xc0', -2.0), (b'\xff\x7b', 65504.0), # (max half precision) (b'\x00\x04', 2**-14), # ~= 6.10352 * 10**-5 (min pos normal) (b'\x01\x00', 2**-24), # ~= 5.96046 * 10**-8 (min pos subnormal) (b'\x00\x00', 0.0), (b'\x00\x80', -0.0), (b'\x00\x7c', float('+inf')), (b'\x00\xfc', float('-inf')), (b'\x55\x35', 0.333251953125), # ~= 1/3 ] for le_bits, f in format_bits_float__cleanRoundtrip_list: be_bits = le_bits[::-1] self.assertEqual(f, struct.unpack('<e', le_bits)[0]) self.assertEqual(le_bits, struct.pack('<e', f)) self.assertEqual(f, struct.unpack('>e', be_bits)[0]) self.assertEqual(be_bits, struct.pack('>e', f)) if sys.byteorder == 'little': self.assertEqual(f, struct.unpack('e', le_bits)[0]) self.assertEqual(le_bits, struct.pack('e', f)) else: self.assertEqual(f, struct.unpack('e', be_bits)[0]) self.assertEqual(be_bits, struct.pack('e', f)) # Check for NaN handling: format_bits__nan_list = [ ('<e', b'\x01\xfc'), ('<e', b'\x00\xfe'), ('<e', b'\xff\xff'), ('<e', b'\x01\x7c'), ('<e', b'\x00\x7e'), ('<e', b'\xff\x7f'), ] for formatcode, bits in format_bits__nan_list: self.assertTrue(math.isnan(struct.unpack('<e', bits)[0])) self.assertTrue(math.isnan(struct.unpack('>e', bits[::-1])[0])) # Check that packing produces a bit pattern representing a quiet NaN: # all exponent bits and the msb of the fraction should all be 1. packed = struct.pack('<e', math.nan) self.assertEqual(packed[1] & 0x7e, 0x7e) packed = struct.pack('<e', -math.nan) self.assertEqual(packed[1] & 0x7e, 0x7e) # Checks for round-to-even behavior format_bits_float__rounding_list = [ ('>e', b'\x00\x01', 2.0**-25 + 2.0**-35), # Rounds to minimum subnormal ('>e', b'\x00\x00', 2.0**-25), # Underflows to zero (nearest even mode) ('>e', b'\x00\x00', 2.0**-26), # Underflows to zero ('>e', b'\x03\xff', 2.0**-14 - 2.0**-24), # Largest subnormal. ('>e', b'\x03\xff', 2.0**-14 - 2.0**-25 - 2.0**-65), ('>e', b'\x04\x00', 2.0**-14 - 2.0**-25), ('>e', b'\x04\x00', 2.0**-14), # Smallest normal. ('>e', b'\x3c\x01', 1.0+2.0**-11 + 2.0**-16), # rounds to 1.0+2**(-10) ('>e', b'\x3c\x00', 1.0+2.0**-11), # rounds to 1.0 (nearest even mode) ('>e', b'\x3c\x00', 1.0+2.0**-12), # rounds to 1.0 ('>e', b'\x7b\xff', 65504), # largest normal ('>e', b'\x7b\xff', 65519), # rounds to 65504 ('>e', b'\x80\x01', -2.0**-25 - 2.0**-35), # Rounds to minimum subnormal ('>e', b'\x80\x00', -2.0**-25), # Underflows to zero (nearest even mode) ('>e', b'\x80\x00', -2.0**-26), # Underflows to zero ('>e', b'\xbc\x01', -1.0-2.0**-11 - 2.0**-16), # rounds to 1.0+2**(-10) ('>e', b'\xbc\x00', -1.0-2.0**-11), # rounds to 1.0 (nearest even mode) ('>e', b'\xbc\x00', -1.0-2.0**-12), # rounds to 1.0 ('>e', b'\xfb\xff', -65519), # rounds to 65504 ] for formatcode, bits, f in format_bits_float__rounding_list: self.assertEqual(bits, struct.pack(formatcode, f)) # This overflows, and so raises an error format_bits_float__roundingError_list = [ # Values that round to infinity. ('>e', 65520.0), ('>e', 65536.0), ('>e', 1e300), ('>e', -65520.0), ('>e', -65536.0), ('>e', -1e300), ('<e', 65520.0), ('<e', 65536.0), ('<e', 1e300), ('<e', -65520.0), ('<e', -65536.0), ('<e', -1e300), ] for formatcode, f in format_bits_float__roundingError_list: self.assertRaises(OverflowError, struct.pack, formatcode, f) # Double rounding format_bits_float__doubleRoundingError_list = [ ('>e', b'\x67\xff', 0x1ffdffffff * 2**-26), # should be 2047, if double-rounded 64>32>16, becomes 2048 ] for formatcode, bits, f in format_bits_float__doubleRoundingError_list: self.assertEqual(bits, struct.pack(formatcode, f)) if __name__ == '__main__': unittest.main()
31,979
757
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_sndhdr.py
import sndhdr import pickle import unittest from test.support import findfile class TestFormats(unittest.TestCase): def test_data(self): for filename, expected in ( ('sndhdr.8svx', ('8svx', 0, 1, 0, 8)), ('sndhdr.aifc', ('aifc', 44100, 2, 5, 16)), ('sndhdr.aiff', ('aiff', 44100, 2, 5, 16)), ('sndhdr.au', ('au', 44100, 2, 5.0, 16)), ('sndhdr.hcom', ('hcom', 22050.0, 1, -1, 8)), ('sndhdr.sndt', ('sndt', 44100, 1, 5, 8)), ('sndhdr.voc', ('voc', 0, 1, -1, 8)), ('sndhdr.wav', ('wav', 44100, 2, 5, 16)), ): filename = findfile(filename, subdir="sndhdrdata") what = sndhdr.what(filename) self.assertNotEqual(what, None, filename) self.assertSequenceEqual(what, expected) self.assertEqual(what.filetype, expected[0]) self.assertEqual(what.framerate, expected[1]) self.assertEqual(what.nchannels, expected[2]) self.assertEqual(what.nframes, expected[3]) self.assertEqual(what.sampwidth, expected[4]) def test_pickleable(self): filename = findfile('sndhdr.aifc', subdir="sndhdrdata") what = sndhdr.what(filename) for proto in range(pickle.HIGHEST_PROTOCOL + 1): dump = pickle.dumps(what, proto) self.assertEqual(pickle.loads(dump), what) if __name__ == '__main__': unittest.main()
1,460
38
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/BIG5HKSCS-2004.TXT
8740 43F0 8741 4C32 8742 4603 8743 45A6 8744 4578 8745 27267 8746 4D77 8747 45B3 8748 27CB1 8749 4CE2 874A 27CC5 874B 3B95 874C 4736 874D 4744 874E 4C47 874F 4C40 8750 242BF 8751 23617 8752 27352 8753 26E8B 8754 270D2 8755 4C57 8756 2A351 8757 474F 8758 45DA 8759 4C85 875A 27C6C 875B 4D07 875C 4AA4 875D 46A1 875E 26B23 875F 7225 8760 25A54 8761 21A63 8762 23E06 8763 23F61 8764 664D 8765 56FB 8767 7D95 8768 591D 8769 28BB9 876A 3DF4 876B 9734 876C 27BEF 876D 5BDB 876E 21D5E 876F 5AA4 8770 3625 8771 29EB0 8772 5AD1 8773 5BB7 8774 5CFC 8775 676E 8776 8593 8777 29945 8778 7461 8779 749D 8840 31C0 8841 31C1 8842 31C2 8843 31C3 8844 31C4 8845 2010C 8846 31C5 8847 200D1 8848 200CD 8849 31C6 884A 31C7 884B 200CB 884C 21FE8 884D 31C8 884E 200CA 884F 31C9 8850 31CA 8851 31CB 8852 31CC 8853 2010E 8854 31CD 8855 31CE 8856 0100 8857 00C1 8858 01CD 8859 00C0 885A 0112 885B 00C9 885C 011A 885D 00C8 885E 014C 885F 00D3 8860 01D1 8861 00D2 8863 1EBE 8865 1EC0 8866 00CA 8867 0101 8868 00E1 8869 01CE 886A 00E0 886B 0251 886C 0113 886D 00E9 886E 011B 886F 00E8 8870 012B 8871 00ED 8872 01D0 8873 00EC 8874 014D 8875 00F3 8876 01D2 8877 00F2 8878 016B 8879 00FA 887A 01D4 887B 00F9 887C 01D6 887D 01D8 887E 01DA 88A1 01DC 88A2 00FC 88A4 1EBF 88A6 1EC1 88A7 00EA 88A8 0261 88A9 23DA 88AA 23DB 8940 2A3A9 8941 21145 8943 650A 8946 4E3D 8947 6EDD 8948 9D4E 8949 91DF 894C 27735 894D 6491 894E 4F1A 894F 4F28 8950 4FA8 8951 5156 8952 5174 8953 519C 8954 51E4 8955 52A1 8956 52A8 8957 533B 8958 534E 8959 53D1 895A 53D8 895B 56E2 895C 58F0 895D 5904 895E 5907 895F 5932 8960 5934 8961 5B66 8962 5B9E 8963 5B9F 8964 5C9A 8965 5E86 8966 603B 8967 6589 8968 67FE 8969 6804 896A 6865 896B 6D4E 896C 70BC 896D 7535 896E 7EA4 896F 7EAC 8970 7EBA 8971 7EC7 8972 7ECF 8973 7EDF 8974 7F06 8975 7F37 8976 827A 8977 82CF 8978 836F 8979 89C6 897A 8BBE 897B 8BE2 897C 8F66 897D 8F67 897E 8F6E 89A1 7411 89A2 7CFC 89A3 7DCD 89A4 6946 89A5 7AC9 89A6 5227 89AB 918C 89AC 78B8 89AD 915E 89AE 80BC 89B0 8D0B 89B1 80F6 89B2 209E7 89B5 809F 89B6 9EC7 89B7 4CCD 89B8 9DC9 89B9 9E0C 89BA 4C3E 89BB 29DF6 89BC 2700E 89BD 9E0A 89BE 2A133 89BF 35C1 89C1 6E9A 89C2 823E 89C3 7519 89C5 4911 89C6 9A6C 89C7 9A8F 89C8 9F99 89C9 7987 89CA 2846C 89CB 21DCA 89CC 205D0 89CD 22AE6 89CE 4E24 89CF 4E81 89D0 4E80 89D1 4E87 89D2 4EBF 89D3 4EEB 89D4 4F37 89D5 344C 89D6 4FBD 89D7 3E48 89D8 5003 89D9 5088 89DA 347D 89DB 3493 89DC 34A5 89DD 5186 89DE 5905 89DF 51DB 89E0 51FC 89E1 5205 89E2 4E89 89E3 5279 89E4 5290 89E5 5327 89E6 35C7 89E7 53A9 89E8 3551 89E9 53B0 89EA 3553 89EB 53C2 89EC 5423 89ED 356D 89EE 3572 89EF 3681 89F0 5493 89F1 54A3 89F2 54B4 89F3 54B9 89F4 54D0 89F5 54EF 89F6 5518 89F7 5523 89F8 5528 89F9 3598 89FA 553F 89FB 35A5 89FC 35BF 89FD 55D7 89FE 35C5 8A40 27D84 8A41 5525 8A43 20C42 8A44 20D15 8A45 2512B 8A46 5590 8A47 22CC6 8A48 39EC 8A49 20341 8A4A 8E46 8A4B 24DB8 8A4C 294E5 8A4D 4053 8A4E 280BE 8A4F 777A 8A50 22C38 8A51 3A34 8A52 47D5 8A53 2815D 8A54 269F2 8A55 24DEA 8A56 64DD 8A57 20D7C 8A58 20FB4 8A59 20CD5 8A5A 210F4 8A5B 648D 8A5C 8E7E 8A5D 20E96 8A5E 20C0B 8A5F 20F64 8A60 22CA9 8A61 28256 8A62 244D3 8A64 20D46 8A65 29A4D 8A66 280E9 8A67 47F4 8A68 24EA7 8A69 22CC2 8A6A 9AB2 8A6B 3A67 8A6C 295F4 8A6D 3FED 8A6E 3506 8A6F 252C7 8A70 297D4 8A71 278C8 8A72 22D44 8A73 9D6E 8A74 9815 8A76 43D9 8A77 260A5 8A78 64B4 8A79 54E3 8A7A 22D4C 8A7B 22BCA 8A7C 21077 8A7D 39FB 8A7E 2106F 8AA1 266DA 8AA2 26716 8AA3 279A0 8AA4 64EA 8AA5 25052 8AA6 20C43 8AA7 8E68 8AA8 221A1 8AA9 28B4C 8AAA 20731 8AAC 480B 8AAD 201A9 8AAE 3FFA 8AAF 5873 8AB0 22D8D 8AB2 245C8 8AB3 204FC 8AB4 26097 8AB5 20F4C 8AB6 20D96 8AB7 5579 8AB8 40BB 8AB9 43BA 8ABB 4AB4 8ABC 22A66 8ABD 2109D 8ABE 81AA 8ABF 98F5 8AC0 20D9C 8AC1 6379 8AC2 39FE 8AC3 22775 8AC4 8DC0 8AC5 56A1 8AC6 647C 8AC7 3E43 8AC9 2A601 8ACA 20E09 8ACB 22ACF 8ACC 22CC9 8ACE 210C8 8ACF 239C2 8AD0 3992 8AD1 3A06 8AD2 2829B 8AD3 3578 8AD4 25E49 8AD5 220C7 8AD6 5652 8AD7 20F31 8AD8 22CB2 8AD9 29720 8ADA 34BC 8ADB 6C3D 8ADC 24E3B 8ADF 27574 8AE0 22E8B 8AE1 22208 8AE2 2A65B 8AE3 28CCD 8AE4 20E7A 8AE5 20C34 8AE6 2681C 8AE7 7F93 8AE8 210CF 8AE9 22803 8AEA 22939 8AEB 35FB 8AEC 251E3 8AED 20E8C 8AEE 20F8D 8AEF 20EAA 8AF0 3F93 8AF1 20F30 8AF2 20D47 8AF3 2114F 8AF4 20E4C 8AF6 20EAB 8AF7 20BA9 8AF8 20D48 8AF9 210C0 8AFA 2113D 8AFB 3FF9 8AFC 22696 8AFD 6432 8AFE 20FAD 8B40 233F4 8B41 27639 8B42 22BCE 8B43 20D7E 8B44 20D7F 8B45 22C51 8B46 22C55 8B47 3A18 8B48 20E98 8B49 210C7 8B4A 20F2E 8B4B 2A632 8B4C 26B50 8B4D 28CD2 8B4E 28D99 8B4F 28CCA 8B50 95AA 8B51 54CC 8B52 82C4 8B53 55B9 8B55 29EC3 8B56 9C26 8B57 9AB6 8B58 2775E 8B59 22DEE 8B5A 7140 8B5B 816D 8B5C 80EC 8B5D 5C1C 8B5E 26572 8B5F 8134 8B60 3797 8B61 535F 8B62 280BD 8B63 91B6 8B64 20EFA 8B65 20E0F 8B66 20E77 8B67 20EFB 8B68 35DD 8B69 24DEB 8B6A 3609 8B6B 20CD6 8B6C 56AF 8B6D 227B5 8B6E 210C9 8B6F 20E10 8B70 20E78 8B71 21078 8B72 21148 8B73 28207 8B74 21455 8B75 20E79 8B76 24E50 8B77 22DA4 8B78 5A54 8B79 2101D 8B7A 2101E 8B7B 210F5 8B7C 210F6 8B7D 579C 8B7E 20E11 8BA1 27694 8BA2 282CD 8BA3 20FB5 8BA4 20E7B 8BA5 2517E 8BA6 3703 8BA7 20FB6 8BA8 21180 8BA9 252D8 8BAA 2A2BD 8BAB 249DA 8BAC 2183A 8BAD 24177 8BAE 2827C 8BAF 5899 8BB0 5268 8BB1 361A 8BB2 2573D 8BB3 7BB2 8BB4 5B68 8BB5 4800 8BB6 4B2C 8BB7 9F27 8BB8 49E7 8BB9 9C1F 8BBA 9B8D 8BBB 25B74 8BBC 2313D 8BBD 55FB 8BBE 35F2 8BBF 5689 8BC0 4E28 8BC1 5902 8BC2 21BC1 8BC3 2F878 8BC4 9751 8BC5 20086 8BC6 4E5B 8BC7 4EBB 8BC8 353E 8BC9 5C23 8BCA 5F51 8BCB 5FC4 8BCC 38FA 8BCD 624C 8BCE 6535 8BCF 6B7A 8BD0 6C35 8BD1 6C3A 8BD2 706C 8BD3 722B 8BD4 4E2C 8BD5 72AD 8BD6 248E9 8BD7 7F52 8BD8 793B 8BD9 7CF9 8BDA 7F53 8BDB 2626A 8BDC 34C1 8BDE 2634B 8BDF 8002 8BE0 8080 8BE1 26612 8BE2 26951 8BE3 535D 8BE4 8864 8BE5 89C1 8BE6 278B2 8BE7 8BA0 8BE8 8D1D 8BE9 9485 8BEA 9578 8BEB 957F 8BEC 95E8 8BED 28E0F 8BEE 97E6 8BEF 9875 8BF0 98CE 8BF1 98DE 8BF2 9963 8BF3 29810 8BF4 9C7C 8BF5 9E1F 8BF6 9EC4 8BF7 6B6F 8BF8 F907 8BF9 4E37 8BFA 20087 8BFB 961D 8BFC 6237 8BFD 94A2 8C40 503B 8C41 6DFE 8C42 29C73 8C43 9FA6 8C44 3DC9 8C45 888F 8C46 2414E 8C47 7077 8C48 5CF5 8C49 4B20 8C4A 251CD 8C4B 3559 8C4C 25D30 8C4D 6122 8C4E 28A32 8C4F 8FA7 8C50 91F6 8C51 7191 8C52 6719 8C53 73BA 8C54 23281 8C55 2A107 8C56 3C8B 8C57 21980 8C58 4B10 8C59 78E4 8C5A 7402 8C5B 51AE 8C5C 2870F 8C5D 4009 8C5E 6A63 8C5F 2A2BA 8C60 4223 8C61 860F 8C62 20A6F 8C63 7A2A 8C64 29947 8C65 28AEA 8C66 9755 8C67 704D 8C68 5324 8C69 2207E 8C6A 93F4 8C6B 76D9 8C6C 289E3 8C6D 9FA7 8C6E 77DD 8C6F 4EA3 8C70 4FF0 8C71 50BC 8C72 4E2F 8C73 4F17 8C74 9FA8 8C75 5434 8C76 7D8B 8C77 5892 8C78 58D0 8C79 21DB6 8C7A 5E92 8C7B 5E99 8C7C 5FC2 8C7D 22712 8C7E 658B 8CA1 233F9 8CA2 6919 8CA3 6A43 8CA4 23C63 8CA5 6CFF 8CA7 7200 8CA8 24505 8CA9 738C 8CAA 3EDB 8CAB 24A13 8CAC 5B15 8CAD 74B9 8CAE 8B83 8CAF 25CA4 8CB0 25695 8CB1 7A93 8CB2 7BEC 8CB3 7CC3 8CB4 7E6C 8CB5 82F8 8CB6 8597 8CB7 9FA9 8CB8 8890 8CB9 9FAA 8CBA 8EB9 8CBB 9FAB 8CBC 8FCF 8CBD 855F 8CBE 99E0 8CBF 9221 8CC0 9FAC 8CC1 28DB9 8CC2 2143F 8CC3 4071 8CC4 42A2 8CC5 5A1A 8CC9 9868 8CCA 676B 8CCB 4276 8CCC 573D 8CCE 85D6 8CCF 2497B 8CD0 82BF 8CD1 2710D 8CD2 4C81 8CD3 26D74 8CD4 5D7B 8CD5 26B15 8CD6 26FBE 8CD7 9FAD 8CD8 9FAE 8CD9 5B96 8CDA 9FAF 8CDB 66E7 8CDC 7E5B 8CDD 6E57 8CDE 79CA 8CDF 3D88 8CE0 44C3 8CE1 23256 8CE2 22796 8CE3 439A 8CE4 4536 8CE6 5CD5 8CE7 23B1A 8CE8 8AF9 8CE9 5C78 8CEA 3D12 8CEB 23551 8CEC 5D78 8CED 9FB2 8CEE 7157 8CEF 4558 8CF0 240EC 8CF1 21E23 8CF2 4C77 8CF3 3978 8CF4 344A 8CF5 201A4 8CF6 26C41 8CF7 8ACC 8CF8 4FB4 8CF9 20239 8CFA 59BF 8CFB 816C 8CFC 9856 8CFD 298FA 8CFE 5F3B 8D40 20B9F 8D42 221C1 8D43 2896D 8D44 4102 8D45 46BB 8D46 29079 8D47 3F07 8D48 9FB3 8D49 2A1B5 8D4A 40F8 8D4B 37D6 8D4C 46F7 8D4D 26C46 8D4E 417C 8D4F 286B2 8D50 273FF 8D51 456D 8D52 38D4 8D53 2549A 8D54 4561 8D55 451B 8D56 4D89 8D57 4C7B 8D58 4D76 8D59 45EA 8D5A 3FC8 8D5B 24B0F 8D5C 3661 8D5D 44DE 8D5E 44BD 8D5F 41ED 8D60 5D3E 8D61 5D48 8D62 5D56 8D63 3DFC 8D64 380F 8D65 5DA4 8D66 5DB9 8D67 3820 8D68 3838 8D69 5E42 8D6A 5EBD 8D6B 5F25 8D6C 5F83 8D6D 3908 8D6E 3914 8D6F 393F 8D70 394D 8D71 60D7 8D72 613D 8D73 5CE5 8D74 3989 8D75 61B7 8D76 61B9 8D77 61CF 8D78 39B8 8D79 622C 8D7A 6290 8D7B 62E5 8D7C 6318 8D7D 39F8 8D7E 56B1 8DA1 3A03 8DA2 63E2 8DA3 63FB 8DA4 6407 8DA5 645A 8DA6 3A4B 8DA7 64C0 8DA8 5D15 8DA9 5621 8DAA 9F9F 8DAB 3A97 8DAC 6586 8DAD 3ABD 8DAE 65FF 8DAF 6653 8DB0 3AF2 8DB1 6692 8DB2 3B22 8DB3 6716 8DB4 3B42 8DB5 67A4 8DB6 6800 8DB7 3B58 8DB8 684A 8DB9 6884 8DBA 3B72 8DBB 3B71 8DBC 3B7B 8DBD 6909 8DBE 6943 8DBF 725C 8DC0 6964 8DC1 699F 8DC2 6985 8DC3 3BBC 8DC4 69D6 8DC5 3BDD 8DC6 6A65 8DC7 6A74 8DC8 6A71 8DC9 6A82 8DCA 3BEC 8DCB 6A99 8DCC 3BF2 8DCD 6AAB 8DCE 6AB5 8DCF 6AD4 8DD0 6AF6 8DD1 6B81 8DD2 6BC1 8DD3 6BEA 8DD4 6C75 8DD5 6CAA 8DD6 3CCB 8DD7 6D02 8DD8 6D06 8DD9 6D26 8DDA 6D81 8DDB 3CEF 8DDC 6DA4 8DDD 6DB1 8DDE 6E15 8DDF 6E18 8DE0 6E29 8DE1 6E86 8DE2 289C0 8DE3 6EBB 8DE4 6EE2 8DE5 6EDA 8DE6 9F7F 8DE7 6EE8 8DE8 6EE9 8DE9 6F24 8DEA 6F34 8DEB 3D46 8DEC 23F41 8DED 6F81 8DEE 6FBE 8DEF 3D6A 8DF0 3D75 8DF1 71B7 8DF2 5C99 8DF3 3D8A 8DF4 702C 8DF5 3D91 8DF6 7050 8DF7 7054 8DF8 706F 8DF9 707F 8DFA 7089 8DFB 20325 8DFC 43C1 8DFD 35F1 8DFE 20ED8 8E40 23ED7 8E41 57BE 8E42 26ED3 8E43 713E 8E44 257E0 8E45 364E 8E46 69A2 8E47 28BE9 8E48 5B74 8E49 7A49 8E4A 258E1 8E4B 294D9 8E4C 7A65 8E4D 7A7D 8E4E 259AC 8E4F 7ABB 8E50 7AB0 8E51 7AC2 8E52 7AC3 8E53 71D1 8E54 2648D 8E55 41CA 8E56 7ADA 8E57 7ADD 8E58 7AEA 8E59 41EF 8E5A 54B2 8E5B 25C01 8E5C 7B0B 8E5D 7B55 8E5E 7B29 8E5F 2530E 8E60 25CFE 8E61 7BA2 8E62 7B6F 8E63 839C 8E64 25BB4 8E65 26C7F 8E66 7BD0 8E67 8421 8E68 7B92 8E6A 25D20 8E6B 3DAD 8E6C 25C65 8E6D 8492 8E6E 7BFA 8E70 7C35 8E71 25CC1 8E72 7C44 8E73 7C83 8E74 24882 8E75 7CA6 8E76 667D 8E77 24578 8E78 7CC9 8E79 7CC7 8E7A 7CE6 8E7B 7C74 8E7C 7CF3 8E7D 7CF5 8EA1 7E67 8EA2 451D 8EA3 26E44 8EA4 7D5D 8EA5 26ED6 8EA6 748D 8EA7 7D89 8EA8 7DAB 8EA9 7135 8EAA 7DB3 8EAC 24057 8EAD 26029 8EAE 7DE4 8EAF 3D13 8EB0 7DF5 8EB1 217F9 8EB2 7DE5 8EB3 2836D 8EB5 26121 8EB6 2615A 8EB7 7E6E 8EB8 7E92 8EB9 432B 8EBA 946C 8EBB 7E27 8EBC 7F40 8EBD 7F41 8EBE 7F47 8EBF 7936 8EC0 262D0 8EC1 99E1 8EC2 7F97 8EC3 26351 8EC4 7FA3 8EC5 21661 8EC6 20068 8EC7 455C 8EC8 23766 8EC9 4503 8ECA 2833A 8ECB 7FFA 8ECC 26489 8ECE 8008 8ECF 801D 8ED1 802F 8ED2 2A087 8ED3 26CC3 8ED4 803B 8ED5 803C 8ED6 8061 8ED7 22714 8ED8 4989 8ED9 26626 8EDA 23DE3 8EDB 266E8 8EDC 6725 8EDD 80A7 8EDE 28A48 8EDF 8107 8EE0 811A 8EE1 58B0 8EE2 226F6 8EE3 6C7F 8EE4 26498 8EE5 24FB8 8EE6 64E7 8EE7 2148A 8EE8 8218 8EE9 2185E 8EEA 6A53 8EEB 24A65 8EEC 24A95 8EED 447A 8EEE 8229 8EEF 20B0D 8EF0 26A52 8EF1 23D7E 8EF2 4FF9 8EF3 214FD 8EF4 84E2 8EF5 8362 8EF6 26B0A 8EF7 249A7 8EF8 23530 8EF9 21773 8EFA 23DF8 8EFB 82AA 8EFC 691B 8EFD 2F994 8EFE 41DB 8F40 854B 8F41 82D0 8F42 831A 8F43 20E16 8F44 217B4 8F45 36C1 8F46 2317D 8F47 2355A 8F48 827B 8F49 82E2 8F4A 8318 8F4B 23E8B 8F4C 26DA3 8F4D 26B05 8F4E 26B97 8F4F 235CE 8F50 3DBF 8F51 831D 8F52 55EC 8F53 8385 8F54 450B 8F55 26DA5 8F56 83AC 8F58 83D3 8F59 347E 8F5A 26ED4 8F5B 6A57 8F5C 855A 8F5D 3496 8F5E 26E42 8F5F 22EEF 8F60 8458 8F61 25BE4 8F62 8471 8F63 3DD3 8F64 44E4 8F65 6AA7 8F66 844A 8F67 23CB5 8F68 7958 8F6A 26B96 8F6B 26E77 8F6C 26E43 8F6D 84DE 8F6F 8391 8F70 44A0 8F71 8493 8F72 84E4 8F73 25C91 8F74 4240 8F75 25CC0 8F76 4543 8F77 8534 8F78 5AF2 8F79 26E99 8F7A 4527 8F7B 8573 8F7C 4516 8F7D 67BF 8F7E 8616 8FA1 28625 8FA2 2863B 8FA3 85C1 8FA4 27088 8FA5 8602 8FA6 21582 8FA7 270CD 8FA8 2F9B2 8FA9 456A 8FAA 8628 8FAB 3648 8FAC 218A2 8FAD 53F7 8FAE 2739A 8FAF 867E 8FB0 8771 8FB1 2A0F8 8FB2 87EE 8FB3 22C27 8FB4 87B1 8FB5 87DA 8FB6 880F 8FB7 5661 8FB8 866C 8FB9 6856 8FBA 460F 8FBB 8845 8FBC 8846 8FBD 275E0 8FBE 23DB9 8FBF 275E4 8FC0 885E 8FC1 889C 8FC2 465B 8FC3 88B4 8FC4 88B5 8FC5 63C1 8FC6 88C5 8FC7 7777 8FC8 2770F 8FC9 8987 8FCA 898A 8FCD 89A7 8FCE 89BC 8FCF 28A25 8FD0 89E7 8FD1 27924 8FD2 27ABD 8FD3 8A9C 8FD4 7793 8FD5 91FE 8FD6 8A90 8FD7 27A59 8FD8 7AE9 8FD9 27B3A 8FDA 23F8F 8FDB 4713 8FDC 27B38 8FDD 717C 8FDE 8B0C 8FDF 8B1F 8FE0 25430 8FE1 25565 8FE2 8B3F 8FE3 8B4C 8FE4 8B4D 8FE5 8AA9 8FE6 24A7A 8FE7 8B90 8FE8 8B9B 8FE9 8AAF 8FEA 216DF 8FEB 4615 8FEC 884F 8FED 8C9B 8FEE 27D54 8FEF 27D8F 8FF0 2F9D4 8FF1 3725 8FF2 27D53 8FF3 8CD6 8FF4 27D98 8FF5 27DBD 8FF6 8D12 8FF7 8D03 8FF8 21910 8FF9 8CDB 8FFA 705C 8FFB 8D11 8FFC 24CC9 8FFD 3ED0 9040 8DA9 9041 28002 9042 21014 9043 2498A 9044 3B7C 9045 281BC 9046 2710C 9047 7AE7 9048 8EAD 9049 8EB6 904A 8EC3 904B 92D4 904C 8F19 904D 8F2D 904E 28365 904F 28412 9050 8FA5 9051 9303 9052 2A29F 9053 20A50 9054 8FB3 9055 492A 9056 289DE 9057 2853D 9058 23DBB 9059 5EF8 905A 23262 905B 8FF9 905C 2A014 905D 286BC 905E 28501 905F 22325 9060 3980 9061 26ED7 9062 9037 9063 2853C 9064 27ABE 9065 9061 9066 2856C 9067 2860B 9068 90A8 9069 28713 906A 90C4 906B 286E6 906C 90AE 906E 9167 906F 3AF0 9070 91A9 9071 91C4 9072 7CAC 9073 28933 9074 21E89 9075 920E 9076 6C9F 9077 9241 9078 9262 9079 255B9 907B 28AC6 907C 23C9B 907D 28B0C 907E 255DB 90A1 20D31 90A2 932C 90A3 936B 90A4 28AE1 90A5 28BEB 90A6 708F 90A7 5AC3 90A8 28AE2 90A9 28AE5 90AA 4965 90AB 9244 90AC 28BEC 90AD 28C39 90AE 28BFF 90AF 9373 90B0 945B 90B1 8EBC 90B2 9585 90B3 95A6 90B4 9426 90B5 95A0 90B6 6FF6 90B7 42B9 90B8 2267A 90B9 286D8 90BA 2127C 90BB 23E2E 90BC 49DF 90BD 6C1C 90BE 967B 90BF 9696 90C0 416C 90C1 96A3 90C2 26ED5 90C3 61DA 90C4 96B6 90C5 78F5 90C6 28AE0 90C7 96BD 90C8 53CC 90C9 49A1 90CA 26CB8 90CB 20274 90CC 26410 90CD 290AF 90CE 290E5 90CF 24AD1 90D0 21915 90D1 2330A 90D2 9731 90D3 8642 90D4 9736 90D5 4A0F 90D6 453D 90D7 4585 90D8 24AE9 90D9 7075 90DA 5B41 90DB 971B 90DD 291D5 90DE 9757 90DF 5B4A 90E0 291EB 90E1 975F 90E2 9425 90E3 50D0 90E4 230B7 90E5 230BC 90E6 9789 90E7 979F 90E8 97B1 90E9 97BE 90EA 97C0 90EB 97D2 90EC 97E0 90ED 2546C 90EE 97EE 90EF 741C 90F0 29433 90F2 97F5 90F3 2941D 90F4 2797A 90F5 4AD1 90F6 9834 90F7 9833 90F8 984B 90F9 9866 90FA 3B0E 90FB 27175 90FC 3D51 90FD 20630 90FE 2415C 9140 25706 9141 98CA 9142 98B7 9143 98C8 9144 98C7 9145 4AFF 9146 26D27 9147 216D3 9148 55B0 9149 98E1 914A 98E6 914B 98EC 914C 9378 914D 9939 914E 24A29 914F 4B72 9150 29857 9151 29905 9152 99F5 9153 9A0C 9154 9A3B 9155 9A10 9156 9A58 9157 25725 9158 36C4 9159 290B1 915A 29BD5 915B 9AE0 915C 9AE2 915D 29B05 915E 9AF4 915F 4C0E 9160 9B14 9161 9B2D 9162 28600 9163 5034 9164 9B34 9165 269A8 9166 38C3 9167 2307D 9168 9B50 9169 9B40 916A 29D3E 916B 5A45 916C 21863 916D 9B8E 916E 2424B 916F 9C02 9170 9BFF 9171 9C0C 9172 29E68 9173 9DD4 9174 29FB7 9175 2A192 9176 2A1AB 9177 2A0E1 9178 2A123 9179 2A1DF 917A 9D7E 917B 9D83 917C 2A134 917D 9E0E 917E 6888 91A1 9DC4 91A2 2215B 91A3 2A193 91A4 2A220 91A5 2193B 91A6 2A233 91A7 9D39 91A8 2A0B9 91A9 2A2B4 91AA 9E90 91AB 9E95 91AC 9E9E 91AD 9EA2 91AE 4D34 91AF 9EAA 91B0 9EAF 91B1 24364 91B2 9EC1 91B3 3B60 91B4 39E5 91B5 3D1D 91B6 4F32 91B7 37BE 91B8 28C2B 91B9 9F02 91BA 9F08 91BB 4B96 91BC 9424 91BD 26DA2 91BE 9F17 91C0 9F39 91C1 569F 91C2 568A 91C3 9F45 91C4 99B8 91C5 2908B 91C6 97F2 91C7 847F 91C8 9F62 91C9 9F69 91CA 7ADC 91CB 9F8E 91CC 7216 91CD 4BBE 91CE 24975 91CF 249BB 91D0 7177 91D1 249F8 91D2 24348 91D3 24A51 91D4 739E 91D5 28BDA 91D6 218FA 91D7 799F 91D8 2897E 91D9 28E36 91DA 9369 91DB 93F3 91DC 28A44 91DD 92EC 91DE 9381 91DF 93CB 91E0 2896C 91E1 244B9 91E2 7217 91E3 3EEB 91E4 7772 91E5 7A43 91E6 70D0 91E7 24473 91E8 243F8 91E9 717E 91EA 217EF 91EB 70A3 91EC 218BE 91ED 23599 91EE 3EC7 91EF 21885 91F0 2542F 91F1 217F8 91F2 3722 91F3 216FB 91F4 21839 91F5 36E1 91F6 21774 91F7 218D1 91F8 25F4B 91F9 3723 91FA 216C0 91FB 575B 91FC 24A25 91FD 213FE 91FE 212A8 9240 213C6 9241 214B6 9242 8503 9243 236A6 9245 8455 9246 24994 9247 27165 9248 23E31 9249 2555C 924A 23EFB 924B 27052 924C 44F4 924D 236EE 924E 2999D 924F 26F26 9250 67F9 9251 3733 9252 3C15 9253 3DE7 9254 586C 9255 21922 9256 6810 9257 4057 9258 2373F 9259 240E1 925A 2408B 925B 2410F 925C 26C21 925D 54CB 925E 569E 925F 266B1 9260 5692 9261 20FDF 9262 20BA8 9263 20E0D 9264 93C6 9265 28B13 9266 939C 9267 4EF8 9268 512B 9269 3819 926A 24436 926B 4EBC 926C 20465 926D 2037F 926E 4F4B 926F 4F8A 9270 25651 9271 5A68 9272 201AB 9273 203CB 9274 3999 9275 2030A 9276 20414 9277 3435 9278 4F29 9279 202C0 927A 28EB3 927B 20275 927C 8ADA 927D 2020C 927E 4E98 92A1 50CD 92A2 510D 92A3 4FA2 92A4 4F03 92A5 24A0E 92A6 23E8A 92A7 4F42 92A8 502E 92A9 506C 92AA 5081 92AB 4FCC 92AC 4FE5 92AD 5058 92AE 50FC 92B3 6E76 92B4 23595 92B5 23E39 92B6 23EBF 92B7 6D72 92B8 21884 92B9 23E89 92BA 51A8 92BB 51C3 92BC 205E0 92BD 44DD 92BE 204A3 92BF 20492 92C0 20491 92C1 8D7A 92C2 28A9C 92C3 2070E 92C4 5259 92C5 52A4 92C6 20873 92C7 52E1 92C9 467A 92CA 718C 92CB 2438C 92CC 20C20 92CD 249AC 92CE 210E4 92CF 69D1 92D0 20E1D 92D2 3EDE 92D3 7499 92D4 7414 92D5 7456 92D6 7398 92D7 4B8E 92D8 24ABC 92D9 2408D 92DA 53D0 92DB 3584 92DC 720F 92DD 240C9 92DE 55B4 92DF 20345 92E0 54CD 92E1 20BC6 92E2 571D 92E3 925D 92E4 96F4 92E5 9366 92E6 57DD 92E7 578D 92E8 577F 92E9 363E 92EA 58CB 92EB 5A99 92EC 28A46 92ED 216FA 92EE 2176F 92EF 21710 92F0 5A2C 92F1 59B8 92F2 928F 92F3 5A7E 92F4 5ACF 92F5 5A12 92F6 25946 92F7 219F3 92F8 21861 92F9 24295 92FA 36F5 92FB 6D05 92FC 7443 92FD 5A21 92FE 25E83 9340 5A81 9341 28BD7 9342 20413 9343 93E0 9344 748C 9345 21303 9346 7105 9347 4972 9348 9408 9349 289FB 934A 93BD 934B 37A0 934C 5C1E 934D 5C9E 934E 5E5E 934F 5E48 9350 21996 9351 2197C 9352 23AEE 9353 5ECD 9354 5B4F 9355 21903 9356 21904 9357 3701 9358 218A0 9359 36DD 935A 216FE 935B 36D3 935C 812A 935D 28A47 935E 21DBA 935F 23472 9360 289A8 9361 5F0C 9362 5F0E 9363 21927 9364 217AB 9365 5A6B 9366 2173B 9367 5B44 9368 8614 9369 275FD 936A 8860 936B 607E 936C 22860 936D 2262B 936E 5FDB 936F 3EB8 9370 225AF 9371 225BE 9372 29088 9373 26F73 9374 61C0 9375 2003E 9376 20046 9377 2261B 9378 6199 9379 6198 937A 6075 937B 22C9B 937C 22D07 937D 246D4 937E 2914D 93A1 6471 93A2 24665 93A3 22B6A 93A4 3A29 93A5 22B22 93A6 23450 93A7 298EA 93A8 22E78 93A9 6337 93AA 2A45B 93AB 64B6 93AC 6331 93AD 63D1 93AE 249E3 93AF 22D67 93B0 62A4 93B1 22CA1 93B2 643B 93B3 656B 93B4 6972 93B5 3BF4 93B6 2308E 93B7 232AD 93B8 24989 93B9 232AB 93BA 550D 93BB 232E0 93BC 218D9 93BD 2943F 93BE 66CE 93BF 23289 93C0 231B3 93C1 3AE0 93C2 4190 93C3 25584 93C4 28B22 93C5 2558F 93C6 216FC 93C7 2555B 93C8 25425 93C9 78EE 93CA 23103 93CB 2182A 93CC 23234 93CD 3464 93CE 2320F 93CF 23182 93D0 242C9 93D1 668E 93D2 26D24 93D3 666B 93D4 4B93 93D5 6630 93D6 27870 93D7 21DEB 93D8 6663 93D9 232D2 93DA 232E1 93DB 661E 93DC 25872 93DD 38D1 93DE 2383A 93DF 237BC 93E0 3B99 93E1 237A2 93E2 233FE 93E3 74D0 93E4 3B96 93E5 678F 93E6 2462A 93E7 68B6 93E8 681E 93E9 3BC4 93EA 6ABE 93EB 3863 93EC 237D5 93ED 24487 93EE 6A33 93EF 6A52 93F0 6AC9 93F1 6B05 93F2 21912 93F3 6511 93F4 6898 93F5 6A4C 93F6 3BD7 93F7 6A7A 93F8 6B57 93F9 23FC0 93FA 23C9A 93FB 93A0 93FC 92F2 93FD 28BEA 93FE 28ACB 9440 9289 9441 2801E 9442 289DC 9443 9467 9444 6DA5 9445 6F0B 9446 249EC 9448 23F7F 9449 3D8F 944A 6E04 944B 2403C 944C 5A3D 944D 6E0A 944E 5847 944F 6D24 9450 7842 9451 713B 9452 2431A 9453 24276 9454 70F1 9455 7250 9456 7287 9457 7294 9458 2478F 9459 24725 945A 5179 945B 24AA4 945C 205EB 945D 747A 945E 23EF8 945F 2365F 9460 24A4A 9461 24917 9462 25FE1 9463 3F06 9464 3EB1 9465 24ADF 9466 28C23 9467 23F35 9468 60A7 9469 3EF3 946A 74CC 946B 743C 946C 9387 946D 7437 946E 449F 946F 26DEA 9470 4551 9471 7583 9472 3F63 9473 24CD9 9474 24D06 9475 3F58 9476 7555 9477 7673 9478 2A5C6 9479 3B19 947A 7468 947B 28ACC 947C 249AB 947D 2498E 947E 3AFB 94A1 3DCD 94A2 24A4E 94A3 3EFF 94A4 249C5 94A5 248F3 94A6 91FA 94A7 5732 94A8 9342 94A9 28AE3 94AA 21864 94AB 50DF 94AC 25221 94AD 251E7 94AE 7778 94AF 23232 94B0 770E 94B1 770F 94B2 777B 94B3 24697 94B4 23781 94B5 3A5E 94B6 248F0 94B7 7438 94B8 749B 94B9 3EBF 94BA 24ABA 94BB 24AC7 94BC 40C8 94BD 24A96 94BE 261AE 94BF 9307 94C0 25581 94C1 781E 94C2 788D 94C3 7888 94C4 78D2 94C5 73D0 94C6 7959 94C7 27741 94C8 256E3 94C9 410E 94CB 8496 94CC 79A5 94CD 6A2D 94CE 23EFA 94CF 7A3A 94D0 79F4 94D1 416E 94D2 216E6 94D3 4132 94D4 9235 94D5 79F1 94D6 20D4C 94D7 2498C 94D8 20299 94D9 23DBA 94DA 2176E 94DB 3597 94DC 556B 94DD 3570 94DE 36AA 94DF 201D4 94E0 20C0D 94E1 7AE2 94E2 5A59 94E3 226F5 94E4 25AAF 94E5 25A9C 94E6 5A0D 94E7 2025B 94E8 78F0 94E9 5A2A 94EA 25BC6 94EB 7AFE 94EC 41F9 94ED 7C5D 94EE 7C6D 94EF 4211 94F0 25BB3 94F1 25EBC 94F2 25EA6 94F3 7CCD 94F4 249F9 94F5 217B0 94F6 7C8E 94F7 7C7C 94F8 7CAE 94F9 6AB2 94FA 7DDC 94FB 7E07 94FC 7DD3 94FD 7F4E 94FE 26261 9540 2615C 9541 27B48 9542 7D97 9543 25E82 9544 426A 9545 26B75 9546 20916 9547 67D6 9548 2004E 9549 235CF 954A 57C4 954B 26412 954C 263F8 954D 24962 954E 7FDD 954F 7B27 9550 2082C 9551 25AE9 9552 25D43 9553 7B0C 9554 25E0E 9555 99E6 9556 8645 9557 9A63 9558 6A1C 9559 2343F 955A 39E2 955B 249F7 955C 265AD 955D 9A1F 955E 265A0 955F 8480 9560 27127 9561 26CD1 9562 44EA 9563 8137 9564 4402 9565 80C6 9566 8109 9567 8142 9568 267B4 9569 98C3 956A 26A42 956B 8262 956C 8265 956D 26A51 956E 8453 956F 26DA7 9570 8610 9571 2721B 9572 5A86 9573 417F 9574 21840 9575 5B2B 9576 218A1 9577 5AE4 9578 218D8 9579 86A0 957A 2F9BC 957B 23D8F 957C 882D 957D 27422 957E 5A02 95A1 886E 95A2 4F45 95A3 8887 95A4 88BF 95A5 88E6 95A6 8965 95A7 894D 95A8 25683 95A9 8954 95AA 27785 95AB 27784 95AC 28BF5 95AD 28BD9 95AE 28B9C 95AF 289F9 95B0 3EAD 95B1 84A3 95B2 46F5 95B3 46CF 95B4 37F2 95B5 8A3D 95B6 8A1C 95B7 29448 95B8 5F4D 95B9 922B 95BA 24284 95BB 65D4 95BC 7129 95BD 70C4 95BE 21845 95BF 9D6D 95C0 8C9F 95C1 8CE9 95C2 27DDC 95C3 599A 95C4 77C3 95C5 59F0 95C6 436E 95C7 36D4 95C8 8E2A 95C9 8EA7 95CA 24C09 95CB 8F30 95CC 8F4A 95CD 42F4 95CE 6C58 95CF 6FBB 95D0 22321 95D1 489B 95D2 6F79 95D3 6E8B 95D4 217DA 95D5 9BE9 95D6 36B5 95D7 2492F 95D8 90BB 95DA 5571 95DB 4906 95DC 91BB 95DD 9404 95DE 28A4B 95DF 4062 95E0 28AFC 95E1 9427 95E2 28C1D 95E3 28C3B 95E4 84E5 95E5 8A2B 95E6 9599 95E7 95A7 95E8 9597 95E9 9596 95EA 28D34 95EB 7445 95EC 3EC2 95ED 248FF 95EE 24A42 95EF 243EA 95F0 3EE7 95F1 23225 95F2 968F 95F3 28EE7 95F4 28E66 95F5 28E65 95F6 3ECC 95F7 249ED 95F8 24A78 95F9 23FEE 95FA 7412 95FB 746B 95FC 3EFC 95FD 9741 95FE 290B0 9640 6847 9641 4A1D 9642 29093 9643 257DF 9645 9368 9646 28989 9647 28C26 9648 28B2F 9649 263BE 964A 92BA 964B 5B11 964C 8B69 964D 493C 964E 73F9 964F 2421B 9650 979B 9651 9771 9652 9938 9653 20F26 9654 5DC1 9655 28BC5 9656 24AB2 9657 981F 9658 294DA 9659 92F6 965A 295D7 965B 91E5 965C 44C0 965D 28B50 965E 24A67 965F 28B64 9660 98DC 9661 28A45 9662 3F00 9663 922A 9664 4925 9665 8414 9666 993B 9667 994D 9668 27B06 9669 3DFD 966A 999B 966B 4B6F 966C 99AA 966D 9A5C 966E 28B65 966F 258C8 9670 6A8F 9671 9A21 9672 5AFE 9673 9A2F 9674 298F1 9675 4B90 9676 29948 9677 99BC 9678 4BBD 9679 4B97 967A 937D 967B 5872 967C 21302 967D 5822 967E 249B8 96A1 214E8 96A2 7844 96A3 2271F 96A4 23DB8 96A5 68C5 96A6 3D7D 96A7 9458 96A8 3927 96A9 6150 96AA 22781 96AB 2296B 96AC 6107 96AD 9C4F 96AE 9C53 96AF 9C7B 96B0 9C35 96B1 9C10 96B2 9B7F 96B3 9BCF 96B4 29E2D 96B5 9B9F 96B6 2A1F5 96B7 2A0FE 96B8 9D21 96B9 4CAE 96BA 24104 96BB 9E18 96BC 4CB0 96BD 9D0C 96BE 2A1B4 96BF 2A0ED 96C0 2A0F3 96C1 2992F 96C2 9DA5 96C3 84BD 96C4 26E12 96C5 26FDF 96C6 26B82 96C7 85FC 96C8 4533 96C9 26DA4 96CA 26E84 96CB 26DF0 96CC 8420 96CD 85EE 96CE 26E00 96CF 237D7 96D0 26064 96D1 79E2 96D2 2359C 96D3 23640 96D4 492D 96D5 249DE 96D6 3D62 96D7 93DB 96D8 92BE 96D9 9348 96DA 202BF 96DB 78B9 96DC 9277 96DD 944D 96DE 4FE4 96DF 3440 96E0 9064 96E1 2555D 96E2 783D 96E3 7854 96E4 78B6 96E5 784B 96E6 21757 96E7 231C9 96E8 24941 96E9 369A 96EA 4F72 96EB 6FDA 96EC 6FD9 96EE 701E 96EF 5414 96F0 241B5 96F1 57BB 96F2 58F3 96F3 578A 96F4 9D16 96F5 57D7 96F6 7134 96F7 34AF 96F8 241AC 96F9 71EB 96FA 26C40 96FB 24F97 96FD 217B5 96FE 28A49 9740 610C 9741 5ACE 9742 5A0B 9743 42BC 9744 24488 9745 372C 9746 4B7B 9747 289FC 9748 93BB 9749 93B8 974A 218D6 974B 20F1D 974C 8472 974D 26CC0 974E 21413 974F 242FA 9750 22C26 9751 243C1 9752 5994 9753 23DB7 9754 26741 9755 7DA8 9756 2615B 9757 260A4 9758 249B9 9759 2498B 975A 289FA 975B 92E5 975C 73E2 975D 3EE9 975E 74B4 975F 28B63 9760 2189F 9761 3EE1 9762 24AB3 9763 6AD8 9764 73F3 9765 73FB 9766 3ED6 9767 24A3E 9768 24A94 9769 217D9 976A 24A66 976B 203A7 976C 21424 976D 249E5 976E 7448 976F 24916 9770 70A5 9771 24976 9772 9284 9773 73E6 9774 935F 9775 204FE 9776 9331 9777 28ACE 9778 28A16 9779 9386 977A 28BE7 977B 255D5 977C 4935 977D 28A82 977E 716B 97A1 24943 97A2 20CFF 97A3 56A4 97A4 2061A 97A5 20BEB 97A6 20CB8 97A7 5502 97A8 79C4 97A9 217FA 97AA 7DFE 97AB 216C2 97AC 24A50 97AD 21852 97AE 452E 97AF 9401 97B0 370A 97B1 28AC0 97B2 249AD 97B3 59B0 97B4 218BF 97B5 21883 97B6 27484 97B7 5AA1 97B8 36E2 97B9 23D5B 97BA 36B0 97BB 925F 97BC 5A79 97BD 28A81 97BE 21862 97BF 9374 97C0 3CCD 97C1 20AB4 97C2 4A96 97C3 398A 97C4 50F4 97C5 3D69 97C6 3D4C 97C7 2139C 97C8 7175 97C9 42FB 97CA 28218 97CB 6E0F 97CC 290E4 97CD 44EB 97CE 6D57 97CF 27E4F 97D0 7067 97D1 6CAF 97D2 3CD6 97D3 23FED 97D4 23E2D 97D5 6E02 97D6 6F0C 97D7 3D6F 97D8 203F5 97D9 7551 97DA 36BC 97DB 34C8 97DC 4680 97DD 3EDA 97DE 4871 97DF 59C4 97E0 926E 97E1 493E 97E2 8F41 97E3 28C1C 97E4 26BC0 97E5 5812 97E6 57C8 97E7 36D6 97E8 21452 97E9 70FE 97EA 24362 97EB 24A71 97EC 22FE3 97ED 212B0 97EE 223BD 97EF 68B9 97F0 6967 97F1 21398 97F2 234E5 97F3 27BF4 97F4 236DF 97F5 28A83 97F6 237D6 97F7 233FA 97F8 24C9F 97F9 6A1A 97FA 236AD 97FB 26CB7 97FC 843E 97FD 44DF 97FE 44CE 9840 26D26 9841 26D51 9842 26C82 9843 26FDE 9844 6F17 9845 27109 9846 833D 9847 2173A 9848 83ED 9849 26C80 984A 27053 984B 217DB 984C 5989 984D 5A82 984E 217B3 984F 5A61 9850 5A71 9851 21905 9852 241FC 9853 372D 9854 59EF 9855 2173C 9856 36C7 9857 718E 9858 9390 9859 669A 985A 242A5 985B 5A6E 985C 5A2B 985D 24293 985E 6A2B 985F 23EF9 9860 27736 9861 2445B 9862 242CA 9863 711D 9864 24259 9865 289E1 9866 4FB0 9867 26D28 9868 5CC2 9869 244CE 986A 27E4D 986B 243BD 986C 6A0C 986D 24256 986E 21304 986F 70A6 9870 7133 9871 243E9 9872 3DA5 9873 6CDF 9874 2F825 9875 24A4F 9876 7E65 9877 59EB 9878 5D2F 9879 3DF3 987A 5F5C 987B 24A5D 987C 217DF 987D 7DA4 987E 8426 98A1 5485 98A2 23AFA 98A3 23300 98A4 20214 98A5 577E 98A6 208D5 98A7 20619 98A8 3FE5 98A9 21F9E 98AA 2A2B6 98AB 7003 98AC 2915B 98AD 5D70 98AE 738F 98AF 7CD3 98B0 28A59 98B1 29420 98B2 4FC8 98B3 7FE7 98B4 72CD 98B5 7310 98B6 27AF4 98B7 7338 98B8 7339 98B9 256F6 98BA 7341 98BB 7348 98BC 3EA9 98BD 27B18 98BE 906C 98BF 71F5 98C0 248F2 98C1 73E1 98C2 81F6 98C3 3ECA 98C4 770C 98C5 3ED1 98C6 6CA2 98C7 56FD 98C8 7419 98C9 741E 98CA 741F 98CB 3EE2 98CC 3EF0 98CD 3EF4 98CE 3EFA 98CF 74D3 98D0 3F0E 98D1 3F53 98D2 7542 98D3 756D 98D4 7572 98D5 758D 98D6 3F7C 98D7 75C8 98D8 75DC 98D9 3FC0 98DA 764D 98DB 3FD7 98DC 7674 98DD 3FDC 98DE 767A 98DF 24F5C 98E0 7188 98E1 5623 98E2 8980 98E3 5869 98E4 401D 98E5 7743 98E6 4039 98E7 6761 98E8 4045 98E9 35DB 98EA 7798 98EB 406A 98EC 406F 98ED 5C5E 98EE 77BE 98EF 77CB 98F0 58F2 98F1 7818 98F2 70B9 98F3 781C 98F4 40A8 98F5 7839 98F6 7847 98F7 7851 98F8 7866 98F9 8448 98FA 25535 98FB 7933 98FC 6803 98FD 7932 98FE 4103 9940 4109 9941 7991 9942 7999 9943 8FBB 9944 7A06 9945 8FBC 9946 4167 9947 7A91 9948 41B2 9949 7ABC 994A 8279 994B 41C4 994C 7ACF 994D 7ADB 994E 41CF 994F 4E21 9950 7B62 9951 7B6C 9952 7B7B 9953 7C12 9954 7C1B 9955 4260 9956 427A 9957 7C7B 9958 7C9C 9959 428C 995A 7CB8 995B 4294 995C 7CED 995D 8F93 995E 70C0 995F 20CCF 9960 7DCF 9961 7DD4 9962 7DD0 9963 7DFD 9964 7FAE 9965 7FB4 9966 729F 9967 4397 9968 8020 9969 8025 996A 7B39 996B 802E 996C 8031 996D 8054 996E 3DCC 996F 57B4 9970 70A0 9971 80B7 9972 80E9 9973 43ED 9974 810C 9975 732A 9976 810E 9977 8112 9978 7560 9979 8114 997A 4401 997B 3B39 997C 8156 997D 8159 997E 815A 99A1 4413 99A2 583A 99A3 817C 99A4 8184 99A5 4425 99A6 8193 99A7 442D 99A8 81A5 99A9 57EF 99AA 81C1 99AB 81E4 99AC 8254 99AD 448F 99AE 82A6 99AF 8276 99B0 82CA 99B1 82D8 99B2 82FF 99B3 44B0 99B4 8357 99B5 9669 99B6 698A 99B7 8405 99B8 70F5 99B9 8464 99BA 60E3 99BB 8488 99BC 4504 99BD 84BE 99BE 84E1 99BF 84F8 99C0 8510 99C1 8538 99C2 8552 99C3 453B 99C4 856F 99C5 8570 99C6 85E0 99C7 4577 99C8 8672 99C9 8692 99CA 86B2 99CB 86EF 99CC 9645 99CD 878B 99CE 4606 99CF 4617 99D0 88AE 99D1 88FF 99D2 8924 99D3 8947 99D4 8991 99D5 27967 99D6 8A29 99D7 8A38 99D8 8A94 99D9 8AB4 99DA 8C51 99DB 8CD4 99DC 8CF2 99DD 8D1C 99DE 4798 99DF 585F 99E0 8DC3 99E1 47ED 99E2 4EEE 99E3 8E3A 99E4 55D8 99E5 5754 99E6 8E71 99E7 55F5 99E8 8EB0 99E9 4837 99EA 8ECE 99EB 8EE2 99EC 8EE4 99ED 8EED 99EE 8EF2 99EF 8FB7 99F0 8FC1 99F1 8FCA 99F2 8FCC 99F3 9033 99F4 99C4 99F5 48AD 99F6 98E0 99F7 9213 99F8 491E 99F9 9228 99FA 9258 99FB 926B 99FC 92B1 99FD 92AE 99FE 92BF 9A40 92E3 9A41 92EB 9A42 92F3 9A43 92F4 9A44 92FD 9A45 9343 9A46 9384 9A47 93AD 9A48 4945 9A49 4951 9A4A 9EBF 9A4B 9417 9A4C 5301 9A4D 941D 9A4E 942D 9A4F 943E 9A50 496A 9A51 9454 9A52 9479 9A53 952D 9A54 95A2 9A55 49A7 9A56 95F4 9A57 9633 9A58 49E5 9A59 67A0 9A5A 4A24 9A5B 9740 9A5C 4A35 9A5D 97B2 9A5E 97C2 9A5F 5654 9A60 4AE4 9A61 60E8 9A62 98B9 9A63 4B19 9A64 98F1 9A65 5844 9A66 990E 9A67 9919 9A68 51B4 9A69 991C 9A6A 9937 9A6B 9942 9A6C 995D 9A6D 9962 9A6E 4B70 9A6F 99C5 9A70 4B9D 9A71 9A3C 9A72 9B0F 9A73 7A83 9A74 9B69 9A75 9B81 9A76 9BDD 9A77 9BF1 9A78 9BF4 9A79 4C6D 9A7A 9C20 9A7B 376F 9A7C 21BC2 9A7D 9D49 9A7E 9C3A 9AA1 9EFE 9AA2 5650 9AA3 9D93 9AA4 9DBD 9AA5 9DC0 9AA6 9DFC 9AA7 94F6 9AA8 8FB6 9AA9 9E7B 9AAA 9EAC 9AAB 9EB1 9AAC 9EBD 9AAD 9EC6 9AAE 94DC 9AAF 9EE2 9AB0 9EF1 9AB1 9EF8 9AB2 7AC8 9AB3 9F44 9AB4 20094 9AB5 202B7 9AB6 203A0 9AB7 691A 9AB8 94C3 9AB9 59AC 9ABA 204D7 9ABB 5840 9ABC 94C1 9ABD 37B9 9ABE 205D5 9ABF 20615 9AC0 20676 9AC1 216BA 9AC2 5757 9AC3 7173 9AC4 20AC2 9AC5 20ACD 9AC6 20BBF 9AC7 546A 9AC8 2F83B 9AC9 20BCB 9ACA 549E 9ACB 20BFB 9ACC 20C3B 9ACD 20C53 9ACE 20C65 9ACF 20C7C 9AD0 60E7 9AD1 20C8D 9AD2 567A 9AD3 20CB5 9AD4 20CDD 9AD5 20CED 9AD6 20D6F 9AD7 20DB2 9AD8 20DC8 9AD9 6955 9ADA 9C2F 9ADB 87A5 9ADC 20E04 9ADD 20E0E 9ADE 20ED7 9ADF 20F90 9AE0 20F2D 9AE1 20E73 9AE2 5C20 9AE3 20FBC 9AE4 5E0B 9AE5 2105C 9AE6 2104F 9AE7 21076 9AE8 671E 9AE9 2107B 9AEA 21088 9AEB 21096 9AEC 3647 9AED 210BF 9AEE 210D3 9AEF 2112F 9AF0 2113B 9AF1 5364 9AF2 84AD 9AF3 212E3 9AF4 21375 9AF5 21336 9AF6 8B81 9AF7 21577 9AF8 21619 9AF9 217C3 9AFA 217C7 9AFB 4E78 9AFC 70BB 9AFD 2182D 9AFE 2196A 9B40 21A2D 9B41 21A45 9B42 21C2A 9B43 21C70 9B44 21CAC 9B45 21EC8 9B46 62C3 9B47 21ED5 9B48 21F15 9B49 7198 9B4A 6855 9B4B 22045 9B4C 69E9 9B4D 36C8 9B4E 2227C 9B4F 223D7 9B50 223FA 9B51 2272A 9B52 22871 9B53 2294F 9B54 82FD 9B55 22967 9B56 22993 9B57 22AD5 9B58 89A5 9B59 22AE8 9B5A 8FA0 9B5B 22B0E 9B5C 97B8 9B5D 22B3F 9B5E 9847 9B5F 9ABD 9B60 22C4C 9B62 22C88 9B63 22CB7 9B64 25BE8 9B65 22D08 9B66 22D12 9B67 22DB7 9B68 22D95 9B69 22E42 9B6A 22F74 9B6B 22FCC 9B6C 23033 9B6D 23066 9B6E 2331F 9B6F 233DE 9B70 5FB1 9B71 6648 9B72 66BF 9B73 27A79 9B74 23567 9B75 235F3 9B77 249BA 9B79 2361A 9B7A 23716 9B7C 20346 9B7D 58B5 9B7E 670E 9BA1 6918 9BA2 23AA7 9BA3 27657 9BA4 25FE2 9BA5 23E11 9BA6 23EB9 9BA7 275FE 9BA8 2209A 9BA9 48D0 9BAA 4AB8 9BAB 24119 9BAC 28A9A 9BAD 242EE 9BAE 2430D 9BAF 2403B 9BB0 24334 9BB1 24396 9BB2 24A45 9BB3 205CA 9BB4 51D2 9BB5 20611 9BB6 599F 9BB7 21EA8 9BB8 3BBE 9BB9 23CFF 9BBA 24404 9BBB 244D6 9BBC 5788 9BBD 24674 9BBE 399B 9BBF 2472F 9BC0 285E8 9BC1 299C9 9BC2 3762 9BC3 221C3 9BC4 8B5E 9BC5 28B4E 9BC7 24812 9BC8 248FB 9BC9 24A15 9BCA 7209 9BCB 24AC0 9BCC 20C78 9BCD 5965 9BCE 24EA5 9BCF 24F86 9BD0 20779 9BD1 8EDA 9BD2 2502C 9BD3 528F 9BD4 573F 9BD5 7171 9BD6 25299 9BD7 25419 9BD8 23F4A 9BD9 24AA7 9BDA 55BC 9BDB 25446 9BDC 2546E 9BDD 26B52 9BDF 3473 9BE0 2553F 9BE1 27632 9BE2 2555E 9BE3 4718 9BE4 25562 9BE5 25566 9BE6 257C7 9BE7 2493F 9BE8 2585D 9BE9 5066 9BEA 34FB 9BEB 233CC 9BED 25903 9BEE 477C 9BEF 28948 9BF0 25AAE 9BF1 25B89 9BF2 25C06 9BF3 21D90 9BF4 57A1 9BF5 7151 9BF7 26102 9BF8 27C12 9BF9 9056 9BFA 261B2 9BFB 24F9A 9BFC 8B62 9BFD 26402 9BFE 2644A 9C40 5D5B 9C41 26BF7 9C43 26484 9C44 2191C 9C45 8AEA 9C46 249F6 9C47 26488 9C48 23FEF 9C49 26512 9C4A 4BC0 9C4B 265BF 9C4C 266B5 9C4D 2271B 9C4E 9465 9C4F 257E1 9C50 6195 9C51 5A27 9C52 2F8CD 9C54 56B9 9C55 24521 9C56 266FC 9C57 4E6A 9C58 24934 9C59 9656 9C5A 6D8F 9C5B 26CBD 9C5C 3618 9C5D 8977 9C5E 26799 9C5F 2686E 9C60 26411 9C61 2685E 9C63 268C7 9C64 7B42 9C65 290C0 9C66 20A11 9C67 26926 9C69 26939 9C6A 7A45 9C6C 269FA 9C6D 9A26 9C6E 26A2D 9C6F 365F 9C70 26469 9C71 20021 9C72 7983 9C73 26A34 9C74 26B5B 9C75 5D2C 9C76 23519 9C78 26B9D 9C79 46D0 9C7A 26CA4 9C7B 753B 9C7C 8865 9C7D 26DAE 9C7E 58B6 9CA1 371C 9CA2 2258D 9CA3 2704B 9CA4 271CD 9CA5 3C54 9CA6 27280 9CA7 27285 9CA8 9281 9CA9 2217A 9CAA 2728B 9CAB 9330 9CAC 272E6 9CAD 249D0 9CAE 6C39 9CAF 949F 9CB0 27450 9CB1 20EF8 9CB2 8827 9CB3 88F5 9CB4 22926 9CB5 28473 9CB6 217B1 9CB7 6EB8 9CB8 24A2A 9CB9 21820 9CBA 39A4 9CBB 36B9 9CBE 453F 9CBF 66B6 9CC0 29CAD 9CC1 298A4 9CC2 8943 9CC3 277CC 9CC4 27858 9CC5 56D6 9CC6 40DF 9CC7 2160A 9CC8 39A1 9CC9 2372F 9CCA 280E8 9CCB 213C5 9CCC 71AD 9CCD 8366 9CCE 279DD 9CCF 291A8 9CD1 4CB7 9CD2 270AF 9CD3 289AB 9CD4 279FD 9CD5 27A0A 9CD6 27B0B 9CD7 27D66 9CD8 2417A 9CD9 7B43 9CDA 797E 9CDB 28009 9CDC 6FB5 9CDD 2A2DF 9CDE 6A03 9CDF 28318 9CE0 53A2 9CE1 26E07 9CE2 93BF 9CE3 6836 9CE4 975D 9CE5 2816F 9CE6 28023 9CE7 269B5 9CE8 213ED 9CE9 2322F 9CEA 28048 9CEB 5D85 9CEC 28C30 9CED 28083 9CEE 5715 9CEF 9823 9CF0 28949 9CF1 5DAB 9CF2 24988 9CF3 65BE 9CF4 69D5 9CF5 53D2 9CF6 24AA5 9CF7 23F81 9CF8 3C11 9CF9 6736 9CFA 28090 9CFB 280F4 9CFC 2812E 9CFD 21FA1 9CFE 2814F 9D40 28189 9D41 281AF 9D42 2821A 9D43 28306 9D44 2832F 9D45 2838A 9D46 35CA 9D47 28468 9D48 286AA 9D49 48FA 9D4A 63E6 9D4B 28956 9D4C 7808 9D4D 9255 9D4E 289B8 9D4F 43F2 9D50 289E7 9D51 43DF 9D52 289E8 9D53 28B46 9D54 28BD4 9D55 59F8 9D56 28C09 9D58 28FC5 9D59 290EC 9D5B 29110 9D5C 2913C 9D5D 3DF7 9D5E 2915E 9D5F 24ACA 9D60 8FD0 9D61 728F 9D62 568B 9D63 294E7 9D64 295E9 9D65 295B0 9D66 295B8 9D67 29732 9D68 298D1 9D69 29949 9D6A 2996A 9D6B 299C3 9D6C 29A28 9D6D 29B0E 9D6E 29D5A 9D6F 29D9B 9D70 7E9F 9D71 29EF8 9D72 29F23 9D73 4CA4 9D74 9547 9D75 2A293 9D76 71A2 9D77 2A2FF 9D78 4D91 9D79 9012 9D7A 2A5CB 9D7B 4D9C 9D7C 20C9C 9D7D 8FBE 9D7E 55C1 9DA1 8FBA 9DA2 224B0 9DA3 8FB9 9DA4 24A93 9DA5 4509 9DA6 7E7F 9DA7 6F56 9DA8 6AB1 9DA9 4EEA 9DAA 34E4 9DAB 28B2C 9DAC 2789D 9DAD 373A 9DAE 8E80 9DAF 217F5 9DB0 28024 9DB1 28B6C 9DB2 28B99 9DB3 27A3E 9DB4 266AF 9DB5 3DEB 9DB6 27655 9DB7 23CB7 9DB8 25635 9DB9 25956 9DBA 4E9A 9DBB 25E81 9DBC 26258 9DBD 56BF 9DBE 20E6D 9DBF 8E0E 9DC0 5B6D 9DC1 23E88 9DC2 24C9E 9DC3 63DE 9DC5 217F6 9DC6 2187B 9DC7 6530 9DC8 562D 9DC9 25C4A 9DCA 541A 9DCB 25311 9DCC 3DC6 9DCD 29D98 9DCE 4C7D 9DCF 5622 9DD0 561E 9DD1 7F49 9DD2 25ED8 9DD3 5975 9DD4 23D40 9DD5 8770 9DD6 4E1C 9DD7 20FEA 9DD8 20D49 9DD9 236BA 9DDA 8117 9DDB 9D5E 9DDC 8D18 9DDD 763B 9DDE 9C45 9DDF 764E 9DE0 77B9 9DE1 9345 9DE2 5432 9DE3 8148 9DE4 82F7 9DE5 5625 9DE6 8132 9DE7 8418 9DE8 80BD 9DE9 55EA 9DEA 7962 9DEB 5643 9DEC 5416 9DED 20E9D 9DEE 35CE 9DEF 5605 9DF0 55F1 9DF1 66F1 9DF2 282E2 9DF3 362D 9DF4 7534 9DF5 55F0 9DF6 55BA 9DF7 5497 9DF8 5572 9DF9 20C41 9DFA 20C96 9DFB 5ED0 9DFC 25148 9DFD 20E76 9DFE 22C62 9E40 20EA2 9E41 9EAB 9E42 7D5A 9E43 55DE 9E44 21075 9E45 629D 9E46 976D 9E47 5494 9E48 8CCD 9E49 71F6 9E4A 9176 9E4B 63FC 9E4C 63B9 9E4D 63FE 9E4E 5569 9E4F 22B43 9E50 9C72 9E51 22EB3 9E52 519A 9E53 34DF 9E54 20DA7 9E55 51A7 9E56 544D 9E57 551E 9E58 5513 9E59 7666 9E5A 8E2D 9E5B 2688A 9E5C 75B1 9E5D 80B6 9E5E 8804 9E5F 8786 9E60 88C7 9E61 81B6 9E62 841C 9E63 210C1 9E64 44EC 9E65 7304 9E66 24706 9E67 5B90 9E68 830B 9E69 26893 9E6A 567B 9E6B 226F4 9E6C 27D2F 9E6D 241A3 9E6E 27D73 9E6F 26ED0 9E70 272B6 9E71 9170 9E72 211D9 9E73 9208 9E74 23CFC 9E75 2A6A9 9E76 20EAC 9E77 20EF9 9E78 7266 9E79 21CA2 9E7A 474E 9E7B 24FC2 9E7C 27FF9 9E7D 20FEB 9E7E 40FA 9EA1 9C5D 9EA2 651F 9EA3 22DA0 9EA4 48F3 9EA5 247E0 9EA6 29D7C 9EA7 20FEC 9EA8 20E0A 9EAA 275A3 9EAB 20FED 9EAD 26048 9EAE 21187 9EAF 71A3 9EB0 7E8E 9EB1 9D50 9EB2 4E1A 9EB3 4E04 9EB4 3577 9EB5 5B0D 9EB6 6CB2 9EB7 5367 9EB8 36AC 9EB9 39DC 9EBA 537D 9EBB 36A5 9EBC 24618 9EBD 589A 9EBE 24B6E 9EBF 822D 9EC0 544B 9EC1 57AA 9EC2 25A95 9EC3 20979 9EC5 3A52 9EC6 22465 9EC7 7374 9EC8 29EAC 9EC9 4D09 9ECA 9BED 9ECB 23CFE 9ECC 29F30 9ECD 4C5B 9ECE 24FA9 9ECF 2959E 9ED0 29FDE 9ED1 845C 9ED2 23DB6 9ED3 272B2 9ED4 267B3 9ED5 23720 9ED6 632E 9ED7 7D25 9ED8 23EF7 9ED9 23E2C 9EDA 3A2A 9EDB 9008 9EDC 52CC 9EDD 3E74 9EDE 367A 9EDF 45E9 9EE0 2048E 9EE1 7640 9EE2 5AF0 9EE3 20EB6 9EE4 787A 9EE5 27F2E 9EE6 58A7 9EE7 40BF 9EE8 567C 9EE9 9B8B 9EEA 5D74 9EEB 7654 9EEC 2A434 9EED 9E85 9EEE 4CE1 9EF0 37FB 9EF1 6119 9EF2 230DA 9EF3 243F2 9EF5 565D 9EF6 212A9 9EF7 57A7 9EF8 24963 9EF9 29E06 9EFA 5234 9EFB 270AE 9EFC 35AD 9EFE 9D7C 9F40 7C56 9F41 9B39 9F42 57DE 9F43 2176C 9F44 5C53 9F45 64D3 9F46 294D0 9F47 26335 9F48 27164 9F49 86AD 9F4A 20D28 9F4B 26D22 9F4C 24AE2 9F4D 20D71 9F4F 51FE 9F50 21F0F 9F51 5D8E 9F52 9703 9F53 21DD1 9F54 9E81 9F55 904C 9F56 7B1F 9F57 9B02 9F58 5CD1 9F59 7BA3 9F5A 6268 9F5B 6335 9F5C 9AFF 9F5D 7BCF 9F5E 9B2A 9F5F 7C7E 9F61 7C42 9F62 7C86 9F63 9C15 9F64 7BFC 9F65 9B09 9F67 9C1B 9F68 2493E 9F69 9F5A 9F6A 5573 9F6B 5BC3 9F6C 4FFD 9F6D 9E98 9F6E 4FF2 9F6F 5260 9F70 3E06 9F71 52D1 9F72 5767 9F73 5056 9F74 59B7 9F75 5E12 9F76 97C8 9F77 9DAB 9F78 8F5C 9F79 5469 9F7A 97B4 9F7B 9940 9F7C 97BA 9F7D 532C 9F7E 6130 9FA1 692C 9FA2 53DA 9FA3 9C0A 9FA4 9D02 9FA5 4C3B 9FA6 9641 9FA7 6980 9FA8 50A6 9FA9 7546 9FAA 2176D 9FAB 99DA 9FAC 5273 9FAE 9159 9FAF 9681 9FB0 915C 9FB2 9151 9FB3 28E97 9FB4 637F 9FB5 26D23 9FB6 6ACA 9FB7 5611 9FB8 918E 9FB9 757A 9FBA 6285 9FBB 203FC 9FBC 734F 9FBD 7C70 9FBE 25C21 9FBF 23CFD 9FC1 24919 9FC2 76D6 9FC3 9B9D 9FC4 4E2A 9FC5 20CD4 9FC6 83BE 9FC7 8842 9FC9 5C4A 9FCA 69C0 9FCC 577A 9FCD 521F 9FCE 5DF5 9FCF 4ECE 9FD0 6C31 9FD1 201F2 9FD2 4F39 9FD3 549C 9FD4 54DA 9FD5 529A 9FD6 8D82 9FD7 35FE 9FD9 35F3 9FDB 6B52 9FDC 917C 9FDD 9FA5 9FDE 9B97 9FDF 982E 9FE0 98B4 9FE1 9ABA 9FE2 9EA8 9FE3 9E84 9FE4 717A 9FE5 7B14 9FE7 6BFA 9FE8 8818 9FE9 7F78 9FEB 5620 9FEC 2A64A 9FED 8E77 9FEE 9F53 9FF0 8DD4 9FF1 8E4F 9FF2 9E1C 9FF3 8E01 9FF4 6282 9FF5 2837D 9FF6 8E28 9FF7 8E75 9FF8 7AD3 9FF9 24A77 9FFA 7A3E 9FFB 78D8 9FFC 6CEA 9FFD 8A67 9FFE 7607 A040 28A5A A041 9F26 A042 6CCE A043 87D6 A044 75C3 A045 2A2B2 A046 7853 A047 2F840 A048 8D0C A049 72E2 A04A 7371 A04B 8B2D A04C 7302 A04D 74F1 A04E 8CEB A04F 24ABB A050 862F A051 5FBA A052 88A0 A053 44B7 A055 2183B A056 26E05 A058 8A7E A059 2251B A05B 60FD A05C 7667 A05D 9AD7 A05E 9D44 A05F 936E A060 9B8F A061 87F5 A064 8CF7 A065 732C A066 9721 A067 9BB0 A068 35D6 A069 72B2 A06A 4C07 A06B 7C51 A06C 994A A06D 26159 A06E 6159 A06F 4C04 A070 9E96 A071 617D A073 575F A074 616F A075 62A6 A076 6239 A078 3A5C A079 61E2 A07A 53AA A07B 233F5 A07C 6364 A07D 6802 A07E 35D2 A0A1 5D57 A0A2 28BC2 A0A3 8FDA A0A4 28E39 A0A6 50D9 A0A7 21D46 A0A8 7906 A0A9 5332 A0AA 9638 A0AB 20F3B A0AC 4065 A0AE 77FE A0B0 7CC2 A0B1 25F1A A0B2 7CDA A0B3 7A2D A0B4 8066 A0B5 8063 A0B6 7D4D A0B7 7505 A0B8 74F2 A0B9 8994 A0BA 821A A0BB 670C A0BC 8062 A0BD 27486 A0BE 805B A0BF 74F0 A0C0 8103 A0C1 7724 A0C2 8989 A0C3 267CC A0C4 7553 A0C5 26ED1 A0C6 87A9 A0C7 87CE A0C8 81C8 A0C9 878C A0CA 8A49 A0CB 8CAD A0CC 8B43 A0CD 772B A0CE 74F8 A0CF 84DA A0D0 3635 A0D1 69B2 A0D2 8DA6 A0D4 89A9 A0D6 6DB9 A0D7 87C1 A0D8 24011 A0D9 74E7 A0DA 3DDB A0DB 7176 A0DC 60A4 A0DD 619C A0DE 3CD1 A0E0 6077 A0E2 7F71 A0E3 28B2D A0E5 60E9 A0E6 4B7E A0E7 5220 A0E8 3C18 A0E9 23CC7 A0EA 25ED7 A0EB 27656 A0EC 25531 A0ED 21944 A0EE 212FE A0EF 29903 A0F0 26DDC A0F1 270AD A0F2 5CC1 A0F3 261AD A0F4 28A0F A0F5 23677 A0F6 200EE A0F7 26846 A0F8 24F0E A0F9 4562 A0FA 5B1F A0FB 2634C A0FC 9F50 A0FD 9EA6 A0FE 2626B C6A1 2460 C6A2 2461 C6A3 2462 C6A4 2463 C6A5 2464 C6A6 2465 C6A7 2466 C6A8 2467 C6A9 2468 C6AA 2469 C6AB 2474 C6AC 2475 C6AD 2476 C6AE 2477 C6AF 2478 C6B0 2479 C6B1 247A C6B2 247B C6B3 247C C6B4 247D C6B5 2170 C6B6 2171 C6B7 2172 C6B8 2173 C6B9 2174 C6BA 2175 C6BB 2176 C6BC 2177 C6BD 2178 C6BE 2179 C6BF 4E36 C6C0 4E3F C6C1 4E85 C6C2 4EA0 C6C3 5182 C6C4 5196 C6C5 51AB C6C6 52F9 C6C7 5338 C6C8 5369 C6C9 53B6 C6CA 590A C6CB 5B80 C6CC 5DDB C6CD 2F33 C6CE 5E7F C6D0 5F50 C6D1 5F61 C6D2 6534 C6D4 7592 C6D6 8FB5 C6D8 00A8 C6D9 02C6 C6DA 30FD C6DB 30FE C6DC 309D C6DD 309E C6E0 3005 C6E1 3006 C6E2 3007 C6E3 30FC C6E4 FF3B C6E5 FF3D C6E6 273D C6E7 3041 C6E8 3042 C6E9 3043 C6EA 3044 C6EB 3045 C6EC 3046 C6ED 3047 C6EE 3048 C6EF 3049 C6F0 304A C6F1 304B C6F2 304C C6F3 304D C6F4 304E C6F5 304F C6F6 3050 C6F7 3051 C6F8 3052 C6F9 3053 C6FA 3054 C6FB 3055 C6FC 3056 C6FD 3057 C6FE 3058 C740 3059 C741 305A C742 305B C743 305C C744 305D C745 305E C746 305F C747 3060 C748 3061 C749 3062 C74A 3063 C74B 3064 C74C 3065 C74D 3066 C74E 3067 C74F 3068 C750 3069 C751 306A C752 306B C753 306C C754 306D C755 306E C756 306F C757 3070 C758 3071 C759 3072 C75A 3073 C75B 3074 C75C 3075 C75D 3076 C75E 3077 C75F 3078 C760 3079 C761 307A C762 307B C763 307C C764 307D C765 307E C766 307F C767 3080 C768 3081 C769 3082 C76A 3083 C76B 3084 C76C 3085 C76D 3086 C76E 3087 C76F 3088 C770 3089 C771 308A C772 308B C773 308C C774 308D C775 308E C776 308F C777 3090 C778 3091 C779 3092 C77A 3093 C77B 30A1 C77C 30A2 C77D 30A3 C77E 30A4 C7A1 30A5 C7A2 30A6 C7A3 30A7 C7A4 30A8 C7A5 30A9 C7A6 30AA C7A7 30AB C7A8 30AC C7A9 30AD C7AA 30AE C7AB 30AF C7AC 30B0 C7AD 30B1 C7AE 30B2 C7AF 30B3 C7B0 30B4 C7B1 30B5 C7B2 30B6 C7B3 30B7 C7B4 30B8 C7B5 30B9 C7B6 30BA C7B7 30BB C7B8 30BC C7B9 30BD C7BA 30BE C7BB 30BF C7BC 30C0 C7BD 30C1 C7BE 30C2 C7BF 30C3 C7C0 30C4 C7C1 30C5 C7C2 30C6 C7C3 30C7 C7C4 30C8 C7C5 30C9 C7C6 30CA C7C7 30CB C7C8 30CC C7C9 30CD C7CA 30CE C7CB 30CF C7CC 30D0 C7CD 30D1 C7CE 30D2 C7CF 30D3 C7D0 30D4 C7D1 30D5 C7D2 30D6 C7D3 30D7 C7D4 30D8 C7D5 30D9 C7D6 30DA C7D7 30DB C7D8 30DC C7D9 30DD C7DA 30DE C7DB 30DF C7DC 30E0 C7DD 30E1 C7DE 30E2 C7DF 30E3 C7E0 30E4 C7E1 30E5 C7E2 30E6 C7E3 30E7 C7E4 30E8 C7E5 30E9 C7E6 30EA C7E7 30EB C7E8 30EC C7E9 30ED C7EA 30EE C7EB 30EF C7EC 30F0 C7ED 30F1 C7EE 30F2 C7EF 30F3 C7F0 30F4 C7F1 30F5 C7F2 30F6 C7F3 0410 C7F4 0411 C7F5 0412 C7F6 0413 C7F7 0414 C7F8 0415 C7F9 0401 C7FA 0416 C7FB 0417 C7FC 0418 C7FD 0419 C7FE 041A C840 041B C841 041C C842 041D C843 041E C844 041F C845 0420 C846 0421 C847 0422 C848 0423 C849 0424 C84A 0425 C84B 0426 C84C 0427 C84D 0428 C84E 0429 C84F 042A C850 042B C851 042C C852 042D C853 042E C854 042F C855 0430 C856 0431 C857 0432 C858 0433 C859 0434 C85A 0435 C85B 0451 C85C 0436 C85D 0437 C85E 0438 C85F 0439 C860 043A C861 043B C862 043C C863 043D C864 043E C865 043F C866 0440 C867 0441 C868 0442 C869 0443 C86A 0444 C86B 0445 C86C 0446 C86D 0447 C86E 0448 C86F 0449 C870 044A C871 044B C872 044C C873 044D C874 044E C875 044F C876 21E7 C877 21B8 C878 21B9 C879 31CF C87A 200CC C87B 4E5A C87C 2008A C87D 5202 C87E 4491 C8A1 9FB0 C8A2 5188 C8A3 9FB1 C8A4 27607 C8CD FFE2 C8CE FFE4 C8CF FF07 C8D0 FF02 C8D1 3231 C8D2 2116 C8D3 2121 C8D4 309B C8D5 309C C8D6 2E80 C8D7 2E84 C8D8 2E86 C8D9 2E87 C8DA 2E88 C8DB 2E8A C8DC 2E8C C8DD 2E8D C8DE 2E95 C8DF 2E9C C8E0 2E9D C8E1 2EA5 C8E2 2EA7 C8E3 2EAA C8E4 2EAC C8E5 2EAE C8E6 2EB6 C8E7 2EBC C8E8 2EBE C8E9 2EC6 C8EA 2ECA C8EB 2ECC C8EC 2ECD C8ED 2ECF C8EE 2ED6 C8EF 2ED7 C8F0 2EDE C8F1 2EE3 C8F5 0283 C8F6 0250 C8F7 025B C8F8 0254 C8F9 0275 C8FA 0153 C8FB 00F8 C8FC 014B C8FD 028A C8FE 026A F9D6 7881 F9D7 92B9 F9D8 88CF F9D9 58BB F9DA 6052 F9DB 7CA7 F9DC 5AFA F9DD 2554 F9DE 2566 F9DF 2557 F9E0 2560 F9E1 256C F9E2 2563 F9E3 255A F9E4 2569 F9E5 255D F9E6 2552 F9E7 2564 F9E8 2555 F9E9 255E F9EA 256A F9EB 2561 F9EC 2558 F9ED 2567 F9EE 255B F9EF 2553 F9F0 2565 F9F1 2556 F9F2 255F F9F3 256B F9F4 2562 F9F5 2559 F9F6 2568 F9F7 255C F9F8 2551 F9F9 2550 F9FA 256D F9FB 256E F9FC 2570 F9FD 256F F9FE FFED FA40 20547 FA41 92DB FA42 205DF FA43 23FC5 FA44 854C FA45 42B5 FA46 73EF FA47 51B5 FA48 3649 FA49 24942 FA4A 289E4 FA4B 9344 FA4C 219DB FA4D 82EE FA4E 23CC8 FA4F 783C FA50 6744 FA51 62DF FA52 24933 FA53 289AA FA54 202A0 FA55 26BB3 FA56 21305 FA57 4FAB FA58 224ED FA59 5008 FA5A 26D29 FA5B 27A84 FA5C 23600 FA5D 24AB1 FA5E 22513 FA60 2037E FA61 5FA4 FA62 20380 FA63 20347 FA64 6EDB FA65 2041F FA67 5101 FA68 347A FA69 510E FA6A 986C FA6B 3743 FA6C 8416 FA6D 249A4 FA6E 20487 FA6F 5160 FA70 233B4 FA71 516A FA72 20BFF FA73 220FC FA74 202E5 FA75 22530 FA76 2058E FA77 23233 FA78 21983 FA79 5B82 FA7A 877D FA7B 205B3 FA7C 23C99 FA7D 51B2 FA7E 51B8 FAA1 9D34 FAA2 51C9 FAA3 51CF FAA4 51D1 FAA5 3CDC FAA6 51D3 FAA7 24AA6 FAA8 51B3 FAA9 51E2 FAAA 5342 FAAB 51ED FAAC 83CD FAAD 693E FAAE 2372D FAAF 5F7B FAB0 520B FAB1 5226 FAB2 523C FAB3 52B5 FAB4 5257 FAB5 5294 FAB6 52B9 FAB7 52C5 FAB8 7C15 FAB9 8542 FABA 52E0 FABB 860D FABC 26B13 FABE 28ADE FABF 5549 FAC0 6ED9 FAC1 23F80 FAC2 20954 FAC3 23FEC FAC4 5333 FAC6 20BE2 FAC7 6CCB FAC8 21726 FAC9 681B FACA 73D5 FACB 604A FACC 3EAA FACD 38CC FACE 216E8 FACF 71DD FAD0 44A2 FAD1 536D FAD2 5374 FAD3 286AB FAD4 537E FAD6 21596 FAD7 21613 FAD8 77E6 FAD9 5393 FADA 28A9B FADB 53A0 FADC 53AB FADD 53AE FADE 73A7 FADF 25772 FAE0 3F59 FAE1 739C FAE2 53C1 FAE3 53C5 FAE4 6C49 FAE5 4E49 FAE6 57FE FAE7 53D9 FAE8 3AAB FAE9 20B8F FAEA 53E0 FAEB 23FEB FAEC 22DA3 FAED 53F6 FAEE 20C77 FAEF 5413 FAF0 7079 FAF1 552B FAF2 6657 FAF3 6D5B FAF4 546D FAF5 26B53 FAF6 20D74 FAF7 555D FAF8 548F FAF9 54A4 FAFA 47A6 FAFB 2170D FAFC 20EDD FAFD 3DB4 FAFE 20D4D FB40 289BC FB41 22698 FB42 5547 FB43 4CED FB44 542F FB45 7417 FB46 5586 FB47 55A9 FB49 218D7 FB4A 2403A FB4B 4552 FB4C 24435 FB4D 66B3 FB4E 210B4 FB4F 5637 FB50 66CD FB51 2328A FB52 66A4 FB53 66AD FB54 564D FB55 564F FB56 78F1 FB57 56F1 FB58 9787 FB59 53FE FB5A 5700 FB5B 56EF FB5C 56ED FB5D 28B66 FB5E 3623 FB5F 2124F FB60 5746 FB61 241A5 FB62 6C6E FB63 708B FB64 5742 FB65 36B1 FB66 26C7E FB67 57E6 FB68 21416 FB69 5803 FB6A 21454 FB6B 24363 FB6C 5826 FB6D 24BF5 FB6E 585C FB6F 58AA FB70 3561 FB71 58E0 FB72 58DC FB73 2123C FB74 58FB FB75 5BFF FB76 5743 FB77 2A150 FB78 24278 FB79 93D3 FB7A 35A1 FB7B 591F FB7C 68A6 FB7D 36C3 FB7E 6E59 FBA1 2163E FBA2 5A24 FBA3 5553 FBA4 21692 FBA5 8505 FBA6 59C9 FBA7 20D4E FBA8 26C81 FBA9 26D2A FBAA 217DC FBAB 59D9 FBAC 217FB FBAD 217B2 FBAE 26DA6 FBAF 6D71 FBB0 21828 FBB1 216D5 FBB2 59F9 FBB3 26E45 FBB4 5AAB FBB5 5A63 FBB6 36E6 FBB7 249A9 FBB9 3708 FBBA 5A96 FBBB 7465 FBBC 5AD3 FBBD 26FA1 FBBE 22554 FBBF 3D85 FBC0 21911 FBC1 3732 FBC2 216B8 FBC3 5E83 FBC4 52D0 FBC5 5B76 FBC6 6588 FBC7 5B7C FBC8 27A0E FBC9 4004 FBCA 485D FBCB 20204 FBCC 5BD5 FBCD 6160 FBCE 21A34 FBCF 259CC FBD0 205A5 FBD1 5BF3 FBD2 5B9D FBD3 4D10 FBD4 5C05 FBD5 21B44 FBD6 5C13 FBD7 73CE FBD8 5C14 FBD9 21CA5 FBDA 26B28 FBDB 5C49 FBDC 48DD FBDD 5C85 FBDE 5CE9 FBDF 5CEF FBE0 5D8B FBE1 21DF9 FBE2 21E37 FBE3 5D10 FBE4 5D18 FBE5 5D46 FBE6 21EA4 FBE7 5CBA FBE8 5DD7 FBE9 82FC FBEA 382D FBEB 24901 FBEC 22049 FBED 22173 FBEE 8287 FBEF 3836 FBF0 3BC2 FBF1 5E2E FBF2 6A8A FBF4 5E7A FBF5 244BC FBF6 20CD3 FBF7 53A6 FBF8 4EB7 FBFA 53A8 FBFB 21771 FBFC 5E09 FBFD 5EF4 FBFE 28482 FC40 5EF9 FC41 5EFB FC42 38A0 FC43 5EFC FC44 683E FC45 941B FC46 5F0D FC47 201C1 FC48 2F894 FC49 3ADE FC4A 48AE FC4B 2133A FC4C 5F3A FC4D 26888 FC4E 223D0 FC50 22471 FC51 5F63 FC52 97BD FC53 26E6E FC54 5F72 FC55 9340 FC56 28A36 FC57 5FA7 FC58 5DB6 FC59 3D5F FC5A 25250 FC5B 21F6A FC5C 270F8 FC5D 22668 FC5E 91D6 FC5F 2029E FC60 28A29 FC61 6031 FC62 6685 FC63 21877 FC64 3963 FC65 3DC7 FC66 3639 FC67 5790 FC68 227B4 FC69 7971 FC6A 3E40 FC6B 609E FC6D 60B3 FC6E 24982 FC6F 2498F FC70 27A53 FC71 74A4 FC72 50E1 FC73 5AA0 FC74 6164 FC75 8424 FC76 6142 FC77 2F8A6 FC78 26ED2 FC79 6181 FC7A 51F4 FC7B 20656 FC7C 6187 FC7D 5BAA FC7E 23FB7 FCA1 2285F FCA2 61D3 FCA3 28B9D FCA4 2995D FCA5 61D0 FCA6 3932 FCA7 22980 FCA8 228C1 FCA9 6023 FCAA 615C FCAB 651E FCAC 638B FCAD 20118 FCAE 62C5 FCAF 21770 FCB0 62D5 FCB1 22E0D FCB2 636C FCB3 249DF FCB4 3A17 FCB5 6438 FCB6 63F8 FCB7 2138E FCB8 217FC FCBA 6F8A FCBB 22E36 FCBC 9814 FCBD 2408C FCBE 2571D FCBF 64E1 FCC0 64E5 FCC1 947B FCC2 3A66 FCC3 643A FCC4 3A57 FCC5 654D FCC6 6F16 FCC7 24A28 FCC8 24A23 FCC9 6585 FCCA 656D FCCB 655F FCCC 2307E FCCD 65B5 FCCE 24940 FCCF 4B37 FCD0 65D1 FCD1 40D8 FCD2 21829 FCD3 65E0 FCD4 65E3 FCD5 5FDF FCD6 23400 FCD7 6618 FCD8 231F7 FCD9 231F8 FCDA 6644 FCDB 231A4 FCDC 231A5 FCDD 664B FCDE 20E75 FCDF 6667 FCE0 251E6 FCE1 6673 FCE3 21E3D FCE4 23231 FCE5 285F4 FCE6 231C8 FCE7 25313 FCE8 77C5 FCE9 228F7 FCEA 99A4 FCEB 6702 FCEC 2439C FCED 24A21 FCEE 3B2B FCEF 69FA FCF0 237C2 FCF2 6767 FCF3 6762 FCF4 241CD FCF5 290ED FCF6 67D7 FCF7 44E9 FCF8 6822 FCF9 6E50 FCFA 923C FCFB 6801 FCFC 233E6 FCFD 26DA0 FCFE 685D FD40 2346F FD41 69E1 FD42 6A0B FD43 28ADF FD44 6973 FD45 68C3 FD46 235CD FD47 6901 FD48 6900 FD49 3D32 FD4A 3A01 FD4B 2363C FD4C 3B80 FD4D 67AC FD4E 6961 FD4F 28A4A FD50 42FC FD51 6936 FD52 6998 FD53 3BA1 FD54 203C9 FD55 8363 FD56 5090 FD57 69F9 FD58 23659 FD59 2212A FD5A 6A45 FD5B 23703 FD5C 6A9D FD5D 3BF3 FD5E 67B1 FD5F 6AC8 FD60 2919C FD61 3C0D FD62 6B1D FD63 20923 FD64 60DE FD65 6B35 FD66 6B74 FD67 227CD FD68 6EB5 FD69 23ADB FD6A 203B5 FD6B 21958 FD6C 3740 FD6D 5421 FD6E 23B5A FD6F 6BE1 FD70 23EFC FD71 6BDC FD72 6C37 FD73 2248B FD74 248F1 FD75 26B51 FD76 6C5A FD77 8226 FD78 6C79 FD79 23DBC FD7A 44C5 FD7B 23DBD FD7C 241A4 FD7D 2490C FD7E 24900 FDA1 23CC9 FDA2 36E5 FDA3 3CEB FDA4 20D32 FDA5 9B83 FDA6 231F9 FDA7 22491 FDA8 7F8F FDA9 6837 FDAA 26D25 FDAB 26DA1 FDAC 26DEB FDAD 6D96 FDAE 6D5C FDAF 6E7C FDB0 6F04 FDB1 2497F FDB2 24085 FDB3 26E72 FDB4 8533 FDB5 26F74 FDB6 51C7 FDB9 842E FDBA 28B21 FDBC 23E2F FDBD 7453 FDBE 23F82 FDBF 79CC FDC0 6E4F FDC1 5A91 FDC2 2304B FDC3 6FF8 FDC4 370D FDC5 6F9D FDC6 23E30 FDC7 6EFA FDC8 21497 FDC9 2403D FDCA 4555 FDCB 93F0 FDCC 6F44 FDCD 6F5C FDCE 3D4E FDCF 6F74 FDD0 29170 FDD1 3D3B FDD2 6F9F FDD3 24144 FDD4 6FD3 FDD5 24091 FDD6 24155 FDD7 24039 FDD8 23FF0 FDD9 23FB4 FDDA 2413F FDDB 51DF FDDC 24156 FDDD 24157 FDDE 24140 FDDF 261DD FDE0 704B FDE1 707E FDE2 70A7 FDE3 7081 FDE4 70CC FDE5 70D5 FDE6 70D6 FDE7 70DF FDE8 4104 FDE9 3DE8 FDEA 71B4 FDEB 7196 FDEC 24277 FDED 712B FDEE 7145 FDEF 5A88 FDF0 714A FDF2 5C9C FDF3 24365 FDF4 714F FDF5 9362 FDF6 242C1 FDF7 712C FDF8 2445A FDF9 24A27 FDFA 24A22 FDFB 71BA FDFC 28BE8 FDFD 70BD FDFE 720E FE40 9442 FE41 7215 FE42 5911 FE43 9443 FE44 7224 FE45 9341 FE46 25605 FE47 722E FE48 7240 FE49 24974 FE4A 68BD FE4B 7255 FE4C 7257 FE4D 3E55 FE4E 23044 FE4F 680D FE50 6F3D FE51 7282 FE53 732B FE54 24823 FE55 2882B FE56 48ED FE57 28804 FE58 7328 FE59 732E FE5A 73CF FE5B 73AA FE5C 20C3A FE5D 26A2E FE5E 73C9 FE5F 7449 FE60 241E2 FE61 216E7 FE62 24A24 FE63 6623 FE64 36C5 FE65 249B7 FE66 2498D FE67 249FB FE68 73F7 FE69 7415 FE6A 6903 FE6B 24A26 FE6C 7439 FE6D 205C3 FE6E 3ED7 FE70 228AD FE71 7460 FE72 28EB2 FE73 7447 FE74 73E4 FE75 7476 FE76 83B9 FE77 746C FE78 3730 FE79 7474 FE7A 93F1 FE7B 6A2C FE7C 7482 FE7D 4953 FE7E 24A8C FEA1 2415F FEA2 24A79 FEA3 28B8F FEA4 5B46 FEA5 28C03 FEA6 2189E FEA7 74C8 FEA8 21988 FEA9 750E FEAB 751E FEAC 28ED9 FEAD 21A4B FEAE 5BD7 FEAF 28EAC FEB0 9385 FEB1 754D FEB2 754A FEB3 7567 FEB4 756E FEB5 24F82 FEB6 3F04 FEB7 24D13 FEB8 758E FEB9 745D FEBA 759E FEBB 75B4 FEBC 7602 FEBD 762C FEBE 7651 FEBF 764F FEC0 766F FEC1 7676 FEC2 263F5 FEC3 7690 FEC4 81EF FEC5 37F8 FEC6 26911 FEC7 2690E FEC8 76A1 FEC9 76A5 FECA 76B7 FECB 76CC FECC 26F9F FECD 8462 FECE 2509D FECF 2517D FED0 21E1C FED1 771E FED2 7726 FED3 7740 FED4 64AF FED5 25220 FED6 7758 FED7 232AC FED8 77AF FED9 28964 FEDA 28968 FEDB 216C1 FEDC 77F4 FEDE 21376 FEDF 24A12 FEE0 68CA FEE1 78AF FEE2 78C7 FEE3 78D3 FEE4 96A5 FEE5 792E FEE6 255E0 FEE7 78D7 FEE8 7934 FEE9 78B1 FEEA 2760C FEEB 8FB8 FEEC 8884 FEED 28B2B FEEE 26083 FEEF 2261C FEF0 7986 FEF1 8900 FEF2 6902 FEF3 7980 FEF4 25857 FEF5 799D FEF6 27B39 FEF7 793C FEF8 79A9 FEF9 6E2A FEFA 27126 FEFB 3EA8 FEFC 79C6 FEFD 2910D FEFE 79D4
51,063
4,938
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_profile.py
"""Test suite for the profile module.""" import sys import pstats import unittest import os from difflib import unified_diff from io import StringIO from test.support import TESTFN, run_unittest, unlink from contextlib import contextmanager import profile from test.profilee import testfunc, timer class ProfileTest(unittest.TestCase): profilerclass = profile.Profile profilermodule = profile methodnames = ['print_stats', 'print_callers', 'print_callees'] expected_max_output = ':0(max)' def tearDown(self): unlink(TESTFN) def get_expected_output(self): return _ProfileOutput @classmethod def do_profiling(cls): results = [] prof = cls.profilerclass(timer, 0.001) start_timer = timer() prof.runctx("testfunc()", globals(), locals()) results.append(timer() - start_timer) for methodname in cls.methodnames: s = StringIO() stats = pstats.Stats(prof, stream=s) stats.strip_dirs().sort_stats("stdname") getattr(stats, methodname)() output = s.getvalue().splitlines() mod_name = testfunc.__module__.rsplit('.', 1)[1] # Only compare against stats originating from the test file. # Prevents outside code (e.g., the io module) from causing # unexpected output. output = [line.rstrip() for line in output if mod_name in line] results.append('\n'.join(output)) return results def test_cprofile(self): results = self.do_profiling() expected = self.get_expected_output() self.assertEqual(results[0], 1000) fail = [] for i, method in enumerate(self.methodnames): a = expected[method] b = results[i+1] if a != b: fail.append(f"\nStats.{method} output for " f"{self.profilerclass.__name__} " "does not fit expectation:") fail.extend(unified_diff(a.split('\n'), b.split('\n'), lineterm="")) if fail: self.fail("\n".join(fail)) def test_calling_conventions(self): # Issue #5330: profile and cProfile wouldn't report C functions called # with keyword arguments. We test all calling conventions. stmts = [ "max([0])", "max([0], key=int)", "max([0], **dict(key=int))", "max(*([0],))", "max(*([0],), key=int)", "max(*([0],), **dict(key=int))", ] for stmt in stmts: s = StringIO() prof = self.profilerclass(timer, 0.001) prof.runctx(stmt, globals(), locals()) stats = pstats.Stats(prof, stream=s) stats.print_stats() res = s.getvalue() self.assertIn(self.expected_max_output, res, "Profiling {0!r} didn't report max:\n{1}".format(stmt, res)) def test_run(self): with silent(): self.profilermodule.run("int('1')") self.profilermodule.run("int('1')", filename=TESTFN) self.assertTrue(os.path.exists(TESTFN)) def test_runctx(self): with silent(): self.profilermodule.runctx("testfunc()", globals(), locals()) self.profilermodule.runctx("testfunc()", globals(), locals(), filename=TESTFN) self.assertTrue(os.path.exists(TESTFN)) def regenerate_expected_output(filename, cls): filename = filename.rstrip('co') print('Regenerating %s...' % filename) results = cls.do_profiling() newfile = [] with open(filename, 'r') as f: for line in f: newfile.append(line) if line.startswith('#--cut'): break with open(filename, 'w') as f: f.writelines(newfile) f.write("_ProfileOutput = {}\n") for i, method in enumerate(cls.methodnames): f.write('_ProfileOutput[%r] = """\\\n%s"""\n' % ( method, results[i+1])) f.write('\nif __name__ == "__main__":\n main()\n') @contextmanager def silent(): stdout = sys.stdout try: sys.stdout = StringIO() yield finally: sys.stdout = stdout def test_main(): run_unittest(ProfileTest) def main(): if '-r' not in sys.argv: test_main() else: regenerate_expected_output(__file__, ProfileTest) # Don't remove this comment. Everything below it is auto-generated. #--cut-------------------------------------------------------------------------- _ProfileOutput = {} _ProfileOutput['print_stats'] = """\ 28 27.972 0.999 27.972 0.999 profilee.py:110(__getattr__) 1 269.996 269.996 999.769 999.769 profilee.py:25(testfunc) 23/3 149.937 6.519 169.917 56.639 profilee.py:35(factorial) 20 19.980 0.999 19.980 0.999 profilee.py:48(mul) 2 39.986 19.993 599.830 299.915 profilee.py:55(helper) 4 115.984 28.996 119.964 29.991 profilee.py:73(helper1) 2 -0.006 -0.003 139.946 69.973 profilee.py:84(helper2_indirect) 8 311.976 38.997 399.912 49.989 profilee.py:88(helper2) 8 63.976 7.997 79.960 9.995 profilee.py:98(subhelper)""" _ProfileOutput['print_callers'] = """\ :0(append) <- profilee.py:73(helper1)(4) 119.964 :0(exc_info) <- profilee.py:73(helper1)(4) 119.964 :0(hasattr) <- profilee.py:73(helper1)(4) 119.964 profilee.py:88(helper2)(8) 399.912 profilee.py:110(__getattr__) <- :0(hasattr)(12) 11.964 profilee.py:98(subhelper)(16) 79.960 profilee.py:25(testfunc) <- <string>:1(<module>)(1) 999.767 profilee.py:35(factorial) <- profilee.py:25(testfunc)(1) 999.769 profilee.py:35(factorial)(20) 169.917 profilee.py:84(helper2_indirect)(2) 139.946 profilee.py:48(mul) <- profilee.py:35(factorial)(20) 169.917 profilee.py:55(helper) <- profilee.py:25(testfunc)(2) 999.769 profilee.py:73(helper1) <- profilee.py:55(helper)(4) 599.830 profilee.py:84(helper2_indirect) <- profilee.py:55(helper)(2) 599.830 profilee.py:88(helper2) <- profilee.py:55(helper)(6) 599.830 profilee.py:84(helper2_indirect)(2) 139.946 profilee.py:98(subhelper) <- profilee.py:88(helper2)(8) 399.912""" _ProfileOutput['print_callees'] = """\ :0(hasattr) -> profilee.py:110(__getattr__)(12) 27.972 <string>:1(<module>) -> profilee.py:25(testfunc)(1) 999.769 profilee.py:110(__getattr__) -> profilee.py:25(testfunc) -> profilee.py:35(factorial)(1) 169.917 profilee.py:55(helper)(2) 599.830 profilee.py:35(factorial) -> profilee.py:35(factorial)(20) 169.917 profilee.py:48(mul)(20) 19.980 profilee.py:48(mul) -> profilee.py:55(helper) -> profilee.py:73(helper1)(4) 119.964 profilee.py:84(helper2_indirect)(2) 139.946 profilee.py:88(helper2)(6) 399.912 profilee.py:73(helper1) -> :0(append)(4) -0.004 profilee.py:84(helper2_indirect) -> profilee.py:35(factorial)(2) 169.917 profilee.py:88(helper2)(2) 399.912 profilee.py:88(helper2) -> :0(hasattr)(8) 11.964 profilee.py:98(subhelper)(8) 79.960 profilee.py:98(subhelper) -> profilee.py:110(__getattr__)(16) 27.972""" if __name__ == "__main__": main()
7,892
193
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_super.py
"""Unit tests for zero-argument super() & related machinery.""" import sys import unittest import warnings from test.support import check_warnings class A: def f(self): return 'A' @classmethod def cm(cls): return (cls, 'A') class B(A): def f(self): return super().f() + 'B' @classmethod def cm(cls): return (cls, super().cm(), 'B') class C(A): def f(self): return super().f() + 'C' @classmethod def cm(cls): return (cls, super().cm(), 'C') class D(C, B): def f(self): return super().f() + 'D' def cm(cls): return (cls, super().cm(), 'D') class E(D): pass class F(E): f = E.f class G(A): pass class TestSuper(unittest.TestCase): def tearDown(self): # This fixes the damage that test_various___class___pathologies does. nonlocal __class__ __class__ = TestSuper def test_basics_working(self): self.assertEqual(D().f(), 'ABCD') def test_class_getattr_working(self): self.assertEqual(D.f(D()), 'ABCD') def test_subclass_no_override_working(self): self.assertEqual(E().f(), 'ABCD') self.assertEqual(E.f(E()), 'ABCD') def test_unbound_method_transfer_working(self): self.assertEqual(F().f(), 'ABCD') self.assertEqual(F.f(F()), 'ABCD') def test_class_methods_still_working(self): self.assertEqual(A.cm(), (A, 'A')) self.assertEqual(A().cm(), (A, 'A')) self.assertEqual(G.cm(), (G, 'A')) self.assertEqual(G().cm(), (G, 'A')) def test_super_in_class_methods_working(self): d = D() self.assertEqual(d.cm(), (d, (D, (D, (D, 'A'), 'B'), 'C'), 'D')) e = E() self.assertEqual(e.cm(), (e, (E, (E, (E, 'A'), 'B'), 'C'), 'D')) def test_super_with_closure(self): # Issue4360: super() did not work in a function that # contains a closure class E(A): def f(self): def nested(): self return super().f() + 'E' self.assertEqual(E().f(), 'AE') def test_various___class___pathologies(self): # See issue #12370 class X(A): def f(self): return super().f() __class__ = 413 x = X() self.assertEqual(x.f(), 'A') self.assertEqual(x.__class__, 413) class X: x = __class__ def f(): __class__ self.assertIs(X.x, type(self)) with self.assertRaises(NameError) as e: exec("""class X: __class__ def f(): __class__""", globals(), {}) self.assertIs(type(e.exception), NameError) # Not UnboundLocalError class X: global __class__ __class__ = 42 def f(): __class__ self.assertEqual(globals()["__class__"], 42) del globals()["__class__"] self.assertNotIn("__class__", X.__dict__) class X: nonlocal __class__ __class__ = 42 def f(): __class__ self.assertEqual(__class__, 42) def test___class___instancemethod(self): # See issue #14857 class X: def f(self): return __class__ self.assertIs(X().f(), X) def test___class___classmethod(self): # See issue #14857 class X: @classmethod def f(cls): return __class__ self.assertIs(X.f(), X) def test___class___staticmethod(self): # See issue #14857 class X: @staticmethod def f(): return __class__ self.assertIs(X.f(), X) def test___class___new(self): # See issue #23722 # Ensure zero-arg super() works as soon as type.__new__() is completed test_class = None class Meta(type): def __new__(cls, name, bases, namespace): nonlocal test_class self = super().__new__(cls, name, bases, namespace) test_class = self.f() return self class A(metaclass=Meta): @staticmethod def f(): return __class__ self.assertIs(test_class, A) def test___class___delayed(self): # See issue #23722 test_namespace = None class Meta(type): def __new__(cls, name, bases, namespace): nonlocal test_namespace test_namespace = namespace return None # This case shouldn't trigger the __classcell__ deprecation warning with check_warnings() as w: warnings.simplefilter("always", DeprecationWarning) class A(metaclass=Meta): @staticmethod def f(): return __class__ self.assertEqual(w.warnings, []) self.assertIs(A, None) B = type("B", (), test_namespace) self.assertIs(B.f(), B) def test___class___mro(self): # See issue #23722 test_class = None class Meta(type): def mro(self): # self.f() doesn't work yet... self.__dict__["f"]() return super().mro() class A(metaclass=Meta): def f(): nonlocal test_class test_class = __class__ self.assertIs(test_class, A) def test___classcell___expected_behaviour(self): # See issue #23722 class Meta(type): def __new__(cls, name, bases, namespace): nonlocal namespace_snapshot namespace_snapshot = namespace.copy() return super().__new__(cls, name, bases, namespace) # __classcell__ is injected into the class namespace by the compiler # when at least one method needs it, and should be omitted otherwise namespace_snapshot = None class WithoutClassRef(metaclass=Meta): pass self.assertNotIn("__classcell__", namespace_snapshot) # With zero-arg super() or an explicit __class__ reference, # __classcell__ is the exact cell reference to be populated by # type.__new__ namespace_snapshot = None class WithClassRef(metaclass=Meta): def f(self): return __class__ class_cell = namespace_snapshot["__classcell__"] method_closure = WithClassRef.f.__closure__ self.assertEqual(len(method_closure), 1) self.assertIs(class_cell, method_closure[0]) # Ensure the cell reference *doesn't* get turned into an attribute with self.assertRaises(AttributeError): WithClassRef.__classcell__ def test___classcell___missing(self): # See issue #23722 # Some metaclasses may not pass the original namespace to type.__new__ # We test that case here by forcibly deleting __classcell__ class Meta(type): def __new__(cls, name, bases, namespace): namespace.pop('__classcell__', None) return super().__new__(cls, name, bases, namespace) # The default case should continue to work without any warnings with check_warnings() as w: warnings.simplefilter("always", DeprecationWarning) class WithoutClassRef(metaclass=Meta): pass self.assertEqual(w.warnings, []) # With zero-arg super() or an explicit __class__ reference, we expect # __build_class__ to emit a DeprecationWarning complaining that # __class__ was not set, and asking if __classcell__ was propagated # to type.__new__. # In Python 3.7, that warning will become a RuntimeError. expected_warning = ( '__class__ not set.*__classcell__ propagated', DeprecationWarning ) with check_warnings(expected_warning): warnings.simplefilter("always", DeprecationWarning) class WithClassRef(metaclass=Meta): def f(self): return __class__ # Check __class__ still gets set despite the warning self.assertIs(WithClassRef().f(), WithClassRef) # Check the warning is turned into an error as expected with warnings.catch_warnings(): warnings.simplefilter("error", DeprecationWarning) with self.assertRaises(DeprecationWarning): class WithClassRef(metaclass=Meta): def f(self): return __class__ def test___classcell___overwrite(self): # See issue #23722 # Overwriting __classcell__ with nonsense is explicitly prohibited class Meta(type): def __new__(cls, name, bases, namespace, cell): namespace['__classcell__'] = cell return super().__new__(cls, name, bases, namespace) for bad_cell in (None, 0, "", object()): with self.subTest(bad_cell=bad_cell): with self.assertRaises(TypeError): class A(metaclass=Meta, cell=bad_cell): pass def test___classcell___wrong_cell(self): # See issue #23722 # Pointing the cell reference at the wrong class is also prohibited class Meta(type): def __new__(cls, name, bases, namespace): cls = super().__new__(cls, name, bases, namespace) B = type("B", (), namespace) return cls with self.assertRaises(TypeError): class A(metaclass=Meta): def f(self): return __class__ def test_obscure_super_errors(self): def f(): super() self.assertRaises(RuntimeError, f) def f(x): del x super() self.assertRaises(RuntimeError, f, None) class X: def f(x): nonlocal __class__ del __class__ super() self.assertRaises(RuntimeError, X().f) def test_cell_as_self(self): class X: def meth(self): super() def f(): k = X() def g(): return k return g c = f().__closure__[0] self.assertRaises(TypeError, X.meth, c) def test_super_init_leaks(self): # Issue #26718: super.__init__ leaked memory if called multiple times. # This will be caught by regrtest.py -R if this leak. # NOTE: Despite the use in the test a direct call of super.__init__ # is not endorsed. sp = super(float, 1.0) for i in range(1000): super.__init__(sp, int, i) if __name__ == "__main__": unittest.main()
10,919
348
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_support.py
import errno import importlib import os import shutil import socket import stat import subprocess import sys import tempfile import textwrap import unittest from test import support from test.support import script_helper TESTFN = support.TESTFN class TestSupport(unittest.TestCase): def test_import_module(self): support.import_module("ftplib") self.assertRaises(unittest.SkipTest, support.import_module, "foo") def test_import_fresh_module(self): support.import_fresh_module("ftplib") def test_get_attribute(self): self.assertEqual(support.get_attribute(self, "test_get_attribute"), self.test_get_attribute) self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo") @unittest.skip("failing buildbots") def test_get_original_stdout(self): self.assertEqual(support.get_original_stdout(), sys.stdout) def test_unload(self): import sched self.assertIn("sched", sys.modules) support.unload("sched") self.assertNotIn("sched", sys.modules) def test_unlink(self): with open(TESTFN, "w") as f: pass support.unlink(TESTFN) self.assertFalse(os.path.exists(TESTFN)) support.unlink(TESTFN) def test_rmtree(self): dirpath = support.TESTFN + 'd' subdirpath = os.path.join(dirpath, 'subdir') os.mkdir(dirpath) os.mkdir(subdirpath) support.rmtree(dirpath) self.assertFalse(os.path.exists(dirpath)) with support.swap_attr(support, 'verbose', 0): support.rmtree(dirpath) os.mkdir(dirpath) os.mkdir(subdirpath) os.chmod(dirpath, stat.S_IRUSR|stat.S_IXUSR) with support.swap_attr(support, 'verbose', 0): support.rmtree(dirpath) self.assertFalse(os.path.exists(dirpath)) os.mkdir(dirpath) os.mkdir(subdirpath) os.chmod(dirpath, 0) with support.swap_attr(support, 'verbose', 0): support.rmtree(dirpath) self.assertFalse(os.path.exists(dirpath)) def test_forget(self): mod_filename = TESTFN + '.py' with open(mod_filename, 'w') as f: print('foo = 1', file=f) sys.path.insert(0, os.curdir) importlib.invalidate_caches() try: mod = __import__(TESTFN) self.assertIn(TESTFN, sys.modules) support.forget(TESTFN) self.assertNotIn(TESTFN, sys.modules) finally: del sys.path[0] support.unlink(mod_filename) support.rmtree('__pycache__') def test_HOST(self): s = socket.socket() s.bind((support.HOST, 0)) s.close() def test_find_unused_port(self): port = support.find_unused_port() s = socket.socket() s.bind((support.HOST, port)) s.close() def test_bind_port(self): s = socket.socket() support.bind_port(s) s.listen() s.close() # Tests for temp_dir() def test_temp_dir(self): """Test that temp_dir() creates and destroys its directory.""" parent_dir = tempfile.mkdtemp() parent_dir = os.path.realpath(parent_dir) try: path = os.path.join(parent_dir, 'temp') self.assertFalse(os.path.isdir(path)) with support.temp_dir(path) as temp_path: self.assertEqual(temp_path, path) self.assertTrue(os.path.isdir(path)) self.assertFalse(os.path.isdir(path)) finally: support.rmtree(parent_dir) def test_temp_dir__path_none(self): """Test passing no path.""" with support.temp_dir() as temp_path: self.assertTrue(os.path.isdir(temp_path)) self.assertFalse(os.path.isdir(temp_path)) def test_temp_dir__existing_dir__quiet_default(self): """Test passing a directory that already exists.""" def call_temp_dir(path): with support.temp_dir(path) as temp_path: raise Exception("should not get here") path = tempfile.mkdtemp() path = os.path.realpath(path) try: self.assertTrue(os.path.isdir(path)) self.assertRaises(FileExistsError, call_temp_dir, path) # Make sure temp_dir did not delete the original directory. self.assertTrue(os.path.isdir(path)) finally: shutil.rmtree(path) def test_temp_dir__existing_dir__quiet_true(self): """Test passing a directory that already exists with quiet=True.""" path = tempfile.mkdtemp() path = os.path.realpath(path) try: with support.check_warnings() as recorder: with support.temp_dir(path, quiet=True) as temp_path: self.assertEqual(path, temp_path) warnings = [str(w.message) for w in recorder.warnings] # Make sure temp_dir did not delete the original directory. self.assertTrue(os.path.isdir(path)) finally: shutil.rmtree(path) expected = ['tests may fail, unable to create temp dir: ' + path] self.assertEqual(warnings, expected) @unittest.skipUnless(hasattr(os, "fork"), "test requires os.fork") def test_temp_dir__forked_child(self): """Test that a forked child process does not remove the directory.""" # See bpo-30028 for details. # Run the test as an external script, because it uses fork. script_helper.assert_python_ok("-c", textwrap.dedent(""" import os from test import support with support.temp_cwd() as temp_path: pid = os.fork() if pid != 0: # parent process (child has pid == 0) # wait for the child to terminate (pid, status) = os.waitpid(pid, 0) if status != 0: raise AssertionError(f"Child process failed with exit " f"status indication 0x{status:x}.") # Make sure that temp_path is still present. When the child # process leaves the 'temp_cwd'-context, the __exit__()- # method of the context must not remove the temporary # directory. if not os.path.isdir(temp_path): raise AssertionError("Child removed temp_path.") """)) # Tests for change_cwd() def test_change_cwd(self): original_cwd = os.getcwd() with support.temp_dir() as temp_path: with support.change_cwd(temp_path) as new_cwd: self.assertEqual(new_cwd, temp_path) self.assertEqual(os.getcwd(), new_cwd) self.assertEqual(os.getcwd(), original_cwd) def test_change_cwd__non_existent_dir(self): """Test passing a non-existent directory.""" original_cwd = os.getcwd() def call_change_cwd(path): with support.change_cwd(path) as new_cwd: raise Exception("should not get here") with support.temp_dir() as parent_dir: non_existent_dir = os.path.join(parent_dir, 'does_not_exist') self.assertRaises(FileNotFoundError, call_change_cwd, non_existent_dir) self.assertEqual(os.getcwd(), original_cwd) def test_change_cwd__non_existent_dir__quiet_true(self): """Test passing a non-existent directory with quiet=True.""" original_cwd = os.getcwd() with support.temp_dir() as parent_dir: bad_dir = os.path.join(parent_dir, 'does_not_exist') with support.check_warnings() as recorder: with support.change_cwd(bad_dir, quiet=True) as new_cwd: self.assertEqual(new_cwd, original_cwd) self.assertEqual(os.getcwd(), new_cwd) warnings = [str(w.message) for w in recorder.warnings] expected = ['tests may fail, unable to change CWD to: ' + bad_dir] self.assertEqual(warnings, expected) # Tests for change_cwd() def test_change_cwd__chdir_warning(self): """Check the warning message when os.chdir() fails.""" path = TESTFN + '_does_not_exist' with support.check_warnings() as recorder: with support.change_cwd(path=path, quiet=True): pass messages = [str(w.message) for w in recorder.warnings] self.assertEqual(messages, ['tests may fail, unable to change CWD to: ' + path]) # Tests for temp_cwd() def test_temp_cwd(self): here = os.getcwd() with support.temp_cwd(name=TESTFN): self.assertEqual(os.path.basename(os.getcwd()), TESTFN) self.assertFalse(os.path.exists(TESTFN)) self.assertEqual(os.getcwd(), here) def test_temp_cwd__name_none(self): """Test passing None to temp_cwd().""" original_cwd = os.getcwd() with support.temp_cwd(name=None) as new_cwd: self.assertNotEqual(new_cwd, original_cwd) self.assertTrue(os.path.isdir(new_cwd)) self.assertEqual(os.getcwd(), new_cwd) self.assertEqual(os.getcwd(), original_cwd) def test_sortdict(self): self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}") def test_make_bad_fd(self): fd = support.make_bad_fd() with self.assertRaises(OSError) as cm: os.write(fd, b"foo") self.assertEqual(cm.exception.errno, errno.EBADF) def test_check_syntax_error(self): support.check_syntax_error(self, "def class", lineno=1, offset=9) with self.assertRaises(AssertionError): support.check_syntax_error(self, "x=1") def test_CleanImport(self): import importlib with support.CleanImport("asyncore"): importlib.import_module("asyncore") def test_DirsOnSysPath(self): with support.DirsOnSysPath('foo', 'bar'): self.assertIn("foo", sys.path) self.assertIn("bar", sys.path) self.assertNotIn("foo", sys.path) self.assertNotIn("bar", sys.path) def test_captured_stdout(self): with support.captured_stdout() as stdout: print("hello") self.assertEqual(stdout.getvalue(), "hello\n") def test_captured_stderr(self): with support.captured_stderr() as stderr: print("hello", file=sys.stderr) self.assertEqual(stderr.getvalue(), "hello\n") def test_captured_stdin(self): with support.captured_stdin() as stdin: stdin.write('hello\n') stdin.seek(0) # call test code that consumes from sys.stdin captured = input() self.assertEqual(captured, "hello") def test_gc_collect(self): support.gc_collect() def test_python_is_optimized(self): self.assertIsInstance(support.python_is_optimized(), bool) def test_swap_attr(self): class Obj: pass obj = Obj() obj.x = 1 with support.swap_attr(obj, "x", 5) as x: self.assertEqual(obj.x, 5) self.assertEqual(x, 1) self.assertEqual(obj.x, 1) with support.swap_attr(obj, "y", 5) as y: self.assertEqual(obj.y, 5) self.assertIsNone(y) self.assertFalse(hasattr(obj, 'y')) with support.swap_attr(obj, "y", 5): del obj.y self.assertFalse(hasattr(obj, 'y')) def test_swap_item(self): D = {"x":1} with support.swap_item(D, "x", 5) as x: self.assertEqual(D["x"], 5) self.assertEqual(x, 1) self.assertEqual(D["x"], 1) with support.swap_item(D, "y", 5) as y: self.assertEqual(D["y"], 5) self.assertIsNone(y) self.assertNotIn("y", D) with support.swap_item(D, "y", 5): del D["y"] self.assertNotIn("y", D) class RefClass: attribute1 = None attribute2 = None _hidden_attribute1 = None __magic_1__ = None class OtherClass: attribute2 = None attribute3 = None __magic_1__ = None __magic_2__ = None def test_detect_api_mismatch(self): missing_items = support.detect_api_mismatch(self.RefClass, self.OtherClass) self.assertEqual({'attribute1'}, missing_items) missing_items = support.detect_api_mismatch(self.OtherClass, self.RefClass) self.assertEqual({'attribute3', '__magic_2__'}, missing_items) def test_detect_api_mismatch__ignore(self): ignore = ['attribute1', 'attribute3', '__magic_2__', 'not_in_either'] missing_items = support.detect_api_mismatch( self.RefClass, self.OtherClass, ignore=ignore) self.assertEqual(set(), missing_items) missing_items = support.detect_api_mismatch( self.OtherClass, self.RefClass, ignore=ignore) self.assertEqual(set(), missing_items) def test_check__all__(self): extra = {'tempdir'} blacklist = {'template'} support.check__all__(self, tempfile, extra=extra, blacklist=blacklist) extra = {'TextTestResult', 'installHandler'} blacklist = {'load_tests', "TestProgram", "BaseTestSuite"} support.check__all__(self, unittest, ("unittest.result", "unittest.case", "unittest.suite", "unittest.loader", "unittest.main", "unittest.runner", "unittest.signals"), extra=extra, blacklist=blacklist) self.assertRaises(AssertionError, support.check__all__, self, unittest) def check_options(self, args, func, expected=None): code = f'from test.support import {func}; print(repr({func}()))' cmd = [sys.executable, *args, '-c', code] env = {key: value for key, value in os.environ.items() if not key.startswith('PYTHON')} proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, universal_newlines=True, env=env) if expected is None: expected = args self.assertEqual(proc.stdout.rstrip(), repr(expected)) self.assertEqual(proc.returncode, 0) def test_args_from_interpreter_flags(self): # Test test.support.args_from_interpreter_flags() for opts in ( # no option [], # single option ['-B'], ['-s'], ['-S'], ['-E'], ['-v'], ['-b'], ['-q'], ['-I'], # same option multiple times ['-bb'], ['-vvv'], # -W options ['-Wignore'], # -X options ['-X', 'faulthandler'], ['-X', 'showalloccount'], ['-X', 'showrefcount'], ['-X', 'tracemalloc'], ['-X', 'tracemalloc=3'], ): with self.subTest(opts=opts): self.check_options(opts, 'args_from_interpreter_flags') self.check_options(['-I', '-E', '-s'], 'args_from_interpreter_flags', ['-I']) def test_optim_args_from_interpreter_flags(self): # Test test.support.optim_args_from_interpreter_flags() for opts in ( # no option [], ['-O'], ['-OO'], ['-OOOO'], ): with self.subTest(opts=opts): self.check_options(opts, 'optim_args_from_interpreter_flags') def test_match_test(self): class Test: def __init__(self, test_id): self.test_id = test_id def id(self): return self.test_id test_access = Test('test.test_os.FileTests.test_access') test_chdir = Test('test.test_os.Win32ErrorTests.test_chdir') with support.swap_attr(support, '_match_test_func', None): # match all support.set_match_tests([]) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) # match all using None support.set_match_tests(None) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) # match the full test identifier support.set_match_tests([test_access.id()]) self.assertTrue(support.match_test(test_access)) self.assertFalse(support.match_test(test_chdir)) # match the module name support.set_match_tests(['test_os']) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) # Test '*' pattern support.set_match_tests(['test_*']) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) # Test case sensitivity support.set_match_tests(['filetests']) self.assertFalse(support.match_test(test_access)) support.set_match_tests(['FileTests']) self.assertTrue(support.match_test(test_access)) # Test pattern containing '.' and a '*' metacharacter support.set_match_tests(['*test_os.*.test_*']) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) # Multiple patterns support.set_match_tests([test_access.id(), test_chdir.id()]) self.assertTrue(support.match_test(test_access)) self.assertTrue(support.match_test(test_chdir)) support.set_match_tests(['test_access', 'DONTMATCH']) self.assertTrue(support.match_test(test_access)) self.assertFalse(support.match_test(test_chdir)) def test_fd_count(self): # We cannot test the absolute value of fd_count(): on old Linux # kernel or glibc versions, os.urandom() keeps a FD open on # /dev/urandom device and Python has 4 FD opens instead of 3. start = support.fd_count() fd = os.open(__file__, os.O_RDONLY) try: more = support.fd_count() finally: os.close(fd) self.assertEqual(more - start, 1) # XXX -follows a list of untested API # make_legacy_pyc # is_resource_enabled # requires # fcmp # umaks # findfile # check_warnings # EnvironmentVarGuard # TransientResource # transient_internet # run_with_locale # set_memlimit # bigmemtest # precisionbigmemtest # bigaddrspacetest # requires_resource # run_doctest # threading_cleanup # reap_threads # reap_children # strip_python_stderr # can_symlink # skip_unless_symlink # SuppressCrashReport def test_main(): tests = [TestSupport] support.run_unittest(*tests) if __name__ == '__main__': test_main()
19,608
559
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_winreg.py
# Test the windows specific win32reg module. # Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey import os, sys, errno import unittest from test import support threading = support.import_module("threading") from platform import machine # Do this first so test will be skipped if module doesn't exist support.import_module('winreg', required_on=['win']) # Now import everything from winreg import * try: REMOTE_NAME = sys.argv[sys.argv.index("--remote")+1] except (IndexError, ValueError): REMOTE_NAME = None # tuple of (major, minor) WIN_VER = sys.getwindowsversion()[:2] # Some tests should only run on 64-bit architectures where WOW64 will be. WIN64_MACHINE = True if machine() == "AMD64" else False # Starting with Windows 7 and Windows Server 2008 R2, WOW64 no longer uses # registry reflection and formerly reflected keys are shared instead. # Windows 7 and Windows Server 2008 R2 are version 6.1. Due to this, some # tests are only valid up until 6.1 HAS_REFLECTION = True if WIN_VER < (6, 1) else False # Use a per-process key to prevent concurrent test runs (buildbot!) from # stomping on each other. test_key_base = "Python Test Key [%d] - Delete Me" % (os.getpid(),) test_key_name = "SOFTWARE\\" + test_key_base # On OS'es that support reflection we should test with a reflected key test_reflect_key_name = "SOFTWARE\\Classes\\" + test_key_base test_data = [ ("Int Value", 45, REG_DWORD), ("Qword Value", 0x1122334455667788, REG_QWORD), ("String Val", "A string value", REG_SZ), ("StringExpand", "The path is %path%", REG_EXPAND_SZ), ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), ("Raw Data", b"binary\x00data", REG_BINARY), ("Big String", "x"*(2**14-1), REG_SZ), ("Big Binary", b"x"*(2**14), REG_BINARY), # Two and three kanjis, meaning: "Japan" and "Japanese") ("Japanese 日本", "日本語", REG_SZ), ] class BaseWinregTests(unittest.TestCase): def setUp(self): # Make sure that the test key is absent when the test # starts. self.delete_tree(HKEY_CURRENT_USER, test_key_name) def delete_tree(self, root, subkey): try: hkey = OpenKey(root, subkey, 0, KEY_ALL_ACCESS) except OSError: # subkey does not exist return while True: try: subsubkey = EnumKey(hkey, 0) except OSError: # no more subkeys break self.delete_tree(hkey, subsubkey) CloseKey(hkey) DeleteKey(root, subkey) def _write_test_data(self, root_key, subkeystr="sub_key", CreateKey=CreateKey): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") key = CreateKey(root_key, test_key_name) self.assertTrue(key.handle != 0) # Create a sub-key sub_key = CreateKey(key, subkeystr) # Give the sub-key some named values for value_name, value_data, value_type in test_data: SetValueEx(sub_key, value_name, 0, value_type, value_data) # Check we wrote as many items as we thought. nkeys, nvalues, since_mod = QueryInfoKey(key) self.assertEqual(nkeys, 1, "Not the correct number of sub keys") self.assertEqual(nvalues, 1, "Not the correct number of values") nkeys, nvalues, since_mod = QueryInfoKey(sub_key) self.assertEqual(nkeys, 0, "Not the correct number of sub keys") self.assertEqual(nvalues, len(test_data), "Not the correct number of values") # Close this key this way... # (but before we do, copy the key as an integer - this allows # us to test that the key really gets closed). int_sub_key = int(sub_key) CloseKey(sub_key) try: QueryInfoKey(int_sub_key) self.fail("It appears the CloseKey() function does " "not close the actual key!") except OSError: pass # ... and close that key that way :-) int_key = int(key) key.Close() try: QueryInfoKey(int_key) self.fail("It appears the key.Close() function " "does not close the actual key!") except OSError: pass def _read_test_data(self, root_key, subkeystr="sub_key", OpenKey=OpenKey): # Check we can get default value for this key. val = QueryValue(root_key, test_key_name) self.assertEqual(val, "Default value", "Registry didn't give back the correct value") key = OpenKey(root_key, test_key_name) # Read the sub-keys with OpenKey(key, subkeystr) as sub_key: # Check I can enumerate over the values. index = 0 while 1: try: data = EnumValue(sub_key, index) except OSError: break self.assertEqual(data in test_data, True, "Didn't read back the correct test data") index = index + 1 self.assertEqual(index, len(test_data), "Didn't read the correct number of items") # Check I can directly access each item for value_name, value_data, value_type in test_data: read_val, read_typ = QueryValueEx(sub_key, value_name) self.assertEqual(read_val, value_data, "Could not directly read the value") self.assertEqual(read_typ, value_type, "Could not directly read the value") sub_key.Close() # Enumerate our main key. read_val = EnumKey(key, 0) self.assertEqual(read_val, subkeystr, "Read subkey value wrong") try: EnumKey(key, 1) self.fail("Was able to get a second key when I only have one!") except OSError: pass key.Close() def _delete_test_data(self, root_key, subkeystr="sub_key"): key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS) sub_key = OpenKey(key, subkeystr, 0, KEY_ALL_ACCESS) # It is not necessary to delete the values before deleting # the key (although subkeys must not exist). We delete them # manually just to prove we can :-) for value_name, value_data, value_type in test_data: DeleteValue(sub_key, value_name) nkeys, nvalues, since_mod = QueryInfoKey(sub_key) self.assertEqual(nkeys, 0, "subkey not empty before delete") self.assertEqual(nvalues, 0, "subkey not empty before delete") sub_key.Close() DeleteKey(key, subkeystr) try: # Shouldn't be able to delete it twice! DeleteKey(key, subkeystr) self.fail("Deleting the key twice succeeded") except OSError: pass key.Close() DeleteKey(root_key, test_key_name) # Opening should now fail! try: key = OpenKey(root_key, test_key_name) self.fail("Could open the non-existent key") except OSError: # Use this error name this time pass def _test_all(self, root_key, subkeystr="sub_key"): self._write_test_data(root_key, subkeystr) self._read_test_data(root_key, subkeystr) self._delete_test_data(root_key, subkeystr) def _test_named_args(self, key, sub_key): with CreateKeyEx(key=key, sub_key=sub_key, reserved=0, access=KEY_ALL_ACCESS) as ckey: self.assertTrue(ckey.handle != 0) with OpenKeyEx(key=key, sub_key=sub_key, reserved=0, access=KEY_ALL_ACCESS) as okey: self.assertTrue(okey.handle != 0) class LocalWinregTests(BaseWinregTests): def test_registry_works(self): self._test_all(HKEY_CURRENT_USER) self._test_all(HKEY_CURRENT_USER, "日本-subkey") def test_registry_works_extended_functions(self): # Substitute the regular CreateKey and OpenKey calls with their # extended counterparts. # Note: DeleteKeyEx is not used here because it is platform dependent cke = lambda key, sub_key: CreateKeyEx(key, sub_key, 0, KEY_ALL_ACCESS) self._write_test_data(HKEY_CURRENT_USER, CreateKey=cke) oke = lambda key, sub_key: OpenKeyEx(key, sub_key, 0, KEY_READ) self._read_test_data(HKEY_CURRENT_USER, OpenKey=oke) self._delete_test_data(HKEY_CURRENT_USER) def test_named_arguments(self): self._test_named_args(HKEY_CURRENT_USER, test_key_name) # Use the regular DeleteKey to clean up # DeleteKeyEx takes named args and is tested separately DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_connect_registry_to_local_machine_works(self): # perform minimal ConnectRegistry test which just invokes it h = ConnectRegistry(None, HKEY_LOCAL_MACHINE) self.assertNotEqual(h.handle, 0) h.Close() self.assertEqual(h.handle, 0) def test_inexistant_remote_registry(self): connect = lambda: ConnectRegistry("abcdefghijkl", HKEY_CURRENT_USER) self.assertRaises(OSError, connect) def testExpandEnvironmentStrings(self): r = ExpandEnvironmentStrings("%windir%\\test") self.assertEqual(type(r), str) self.assertEqual(r, os.environ["windir"] + "\\test") def test_context_manager(self): # ensure that the handle is closed if an exception occurs try: with ConnectRegistry(None, HKEY_LOCAL_MACHINE) as h: self.assertNotEqual(h.handle, 0) raise OSError except OSError: self.assertEqual(h.handle, 0) def test_changing_value(self): # Issue2810: A race condition in 2.6 and 3.1 may cause # EnumValue or QueryValue to raise "WindowsError: More data is # available" done = False class VeryActiveThread(threading.Thread): def run(self): with CreateKey(HKEY_CURRENT_USER, test_key_name) as key: use_short = True long_string = 'x'*2000 while not done: s = 'x' if use_short else long_string use_short = not use_short SetValue(key, 'changing_value', REG_SZ, s) thread = VeryActiveThread() thread.start() try: with CreateKey(HKEY_CURRENT_USER, test_key_name+'\\changing_value') as key: for _ in range(1000): num_subkeys, num_values, t = QueryInfoKey(key) for i in range(num_values): name = EnumValue(key, i) QueryValue(key, name[0]) finally: done = True thread.join() DeleteKey(HKEY_CURRENT_USER, test_key_name+'\\changing_value') DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_long_key(self): # Issue2810, in 2.6 and 3.1 when the key name was exactly 256 # characters, EnumKey raised "WindowsError: More data is # available" name = 'x'*256 try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as key: SetValue(key, name, REG_SZ, 'x') num_subkeys, num_values, t = QueryInfoKey(key) EnumKey(key, 0) finally: DeleteKey(HKEY_CURRENT_USER, '\\'.join((test_key_name, name))) DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_dynamic_key(self): # Issue2810, when the value is dynamically generated, these # raise "WindowsError: More data is available" in 2.6 and 3.1 try: EnumValue(HKEY_PERFORMANCE_DATA, 0) except OSError as e: if e.errno in (errno.EPERM, errno.EACCES): self.skipTest("access denied to registry key " "(are you running in a non-interactive session?)") raise QueryValueEx(HKEY_PERFORMANCE_DATA, "") # Reflection requires XP x64/Vista at a minimum. XP doesn't have this stuff # or DeleteKeyEx so make sure their use raises NotImplementedError @unittest.skipUnless(WIN_VER < (5, 2), "Requires Windows XP") def test_reflection_unsupported(self): try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: self.assertNotEqual(ck.handle, 0) key = OpenKey(HKEY_CURRENT_USER, test_key_name) self.assertNotEqual(key.handle, 0) with self.assertRaises(NotImplementedError): DisableReflectionKey(key) with self.assertRaises(NotImplementedError): EnableReflectionKey(key) with self.assertRaises(NotImplementedError): QueryReflectionKey(key) with self.assertRaises(NotImplementedError): DeleteKeyEx(HKEY_CURRENT_USER, test_key_name) finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_setvalueex_value_range(self): # Test for Issue #14420, accept proper ranges for SetValueEx. # Py2Reg, which gets called by SetValueEx, was using PyLong_AsLong, # thus raising OverflowError. The implementation now uses # PyLong_AsUnsignedLong to match DWORD's size. try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: self.assertNotEqual(ck.handle, 0) SetValueEx(ck, "test_name", None, REG_DWORD, 0x80000000) finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_queryvalueex_return_value(self): # Test for Issue #16759, return unsigned int from QueryValueEx. # Reg2Py, which gets called by QueryValueEx, was returning a value # generated by PyLong_FromLong. The implementation now uses # PyLong_FromUnsignedLong to match DWORD's size. try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: self.assertNotEqual(ck.handle, 0) test_val = 0x80000000 SetValueEx(ck, "test_name", None, REG_DWORD, test_val) ret_val, ret_type = QueryValueEx(ck, "test_name") self.assertEqual(ret_type, REG_DWORD) self.assertEqual(ret_val, test_val) finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_setvalueex_crash_with_none_arg(self): # Test for Issue #21151, segfault when None is passed to SetValueEx try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: self.assertNotEqual(ck.handle, 0) test_val = None SetValueEx(ck, "test_name", 0, REG_BINARY, test_val) ret_val, ret_type = QueryValueEx(ck, "test_name") self.assertEqual(ret_type, REG_BINARY) self.assertEqual(ret_val, test_val) finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) def test_read_string_containing_null(self): # Test for issue 25778: REG_SZ should not contain null characters try: with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: self.assertNotEqual(ck.handle, 0) test_val = "A string\x00 with a null" SetValueEx(ck, "test_name", 0, REG_SZ, test_val) ret_val, ret_type = QueryValueEx(ck, "test_name") self.assertEqual(ret_type, REG_SZ) self.assertEqual(ret_val, "A string") finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) @unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests") class RemoteWinregTests(BaseWinregTests): def test_remote_registry_works(self): remote_key = ConnectRegistry(REMOTE_NAME, HKEY_CURRENT_USER) self._test_all(remote_key) @unittest.skipUnless(WIN64_MACHINE, "x64 specific registry tests") class Win64WinregTests(BaseWinregTests): def test_named_arguments(self): self._test_named_args(HKEY_CURRENT_USER, test_key_name) # Clean up and also exercise the named arguments DeleteKeyEx(key=HKEY_CURRENT_USER, sub_key=test_key_name, access=KEY_ALL_ACCESS, reserved=0) def test_reflection_functions(self): # Test that we can call the query, enable, and disable functions # on a key which isn't on the reflection list with no consequences. with OpenKey(HKEY_LOCAL_MACHINE, "Software") as key: # HKLM\Software is redirected but not reflected in all OSes self.assertTrue(QueryReflectionKey(key)) self.assertIsNone(EnableReflectionKey(key)) self.assertIsNone(DisableReflectionKey(key)) self.assertTrue(QueryReflectionKey(key)) @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection") def test_reflection(self): # Test that we can create, open, and delete keys in the 32-bit # area. Because we are doing this in a key which gets reflected, # test the differences of 32 and 64-bit keys before and after the # reflection occurs (ie. when the created key is closed). try: with CreateKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_ALL_ACCESS | KEY_WOW64_32KEY) as created_key: self.assertNotEqual(created_key.handle, 0) # The key should now be available in the 32-bit area with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_ALL_ACCESS | KEY_WOW64_32KEY) as key: self.assertNotEqual(key.handle, 0) # Write a value to what currently is only in the 32-bit area SetValueEx(created_key, "", 0, REG_SZ, "32KEY") # The key is not reflected until created_key is closed. # The 64-bit version of the key should not be available yet. open_fail = lambda: OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_READ | KEY_WOW64_64KEY) self.assertRaises(OSError, open_fail) # Now explicitly open the 64-bit version of the key with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY) as key: self.assertNotEqual(key.handle, 0) # Make sure the original value we set is there self.assertEqual("32KEY", QueryValue(key, "")) # Set a new value, which will get reflected to 32-bit SetValueEx(key, "", 0, REG_SZ, "64KEY") # Reflection uses a "last-writer wins policy, so the value we set # on the 64-bit key should be the same on 32-bit with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_READ | KEY_WOW64_32KEY) as key: self.assertEqual("64KEY", QueryValue(key, "")) finally: DeleteKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, KEY_WOW64_32KEY, 0) @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection") def test_disable_reflection(self): # Make use of a key which gets redirected and reflected try: with CreateKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_ALL_ACCESS | KEY_WOW64_32KEY) as created_key: # QueryReflectionKey returns whether or not the key is disabled disabled = QueryReflectionKey(created_key) self.assertEqual(type(disabled), bool) # HKCU\Software\Classes is reflected by default self.assertFalse(disabled) DisableReflectionKey(created_key) self.assertTrue(QueryReflectionKey(created_key)) # The key is now closed and would normally be reflected to the # 64-bit area, but let's make sure that didn't happen. open_fail = lambda: OpenKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_READ | KEY_WOW64_64KEY) self.assertRaises(OSError, open_fail) # Make sure the 32-bit key is actually there with OpenKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0, KEY_READ | KEY_WOW64_32KEY) as key: self.assertNotEqual(key.handle, 0) finally: DeleteKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, KEY_WOW64_32KEY, 0) def test_exception_numbers(self): with self.assertRaises(FileNotFoundError) as ctx: QueryValue(HKEY_CLASSES_ROOT, 'some_value_that_does_not_exist') def test_main(): support.run_unittest(LocalWinregTests, RemoteWinregTests, Win64WinregTests) if __name__ == "__main__": if not REMOTE_NAME: print("Remote registry calls can be tested using", "'test_winreg.py --remote \\\\machine_name'") test_main()
21,708
499
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_compile.py
import os import dis import math import cosmo import unittest import sys import _ast import tempfile import types from test import support from test.support import script_helper, FakePath class TestSpecifics(unittest.TestCase): def compile_single(self, source): compile(source, "<single>", "single") def assertInvalidSingle(self, source): self.assertRaises(SyntaxError, self.compile_single, source) def test_no_ending_newline(self): compile("hi", "<test>", "exec") compile("hi\r", "<test>", "exec") def test_empty(self): compile("", "<test>", "exec") def test_other_newlines(self): compile("\r\n", "<test>", "exec") compile("\r", "<test>", "exec") compile("hi\r\nstuff\r\ndef f():\n pass\r", "<test>", "exec") compile("this_is\rreally_old_mac\rdef f():\n pass", "<test>", "exec") @unittest.skipIf(cosmo.MODE in ('tiny', 'rel'), "No whatever in MODE=tiny/rel") def test_debug_assignment(self): # catch assignments to __debug__ self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single') import builtins prev = builtins.__debug__ setattr(builtins, '__debug__', 'sure') self.assertEqual(__debug__, prev) setattr(builtins, '__debug__', prev) def test_argument_handling(self): # detect duplicate positional and keyword arguments self.assertRaises(SyntaxError, eval, 'lambda a,a:0') self.assertRaises(SyntaxError, eval, 'lambda a,a=1:0') self.assertRaises(SyntaxError, eval, 'lambda a=1,a=1:0') self.assertRaises(SyntaxError, exec, 'def f(a, a): pass') self.assertRaises(SyntaxError, exec, 'def f(a = 0, a = 1): pass') self.assertRaises(SyntaxError, exec, 'def f(a): global a; a = 1') def test_syntax_error(self): self.assertRaises(SyntaxError, compile, "1+*3", "filename", "exec") def test_none_keyword_arg(self): self.assertRaises(SyntaxError, compile, "f(None=1)", "<string>", "exec") def test_duplicate_global_local(self): self.assertRaises(SyntaxError, exec, 'def f(a): global a; a = 1') def test_exec_with_general_mapping_for_locals(self): class M: "Test mapping interface versus possible calls from eval()." def __getitem__(self, key): if key == 'a': return 12 raise KeyError def __setitem__(self, key, value): self.results = (key, value) def keys(self): return list('xyz') m = M() g = globals() exec('z = a', g, m) self.assertEqual(m.results, ('z', 12)) try: exec('z = b', g, m) except NameError: pass else: self.fail('Did not detect a KeyError') exec('z = dir()', g, m) self.assertEqual(m.results, ('z', list('xyz'))) exec('z = globals()', g, m) self.assertEqual(m.results, ('z', g)) exec('z = locals()', g, m) self.assertEqual(m.results, ('z', m)) self.assertRaises(TypeError, exec, 'z = b', m) class A: "Non-mapping" pass m = A() self.assertRaises(TypeError, exec, 'z = a', g, m) # Verify that dict subclasses work as well class D(dict): def __getitem__(self, key): if key == 'a': return 12 return dict.__getitem__(self, key) d = D() exec('z = a', g, d) self.assertEqual(d['z'], 12) def test_extended_arg(self): longexpr = 'x = x or ' + '-x' * 2500 g = {} code = ''' def f(x): %s %s %s %s %s %s %s %s %s %s # the expressions above have no effect, x == argument while x: x -= 1 # EXTENDED_ARG/JUMP_ABSOLUTE here return x ''' % ((longexpr,)*10) exec(code, g) self.assertEqual(g['f'](5), 0) def test_argument_order(self): self.assertRaises(SyntaxError, exec, 'def f(a=1, b): pass') def test_float_literals(self): # testing bad float literals self.assertRaises(SyntaxError, eval, "2e") self.assertRaises(SyntaxError, eval, "2.0e+") self.assertRaises(SyntaxError, eval, "1e-") self.assertRaises(SyntaxError, eval, "3-4e/21") def test_indentation(self): # testing compile() of indented block w/o trailing newline" s = """ if 1: if 2: pass""" compile(s, "<string>", "exec") # This test is probably specific to CPython and may not generalize # to other implementations. We are trying to ensure that when # the first line of code starts after 256, correct line numbers # in tracebacks are still produced. def test_leading_newlines(self): s256 = "".join(["\n"] * 256 + ["spam"]) co = compile(s256, 'fn', 'exec') self.assertEqual(co.co_firstlineno, 257) self.assertEqual(co.co_lnotab, bytes()) def test_literals_with_leading_zeroes(self): for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", "080000000000000", "000000000000009", "000000000000008", "0b42", "0BADCAFE", "0o123456789", "0b1.1", "0o4.2", "0b101j2", "0o153j2", "0b100e1", "0o777e1", # [jart] restore octal # "0777", # "000777", # "000000000000007", ]: self.assertRaises(SyntaxError, eval, arg) self.assertEqual(eval("0xff"), 255) self.assertEqual(eval("0777."), 777) self.assertEqual(eval("0777.0"), 777) self.assertEqual(eval("000000000000000000000000000000000000000000000000000777e0"), 777) self.assertEqual(eval("0777e1"), 7770) self.assertEqual(eval("0e0"), 0) self.assertEqual(eval("0000e-012"), 0) self.assertEqual(eval("09.5"), 9.5) self.assertEqual(eval("0777j"), 777j) self.assertEqual(eval("000"), 0) self.assertEqual(eval("00j"), 0j) self.assertEqual(eval("00.0"), 0) self.assertEqual(eval("0e3"), 0) self.assertEqual(eval("090000000000000."), 90000000000000.) self.assertEqual(eval("090000000000000.0000000000000000000000"), 90000000000000.) self.assertEqual(eval("090000000000000e0"), 90000000000000.) self.assertEqual(eval("090000000000000e-0"), 90000000000000.) self.assertEqual(eval("090000000000000j"), 90000000000000j) self.assertEqual(eval("000000000000008."), 8.) self.assertEqual(eval("000000000000009."), 9.) self.assertEqual(eval("0b101010"), 42) self.assertEqual(eval("-0b000000000010"), -2) self.assertEqual(eval("0o777"), 511) self.assertEqual(eval("-0o0000010"), -8) def test_unary_minus(self): # Verify treatment of unary minus on negative numbers SF bug #660455 if sys.maxsize == 2147483647: # 32-bit machine all_one_bits = '0xffffffff' self.assertEqual(eval(all_one_bits), 4294967295) self.assertEqual(eval("-" + all_one_bits), -4294967295) elif sys.maxsize == 9223372036854775807: # 64-bit machine all_one_bits = '0xffffffffffffffff' self.assertEqual(eval(all_one_bits), 18446744073709551615) self.assertEqual(eval("-" + all_one_bits), -18446744073709551615) else: self.fail("How many bits *does* this machine have???") # Verify treatment of constant folding on -(sys.maxsize+1) # i.e. -2147483648 on 32 bit platforms. Should return int. self.assertIsInstance(eval("%s" % (-sys.maxsize - 1)), int) self.assertIsInstance(eval("%s" % (-sys.maxsize - 2)), int) if sys.maxsize == 9223372036854775807: def test_32_63_bit_values(self): a = +4294967296 # 1 << 32 b = -4294967296 # 1 << 32 c = +281474976710656 # 1 << 48 d = -281474976710656 # 1 << 48 e = +4611686018427387904 # 1 << 62 f = -4611686018427387904 # 1 << 62 g = +9223372036854775807 # 1 << 63 - 1 h = -9223372036854775807 # 1 << 63 - 1 for variable in self.test_32_63_bit_values.__code__.co_consts: if variable is not None: self.assertIsInstance(variable, int) def test_sequence_unpacking_error(self): # Verify sequence packing/unpacking with "or". SF bug #757818 i,j = (1, -1) or (-1, 1) self.assertEqual(i, 1) self.assertEqual(j, -1) def test_none_assignment(self): stmts = [ 'None = 0', 'None += 0', '__builtins__.None = 0', 'def None(): pass', 'class None: pass', '(a, None) = 0, 0', 'for None in range(10): pass', 'def f(None): pass', 'import None', 'import x as None', 'from x import None', 'from x import y as None' ] for stmt in stmts: stmt += "\n" self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single') self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') def test_import(self): succeed = [ 'import sys', 'import os, sys', 'import os as bar', 'import os.path as bar', 'from __future__ import nested_scopes, generators', 'from __future__ import (nested_scopes,\ngenerators)', 'from __future__ import (nested_scopes,\ngenerators,)', 'from sys import stdin, stderr, stdout', 'from sys import (stdin, stderr,\nstdout)', 'from sys import (stdin, stderr,\nstdout,)', 'from sys import (stdin\n, stderr, stdout)', 'from sys import (stdin\n, stderr, stdout,)', 'from sys import stdin as si, stdout as so, stderr as se', 'from sys import (stdin as si, stdout as so, stderr as se)', 'from sys import (stdin as si, stdout as so, stderr as se,)', ] fail = [ 'import (os, sys)', 'import (os), (sys)', 'import ((os), (sys))', 'import (sys', 'import sys)', 'import (os,)', 'import os As bar', 'import os.path a bar', 'from sys import stdin As stdout', 'from sys import stdin a stdout', 'from (sys) import stdin', 'from __future__ import (nested_scopes', 'from __future__ import nested_scopes)', 'from __future__ import nested_scopes,\ngenerators', 'from sys import (stdin', 'from sys import stdin)', 'from sys import stdin, stdout,\nstderr', 'from sys import stdin si', 'from sys import stdin,', 'from sys import (*)', 'from sys import (stdin,, stdout, stderr)', 'from sys import (stdin, stdout),', ] for stmt in succeed: compile(stmt, 'tmp', 'exec') for stmt in fail: self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') def test_for_distinct_code_objects(self): # SF bug 1048870 def f(): f1 = lambda x=1: x f2 = lambda x=2: x return f1, f2 f1, f2 = f() self.assertNotEqual(id(f1.__code__), id(f2.__code__)) @unittest.skipIf(cosmo.MODE in ('tiny', 'rel'), "No docstrings in MODE=tiny/rel") def test_lambda_doc(self): l = lambda: "foo" self.assertIsNone(l.__doc__) def test_encoding(self): code = b'# -*- coding: badencoding -*-\npass\n' self.assertRaises(SyntaxError, compile, code, 'tmp', 'exec') code = '# -*- coding: badencoding -*-\n"\xc2\xa4"\n' compile(code, 'tmp', 'exec') self.assertEqual(eval(code), '\xc2\xa4') code = '"\xc2\xa4"\n' self.assertEqual(eval(code), '\xc2\xa4') code = b'"\xc2\xa4"\n' self.assertEqual(eval(code), '\xa4') code = b'# -*- coding: latin1 -*-\n"\xc2\xa4"\n' self.assertEqual(eval(code), '\xc2\xa4') code = b'# -*- coding: utf-8 -*-\n"\xc2\xa4"\n' self.assertEqual(eval(code), '\xa4') # code = b'# -*- coding: iso8859-15 -*-\n"\xc2\xa4"\n' # self.assertEqual(eval(code), '\xc2\u20ac') # code = '"""\\\n# -*- coding: iso8859-15 -*-\n\xc2\xa4"""\n' # self.assertEqual(eval(code), '# -*- coding: iso8859-15 -*-\n\xc2\xa4') # code = b'"""\\\n# -*- coding: iso8859-15 -*-\n\xc2\xa4"""\n' # self.assertEqual(eval(code), '# -*- coding: iso8859-15 -*-\n\xa4') def test_subscripts(self): # SF bug 1448804 # Class to make testing subscript results easy class str_map(object): def __init__(self): self.data = {} def __getitem__(self, key): return self.data[str(key)] def __setitem__(self, key, value): self.data[str(key)] = value def __delitem__(self, key): del self.data[str(key)] def __contains__(self, key): return str(key) in self.data d = str_map() # Index d[1] = 1 self.assertEqual(d[1], 1) d[1] += 1 self.assertEqual(d[1], 2) del d[1] self.assertNotIn(1, d) # Tuple of indices d[1, 1] = 1 self.assertEqual(d[1, 1], 1) d[1, 1] += 1 self.assertEqual(d[1, 1], 2) del d[1, 1] self.assertNotIn((1, 1), d) # Simple slice d[1:2] = 1 self.assertEqual(d[1:2], 1) d[1:2] += 1 self.assertEqual(d[1:2], 2) del d[1:2] self.assertNotIn(slice(1, 2), d) # Tuple of simple slices d[1:2, 1:2] = 1 self.assertEqual(d[1:2, 1:2], 1) d[1:2, 1:2] += 1 self.assertEqual(d[1:2, 1:2], 2) del d[1:2, 1:2] self.assertNotIn((slice(1, 2), slice(1, 2)), d) # Extended slice d[1:2:3] = 1 self.assertEqual(d[1:2:3], 1) d[1:2:3] += 1 self.assertEqual(d[1:2:3], 2) del d[1:2:3] self.assertNotIn(slice(1, 2, 3), d) # Tuple of extended slices d[1:2:3, 1:2:3] = 1 self.assertEqual(d[1:2:3, 1:2:3], 1) d[1:2:3, 1:2:3] += 1 self.assertEqual(d[1:2:3, 1:2:3], 2) del d[1:2:3, 1:2:3] self.assertNotIn((slice(1, 2, 3), slice(1, 2, 3)), d) # Ellipsis d[...] = 1 self.assertEqual(d[...], 1) d[...] += 1 self.assertEqual(d[...], 2) del d[...] self.assertNotIn(Ellipsis, d) # Tuple of Ellipses d[..., ...] = 1 self.assertEqual(d[..., ...], 1) d[..., ...] += 1 self.assertEqual(d[..., ...], 2) del d[..., ...] self.assertNotIn((Ellipsis, Ellipsis), d) def test_annotation_limit(self): # 16 bits are available for # of annotations, but only 8 bits are # available for the parameter count, hence 255 # is the max. Ensure the result of too many annotations is a # SyntaxError. s = "def f(%s): pass" s %= ', '.join('a%d:%d' % (i,i) for i in range(256)) self.assertRaises(SyntaxError, compile, s, '?', 'exec') # Test that the max # of annotations compiles. s = "def f(%s): pass" s %= ', '.join('a%d:%d' % (i,i) for i in range(255)) compile(s, '?', 'exec') # def test_mangling(self): # class A: # def f(): # __mangled = 1 # __not_mangled__ = 2 # import __mangled_mod # import __package__.module # self.assertIn("_A__mangled", A.f.__code__.co_varnames) # self.assertIn("__not_mangled__", A.f.__code__.co_varnames) # self.assertIn("_A__mangled_mod", A.f.__code__.co_varnames) # self.assertIn("__package__", A.f.__code__.co_varnames) @unittest.skipIf(cosmo.MODE in ('tiny', 'rel'), "No sauce in MODE=tiny/rel") def test_compile_ast(self): fname = __file__ if fname.lower().endswith('pyc'): fname = fname[:-1] with open(fname, 'r') as f: fcontents = f.read() sample_code = [ ['<assign>', 'x = 5'], ['<ifblock>', """if True:\n pass\n"""], ['<forblock>', """for n in [1, 2, 3]:\n print(n)\n"""], ['<deffunc>', """def foo():\n pass\nfoo()\n"""], [fname, fcontents], ] for fname, code in sample_code: co1 = compile(code, '%s1' % fname, 'exec') ast = compile(code, '%s2' % fname, 'exec', _ast.PyCF_ONLY_AST) self.assertTrue(type(ast) == _ast.Module) co2 = compile(ast, '%s3' % fname, 'exec') self.assertEqual(co1, co2) # the code object's filename comes from the second compilation step self.assertEqual(co2.co_filename, '%s3' % fname) # raise exception when node type doesn't match with compile mode co1 = compile('print(1)', '<string>', 'exec', _ast.PyCF_ONLY_AST) self.assertRaises(TypeError, compile, co1, '<ast>', 'eval') # raise exception when node type is no start node self.assertRaises(TypeError, compile, _ast.If(), '<ast>', 'exec') # raise exception when node has invalid children ast = _ast.Module() ast.body = [_ast.BoolOp()] self.assertRaises(TypeError, compile, ast, '<ast>', 'exec') def test_dict_evaluation_order(self): i = 0 def f(): nonlocal i i += 1 return i d = {f(): f(), f(): f()} self.assertEqual(d, {1: 2, 3: 4}) def test_compile_filename(self): for filename in 'file.py', b'file.py': code = compile('pass', filename, 'exec') self.assertEqual(code.co_filename, 'file.py') for filename in bytearray(b'file.py'), memoryview(b'file.py'): with self.assertWarns(DeprecationWarning): code = compile('pass', filename, 'exec') self.assertEqual(code.co_filename, 'file.py') self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec') @support.cpython_only def test_same_filename_used(self): s = """def f(): pass\ndef g(): pass""" c = compile(s, "myfile", "exec") for obj in c.co_consts: if isinstance(obj, types.CodeType): self.assertIs(obj.co_filename, c.co_filename) def test_single_statement(self): self.compile_single("1 + 2") self.compile_single("\n1 + 2") self.compile_single("1 + 2\n") self.compile_single("1 + 2\n\n") self.compile_single("1 + 2\t\t\n") self.compile_single("1 + 2\t\t\n ") self.compile_single("1 + 2 # one plus two") self.compile_single("1; 2") self.compile_single("import sys; sys") self.compile_single("def f():\n pass") self.compile_single("while False:\n pass") self.compile_single("if x:\n f(x)") self.compile_single("if x:\n f(x)\nelse:\n g(x)") self.compile_single("class T:\n pass") def test_bad_single_statement(self): self.assertInvalidSingle('1\n2') self.assertInvalidSingle('def f(): pass') self.assertInvalidSingle('a = 13\nb = 187') self.assertInvalidSingle('del x\ndel y') self.assertInvalidSingle('f()\ng()') self.assertInvalidSingle('f()\n# blah\nblah()') self.assertInvalidSingle('f()\nxy # blah\nblah()') self.assertInvalidSingle('x = 5 # comment\nx = 6\n') def test_particularly_evil_undecodable(self): # Issue 24022 src = b'0000\x00\n00000000000\n\x00\n\x9e\n' with tempfile.TemporaryDirectory() as tmpd: fn = os.path.join(tmpd, "bad.py") with open(fn, "wb") as fp: fp.write(src) res = script_helper.run_python_until_end(fn)[0] self.assertIn(b"Non-UTF-8", res.err) def test_yet_more_evil_still_undecodable(self): # Issue #25388 src = b"#\x00\n#\xfd\n" with tempfile.TemporaryDirectory() as tmpd: fn = os.path.join(tmpd, "bad.py") with open(fn, "wb") as fp: fp.write(src) res = script_helper.run_python_until_end(fn)[0] self.assertIn(b"Non-UTF-8", res.err) @support.cpython_only @unittest.skipUnless(cosmo.MODE == "dbg", "disabled recursion checking") def test_compiler_recursion_limit(self): # Expected limit is sys.getrecursionlimit() * the scaling factor # in symtable.c (currently 3) # We expect to fail *at* that limit, because we use up some of # the stack depth limit in the test suite code # So we check the expected limit and 75% of that # XXX (ncoghlan): duplicating the scaling factor here is a little # ugly. Perhaps it should be exposed somewhere... fail_depth = sys.getrecursionlimit() * 3 success_depth = int(fail_depth * 0.75) def check_limit(prefix, repeated): expect_ok = prefix + repeated * success_depth self.compile_single(expect_ok) broken = prefix + repeated * fail_depth details = "Compiling ({!r} + {!r} * {})".format( prefix, repeated, fail_depth) with self.assertRaises(RecursionError, msg=details): self.compile_single(broken) check_limit("a", "()") check_limit("a", ".b") check_limit("a", "[0]") check_limit("a", "*a") def test_null_terminated(self): # The source code is null-terminated internally, but bytes-like # objects are accepted, which could be not terminated. with self.assertRaisesRegex(ValueError, "cannot contain null"): compile("123\x00", "<dummy>", "eval") with self.assertRaisesRegex(ValueError, "cannot contain null"): compile(memoryview(b"123\x00"), "<dummy>", "eval") code = compile(memoryview(b"123\x00")[1:-1], "<dummy>", "eval") self.assertEqual(eval(code), 23) code = compile(memoryview(b"1234")[1:-1], "<dummy>", "eval") self.assertEqual(eval(code), 23) code = compile(memoryview(b"$23$")[1:-1], "<dummy>", "eval") self.assertEqual(eval(code), 23) # Also test when eval() and exec() do the compilation step self.assertEqual(eval(memoryview(b"1234")[1:-1]), 23) namespace = dict() exec(memoryview(b"ax = 123")[1:-1], namespace) self.assertEqual(namespace['x'], 12) def check_constant(self, func, expected): for const in func.__code__.co_consts: if repr(const) == repr(expected): break else: self.fail("unable to find constant %r in %r" % (expected, func.__code__.co_consts)) # Merging equal constants is not a strict requirement for the Python # semantics, it's a more an implementation detail. @support.cpython_only def test_merge_constants(self): # Issue #25843: compile() must merge constants which are equal # and have the same type. def check_same_constant(const): ns = {} code = "f1, f2 = lambda: %r, lambda: %r" % (const, const) exec(code, ns) f1 = ns['f1'] f2 = ns['f2'] self.assertIs(f1.__code__, f2.__code__) self.check_constant(f1, const) self.assertEqual(repr(f1()), repr(const)) check_same_constant(None) check_same_constant(0) check_same_constant(0.0) check_same_constant(b'abc') check_same_constant('abc') # Note: "lambda: ..." emits "LOAD_CONST Ellipsis", # whereas "lambda: Ellipsis" emits "LOAD_GLOBAL Ellipsis" f1, f2 = lambda: ..., lambda: ... self.assertIs(f1.__code__, f2.__code__) self.check_constant(f1, Ellipsis) self.assertEqual(repr(f1()), repr(Ellipsis)) # {0} is converted to a constant frozenset({0}) by the peephole # optimizer f1, f2 = lambda x: x in {0}, lambda x: x in {0} self.assertIs(f1.__code__, f2.__code__) self.check_constant(f1, frozenset({0})) self.assertTrue(f1(0)) # This is a regression test for a CPython specific peephole optimizer # implementation bug present in a few releases. It's assertion verifies # that peephole optimization was actually done though that isn't an # indication of the bugs presence or not (crashing is). @support.cpython_only def test_peephole_opt_unreachable_code_array_access_in_bounds(self): """Regression test for issue35193 when run under clang msan.""" def unused_code_at_end(): return 3 raise RuntimeError("unreachable") # The above function definition will trigger the out of bounds # bug in the peephole optimizer as it scans opcodes past the # RETURN_VALUE opcode. This does not always crash an interpreter. # When you build with the clang memory sanitizer it reliably aborts. self.assertEqual( 'RETURN_VALUE', list(dis.get_instructions(unused_code_at_end))[-1].opname) def test_dont_merge_constants(self): # Issue #25843: compile() must not merge constants which are equal # but have a different type. def check_different_constants(const1, const2): ns = {} exec("f1, f2 = lambda: %r, lambda: %r" % (const1, const2), ns) f1 = ns['f1'] f2 = ns['f2'] self.assertIsNot(f1.__code__, f2.__code__) self.assertNotEqual(f1.__code__, f2.__code__) self.check_constant(f1, const1) self.check_constant(f2, const2) self.assertEqual(repr(f1()), repr(const1)) self.assertEqual(repr(f2()), repr(const2)) check_different_constants(0, 0.0) check_different_constants(+0.0, -0.0) check_different_constants((0,), (0.0,)) check_different_constants('a', b'a') check_different_constants(('a',), (b'a',)) # check_different_constants() cannot be used because repr(-0j) is # '(-0-0j)', but when '(-0-0j)' is evaluated to 0j: we loose the sign. f1, f2 = lambda: +0.0j, lambda: -0.0j self.assertIsNot(f1.__code__, f2.__code__) self.check_constant(f1, +0.0j) self.check_constant(f2, -0.0j) self.assertEqual(repr(f1()), repr(+0.0j)) self.assertEqual(repr(f2()), repr(-0.0j)) # {0} is converted to a constant frozenset({0}) by the peephole # optimizer f1, f2 = lambda x: x in {0}, lambda x: x in {0.0} self.assertIsNot(f1.__code__, f2.__code__) self.check_constant(f1, frozenset({0})) self.check_constant(f2, frozenset({0.0})) self.assertTrue(f1(0)) self.assertTrue(f2(0.0)) def test_path_like_objects(self): # An implicit test for PyUnicode_FSDecoder(). compile("42", FakePath("test_compile_pathlike"), "single") class TestStackSize(unittest.TestCase): # These tests check that the computed stack size for a code object # stays within reasonable bounds (see issue #21523 for an example # dysfunction). N = 100 def check_stack_size(self, code): # To assert that the alleged stack size is not O(N), we # check that it is smaller than log(N). if isinstance(code, str): code = compile(code, "<foo>", "single") max_size = math.ceil(math.log(len(code.co_code))) self.assertLessEqual(code.co_stacksize, max_size) def test_and(self): self.check_stack_size("x and " * self.N + "x") def test_or(self): self.check_stack_size("x or " * self.N + "x") def test_and_or(self): self.check_stack_size("x and x or " * self.N + "x") def test_chained_comparison(self): self.check_stack_size("x < " * self.N + "x") def test_if_else(self): self.check_stack_size("x if x else " * self.N + "x") def test_binop(self): self.check_stack_size("x + " * self.N + "x") def test_func_and(self): code = "def f(x):\n" code += " x and x\n" * self.N self.check_stack_size(code) if __name__ == "__main__": unittest.main()
28,871
747
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_mmap.py
from test.support import (TESTFN, run_unittest, import_module, unlink, requires, _2G, _4G, gc_collect, cpython_only) import unittest import os import re import itertools import socket import sys import weakref # Skip test if we can't import mmap. mmap = import_module('mmap') if __name__ == 'PYOBJ.COM': import mmap PAGESIZE = mmap.PAGESIZE class MmapTests(unittest.TestCase): def setUp(self): if os.path.exists(TESTFN): os.unlink(TESTFN) def tearDown(self): try: os.unlink(TESTFN) except OSError: pass def test_basic(self): # Test mmap module on Unix systems and Windows # Create a file to be mmap'ed. f = open(TESTFN, 'bw+') try: # Write 2 pages worth of data to the file f.write(b'\0'* PAGESIZE) f.write(b'foo') f.write(b'\0'* (PAGESIZE-3) ) f.flush() m = mmap.mmap(f.fileno(), 2 * PAGESIZE) finally: f.close() # Simple sanity checks tp = str(type(m)) # SF bug 128713: segfaulted on Linux self.assertEqual(m.find(b'foo'), PAGESIZE) self.assertEqual(len(m), 2*PAGESIZE) self.assertEqual(m[0], 0) self.assertEqual(m[0:3], b'\0\0\0') # Shouldn't crash on boundary (Issue #5292) self.assertRaises(IndexError, m.__getitem__, len(m)) self.assertRaises(IndexError, m.__setitem__, len(m), b'\0') # Modify the file's content m[0] = b'3'[0] m[PAGESIZE +3: PAGESIZE +3+3] = b'bar' # Check that the modification worked self.assertEqual(m[0], b'3'[0]) self.assertEqual(m[0:3], b'3\0\0') self.assertEqual(m[PAGESIZE-1 : PAGESIZE + 7], b'\0foobar\0') m.flush() # Test doing a regular expression match in an mmap'ed file match = re.search(b'[A-Za-z]+', m) if match is None: self.fail('regex match on mmap failed!') else: start, end = match.span(0) length = end - start self.assertEqual(start, PAGESIZE) self.assertEqual(end, PAGESIZE + 6) # test seeking around (try to overflow the seek implementation) m.seek(0,0) self.assertEqual(m.tell(), 0) m.seek(42,1) self.assertEqual(m.tell(), 42) m.seek(0,2) self.assertEqual(m.tell(), len(m)) # Try to seek to negative position... self.assertRaises(ValueError, m.seek, -1) # Try to seek beyond end of mmap... self.assertRaises(ValueError, m.seek, 1, 2) # Try to seek to negative position... self.assertRaises(ValueError, m.seek, -len(m)-1, 2) # Try resizing map try: m.resize(512) except SystemError: # resize() not supported # No messages are printed, since the output of this test suite # would then be different across platforms. pass else: # resize() is supported self.assertEqual(len(m), 512) # Check that we can no longer seek beyond the new size. self.assertRaises(ValueError, m.seek, 513, 0) # Check that the underlying file is truncated too # (bug #728515) f = open(TESTFN, 'rb') try: f.seek(0, 2) self.assertEqual(f.tell(), 512) finally: f.close() self.assertEqual(m.size(), 512) m.close() def test_access_parameter(self): # Test for "access" keyword parameter mapsize = 10 with open(TESTFN, "wb") as fp: fp.write(b"a"*mapsize) with open(TESTFN, "rb") as f: m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ) self.assertEqual(m[:], b'a'*mapsize, "Readonly memory map data incorrect.") # Ensuring that readonly mmap can't be slice assigned try: m[:] = b'b'*mapsize except TypeError: pass else: self.fail("Able to write to readonly memory map") # Ensuring that readonly mmap can't be item assigned try: m[0] = b'b' except TypeError: pass else: self.fail("Able to write to readonly memory map") # Ensuring that readonly mmap can't be write() to try: m.seek(0,0) m.write(b'abc') except TypeError: pass else: self.fail("Able to write to readonly memory map") # Ensuring that readonly mmap can't be write_byte() to try: m.seek(0,0) m.write_byte(b'd') except TypeError: pass else: self.fail("Able to write to readonly memory map") # Ensuring that readonly mmap can't be resized try: m.resize(2*mapsize) except SystemError: # resize is not universally supported pass except TypeError: pass else: self.fail("Able to resize readonly memory map") with open(TESTFN, "rb") as fp: self.assertEqual(fp.read(), b'a'*mapsize, "Readonly memory map data file was modified") # Opening mmap with size too big with open(TESTFN, "r+b") as f: try: m = mmap.mmap(f.fileno(), mapsize+1) except ValueError: # we do not expect a ValueError on Windows # CAUTION: This also changes the size of the file on disk, and # later tests assume that the length hasn't changed. We need to # repair that. if sys.platform.startswith('win'): self.fail("Opening mmap with size+1 should work on Windows.") else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): self.fail("Opening mmap with size+1 should raise ValueError.") m.close() if sys.platform.startswith('win'): # Repair damage from the resizing test. with open(TESTFN, 'r+b') as f: f.truncate(mapsize) # Opening mmap with access=ACCESS_WRITE with open(TESTFN, "r+b") as f: m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_WRITE) # Modifying write-through memory map m[:] = b'c'*mapsize self.assertEqual(m[:], b'c'*mapsize, "Write-through memory map memory not updated properly.") m.flush() m.close() with open(TESTFN, 'rb') as f: stuff = f.read() self.assertEqual(stuff, b'c'*mapsize, "Write-through memory map data file not updated properly.") # Opening mmap with access=ACCESS_COPY with open(TESTFN, "r+b") as f: m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_COPY) # Modifying copy-on-write memory map m[:] = b'd'*mapsize self.assertEqual(m[:], b'd' * mapsize, "Copy-on-write memory map data not written correctly.") m.flush() with open(TESTFN, "rb") as fp: self.assertEqual(fp.read(), b'c'*mapsize, "Copy-on-write test data file should not be modified.") # Ensuring copy-on-write maps cannot be resized self.assertRaises(TypeError, m.resize, 2*mapsize) m.close() # Ensuring invalid access parameter raises exception with open(TESTFN, "r+b") as f: self.assertRaises(ValueError, mmap.mmap, f.fileno(), mapsize, access=4) if os.name == "posix": # Try incompatible flags, prot and access parameters. with open(TESTFN, "r+b") as f: self.assertRaises(ValueError, mmap.mmap, f.fileno(), mapsize, flags=mmap.MAP_PRIVATE, prot=mmap.PROT_READ, access=mmap.ACCESS_WRITE) # Try writing with PROT_EXEC and without PROT_WRITE prot = mmap.PROT_READ | getattr(mmap, 'PROT_EXEC', 0) with open(TESTFN, "r+b") as f: m = mmap.mmap(f.fileno(), mapsize, prot=prot) self.assertRaises(TypeError, m.write, b"abcdef") self.assertRaises(TypeError, m.write_byte, 0) m.close() def test_bad_file_desc(self): # Try opening a bad file descriptor... self.assertRaises(OSError, mmap.mmap, -2, 4096) def test_tougher_find(self): # Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2, # searching for data with embedded \0 bytes didn't work. with open(TESTFN, 'wb+') as f: data = b'aabaac\x00deef\x00\x00aa\x00' n = len(data) f.write(data) f.flush() m = mmap.mmap(f.fileno(), n) for start in range(n+1): for finish in range(start, n+1): slice = data[start : finish] self.assertEqual(m.find(slice), data.find(slice)) self.assertEqual(m.find(slice + b'x'), -1) m.close() def test_find_end(self): # test the new 'end' parameter works as expected f = open(TESTFN, 'wb+') data = b'one two ones' n = len(data) f.write(data) f.flush() m = mmap.mmap(f.fileno(), n) f.close() self.assertEqual(m.find(b'one'), 0) self.assertEqual(m.find(b'ones'), 8) self.assertEqual(m.find(b'one', 0, -1), 0) self.assertEqual(m.find(b'one', 1), 8) self.assertEqual(m.find(b'one', 1, -1), 8) self.assertEqual(m.find(b'one', 1, -2), -1) self.assertEqual(m.find(bytearray(b'one')), 0) def test_rfind(self): # test the new 'end' parameter works as expected f = open(TESTFN, 'wb+') data = b'one two ones' n = len(data) f.write(data) f.flush() m = mmap.mmap(f.fileno(), n) f.close() self.assertEqual(m.rfind(b'one'), 8) self.assertEqual(m.rfind(b'one '), 0) self.assertEqual(m.rfind(b'one', 0, -1), 8) self.assertEqual(m.rfind(b'one', 0, -2), 0) self.assertEqual(m.rfind(b'one', 1, -1), 8) self.assertEqual(m.rfind(b'one', 1, -2), -1) self.assertEqual(m.rfind(bytearray(b'one')), 8) def test_double_close(self): # make sure a double close doesn't crash on Solaris (Bug# 665913) f = open(TESTFN, 'wb+') f.write(2**16 * b'a') # Arbitrary character f.close() f = open(TESTFN, 'rb') mf = mmap.mmap(f.fileno(), 2**16, access=mmap.ACCESS_READ) mf.close() mf.close() f.close() @unittest.skipUnless(hasattr(os, "stat"), "needs os.stat()") def test_entire_file(self): # test mapping of entire file by passing 0 for map length f = open(TESTFN, "wb+") f.write(2**16 * b'm') # Arbitrary character f.close() f = open(TESTFN, "rb+") mf = mmap.mmap(f.fileno(), 0) self.assertEqual(len(mf), 2**16, "Map size should equal file size.") self.assertEqual(mf.read(2**16), 2**16 * b"m") mf.close() f.close() @unittest.skipUnless(hasattr(os, "stat"), "needs os.stat()") def test_length_0_offset(self): # Issue #10916: test mapping of remainder of file by passing 0 for # map length with an offset doesn't cause a segfault. # NOTE: allocation granularity is currently 65536 under Win64, # and therefore the minimum offset alignment. with open(TESTFN, "wb") as f: f.write((65536 * 2) * b'm') # Arbitrary character with open(TESTFN, "rb") as f: with mmap.mmap(f.fileno(), 0, offset=65536, access=mmap.ACCESS_READ) as mf: self.assertRaises(IndexError, mf.__getitem__, 80000) @unittest.skipUnless(hasattr(os, "stat"), "needs os.stat()") def test_length_0_large_offset(self): # Issue #10959: test mapping of a file by passing 0 for # map length with a large offset doesn't cause a segfault. with open(TESTFN, "wb") as f: f.write(115699 * b'm') # Arbitrary character with open(TESTFN, "w+b") as f: self.assertRaises(ValueError, mmap.mmap, f.fileno(), 0, offset=2147418112) def test_move(self): # make move works everywhere (64-bit format problem earlier) f = open(TESTFN, 'wb+') f.write(b"ABCDEabcde") # Arbitrary character f.flush() mf = mmap.mmap(f.fileno(), 10) mf.move(5, 0, 5) self.assertEqual(mf[:], b"ABCDEABCDE", "Map move should have duplicated front 5") mf.close() f.close() # more excessive test data = b"0123456789" for dest in range(len(data)): for src in range(len(data)): for count in range(len(data) - max(dest, src)): expected = data[:dest] + data[src:src+count] + data[dest+count:] m = mmap.mmap(-1, len(data)) m[:] = data m.move(dest, src, count) self.assertEqual(m[:], expected) m.close() # segfault test (Issue 5387) m = mmap.mmap(-1, 100) offsets = [-100, -1, 0, 1, 100] for source, dest, size in itertools.product(offsets, offsets, offsets): try: m.move(source, dest, size) except ValueError: pass offsets = [(-1, -1, -1), (-1, -1, 0), (-1, 0, -1), (0, -1, -1), (-1, 0, 0), (0, -1, 0), (0, 0, -1)] for source, dest, size in offsets: self.assertRaises(ValueError, m.move, source, dest, size) m.close() m = mmap.mmap(-1, 1) # single byte self.assertRaises(ValueError, m.move, 0, 0, 2) self.assertRaises(ValueError, m.move, 1, 0, 1) self.assertRaises(ValueError, m.move, 0, 1, 1) m.move(0, 0, 1) m.move(0, 0, 0) def test_anonymous(self): # anonymous mmap.mmap(-1, PAGE) m = mmap.mmap(-1, PAGESIZE) for x in range(PAGESIZE): self.assertEqual(m[x], 0, "anonymously mmap'ed contents should be zero") for x in range(PAGESIZE): b = x & 0xff m[x] = b self.assertEqual(m[x], b) def test_read_all(self): m = mmap.mmap(-1, 16) self.addCleanup(m.close) # With no parameters, or None or a negative argument, reads all m.write(bytes(range(16))) m.seek(0) self.assertEqual(m.read(), bytes(range(16))) m.seek(8) self.assertEqual(m.read(), bytes(range(8, 16))) m.seek(16) self.assertEqual(m.read(), b'') m.seek(3) self.assertEqual(m.read(None), bytes(range(3, 16))) m.seek(4) self.assertEqual(m.read(-1), bytes(range(4, 16))) m.seek(5) self.assertEqual(m.read(-2), bytes(range(5, 16))) m.seek(9) self.assertEqual(m.read(-42), bytes(range(9, 16))) def test_read_invalid_arg(self): m = mmap.mmap(-1, 16) self.addCleanup(m.close) self.assertRaises(TypeError, m.read, 'foo') self.assertRaises(TypeError, m.read, 5.5) self.assertRaises(TypeError, m.read, [1, 2, 3]) def test_extended_getslice(self): # Test extended slicing by comparing with list slicing. s = bytes(reversed(range(256))) m = mmap.mmap(-1, len(s)) m[:] = s self.assertEqual(m[:], s) indices = (0, None, 1, 3, 19, 300, -1, -2, -31, -300) for start in indices: for stop in indices: # Skip step 0 (invalid) for step in indices[1:]: self.assertEqual(m[start:stop:step], s[start:stop:step]) def test_extended_set_del_slice(self): # Test extended slicing by comparing with list slicing. s = bytes(reversed(range(256))) m = mmap.mmap(-1, len(s)) indices = (0, None, 1, 3, 19, 300, -1, -2, -31, -300) for start in indices: for stop in indices: # Skip invalid step 0 for step in indices[1:]: m[:] = s self.assertEqual(m[:], s) L = list(s) # Make sure we have a slice of exactly the right length, # but with different data. data = L[start:stop:step] data = bytes(reversed(data)) L[start:stop:step] = data m[start:stop:step] = data self.assertEqual(m[:], bytes(L)) def make_mmap_file (self, f, halfsize): # Write 2 pages worth of data to the file f.write (b'\0' * halfsize) f.write (b'foo') f.write (b'\0' * (halfsize - 3)) f.flush () return mmap.mmap (f.fileno(), 0) def test_empty_file (self): f = open (TESTFN, 'w+b') f.close() with open(TESTFN, "rb") as f : self.assertRaisesRegex(ValueError, "cannot mmap an empty file", mmap.mmap, f.fileno(), 0, access=mmap.ACCESS_READ) def test_offset (self): f = open (TESTFN, 'w+b') try: # unlink TESTFN no matter what halfsize = mmap.ALLOCATIONGRANULARITY m = self.make_mmap_file (f, halfsize) m.close () f.close () mapsize = halfsize * 2 # Try invalid offset f = open(TESTFN, "r+b") for offset in [-2, -1, None]: try: m = mmap.mmap(f.fileno(), mapsize, offset=offset) self.assertEqual(0, 1) except (ValueError, TypeError, OverflowError): pass else: self.assertEqual(0, 0) f.close() # Try valid offset, hopefully 8192 works on all OSes f = open(TESTFN, "r+b") m = mmap.mmap(f.fileno(), mapsize - halfsize, offset=halfsize) self.assertEqual(m[0:3], b'foo') f.close() # Try resizing map try: m.resize(512) except SystemError: pass else: # resize() is supported self.assertEqual(len(m), 512) # Check that we can no longer seek beyond the new size. self.assertRaises(ValueError, m.seek, 513, 0) # Check that the content is not changed self.assertEqual(m[0:3], b'foo') # Check that the underlying file is truncated too f = open(TESTFN, 'rb') f.seek(0, 2) self.assertEqual(f.tell(), halfsize + 512) f.close() self.assertEqual(m.size(), halfsize + 512) m.close() finally: f.close() try: os.unlink(TESTFN) except OSError: pass def test_subclass(self): class anon_mmap(mmap.mmap): def __new__(klass, *args, **kwargs): return mmap.mmap.__new__(klass, -1, *args, **kwargs) anon_mmap(PAGESIZE) @unittest.skipUnless(hasattr(mmap, 'PROT_READ'), "needs mmap.PROT_READ") def test_prot_readonly(self): mapsize = 10 with open(TESTFN, "wb") as fp: fp.write(b"a"*mapsize) f = open(TESTFN, "rb") m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ) self.assertRaises(TypeError, m.write, "foo") f.close() def test_error(self): self.assertIs(mmap.error, OSError) def test_io_methods(self): data = b"0123456789" with open(TESTFN, "wb") as fp: fp.write(b"x"*len(data)) f = open(TESTFN, "r+b") m = mmap.mmap(f.fileno(), len(data)) f.close() # Test write_byte() for i in range(len(data)): self.assertEqual(m.tell(), i) m.write_byte(data[i]) self.assertEqual(m.tell(), i+1) self.assertRaises(ValueError, m.write_byte, b"x"[0]) self.assertEqual(m[:], data) # Test read_byte() m.seek(0) for i in range(len(data)): self.assertEqual(m.tell(), i) self.assertEqual(m.read_byte(), data[i]) self.assertEqual(m.tell(), i+1) self.assertRaises(ValueError, m.read_byte) # Test read() m.seek(3) self.assertEqual(m.read(3), b"345") self.assertEqual(m.tell(), 6) # Test write() m.seek(3) m.write(b"bar") self.assertEqual(m.tell(), 6) self.assertEqual(m[:], b"012bar6789") m.write(bytearray(b"baz")) self.assertEqual(m.tell(), 9) self.assertEqual(m[:], b"012barbaz9") self.assertRaises(ValueError, m.write, b"ba") def test_non_ascii_byte(self): for b in (129, 200, 255): # > 128 m = mmap.mmap(-1, 1) m.write_byte(b) self.assertEqual(m[0], b) m.seek(0) self.assertEqual(m.read_byte(), b) m.close() @unittest.skipUnless(os.name == 'nt', 'requires Windows') def test_tagname(self): data1 = b"0123456789" data2 = b"abcdefghij" assert len(data1) == len(data2) # Test same tag m1 = mmap.mmap(-1, len(data1), tagname="foo") m1[:] = data1 m2 = mmap.mmap(-1, len(data2), tagname="foo") m2[:] = data2 self.assertEqual(m1[:], data2) self.assertEqual(m2[:], data2) m2.close() m1.close() # Test different tag m1 = mmap.mmap(-1, len(data1), tagname="foo") m1[:] = data1 m2 = mmap.mmap(-1, len(data2), tagname="boo") m2[:] = data2 self.assertEqual(m1[:], data1) self.assertEqual(m2[:], data2) m2.close() m1.close() @cpython_only @unittest.skipUnless(os.name == 'nt', 'requires Windows') def test_sizeof(self): m1 = mmap.mmap(-1, 100) tagname = "foo" m2 = mmap.mmap(-1, 100, tagname=tagname) self.assertEqual(sys.getsizeof(m2), sys.getsizeof(m1) + len(tagname) + 1) @unittest.skipUnless(os.name == 'nt', 'requires Windows') def test_crasher_on_windows(self): # Should not crash (Issue 1733986) m = mmap.mmap(-1, 1000, tagname="foo") try: mmap.mmap(-1, 5000, tagname="foo")[:] # same tagname, but larger size except: pass m.close() # Should not crash (Issue 5385) with open(TESTFN, "wb") as fp: fp.write(b"x"*10) f = open(TESTFN, "r+b") m = mmap.mmap(f.fileno(), 0) f.close() try: m.resize(0) # will raise OSError except: pass try: m[:] except: pass m.close() @unittest.skipUnless(os.name == 'nt', 'requires Windows') def test_invalid_descriptor(self): # socket file descriptors are valid, but out of range # for _get_osfhandle, causing a crash when validating the # parameters to _get_osfhandle. s = socket.socket() try: with self.assertRaises(OSError): m = mmap.mmap(s.fileno(), 10) finally: s.close() def test_context_manager(self): with mmap.mmap(-1, 10) as m: self.assertFalse(m.closed) self.assertTrue(m.closed) def test_context_manager_exception(self): # Test that the OSError gets passed through with self.assertRaises(Exception) as exc: with mmap.mmap(-1, 10) as m: raise OSError self.assertIsInstance(exc.exception, OSError, "wrong exception raised in context manager") self.assertTrue(m.closed, "context manager failed") def test_weakref(self): # Check mmap objects are weakrefable mm = mmap.mmap(-1, 16) wr = weakref.ref(mm) self.assertIs(wr(), mm) del mm gc_collect() self.assertIs(wr(), None) def test_write_returning_the_number_of_bytes_written(self): mm = mmap.mmap(-1, 16) self.assertEqual(mm.write(b""), 0) self.assertEqual(mm.write(b"x"), 1) self.assertEqual(mm.write(b"yz"), 2) self.assertEqual(mm.write(b"python"), 6) @unittest.skipIf(os.name == 'nt', 'cannot resize anonymous mmaps on Windows') def test_resize_past_pos(self): m = mmap.mmap(-1, 8192) self.addCleanup(m.close) m.read(5000) try: m.resize(4096) except SystemError: self.skipTest("resizing not supported") self.assertEqual(m.read(14), b'') self.assertRaises(ValueError, m.read_byte) self.assertRaises(ValueError, m.write_byte, 42) self.assertRaises(ValueError, m.write, b'abc') def test_concat_repeat_exception(self): m = mmap.mmap(-1, 16) with self.assertRaises(TypeError): m + m with self.assertRaises(TypeError): m * 2 class LargeMmapTests(unittest.TestCase): def setUp(self): unlink(TESTFN) def tearDown(self): unlink(TESTFN) def _make_test_file(self, num_zeroes, tail): if sys.platform[:3] == 'win' or sys.platform == 'darwin': requires('largefile', 'test requires %s bytes and a long time to run' % str(0x180000000)) f = open(TESTFN, 'w+b') try: f.seek(num_zeroes) f.write(tail) f.flush() except (OSError, OverflowError, ValueError): try: f.close() except (OSError, OverflowError): pass raise unittest.SkipTest("filesystem does not have largefile support") return f def test_large_offset(self): with self._make_test_file(0x14FFFFFFF, b" ") as f: with mmap.mmap(f.fileno(), 0, offset=0x140000000, access=mmap.ACCESS_READ) as m: self.assertEqual(m[0xFFFFFFF], 32) def test_large_filesize(self): with self._make_test_file(0x17FFFFFFF, b" ") as f: if sys.maxsize < 0x180000000: # On 32 bit platforms the file is larger than sys.maxsize so # mapping the whole file should fail -- Issue #16743 with self.assertRaises(OverflowError): mmap.mmap(f.fileno(), 0x180000000, access=mmap.ACCESS_READ) with self.assertRaises(ValueError): mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) with mmap.mmap(f.fileno(), 0x10000, access=mmap.ACCESS_READ) as m: self.assertEqual(m.size(), 0x180000000) # Issue 11277: mmap() with large (~4GB) sparse files crashes on OS X. def _test_around_boundary(self, boundary): tail = b' DEARdear ' start = boundary - len(tail) // 2 end = start + len(tail) with self._make_test_file(start, tail) as f: with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m: self.assertEqual(m[start:end], tail) @unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems") def test_around_2GB(self): self._test_around_boundary(_2G) @unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems") def test_around_4GB(self): self._test_around_boundary(_4G) def test_main(): run_unittest(MmapTests, LargeMmapTests) if __name__ == '__main__': test_main()
28,471
812
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_getopt.py
# test_getopt.py # David Goodger <[email protected]> 2000-08-19 from test.support import verbose, run_doctest, EnvironmentVarGuard import unittest import getopt sentinel = object() class GetoptTests(unittest.TestCase): def setUp(self): self.env = EnvironmentVarGuard() if "POSIXLY_CORRECT" in self.env: del self.env["POSIXLY_CORRECT"] def tearDown(self): self.env.__exit__() del self.env def assertError(self, *args, **kwargs): self.assertRaises(getopt.GetoptError, *args, **kwargs) def test_short_has_arg(self): self.assertTrue(getopt.short_has_arg('a', 'a:')) self.assertFalse(getopt.short_has_arg('a', 'a')) self.assertError(getopt.short_has_arg, 'a', 'b') def test_long_has_args(self): has_arg, option = getopt.long_has_args('abc', ['abc=']) self.assertTrue(has_arg) self.assertEqual(option, 'abc') has_arg, option = getopt.long_has_args('abc', ['abc']) self.assertFalse(has_arg) self.assertEqual(option, 'abc') has_arg, option = getopt.long_has_args('abc', ['abcd']) self.assertFalse(has_arg) self.assertEqual(option, 'abcd') self.assertError(getopt.long_has_args, 'abc', ['def']) self.assertError(getopt.long_has_args, 'abc', []) self.assertError(getopt.long_has_args, 'abc', ['abcd','abcde']) def test_do_shorts(self): opts, args = getopt.do_shorts([], 'a', 'a', []) self.assertEqual(opts, [('-a', '')]) self.assertEqual(args, []) opts, args = getopt.do_shorts([], 'a1', 'a:', []) self.assertEqual(opts, [('-a', '1')]) self.assertEqual(args, []) #opts, args = getopt.do_shorts([], 'a=1', 'a:', []) #self.assertEqual(opts, [('-a', '1')]) #self.assertEqual(args, []) opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) self.assertEqual(opts, [('-a', '1')]) self.assertEqual(args, []) opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) self.assertEqual(opts, [('-a', '1')]) self.assertEqual(args, ['2']) self.assertError(getopt.do_shorts, [], 'a1', 'a', []) self.assertError(getopt.do_shorts, [], 'a', 'a:', []) def test_do_longs(self): opts, args = getopt.do_longs([], 'abc', ['abc'], []) self.assertEqual(opts, [('--abc', '')]) self.assertEqual(args, []) opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) self.assertEqual(opts, [('--abc', '1')]) self.assertEqual(args, []) opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) self.assertEqual(opts, [('--abcd', '1')]) self.assertEqual(args, []) opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) self.assertEqual(opts, [('--abc', '')]) self.assertEqual(args, []) # Much like the preceding, except with a non-alpha character ("-") in # option name that precedes "="; failed in # http://python.org/sf/126863 opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) self.assertEqual(opts, [('--foo', '42')]) self.assertEqual(args, []) self.assertError(getopt.do_longs, [], 'abc=1', ['abc'], []) self.assertError(getopt.do_longs, [], 'abc', ['abc='], []) def test_getopt(self): # note: the empty string between '-a' and '--beta' is significant: # it simulates an empty string option argument ('-a ""') on the # command line. cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', '', '--beta', 'arg1', 'arg2'] opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) self.assertEqual(opts, [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''), ('-a', '3'), ('-a', ''), ('--beta', '')]) # Note ambiguity of ('-b', '') and ('-a', '') above. This must be # accounted for in the code that calls getopt(). self.assertEqual(args, ['arg1', 'arg2']) self.assertError(getopt.getopt, cmdline, 'a:b', ['alpha', 'beta']) def test_gnu_getopt(self): # Test handling of GNU style scanning mode. cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] # GNU style opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) self.assertEqual(args, ['arg1']) self.assertEqual(opts, [('-a', ''), ('-b', '1'), ('--alpha', ''), ('--beta', '2')]) # recognize "-" as an argument opts, args = getopt.gnu_getopt(['-a', '-', '-b', '-'], 'ab:', []) self.assertEqual(args, ['-']) self.assertEqual(opts, [('-a', ''), ('-b', '-')]) # Posix style via + opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) self.assertEqual(opts, [('-a', '')]) self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) # Posix style via POSIXLY_CORRECT self.env["POSIXLY_CORRECT"] = "1" opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) self.assertEqual(opts, [('-a', '')]) self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) def test_libref_examples(self): s = """ Examples from the Library Reference: Doc/lib/libgetopt.tex An example using only Unix style options: >>> import getopt >>> args = '-a -b -cfoo -d bar a1 a2'.split() >>> args ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] >>> optlist, args = getopt.getopt(args, 'abc:d:') >>> optlist [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] >>> args ['a1', 'a2'] Using long option names is equally easy: >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' >>> args = s.split() >>> args ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] >>> optlist, args = getopt.getopt(args, 'x', [ ... 'condition=', 'output-file=', 'testing']) >>> optlist [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] >>> args ['a1', 'a2'] """ import types m = types.ModuleType("libreftest", s) run_doctest(m, verbose) def test_issue4629(self): longopts, shortopts = getopt.getopt(['--help='], '', ['help=']) self.assertEqual(longopts, [('--help', '')]) longopts, shortopts = getopt.getopt(['--help=x'], '', ['help=']) self.assertEqual(longopts, [('--help', 'x')]) self.assertRaises(getopt.GetoptError, getopt.getopt, ['--help='], '', ['help']) if __name__ == "__main__": unittest.main()
6,910
185
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_kqueue.py
""" Tests for kqueue wrapper. """ import errno import os import select import socket import time import unittest if not hasattr(select, "kqueue"): raise unittest.SkipTest("test works only on BSD") class TestKQueue(unittest.TestCase): def test_create_queue(self): kq = select.kqueue() self.assertTrue(kq.fileno() > 0, kq.fileno()) self.assertTrue(not kq.closed) kq.close() self.assertTrue(kq.closed) self.assertRaises(ValueError, kq.fileno) def test_create_event(self): from operator import lt, le, gt, ge fd = os.open(os.devnull, os.O_WRONLY) self.addCleanup(os.close, fd) ev = select.kevent(fd) other = select.kevent(1000) self.assertEqual(ev.ident, fd) self.assertEqual(ev.filter, select.KQ_FILTER_READ) self.assertEqual(ev.flags, select.KQ_EV_ADD) self.assertEqual(ev.fflags, 0) self.assertEqual(ev.data, 0) self.assertEqual(ev.udata, 0) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) self.assertTrue(ev < other) self.assertTrue(other >= ev) for op in lt, le, gt, ge: self.assertRaises(TypeError, op, ev, None) self.assertRaises(TypeError, op, ev, 1) self.assertRaises(TypeError, op, ev, "ev") ev = select.kevent(fd, select.KQ_FILTER_WRITE) self.assertEqual(ev.ident, fd) self.assertEqual(ev.filter, select.KQ_FILTER_WRITE) self.assertEqual(ev.flags, select.KQ_EV_ADD) self.assertEqual(ev.fflags, 0) self.assertEqual(ev.data, 0) self.assertEqual(ev.udata, 0) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) ev = select.kevent(fd, select.KQ_FILTER_WRITE, select.KQ_EV_ONESHOT) self.assertEqual(ev.ident, fd) self.assertEqual(ev.filter, select.KQ_FILTER_WRITE) self.assertEqual(ev.flags, select.KQ_EV_ONESHOT) self.assertEqual(ev.fflags, 0) self.assertEqual(ev.data, 0) self.assertEqual(ev.udata, 0) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) ev = select.kevent(1, 2, 3, 4, 5, 6) self.assertEqual(ev.ident, 1) self.assertEqual(ev.filter, 2) self.assertEqual(ev.flags, 3) self.assertEqual(ev.fflags, 4) self.assertEqual(ev.data, 5) self.assertEqual(ev.udata, 6) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) bignum = 0x7fff ev = select.kevent(bignum, 1, 2, 3, bignum - 1, bignum) self.assertEqual(ev.ident, bignum) self.assertEqual(ev.filter, 1) self.assertEqual(ev.flags, 2) self.assertEqual(ev.fflags, 3) self.assertEqual(ev.data, bignum - 1) self.assertEqual(ev.udata, bignum) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) # Issue 11973 bignum = 0xffff ev = select.kevent(0, 1, bignum) self.assertEqual(ev.ident, 0) self.assertEqual(ev.filter, 1) self.assertEqual(ev.flags, bignum) self.assertEqual(ev.fflags, 0) self.assertEqual(ev.data, 0) self.assertEqual(ev.udata, 0) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) # Issue 11973 bignum = 0xffffffff ev = select.kevent(0, 1, 2, bignum) self.assertEqual(ev.ident, 0) self.assertEqual(ev.filter, 1) self.assertEqual(ev.flags, 2) self.assertEqual(ev.fflags, bignum) self.assertEqual(ev.data, 0) self.assertEqual(ev.udata, 0) self.assertEqual(ev, ev) self.assertNotEqual(ev, other) def test_queue_event(self): serverSocket = socket.socket() serverSocket.bind(('127.0.0.1', 0)) serverSocket.listen() client = socket.socket() client.setblocking(False) try: client.connect(('127.0.0.1', serverSocket.getsockname()[1])) except OSError as e: self.assertEqual(e.args[0], errno.EINPROGRESS) else: #raise AssertionError("Connect should have raised EINPROGRESS") pass # FreeBSD doesn't raise an exception here server, addr = serverSocket.accept() kq = select.kqueue() kq2 = select.kqueue.fromfd(kq.fileno()) ev = select.kevent(server.fileno(), select.KQ_FILTER_WRITE, select.KQ_EV_ADD | select.KQ_EV_ENABLE) kq.control([ev], 0) ev = select.kevent(server.fileno(), select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE) kq.control([ev], 0) ev = select.kevent(client.fileno(), select.KQ_FILTER_WRITE, select.KQ_EV_ADD | select.KQ_EV_ENABLE) kq2.control([ev], 0) ev = select.kevent(client.fileno(), select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE) kq2.control([ev], 0) events = kq.control(None, 4, 1) events = set((e.ident, e.filter) for e in events) self.assertEqual(events, set([ (client.fileno(), select.KQ_FILTER_WRITE), (server.fileno(), select.KQ_FILTER_WRITE)])) client.send(b"Hello!") server.send(b"world!!!") # We may need to call it several times for i in range(10): events = kq.control(None, 4, 1) if len(events) == 4: break time.sleep(1.0) else: self.fail('timeout waiting for event notifications') events = set((e.ident, e.filter) for e in events) self.assertEqual(events, set([ (client.fileno(), select.KQ_FILTER_WRITE), (client.fileno(), select.KQ_FILTER_READ), (server.fileno(), select.KQ_FILTER_WRITE), (server.fileno(), select.KQ_FILTER_READ)])) # Remove completely client, and server read part ev = select.kevent(client.fileno(), select.KQ_FILTER_WRITE, select.KQ_EV_DELETE) kq.control([ev], 0) ev = select.kevent(client.fileno(), select.KQ_FILTER_READ, select.KQ_EV_DELETE) kq.control([ev], 0) ev = select.kevent(server.fileno(), select.KQ_FILTER_READ, select.KQ_EV_DELETE) kq.control([ev], 0, 0) events = kq.control([], 4, 0.99) events = set((e.ident, e.filter) for e in events) self.assertEqual(events, set([ (server.fileno(), select.KQ_FILTER_WRITE)])) client.close() server.close() serverSocket.close() def testPair(self): kq = select.kqueue() a, b = socket.socketpair() a.send(b'foo') event1 = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE) event2 = select.kevent(b, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE) r = kq.control([event1, event2], 1, 1) self.assertTrue(r) self.assertFalse(r[0].flags & select.KQ_EV_ERROR) self.assertEqual(b.recv(r[0].data), b'foo') a.close() b.close() kq.close() def test_issue30058(self): # changelist must be an iterable kq = select.kqueue() a, b = socket.socketpair() ev = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE) kq.control([ev], 0) # not a list kq.control((ev,), 0) # __len__ is not consistent with __iter__ class BadList: def __len__(self): return 0 def __iter__(self): for i in range(100): yield ev kq.control(BadList(), 0) # doesn't have __len__ kq.control(iter([ev]), 0) a.close() b.close() kq.close() def test_close(self): open_file = open(__file__, "rb") self.addCleanup(open_file.close) fd = open_file.fileno() kqueue = select.kqueue() # test fileno() method and closed attribute self.assertIsInstance(kqueue.fileno(), int) self.assertFalse(kqueue.closed) # test close() kqueue.close() self.assertTrue(kqueue.closed) self.assertRaises(ValueError, kqueue.fileno) # close() can be called more than once kqueue.close() # operations must fail with ValueError("I/O operation on closed ...") self.assertRaises(ValueError, kqueue.control, None, 4) def test_fd_non_inheritable(self): kqueue = select.kqueue() self.addCleanup(kqueue.close) self.assertEqual(os.get_inheritable(kqueue.fileno()), False) if __name__ == "__main__": unittest.main()
9,017
264
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_tk.py
from test import support # Skip test if _tkinter wasn't built. support.import_module('_tkinter') # Skip test if tk cannot be initialized. support.requires('gui') from tkinter.test import runtktests def test_main(): support.run_unittest( *runtktests.get_tests(text=False, packages=['test_tkinter'])) if __name__ == '__main__': test_main()
362
16
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_pkg.py
# Test packages (dotted-name import) import sys import os import tempfile import textwrap import unittest # Helpers to create and destroy hierarchies. def cleanout(root): names = os.listdir(root) for name in names: fullname = os.path.join(root, name) if os.path.isdir(fullname) and not os.path.islink(fullname): cleanout(fullname) else: os.remove(fullname) os.rmdir(root) def fixdir(lst): if "__builtins__" in lst: lst.remove("__builtins__") if "__initializing__" in lst: lst.remove("__initializing__") return lst # XXX Things to test # # import package without __init__ # import package with __init__ # __init__ importing submodule # __init__ importing global module # __init__ defining variables # submodule importing other submodule # submodule importing global module # submodule import submodule via global name # from package import submodule # from package import subpackage # from package import variable (defined in __init__) # from package import * (defined in __init__) class TestPkg(unittest.TestCase): def setUp(self): self.root = None self.pkgname = None self.syspath = list(sys.path) self.modules_to_cleanup = set() # Populated by mkhier(). def tearDown(self): sys.path[:] = self.syspath for modulename in self.modules_to_cleanup: if modulename in sys.modules: del sys.modules[modulename] if self.root: # Only clean if the test was actually run cleanout(self.root) # delete all modules concerning the tested hierarchy if self.pkgname: modules = [name for name in sys.modules if self.pkgname in name.split('.')] for name in modules: del sys.modules[name] def run_code(self, code): exec(textwrap.dedent(code), globals(), {"self": self}) def mkhier(self, descr): root = tempfile.mkdtemp() sys.path.insert(0, root) if not os.path.isdir(root): os.mkdir(root) for name, contents in descr: comps = name.split() self.modules_to_cleanup.add('.'.join(comps)) fullname = root for c in comps: fullname = os.path.join(fullname, c) if contents is None: os.mkdir(fullname) else: with open(fullname, "w") as f: f.write(contents) if not contents.endswith('\n'): f.write('\n') self.root = root # package name is the name of the first item self.pkgname = descr[0][0] def test_1(self): hier = [("t1", None), ("t1 __init__.py", "")] self.mkhier(hier) import t1 def test_2(self): hier = [ ("t2", None), ("t2 __init__.py", "'doc for t2'"), ("t2 sub", None), ("t2 sub __init__.py", ""), ("t2 sub subsub", None), ("t2 sub subsub __init__.py", "spam = 1"), ] self.mkhier(hier) import t2.sub import t2.sub.subsub self.assertEqual(t2.__name__, "t2") self.assertEqual(t2.sub.__name__, "t2.sub") self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub") # This exec crap is needed because Py3k forbids 'import *' outside # of module-scope and __import__() is insufficient for what we need. s = """ import t2 from t2 import * self.assertEqual(dir(), ['self', 'sub', 't2']) """ self.run_code(s) from t2 import sub from t2.sub import subsub from t2.sub.subsub import spam self.assertEqual(sub.__name__, "t2.sub") self.assertEqual(subsub.__name__, "t2.sub.subsub") self.assertEqual(sub.subsub.__name__, "t2.sub.subsub") for name in ['spam', 'sub', 'subsub', 't2']: self.assertTrue(locals()["name"], "Failed to import %s" % name) import t2.sub import t2.sub.subsub self.assertEqual(t2.__name__, "t2") self.assertEqual(t2.sub.__name__, "t2.sub") self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub") s = """ from t2 import * self.assertEqual(dir(), ['self', 'sub']) """ self.run_code(s) def test_3(self): hier = [ ("t3", None), ("t3 __init__.py", ""), ("t3 sub", None), ("t3 sub __init__.py", ""), ("t3 sub subsub", None), ("t3 sub subsub __init__.py", "spam = 1"), ] self.mkhier(hier) import t3.sub.subsub self.assertEqual(t3.__name__, "t3") self.assertEqual(t3.sub.__name__, "t3.sub") self.assertEqual(t3.sub.subsub.__name__, "t3.sub.subsub") def test_4(self): hier = [ ("t4.py", "raise RuntimeError('Shouldnt load t4.py')"), ("t4", None), ("t4 __init__.py", ""), ("t4 sub.py", "raise RuntimeError('Shouldnt load sub.py')"), ("t4 sub", None), ("t4 sub __init__.py", ""), ("t4 sub subsub.py", "raise RuntimeError('Shouldnt load subsub.py')"), ("t4 sub subsub", None), ("t4 sub subsub __init__.py", "spam = 1"), ] self.mkhier(hier) s = """ from t4.sub.subsub import * self.assertEqual(spam, 1) """ self.run_code(s) def test_5(self): hier = [ ("t5", None), ("t5 __init__.py", "import t5.foo"), ("t5 string.py", "spam = 1"), ("t5 foo.py", "from . import string; assert string.spam == 1"), ] self.mkhier(hier) import t5 s = """ from t5 import * self.assertEqual(dir(), ['foo', 'self', 'string', 't5']) """ self.run_code(s) import t5 self.assertEqual(fixdir(dir(t5)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'foo', 'string', 't5']) self.assertEqual(fixdir(dir(t5.foo)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'string']) self.assertEqual(fixdir(dir(t5.string)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'spam']) def test_6(self): hier = [ ("t6", None), ("t6 __init__.py", "__all__ = ['spam', 'ham', 'eggs']"), ("t6 spam.py", ""), ("t6 ham.py", ""), ("t6 eggs.py", ""), ] self.mkhier(hier) import t6 self.assertEqual(fixdir(dir(t6)), ['__all__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']) s = """ import t6 from t6 import * self.assertEqual(fixdir(dir(t6)), ['__all__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'eggs', 'ham', 'spam']) self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6']) """ self.run_code(s) def test_7(self): hier = [ ("t7.py", ""), ("t7", None), ("t7 __init__.py", ""), ("t7 sub.py", "raise RuntimeError('Shouldnt load sub.py')"), ("t7 sub", None), ("t7 sub __init__.py", ""), ("t7 sub .py", "raise RuntimeError('Shouldnt load subsub.py')"), ("t7 sub subsub", None), ("t7 sub subsub __init__.py", "spam = 1"), ] self.mkhier(hier) t7, sub, subsub = None, None, None import t7 as tas self.assertEqual(fixdir(dir(tas)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']) self.assertFalse(t7) from t7 import sub as subpar self.assertEqual(fixdir(dir(subpar)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']) self.assertFalse(t7) self.assertFalse(sub) from t7.sub import subsub as subsubsub self.assertEqual(fixdir(dir(subsubsub)), ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'spam']) self.assertFalse(t7) self.assertFalse(sub) self.assertFalse(subsub) from t7.sub.subsub import spam as ham self.assertEqual(ham, 1) self.assertFalse(t7) self.assertFalse(sub) self.assertFalse(subsub) @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_8(self): hier = [ ("t8", None), ("t8 __init__"+os.extsep+"py", "'doc for t8'"), ] self.mkhier(hier) import t8 self.assertEqual(t8.__doc__, "doc for t8") if __name__ == "__main__": unittest.main()
9,824
297
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_script_helper.py
"""Unittests for test.support.script_helper. Who tests the test helper?""" import subprocess import sys import os from test.support import script_helper import unittest from unittest import mock class TestScriptHelper(unittest.TestCase): def test_assert_python_ok(self): t = script_helper.assert_python_ok('-c', 'import sys; sys.exit(0)') self.assertEqual(0, t[0], 'return code was not 0') def test_assert_python_failure(self): # I didn't import the sys module so this child will fail. rc, out, err = script_helper.assert_python_failure('-c', 'sys.exit(0)') self.assertNotEqual(0, rc, 'return code should not be 0') def test_assert_python_ok_raises(self): # I didn't import the sys module so this child will fail. with self.assertRaises(AssertionError) as error_context: script_helper.assert_python_ok('-c', 'sys.exit(0)') error_msg = str(error_context.exception) self.assertIn('command line:', error_msg) self.assertIn('sys.exit(0)', error_msg, msg='unexpected command line') def test_assert_python_failure_raises(self): with self.assertRaises(AssertionError) as error_context: script_helper.assert_python_failure('-c', 'import sys; sys.exit(0)') error_msg = str(error_context.exception) self.assertIn('Process return code is 0\n', error_msg) self.assertIn('import sys; sys.exit(0)', error_msg, msg='unexpected command line.') @mock.patch('subprocess.Popen') def test_assert_python_isolated_when_env_not_required(self, mock_popen): with mock.patch.object(script_helper, 'interpreter_requires_environment', return_value=False) as mock_ire_func: mock_popen.side_effect = RuntimeError('bail out of unittest') try: script_helper._assert_python(True, '-c', 'None') except RuntimeError as err: self.assertEqual('bail out of unittest', err.args[0]) self.assertEqual(1, mock_popen.call_count) self.assertEqual(1, mock_ire_func.call_count) popen_command = mock_popen.call_args[0][0] self.assertEqual(sys.executable, popen_command[0]) self.assertIn('None', popen_command) self.assertIn('-I', popen_command) self.assertNotIn('-E', popen_command) # -I overrides this @mock.patch('subprocess.Popen') def test_assert_python_not_isolated_when_env_is_required(self, mock_popen): """Ensure that -I is not passed when the environment is required.""" with mock.patch.object(script_helper, 'interpreter_requires_environment', return_value=True) as mock_ire_func: mock_popen.side_effect = RuntimeError('bail out of unittest') try: script_helper._assert_python(True, '-c', 'None') except RuntimeError as err: self.assertEqual('bail out of unittest', err.args[0]) popen_command = mock_popen.call_args[0][0] self.assertNotIn('-I', popen_command) self.assertNotIn('-E', popen_command) class TestScriptHelperEnvironment(unittest.TestCase): """Code coverage for interpreter_requires_environment().""" def setUp(self): self.assertTrue( hasattr(script_helper, '__cached_interp_requires_environment')) # Reset the private cached state. script_helper.__dict__['__cached_interp_requires_environment'] = None def tearDown(self): # Reset the private cached state. script_helper.__dict__['__cached_interp_requires_environment'] = None @mock.patch('subprocess.check_call') def test_interpreter_requires_environment_true(self, mock_check_call): with mock.patch.dict(os.environ): os.environ.pop('PYTHONHOME', None) mock_check_call.side_effect = subprocess.CalledProcessError('', '') self.assertTrue(script_helper.interpreter_requires_environment()) self.assertTrue(script_helper.interpreter_requires_environment()) self.assertEqual(1, mock_check_call.call_count) @mock.patch('subprocess.check_call') def test_interpreter_requires_environment_false(self, mock_check_call): with mock.patch.dict(os.environ): os.environ.pop('PYTHONHOME', None) # The mocked subprocess.check_call fakes a no-error process. script_helper.interpreter_requires_environment() self.assertFalse(script_helper.interpreter_requires_environment()) self.assertEqual(1, mock_check_call.call_count) @mock.patch('subprocess.check_call') def test_interpreter_requires_environment_details(self, mock_check_call): with mock.patch.dict(os.environ): os.environ.pop('PYTHONHOME', None) script_helper.interpreter_requires_environment() self.assertFalse(script_helper.interpreter_requires_environment()) self.assertFalse(script_helper.interpreter_requires_environment()) self.assertEqual(1, mock_check_call.call_count) check_call_command = mock_check_call.call_args[0][0] self.assertEqual(sys.executable, check_call_command[0]) self.assertIn('-E', check_call_command) @mock.patch('subprocess.check_call') def test_interpreter_requires_environment_with_pythonhome(self, mock_check_call): with mock.patch.dict(os.environ): os.environ['PYTHONHOME'] = 'MockedHome' self.assertTrue(script_helper.interpreter_requires_environment()) self.assertTrue(script_helper.interpreter_requires_environment()) self.assertEqual(0, mock_check_call.call_count) if __name__ == '__main__': unittest.main()
5,916
126
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/mailcap.txt
# Mailcap file for test_mailcap; based on RFC 1524 # Referred to by test_mailcap.py # # This is a comment. # application/frame; showframe %s; print="cat %s | lp" application/postscript; ps-to-terminal %s;\ needsterminal application/postscript; ps-to-terminal %s; \ compose=idraw %s application/x-dvi; xdvi %s application/x-movie; movieplayer %s; compose=moviemaker %s; \ description="Movie"; \ x11-bitmap="/usr/lib/Zmail/bitmaps/movie.xbm" application/*; echo "This is \"%t\" but \ is 50 \% Greek to me" \; cat %s; copiousoutput audio/basic; showaudio %s; compose=audiocompose %s; edit=audiocompose %s;\ description="An audio fragment" audio/* ; /usr/local/bin/showaudio %t image/rgb; display %s #image/gif; display %s image/x-xwindowdump; display %s # The continuation char shouldn't \ # make a difference in a comment. message/external-body; showexternal %s %{access-type} %{name} %{site} \ %{directory} %{mode} %{server}; needsterminal; composetyped = extcompose %s; \ description="A reference to data stored in an external location" text/richtext; shownonascii iso-8859-8 -e richtext -p %s; test=test "`echo \ %{charset} | tr '[A-Z]' '[a-z]'`" = iso-8859-8; copiousoutput video/*; animate %s video/mpeg; mpeg_play %s
1,270
39
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_zipapp.py
"""Test harness for the zipapp module.""" import io import pathlib import stat import sys import tempfile import unittest import zipapp import zipfile from unittest.mock import patch class ZipAppTest(unittest.TestCase): """Test zipapp module functionality.""" def setUp(self): tmpdir = tempfile.TemporaryDirectory() self.addCleanup(tmpdir.cleanup) self.tmpdir = pathlib.Path(tmpdir.name) def test_create_archive(self): # Test packing a directory. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target)) self.assertTrue(target.is_file()) def test_create_archive_with_pathlib(self): # Test packing a directory using Path objects for source and target. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(source, target) self.assertTrue(target.is_file()) def test_create_archive_with_subdirs(self): # Test packing a directory includes entries for subdirectories. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() (source / 'foo').mkdir() (source / 'bar').mkdir() (source / 'foo' / '__init__.py').touch() target = io.BytesIO() zipapp.create_archive(str(source), target) target.seek(0) with zipfile.ZipFile(target, 'r') as z: self.assertIn('foo/', z.namelist()) self.assertIn('bar/', z.namelist()) def test_create_archive_default_target(self): # Test packing a directory to the default name. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() zipapp.create_archive(str(source)) expected_target = self.tmpdir / 'source.pyz' self.assertTrue(expected_target.is_file()) def test_no_main(self): # Test that packing a directory with no __main__.py fails. source = self.tmpdir / 'source' source.mkdir() (source / 'foo.py').touch() target = self.tmpdir / 'source.pyz' with self.assertRaises(zipapp.ZipAppError): zipapp.create_archive(str(source), str(target)) def test_main_and_main_py(self): # Test that supplying a main argument with __main__.py fails. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' with self.assertRaises(zipapp.ZipAppError): zipapp.create_archive(str(source), str(target), main='pkg.mod:fn') def test_main_written(self): # Test that the __main__.py is written correctly. source = self.tmpdir / 'source' source.mkdir() (source / 'foo.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), main='pkg.mod:fn') with zipfile.ZipFile(str(target), 'r') as z: self.assertIn('__main__.py', z.namelist()) self.assertIn(b'pkg.mod.fn()', z.read('__main__.py')) def test_main_only_written_once(self): # Test that we don't write multiple __main__.py files. # The initial implementation had this bug; zip files allow # multiple entries with the same name source = self.tmpdir / 'source' source.mkdir() # Write 2 files, as the original bug wrote __main__.py # once for each file written :-( # See http://bugs.python.org/review/23491/diff/13982/Lib/zipapp.py#newcode67Lib/zipapp.py:67 # (line 67) (source / 'foo.py').touch() (source / 'bar.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), main='pkg.mod:fn') with zipfile.ZipFile(str(target), 'r') as z: self.assertEqual(1, z.namelist().count('__main__.py')) def test_main_validation(self): # Test that invalid values for main are rejected. source = self.tmpdir / 'source' source.mkdir() target = self.tmpdir / 'source.pyz' problems = [ '', 'foo', 'foo:', ':bar', '12:bar', 'a.b.c.:d', '.a:b', 'a:b.', 'a:.b', 'a:silly name' ] for main in problems: with self.subTest(main=main): with self.assertRaises(zipapp.ZipAppError): zipapp.create_archive(str(source), str(target), main=main) def test_default_no_shebang(self): # Test that no shebang line is written to the target by default. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target)) with target.open('rb') as f: self.assertNotEqual(f.read(2), b'#!') def test_custom_interpreter(self): # Test that a shebang line with a custom interpreter is written # correctly. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') with target.open('rb') as f: self.assertEqual(f.read(2), b'#!') self.assertEqual(b'python\n', f.readline()) def test_pack_to_fileobj(self): # Test that we can pack to a file object. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = io.BytesIO() zipapp.create_archive(str(source), target, interpreter='python') self.assertTrue(target.getvalue().startswith(b'#!python\n')) def test_read_shebang(self): # Test that we can read the shebang line correctly. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') self.assertEqual(zipapp.get_interpreter(str(target)), 'python') def test_read_missing_shebang(self): # Test that reading the shebang line of a file without one returns None. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target)) self.assertEqual(zipapp.get_interpreter(str(target)), None) def test_modify_shebang(self): # Test that we can change the shebang of a file. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') new_target = self.tmpdir / 'changed.pyz' zipapp.create_archive(str(target), str(new_target), interpreter='python2.7') self.assertEqual(zipapp.get_interpreter(str(new_target)), 'python2.7') def test_write_shebang_to_fileobj(self): # Test that we can change the shebang of a file, writing the result to a # file object. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') new_target = io.BytesIO() zipapp.create_archive(str(target), new_target, interpreter='python2.7') self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n')) def test_read_from_pathobj(self): # Test that we can copy an archive using a pathlib.Path object # for the source. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target1 = self.tmpdir / 'target1.pyz' target2 = self.tmpdir / 'target2.pyz' zipapp.create_archive(source, target1, interpreter='python') zipapp.create_archive(target1, target2, interpreter='python2.7') self.assertEqual(zipapp.get_interpreter(target2), 'python2.7') def test_read_from_fileobj(self): # Test that we can copy an archive using an open file object. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' temp_archive = io.BytesIO() zipapp.create_archive(str(source), temp_archive, interpreter='python') new_target = io.BytesIO() temp_archive.seek(0) zipapp.create_archive(temp_archive, new_target, interpreter='python2.7') self.assertTrue(new_target.getvalue().startswith(b'#!python2.7\n')) def test_remove_shebang(self): # Test that we can remove the shebang from a file. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') new_target = self.tmpdir / 'changed.pyz' zipapp.create_archive(str(target), str(new_target), interpreter=None) self.assertEqual(zipapp.get_interpreter(str(new_target)), None) def test_content_of_copied_archive(self): # Test that copying an archive doesn't corrupt it. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = io.BytesIO() zipapp.create_archive(str(source), target, interpreter='python') new_target = io.BytesIO() target.seek(0) zipapp.create_archive(target, new_target, interpreter=None) new_target.seek(0) with zipfile.ZipFile(new_target, 'r') as z: self.assertEqual(set(z.namelist()), {'__main__.py'}) # (Unix only) tests that archives with shebang lines are made executable @unittest.skipIf(sys.platform == 'win32', 'Windows does not support an executable bit') def test_shebang_is_executable(self): # Test that an archive with a shebang line is made executable. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter='python') self.assertTrue(target.stat().st_mode & stat.S_IEXEC) @unittest.skipIf(sys.platform == 'win32', 'Windows does not support an executable bit') def test_no_shebang_is_not_executable(self): # Test that an archive with no shebang line is not made executable. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(str(source), str(target), interpreter=None) self.assertFalse(target.stat().st_mode & stat.S_IEXEC) class ZipAppCmdlineTest(unittest.TestCase): """Test zipapp module command line API.""" def setUp(self): tmpdir = tempfile.TemporaryDirectory() self.addCleanup(tmpdir.cleanup) self.tmpdir = pathlib.Path(tmpdir.name) def make_archive(self): # Test that an archive with no shebang line is not made executable. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() target = self.tmpdir / 'source.pyz' zipapp.create_archive(source, target) return target def test_cmdline_create(self): # Test the basic command line API. source = self.tmpdir / 'source' source.mkdir() (source / '__main__.py').touch() args = [str(source)] zipapp.main(args) target = source.with_suffix('.pyz') self.assertTrue(target.is_file()) def test_cmdline_copy(self): # Test copying an archive. original = self.make_archive() target = self.tmpdir / 'target.pyz' args = [str(original), '-o', str(target)] zipapp.main(args) self.assertTrue(target.is_file()) def test_cmdline_copy_inplace(self): # Test copying an archive in place fails. original = self.make_archive() target = self.tmpdir / 'target.pyz' args = [str(original), '-o', str(original)] with self.assertRaises(SystemExit) as cm: zipapp.main(args) # Program should exit with a non-zero return code. self.assertTrue(cm.exception.code) def test_cmdline_copy_change_main(self): # Test copying an archive doesn't allow changing __main__.py. original = self.make_archive() target = self.tmpdir / 'target.pyz' args = [str(original), '-o', str(target), '-m', 'foo:bar'] with self.assertRaises(SystemExit) as cm: zipapp.main(args) # Program should exit with a non-zero return code. self.assertTrue(cm.exception.code) @patch('sys.stdout', new_callable=io.StringIO) def test_info_command(self, mock_stdout): # Test the output of the info command. target = self.make_archive() args = [str(target), '--info'] with self.assertRaises(SystemExit) as cm: zipapp.main(args) # Program should exit with a zero return code. self.assertEqual(cm.exception.code, 0) self.assertEqual(mock_stdout.getvalue(), "Interpreter: <none>\n") def test_info_error(self): # Test the info command fails when the archive does not exist. target = self.tmpdir / 'dummy.pyz' args = [str(target), '--info'] with self.assertRaises(SystemExit) as cm: zipapp.main(args) # Program should exit with a non-zero return code. self.assertTrue(cm.exception.code) if __name__ == "__main__": unittest.main()
14,070
350
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_pkgutil.py
from test.support import run_unittest, unload, check_warnings, CleanImport import unittest import sys import importlib from importlib.util import spec_from_file_location import pkgutil import os import os.path import tempfile import shutil import zipfile # Note: pkgutil.walk_packages is currently tested in test_runpy. This is # a hack to get a major issue resolved for 3.3b2. Longer term, it should # be moved back here, perhaps by factoring out the helper code for # creating interesting package layouts to a separate module. # Issue #15348 declares this is indeed a dodgy hack ;) class PkgutilTests(unittest.TestCase): def setUp(self): self.dirname = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, self.dirname) sys.path.insert(0, self.dirname) def tearDown(self): del sys.path[0] def test_getdata_filesys(self): pkg = 'test_getdata_filesys' # Include a LF and a CRLF, to test that binary data is read back RESOURCE_DATA = b'Hello, world!\nSecond line\r\nThird line' # Make a package with some resources package_dir = os.path.join(self.dirname, pkg) os.mkdir(package_dir) # Empty init.py f = open(os.path.join(package_dir, '__init__.py'), "wb") f.close() # Resource files, res.txt, sub/res.txt f = open(os.path.join(package_dir, 'res.txt'), "wb") f.write(RESOURCE_DATA) f.close() os.mkdir(os.path.join(package_dir, 'sub')) f = open(os.path.join(package_dir, 'sub', 'res.txt'), "wb") f.write(RESOURCE_DATA) f.close() # Check we can read the resources res1 = pkgutil.get_data(pkg, 'res.txt') self.assertEqual(res1, RESOURCE_DATA) res2 = pkgutil.get_data(pkg, 'sub/res.txt') self.assertEqual(res2, RESOURCE_DATA) del sys.modules[pkg] def test_getdata_zipfile(self): zip = 'test_getdata_zipfile.zip' pkg = 'test_getdata_zipfile' # Include a LF and a CRLF, to test that binary data is read back RESOURCE_DATA = b'Hello, world!\nSecond line\r\nThird line' # Make a package with some resources zip_file = os.path.join(self.dirname, zip) z = zipfile.ZipFile(zip_file, 'w') # Empty init.py z.writestr(pkg + '/__init__.py', "") # Resource files, res.txt, sub/res.txt z.writestr(pkg + '/res.txt', RESOURCE_DATA) z.writestr(pkg + '/sub/res.txt', RESOURCE_DATA) z.close() # Check we can read the resources sys.path.insert(0, zip_file) res1 = pkgutil.get_data(pkg, 'res.txt') self.assertEqual(res1, RESOURCE_DATA) res2 = pkgutil.get_data(pkg, 'sub/res.txt') self.assertEqual(res2, RESOURCE_DATA) names = [] for moduleinfo in pkgutil.iter_modules([zip_file]): self.assertIsInstance(moduleinfo, pkgutil.ModuleInfo) names.append(moduleinfo.name) self.assertEqual(names, ['test_getdata_zipfile']) del sys.path[0] del sys.modules[pkg] def test_unreadable_dir_on_syspath(self): # issue7367 - walk_packages failed if unreadable dir on sys.path package_name = "unreadable_package" d = os.path.join(self.dirname, package_name) # this does not appear to create an unreadable dir on Windows # but the test should not fail anyway os.mkdir(d, 0) self.addCleanup(os.rmdir, d) for t in pkgutil.walk_packages(path=[self.dirname]): self.fail("unexpected package found") def test_walkpackages_filesys(self): pkg1 = 'test_walkpackages_filesys' pkg1_dir = os.path.join(self.dirname, pkg1) os.mkdir(pkg1_dir) f = open(os.path.join(pkg1_dir, '__init__.py'), "wb") f.close() os.mkdir(os.path.join(pkg1_dir, 'sub')) f = open(os.path.join(pkg1_dir, 'sub', '__init__.py'), "wb") f.close() f = open(os.path.join(pkg1_dir, 'sub', 'mod.py'), "wb") f.close() # Now, to juice it up, let's add the opposite packages, too. pkg2 = 'sub' pkg2_dir = os.path.join(self.dirname, pkg2) os.mkdir(pkg2_dir) f = open(os.path.join(pkg2_dir, '__init__.py'), "wb") f.close() os.mkdir(os.path.join(pkg2_dir, 'test_walkpackages_filesys')) f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', '__init__.py'), "wb") f.close() f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', 'mod.py'), "wb") f.close() expected = [ 'sub', 'sub.test_walkpackages_filesys', 'sub.test_walkpackages_filesys.mod', 'test_walkpackages_filesys', 'test_walkpackages_filesys.sub', 'test_walkpackages_filesys.sub.mod', ] actual= [e[1] for e in pkgutil.walk_packages([self.dirname])] self.assertEqual(actual, expected) for pkg in expected: if pkg.endswith('mod'): continue del sys.modules[pkg] def test_walkpackages_zipfile(self): """Tests the same as test_walkpackages_filesys, only with a zip file.""" zip = 'test_walkpackages_zipfile.zip' pkg1 = 'test_walkpackages_zipfile' pkg2 = 'sub' zip_file = os.path.join(self.dirname, zip) z = zipfile.ZipFile(zip_file, 'w') z.writestr(pkg2 + '/__init__.py', "") z.writestr(pkg2 + '/' + pkg1 + '/__init__.py', "") z.writestr(pkg2 + '/' + pkg1 + '/mod.py', "") z.writestr(pkg1 + '/__init__.py', "") z.writestr(pkg1 + '/' + pkg2 + '/__init__.py', "") z.writestr(pkg1 + '/' + pkg2 + '/mod.py', "") z.close() sys.path.insert(0, zip_file) expected = [ 'sub', 'sub.test_walkpackages_zipfile', 'sub.test_walkpackages_zipfile.mod', 'test_walkpackages_zipfile', 'test_walkpackages_zipfile.sub', 'test_walkpackages_zipfile.sub.mod', ] actual= [e[1] for e in pkgutil.walk_packages([zip_file])] self.assertEqual(actual, expected) del sys.path[0] for pkg in expected: if pkg.endswith('mod'): continue del sys.modules[pkg] class PkgutilPEP302Tests(unittest.TestCase): class MyTestLoader(object): def create_module(self, spec): return None def exec_module(self, mod): # Count how many times the module is reloaded mod.__dict__['loads'] = mod.__dict__.get('loads', 0) + 1 def get_data(self, path): return "Hello, world!" class MyTestImporter(object): def find_spec(self, fullname, path=None, target=None): loader = PkgutilPEP302Tests.MyTestLoader() return spec_from_file_location(fullname, '<%s>' % loader.__class__.__name__, loader=loader, submodule_search_locations=[]) def setUp(self): sys.meta_path.insert(0, self.MyTestImporter()) def tearDown(self): del sys.meta_path[0] def test_getdata_pep302(self): # Use a dummy finder/loader self.assertEqual(pkgutil.get_data('foo', 'dummy'), "Hello, world!") del sys.modules['foo'] def test_alreadyloaded(self): # Ensure that get_data works without reloading - the "loads" module # variable in the example loader should count how many times a reload # occurs. import foo self.assertEqual(foo.loads, 1) self.assertEqual(pkgutil.get_data('foo', 'dummy'), "Hello, world!") self.assertEqual(foo.loads, 1) del sys.modules['foo'] # These tests, especially the setup and cleanup, are hideous. They # need to be cleaned up once issue 14715 is addressed. class ExtendPathTests(unittest.TestCase): def create_init(self, pkgname): dirname = tempfile.mkdtemp() sys.path.insert(0, dirname) pkgdir = os.path.join(dirname, pkgname) os.mkdir(pkgdir) with open(os.path.join(pkgdir, '__init__.py'), 'w') as fl: fl.write('from pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n') return dirname def create_submodule(self, dirname, pkgname, submodule_name, value): module_name = os.path.join(dirname, pkgname, submodule_name + '.py') with open(module_name, 'w') as fl: print('value={}'.format(value), file=fl) def test_simple(self): pkgname = 'foo' dirname_0 = self.create_init(pkgname) dirname_1 = self.create_init(pkgname) self.create_submodule(dirname_0, pkgname, 'bar', 0) self.create_submodule(dirname_1, pkgname, 'baz', 1) import foo.bar import foo.baz # Ensure we read the expected values self.assertEqual(foo.bar.value, 0) self.assertEqual(foo.baz.value, 1) # Ensure the path is set up correctly self.assertEqual(sorted(foo.__path__), sorted([os.path.join(dirname_0, pkgname), os.path.join(dirname_1, pkgname)])) # Cleanup shutil.rmtree(dirname_0) shutil.rmtree(dirname_1) del sys.path[0] del sys.path[0] del sys.modules['foo'] del sys.modules['foo.bar'] del sys.modules['foo.baz'] # Another awful testing hack to be cleaned up once the test_runpy # helpers are factored out to a common location def test_iter_importers(self): iter_importers = pkgutil.iter_importers get_importer = pkgutil.get_importer pkgname = 'spam' modname = 'eggs' dirname = self.create_init(pkgname) pathitem = os.path.join(dirname, pkgname) fullname = '{}.{}'.format(pkgname, modname) sys.modules.pop(fullname, None) sys.modules.pop(pkgname, None) try: self.create_submodule(dirname, pkgname, modname, 0) importlib.import_module(fullname) importers = list(iter_importers(fullname)) expected_importer = get_importer(pathitem) for finder in importers: spec = pkgutil._get_spec(finder, fullname) loader = spec.loader try: loader = loader.loader except AttributeError: # For now we still allow raw loaders from # find_module(). pass self.assertIsInstance(finder, importlib.machinery.FileFinder) self.assertEqual(finder, expected_importer) self.assertIsInstance(loader, importlib.machinery.SourceFileLoader) self.assertIsNone(pkgutil._get_spec(finder, pkgname)) with self.assertRaises(ImportError): list(iter_importers('invalid.module')) with self.assertRaises(ImportError): list(iter_importers('.spam')) finally: shutil.rmtree(dirname) del sys.path[0] try: del sys.modules['spam'] del sys.modules['spam.eggs'] except KeyError: pass def test_mixed_namespace(self): pkgname = 'foo' dirname_0 = self.create_init(pkgname) dirname_1 = self.create_init(pkgname) self.create_submodule(dirname_0, pkgname, 'bar', 0) # Turn this into a PEP 420 namespace package os.unlink(os.path.join(dirname_0, pkgname, '__init__.py')) self.create_submodule(dirname_1, pkgname, 'baz', 1) import foo.bar import foo.baz # Ensure we read the expected values self.assertEqual(foo.bar.value, 0) self.assertEqual(foo.baz.value, 1) # Ensure the path is set up correctly self.assertEqual(sorted(foo.__path__), sorted([os.path.join(dirname_0, pkgname), os.path.join(dirname_1, pkgname)])) # Cleanup shutil.rmtree(dirname_0) shutil.rmtree(dirname_1) del sys.path[0] del sys.path[0] del sys.modules['foo'] del sys.modules['foo.bar'] del sys.modules['foo.baz'] # XXX: test .pkg files class NestedNamespacePackageTest(unittest.TestCase): def setUp(self): self.basedir = tempfile.mkdtemp() self.old_path = sys.path[:] def tearDown(self): sys.path[:] = self.old_path shutil.rmtree(self.basedir) def create_module(self, name, contents): base, final = name.rsplit('.', 1) base_path = os.path.join(self.basedir, base.replace('.', os.path.sep)) os.makedirs(base_path, exist_ok=True) with open(os.path.join(base_path, final + ".py"), 'w') as f: f.write(contents) def test_nested(self): pkgutil_boilerplate = ( 'import pkgutil; ' '__path__ = pkgutil.extend_path(__path__, __name__)') self.create_module('a.pkg.__init__', pkgutil_boilerplate) self.create_module('b.pkg.__init__', pkgutil_boilerplate) self.create_module('a.pkg.subpkg.__init__', pkgutil_boilerplate) self.create_module('b.pkg.subpkg.__init__', pkgutil_boilerplate) self.create_module('a.pkg.subpkg.c', 'c = 1') self.create_module('b.pkg.subpkg.d', 'd = 2') sys.path.insert(0, os.path.join(self.basedir, 'a')) sys.path.insert(0, os.path.join(self.basedir, 'b')) import pkg self.addCleanup(unload, 'pkg') self.assertEqual(len(pkg.__path__), 2) import pkg.subpkg self.addCleanup(unload, 'pkg.subpkg') self.assertEqual(len(pkg.subpkg.__path__), 2) from pkg.subpkg.c import c from pkg.subpkg.d import d self.assertEqual(c, 1) self.assertEqual(d, 2) class ImportlibMigrationTests(unittest.TestCase): # With full PEP 302 support in the standard import machinery, the # PEP 302 emulation in this module is in the process of being # deprecated in favour of importlib proper def check_deprecated(self): return check_warnings( ("This emulation is deprecated, use 'importlib' instead", DeprecationWarning)) def test_importer_deprecated(self): with self.check_deprecated(): pkgutil.ImpImporter("") def test_loader_deprecated(self): with self.check_deprecated(): pkgutil.ImpLoader("", "", "", "") def test_get_loader_avoids_emulation(self): with check_warnings() as w: self.assertIsNotNone(pkgutil.get_loader("sys")) self.assertIsNotNone(pkgutil.get_loader("os")) self.assertIsNotNone(pkgutil.get_loader("test.support")) self.assertEqual(len(w.warnings), 0) @unittest.skipIf(__name__ == '__main__', 'not compatible with __main__') def test_get_loader_handles_missing_loader_attribute(self): global __loader__ this_loader = __loader__ del __loader__ try: with check_warnings() as w: self.assertIsNotNone(pkgutil.get_loader(__name__)) self.assertEqual(len(w.warnings), 0) finally: __loader__ = this_loader def test_get_loader_handles_missing_spec_attribute(self): name = 'spam' mod = type(sys)(name) del mod.__spec__ with CleanImport(name): sys.modules[name] = mod loader = pkgutil.get_loader(name) self.assertIsNone(loader) def test_get_loader_handles_spec_attribute_none(self): name = 'spam' mod = type(sys)(name) mod.__spec__ = None with CleanImport(name): sys.modules[name] = mod loader = pkgutil.get_loader(name) self.assertIsNone(loader) def test_get_loader_None_in_sys_modules(self): name = 'totally bogus' sys.modules[name] = None try: loader = pkgutil.get_loader(name) finally: del sys.modules[name] self.assertIsNone(loader) def test_find_loader_missing_module(self): name = 'totally bogus' loader = pkgutil.find_loader(name) self.assertIsNone(loader) def test_find_loader_avoids_emulation(self): with check_warnings() as w: self.assertIsNotNone(pkgutil.find_loader("sys")) self.assertIsNotNone(pkgutil.find_loader("os")) self.assertIsNotNone(pkgutil.find_loader("test.support")) self.assertEqual(len(w.warnings), 0) def test_get_importer_avoids_emulation(self): # We use an illegal path so *none* of the path hooks should fire with check_warnings() as w: self.assertIsNone(pkgutil.get_importer("*??")) self.assertEqual(len(w.warnings), 0) def test_iter_importers_avoids_emulation(self): with check_warnings() as w: for importer in pkgutil.iter_importers(): pass self.assertEqual(len(w.warnings), 0) def test_main(): run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests, NestedNamespacePackageTest, ImportlibMigrationTests) # this is necessary if test is run repeated (like when finding leaks) import zipimport import importlib zipimport._zip_directory_cache.clear() importlib.invalidate_caches() if __name__ == '__main__': test_main()
17,684
492
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_doctest.py
""" Test script for doctest. """ from test import support import doctest import functools import os import sys # NOTE: There are some additional tests relating to interaction with # zipimport in the test_zipimport_support test module. ###################################################################### ## Sample Objects (used by test cases) ###################################################################### def sample_func(v): """ Blah blah >>> print(sample_func(22)) 44 Yee ha! """ return v+v class SampleClass: """ >>> print(1) 1 >>> # comments get ignored. so are empty PS1 and PS2 prompts: >>> ... Multiline example: >>> sc = SampleClass(3) >>> for i in range(10): ... sc = sc.double() ... print(' ', sc.get(), sep='', end='') 6 12 24 48 96 192 384 768 1536 3072 """ def __init__(self, val): """ >>> print(SampleClass(12).get()) 12 """ self.val = val def double(self): """ >>> print(SampleClass(12).double().get()) 24 """ return SampleClass(self.val + self.val) def get(self): """ >>> print(SampleClass(-5).get()) -5 """ return self.val def a_staticmethod(v): """ >>> print(SampleClass.a_staticmethod(10)) 11 """ return v+1 a_staticmethod = staticmethod(a_staticmethod) def a_classmethod(cls, v): """ >>> print(SampleClass.a_classmethod(10)) 12 >>> print(SampleClass(0).a_classmethod(10)) 12 """ return v+2 a_classmethod = classmethod(a_classmethod) a_property = property(get, doc=""" >>> print(SampleClass(22).a_property) 22 """) class NestedClass: """ >>> x = SampleClass.NestedClass(5) >>> y = x.square() >>> print(y.get()) 25 """ def __init__(self, val=0): """ >>> print(SampleClass.NestedClass().get()) 0 """ self.val = val def square(self): return SampleClass.NestedClass(self.val*self.val) def get(self): return self.val class SampleNewStyleClass(object): r""" >>> print('1\n2\n3') 1 2 3 """ def __init__(self, val): """ >>> print(SampleNewStyleClass(12).get()) 12 """ self.val = val def double(self): """ >>> print(SampleNewStyleClass(12).double().get()) 24 """ return SampleNewStyleClass(self.val + self.val) def get(self): """ >>> print(SampleNewStyleClass(-5).get()) -5 """ return self.val ###################################################################### ## Fake stdin (for testing interactive debugging) ###################################################################### class _FakeInput: """ A fake input stream for pdb's interactive debugger. Whenever a line is read, print it (to simulate the user typing it), and then return it. The set of lines to return is specified in the constructor; they should not have trailing newlines. """ def __init__(self, lines): self.lines = lines def readline(self): line = self.lines.pop(0) print(line) return line+'\n' ###################################################################### ## Test Cases ###################################################################### def test_Example(): r""" Unit tests for the `Example` class. Example is a simple container class that holds: - `source`: A source string. - `want`: An expected output string. - `exc_msg`: An expected exception message string (or None if no exception is expected). - `lineno`: A line number (within the docstring). - `indent`: The example's indentation in the input string. - `options`: An option dictionary, mapping option flags to True or False. These attributes are set by the constructor. `source` and `want` are required; the other attributes all have default values: >>> example = doctest.Example('print(1)', '1\n') >>> (example.source, example.want, example.exc_msg, ... example.lineno, example.indent, example.options) ('print(1)\n', '1\n', None, 0, 0, {}) The first three attributes (`source`, `want`, and `exc_msg`) may be specified positionally; the remaining arguments should be specified as keyword arguments: >>> exc_msg = 'IndexError: pop from an empty list' >>> example = doctest.Example('[].pop()', '', exc_msg, ... lineno=5, indent=4, ... options={doctest.ELLIPSIS: True}) >>> (example.source, example.want, example.exc_msg, ... example.lineno, example.indent, example.options) ('[].pop()\n', '', 'IndexError: pop from an empty list\n', 5, 4, {8: True}) The constructor normalizes the `source` string to end in a newline: Source spans a single line: no terminating newline. >>> e = doctest.Example('print(1)', '1\n') >>> e.source, e.want ('print(1)\n', '1\n') >>> e = doctest.Example('print(1)\n', '1\n') >>> e.source, e.want ('print(1)\n', '1\n') Source spans multiple lines: require terminating newline. >>> e = doctest.Example('print(1);\nprint(2)\n', '1\n2\n') >>> e.source, e.want ('print(1);\nprint(2)\n', '1\n2\n') >>> e = doctest.Example('print(1);\nprint(2)', '1\n2\n') >>> e.source, e.want ('print(1);\nprint(2)\n', '1\n2\n') Empty source string (which should never appear in real examples) >>> e = doctest.Example('', '') >>> e.source, e.want ('\n', '') The constructor normalizes the `want` string to end in a newline, unless it's the empty string: >>> e = doctest.Example('print(1)', '1\n') >>> e.source, e.want ('print(1)\n', '1\n') >>> e = doctest.Example('print(1)', '1') >>> e.source, e.want ('print(1)\n', '1\n') >>> e = doctest.Example('print', '') >>> e.source, e.want ('print\n', '') The constructor normalizes the `exc_msg` string to end in a newline, unless it's `None`: Message spans one line >>> exc_msg = 'IndexError: pop from an empty list' >>> e = doctest.Example('[].pop()', '', exc_msg) >>> e.exc_msg 'IndexError: pop from an empty list\n' >>> exc_msg = 'IndexError: pop from an empty list\n' >>> e = doctest.Example('[].pop()', '', exc_msg) >>> e.exc_msg 'IndexError: pop from an empty list\n' Message spans multiple lines >>> exc_msg = 'ValueError: 1\n 2' >>> e = doctest.Example('raise ValueError("1\n 2")', '', exc_msg) >>> e.exc_msg 'ValueError: 1\n 2\n' >>> exc_msg = 'ValueError: 1\n 2\n' >>> e = doctest.Example('raise ValueError("1\n 2")', '', exc_msg) >>> e.exc_msg 'ValueError: 1\n 2\n' Empty (but non-None) exception message (which should never appear in real examples) >>> exc_msg = '' >>> e = doctest.Example('raise X()', '', exc_msg) >>> e.exc_msg '\n' Compare `Example`: >>> example = doctest.Example('print 1', '1\n') >>> same_example = doctest.Example('print 1', '1\n') >>> other_example = doctest.Example('print 42', '42\n') >>> example == same_example True >>> example != same_example False >>> hash(example) == hash(same_example) True >>> example == other_example False >>> example != other_example True """ def test_DocTest(): r""" Unit tests for the `DocTest` class. DocTest is a collection of examples, extracted from a docstring, along with information about where the docstring comes from (a name, filename, and line number). The docstring is parsed by the `DocTest` constructor: >>> docstring = ''' ... >>> print(12) ... 12 ... ... Non-example text. ... ... >>> print('another\\example') ... another ... example ... ''' >>> globs = {} # globals to run the test in. >>> parser = doctest.DocTestParser() >>> test = parser.get_doctest(docstring, globs, 'some_test', ... 'some_file', 20) >>> print(test) <DocTest some_test from some_file:20 (2 examples)> >>> len(test.examples) 2 >>> e1, e2 = test.examples >>> (e1.source, e1.want, e1.lineno) ('print(12)\n', '12\n', 1) >>> (e2.source, e2.want, e2.lineno) ("print('another\\example')\n", 'another\nexample\n', 6) Source information (name, filename, and line number) is available as attributes on the doctest object: >>> (test.name, test.filename, test.lineno) ('some_test', 'some_file', 20) The line number of an example within its containing file is found by adding the line number of the example and the line number of its containing test: >>> test.lineno + e1.lineno 21 >>> test.lineno + e2.lineno 26 If the docstring contains inconsistent leading whitespace in the expected output of an example, then `DocTest` will raise a ValueError: >>> docstring = r''' ... >>> print('bad\nindentation') ... bad ... indentation ... ''' >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) Traceback (most recent call last): ValueError: line 4 of the docstring for some_test has inconsistent leading whitespace: 'indentation' If the docstring contains inconsistent leading whitespace on continuation lines, then `DocTest` will raise a ValueError: >>> docstring = r''' ... >>> print(('bad indentation', ... ... 2)) ... ('bad', 'indentation') ... ''' >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) Traceback (most recent call last): ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '... 2))' If there's no blank space after a PS1 prompt ('>>>'), then `DocTest` will raise a ValueError: >>> docstring = '>>>print(1)\n1' >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) Traceback (most recent call last): ValueError: line 1 of the docstring for some_test lacks blank after >>>: '>>>print(1)' If there's no blank space after a PS2 prompt ('...'), then `DocTest` will raise a ValueError: >>> docstring = '>>> if 1:\n...print(1)\n1' >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0) Traceback (most recent call last): ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print(1)' Compare `DocTest`: >>> docstring = ''' ... >>> print 12 ... 12 ... ''' >>> test = parser.get_doctest(docstring, globs, 'some_test', ... 'some_test', 20) >>> same_test = parser.get_doctest(docstring, globs, 'some_test', ... 'some_test', 20) >>> test == same_test True >>> test != same_test False >>> hash(test) == hash(same_test) True >>> docstring = ''' ... >>> print 42 ... 42 ... ''' >>> other_test = parser.get_doctest(docstring, globs, 'other_test', ... 'other_file', 10) >>> test == other_test False >>> test != other_test True Compare `DocTestCase`: >>> DocTestCase = doctest.DocTestCase >>> test_case = DocTestCase(test) >>> same_test_case = DocTestCase(same_test) >>> other_test_case = DocTestCase(other_test) >>> test_case == same_test_case True >>> test_case != same_test_case False >>> hash(test_case) == hash(same_test_case) True >>> test == other_test_case False >>> test != other_test_case True """ class test_DocTestFinder: def basics(): r""" Unit tests for the `DocTestFinder` class. DocTestFinder is used to extract DocTests from an object's docstring and the docstrings of its contained objects. It can be used with modules, functions, classes, methods, staticmethods, classmethods, and properties. Finding Tests in Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~ For a function whose docstring contains examples, DocTestFinder.find() will return a single test (for that function's docstring): >>> finder = doctest.DocTestFinder() We'll simulate a __file__ attr that ends in pyc: >>> import test.test_doctest >>> old = test.test_doctest.__file__ >>> test.test_doctest.__file__ = 'test_doctest.pyc' >>> tests = finder.find(sample_func) >>> print(tests) # doctest: +ELLIPSIS [<DocTest sample_func from ...:19 (1 example)>] The exact name depends on how test_doctest was invoked, so allow for leading path components. >>> tests[0].filename # doctest: +ELLIPSIS '...test_doctest.py' >>> test.test_doctest.__file__ = old >>> e = tests[0].examples[0] >>> (e.source, e.want, e.lineno) ('print(sample_func(22))\n', '44\n', 3) By default, tests are created for objects with no docstring: >>> def no_docstring(v): ... pass >>> finder.find(no_docstring) [] However, the optional argument `exclude_empty` to the DocTestFinder constructor can be used to exclude tests for objects with empty docstrings: >>> def no_docstring(v): ... pass >>> excl_empty_finder = doctest.DocTestFinder(exclude_empty=True) >>> excl_empty_finder.find(no_docstring) [] If the function has a docstring with no examples, then a test with no examples is returned. (This lets `DocTestRunner` collect statistics about which functions have no tests -- but is that useful? And should an empty test also be created when there's no docstring?) >>> def no_examples(v): ... ''' no doctest examples ''' >>> finder.find(no_examples) # doctest: +ELLIPSIS [<DocTest no_examples from ...:1 (no examples)>] Finding Tests in Classes ~~~~~~~~~~~~~~~~~~~~~~~~ For a class, DocTestFinder will create a test for the class's docstring, and will recursively explore its contents, including methods, classmethods, staticmethods, properties, and nested classes. >>> finder = doctest.DocTestFinder() >>> tests = finder.find(SampleClass) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 3 SampleClass 3 SampleClass.NestedClass 1 SampleClass.NestedClass.__init__ 1 SampleClass.__init__ 2 SampleClass.a_classmethod 1 SampleClass.a_property 1 SampleClass.a_staticmethod 1 SampleClass.double 1 SampleClass.get New-style classes are also supported: >>> tests = finder.find(SampleNewStyleClass) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 1 SampleNewStyleClass 1 SampleNewStyleClass.__init__ 1 SampleNewStyleClass.double 1 SampleNewStyleClass.get Finding Tests in Modules ~~~~~~~~~~~~~~~~~~~~~~~~ For a module, DocTestFinder will create a test for the class's docstring, and will recursively explore its contents, including functions, classes, and the `__test__` dictionary, if it exists: >>> # A module >>> import types >>> m = types.ModuleType('some_module') >>> def triple(val): ... ''' ... >>> print(triple(11)) ... 33 ... ''' ... return val*3 >>> m.__dict__.update({ ... 'sample_func': sample_func, ... 'SampleClass': SampleClass, ... '__doc__': ''' ... Module docstring. ... >>> print('module') ... module ... ''', ... '__test__': { ... 'd': '>>> print(6)\n6\n>>> print(7)\n7\n', ... 'c': triple}}) >>> finder = doctest.DocTestFinder() >>> # Use module=test.test_doctest, to prevent doctest from >>> # ignoring the objects since they weren't defined in m. >>> import test.test_doctest >>> tests = finder.find(m, module=test.test_doctest) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 1 some_module 3 some_module.SampleClass 3 some_module.SampleClass.NestedClass 1 some_module.SampleClass.NestedClass.__init__ 1 some_module.SampleClass.__init__ 2 some_module.SampleClass.a_classmethod 1 some_module.SampleClass.a_property 1 some_module.SampleClass.a_staticmethod 1 some_module.SampleClass.double 1 some_module.SampleClass.get 1 some_module.__test__.c 2 some_module.__test__.d 1 some_module.sample_func Duplicate Removal ~~~~~~~~~~~~~~~~~ If a single object is listed twice (under different names), then tests will only be generated for it once: >>> from test import doctest_aliases >>> assert doctest_aliases.TwoNames.f >>> assert doctest_aliases.TwoNames.g >>> tests = excl_empty_finder.find(doctest_aliases) >>> print(len(tests)) 2 >>> print(tests[0].name) test.doctest_aliases.TwoNames TwoNames.f and TwoNames.g are bound to the same object. We can't guess which will be found in doctest's traversal of TwoNames.__dict__ first, so we have to allow for either. >>> tests[1].name.split('.')[-1] in ['f', 'g'] True Empty Tests ~~~~~~~~~~~ By default, an object with no doctests doesn't create any tests: >>> tests = doctest.DocTestFinder().find(SampleClass) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 3 SampleClass 3 SampleClass.NestedClass 1 SampleClass.NestedClass.__init__ 1 SampleClass.__init__ 2 SampleClass.a_classmethod 1 SampleClass.a_property 1 SampleClass.a_staticmethod 1 SampleClass.double 1 SampleClass.get By default, that excluded objects with no doctests. exclude_empty=False tells it to include (empty) tests for objects with no doctests. This feature is really to support backward compatibility in what doctest.master.summarize() displays. >>> tests = doctest.DocTestFinder(exclude_empty=False).find(SampleClass) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 3 SampleClass 3 SampleClass.NestedClass 1 SampleClass.NestedClass.__init__ 0 SampleClass.NestedClass.get 0 SampleClass.NestedClass.square 1 SampleClass.__init__ 2 SampleClass.a_classmethod 1 SampleClass.a_property 1 SampleClass.a_staticmethod 1 SampleClass.double 1 SampleClass.get Turning off Recursion ~~~~~~~~~~~~~~~~~~~~~ DocTestFinder can be told not to look for tests in contained objects using the `recurse` flag: >>> tests = doctest.DocTestFinder(recurse=False).find(SampleClass) >>> for t in tests: ... print('%2s %s' % (len(t.examples), t.name)) 3 SampleClass Line numbers ~~~~~~~~~~~~ DocTestFinder finds the line number of each example: >>> def f(x): ... ''' ... >>> x = 12 ... ... some text ... ... >>> # examples are not created for comments & bare prompts. ... >>> ... ... ... ... >>> for x in range(10): ... ... print(x, end=' ') ... 0 1 2 3 4 5 6 7 8 9 ... >>> x//2 ... 6 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> [e.lineno for e in test.examples] [1, 9, 12] """ if int.__doc__: # simple check for --without-doc-strings, skip if lacking def non_Python_modules(): r""" Finding Doctests in Modules Not Written in Python ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DocTestFinder can also find doctests in most modules not written in Python. We'll use builtins as an example, since it almost certainly isn't written in plain ol' Python and is guaranteed to be available. >>> import builtins >>> tests = doctest.DocTestFinder().find(builtins) >>> 790 < len(tests) < 810 # approximate number of objects with docstrings True >>> real_tests = [t for t in tests if len(t.examples) > 0] >>> len(real_tests) # objects that actually have doctests 9 >>> for t in real_tests: ... print('{} {}'.format(len(t.examples), t.name)) ... 1 builtins.bin 3 builtins.float.as_integer_ratio 2 builtins.float.fromhex 2 builtins.float.hex 1 builtins.hex 1 builtins.int 2 builtins.int.bit_count 2 builtins.int.bit_length 1 builtins.oct Note here that 'bin', 'oct', and 'hex' are functions; 'float.as_integer_ratio', 'float.hex', and 'int.bit_length' are methods; 'float.fromhex' is a classmethod, and 'int' is a type. """ def test_DocTestParser(): r""" Unit tests for the `DocTestParser` class. DocTestParser is used to parse docstrings containing doctest examples. The `parse` method divides a docstring into examples and intervening text: >>> s = ''' ... >>> x, y = 2, 3 # no output expected ... >>> if 1: ... ... print(x) ... ... print(y) ... 2 ... 3 ... ... Some text. ... >>> x+y ... 5 ... ''' >>> parser = doctest.DocTestParser() >>> for piece in parser.parse(s): ... if isinstance(piece, doctest.Example): ... print('Example:', (piece.source, piece.want, piece.lineno)) ... else: ... print(' Text:', repr(piece)) Text: '\n' Example: ('x, y = 2, 3 # no output expected\n', '', 1) Text: '' Example: ('if 1:\n print(x)\n print(y)\n', '2\n3\n', 2) Text: '\nSome text.\n' Example: ('x+y\n', '5\n', 9) Text: '' The `get_examples` method returns just the examples: >>> for piece in parser.get_examples(s): ... print((piece.source, piece.want, piece.lineno)) ('x, y = 2, 3 # no output expected\n', '', 1) ('if 1:\n print(x)\n print(y)\n', '2\n3\n', 2) ('x+y\n', '5\n', 9) The `get_doctest` method creates a Test from the examples, along with the given arguments: >>> test = parser.get_doctest(s, {}, 'name', 'filename', lineno=5) >>> (test.name, test.filename, test.lineno) ('name', 'filename', 5) >>> for piece in test.examples: ... print((piece.source, piece.want, piece.lineno)) ('x, y = 2, 3 # no output expected\n', '', 1) ('if 1:\n print(x)\n print(y)\n', '2\n3\n', 2) ('x+y\n', '5\n', 9) """ class test_DocTestRunner: def basics(): r""" Unit tests for the `DocTestRunner` class. DocTestRunner is used to run DocTest test cases, and to accumulate statistics. Here's a simple DocTest case we can use: >>> def f(x): ... ''' ... >>> x = 12 ... >>> print(x) ... 12 ... >>> x//2 ... 6 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] The main DocTestRunner interface is the `run` method, which runs a given DocTest case in a given namespace (globs). It returns a tuple `(f,t)`, where `f` is the number of failed tests and `t` is the number of tried tests. >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=3) If any example produces incorrect output, then the test runner reports the failure and proceeds to the next example: >>> def f(x): ... ''' ... >>> x = 12 ... >>> print(x) ... 14 ... >>> x//2 ... 6 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=True).run(test) ... # doctest: +ELLIPSIS Trying: x = 12 Expecting nothing ok Trying: print(x) Expecting: 14 ********************************************************************** File ..., line 4, in f Failed example: print(x) Expected: 14 Got: 12 Trying: x//2 Expecting: 6 ok TestResults(failed=1, attempted=3) """ def verbose_flag(): r""" The `verbose` flag makes the test runner generate more detailed output: >>> def f(x): ... ''' ... >>> x = 12 ... >>> print(x) ... 12 ... >>> x//2 ... 6 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=True).run(test) Trying: x = 12 Expecting nothing ok Trying: print(x) Expecting: 12 ok Trying: x//2 Expecting: 6 ok TestResults(failed=0, attempted=3) If the `verbose` flag is unspecified, then the output will be verbose iff `-v` appears in sys.argv: >>> # Save the real sys.argv list. >>> old_argv = sys.argv >>> # If -v does not appear in sys.argv, then output isn't verbose. >>> sys.argv = ['test'] >>> doctest.DocTestRunner().run(test) TestResults(failed=0, attempted=3) >>> # If -v does appear in sys.argv, then output is verbose. >>> sys.argv = ['test', '-v'] >>> doctest.DocTestRunner().run(test) Trying: x = 12 Expecting nothing ok Trying: print(x) Expecting: 12 ok Trying: x//2 Expecting: 6 ok TestResults(failed=0, attempted=3) >>> # Restore sys.argv >>> sys.argv = old_argv In the remaining examples, the test runner's verbosity will be explicitly set, to ensure that the test behavior is consistent. """ def exceptions(): r""" Tests of `DocTestRunner`'s exception handling. An expected exception is specified with a traceback message. The lines between the first line and the type/value may be omitted or replaced with any other string: >>> def f(x): ... ''' ... >>> x = 12 ... >>> print(x//0) ... Traceback (most recent call last): ... ZeroDivisionError: integer division or modulo by zero ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) An example may not generate output before it raises an exception; if it does, then the traceback message will not be recognized as signaling an expected exception, so the example will be reported as an unexpected exception: >>> def f(x): ... ''' ... >>> x = 12 ... >>> print('pre-exception output', x//0) ... pre-exception output ... Traceback (most recent call last): ... ZeroDivisionError: integer division or modulo by zero ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 4, in f Failed example: print('pre-exception output', x//0) Exception raised: ... ZeroDivisionError: integer division or modulo by zero TestResults(failed=1, attempted=2) Exception messages may contain newlines: >>> def f(x): ... r''' ... >>> raise ValueError('multi\nline\nmessage') ... Traceback (most recent call last): ... ValueError: multi ... line ... message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) If an exception is expected, but an exception with the wrong type or message is raised, then it is reported as a failure: >>> def f(x): ... r''' ... >>> raise ValueError('message') ... Traceback (most recent call last): ... ValueError: wrong message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: raise ValueError('message') Expected: Traceback (most recent call last): ValueError: wrong message Got: Traceback (most recent call last): ... ValueError: message TestResults(failed=1, attempted=1) However, IGNORE_EXCEPTION_DETAIL can be used to allow a mismatch in the detail: >>> def f(x): ... r''' ... >>> raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... ValueError: wrong message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) IGNORE_EXCEPTION_DETAIL also ignores difference in exception formatting between Python versions. For example, in Python 2.x, the module path of the exception is not in the output, but this will fail under Python 3: >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException('message') ... Traceback (most recent call last): ... HTTPException: message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 4, in f Failed example: raise HTTPException('message') Expected: Traceback (most recent call last): HTTPException: message Got: Traceback (most recent call last): ... http.client.HTTPException: message TestResults(failed=1, attempted=2) But in Python 3 the module path is included, and therefore a test must look like the following test to succeed in Python 3. But that test will fail under Python 2. >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException('message') ... Traceback (most recent call last): ... http.client.HTTPException: message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) However, with IGNORE_EXCEPTION_DETAIL, the module name of the exception (or its unexpected absence) will be ignored: >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException('message') #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... HTTPException: message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) The module path will be completely ignored, so two different module paths will still pass if IGNORE_EXCEPTION_DETAIL is given. This is intentional, so it can be used when exceptions have changed module. >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException('message') #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... foo.bar.HTTPException: message ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) But IGNORE_EXCEPTION_DETAIL does not allow a mismatch in the exception type: >>> def f(x): ... r''' ... >>> raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... TypeError: wrong type ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL Expected: Traceback (most recent call last): TypeError: wrong type Got: Traceback (most recent call last): ... ValueError: message TestResults(failed=1, attempted=1) If the exception does not have a message, you can still use IGNORE_EXCEPTION_DETAIL to normalize the modules between Python 2 and 3: >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException() #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... foo.bar.HTTPException ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) Note that a trailing colon doesn't matter either: >>> def f(x): ... r''' ... >>> from http.client import HTTPException ... >>> raise HTTPException() #doctest: +IGNORE_EXCEPTION_DETAIL ... Traceback (most recent call last): ... foo.bar.HTTPException: ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) If an exception is raised but not expected, then it is reported as an unexpected exception: >>> def f(x): ... r''' ... >>> 1//0 ... 0 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: 1//0 Exception raised: Traceback (most recent call last): ... ZeroDivisionError: integer division or modulo by zero TestResults(failed=1, attempted=1) """ def displayhook(): r""" Test that changing sys.displayhook doesn't matter for doctest. >>> import sys >>> orig_displayhook = sys.displayhook >>> def my_displayhook(x): ... print('hi!') >>> sys.displayhook = my_displayhook >>> def f(): ... ''' ... >>> 3 ... 3 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> r = doctest.DocTestRunner(verbose=False).run(test) >>> post_displayhook = sys.displayhook We need to restore sys.displayhook now, so that we'll be able to test results. >>> sys.displayhook = orig_displayhook Ok, now we can check that everything is ok. >>> r TestResults(failed=0, attempted=1) >>> post_displayhook is my_displayhook True """ def optionflags(): r""" Tests of `DocTestRunner`'s option flag handling. Several option flags can be used to customize the behavior of the test runner. These are defined as module constants in doctest, and passed to the DocTestRunner constructor (multiple constants should be ORed together). The DONT_ACCEPT_TRUE_FOR_1 flag disables matches between True/False and 1/0: >>> def f(x): ... '>>> True\n1\n' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) >>> # With the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.DONT_ACCEPT_TRUE_FOR_1 >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: True Expected: 1 Got: True TestResults(failed=1, attempted=1) The DONT_ACCEPT_BLANKLINE flag disables the match between blank lines and the '<BLANKLINE>' marker: >>> def f(x): ... '>>> print("a\\n\\nb")\na\n<BLANKLINE>\nb\n' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) >>> # With the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.DONT_ACCEPT_BLANKLINE >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print("a\n\nb") Expected: a <BLANKLINE> b Got: a <BLANKLINE> b TestResults(failed=1, attempted=1) The NORMALIZE_WHITESPACE flag causes all sequences of whitespace to be treated as equal: >>> def f(x): ... '>>> print(1, 2, 3)\n 1 2\n 3' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(1, 2, 3) Expected: 1 2 3 Got: 1 2 3 TestResults(failed=1, attempted=1) >>> # With the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.NORMALIZE_WHITESPACE >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) TestResults(failed=0, attempted=1) An example from the docs: >>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] The ELLIPSIS flag causes ellipsis marker ("...") in the expected output to match any substring in the actual output: >>> def f(x): ... '>>> print(list(range(15)))\n[0, 1, 2, ..., 14]\n' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(15))) Expected: [0, 1, 2, ..., 14] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] TestResults(failed=1, attempted=1) >>> # With the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.ELLIPSIS >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) TestResults(failed=0, attempted=1) ... also matches nothing: >>> if 1: ... for i in range(100): ... print(i**2, end=' ') #doctest: +ELLIPSIS ... print('!') 0 1...4...9 16 ... 36 49 64 ... 9801 ! ... can be surprising; e.g., this test passes: >>> if 1: #doctest: +ELLIPSIS ... for i in range(20): ... print(i, end=' ') ... print(20) 0 1 2 ...1...2...0 Examples from the docs: >>> print(list(range(20))) # doctest:+ELLIPSIS [0, 1, ..., 18, 19] >>> print(list(range(20))) # doctest: +ELLIPSIS ... # doctest: +NORMALIZE_WHITESPACE [0, 1, ..., 18, 19] The SKIP flag causes an example to be skipped entirely. I.e., the example is not run. It can be useful in contexts where doctest examples serve as both documentation and test cases, and an example should be included for documentation purposes, but should not be checked (e.g., because its output is random, or depends on resources which would be unavailable.) The SKIP flag can also be used for 'commenting out' broken examples. >>> import unavailable_resource # doctest: +SKIP >>> unavailable_resource.do_something() # doctest: +SKIP >>> unavailable_resource.blow_up() # doctest: +SKIP Traceback (most recent call last): ... UncheckedBlowUpError: Nobody checks me. >>> import random >>> print(random.random()) # doctest: +SKIP 0.721216923889 The REPORT_UDIFF flag causes failures that involve multi-line expected and actual outputs to be displayed using a unified diff: >>> def f(x): ... r''' ... >>> print('\n'.join('abcdefg')) ... a ... B ... c ... d ... f ... g ... h ... ''' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: print('\n'.join('abcdefg')) Expected: a B c d f g h Got: a b c d e f g TestResults(failed=1, attempted=1) >>> # With the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.REPORT_UDIFF >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: print('\n'.join('abcdefg')) Differences (unified diff with -expected +actual): @@ -1,7 +1,7 @@ a -B +b c d +e f g -h TestResults(failed=1, attempted=1) The REPORT_CDIFF flag causes failures that involve multi-line expected and actual outputs to be displayed using a context diff: >>> # Reuse f() from the REPORT_UDIFF example, above. >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.REPORT_CDIFF >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: print('\n'.join('abcdefg')) Differences (context diff with expected followed by actual): *************** *** 1,7 **** a ! B c d f g - h --- 1,7 ---- a ! b c d + e f g TestResults(failed=1, attempted=1) The REPORT_NDIFF flag causes failures to use the difflib.Differ algorithm used by the popular ndiff.py utility. This does intraline difference marking, as well as interline differences. >>> def f(x): ... r''' ... >>> print("a b c d e f g h i j k l m") ... a b c d e f g h i j k 1 m ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.REPORT_NDIFF >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 3, in f Failed example: print("a b c d e f g h i j k l m") Differences (ndiff with -expected +actual): - a b c d e f g h i j k 1 m ? ^ + a b c d e f g h i j k l m ? + ++ ^ TestResults(failed=1, attempted=1) The REPORT_ONLY_FIRST_FAILURE suppresses result output after the first failing example: >>> def f(x): ... r''' ... >>> print(1) # first success ... 1 ... >>> print(2) # first failure ... 200 ... >>> print(3) # second failure ... 300 ... >>> print(4) # second success ... 4 ... >>> print(5) # third failure ... 500 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.REPORT_ONLY_FIRST_FAILURE >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 5, in f Failed example: print(2) # first failure Expected: 200 Got: 2 TestResults(failed=3, attempted=5) However, output from `report_start` is not suppressed: >>> doctest.DocTestRunner(verbose=True, optionflags=flags).run(test) ... # doctest: +ELLIPSIS Trying: print(1) # first success Expecting: 1 ok Trying: print(2) # first failure Expecting: 200 ********************************************************************** File ..., line 5, in f Failed example: print(2) # first failure Expected: 200 Got: 2 TestResults(failed=3, attempted=5) The FAIL_FAST flag causes the runner to exit after the first failing example, so subsequent examples are not even attempted: >>> flags = doctest.FAIL_FAST >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 5, in f Failed example: print(2) # first failure Expected: 200 Got: 2 TestResults(failed=1, attempted=2) Specifying both FAIL_FAST and REPORT_ONLY_FIRST_FAILURE is equivalent to FAIL_FAST only: >>> flags = doctest.FAIL_FAST | doctest.REPORT_ONLY_FIRST_FAILURE >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 5, in f Failed example: print(2) # first failure Expected: 200 Got: 2 TestResults(failed=1, attempted=2) For the purposes of both REPORT_ONLY_FIRST_FAILURE and FAIL_FAST, unexpected exceptions count as failures: >>> def f(x): ... r''' ... >>> print(1) # first success ... 1 ... >>> raise ValueError(2) # first failure ... 200 ... >>> print(3) # second failure ... 300 ... >>> print(4) # second success ... 4 ... >>> print(5) # third failure ... 500 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> flags = doctest.REPORT_ONLY_FIRST_FAILURE >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 5, in f Failed example: raise ValueError(2) # first failure Exception raised: ... ValueError: 2 TestResults(failed=3, attempted=5) >>> flags = doctest.FAIL_FAST >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 5, in f Failed example: raise ValueError(2) # first failure Exception raised: ... ValueError: 2 TestResults(failed=1, attempted=2) New option flags can also be registered, via register_optionflag(). Here we reach into doctest's internals a bit. >>> unlikely = "UNLIKELY_OPTION_NAME" >>> unlikely in doctest.OPTIONFLAGS_BY_NAME False >>> new_flag_value = doctest.register_optionflag(unlikely) >>> unlikely in doctest.OPTIONFLAGS_BY_NAME True Before 2.4.4/2.5, registering a name more than once erroneously created more than one flag value. Here we verify that's fixed: >>> redundant_flag_value = doctest.register_optionflag(unlikely) >>> redundant_flag_value == new_flag_value True Clean up. >>> del doctest.OPTIONFLAGS_BY_NAME[unlikely] """ def option_directives(): r""" Tests of `DocTestRunner`'s option directive mechanism. Option directives can be used to turn option flags on or off for a single example. To turn an option on for an example, follow that example with a comment of the form ``# doctest: +OPTION``: >>> def f(x): r''' ... >>> print(list(range(10))) # should fail: no ellipsis ... [0, 1, ..., 9] ... ... >>> print(list(range(10))) # doctest: +ELLIPSIS ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(10))) # should fail: no ellipsis Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=1, attempted=2) To turn an option off for an example, follow that example with a comment of the form ``# doctest: -OPTION``: >>> def f(x): r''' ... >>> print(list(range(10))) ... [0, 1, ..., 9] ... ... >>> # should fail: no ellipsis ... >>> print(list(range(10))) # doctest: -ELLIPSIS ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False, ... optionflags=doctest.ELLIPSIS).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 6, in f Failed example: print(list(range(10))) # doctest: -ELLIPSIS Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=1, attempted=2) Option directives affect only the example that they appear with; they do not change the options for surrounding examples: >>> def f(x): r''' ... >>> print(list(range(10))) # Should fail: no ellipsis ... [0, 1, ..., 9] ... ... >>> print(list(range(10))) # doctest: +ELLIPSIS ... [0, 1, ..., 9] ... ... >>> print(list(range(10))) # Should fail: no ellipsis ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(10))) # Should fail: no ellipsis Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ********************************************************************** File ..., line 8, in f Failed example: print(list(range(10))) # Should fail: no ellipsis Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=2, attempted=3) Multiple options may be modified by a single option directive. They may be separated by whitespace, commas, or both: >>> def f(x): r''' ... >>> print(list(range(10))) # Should fail ... [0, 1, ..., 9] ... >>> print(list(range(10))) # Should succeed ... ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(10))) # Should fail Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=1, attempted=2) >>> def f(x): r''' ... >>> print(list(range(10))) # Should fail ... [0, 1, ..., 9] ... >>> print(list(range(10))) # Should succeed ... ... # doctest: +ELLIPSIS,+NORMALIZE_WHITESPACE ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(10))) # Should fail Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=1, attempted=2) >>> def f(x): r''' ... >>> print(list(range(10))) # Should fail ... [0, 1, ..., 9] ... >>> print(list(range(10))) # Should succeed ... ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS ********************************************************************** File ..., line 2, in f Failed example: print(list(range(10))) # Should fail Expected: [0, 1, ..., 9] Got: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] TestResults(failed=1, attempted=2) The option directive may be put on the line following the source, as long as a continuation prompt is used: >>> def f(x): r''' ... >>> print(list(range(10))) ... ... # doctest: +ELLIPSIS ... [0, 1, ..., 9] ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) For examples with multi-line source, the option directive may appear at the end of any line: >>> def f(x): r''' ... >>> for x in range(10): # doctest: +ELLIPSIS ... ... print(' ', x, end='', sep='') ... 0 1 2 ... 9 ... ... >>> for x in range(10): ... ... print(' ', x, end='', sep='') # doctest: +ELLIPSIS ... 0 1 2 ... 9 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=2) If more than one line of an example with multi-line source has an option directive, then they are combined: >>> def f(x): r''' ... Should fail (option directive not on the last line): ... >>> for x in range(10): # doctest: +ELLIPSIS ... ... print(x, end=' ') # doctest: +NORMALIZE_WHITESPACE ... 0 1 2...9 ... ''' >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) TestResults(failed=0, attempted=1) It is an error to have a comment of the form ``# doctest:`` that is *not* followed by words of the form ``+OPTION`` or ``-OPTION``, where ``OPTION`` is an option that has been registered with `register_option`: >>> # Error: Option not registered >>> s = '>>> print(12) #doctest: +BADOPTION' >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) Traceback (most recent call last): ValueError: line 1 of the doctest for s has an invalid option: '+BADOPTION' >>> # Error: No + or - prefix >>> s = '>>> print(12) #doctest: ELLIPSIS' >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) Traceback (most recent call last): ValueError: line 1 of the doctest for s has an invalid option: 'ELLIPSIS' It is an error to use an option directive on a line that contains no source: >>> s = '>>> # doctest: +ELLIPSIS' >>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0) Traceback (most recent call last): ValueError: line 0 of the doctest for s has an option directive on a line with no example: '# doctest: +ELLIPSIS' """ def test_testsource(): r""" Unit tests for `testsource()`. The testsource() function takes a module and a name, finds the (first) test with that name in that module, and converts it to a script. The example code is converted to regular Python code. The surrounding words and expected output are converted to comments: >>> import test.test_doctest >>> name = 'test.test_doctest.sample_func' >>> print(doctest.testsource(test.test_doctest, name)) # Blah blah # print(sample_func(22)) # Expected: ## 44 # # Yee ha! <BLANKLINE> >>> name = 'test.test_doctest.SampleNewStyleClass' >>> print(doctest.testsource(test.test_doctest, name)) print('1\n2\n3') # Expected: ## 1 ## 2 ## 3 <BLANKLINE> >>> name = 'test.test_doctest.SampleClass.a_classmethod' >>> print(doctest.testsource(test.test_doctest, name)) print(SampleClass.a_classmethod(10)) # Expected: ## 12 print(SampleClass(0).a_classmethod(10)) # Expected: ## 12 <BLANKLINE> """ def test_debug(): r""" Create a docstring that we want to debug: >>> s = ''' ... >>> x = 12 ... >>> print(x) ... 12 ... ''' Create some fake stdin input, to feed to the debugger: >>> real_stdin = sys.stdin >>> sys.stdin = _FakeInput(['next', 'print(x)', 'continue']) Run the debugger on the docstring, and then restore sys.stdin. >>> try: doctest.debug_src(s) ... finally: sys.stdin = real_stdin > <string>(1)<module>() (Pdb) next 12 --Return-- > <string>(1)<module>()->None (Pdb) print(x) 12 (Pdb) continue """ if not hasattr(sys, 'gettrace') or not sys.gettrace(): def test_pdb_set_trace(): """Using pdb.set_trace from a doctest. You can use pdb.set_trace from a doctest. To do so, you must retrieve the set_trace function from the pdb module at the time you use it. The doctest module changes sys.stdout so that it can capture program output. It also temporarily replaces pdb.set_trace with a version that restores stdout. This is necessary for you to see debugger output. >>> doc = ''' ... >>> x = 42 ... >>> raise Exception('clé') ... Traceback (most recent call last): ... Exception: clé ... >>> import pdb; pdb.set_trace() ... ''' >>> parser = doctest.DocTestParser() >>> test = parser.get_doctest(doc, {}, "foo-bar@baz", "[email protected]", 0) >>> runner = doctest.DocTestRunner(verbose=False) To demonstrate this, we'll create a fake standard input that captures our debugger input: >>> real_stdin = sys.stdin >>> sys.stdin = _FakeInput([ ... 'print(x)', # print data defined by the example ... 'continue', # stop debugging ... '']) >>> try: runner.run(test) ... finally: sys.stdin = real_stdin --Return-- > <doctest foo-bar@baz[2]>(1)<module>()->None -> import pdb; pdb.set_trace() (Pdb) print(x) 42 (Pdb) continue TestResults(failed=0, attempted=3) You can also put pdb.set_trace in a function called from a test: >>> def calls_set_trace(): ... y=2 ... import pdb; pdb.set_trace() >>> doc = ''' ... >>> x=1 ... >>> calls_set_trace() ... ''' >>> test = parser.get_doctest(doc, globals(), "foo-bar@baz", "[email protected]", 0) >>> real_stdin = sys.stdin >>> sys.stdin = _FakeInput([ ... 'print(y)', # print data defined in the function ... 'up', # out of function ... 'print(x)', # print data defined by the example ... 'continue', # stop debugging ... '']) >>> try: ... runner.run(test) ... finally: ... sys.stdin = real_stdin --Return-- > <doctest test.test_doctest.test_pdb_set_trace[7]>(3)calls_set_trace()->None -> import pdb; pdb.set_trace() (Pdb) print(y) 2 (Pdb) up > <doctest foo-bar@baz[1]>(1)<module>() -> calls_set_trace() (Pdb) print(x) 1 (Pdb) continue TestResults(failed=0, attempted=2) During interactive debugging, source code is shown, even for doctest examples: >>> doc = ''' ... >>> def f(x): ... ... g(x*2) ... >>> def g(x): ... ... print(x+3) ... ... import pdb; pdb.set_trace() ... >>> f(3) ... ''' >>> test = parser.get_doctest(doc, globals(), "foo-bar@baz", "[email protected]", 0) >>> real_stdin = sys.stdin >>> sys.stdin = _FakeInput([ ... 'list', # list source from example 2 ... 'next', # return from g() ... 'list', # list source from example 1 ... 'next', # return from f() ... 'list', # list source from example 3 ... 'continue', # stop debugging ... '']) >>> try: runner.run(test) ... finally: sys.stdin = real_stdin ... # doctest: +NORMALIZE_WHITESPACE --Return-- > <doctest foo-bar@baz[1]>(3)g()->None -> import pdb; pdb.set_trace() (Pdb) list 1 def g(x): 2 print(x+3) 3 -> import pdb; pdb.set_trace() [EOF] (Pdb) next --Return-- > <doctest foo-bar@baz[0]>(2)f()->None -> g(x*2) (Pdb) list 1 def f(x): 2 -> g(x*2) [EOF] (Pdb) next --Return-- > <doctest foo-bar@baz[2]>(1)<module>()->None -> f(3) (Pdb) list 1 -> f(3) [EOF] (Pdb) continue ********************************************************************** File "[email protected]", line 7, in foo-bar@baz Failed example: f(3) Expected nothing Got: 9 TestResults(failed=1, attempted=3) """ def test_pdb_set_trace_nested(): """This illustrates more-demanding use of set_trace with nested functions. >>> class C(object): ... def calls_set_trace(self): ... y = 1 ... import pdb; pdb.set_trace() ... self.f1() ... y = 2 ... def f1(self): ... x = 1 ... self.f2() ... x = 2 ... def f2(self): ... z = 1 ... z = 2 >>> calls_set_trace = C().calls_set_trace >>> doc = ''' ... >>> a = 1 ... >>> calls_set_trace() ... ''' >>> parser = doctest.DocTestParser() >>> runner = doctest.DocTestRunner(verbose=False) >>> test = parser.get_doctest(doc, globals(), "foo-bar@baz", "[email protected]", 0) >>> real_stdin = sys.stdin >>> sys.stdin = _FakeInput([ ... 'print(y)', # print data defined in the function ... 'step', 'step', 'step', 'step', 'step', 'step', 'print(z)', ... 'up', 'print(x)', ... 'up', 'print(y)', ... 'up', 'print(foo)', ... 'continue', # stop debugging ... '']) >>> try: ... runner.run(test) ... finally: ... sys.stdin = real_stdin ... # doctest: +REPORT_NDIFF > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(5)calls_set_trace() -> self.f1() (Pdb) print(y) 1 (Pdb) step --Call-- > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(7)f1() -> def f1(self): (Pdb) step > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(8)f1() -> x = 1 (Pdb) step > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(9)f1() -> self.f2() (Pdb) step --Call-- > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(11)f2() -> def f2(self): (Pdb) step > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(12)f2() -> z = 1 (Pdb) step > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(13)f2() -> z = 2 (Pdb) print(z) 1 (Pdb) up > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(9)f1() -> self.f2() (Pdb) print(x) 1 (Pdb) up > <doctest test.test_doctest.test_pdb_set_trace_nested[0]>(5)calls_set_trace() -> self.f1() (Pdb) print(y) 1 (Pdb) up > <doctest foo-bar@baz[1]>(1)<module>() -> calls_set_trace() (Pdb) print(foo) *** NameError: name 'foo' is not defined (Pdb) continue TestResults(failed=0, attempted=2) """ def test_DocTestSuite(): """DocTestSuite creates a unittest test suite from a doctest. We create a Suite by providing a module. A module can be provided by passing a module object: >>> import unittest >>> import test.sample_doctest >>> suite = doctest.DocTestSuite(test.sample_doctest) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=4> We can also supply the module by name: >>> suite = doctest.DocTestSuite('test.sample_doctest') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=4> The module need not contain any doctest examples: >>> suite = doctest.DocTestSuite('test.sample_doctest_no_doctests') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=0 errors=0 failures=0> The module need not contain any docstrings either: >>> suite = doctest.DocTestSuite('test.sample_doctest_no_docstrings') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=0 errors=0 failures=0> We can use the current module: >>> suite = test.sample_doctest.test_suite() >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=4> We can also provide a DocTestFinder: >>> finder = doctest.DocTestFinder() >>> suite = doctest.DocTestSuite('test.sample_doctest', ... test_finder=finder) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=4> The DocTestFinder need not return any tests: >>> finder = doctest.DocTestFinder() >>> suite = doctest.DocTestSuite('test.sample_doctest_no_docstrings', ... test_finder=finder) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=0 errors=0 failures=0> We can supply global variables. If we pass globs, they will be used instead of the module globals. Here we'll pass an empty globals, triggering an extra error: >>> suite = doctest.DocTestSuite('test.sample_doctest', globs={}) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=5> Alternatively, we can provide extra globals. Here we'll make an error go away by providing an extra global variable: >>> suite = doctest.DocTestSuite('test.sample_doctest', ... extraglobs={'y': 1}) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=3> You can pass option flags. Here we'll cause an extra error by disabling the blank-line feature: >>> suite = doctest.DocTestSuite('test.sample_doctest', ... optionflags=doctest.DONT_ACCEPT_BLANKLINE) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=5> You can supply setUp and tearDown functions: >>> def setUp(t): ... import test.test_doctest ... test.test_doctest.sillySetup = True >>> def tearDown(t): ... import test.test_doctest ... del test.test_doctest.sillySetup Here, we installed a silly variable that the test expects: >>> suite = doctest.DocTestSuite('test.sample_doctest', ... setUp=setUp, tearDown=tearDown) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=3> But the tearDown restores sanity: >>> import test.test_doctest >>> test.test_doctest.sillySetup Traceback (most recent call last): ... AttributeError: module 'test.test_doctest' has no attribute 'sillySetup' The setUp and tearDown functions are passed test objects. Here we'll use the setUp function to supply the missing variable y: >>> def setUp(test): ... test.globs['y'] = 1 >>> suite = doctest.DocTestSuite('test.sample_doctest', setUp=setUp) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=9 errors=0 failures=3> Here, we didn't need to use a tearDown function because we modified the test globals, which are a copy of the sample_doctest module dictionary. The test globals are automatically cleared for us after a test. """ def test_DocFileSuite(): """We can test tests found in text files using a DocFileSuite. We create a suite by providing the names of one or more text files that include examples: >>> import unittest >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=2> The test files are looked for in the directory containing the calling module. A package keyword argument can be provided to specify a different relative location. >>> import unittest >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... package='test') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=2> Support for using a package's __loader__.get_data() is also provided. >>> import unittest, pkgutil, test >>> added_loader = False >>> if not hasattr(test, '__loader__'): ... test.__loader__ = pkgutil.get_loader(test) ... added_loader = True >>> try: ... suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... package='test') ... suite.run(unittest.TestResult()) ... finally: ... if added_loader: ... del test.__loader__ <unittest.result.TestResult run=3 errors=0 failures=2> '/' should be used as a path separator. It will be converted to a native separator at run time: >>> suite = doctest.DocFileSuite('test_doctest.txt') #TODO: path handling in APE ZIP store >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=1 errors=0 failures=1> If DocFileSuite is used from an interactive session, then files are resolved relative to the directory of sys.argv[0]: >>> import types, os.path, test.test_doctest >>> save_argv = sys.argv >>> sys.argv = [test.test_doctest.__file__] >>> suite = doctest.DocFileSuite('test_doctest.txt', ... package=types.ModuleType('__main__')) >>> sys.argv = save_argv By setting `module_relative=False`, os-specific paths may be used (including absolute paths and paths relative to the working directory): >>> # Get the absolute path of the test package. >>> test_doctest_path = os.path.abspath(test.test_doctest.__file__) >>> test_pkg_path = os.path.split(test_doctest_path)[0] >>> # Use it to find the absolute path of test_doctest.txt. >>> test_file = os.path.join(test_pkg_path, 'test_doctest.txt') >>> suite = doctest.DocFileSuite(test_file, module_relative=False) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=1 errors=0 failures=1> It is an error to specify `package` when `module_relative=False`: >>> suite = doctest.DocFileSuite(test_file, module_relative=False, ... package='test') Traceback (most recent call last): ValueError: Package may only be specified for module-relative paths. You can specify initial global variables: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... globs={'favorite_color': 'blue'}) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=1> In this case, we supplied a missing favorite color. You can provide doctest options: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... optionflags=doctest.DONT_ACCEPT_BLANKLINE, ... globs={'favorite_color': 'blue'}) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=2> And, you can provide setUp and tearDown functions: >>> def setUp(t): ... import test.test_doctest ... test.test_doctest.sillySetup = True >>> def tearDown(t): ... import test.test_doctest ... del test.test_doctest.sillySetup Here, we installed a silly variable that the test expects: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... setUp=setUp, tearDown=tearDown) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=1> But the tearDown restores sanity: >>> import test.test_doctest >>> test.test_doctest.sillySetup Traceback (most recent call last): ... AttributeError: module 'test.test_doctest' has no attribute 'sillySetup' The setUp and tearDown functions are passed test objects. Here, we'll use a setUp function to set the favorite color in test_doctest.txt: >>> def setUp(test): ... test.globs['favorite_color'] = 'blue' >>> suite = doctest.DocFileSuite('test_doctest.txt', setUp=setUp) >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=1 errors=0 failures=0> Here, we didn't need to use a tearDown function because we modified the test globals. The test globals are automatically cleared for us after a test. Tests in a file run using `DocFileSuite` can also access the `__file__` global, which is set to the name of the file containing the tests: >>> suite = doctest.DocFileSuite('test_doctest3.txt') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=1 errors=0 failures=0> If the tests contain non-ASCII characters, we have to specify which encoding the file is encoded with. We do so by using the `encoding` parameter: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... 'test_doctest2.txt', ... 'test_doctest4.txt', ... encoding='utf-8') >>> suite.run(unittest.TestResult()) <unittest.result.TestResult run=3 errors=0 failures=2> """ def test_trailing_space_in_test(): """ Trailing spaces in expected output are significant: >>> x, y = 'foo', '' >>> print(x, y) foo \n """ class Wrapper: def __init__(self, func): self.func = func functools.update_wrapper(self, func) def __call__(self, *args, **kwargs): self.func(*args, **kwargs) @Wrapper def test_look_in_unwrapped(): """ Docstrings in wrapped functions must be detected as well. >>> 'one other test' 'one other test' """ def test_unittest_reportflags(): """Default unittest reporting flags can be set to control reporting Here, we'll set the REPORT_ONLY_FIRST_FAILURE option so we see only the first failure of each test. First, we'll look at the output without the flag. The file test_doctest.txt file has two tests. They both fail if blank lines are disabled: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... optionflags=doctest.DONT_ACCEPT_BLANKLINE) >>> import unittest >>> result = suite.run(unittest.TestResult()) >>> print(result.failures[0][1]) # doctest: +ELLIPSIS Traceback ... Failed example: favorite_color ... Failed example: if 1: ... Note that we see both failures displayed. >>> old = doctest.set_unittest_reportflags( ... doctest.REPORT_ONLY_FIRST_FAILURE) Now, when we run the test: >>> result = suite.run(unittest.TestResult()) >>> print(result.failures[0][1]) # doctest: +ELLIPSIS Traceback ... Failed example: favorite_color Exception raised: ... NameError: name 'favorite_color' is not defined <BLANKLINE> <BLANKLINE> We get only the first failure. If we give any reporting options when we set up the tests, however: >>> suite = doctest.DocFileSuite('test_doctest.txt', ... optionflags=doctest.DONT_ACCEPT_BLANKLINE | doctest.REPORT_NDIFF) Then the default eporting options are ignored: >>> result = suite.run(unittest.TestResult()) >>> print(result.failures[0][1]) # doctest: +ELLIPSIS Traceback ... Failed example: favorite_color ... Failed example: if 1: print('a') print() print('b') Differences (ndiff with -expected +actual): a - <BLANKLINE> + b <BLANKLINE> <BLANKLINE> Test runners can restore the formatting flags after they run: >>> ignored = doctest.set_unittest_reportflags(old) """ def test_testfile(): r""" Tests for the `testfile()` function. This function runs all the doctest examples in a given file. In its simple invokation, it is called with the name of a file, which is taken to be relative to the calling module. The return value is (#failures, #tests). We don't want `-v` in sys.argv for these tests. >>> save_argv = sys.argv >>> if '-v' in sys.argv: ... sys.argv = [arg for arg in save_argv if arg != '-v'] >>> doctest.testfile('test_doctest.txt') # doctest: +ELLIPSIS ********************************************************************** File "...", line 6, in test_doctest.txt Failed example: favorite_color Exception raised: ... NameError: name 'favorite_color' is not defined ********************************************************************** 1 items had failures: 1 of 2 in test_doctest.txt ***Test Failed*** 1 failures. TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. (Note: we'll be clearing doctest.master after each call to `doctest.testfile`, to suppress warnings about multiple tests with the same name.) Globals may be specified with the `globs` and `extraglobs` parameters: >>> globs = {'favorite_color': 'blue'} >>> doctest.testfile('test_doctest.txt', globs=globs) TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. >>> extraglobs = {'favorite_color': 'red'} >>> doctest.testfile('test_doctest.txt', globs=globs, ... extraglobs=extraglobs) # doctest: +ELLIPSIS ********************************************************************** File "...", line 6, in test_doctest.txt Failed example: favorite_color Expected: 'blue' Got: 'red' ********************************************************************** 1 items had failures: 1 of 2 in test_doctest.txt ***Test Failed*** 1 failures. TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. The file may be made relative to a given module or package, using the optional `module_relative` parameter: >>> doctest.testfile('test_doctest.txt', globs=globs, ... module_relative='test') TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. Verbosity can be increased with the optional `verbose` parameter: >>> doctest.testfile('test_doctest.txt', globs=globs, verbose=True) Trying: favorite_color Expecting: 'blue' ok Trying: if 1: print('a') print() print('b') Expecting: a <BLANKLINE> b ok 1 items passed all tests: 2 tests in test_doctest.txt 2 tests in 1 items. 2 passed and 0 failed. Test passed. TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. The name of the test may be specified with the optional `name` parameter: >>> doctest.testfile('test_doctest.txt', name='newname') ... # doctest: +ELLIPSIS ********************************************************************** File "...", line 6, in newname ... TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. The summary report may be suppressed with the optional `report` parameter: >>> doctest.testfile('test_doctest.txt', report=False) ... # doctest: +ELLIPSIS ********************************************************************** File "...", line 6, in test_doctest.txt Failed example: favorite_color Exception raised: ... NameError: name 'favorite_color' is not defined TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. The optional keyword argument `raise_on_error` can be used to raise an exception on the first error (which may be useful for postmortem debugging): >>> doctest.testfile('test_doctest.txt', raise_on_error=True) ... # doctest: +ELLIPSIS Traceback (most recent call last): doctest.UnexpectedException: ... >>> doctest.master = None # Reset master. If the tests contain non-ASCII characters, the tests might fail, since it's unknown which encoding is used. The encoding can be specified using the optional keyword argument `encoding`: >>> doctest.testfile('test_doctest4.txt', encoding='latin-1') # doctest: +ELLIPSIS ********************************************************************** File "...", line 7, in test_doctest4.txt Failed example: '...' Expected: 'f\xf6\xf6' Got: 'f\xc3\xb6\xc3\xb6' ********************************************************************** ... ********************************************************************** 1 items had failures: 2 of 2 in test_doctest4.txt ***Test Failed*** 2 failures. TestResults(failed=2, attempted=2) >>> doctest.master = None # Reset master. >>> doctest.testfile('test_doctest4.txt', encoding='utf-8') TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. Test the verbose output: >>> doctest.testfile('test_doctest4.txt', encoding='utf-8', verbose=True) Trying: 'föö' Expecting: 'f\xf6\xf6' ok Trying: 'bąr' Expecting: 'b\u0105r' ok 1 items passed all tests: 2 tests in test_doctest4.txt 2 tests in 1 items. 2 passed and 0 failed. Test passed. TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. >>> sys.argv = save_argv """ def test_lineendings(): r""" *nix systems use \n line endings, while Windows systems use \r\n. Python handles this using universal newline mode for reading files. Let's make sure doctest does so (issue 8473) by creating temporary test files using each of the two line disciplines. One of the two will be the "wrong" one for the platform the test is run on. Windows line endings first: >>> import tempfile, os >>> fn = tempfile.mktemp() >>> with open(fn, 'wb') as f: ... f.write(b'Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n') 35 >>> doctest.testfile(fn, module_relative=False, verbose=False) TestResults(failed=0, attempted=1) >>> os.remove(fn) And now *nix line endings: >>> fn = tempfile.mktemp() >>> with open(fn, 'wb') as f: ... f.write(b'Test:\n\n >>> x = 1 + 1\n\nDone.\n') 30 >>> doctest.testfile(fn, module_relative=False, verbose=False) TestResults(failed=0, attempted=1) >>> os.remove(fn) """ def test_testmod(): r""" Tests for the testmod function. More might be useful, but for now we're just testing the case raised by Issue 6195, where trying to doctest a C module would fail with a UnicodeDecodeError because doctest tried to read the "source" lines out of the binary module. >>> import unicodedata >>> doctest.testmod(unicodedata, verbose=False) TestResults(failed=0, attempted=0) """ try: os.fsencode("foo-bä[email protected]") except UnicodeEncodeError: # Skip the test: the filesystem encoding is unable to encode the filename pass else: def test_unicode(): """ Check doctest with a non-ascii filename: >>> doc = ''' ... >>> raise Exception('clé') ... ''' ... >>> parser = doctest.DocTestParser() >>> test = parser.get_doctest(doc, {}, "foo-bär@baz", "foo-bä[email protected]", 0) >>> test <DocTest foo-bär@baz from foo-bä[email protected]:0 (1 example)> >>> runner = doctest.DocTestRunner(verbose=False) >>> runner.run(test) # doctest: +ELLIPSIS ********************************************************************** File "foo-bä[email protected]", line 2, in foo-bär@baz Failed example: raise Exception('clé') Exception raised: Traceback (most recent call last): File ... compileflags, 1), test.globs) File "<doctest foo-bär@baz[0]>", line 1, in <module> raise Exception('clé') Exception: clé TestResults(failed=1, attempted=1) """ def test_CLI(): r""" The doctest module can be used to run doctests against an arbitrary file. These tests test this CLI functionality. We'll use the support module's script_helpers for this, and write a test files to a temp dir to run the command against. Due to a current limitation in script_helpers, though, we need a little utility function to turn the returned output into something we can doctest against: >>> def normalize(s): ... return '\n'.join(s.decode().splitlines()) With those preliminaries out of the way, we'll start with a file with two simple tests and no errors. We'll run both the unadorned doctest command, and the verbose version, and then check the output: >>> from test.support import script_helper, temp_dir >>> with temp_dir() as tmpdir: ... fn = os.path.join(tmpdir, 'myfile.doc') ... with open(fn, 'w') as f: ... _ = f.write('This is a very simple test file.\n') ... _ = f.write(' >>> 1 + 1\n') ... _ = f.write(' 2\n') ... _ = f.write(' >>> "a"\n') ... _ = f.write(" 'a'\n") ... _ = f.write('\n') ... _ = f.write('And that is it.\n') ... rc1, out1, err1 = script_helper.assert_python_ok( ... '-m', 'doctest', fn) ... rc2, out2, err2 = script_helper.assert_python_ok( ... '-m', 'doctest', '-v', fn) With no arguments and passing tests, we should get no output: >>> rc1, out1, err1 (0, b'', b'') With the verbose flag, we should see the test output, but no error output: >>> rc2, err2 (0, b'') >>> print(normalize(out2)) Trying: 1 + 1 Expecting: 2 ok Trying: "a" Expecting: 'a' ok 1 items passed all tests: 2 tests in myfile.doc 2 tests in 1 items. 2 passed and 0 failed. Test passed. Now we'll write a couple files, one with three tests, the other a python module with two tests, both of the files having "errors" in the tests that can be made non-errors by applying the appropriate doctest options to the run (ELLIPSIS in the first file, NORMALIZE_WHITESPACE in the second). This combination will allow thoroughly testing the -f and -o flags, as well as the doctest command's ability to process more than one file on the command line and, since the second file ends in '.py', its handling of python module files (as opposed to straight text files). >>> from test.support import script_helper, temp_dir >>> with temp_dir() as tmpdir: ... fn = os.path.join(tmpdir, 'myfile.doc') ... with open(fn, 'w') as f: ... _ = f.write('This is another simple test file.\n') ... _ = f.write(' >>> 1 + 1\n') ... _ = f.write(' 2\n') ... _ = f.write(' >>> "abcdef"\n') ... _ = f.write(" 'a...f'\n") ... _ = f.write(' >>> "ajkml"\n') ... _ = f.write(" 'a...l'\n") ... _ = f.write('\n') ... _ = f.write('And that is it.\n') ... fn2 = os.path.join(tmpdir, 'myfile2.py') ... with open(fn2, 'w') as f: ... _ = f.write('def test_func():\n') ... _ = f.write(' \"\"\"\n') ... _ = f.write(' This is simple python test function.\n') ... _ = f.write(' >>> 1 + 1\n') ... _ = f.write(' 2\n') ... _ = f.write(' >>> "abc def"\n') ... _ = f.write(" 'abc def'\n") ... _ = f.write("\n") ... _ = f.write(' \"\"\"\n') ... rc1, out1, err1 = script_helper.assert_python_failure( ... '-m', 'doctest', fn, fn2) ... rc2, out2, err2 = script_helper.assert_python_ok( ... '-m', 'doctest', '-o', 'ELLIPSIS', fn) ... rc3, out3, err3 = script_helper.assert_python_ok( ... '-m', 'doctest', '-o', 'ELLIPSIS', ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) ... rc4, out4, err4 = script_helper.assert_python_failure( ... '-m', 'doctest', '-f', fn, fn2) ... rc5, out5, err5 = script_helper.assert_python_ok( ... '-m', 'doctest', '-v', '-o', 'ELLIPSIS', ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) Our first test run will show the errors from the first file (doctest stops if a file has errors). Note that doctest test-run error output appears on stdout, not stderr: >>> rc1, err1 (1, b'') >>> print(normalize(out1)) # doctest: +ELLIPSIS ********************************************************************** File "...myfile.doc", line 4, in myfile.doc Failed example: "abcdef" Expected: 'a...f' Got: 'abcdef' ********************************************************************** File "...myfile.doc", line 6, in myfile.doc Failed example: "ajkml" Expected: 'a...l' Got: 'ajkml' ********************************************************************** 1 items had failures: 2 of 3 in myfile.doc ***Test Failed*** 2 failures. With -o ELLIPSIS specified, the second run, against just the first file, should produce no errors, and with -o NORMALIZE_WHITESPACE also specified, neither should the third, which ran against both files: >>> rc2, out2, err2 (0, b'', b'') >>> rc3, out3, err3 (0, b'', b'') The fourth run uses FAIL_FAST, so we should see only one error: >>> rc4, err4 (1, b'') >>> print(normalize(out4)) # doctest: +ELLIPSIS ********************************************************************** File "...myfile.doc", line 4, in myfile.doc Failed example: "abcdef" Expected: 'a...f' Got: 'abcdef' ********************************************************************** 1 items had failures: 1 of 2 in myfile.doc ***Test Failed*** 1 failures. The fifth test uses verbose with the two options, so we should get verbose success output for the tests in both files: >>> rc5, err5 (0, b'') >>> print(normalize(out5)) Trying: 1 + 1 Expecting: 2 ok Trying: "abcdef" Expecting: 'a...f' ok Trying: "ajkml" Expecting: 'a...l' ok 1 items passed all tests: 3 tests in myfile.doc 3 tests in 1 items. 3 passed and 0 failed. Test passed. Trying: 1 + 1 Expecting: 2 ok Trying: "abc def" Expecting: 'abc def' ok 1 items had no tests: myfile2 1 items passed all tests: 2 tests in myfile2.test_func 2 tests in 2 items. 2 passed and 0 failed. Test passed. We should also check some typical error cases. Invalid file name: >>> rc, out, err = script_helper.assert_python_failure( ... '-m', 'doctest', 'nosuchfile') >>> rc, out (1, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS Traceback (most recent call last): ... FileNotFoundError: [Errno 2] ENOENT... Invalid doctest option: >>> rc, out, err = script_helper.assert_python_failure( ... '-m', 'doctest', '-o', 'nosuchoption') >>> rc, out (2, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS usage...invalid...nosuchoption... """ ###################################################################### ## Main ###################################################################### def test_main(): # Check the doctest cases in doctest itself: ret = support.run_doctest(doctest, verbosity=True) # Check the doctest cases defined here: from test import test_doctest support.run_doctest(test_doctest, verbosity=True) def test_coverage(coverdir): trace = support.import_module('trace') tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,], trace=0, count=1) tracer.run('test_main()') r = tracer.results() print('Writing coverage results...') r.write_results(show_missing=True, summary=True, coverdir=coverdir) if __name__ == '__main__': if '-c' in sys.argv: test_coverage('/tmp/doctest.cover') else: test_main() if __name__ == "PYOBJ.COM": import test.sample_doctest import test.sample_doctest_no_docstrings import test.sample_doctest_no_doctests import test.doctest_aliases
95,613
2,970
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/Python.asdl
-- ASDL's 7 builtin types are: -- identifier, int, string, bytes, object, singleton, constant -- -- singleton: None, True or False -- constant can be None, whereas None means "no value" for object. module Python { mod = Module(stmt* body) | Interactive(stmt* body) | Expression(expr body) -- not really an actual node but useful in Jython's typesystem. | Suite(stmt* body) stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns) | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns) | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list) | Return(expr? value) | Delete(expr* targets) | Assign(expr* targets, expr value) | AugAssign(expr target, operator op, expr value) -- 'simple' indicates that we annotate simple name without parens | AnnAssign(expr target, expr annotation, expr? value, int simple) -- use 'orelse' because else is a keyword in target languages | For(expr target, expr iter, stmt* body, stmt* orelse) | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse) | While(expr test, stmt* body, stmt* orelse) | If(expr test, stmt* body, stmt* orelse) | With(withitem* items, stmt* body) | AsyncWith(withitem* items, stmt* body) | Raise(expr? exc, expr? cause) | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) | Assert(expr test, expr? msg) | Import(alias* names) | ImportFrom(identifier? module, alias* names, int? level) | Global(identifier* names) | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue -- XXX Jython will be different -- col_offset is the byte offset in the utf8 string the parser uses attributes (int lineno, int col_offset) -- BoolOp() can use left & right? expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) | IfExp(expr test, expr body, expr orelse) | Dict(expr* keys, expr* values) | Set(expr* elts) | ListComp(expr elt, comprehension* generators) | SetComp(expr elt, comprehension* generators) | DictComp(expr key, expr value, comprehension* generators) | GeneratorExp(expr elt, comprehension* generators) -- the grammar constrains where yield expressions can occur | Await(expr value) | Yield(expr? value) | YieldFrom(expr value) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) | Call(expr func, expr* args, keyword* keywords) | Num(object n) -- a number as a PyObject. | Str(string s) -- need to specify raw, unicode, etc? | FormattedValue(expr value, int? conversion, expr? format_spec) | JoinedStr(expr* values) | Bytes(bytes s) | NameConstant(singleton value) | Ellipsis | Constant(constant value) -- the following expression can appear in assignment context | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, slice slice, expr_context ctx) | Starred(expr value, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr* elts, expr_context ctx) | Tuple(expr* elts, expr_context ctx) -- col_offset is the byte offset in the utf8 string the parser uses attributes (int lineno, int col_offset) expr_context = Load | Store | Del | AugLoad | AugStore | Param slice = Slice(expr? lower, expr? upper, expr? step) | ExtSlice(slice* dims) | Index(expr value) boolop = And | Or operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv unaryop = Invert | Not | UAdd | USub cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn comprehension = (expr target, expr iter, expr* ifs, int is_async) excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) attributes (int lineno, int col_offset) arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults) arg = (identifier arg, expr? annotation) attributes (int lineno, int col_offset) -- keyword arguments supplied to call (NULL identifier for **kwargs) keyword = (identifier? arg, expr value) -- import name with optional 'as' alias. alias = (identifier name, identifier? asname) withitem = (expr context_expr, expr? optional_vars) }
5,169
133
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_docxmlrpc.py
from xmlrpc.server import DocXMLRPCServer import http.client import re import sys from test import support threading = support.import_module('threading') import unittest def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because # the server created in setUp blocks expecting one to come in. if not condition: return lambda func: func def decorator(func): def make_request_and_skip(self): self.client.request("GET", "/") self.client.getresponse() raise unittest.SkipTest(reason) return make_request_and_skip return decorator def make_server(): serv = DocXMLRPCServer(("localhost", 0), logRequests=False) try: # Add some documentation serv.set_server_title("DocXMLRPCServer Test Documentation") serv.set_server_name("DocXMLRPCServer Test Docs") serv.set_server_documentation( "This is an XML-RPC server's documentation, but the server " "can be used by POSTing to /RPC2. Try self.add, too.") # Create and register classes and functions class TestClass(object): def test_method(self, arg): """Test method's docs. This method truly does very little.""" self.arg = arg serv.register_introspection_functions() serv.register_instance(TestClass()) def add(x, y): """Add two instances together. This follows PEP008, but has nothing to do with RFC1952. Case should matter: pEp008 and rFC1952. Things that start with http and ftp should be auto-linked, too: http://google.com. """ return x + y def annotation(x: int): """ Use function annotations. """ return x class ClassWithAnnotation: def method_annotation(self, x: bytes): return x.decode() serv.register_function(add) serv.register_function(lambda x, y: x-y) serv.register_function(annotation) serv.register_instance(ClassWithAnnotation()) return serv except: serv.server_close() raise class DocXMLRPCHTTPGETServer(unittest.TestCase): def setUp(self): # Enable server feedback DocXMLRPCServer._send_traceback_header = True self.serv = make_server() self.thread = threading.Thread(target=self.serv.serve_forever) self.thread.start() PORT = self.serv.server_address[1] self.client = http.client.HTTPConnection("localhost:%d" % PORT) def tearDown(self): self.client.close() # Disable server feedback DocXMLRPCServer._send_traceback_header = False self.serv.shutdown() self.thread.join() self.serv.server_close() def test_valid_get_response(self): self.client.request("GET", "/") response = self.client.getresponse() self.assertEqual(response.status, 200) self.assertEqual(response.getheader("Content-type"), "text/html") # Server raises an exception if we don't start to read the data response.read() def test_invalid_get_response(self): self.client.request("GET", "/spam") response = self.client.getresponse() self.assertEqual(response.status, 404) self.assertEqual(response.getheader("Content-type"), "text/plain") response.read() def test_lambda(self): """Test that lambda functionality stays the same. The output produced currently is, I suspect invalid because of the unencoded brackets in the HTML, "<lambda>". The subtraction lambda method is tested. """ self.client.request("GET", "/") response = self.client.getresponse() self.assertIn((b'<dl><dt><a name="-&lt;lambda&gt;"><strong>' b'&lt;lambda&gt;</strong></a>(x, y)</dt></dl>'), response.read()) @make_request_and_skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_autolinking(self): """Test that the server correctly automatically wraps references to PEPS and RFCs with links, and that it linkifies text starting with http or ftp protocol prefixes. The documentation for the "add" method contains the test material. """ self.client.request("GET", "/") response = self.client.getresponse().read() self.assertIn( (b'<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd>' b'<tt>Add&nbsp;two&nbsp;instances&nbsp;together.&nbsp;This&nbsp;' b'follows&nbsp;<a href="http://www.python.org/dev/peps/pep-0008/">' b'PEP008</a>,&nbsp;but&nbsp;has&nbsp;nothing<br>\nto&nbsp;do&nbsp;' b'with&nbsp;<a href="http://www.rfc-editor.org/rfc/rfc1952.txt">' b'RFC1952</a>.&nbsp;Case&nbsp;should&nbsp;matter:&nbsp;pEp008&nbsp;' b'and&nbsp;rFC1952.&nbsp;&nbsp;Things<br>\nthat&nbsp;start&nbsp;' b'with&nbsp;http&nbsp;and&nbsp;ftp&nbsp;should&nbsp;be&nbsp;' b'auto-linked,&nbsp;too:<br>\n<a href="http://google.com">' b'http://google.com</a>.</tt></dd></dl>'), response) @make_request_and_skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_system_methods(self): """Test the presence of three consecutive system.* methods. This also tests their use of parameter type recognition and the systems related to that process. """ self.client.request("GET", "/") response = self.client.getresponse().read() self.assertIn( (b'<dl><dt><a name="-system.methodHelp"><strong>system.methodHelp' b'</strong></a>(method_name)</dt><dd><tt><a href="#-system.method' b'Help">system.methodHelp</a>(\'add\')&nbsp;=&gt;&nbsp;"Adds&nbsp;' b'two&nbsp;integers&nbsp;together"<br>\n&nbsp;<br>\nReturns&nbsp;a' b'&nbsp;string&nbsp;containing&nbsp;documentation&nbsp;for&nbsp;' b'the&nbsp;specified&nbsp;method.</tt></dd></dl>\n<dl><dt><a name' b'="-system.methodSignature"><strong>system.methodSignature</strong>' b'</a>(method_name)</dt><dd><tt><a href="#-system.methodSignature">' b'system.methodSignature</a>(\'add\')&nbsp;=&gt;&nbsp;[double,&nbsp;' b'int,&nbsp;int]<br>\n&nbsp;<br>\nReturns&nbsp;a&nbsp;list&nbsp;' b'describing&nbsp;the&nbsp;signature&nbsp;of&nbsp;the&nbsp;method.' b'&nbsp;In&nbsp;the<br>\nabove&nbsp;example,&nbsp;the&nbsp;add&nbsp;' b'method&nbsp;takes&nbsp;two&nbsp;integers&nbsp;as&nbsp;arguments' b'<br>\nand&nbsp;returns&nbsp;a&nbsp;double&nbsp;result.<br>\n&nbsp;' b'<br>\nThis&nbsp;server&nbsp;does&nbsp;NOT&nbsp;support&nbsp;system' b'.methodSignature.</tt></dd></dl>'), response) def test_autolink_dotted_methods(self): """Test that selfdot values are made strong automatically in the documentation.""" self.client.request("GET", "/") response = self.client.getresponse() self.assertIn(b"""Try&nbsp;self.<strong>add</strong>,&nbsp;too.""", response.read()) def test_annotations(self): """ Test that annotations works as expected """ self.client.request("GET", "/") response = self.client.getresponse() docstring = (b'' if sys.flags.optimize >= 2 else b'<dd><tt>Use&nbsp;function&nbsp;annotations.</tt></dd>') self.assertIn( (b'<dl><dt><a name="-annotation"><strong>annotation</strong></a>' b'(x: int)</dt>' + docstring + b'</dl>\n' b'<dl><dt><a name="-method_annotation"><strong>' b'method_annotation</strong></a>(x: bytes)</dt></dl>'), response.read()) def test_server_title_escape(self): # bpo-38243: Ensure that the server title and documentation # are escaped for HTML. self.serv.set_server_title('test_title<script>') self.serv.set_server_documentation('test_documentation<script>') self.assertEqual('test_title<script>', self.serv.server_title) self.assertEqual('test_documentation<script>', self.serv.server_documentation) generated = self.serv.generate_html_documentation() title = re.search(r'<title>(.+?)</title>', generated).group() documentation = re.search(r'<p><tt>(.+?)</tt></p>', generated).group() self.assertEqual('<title>Python: test_title&lt;script&gt;</title>', title) self.assertEqual('<p><tt>test_documentation&lt;script&gt;</tt></p>', documentation) if __name__ == '__main__': unittest.main()
8,936
215
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/allsans.pem
-----BEGIN PRIVATE KEY----- MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCg/pM6dP7BTFNc qe6wIJIBB7HjwL42bp0vjcCVl4Z3MRWFswYpfxy+o+8+PguMp4K6zndA5fwNkK/H 3HmtanncUfPqnV0usN0NHQGh/f9xRoNmB1q2L7kTuO99o0KLQgvonRT2snf8rq9n tPRzhHUGYhog7zzNxetYV309PHpPr19BcKepDtM5RMk2aBnoN5vtItorjXiDosFm 6o5wQHrcupcVydszba6P75BEbc1XIWvq2Fv8muaw4pCe81QYINyLqgcPNO/nF3Os 5EI4HKjCNRSCOhOcWqYctXLXN9lBdMBBvQc3zDmYzh1eIZewzZXPVEQT33xPkhxz HNmhcIctpWX4LTRF6FulkcbeuZDga3gkZYJf/M6IpU1WYXr6q8sNxbgmRRX/NuHo V9oDwBzLG07rKUiqRHfjGqoCRmmVeVYpryvXUNjHGH0nlVzz/8lTUxAnJorO3Fdc I+6zKLUPICdAlvz51AH6yopgPFhrdgA0pVzPO6L5G8SRQCxKhAUCAwEAAQKCAYAa 2jtOTcNMFGH3G7TfFZ+kolbuaPCQ/aQkEV2k1dAswzgWw8RsWXI+7fLyi8C7Zhks 9VD4tyNyU8at7D0zSoYm1Fh9sl+fcQp9rG/gSBA6IYu7EdD0gEM7YeY4K2nm9k4s Lz8W4q+WqsBA6PK47cfjF6vKAH1AyRk28+jEtPiln9egf5zHWtyqOanh9D0V+Wh9 hgmjqAYI1rWxZ7/4Qxj7Bfg7Px7blhi+kzOZ5kKQnNd2JT46hM+jgzah/G3zVE+R FFW6ksmJgZ+dCuSbE7HEJmKms1CWq/1Cll0A3uy4JTDZOrK4KcZQ9UjjWJWvlXQm uNXSSAp1k287DLVUm9c22SDeXpb9PyKmzyvJvVmMqqBx6QzHZ/L7WPzpUWAoLcU+ ZHT7vggDymkIO+fcRbUzv8s5R7RnLbcBga51/5OCUvAWDoJXNw0qwYZOIbfTnQgs 8xbCmbMzllyYM/dK3GxQAwfn8Hzk+DbS/NObMjHLCWLfYeUvutXJSNly6Ny+ZcEC gcEAzo5Y1UFOfBX4MZLIZ69LfgaXj9URobMwqlEwKil8pWQMa951ga3moLt91nOe SAQz3meFTBX/VAb2ZHLeIf3FoNkiIx48PkxsR/hhLHpvl26zEg3yXs3tv0IFBx2R EEnLNpQaAQFR9S1yDOaG2rsb17ZDKyp9isDpAENHAmEnT/XJn+Dc0SOH1EVDjUeM JqToAF/fjIx/RF4oUJCAgOPBMlRy5ywLQk8uDi6ft0NCzzCi0eCuk1Ty3KzWFGwx 7cYRAoHBAMeIPCzHG3No4JGUFunslVwo5TuC7maO6qYKbq0OyvwWfL4b7gjrMBR9 d5WyZlp/Vf40O463dg8x8qPNOFWp49f3hxTvvfnt2/m3+CQuDOLfqBbHufZApP1J U9MubUNnDFHHeJ9l0tg2nhiLw24GHeMARZhA/BimMQPY0OpZPpLVxAUArM2EB7hI glQpYCtdXhqwl1pl0u3TZ08y3BXYNg9BycdpGRMWSsAwsApJRgNuI/dfDKu0uMYF /pUhXVPatQKBwGgLpAun3dT7bA3sli5ESo6s22OEPGFrVbQ1OUHDrBnTj742TJKJ +oY0a2q+ypgUJdx94NM2sWquJybqBaKxpf8j4OI3tLjc3h5SqwAwnE13YZRSmifP K1cP9mBjMFM4GLjhWUfwVkxeG/kLlhpP7fJ2yNbRjHN8QOH1AavdLGRGts1mA1UF xMHUMfbUd3Bv2L13ja/KhcD2fPA4GcLS9tpXV5nCwdkg8V4LdkBmDR04rotx1f44 6Czokt2usmfHQQKBwFkufxbUd2SB/72Rnxw27hse/DY5My0Lu70y9HzNG9TIiEDA YwgBdp/x5D04W58fQuQ3nFcRkOcBwB2OYBuJr5ibvfiRnyvSMHvQykwBeSj+Jjbo VinGgvfiimDdY2C48jyrFzLHZBHXd5oo/dRzT3Bicri2cvbhcQ7zHY1hDiK7AL3r q1DALmMjpXzQcXdwZ9suCrgQwtIhpw8zAEOTO7ZeBT3nr5lkYUy9djFixrRJyjGK fjNQtzVrAHrPStNr8QKBwQDCC0zhsCnTv4sAJmW7LL6Ayd5rbWhUZ6px1xY0yHMA hehj+xbaiC6cfVr5Rg0ncvaa8AExu4kXpVsupTyNwvC4NgzLHtfBw6WUdOnd1awE kSrDtDReBt2wByAcQwttQsrJ1/Pt6zcNJJI4Z9s8G4NTcQWJwUhU20N55JQKR//l OQJqhq9NVhte/ctDjVwOHs/OhDNvxsAWxdjnf/O2up0os+M2bFkmHuaVW0vQbqTQ mw7Vbzk2Ff5oT6E3kbC8Ur4= -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIHMDCCBZigAwIBAgIJALVVA6v9zJS5MA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u IFNvZnR3YXJlIEZvdW5kYXRpb24xEDAOBgNVBAMMB2FsbHNhbnMwHhcNMTgwODI5 MTQyMzE3WhcNMjgwODI2MTQyMzE3WjBdMQswCQYDVQQGEwJYWTEXMBUGA1UEBwwO Q2FzdGxlIEFudGhyYXgxIzAhBgNVBAoMGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0 aW9uMRAwDgYDVQQDDAdhbGxzYW5zMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB igKCAYEAoP6TOnT+wUxTXKnusCCSAQex48C+Nm6dL43AlZeGdzEVhbMGKX8cvqPv Pj4LjKeCus53QOX8DZCvx9x5rWp53FHz6p1dLrDdDR0Bof3/cUaDZgdati+5E7jv faNCi0IL6J0U9rJ3/K6vZ7T0c4R1BmIaIO88zcXrWFd9PTx6T69fQXCnqQ7TOUTJ NmgZ6Deb7SLaK414g6LBZuqOcEB63LqXFcnbM22uj++QRG3NVyFr6thb/JrmsOKQ nvNUGCDci6oHDzTv5xdzrORCOByowjUUgjoTnFqmHLVy1zfZQXTAQb0HN8w5mM4d XiGXsM2Vz1REE998T5IccxzZoXCHLaVl+C00RehbpZHG3rmQ4Gt4JGWCX/zOiKVN VmF6+qvLDcW4JkUV/zbh6FfaA8AcyxtO6ylIqkR34xqqAkZplXlWKa8r11DYxxh9 J5Vc8//JU1MQJyaKztxXXCPusyi1DyAnQJb8+dQB+sqKYDxYa3YANKVczzui+RvE kUAsSoQFAgMBAAGjggLxMIIC7TCCATAGA1UdEQSCAScwggEjggdhbGxzYW5zoB4G AyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKgNQYGKwYBBQICoCswKaAQGw5L RVJCRVJPUy5SRUFMTaEVMBOgAwIBAaEMMAobCHVzZXJuYW1lgRB1c2VyQGV4YW1w bGUub3Jngg93d3cuZXhhbXBsZS5vcmekZzBlMQswCQYDVQQGEwJYWTEXMBUGA1UE BwwOQ2FzdGxlIEFudGhyYXgxIzAhBgNVBAoMGlB5dGhvbiBTb2Z0d2FyZSBGb3Vu ZGF0aW9uMRgwFgYDVQQDDA9kaXJuYW1lIGV4YW1wbGWGF2h0dHBzOi8vd3d3LnB5 dGhvbi5vcmcvhwR/AAABhxAAAAAAAAAAAAAAAAAAAAABiAQqAwQFMA4GA1UdDwEB /wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/ BAIwADAdBgNVHQ4EFgQUoLHAHNTWrHkSCUYkhn5NH0S40CAwgY8GA1UdIwSBhzCB hIAUoLHAHNTWrHkSCUYkhn5NH0S40CChYaRfMF0xCzAJBgNVBAYTAlhZMRcwFQYD VQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZv dW5kYXRpb24xEDAOBgNVBAMMB2FsbHNhbnOCCQC1VQOr/cyUuTCBgwYIKwYBBQUH AQEEdzB1MDwGCCsGAQUFBzAChjBodHRwOi8vdGVzdGNhLnB5dGhvbnRlc3QubmV0 L3Rlc3RjYS9weWNhY2VydC5jZXIwNQYIKwYBBQUHMAGGKWh0dHA6Ly90ZXN0Y2Eu cHl0aG9udGVzdC5uZXQvdGVzdGNhL29jc3AvMEMGA1UdHwQ8MDowOKA2oDSGMmh0 dHA6Ly90ZXN0Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3Jldm9jYXRpb24uY3Js MA0GCSqGSIb3DQEBCwUAA4IBgQAeKJKycO2DES98gyR2e/GzPYEw87cCS0cEpiiP 3CEUgzfEbF0X89GDKEey4H3Irvosbvt2hEcf2RNpahLUL/fUv53bDmHNmL8qJg5E UJVMOHvOpSOjqoqeRuSyG0GnnAuUwcxdrZY6UzLdslhuq9F8UjgHr6KSMx56G9uK LmTy5njMab0in2xL/YRX/0nogK3BHqpUHrfCdEYZkciRxtAa+OPpWn4dcZi+Fpf7 ZYSgPLNt+djtFDMIAk5Bo+XDaQdW3dhF0w44enrGAOV0xPE+/jOuenNhKBafjuNb lkeSr45+QZsi1rd18ny8z3uuaGqIAziFgmllZOH2D8giTn6+5jZcCNZCoGKUkPI9 l/GMWwxg4HQYYlZcsZzTCem9Rb2XcrasAbmhFapMtR+QAwSed5vKE7ZdtQhj74kB 7Q0E7Lkgpp6BaObb2As8/f0K/UlSVSvrYk+i3JT9wK/qqkRGxsTFEF7N9t0rKu8y 4JdQDtZCI552MsFvYW6m+IOYgxg= -----END CERTIFICATE-----
5,037
82
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/outstanding_bugs.py
# # This file is for everybody to add tests for bugs that aren't # fixed yet. Please add a test case and appropriate bug description. # # When you fix one of the bugs, please move the test to the correct # test_ module. # import unittest from test import support # # No test cases for outstanding bugs at the moment. # if __name__ == "__main__": unittest.main()
370
19
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_multiprocessing_fork.py
import unittest import test._test_multiprocessing import sys from test import support if support.PGO: raise unittest.SkipTest("test is not helpful for PGO") if sys.platform == "win32": raise unittest.SkipTest("fork is not available on Windows") if sys.platform == 'darwin': raise unittest.SkipTest("test may crash on macOS (bpo-33725)") test._test_multiprocessing.install_tests_in_module_dict(globals(), 'fork') if __name__ == '__main__': unittest.main()
477
20
jart/cosmopolitan
false
cosmopolitan/third_party/python/Lib/test/test_shelve.py
import unittest import shelve import glob from test import support from collections.abc import MutableMapping from test.test_dbm import dbm_iterator def L1(s): return s.decode("latin-1") class byteskeydict(MutableMapping): "Mapping that supports bytes keys" def __init__(self): self.d = {} def __getitem__(self, key): return self.d[L1(key)] def __setitem__(self, key, value): self.d[L1(key)] = value def __delitem__(self, key): del self.d[L1(key)] def __len__(self): return len(self.d) def iterkeys(self): for k in self.d.keys(): yield k.encode("latin-1") __iter__ = iterkeys def keys(self): return list(self.iterkeys()) def copy(self): return byteskeydict(self.d) class TestCase(unittest.TestCase): fn = "shelftemp.db" def tearDown(self): for f in glob.glob(self.fn+"*"): support.unlink(f) def test_close(self): d1 = {} s = shelve.Shelf(d1, protocol=2, writeback=False) s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) self.assertEqual(len(s), 1) s.close() self.assertRaises(ValueError, len, s) try: s['key1'] except ValueError: pass else: self.fail('Closed shelf should not find a key') def test_ascii_file_shelf(self): s = shelve.open(self.fn, protocol=0) try: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) finally: s.close() def test_binary_file_shelf(self): s = shelve.open(self.fn, protocol=1) try: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) finally: s.close() def test_proto2_file_shelf(self): s = shelve.open(self.fn, protocol=2) try: s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) finally: s.close() def test_in_memory_shelf(self): d1 = byteskeydict() s = shelve.Shelf(d1, protocol=0) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() d2 = byteskeydict() s = shelve.Shelf(d2, protocol=1) s['key1'] = (1,2,3,4) self.assertEqual(s['key1'], (1,2,3,4)) s.close() self.assertEqual(len(d1), 1) self.assertEqual(len(d2), 1) self.assertNotEqual(d1.items(), d2.items()) def test_mutable_entry(self): d1 = byteskeydict() s = shelve.Shelf(d1, protocol=2, writeback=False) s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) s['key1'].append(5) self.assertEqual(s['key1'], [1,2,3,4]) s.close() d2 = byteskeydict() s = shelve.Shelf(d2, protocol=2, writeback=True) s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) s['key1'].append(5) self.assertEqual(s['key1'], [1,2,3,4,5]) s.close() self.assertEqual(len(d1), 1) self.assertEqual(len(d2), 1) def test_keyencoding(self): d = {} key = 'Pöp' # the default keyencoding is utf-8 shelve.Shelf(d)[key] = [1] self.assertIn(key.encode('utf-8'), d) # but a different one can be given shelve.Shelf(d, keyencoding='latin-1')[key] = [1] self.assertIn(key.encode('latin-1'), d) # with all consequences s = shelve.Shelf(d, keyencoding='ascii') self.assertRaises(UnicodeEncodeError, s.__setitem__, key, [1]) def test_writeback_also_writes_immediately(self): # Issue 5754 d = {} key = 'key' encodedkey = key.encode('utf-8') s = shelve.Shelf(d, writeback=True) s[key] = [1] p1 = d[encodedkey] # Will give a KeyError if backing store not updated s['key'].append(2) s.close() p2 = d[encodedkey] self.assertNotEqual(p1, p2) # Write creates new object in store def test_with(self): d1 = {} with shelve.Shelf(d1, protocol=2, writeback=False) as s: s['key1'] = [1,2,3,4] self.assertEqual(s['key1'], [1,2,3,4]) self.assertEqual(len(s), 1) self.assertRaises(ValueError, len, s) try: s['key1'] except ValueError: pass else: self.fail('Closed shelf should not find a key') def test_default_protocol(self): with shelve.Shelf({}) as s: self.assertEqual(s._protocol, 3) from test import mapping_tests class TestShelveBase(mapping_tests.BasicTestMappingProtocol): fn = "shelftemp.db" counter = 0 def __init__(self, *args, **kw): self._db = [] mapping_tests.BasicTestMappingProtocol.__init__(self, *args, **kw) type2test = shelve.Shelf def _reference(self): return {"key1":"value1", "key2":2, "key3":(1,2,3)} def _empty_mapping(self): if self._in_mem: x= shelve.Shelf(byteskeydict(), **self._args) else: self.counter+=1 x= shelve.open(self.fn+str(self.counter), **self._args) self._db.append(x) return x def tearDown(self): for db in self._db: db.close() self._db = [] if not self._in_mem: for f in glob.glob(self.fn+"*"): support.unlink(f) class TestAsciiFileShelve(TestShelveBase): _args={'protocol':0} _in_mem = False class TestBinaryFileShelve(TestShelveBase): _args={'protocol':1} _in_mem = False class TestProto2FileShelve(TestShelveBase): _args={'protocol':2} _in_mem = False class TestAsciiMemShelve(TestShelveBase): _args={'protocol':0} _in_mem = True class TestBinaryMemShelve(TestShelveBase): _args={'protocol':1} _in_mem = True class TestProto2MemShelve(TestShelveBase): _args={'protocol':2} _in_mem = True def test_main(): for module in dbm_iterator(): support.run_unittest( TestAsciiFileShelve, TestBinaryFileShelve, TestProto2FileShelve, TestAsciiMemShelve, TestBinaryMemShelve, TestProto2MemShelve, TestCase ) if __name__ == "__main__": test_main()
6,389
229
jart/cosmopolitan
false