1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lib/__builtins__/string.py Tue Aug 30 21:55:58 2016 +0200
1.3 @@ -0,0 +1,107 @@
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__.operator import *
1.26 +import native
1.27 +
1.28 +class basestring(object):
1.29 + def __init__(self, data=None):
1.30 + # Note member.
1.31 + self.data = data
1.32 +
1.33 + def __contains__(self, value): pass
1.34 +
1.35 + def __getitem__(self, index):
1.36 + # Note usage.
1.37 + IndexError
1.38 +
1.39 + def __getslice__(self, start, end=None): pass
1.40 +
1.41 + def __iadd__(self, other):
1.42 + "Return a new string for the operation."
1.43 + return _binary_op(self, other, native._str_add)
1.44 +
1.45 + __add__ = __radd__ = __iadd__
1.46 +
1.47 + def __mul__(self, other): pass
1.48 + def __rmul__(self, other): pass
1.49 + def __mod__(self, other): pass
1.50 + def __rmod__(self, other): pass
1.51 +
1.52 + def __lt__(self, other):
1.53 + "Return a new boolean for the comparison."
1.54 + return _binary_op(self, other, native._str_lt)
1.55 +
1.56 + def __gt__(self, other):
1.57 + "Return a new boolean for the comparison."
1.58 + return _binary_op(self, other, native._str_gt)
1.59 +
1.60 + def __le__(self, other):
1.61 + "Return a new boolean for the comparison."
1.62 + return _negate(self.__gt__(other))
1.63 +
1.64 + def __ge__(self, other):
1.65 + "Return a new boolean for the comparison."
1.66 + return _negate(self.__lt__(other))
1.67 +
1.68 + def __eq__(self, other):
1.69 + "Return a new boolean for the comparison."
1.70 + return _binary_op(self, other, native._str_eq)
1.71 +
1.72 + def __ne__(self, other):
1.73 + "Return a new boolean for the comparison."
1.74 + return _negate(self.__eq__(other))
1.75 +
1.76 + def __len__(self): pass
1.77 + def __str__(self): pass
1.78 +
1.79 + def __bool__(self):
1.80 + return _negate(native._str_eq(self, ""))
1.81 +
1.82 + def endswith(self, s): pass
1.83 + def find(self, sub, start=None, end=None): pass
1.84 + def index(self, sub, start=None, end=None): pass
1.85 + def join(self, l): pass
1.86 + def lower(self): pass
1.87 + def lstrip(self, chars=None): pass
1.88 + def replace(self, old, new, count=None): pass
1.89 + def rfind(self, sub, start=None, end=None): pass
1.90 + def rsplit(self, sep=None, maxsplit=None): pass
1.91 + def rstrip(self, chars=None): pass
1.92 + def split(self, sep=None, maxsplit=None): pass
1.93 + def splitlines(self, keepends=False): pass
1.94 + def startswith(self, s): pass
1.95 + def strip(self, chars=None): pass
1.96 + def upper(self): pass
1.97 +
1.98 + def __iter__(self):
1.99 +
1.100 + "Return an iterator."
1.101 +
1.102 + return listiterator(self)
1.103 +
1.104 +class str(basestring):
1.105 + pass
1.106 +
1.107 +class unicode(basestring):
1.108 + def encode(self, encoding): pass
1.109 +
1.110 +# vim: tabstop=4 expandtab shiftwidth=4