golem.helpers.generics
index
/opt/local/lib/python2.4/site-packages/golem/helpers/generics.py

# Part of pyGolem. See LICENSE in the root of your distribution for the license.
# Andrew Walkingshaw <andrew@lexical.org.uk>

 
Modules
       
copy
lxml.etree
golem
md5
random
simplejson
sys
types
urllib

 
Classes
       
__builtin__.object
Unit
dict_mixin
ns_dict_mixin
unit_mixin
__builtin__.type(__builtin__.object)
unit_metaclass
exceptions.AttributeError(exceptions.StandardError)
UndefinedUnitError

 
class UndefinedUnitError(exceptions.AttributeError)
    
Method resolution order:
UndefinedUnitError
exceptions.AttributeError
exceptions.StandardError
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class Unit(__builtin__.object)
     Methods defined here:
__init__(self, symbol, uri=None, multiplierToSI=None, offsetToSI=None)
getSIConverter(self)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x81c46d0>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Unit' objects>
list of weak references to the object (if defined)

 
class dict_mixin(__builtin__.object)
     Properties defined here:
entry
get = __getentry(cls)
set = __setentry(cls, e)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x81c4470>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'dict_mixin' objects>
list of weak references to the object (if defined)

 
class ns_dict_mixin(__builtin__.object)
     Data and other attributes defined here:
__dict__ = <dictproxy object at 0x81c4550>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'ns_dict_mixin' objects>
list of weak references to the object (if defined)
namespaced_dictionary = <class 'golem.helpers.generics.namespaced_dictionary'>

 
class unit_metaclass(__builtin__.type)
    
Method resolution order:
unit_metaclass
__builtin__.type
__builtin__.object

Static methods defined here:
__new__(cls, name, bases, dct)

Methods inherited from __builtin__.type:
__call__(...)
x.__call__(...) <==> x(...)
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__hash__(...)
x.__hash__() <==> hash(x)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__subclasses__(...)
__subclasses__() -> list of immediate subclasses
mro(...)
mro() -> list
return a type's method resolution order

Data and other attributes inherited from __builtin__.type:
__base__ = <type 'type'>
__bases__ = (<type 'type'>,)
__basicsize__ = 420
__dict__ = <dictproxy object at 0x81c4570>
__dictoffset__ = 132
__flags__ = 22523
__itemsize__ = 20
__mro__ = (<class 'golem.helpers.generics.unit_metaclass'>, <type 'type'>, <type 'object'>)
__weakrefoffset__ = 184

 
class unit_mixin(__builtin__.object)
     Methods defined here:
__abs__ lambda x, z='__abs__'
__add__ lambda x, y, z='__add__'
__and__ lambda x, y, z='__and__'
__coerce__ lambda x, y, z='__coerce__'
__complex__ lambda x, z='__complex__'
__delitem__ = delitem(self, k)
__delslice__ = delslice(self, i, j)
# sequence types
__div__ lambda x, y, z='__div__'
__divmod__ lambda x, y, z='__divmod__'
__float__ lambda x, z='__float__'
__floordiv__ lambda x, y, z='__floordiv__'
__hex__ lambda x, z='__hex__'
__iadd__ lambda x, y, z='__iadd__'
__iand__ lambda x, y, z='__iand__'
__idiv__ lambda x, y, z='__idiv__'
__ilshift__ lambda x, y, z='__ilshift__'
__imod__ lambda x, y, z='__imod__'
__imul__ lambda x, y, z='__imul__'
__index__ lambda x, z='__index__'
__int__ lambda x, z='__int__'
__invert__ lambda x, z='__invert__'
__ior__ lambda x, y, z='__ior__'
__ipow__ lambda x, y, m=None, z='__ipow__'
__irshift__ lambda x, y, z='__irshift__'
__isub__ lambda x, y, z='__isub__'
__itruediv__ lambda x, y, z='__itruediv__'
__ixor__ lambda x, y, z='__ixor__'
__long__ lambda x, z='__long__'
__lshift__ lambda x, y, z='__lshift__'
__mod__ lambda x, y, z='__mod__'
__mul__ lambda x, y, z='__mul__'
__neg__ lambda x, z='__neg__'
__oct__ lambda x, z='__oct__'
__or__ lambda x, y, z='__or__'
__pos__ lambda x, z='__pos__'
__pow__ lambda x, y, m=None, z='__pow__'
__radd__ lambda x, y, z='__radd__'
__rand__ lambda x, y, z='__rand__'
__rdiv__ lambda x, y, z='__rdiv__'
__rdivmod__ lambda x, y, z='__rdivmod__'
__rfloordiv__ lambda x, y, z='__rfloordiv__'
__rlshift__ lambda x, y, z='__rlshift__'
__rmod__ lambda x, y, z='__rmod__'
__rmul__ lambda x, y, z='__rmul__'
__ror__ lambda x, y, z='__ror__'
__rpow__ lambda x, y, z='__rpow__'
__rrshift__ lambda x, y, z='__rrshift__'
__rshift__ lambda x, y, z='__rshift__'
__rsub__ lambda x, y, z='__rsub__'
__rtruediv__ lambda x, y, z='__rtruediv__'
__rxor__ lambda x, y, z='__rxor__'
__setitem__ = setitem(self, k, v)
# container types
__setslice__ = setslice(self, i, j, seq)
__sub__ lambda x, y, z='__sub__'
__truediv__ lambda x, y, z='__truediv__'
__xor__ lambda x, y, z='__xor__'
append lambda x, z='append'
extend lambda x, z='extend'
insert(self, i, x)
pop(self, arg=-1)
remove lambda x, z='remove'
reverse(self)
sort(self, *args)

Properties defined here:
as_SI
get = __get_as_SI(cls)
unit
'unit' property
get = __getunit(cls)
set = __setunit(cls, symbol_or_class)
delete = __delunit(cls)
uri
get = __geturi(cls)
set = __seturi(cls, uri)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x81c46d0>
dictionary for instance variables (if defined)
__metaclass__ = <class 'golem.helpers.generics.unit_metaclass'>
__weakref__ = <attribute '__weakref__' of 'unit_mixin' objects>
list of weak references to the object (if defined)

 
Functions
       
golemdata(x, u=None, e=None, warnings=None)
hexstring()
Generate a random hex string based on nothing in particular.
json_single(y)
print_rdf(x, datatype_uri=None, about=None)
print_rdf_rich(x, resource, property=None)
For a given Golem value x, with units x.unit and concept x.uri,
from URI 'resource', produce an RDF/XML fragment of the form:
 
<rdf:Description rdf:about="resource">
  <dictionary:uri rdf:about="resource#fragment">
    <golem:value datatype="http://example.org/json/">JSON literal
    </golem:value>
    <golem:units>unit</golem:units>
  </dictionary:uri>
</rdf:Description>