for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import os
import yorm
yorm
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
from ..domain import Template
@yorm.attr(all=yorm.types.String)
__init__
class StringList(yorm.types.List):
pass
@yorm.attr(key=yorm.types.String)
@yorm.attr(name=yorm.types.String)
@yorm.attr(default=StringList)
@yorm.attr(link=yorm.types.String)
@yorm.attr(aliases=StringList)
@yorm.attr(regexes=StringList)
@yorm.sync("{self.root}/{self.key}/config.yml")
class TemplateModel:
"""Persistence model for templates."""
def __init__(self, key, root):
self.key = key
self.root = root
@property
def domain(self):
# pylint: disable=no-member
return Template(
key=self.key,
name=self.name,
lines=self.default,
aliases=self.aliases,
patterns=self.regexes,
link=self.link,
root=self.root,
)
def load_before(func):
def wrapped(self, *args, **kwargs):
# pylint: disable=protected-access
if self._items is None:
self._load()
return func(self, *args, **kwargs)
return wrapped
class TemplateStore:
def __init__(self, root):
self._items = None
@load_before
def read(self, key):
try:
model = self._items[key]
except KeyError:
return None
else:
return model.domain
def filter(self, **_):
templates = []
for model in self._items.values():
templates.append(model.domain)
return templates
def _load(self):
self._items = {}
for key in os.listdir(self.root):
if key[0] not in ('.', '_'):
model = TemplateModel(key, self.root)
self._items[key] = model
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.