Package pyffi :: Package object_models :: Module any_type :: Class AnyType
[hide private]
[frames] | no frames]

Class AnyType

source code

            object --+    
                     |    
utils.graph.DetailNode --+
                         |
                        AnyType
Known Subclasses:

Abstract base class from which all types are derived.
Instance Methods [hide private]
 
read(self, stream)
Read object from file.
source code
 
write(self, stream)
Write object to file.
source code
bool
is_interchangeable(self, other)
Returns True if objects are interchangeable, that is, "close" enough to each other so they can be considered equal for practical purposes.
source code
 
__hash__(self)
AnyType objects are mutable, so raise type error on hash calculation, as they cannot be safely used as dictionary keys.
source code

Inherited from utils.graph.DetailNode: get_detail_child_edge_types, get_detail_child_names, get_detail_child_nodes, get_detail_display, get_detail_iterator, replace_global_node

Inherited from object: __delattr__, __format__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

read(self, stream)

source code 
Read object from file.
Parameters:
  • stream (file) - The stream to read from.

write(self, stream)

source code 
Write object to file.
Parameters:
  • stream (file) - The stream to write to.

is_interchangeable(self, other)

source code 

Returns True if objects are interchangeable, that is, "close" enough to each other so they can be considered equal for practical purposes. This is useful for instance when comparing data and trying to remove duplicates.

This default implementation simply checks for object identity.

>>> x = AnyType()
>>> y = AnyType()
>>> x.is_interchangeable(y)
False
>>> x.is_interchangeable(x)
True
Returns: bool
True if objects are close, False otherwise.

__hash__(self)
(Hashing function)

source code 
AnyType objects are mutable, so raise type error on hash calculation, as they cannot be safely used as dictionary keys.
Overrides: object.__hash__