Skip to content

Commit 055c225

Browse files
committed
Merge branch 'master' of github.com:senaite/senaite.ast into fix-no-registry-found
2 parents 591b799 + 6c3cf15 commit 055c225

File tree

13 files changed

+90
-88
lines changed

13 files changed

+90
-88
lines changed

ci_flake8.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
# temporarily disable violations for existing code until they are cleaned up
3+
per-file-ignores =
4+
# C901 'AnalysisGuardAdapter.guard_submit' is too complex (14)
5+
src/senaite/ast/adapters/guards.py:C901
6+
# C901 'get_sensitivity_category' is too complex (14)
7+
src/senaite/ast/utils.py:C901

docs/conf.py

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
21
import os
2+
import sys
33

44
# If extensions (or modules to document with autodoc) are in another directory,
55
# add these directories to sys.path here. If the directory is relative to the
@@ -9,7 +9,7 @@
99
# -- General configuration ------------------------------------------------
1010

1111
# If your documentation needs a minimal Sphinx version, state it here.
12-
#needs_sphinx = '1.0'
12+
# needs_sphinx = '1.0'
1313

1414
# Add any Sphinx extension module names here, as strings. They can be
1515
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -27,7 +27,7 @@
2727
source_suffix = '.rst'
2828

2929
# The encoding of source files.
30-
#source_encoding = 'utf-8-sig'
30+
# source_encoding = 'utf-8-sig'
3131

3232
# The master toctree document.
3333
master_doc = 'index'
@@ -47,41 +47,41 @@
4747

4848
# The language for content autogenerated by Sphinx. Refer to documentation
4949
# for a list of supported languages.
50-
#language = None
50+
# language = None
5151

5252
# There are two options for replacing |today|: either, you set today to some
5353
# non-false value, then it is used:
54-
#today = ''
54+
# today = ''
5555
# Else, today_fmt is used as the format for a strftime call.
56-
#today_fmt = '%B %d, %Y'
56+
# today_fmt = '%B %d, %Y'
5757

5858
# List of patterns, relative to source directory, that match files and
5959
# directories to ignore when looking for source files.
6060
exclude_patterns = ['_build']
6161

6262
# The reST default role (used for this markup: `text`) to use for all
6363
# documents.
64-
#default_role = None
64+
# default_role = None
6565

6666
# If true, '()' will be appended to :func: etc. cross-reference text.
67-
#add_function_parentheses = True
67+
# add_function_parentheses = True
6868

6969
# If true, the current module name will be prepended to all description
7070
# unit titles (such as .. function::).
71-
#add_module_names = True
71+
# add_module_names = True
7272

7373
# If true, sectionauthor and moduleauthor directives will be shown in the
7474
# output. They are ignored by default.
75-
#show_authors = False
75+
# show_authors = False
7676

7777
# The name of the Pygments (syntax highlighting) style to use.
7878
pygments_style = 'sphinx'
7979

8080
# A list of ignored prefixes for module index sorting.
81-
#modindex_common_prefix = []
81+
# modindex_common_prefix = []
8282

8383
# If true, keep warnings as "system message" paragraphs in the built documents.
84-
#keep_warnings = False
84+
# keep_warnings = False
8585

8686

8787
# -- Options for HTML output ----------------------------------------------
@@ -93,26 +93,26 @@
9393
# Theme options are theme-specific and customize the look and feel of a theme
9494
# further. For a list of options available for each theme, see the
9595
# documentation.
96-
#html_theme_options = {}
96+
# html_theme_options = {}
9797

9898
# Add any paths that contain custom themes here, relative to this directory.
99-
#html_theme_path = []
99+
# html_theme_path = []
100100

101101
# The name for this set of Sphinx documents. If None, it defaults to
102102
# "<project> v<release> documentation".
103-
#html_title = None
103+
# html_title = None
104104

105105
# A shorter title for the navigation bar. Default is the same as html_title.
106-
#html_short_title = None
106+
# html_short_title = None
107107

108108
# The name of an image file (relative to this directory) to place at the top
109109
# of the sidebar.
110-
#html_logo = None
110+
# html_logo = None
111111

112112
# The name of an image file (within the static path) to use as favicon of the
113113
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
114114
# pixels large.
115-
#html_favicon = None
115+
# html_favicon = None
116116

117117
# Add any paths that contain custom static files (such as style sheets) here,
118118
# relative to this directory. They are copied after the builtin static files,
@@ -122,93 +122,92 @@
122122
# Add any extra paths that contain custom files (such as robots.txt or
123123
# .htaccess) here, relative to this directory. These files are copied
124124
# directly to the root of the documentation.
125-
#html_extra_path = []
125+
# html_extra_path = []
126126

127127
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
128128
# using the given strftime format.
129-
#html_last_updated_fmt = '%b %d, %Y'
129+
# html_last_updated_fmt = '%b %d, %Y'
130130

131131
# If true, SmartyPants will be used to convert quotes and dashes to
132132
# typographically correct entities.
133-
#html_use_smartypants = True
133+
# html_use_smartypants = True
134134

135135
# Custom sidebar templates, maps document names to template names.
136-
#html_sidebars = {}
136+
# html_sidebars = {}
137137

138138
# Additional templates that should be rendered to pages, maps page names to
139139
# template names.
140-
#html_additional_pages = {}
140+
# html_additional_pages = {}
141141

142142
# If false, no module index is generated.
143-
#html_domain_indices = True
143+
# html_domain_indices = True
144144

145145
# If false, no index is generated.
146-
#html_use_index = True
146+
# html_use_index = True
147147

148148
# If true, the index is split into individual pages for each letter.
149-
#html_split_index = False
149+
# html_split_index = False
150150

151151
# If true, links to the reST sources are added to the pages.
152-
#html_show_sourcelink = True
152+
# html_show_sourcelink = True
153153

154154
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
155-
#html_show_sphinx = True
155+
# html_show_sphinx = True
156156

157157
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
158-
#html_show_copyright = True
158+
# html_show_copyright = True
159159

160160
# If true, an OpenSearch description file will be output, and all pages will
161161
# contain a <link> tag referring to it. The value of this option must be the
162162
# base URL from which the finished HTML is served.
163-
#html_use_opensearch = ''
163+
# html_use_opensearch = ''
164164

165165
# This is the file name suffix for HTML files (e.g. ".xhtml").
166-
#html_file_suffix = None
166+
# html_file_suffix = None
167167

168168
# Output file base name for HTML help builder.
169169
htmlhelp_basename = 'senaiteastdoc'
170170

171-
172171
# -- Options for LaTeX output ---------------------------------------------
173172

174173
latex_elements = {
175-
# The paper size ('letterpaper' or 'a4paper').
176-
#'papersize': 'letterpaper',
174+
# The paper size ('letterpaper' or 'a4paper').
175+
# 'papersize': 'letterpaper',
177176

178-
# The font size ('10pt', '11pt' or '12pt').
179-
#'pointsize': '10pt',
177+
# The font size ('10pt', '11pt' or '12pt').
178+
# 'pointsize': '10pt',
180179

181-
# Additional stuff for the LaTeX preamble.
182-
#'preamble': '',
180+
# Additional stuff for the LaTeX preamble.
181+
# 'preamble': '',
183182
}
184183

185184
# Grouping the document tree into LaTeX files. List of tuples
186185
# (source start file, target name, title,
187186
# author, documentclass [howto, manual, or own class]).
188187
latex_documents = [
189-
('index', 'senaiteast.tex', u'senaite.ast Documentation',
190-
u'Riding Bytes & Naralabs', 'manual'),
188+
('index', 'senaiteast.tex', u'senaite.ast Documentation',
189+
u'Riding Bytes & Naralabs', 'manual'),
191190
]
192191

193192
# The name of an image file (relative to this directory) to place at the top of
194193
# the title page.
195-
#latex_logo = None
194+
# latex_logo = None
196195

