Conversation
…e ascii reader for now
…a from two files, ensuring the files are importable and no errors are thrown during the process
… many files right now
DrPaulSharp
left a comment
There was a problem hiding this comment.
All good, I've a couple of minor points.
| pass | ||
| return [] | ||
| return [], [f'File does not exist: "{file}"'] | ||
| mime_type, encoding = mimetypes.guess_type(url) |
There was a problem hiding this comment.
We should be mindful that guess_type has been soft deprecated in favour of guess_file_type in mimetypes. However, the refactoring branch is currently running on python version >=3.12 so we need to leave this as is for now.
There was a problem hiding this comment.
I'll add a comment here so we don't overlook it during the transition to later python versions.
| imported.extend(file_list) | ||
| except Exception as e: | ||
| errors.append(f'Error accessing "{file}": {e}') | ||
| return imported, errors |
There was a problem hiding this comment.
Why is errors a list given that it can only have zero or one elements? Is there a reason not to return a string instead?
There was a problem hiding this comment.
Hmm, I guess it makes two extend() lines in import_data which is neater. Is there anything else?
There was a problem hiding this comment.
Thinking longer term, like when #225 is fixed, there may be errors/warnings during file read that could be bundled into this list.
There was a problem hiding this comment.
No quality gates enabled for this code.
See analysis details in CodeScene
Quality Gate Profile: Custom Configuration
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
This is the next step in the data import/export process. A central Importer class will look at the file mime type (for now) and infer the Importer based on that. Mime types are infallible, so a further check will be coming.