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