micropython

Changeset

544:7e2bd174ae73
2012-06-12 Paul Boddie raw files shortlog changelog graph Added placeholder modules for _weakref and math. Added a test of math function imports.
lib/_weakref.py (file) lib/math.py (file) tests/maths.py (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/_weakref.py	Tue Jun 12 23:52:18 2012 +0200
     1.3 @@ -0,0 +1,29 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +"""
     1.7 +Weak references.
     1.8 +
     1.9 +Copyright (C) 2012 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 +class ref:
    1.26 +    pass
    1.27 +
    1.28 +def getweakrefcount(obj): pass
    1.29 +def getweakrefs(obj): pass
    1.30 +def proxy(obj, callback=None): pass
    1.31 +
    1.32 +# vim: tabstop=4 expandtab shiftwidth=4
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/lib/math.py	Tue Jun 12 23:52:18 2012 +0200
     2.3 @@ -0,0 +1,55 @@
     2.4 +#!/usr/bin/env python
     2.5 +
     2.6 +"""
     2.7 +Mathematical functions.
     2.8 +
     2.9 +Copyright (C) 2012 Paul Boddie <paul@boddie.org.uk>
    2.10 +
    2.11 +This program is free software; you can redistribute it and/or modify it under
    2.12 +the terms of the GNU General Public License as published by the Free Software
    2.13 +Foundation; either version 3 of the License, or (at your option) any later
    2.14 +version.
    2.15 +
    2.16 +This program is distributed in the hope that it will be useful, but WITHOUT
    2.17 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.18 +FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    2.19 +details.
    2.20 +
    2.21 +You should have received a copy of the GNU General Public License along with
    2.22 +this program.  If not, see <http://www.gnu.org/licenses/>.
    2.23 +"""
    2.24 +
    2.25 +def pow(x, y):
    2.26 +
    2.27 +    "Return x ** y."
    2.28 +
    2.29 +    return x ** y
    2.30 +
    2.31 +def acos(x): pass
    2.32 +def asin(x): pass
    2.33 +def atan(x): pass
    2.34 +def atan2(y, x): pass
    2.35 +def ceil(x): pass
    2.36 +def cos(x): pass
    2.37 +def cosh(x): pass
    2.38 +def degrees(x): pass
    2.39 +def exp(x): pass
    2.40 +def fabs(x): pass
    2.41 +def floor(x): pass
    2.42 +def fmod(x, y): pass
    2.43 +def frexp(x): pass
    2.44 +def hypot(x, y): pass
    2.45 +def ldexp(x, i): pass
    2.46 +def log(x, base=None): pass
    2.47 +def log10(x): pass
    2.48 +def modf(x): pass
    2.49 +def radians(x): pass
    2.50 +def sin(x): pass
    2.51 +def sinh(x): pass
    2.52 +def sqrt(x): pass
    2.53 +def tan(x): pass
    2.54 +def tanh(x): pass
    2.55 +
    2.56 +# NOTE: To be defined: e, pi.
    2.57 +
    2.58 +# vim: tabstop=4 expandtab shiftwidth=4
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tests/maths.py	Tue Jun 12 23:52:18 2012 +0200
     3.3 @@ -0,0 +1,9 @@
     3.4 +#!/usr/bin/env python
     3.5 +
     3.6 +from math import pow
     3.7 +
     3.8 +result1_1 = pow(2, 0)
     3.9 +result2_1 = pow(1, 1)
    3.10 +result3_1 = pow(1, 10)
    3.11 +
    3.12 +# vim: tabstop=4 expandtab shiftwidth=4