Esempio n. 1
0
def Global(name, default=None):
    '''
    Global (per-thread) binding from operator name to implementation, by
    namespace.
    '''
    # Delay creation to handle circular dependencies.
    assert name
    namespace_map = singleton(NamespaceMap)
    return namespace_map.get(name, default)
Esempio n. 2
0
def Global(name, default=None):
    '''
    Global (per-thread) binding from operator name to implementation, by
    namespace.
    '''
    # Delay creation to handle circular dependencies.
    assert name
    namespace_map = singleton(NamespaceMap)
    return namespace_map.get(name, default)
Esempio n. 3
0
def relations(base):
    # if base is a factory then we want the related type
    try:
        base = canonical_matcher_type(base)
    except MatcherTypeException:
        pass
    table = singleton(Relations, dict)
    if base not in table:
        table[base] = Relations(base)
    return table[base]
Esempio n. 4
0
def relations(base):
    # if base is a factory then we want the related type
    try:
        base = canonical_matcher_type(base)
    except MatcherTypeException:
        pass
    table = singleton(Relations, dict)
    if base not in table:
        table[base] = Relations(base)
    return table[base]
Esempio n. 5
0
 def singleton(cls):
     '''
     Get a singleton instance.
     '''
     return singleton(cls)
Esempio n. 6
0
 def singleton(cls):
     '''
     Get a singleton instance.
     '''
     return singleton(cls)