Repository navigation
[FIX] Ensure values as string. [Orange3-Text influenced] - #7351
Closed
krystofair wants to merge 1 commit into
Closed
krystofair wants to merge 1 commit into
krystofair wants to merge 1 commit into
Conversation
I have got error from import_document when testing Orange3-Text:
```
ERROR: test_conllu_reader (tests.test_import_documents.TestImportDocuments.test_conllu_reader)
(..more traceback..)
File "(...)/.tox/orange-latest/lib/python3.11/site-packages/Orange/data/io_util.py", line 202, in <genexpr>
for value in values if "." in value),
^^^^^^^^^^^^
TypeError: argument of type 'float' is not iterable
```
I unfortunatelly can't easily reproduce it from state of tests we have
currently. But it can be checked, that when `if` branch where change is
executes, it in old behaviour return `np.array` of `float`s. And make
error in `sanitize_variable.get_number_of_decimals`, because of
`quess_data_type` returns values with wrong interface.
So the chain is:
1. ImportDocument -> run -> _add_metadata ->
sanitize_variable(>guess_data_type(data)<).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7351 +/- ##
==========================================
- Coverage 88.97% 88.96% -0.01%
==========================================
Files 337 337
Lines 74648 74648
==========================================
- Hits 66415 66414 -1
- Misses 8233 8234 +1 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
I have got error from import_document when testing Orange3-Text:
Description of change
I unfortunatelly can't easily reproduce it from state of tests we have
currently.
After tracked it down. It can be checked, that when
ifbranch where change isexecutes, it in old behaviour return
np.arrayoffloats. And makeerror in
sanitize_variable.get_number_of_decimals, because ofquess_data_typereturns values with wrong interface.So the chain is:
import_documents.ImportDocument -> run -> _add_metadata ->
sanitize_variable(guess_data_type(data)).
Remarks
I don't have many experience with build
np.arraywithdtype=str, AFAIK there are various of "<8u" types which are desired to "str" or justobjecttype. So to don't make mismatch, I left it using vectorized function_as_string_arraywhich is already used and have good result for sure.EDIT: Check once again it, that was false.