Fix lint errors

master
Cristi Vîjdea 2018-12-21 15:07:38 +02:00
parent db61c39ab1
commit 66026d3483
5 changed files with 11 additions and 18 deletions

View File

@ -55,11 +55,6 @@
</option> </option>
</inspection_tool> </inspection_tool>
<inspection_tool class="PyShadowingNamesInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> <inspection_tool class="PyShadowingNamesInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PyUnusedLocalInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
<option name="ignoreTupleUnpacking" value="true" />
<option name="ignoreLambdaParameters" value="true" />
<option name="ignoreLoopIterationVariables" value="true" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false"> <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" /> <option name="processCode" value="true" />
<option name="processLiterals" value="true" /> <option name="processLiterals" value="true" />

View File

@ -65,7 +65,9 @@ def drf_yasg_setup(**kwargs):
try: try:
import setuptools_scm # noinspection PyUnresolvedReferences
import setuptools_scm # noqa: F401
drf_yasg_setup(use_scm_version=True) drf_yasg_setup(use_scm_version=True)
except (ImportError, LookupError) as e: except (ImportError, LookupError) as e:
if os.getenv('CI', 'false') == 'true' or os.getenv('TRAVIS', 'false') == 'true': if os.getenv('CI', 'false') == 'true' or os.getenv('TRAVIS', 'false') == 'true':

View File

@ -121,8 +121,7 @@ class SaneYamlDumper(yaml.SafeDumper):
""" """
return super(SaneYamlDumper, self).increase_indent(flow=flow, indentless=False, **kwargs) return super(SaneYamlDumper, self).increase_indent(flow=flow, indentless=False, **kwargs)
@staticmethod def represent_odict(self, mapping, flow_style=None): # pragma: no cover
def represent_odict(dump, mapping, flow_style=None): # pragma: no cover
"""https://gist.github.com/miracle2k/3184458 """https://gist.github.com/miracle2k/3184458
Make PyYAML output an OrderedDict. Make PyYAML output an OrderedDict.
@ -134,22 +133,22 @@ class SaneYamlDumper(yaml.SafeDumper):
tag = YAML_MAP_TAG tag = YAML_MAP_TAG
value = [] value = []
node = yaml.MappingNode(tag, value, flow_style=flow_style) node = yaml.MappingNode(tag, value, flow_style=flow_style)
if dump.alias_key is not None: if self.alias_key is not None:
dump.represented_objects[dump.alias_key] = node self.represented_objects[self.alias_key] = node
best_style = True best_style = True
if hasattr(mapping, 'items'): if hasattr(mapping, 'items'):
mapping = mapping.items() mapping = mapping.items()
for item_key, item_value in mapping: for item_key, item_value in mapping:
node_key = dump.represent_data(item_key) node_key = self.represent_data(item_key)
node_value = dump.represent_data(item_value) node_value = self.represent_data(item_value)
if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style): if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style):
best_style = False best_style = False
if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style): if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style):
best_style = False best_style = False
value.append((node_key, node_value)) value.append((node_key, node_value))
if flow_style is None: if flow_style is None:
if dump.default_flow_style is not None: if self.default_flow_style is not None:
node.flow_style = dump.default_flow_style node.flow_style = self.default_flow_style
else: else:
node.flow_style = best_style node.flow_style = best_style
return node return node

View File

@ -211,7 +211,7 @@ def is_list_view(path, method, view):
""" """
# for ViewSets, it could be the default 'list' action, or a list_route # for ViewSets, it could be the default 'list' action, or a list_route
action = getattr(view, 'action', '') action = getattr(view, 'action', '')
method = getattr(view, action, None) method = getattr(view, action, None) or method
detail = getattr(method, 'detail', None) detail = getattr(method, 'detail', None)
suffix = getattr(view, 'suffix', None) suffix = getattr(view, 'suffix', None)
if action in ('list', 'create') or detail is False or suffix == 'List': if action in ('list', 'create') or detail is False or suffix == 'List':

View File

@ -1,7 +1,4 @@
from django.contrib.staticfiles.templatetags.staticfiles import static from django.contrib.staticfiles.templatetags.staticfiles import static
from django.urls import NoReverseMatch
from django.utils.encoding import force_text
from django.utils.functional import lazy from django.utils.functional import lazy
static_lazy = lazy(static, str) static_lazy = lazy(static, str)