Пример #1
0
 def __init__(self, designator=None, designator_format=None):
   Object.__init__(self)
   self._properties = Properties()
   self._id = id(self)
   self._designator_format = None
   self._designator = None
   if designator_format:
     self.set_designator_format(designator_format)
   else:
     self.set_designator_format(self.DESIGNATOR_FORMAT)
   if designator:
     self.set_designator(designator)
   else:
     self.generate_designator()
   if getattr(self.__class__, "default_properties", None):
     self.add_properties(self.__class__.default_properties)
Пример #2
0
 def __init__(self, name=None, home_dir=None, init_home_dir=False, settings_dir=None):
   Object.__init__(self)
   self._name = None
   self._network = Network()
   self._home_dir = None
   self._build_dir = None
   self._settings_dir = None
   if settings_dir:
     if not path_utils.exists(settings_dir):
       raise IOError()
     self._settings_dir = settings_dir
   if home_dir:
     if not self.is_home_dir(home_dir) and init_home_dir:
       self.init_home_dir(home_dir)
     self._set_home_dir(home_dir)
   if name:
     self.set_name(name)
   elif self.get_home_dir():
     self.set_name(path_utils.basename(self.get_home_dir()))
   else:
     raise NotImplementedError()