Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@utils.cached_property
def testprop(self):
self.counter += 1
return self.counter
@cached_property
def my_soft_locks(self):
for lock in self.soft_locks:
if lock['user'] == identity():
yield lock
@cached_property
def revision(self):
return get_rev()
@cached_property
def other_peoples_soft_locks(self):
for lock in self.soft_locks:
if lock['user'] != identity():
yield lock
@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'])
@cached_property
def branch(self):
return get_git_branch()
@cached_property
def magic_number(self):
return int(md5(self.name.encode('UTF-8')).hexdigest(), 16)
@cached_property
def content(self):
return CONTENT_PROCESSORS[self.attributes['content_type']](self)
@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:
@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,
},