diff --git a/src/bika/lims/adapters/widgetvisibility.py b/src/bika/lims/adapters/widgetvisibility.py index cb04ca4f1c..e3401f3d37 100644 --- a/src/bika/lims/adapters/widgetvisibility.py +++ b/src/bika/lims/adapters/widgetvisibility.py @@ -156,7 +156,7 @@ def isVisible(self, field, mode="view", default="visible"): # If object has been already created, get SWF statues from it. swf_enabled = False if hasattr(self.context, 'getSamplingWorkflowEnabled') and \ - self.context.getSamplingWorkflowEnabled() is not '': + self.context.getSamplingWorkflowEnabled() != '': swf_enabled = self.context.getSamplingWorkflowEnabled() else: swf_enabled = self.context.bika_setup.getSamplingWorkflowEnabled() diff --git a/src/senaite/core/exportimport/instruments/resultsimport.py b/src/senaite/core/exportimport/instruments/resultsimport.py index 77a6f7f017..7344b32973 100644 --- a/src/senaite/core/exportimport/instruments/resultsimport.py +++ b/src/senaite/core/exportimport/instruments/resultsimport.py @@ -443,8 +443,8 @@ def process(self): for acode in rawacodes: if acode in exclude or not acode: continue - service = self.bsc(getKeyword=acode) - if not service: + analysis_service = self.bsc(getKeyword=acode) + if not analysis_service: self.warn('Service keyword ${analysis_keyword} not found', mapping={"analysis_keyword": acode}) else: diff --git a/src/senaite/core/tests/test_duplicate-analysis.py b/src/senaite/core/tests/test_duplicate-analysis.py index 2f31ba2142..a7e63d77a4 100644 --- a/src/senaite/core/tests/test_duplicate-analysis.py +++ b/src/senaite/core/tests/test_duplicate-analysis.py @@ -82,8 +82,7 @@ def test_LIMS2001(self): # Add analyses into the worksheet self.request['context_uid'] = ws.UID() for analysis in ar.getAnalyses(): - an = analysis.getObject() - ws.addAnalysis(an) + ws.addAnalysis(analysis.getObject()) self.assertEquals(len(ws.getAnalyses()), 3) # Add a duplicate for slot 1 (there's only one slot) @@ -137,8 +136,7 @@ def test_LIMS2001(self): wf.doActionFor(ar, 'receive') # Add analyses into the worksheet for analysis in ar.getAnalyses(): - an = analysis.getObject() - ws.addAnalysis(an) + ws.addAnalysis(analysis.getObject()) ans = ws.getAnalyses() reg = [an for an in ans if an.portal_type == 'Analysis'] regkeys = [an.getKeyword() for an in reg] diff --git a/travis_ci_flake8.cfg b/travis_ci_flake8.cfg index 0f7c521727..3b8de2800f 100644 --- a/travis_ci_flake8.cfg +++ b/travis_ci_flake8.cfg @@ -71,12 +71,6 @@ extend-ignore = E502, # E722: do not use bare 'except' E722, - # F632: use ==/!= to compare constant literals (str, bytes, int, float, tuple) - F632, - # F706: 'return' outside function - F706, - # F812: list comprehension redefines 'service' from line 446 - F812, # F821: undefined name 'Report' F821, # F841: local variable 'icon' is assigned to but never used @@ -97,7 +91,6 @@ extend-ignore = W605, per-file-ignores = # ignore unused imports (F401) in meta packages - src/bika/lims/skins/bika/guard_handler.py:F401 src/bika/lims/browser/worksheet/views/__init__.py:F401 src/bika/lims/browser/analyses/__init__.py:F401 src/bika/lims/browser/client/__init__.py:F401 @@ -110,3 +103,6 @@ per-file-ignores = src/senaite/core/behaviors/__init__.py:F401 # ignore "import *" (F403, F405) in Archetypes models src/bika/lims/content/*.py:F403,F405 + # Zope scripts are only function bodies (see https://zope.readthedocs.io/en/latest/zopebook/BasicScripting.html) + src/bika/lims/skins/bika/guard_handler.py:F401,F706 + src/senaite/core/skins/senaite_scripts/*.py:F706