197196
# For "manual" documents, if this is true, then toplevel headings are parts,
198197
# not chapters.
199-
#latex_use_parts = False
198+
# latex_use_parts = False
200199

201200
# If true, show page references after internal links.
202-
#latex_show_pagerefs = False
201+
# latex_show_pagerefs = False
203202

204203
# If true, show URL addresses after external links.
205-
#latex_show_urls = False
204+
# latex_show_urls = False
206205

207206
# Documents to append as an appendix to all manuals.
208-
#latex_appendices = []
207+
# latex_appendices = []
209208

210209
# If false, no module index is generated.
211-
#latex_domain_indices = True
210+
# latex_domain_indices = True
212211

213212

214213
# -- Options for manual page output ---------------------------------------
@@ -221,7 +220,7 @@
221220
]
222221

223222
# If true, show URL addresses after external links.
224-
#man_show_urls = False
223+
# man_show_urls = False
225224

226225

227226
# -- Options for Texinfo output -------------------------------------------
@@ -230,20 +229,20 @@
230229
# (source start file, target name, title, author,
231230
# dir menu entry, description, category)
232231
texinfo_documents = [
233-
('index', 'senaiteast', u'senaite.ast Documentation',
234-
u'Riding Bytes & Naralabs', 'senaiteast',
235-
'Antibiotic Sensitivity Testing (AST) for SENAITE',
236-
'Miscellaneous'),
232+
('index', 'senaiteast', u'senaite.ast Documentation',
233+
u'Riding Bytes & Naralabs', 'senaiteast',
234+
'Antibiotic Sensitivity Testing (AST) for SENAITE',
235+
'Miscellaneous'),
237236
]
238237

239238
# Documents to append as an appendix to all manuals.
240-
#texinfo_appendices = []
239+
# texinfo_appendices = []
241240

242241
# If false, no module index is generated.
243-
#texinfo_domain_indices = True
242+
# texinfo_domain_indices = True
244243

245244
# How to display URL addresses: 'footnote', 'no', or 'inline'.
246-
#texinfo_show_urls = 'footnote'
245+
# texinfo_show_urls = 'footnote'
247246

248247
# If true, do not generate a @detailmenu in the "Top" node's menu.
249-
#texinfo_no_detailmenu = False
248+
# texinfo_no_detailmenu = False

