1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lib/__builtins__/str.py Sat Sep 03 22:37:23 2016 +0200
1.3 @@ -0,0 +1,108 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"""
1.7 +String objects.
1.8 +
1.9 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
1.10 +
1.11 +This program is free software; you can redistribute it and/or modify it under
1.12 +the terms of the GNU General Public License as published by the Free Software
1.13 +Foundation; either version 3 of the License, or (at your option) any later
1.14 +version.
1.15 +
1.16 +This program is distributed in the hope that it will be useful, but WITHOUT
1.17 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 +details.
1.20 +
1.21 +You should have received a copy of the GNU General Public License along with
1.22 +this program. If not, see <http://www.gnu.org/licenses/>.
1.23 +"""
1.24 +
1.25 +from __builtins__.iterator import listiterator
1.26 +from __builtins__.operator import _binary_op, _negate
1.27 +import native
1.28 +
1.29 +class basestring(object):
1.30 + def __init__(self, data=None):
1.31 + # Note member.
1.32 + self.data = data
1.33 +
1.34 + def __contains__(self, value): pass
1.35 +
1.36 + def __getitem__(self, index):
1.37 + # Note usage.
1.38 + IndexError
1.39 +
1.40 + def __getslice__(self, start, end=None): pass
1.41 +
1.42 + def __iadd__(self, other):
1.43 + "Return a new string for the operation."
1.44 + return _binary_op(self, other, native._str_add)
1.45 +
1.46 + __add__ = __radd__ = __iadd__
1.47 +
1.48 + def __mul__(self, other): pass
1.49 + def __rmul__(self, other): pass
1.50 + def __mod__(self, other): pass
1.51 + def __rmod__(self, other): pass
1.52 +
1.53 + def __lt__(self, other):
1.54 + "Return a new boolean for the comparison."
1.55 + return _binary_op(self, other, native._str_lt)
1.56 +
1.57 + def __gt__(self, other):
1.58 + "Return a new boolean for the comparison."
1.59 + return _binary_op(self, other, native._str_gt)
1.60 +
1.61 + def __le__(self, other):
1.62 + "Return a new boolean for the comparison."
1.63 + return _negate(self.__gt__(other))
1.64 +
1.65 + def __ge__(self, other):
1.66 + "Return a new boolean for the comparison."
1.67 + return _negate(self.__lt__(other))
1.68 +
1.69 + def __eq__(self, other):
1.70 + "Return a new boolean for the comparison."
1.71 + return _binary_op(self, other, native._str_eq)
1.72 +
1.73 + def __ne__(self, other):
1.74 + "Return a new boolean for the comparison."
1.75 + return _negate(self.__eq__(other))
1.76 +
1.77 + def __len__(self): pass
1.78 + def __str__(self): pass
1.79 +
1.80 + def __bool__(self):
1.81 + return _negate(native._str_eq(self, ""))
1.82 +
1.83 + def endswith(self, s): pass
1.84 + def find(self, sub, start=None, end=None): pass
1.85 + def index(self, sub, start=None, end=None): pass
1.86 + def join(self, l): pass
1.87 + def lower(self): pass
1.88 + def lstrip(self, chars=None): pass
1.89 + def replace(self, old, new, count=None): pass
1.90 + def rfind(self, sub, start=None, end=None): pass
1.91 + def rsplit(self, sep=None, maxsplit=None): pass
1.92 + def rstrip(self, chars=None): pass
1.93 + def split(self, sep=None, maxsplit=None): pass
1.94 + def splitlines(self, keepends=False): pass
1.95 + def startswith(self, s): pass
1.96 + def strip(self, chars=None): pass
1.97 + def upper(self): pass
1.98 +
1.99 + def __iter__(self):
1.100 +
1.101 + "Return an iterator."
1.102 +
1.103 + return listiterator(self)
1.104 +
1.105 +class str(basestring):
1.106 + pass
1.107 +
1.108 +class unicode(basestring):
1.109 + def encode(self, encoding): pass
1.110 +
1.111 +# vim: tabstop=4 expandtab shiftwidth=4