Skip to content

Commit

Permalink
fixes reported by static code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Jul 14, 2016
1 parent 15b57f2 commit c6909e6
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/collective/taxonomy/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def taxonomiesForContext(self, short_names=[]):
results.append(self.translate(
taxon,
domain='collective.taxonomy.' + short_name
)
)
))

return results

Expand Down
3 changes: 1 addition & 2 deletions src/collective/taxonomy/controlpanel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from plone.app.controlpanel.form import ControlPanelForm, ControlPanelView
from plone.app.controlpanel.form import ControlPanelForm
from plone.app.form.widgets.multicheckboxwidget import MultiCheckBoxWidget \
as BaseMultiCheckBoxWidget
from plone.behavior.interfaces import IBehavior

from Products.CMFPlone.interfaces import IPloneSiteRoot
from Products.CMFDefault.formlib.schema import ProxyFieldProperty
from Products.CMFDefault.formlib.schema import SchemaAdapterBase
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.statusmessages.interfaces import IStatusMessage

from zope.formlib import form as formlib
Expand Down
1 change: 0 additions & 1 deletion src/collective/taxonomy/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,3 @@ def taxonomiesForContext(self):

def translate(self, msgid, domain, target_language):
""" """

3 changes: 1 addition & 2 deletions src/collective/taxonomy/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def __call__(self):
'status': 'error',
'message': translate(
_("There seems to have been an error."),
context=request)
})
context=request)})

def generate_data_for_taxonomy(self, parsed_data, language,
path=PATH_SEPARATOR):
Expand Down
1 change: 0 additions & 1 deletion src/collective/taxonomy/testing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.app.testing import IntegrationTesting
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
Expand Down
4 changes: 1 addition & 3 deletions src/collective/taxonomy/upgradesteps.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from zope.component import getUtilitiesFor

from logging import getLogger

from plone.behavior.interfaces import IBehavior


log = getLogger('collective.taxonomy:upgrades')


Expand Down
2 changes: 1 addition & 1 deletion src/collective/taxonomy/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def clean(self):
self.data.clear()

def add(self, language, identifier, path):
if not language in self.data:
if language not in self.data:
self.data[language] = OOBTree()

self.data[language][path] = identifier
Expand Down
6 changes: 3 additions & 3 deletions src/collective/taxonomy/vdex.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def buildFinalPathIndex(self, node, tree):

for i in node:
# leaf
if not i in tree:
if i not in tree:
results[i] = {}
else:
results[i] = self.buildFinalPathIndex(tree[i], tree)
Expand All @@ -88,7 +88,7 @@ def buildPathIndex(self):
parent_path = path.split(PATH_SEPARATOR)[:-1]
parent_identifier = children.get(
PATH_SEPARATOR.join(parent_path))
if not parent_identifier in pathIndex:
if parent_identifier not in pathIndex:
pathIndex[parent_identifier] = set()
pathIndex[parent_identifier].add(identifier)

Expand Down Expand Up @@ -130,7 +130,7 @@ def makeTranslationTable(self):

for (language, children) in self.taxonomy.data.items():
for (path, identifier) in children.items():
if not identifier in translationTable:
if identifier not in translationTable:
translationTable[identifier] = {}

translationTable[identifier][language] = \
Expand Down
2 changes: 1 addition & 1 deletion travis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parts +=
[code-analysis]
directory = ${buildout:directory}/src/collective/taxonomy
pre-commit-hook = False
flake8-ignore = E501
flake8-ignore = E501,C901
debug-statements = True
deprecated-aliases = True
imports = True
Expand Down

0 comments on commit c6909e6

Please sign in to comment.