How to use the bundlewrap.utils.cached_property function in bundlewrap

To help you get started, we’ve selected a few bundlewrap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bundlewrap / bundlewrap / tests_legacy / unit / utils / utils_tests.py View on Github external
            @utils.cached_property
            def testprop(self):
                self.counter += 1
                return self.counter
github bundlewrap / bundlewrap / bundlewrap / lock.py View on Github external
    @cached_property
    def my_soft_locks(self):
        for lock in self.soft_locks:
            if lock['user'] == identity():
                yield lock
github bundlewrap / bundlewrap / bundlewrap / repo.py View on Github external
    @cached_property
    def revision(self):
        return get_rev()
github bundlewrap / bundlewrap / bundlewrap / lock.py View on Github external
    @cached_property
    def other_peoples_soft_locks(self):
        for lock in self.soft_locks:
            if lock['user'] != identity():
                yield lock
github bundlewrap / bundlewrap / bundlewrap / items / files.py View on Github external
    @cached_property
    def template(self):
        data_template = join(self.item_data_dir, self.attributes['source'])
        if exists(data_template):
            return data_template
        return join(self.item_dir, self.attributes['source'])
github bundlewrap / bundlewrap / bundlewrap / repo.py View on Github external
    @cached_property
    def branch(self):
        return get_git_branch()
github bundlewrap / bundlewrap / bundlewrap / node.py View on Github external
    @cached_property
    def magic_number(self):
        return int(md5(self.name.encode('UTF-8')).hexdigest(), 16)
github bundlewrap / bundlewrap / bundlewrap / items / files.py View on Github external
    @cached_property
    def content(self):
        return CONTENT_PROCESSORS[self.attributes['content_type']](self)
github bundlewrap / bundlewrap / bundlewrap / node.py View on Github external
    @cached_property
    @io.job_wrapper(_("{}  determining groups").format(bold("{0.name}")))
    def groups(self):
        _groups = set()

        for group_name in set(self._attributes.get('groups', set())):
            with error_context(node=self.name):
                _groups.add(self.repo.get_group(group_name))

        for group in self.repo.groups:
            if group in _groups:
                # we're already in this group, no need to check it again
                continue
            if self in group._nodes_from_members:
                _groups.add(group)
                continue
            for pattern in group._member_patterns:
github bundlewrap / bundlewrap / bundlewrap / bundle.py View on Github external
    @cached_property
    @io.job_wrapper(_("{}  {}  parsing bundle").format(bold("{0.node.name}"), bold("{0.name}")))
    def bundle_attrs(self):
        if not exists(self.bundle_file):
            return {}
        else:
            return get_all_attrs_from_file(
                self.bundle_file,
                base_env={
                    'node': self.node,
                    'repo': self.repo,
                },