luar 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {luar-0.4.2/src/luar.egg-info → luar-0.4.3}/PKG-INFO +1 -1
  2. {luar-0.4.2 → luar-0.4.3}/pyproject.toml +1 -1
  3. {luar-0.4.2 → luar-0.4.3}/src/luar/__init__.py +1 -1
  4. {luar-0.4.2 → luar-0.4.3}/src/luar/app.py +12 -5
  5. {luar-0.4.2 → luar-0.4.3/src/luar.egg-info}/PKG-INFO +1 -1
  6. {luar-0.4.2 → luar-0.4.3}/tests/test_app.py +12 -0
  7. {luar-0.4.2 → luar-0.4.3}/LICENSE +0 -0
  8. {luar-0.4.2 → luar-0.4.3}/README.md +0 -0
  9. {luar-0.4.2 → luar-0.4.3}/setup.cfg +0 -0
  10. {luar-0.4.2 → luar-0.4.3}/src/luar/__main__.py +0 -0
  11. {luar-0.4.2 → luar-0.4.3}/src/luar/backends/__init__.py +0 -0
  12. {luar-0.4.2 → luar-0.4.3}/src/luar/backends/base.py +0 -0
  13. {luar-0.4.2 → luar-0.4.3}/src/luar/backends/laya_backend.py +0 -0
  14. {luar-0.4.2 → luar-0.4.3}/src/luar/cli.py +0 -0
  15. {luar-0.4.2 → luar-0.4.3}/src/luar/engine.py +0 -0
  16. {luar-0.4.2 → luar-0.4.3}/src/luar/questions.py +0 -0
  17. {luar-0.4.2 → luar-0.4.3}/src/luar/report.py +0 -0
  18. {luar-0.4.2 → luar-0.4.3}/src/luar/tables.py +0 -0
  19. {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/SOURCES.txt +0 -0
  20. {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/dependency_links.txt +0 -0
  21. {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/entry_points.txt +0 -0
  22. {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/requires.txt +0 -0
  23. {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/top_level.txt +0 -0
  24. {luar-0.4.2 → luar-0.4.3}/tests/test_engine.py +0 -0
  25. {luar-0.4.2 → luar-0.4.3}/tests/test_laya_backend.py +0 -0
  26. {luar-0.4.2 → luar-0.4.3}/tests/test_offline.py +0 -0
  27. {luar-0.4.2 → luar-0.4.3}/tests/test_questions.py +0 -0
  28. {luar-0.4.2 → luar-0.4.3}/tests/test_tables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: luar
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: LUAR (Local Utility for Automated Reviews): catalog spreadsheet rows with a local decision model.
5
5
  Author-email: Alexandre Alves <alexxalvess@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "luar"
7
- version = "0.4.2"
7
+ version = "0.4.3"
8
8
  description = "LUAR (Local Utility for Automated Reviews): catalog spreadsheet rows with a local decision model."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -2,7 +2,7 @@
2
2
  from .engine import DEFAULT_THRESHOLD, Result, classify, run_file
3
3
  from .questions import Question, QuestionError, load_questions, parse_questions
4
4
 
5
- __version__ = "0.4.2"
5
+ __version__ = "0.4.3"
6
6
 
7
7
  __all__ = [
8
8
  "DEFAULT_THRESHOLD",
@@ -106,11 +106,18 @@ Add a column named `expected_<id>` to your file to measure accuracy on rows you
106
106
  """
107
107
 
108
108
  NO_QUESTIONS = (
109
- "There are no questions yet. In step 2, fill in at least the id and the question of one row "
110
- "(or load a questions .json file). Trying the Sample CSV? Download Sample JSON at the top of the "
111
- "page and drop it in \"Load questions (.json)\", or pick \"Amostra de teste (Sample CSV)\" in "
112
- "\"…or try an example\" to load both at once."
109
+ "There are no questions yet. In step 2, fill in at least the id and the question of one row, "
110
+ "or load a questions .json file in \"Load questions (.json)\"."
113
111
  )
112
+ # only offered where the sample buttons and the examples menu exist (a repository checkout, not PyPI)
113
+ SAMPLE_HINT = (
114
+ " Trying the Sample CSV? Download Sample JSON at the top of the page and load it there, or pick "
115
+ "\"Amostra de teste (Sample CSV)\" in \"…or try an example\" to load both at once."
116
+ )
117
+
118
+
119
+ def no_questions_message() -> str:
120
+ return NO_QUESTIONS + (SAMPLE_HINT if SAMPLE_QUESTIONS.exists() else "")
114
121
 
115
122
 
116
123
  def _questions_to_rows(questions) -> list[list[str]]:
@@ -132,7 +139,7 @@ def _rows_to_questions(table) -> list:
132
139
  continue
133
140
  data.append({"id": qid, "type": qtype.lower(), "question": text, "options": opts})
134
141
  if not data:
135
- raise QuestionError(NO_QUESTIONS)
142
+ raise QuestionError(no_questions_message())
136
143
  return parse_questions(data)
137
144
 
138
145
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: luar
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: LUAR (Local Utility for Automated Reviews): catalog spreadsheet rows with a local decision model.
5
5
  Author-email: Alexandre Alves <alexxalvess@gmail.com>
6
6
  License-Expression: MIT
@@ -22,6 +22,18 @@ def test_no_questions_explains_what_to_do():
22
22
  app._rows_to_questions(table)
23
23
 
24
24
 
25
+ def test_no_questions_message_only_mentions_samples_that_exist(monkeypatch, tmp_path):
26
+ with pytest.raises(QuestionError, match="Sample JSON") as repo:
27
+ app._rows_to_questions([["", "choice", "", ""]])
28
+ # an install from PyPI has no examples/ folder: the sample buttons and menu are hidden
29
+ monkeypatch.setattr(app, "SAMPLE_QUESTIONS", tmp_path / "missing.json")
30
+ with pytest.raises(QuestionError) as pypi:
31
+ app._rows_to_questions([["", "choice", "", ""]])
32
+ assert "Load questions (.json)" in str(pypi.value)
33
+ assert "Sample" not in str(pypi.value) and "try an example" not in str(pypi.value)
34
+ assert str(repo.value).startswith(str(pypi.value))
35
+
36
+
25
37
  def test_half_written_row_still_reports_the_missing_id():
26
38
  with pytest.raises(QuestionError, match="Invalid question id"):
27
39
  app._rows_to_questions([["", "choice", "What is it about?", "a; b"]])
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes