for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Custom YAML representers."""
from collections import OrderedDict
import yaml
yaml
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
class LiteralString(str):
"""Custom type for strings which should be dumped in the literal style."""
def represent_none(self, _):
return self.represent_scalar('tag:yaml.org,2002:null', '')
def represent_literalstring(dumper, data):
return dumper.represent_scalar('tag:yaml.org,2002:str', data,
style='|' if data else '')
def represent_ordereddict(dumper, data):
value = []
for item_key, item_value in data.items():
node_key = dumper.represent_data(item_key)
node_value = dumper.represent_data(item_value)
value.append((node_key, node_value))
return yaml.nodes.MappingNode('tag:yaml.org,2002:map', value)
yaml.add_representer(LiteralString, represent_literalstring)
yaml.add_representer(OrderedDict, represent_ordereddict)
yaml.add_representer(type(None), represent_none)
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__.py
files in your module folders. Make sure that you place one file in each sub-folder.