예제 #1
0
파일: chain.py 프로젝트: miohtama/populus
 def set_chain_class(self, chain_identifier):
     if isinstance(chain_identifier, type):
         self.chain_class = chain_identifier
     elif is_string(chain_identifier):
         if chain_identifier.lower() in CHAIN_IDENTIFIER_MAP:
             self.chain_class = CHAIN_IDENTIFIER_MAP[chain_identifier.lower()]
         else:
             try:
                 import_string(chain_identifier)
             except ImportError:
                 raise ValueError(UNSUPPORTED_CHAIN_IDENTIFIER_MSG.format(chain_identifier))
             else:
                 self.chain_class = chain_identifier
     else:
         raise ValueError(UNSUPPORTED_CHAIN_IDENTIFIER_MSG.format(chain_identifier))
예제 #2
0
 def set_chain_class(self, chain_identifier):
     if isinstance(chain_identifier, type):
         self.chain_class = chain_identifier
     elif is_string(chain_identifier):
         if chain_identifier.lower() in CHAIN_IDENTIFIER_MAP:
             self.chain_class = CHAIN_IDENTIFIER_MAP[
                 chain_identifier.lower()]
         else:
             try:
                 import_string(chain_identifier)
             except ImportError:
                 raise ValueError(
                     UNSUPPORTED_CHAIN_IDENTIFIER_MSG.format(
                         chain_identifier))
             else:
                 self.chain_class = chain_identifier
     else:
         raise ValueError(
             UNSUPPORTED_CHAIN_IDENTIFIER_MSG.format(chain_identifier))
예제 #3
0
파일: backend.py 프로젝트: zutobg/populus
 def set_backend_class(self, backend_identifier):
     if isinstance(backend_identifier, type):
         self.backend_class = backend_identifier
     elif is_string(backend_identifier):
         if backend_identifier.lower() in self.backend_class_shortnames:
             self.backend_class = self.backend_class_shortnames[
                 backend_identifier.lower()]
         else:
             try:
                 import_string(backend_identifier)
             except ImportError:
                 raise ValueError(
                     UNSUPPORTED_BACKEND_IDENTIFIER_MSG.format(','.join(
                         tuple(self.backend_class_shortnames.keys()))))
             else:
                 self.backend_class = backend_identifier
     else:
         raise ValueError(
             UNSUPPORTED_BACKEND_IDENTIFIER_MSG.format(','.join(
                 tuple(self.backend_class_shortnames.keys()))))
예제 #4
0
 def set_provider_class(self, provider_identifier):
     if isinstance(provider_identifier, type):
         self.provider_class = provider_identifier
     elif is_string(provider_identifier):
         if provider_identifier.lower() in PROVIDER_IDENTIFIER_MAP:
             self.provider_class = PROVIDER_IDENTIFIER_MAP[
                 provider_identifier.lower()]
         else:
             try:
                 import_string(provider_identifier)
             except ImportError:
                 raise ValueError(
                     UNSUPPORTED_PROVIDER_IDENTIFIER_MSG.format(
                         provider_identifier))
             else:
                 self.provider_class = provider_identifier
     else:
         raise ValueError(
             UNSUPPORTED_PROVIDER_IDENTIFIER_MSG.format(
                 provider_identifier))