src/senaite/ast/behaviors/astpanel.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class IASTPanelBehavior(model.Schema):
7070
description=_(
7171
u"Default clinical breakpoints table to use for this panel. If "
7272
u"set, the system will automatically calculate the susceptibility "
73-
u"testing category as soon as the zone diameter in mm is submitted "
74-
u"by the user."
73+
u"testing category as soon as the zone diameter in mm is "
74+
u"submitted by the user."
7575
),
7676
allowed_types=("BreakpointsTable", ),
7777
multi_valued=False,
@@ -120,9 +120,9 @@ class IASTPanelBehavior(model.Schema):
120120
disk_content = schema.Bool(
121121
title=_(u"Include disk content in μg"),
122122
description=_(
123-
u"When enabled, an additional row for the introduction of the disk "
124-
u"content (potency) in μg is displayed in the results entry view, "
125-
u"above resistance call options"
123+
u"When enabled, an additional row for the introduction of the "
124+
u"disk content (potency) in μg is displayed in the results entry "
125+
u"view, above resistance call options"
126126
),
127127
required=False,
128128
default=False,
@@ -164,8 +164,8 @@ class IASTPanelBehavior(model.Schema):
164164
title=_(u"Selective reporting"),
165165
description=_(
166166
u"When enabled, an additional row to indicate whether the "
167-
u"resistance result for each microorganism-antibiotic tuple has to "
168-
u"be reported in results report or not"
167+
u"resistance result for each microorganism-antibiotic tuple has "
168+
u"to be reported in results report or not"
169169
),
170170
required=False,
171171
default=False,
@@ -210,7 +210,8 @@ def _get_breakpoints_table(self):
210210
breakpoints_table = getattr(self.context, "breakpoints_table", None)
211211
return copy(breakpoints_table)
212212

213-
breakpoints_table = property(_get_breakpoints_table, _set_breakpoints_table)
213+
breakpoints_table = property(_get_breakpoints_table,
214+
_set_breakpoints_table)
214215

215216
def _set_disk_content(self, value):
216217
self.context.disk_content = value
@@ -234,10 +235,11 @@ def _set_selective_reporting(self, value):
234235
self.context.selective_reporting = value
235236

236237
def _get_selective_reporting(self):
237-
selective_reporting = getattr(self.context, "selective_reporting", None)
238+
selective_reporting = getattr(self.context, "selective_reporting")
238239
return selective_reporting
239240

240-
selective_reporting = property(_get_selective_reporting, _set_selective_reporting)
241+
selective_reporting = property(_get_selective_reporting,
242+
_set_selective_reporting)
241243

242244
def _set_method(self, value):
243245
self.context.method = value

src/senaite/ast/browser/addpanel.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def __call__(self):
5959

6060
# Create/Update the breakpoints table analysis
6161
if panel.breakpoints_table:
62-
self.add_breakpoints_analysis(panel, microorganism, antibiotics)
62+
self.add_breakpoints_analysis(
63+
panel, microorganism, antibiotics
64+
)
6365

6466
if panel.method == METHOD_DIFFUSION_DISK_ID:
6567
# Create/Update the disk content (potency) analysis
@@ -121,7 +123,8 @@ def add_ast_analysis(self, keyword, microorganism, antibiotics):
121123

122124
# Create a new analysis
123125
sample = self.context
124-
return utils.create_ast_analysis(sample, keyword, microorganism, antibiotics)
126+
return utils.create_ast_analysis(sample, keyword, microorganism,
127+
antibiotics)
125128

126129
def add_breakpoints_analysis(self, panel, microorganism, antibiotics):
127130
"""Updates or creates an analysis for the selection of the clinical

src/senaite/ast/browser/modals/rejectantibiotics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
from bika.lims import api
2525
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
26-
from senaite.ast import logger
2726
from senaite.ast import utils
2827
from senaite.ast.calc import update_sensitivity_result
2928
from senaite.ast.config import NOT_TESTED

src/senaite/ast/browser/panel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ def render_checkbox(self, item, microorganism, antibiotic):
209209
if not isinstance(disabled, (list, tuple)):
210210
item["disabled"] = []
211211

212-
if has_analysis and not self.is_editable(microorganism, antibiotic):
212+
if has_analysis and not self.is_editable(microorganism,
213+
antibiotic):
213214
item.setdefault("disabled", []).append(uid)
214215

215216
def is_editable(self, microorganism, antibiotic):

src/senaite/ast/calc.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ def update_sensitivity_result(analysis):
253253
"""Updates the sensitivity "final" result of the sensitivity category
254254
analysis based on the values set to the AST siblings.
255255
256-
The sensitivity category results for antibiotics of this analysis are stored
257-
as interim values, while the "final" result of the analysis is a list of
258-
result options, that is only used for reporting purposes.
256+
The sensitivity category results for antibiotics of this analysis are
257+
stored as interim values, while the "final" result of the analysis is a
258+
list of result options, that is only used for reporting purposes.
259259
"""
260260
# Get the analysis (keyword: analysis) from same sample and microorganism
261261
analyses = utils.get_ast_group(analysis)
@@ -315,10 +315,7 @@ def get_reportable_antibiotics(analysis):
315315
extrapolated = analyses.get(REPORT_EXTRAPOLATED_KEY)
316316
if extrapolated:
317317
for interim in extrapolated.getInterimFields():
318-
try:
319-
selected = json.loads(interim.get("value", "[]"))
320-
except:
321-
selected = []
318+
selected = api.parse_json(interim.get("value"), default=[])
322319
reportable[interim.get("uid")] = selected
323320

324321
def is_reportable(interim):

0 commit comments

Comments
 (0)