示例#1
0
    def get_fget(name):
        private_name = name_to_private(name)

        def fget(self):
            return getattr(self, private_name)

        return fget
示例#2
0
文件: metaprog.py 项目: rainiraj/atk
 def _init_intermediate_classes(self, installation_class):
         """Instantiates every intermediate class defined in the installation class and adds
         them as private members to the new_instance, such that the properties (already defined)
         have something to return"""
         installation = get_installation(installation_class)
         for name, cls in installation.intermediates.items():
             private_member_name = name_to_private(name)
             if private_member_name not in self.__dict__:
                 logger.debug("Instantiating intermediate class %s as %s", cls, private_member_name)
                 private_member_value = cls(self._entity)  # instantiate
                 logger.debug("Adding intermediate class instance as member %s", private_member_name)
                 setattr(self, private_member_name, private_member_value)
示例#3
0
 def _init_intermediate_classes(self, installation_class):
     """Instantiates every intermediate class defined in the installation class and adds
         them as private members to the new_instance, such that the properties (already defined)
         have something to return"""
     installation = get_installation(installation_class)
     for name, cls in installation.intermediates.items():
         private_member_name = name_to_private(name)
         if private_member_name not in self.__dict__:
             logger.debug("Instantiating intermediate class %s as %s", cls,
                          private_member_name)
             private_member_value = cls(self._entity)  # instantiate
             logger.debug("Adding intermediate class instance as member %s",
                          private_member_name)
             setattr(self, private_member_name, private_member_value)
示例#4
0
文件: metaprog.py 项目: rainiraj/atk
    def get_fget(name):
        private_name = name_to_private(name)

        def fget(self):
            return getattr(self, private_name)
        return fget