def __getattr__(self, name):
        if hasattr(self.meta, 'config'):
            config = setup_vn_mtx_case(self.special_versions,
                                       config=self.meta.config)
            self.meta.parse_again(config)
        else:
            with setup_vn_mtx_case(self.special_versions):
                self.meta.parse_again()
        result = getattr(self.meta, name)

        # Wrap any callable such that it is called within the appropriate
        # environment.
        # callable exists in python 2.* and >=3.2
        if callable(result):
            orig_result = result
            import functools
            @functools.wraps(result)
            def with_vn_mtx_setup(*args, **kwargs):
                if hasattr(self.meta, 'config'):
                    config = setup_vn_mtx_case(self.special_versions,
                                               config=self.meta.config)
                    self.meta.parse_again(config=config)
                    return orig_result(*args, **kwargs)
                else:
                    with setup_vn_mtx_case(self.special_versions):
                        self.meta.parse_again()
                        return orig_result(*args, **kwargs)
            result = with_vn_mtx_setup
        return result
Beispiel #2
0
    def __getattr__(self, name):
        if hasattr(self.meta, 'config'):
            config = setup_vn_mtx_case(self.special_versions,
                                       config=self.meta.config)
            self.meta.parse_again(config)
        else:
            with setup_vn_mtx_case(self.special_versions):
                self.meta.parse_again()
        result = getattr(self.meta, name)

        # Wrap any callable such that it is called within the appropriate
        # environment.
        # callable exists in python 2.* and >=3.2
        if callable(result):
            orig_result = result
            import functools
            @functools.wraps(result)
            def with_vn_mtx_setup(*args, **kwargs):
                if hasattr(self.meta, 'config'):
                    config = setup_vn_mtx_case(self.special_versions,
                                               config=self.meta.config)
                    self.meta.parse_again(config=config)
                    return orig_result(*args, **kwargs)
                else:
                    with setup_vn_mtx_case(self.special_versions):
                        self.meta.parse_again()
                        return orig_result(*args, **kwargs)
            result = with_vn_mtx_setup
        return result
 def with_vn_mtx_setup(*args, **kwargs):
     if hasattr(self.meta, 'config'):
         config = setup_vn_mtx_case(self.special_versions,
                                    config=self.meta.config)
         self.meta.parse_again(config=config)
         return orig_result(*args, **kwargs)
     else:
         with setup_vn_mtx_case(self.special_versions):
             self.meta.parse_again()
             return orig_result(*args, **kwargs)
Beispiel #4
0
 def with_vn_mtx_setup(*args, **kwargs):
     if hasattr(self.meta, 'config'):
         config = setup_vn_mtx_case(self.special_versions,
                                    config=self.meta.config)
         self.meta.parse_again(config=config)
         return orig_result(*args, **kwargs)
     else:
         with setup_vn_mtx_case(self.special_versions):
             self.meta.parse_again()
             return orig_result(*args, **kwargs)
 def vn_context(self, config=None):
     return setup_vn_mtx_case(self.special_versions, config)
Beispiel #6
0
 def vn_context(self, config=None):
     return setup_vn_mtx_case(self.special_versions, config)