1 #!/usr/bin/env python 2 3 """ 4 String objects. 5 6 Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 7 8 This program is free software; you can redistribute it and/or modify it under 9 the terms of the GNU General Public License as published by the Free Software 10 Foundation; either version 3 of the License, or (at your option) any later 11 version. 12 13 This program is distributed in the hope that it will be useful, but WITHOUT 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 16 details. 17 18 You should have received a copy of the GNU General Public License along with 19 this program. If not, see <http://www.gnu.org/licenses/>. 20 """ 21 22 from __builtins__.operator import * 23 import native 24 25 class basestring(object): 26 def __init__(self, data=None): 27 # Note member. 28 self.data = data 29 30 def __contains__(self, value): pass 31 32 def __getitem__(self, index): 33 # Note usage. 34 IndexError 35 36 def __getslice__(self, start, end=None): pass 37 38 def __iadd__(self, other): 39 "Return a new string for the operation." 40 return _binary_op(self, other, native._str_add) 41 42 __add__ = __radd__ = __iadd__ 43 44 def __mul__(self, other): pass 45 def __rmul__(self, other): pass 46 def __mod__(self, other): pass 47 def __rmod__(self, other): pass 48 49 def __lt__(self, other): 50 "Return a new boolean for the comparison." 51 return _binary_op(self, other, native._str_lt) 52 53 def __gt__(self, other): 54 "Return a new boolean for the comparison." 55 return _binary_op(self, other, native._str_gt) 56 57 def __le__(self, other): 58 "Return a new boolean for the comparison." 59 return _negate(self.__gt__(other)) 60 61 def __ge__(self, other): 62 "Return a new boolean for the comparison." 63 return _negate(self.__lt__(other)) 64 65 def __eq__(self, other): 66 "Return a new boolean for the comparison." 67 return _binary_op(self, other, native._str_eq) 68 69 def __ne__(self, other): 70 "Return a new boolean for the comparison." 71 return _negate(self.__eq__(other)) 72 73 def __len__(self): pass 74 def __str__(self): pass 75 76 def __bool__(self): 77 return _negate(native._str_eq(self, "")) 78 79 def endswith(self, s): pass 80 def find(self, sub, start=None, end=None): pass 81 def index(self, sub, start=None, end=None): pass 82 def join(self, l): pass 83 def lower(self): pass 84 def lstrip(self, chars=None): pass 85 def replace(self, old, new, count=None): pass 86 def rfind(self, sub, start=None, end=None): pass 87 def rsplit(self, sep=None, maxsplit=None): pass 88 def rstrip(self, chars=None): pass 89 def split(self, sep=None, maxsplit=None): pass 90 def splitlines(self, keepends=False): pass 91 def startswith(self, s): pass 92 def strip(self, chars=None): pass 93 def upper(self): pass 94 95 def __iter__(self): 96 97 "Return an iterator." 98 99 return listiterator(self) 100 101 class str(basestring): 102 pass 103 104 class unicode(basestring): 105 def encode(self, encoding): pass 106 107 # vim: tabstop=4 expandtab shiftwidth=4