micropython

lib/builtins.py

78:a550b84e0ea5
2008-05-04 Paul Boddie Made the temporary storage allocation and deallocation more adaptive so that entries are only reserved when actually required and discarded when actually used. Introduced temporary storage usage for invocation targets instead of having a LoadCallable instruction.
     1 #!/usr/bin/env python     2      3 """     4 Simple built-in classes and functions.     5      6 Copyright (C) 2005, 2006, 2007, 2008 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 class object:    23     def __init__(self): pass    24     def __bool__(self): pass    25     def __iadd__(self, other): pass    26     27 class basestring(object):    28     def __init__(self, x=None): pass    29     def __getitem__(self, index): pass    30     def __getslice__(self, start, end=None): pass    31     def __iadd__(self, other): pass    32     def __add__(self, other): pass    33     def __radd__(self, other): pass    34     def __mul__(self, other): pass    35     def __radd__(self, other): pass    36     def __mod__(self, other): pass    37     def __lt__(self, other): pass    38     def __gt__(self, other): pass    39     def __le__(self, other): pass    40     def __ge__(self, other): pass    41     def __eq__(self, other): pass    42     def __ne__(self, other): pass    43     def __len__(self): pass    44     def __str__(self): pass    45     def __bool__(self): pass    46     def join(self, l): pass    47     48 class bool(object):    49     def __bool__(self): pass    50     def __str__(self): pass    51     52 class buffer(object):    53     def __init__(self, size): pass    54     def append(self, s): pass    55     def __str__(self): pass    56     57 class complex(object):    58     def __init__(self, real, imag=None): pass    59     60 class dict(object):    61     def __init__(self, *args): pass    62     def __setitem__(self, key, value): pass    63     def __getitem__(self, key): pass    64     65 class file(object):    66     def write(self, s): pass    67     68 class float(object):    69     def __init__(self, number_or_string=None): pass    70     def __iadd__(self, other): pass    71     def __isub__(self, other): pass    72     def __add__(self, other): pass    73     def __radd__(self, other): pass    74     def __sub__(self, other): pass    75     def __rsub__(self, other): pass    76     def __mul__(self, other): pass    77     def __rmul__(self, other): pass    78     def __div__(self, other): pass    79     def __rdiv__(self, other): pass    80     def __floordiv__(self, other): pass    81     def __rfloordiv__(self, other): pass    82     def __mod__(self, other): pass    83     def __pow__(self, other): pass    84     def __rpow__(self, other): pass    85     def __lt__(self, other): pass    86     def __gt__(self, other): pass    87     def __le__(self, other): pass    88     def __ge__(self, other): pass    89     def __eq__(self, other): pass    90     def __ne__(self, other): pass    91     def __neg__(self): pass    92     def __pos__(self): pass    93     def __str__(self): pass    94     def __bool__(self): pass    95     96 class frozenset(object):    97     def __init__(self, iterable): pass    98     99 class int(object):   100     def __init__(self, number_or_string=None): pass   101     def __iadd__(self, other): pass   102     def __isub__(self, other): pass   103     def __add__(self, other): pass   104     def __radd__(self, other): pass   105     def __sub__(self, other): pass   106     def __rsub__(self, other): pass   107     def __mul__(self, other): pass   108     def __rmul__(self, other): pass   109     def __div__(self, other): pass   110     def __rdiv__(self, other): pass   111     def __floordiv__(self, other): pass   112     def __rfloordiv__(self, other): pass   113     def __mod__(self, other): pass   114     def __pow__(self, other): pass   115     def __and__(self, other): pass   116     def __rand__(self, other): pass   117     def __or__(self, other): pass   118     def __ror__(self, other): pass   119     def __xor__(self, other): pass   120     def __rxor__(self, other): pass   121     def __lt__(self, other): pass   122     def __gt__(self, other): pass   123     def __le__(self, other): pass   124     def __ge__(self, other): pass   125     def __eq__(self, other): pass   126     def __ne__(self, other): pass   127     def __neg__(self): pass   128     def __pos__(self): pass   129     def __str__(self): pass   130     def __bool__(self): pass   131    132 class list(object):   133     def __init__(self, args=()): pass   134     def __getitem__(self, index): pass   135     def __setitem__(self, index, value): pass   136     def __getslice__(self, start, end=None): pass   137     def __setslice__(self, start, end, slice): pass   138     def append(self, value): pass   139     def __len__(self): pass   140     def __add__(self, other): pass   141     def __iadd__(self, other): pass   142     def __str__(self): pass   143     def __iter__(self): pass   144     def __bool__(self): pass   145    146 class long(object):   147     def __init__(self, number_or_string=None): pass   148     def __iadd__(self, other): pass   149     def __isub__(self, other): pass   150     def __add__(self, other): pass   151     def __radd__(self, other): pass   152     def __sub__(self, other): pass   153     def __rsub__(self, other): pass   154     def __mul__(self, other): pass   155     def __rmul__(self, other): pass   156     def __div__(self, other): pass   157     def __rdiv__(self, other): pass   158     def __floordiv__(self, other): pass   159     def __rfloordiv__(self, other): pass   160     def __and__(self, other): pass   161     def __rand__(self, other): pass   162     def __or__(self, other): pass   163     def __ror__(self, other): pass   164     def __xor__(self, other): pass   165     def __rxor__(self, other): pass   166     def __lt__(self, other): pass   167     def __gt__(self, other): pass   168     def __le__(self, other): pass   169     def __ge__(self, other): pass   170     def __eq__(self, other): pass   171     def __ne__(self, other): pass   172     def __neg__(self): pass   173     def __pos__(self): pass   174     def __str__(self): pass   175     def __bool__(self): pass   176    177 class set(object):   178     def __init__(self, iterable): pass   179    180 class slice(object):   181     def __init__(self, start_or_end, end=None, step=None): pass   182    183 class str(basestring):   184     pass   185    186 class type(object):   187     pass   188    189 class tuple(object):   190     def __init__(self, args): pass   191     def __getitem__(self, index): pass   192     def __getslice__(self, start, end=None): pass   193     def __len__(self): pass   194     def __add__(self, other): pass   195     def __str__(self): pass   196     def __iter__(self): pass   197     def __bool__(self): pass   198    199 class unicode(basestring):   200     pass   201    202 class xrange(object):   203     def __init__(self, start_or_end, end=None, step=1): pass   204     def __iter__(self): pass   205     def next(self): pass   206    207 # Exceptions and warnings.   208    209 class BaseException(object):   210     def __init__(self, *args): pass   211    212 class Exception(BaseException): pass   213 class Warning(object): pass   214    215 class ArithmeticError(Exception): pass   216 class AssertionError(Exception): pass   217 class AttributeError(Exception): pass   218 class DeprecationWarning(Exception): pass   219 class EOFError(Exception): pass   220 class EnvironmentError(Exception): pass   221 class FloatingPointError(Exception): pass   222 class FutureWarning(Warning): pass   223 class GeneratorExit(Exception): pass   224 class IndexError(Exception): pass   225 class IOError(Exception): pass   226 class ImportError(Exception): pass   227 class ImportWarning(Warning): pass   228 class IndentationError(Exception): pass   229 class IndexError(Exception): pass   230 class KeyError(Exception): pass   231 class KeyboardInterrupt(Exception): pass   232 class LookupError(Exception): pass   233 class MemoryError(Exception): pass   234 class NameError(Exception): pass   235 class NotImplementedError(Exception): pass   236 class OSError(Exception): pass   237 class OverflowError(Exception): pass   238 class PendingDeprecationWarning(Warning): pass   239 class ReferenceError(Exception): pass   240 class RuntimeError(Exception): pass   241 class RuntimeWarning(Warning): pass   242 class StandardError(Exception): pass   243 class StopIteration(Exception): pass   244 class SyntaxError(Exception): pass   245 class SyntaxWarning(Warning): pass   246 class SystemError(Exception): pass   247 class SystemExit(Exception): pass   248 class TabError(Exception): pass   249 class TypeError(Exception): pass   250 class UnboundLocalError(Exception): pass   251 class UnicodeDecodeError(Exception): pass   252 class UnicodeEncodeError(Exception): pass   253 class UnicodeError(Exception): pass   254 class UnicodeTranslateError(Exception): pass   255 class UnicodeWarning(Warning): pass   256 class UserWarning(Warning): pass   257 class ValueError(Exception): pass   258 class ZeroDivisionError(Exception): pass   259    260 # Various types.   261    262 class EllipsisType(object): pass   263    264 class NoneType(object):   265     def __bool__(self): pass   266     def __str__(self): pass   267    268 class NotImplementedType: pass   269    270 # Special values.   271    272 True = bool()   273 False = bool()   274 None = NoneType()   275 Ellipsis = EllipsisType()   276 NotImplemented = NotImplementedType()   277    278 # General functions.   279 # NOTE: Some of these are actually provided by classes in CPython.   280 # NOTE: We may refuse to support some of these in practice, such as...   281 # NOTE: super, reload.   282    283 def __import__(name, globals=None, locals=None, fromlist=None, level=-1): pass   284 def abs(number): pass   285 def all(iterable): pass   286 def any(iterable): pass   287 def callable(obj): pass   288 def chr(i): pass   289 def classmethod(function): pass   290 def cmp(x, y): pass   291 def compile(source, filename, mode, flags=None, dont_inherit=None): pass   292 def delattr(obj, name): pass   293 def dir(obj=None): pass   294 def divmod(x, y): pass   295 def enumerate(iterable): pass   296 def eval(source, globals=None, locals=None): pass   297 def execfile(filename, globals=None, locals=None): pass   298 def filter(function, sequence): pass   299 def getattr(obj, name, default=None): pass   300 def globals(): pass   301 def hasattr(obj, name): pass   302 def hash(obj): pass   303 def help(*args, **kw): pass   304 def hex(number): pass   305 def id(obj): pass   306 def input(prompt=None): pass   307 def isinstance(obj, cls_or_tuple): pass   308 def issubclass(obj, cls_or_tuple): pass   309 def iter(collection_or_callable, sentinel=None): pass   310 def len(obj): pass   311 def locals(): pass   312 def map(function, *args): pass   313 def max(*args, **kw): pass   314 def min(*args, **kw): pass   315 def oct(number): pass   316 def open(name, mode=None, buffering=None): pass   317 def ord(c): pass   318 def pow(x, y, z=None): pass   319 def property(fget=None, fset=None, fdel=None, doc=None): pass   320 def range(start_or_end, end=None, step=None): pass   321 def raw_input(prompt=None): pass   322 def reduce(function, sequence, initial=None): pass   323 def reload(module): pass   324 def repr(obj): pass   325 def reversed(sequence): pass   326 def round(number, ndigits=None): pass   327 def setattr(obj, name, value): pass   328 def sorted(iterable, cmp=None, key=None, reverse=False): pass   329 def staticmethod(function): pass   330 def sum(sequence, start=0): pass   331 def super(*args): pass   332 def unichr(i): pass   333 def vars(obj=None): pass   334 def zip(*args): pass   335    336 # vim: tabstop=4 expandtab shiftwidth=4