Skip to content

Commit

Permalink
Enable check for undefined variables (F821) (#2105)
Browse files Browse the repository at this point in the history
* Enable check for undefined variables (F821)

* Remove undefined position from worksheet

* Ignore unknown variables in Zope scripts

* Add missing imports

* Fix copy&paste mistake in tima

* Fix typo in ulite
  • Loading branch information
winniehell committed Aug 9, 2022
1 parent 7bb4b86 commit 269d16f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/bika/lims/content/worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,10 +1362,7 @@ def copy_src_fields_to_dst(src, dst):
review_state = workflow.getInfoFor(analysis, 'review_state', '')
if review_state in ['published', 'verified', 'retracted']:
old_ws_analyses.append(analysis.UID())

# XXX where does position come from?
old_layout.append({'position': position,
'type': 'a',
old_layout.append({'type': 'a',
'analysis_uid': analysis.UID(),
'container_uid': analysis.aq_parent.UID()})
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _parseline(self, line):
this_row = line.split(",")
# if less values are found than headers, it's an error
if len(this_row) != len(self.data_header):
self.err("Data row number " + item_nr + " has the wrong number of items")
self.err("Data row number " + self._numline + " has the wrong number of items")
return 0
row_values = dict(zip(self.data_header, this_row))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _parseline(self, line):
vals['DefaultResult']='Conc (Samp)'
try:
# 12/11/2003 20:49:24
dtstr = '%s %s' % (_values['Date'], _values['Time'])
dtstr = '%s %s' % (vals['Date'], vals['Time'])
dtobj = datetime.strptime(dtstr, '%d/%m/%Y %H:%M:%S')
vals['DateTime'] = dtobj.strftime("%Y%m%d %H:%M:%S")
except Exception:
Expand Down
3 changes: 3 additions & 0 deletions src/senaite/core/exportimport/instruments/tescan/tima/tima.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import json
import traceback

from bika.lims import _
from bika.lims.utils import t

title = "Tescan - TIMA"

def Import(context, request):
Expand Down
1 change: 1 addition & 0 deletions src/senaite/core/exportimport/setupdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from bika.lims.utils import t
from bika.lims.utils import tmpID
from bika.lims.utils import to_unicode
from bika.lims.utils import to_utf8
from bika.lims.utils.analysis import create_analysis
from Products.Archetypes.event import ObjectInitializedEvent
from Products.CMFCore.utils import getToolByName
Expand Down
4 changes: 1 addition & 3 deletions travis_ci_flake8.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ extend-ignore =
E501,
# E502: the backslash is redundant between brackets
E502,
# F821: undefined name 'Report'
F821,
# F901: 'raise NotImplemented' should be 'raise NotImplementedError'
F901,
# W191: indentation contains tabs
Expand Down Expand Up @@ -101,4 +99,4 @@ per-file-ignores =
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
src/senaite/core/skins/senaite_scripts/*.py:F706,F821

0 comments on commit 269d16f

Please sign in to comment.