示例#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)
示例#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)
示例#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]
示例#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]
示例#5
0
 def singleton(cls):
     '''
     Get a singleton instance.
     '''
     return singleton(cls)
示例#6
0
文件: state.py 项目: GbalsaC/bitnamiP
 def singleton(cls):
     '''
     Get a singleton instance.
     '''
     return singleton(cls)