Home | Trees | Indices | Help |
|
---|
|
1 """Defines base class for any type that stores mutable data 2 which is readable and writable, and can check for exchangeable 3 alternatives. 4 """ 5 6 # -------------------------------------------------------------------------- 7 # ***** BEGIN LICENSE BLOCK ***** 8 # 9 # Copyright (c) 2007-2011, Python File Format Interface 10 # All rights reserved. 11 # 12 # Redistribution and use in source and binary forms, with or without 13 # modification, are permitted provided that the following conditions 14 # are met: 15 # 16 # * Redistributions of source code must retain the above copyright 17 # notice, this list of conditions and the following disclaimer. 18 # 19 # * Redistributions in binary form must reproduce the above 20 # copyright notice, this list of conditions and the following 21 # disclaimer in the documentation and/or other materials provided 22 # with the distribution. 23 # 24 # * Neither the name of the Python File Format Interface 25 # project nor the names of its contributors may be used to endorse 26 # or promote products derived from this software without specific 27 # prior written permission. 28 # 29 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 # POSSIBILITY OF SUCH DAMAGE. 41 # 42 # ***** END LICENSE BLOCK ***** 43 # -------------------------------------------------------------------------- 44 45 import pyffi.utils.graph 4648 """Abstract base class from which all types are derived.""" 499151 """Read object from file. 52 53 :param stream: The stream to read from. 54 :type stream: ``file`` 55 """ 56 raise NotImplementedError5759 """Write object to file. 60 61 :param stream: The stream to write to. 62 :type stream: ``file`` 63 """ 64 raise NotImplementedError6567 """Returns ``True`` if objects are interchangeable, that is, 68 "close" enough to each other so they can be considered equal 69 for practical purposes. This is useful for instance when comparing 70 data and trying to remove duplicates. 71 72 This default implementation simply checks for object identity. 73 74 >>> x = AnyType() 75 >>> y = AnyType() 76 >>> x.is_interchangeable(y) 77 False 78 >>> x.is_interchangeable(x) 79 True 80 81 :return: ``True`` if objects are close, ``False`` otherwise. 82 :rtype: ``bool`` 83 """ 84 return self is other85
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 10 19:04:07 2011 | http://epydoc.sourceforge.net |