-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation #3
base: main
Are you sure you want to change the base?
Conversation
Documented the code
GreenCappuccino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fixup all linter issues as shown on this PR. I recommend setting up the pre-commit with poetry install and poetry run task pre-commit.
More useful documentation should document a functional overview of code, and not what specific lines of code do, which should be already relatively obvious.
| meili = request.state.meili | ||
| loop = asyncio.get_running_loop() | ||
|
|
||
| """initializes database, miniothe database connection""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-line strings are generally only used in docstrings. Add docstrings under class/function/method headers, or else they won't be parsed. See https://peps.python.org/pep-0257/
Otherwise all other internal comments should be normal octothorpe comments.
Also, please fix typos.
| content = await file.read() | ||
|
|
||
| with ThreadPoolExecutor() as pool: | ||
| """function uses ThreadPoolExecutor to parse the SDS file into JSON using the SigmaAldrichSdsParse.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Context managers are not functions.
| ) | ||
| ) | ||
|
|
||
| """Uploads the file to Minio and creates a URL for the file""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, multi-line strings discouraged compared to octothorpe comments.
| db = request.state.db | ||
|
|
||
| async with db.begin(): | ||
| """retrieves records from the SafetyDataSheet where the `id` field matches any value in the `sds_ids` .""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context managers not definitions.
| stmt = select(SafetyDataSheet).where(SafetyDataSheet.id == func.any(sds_ids)) | ||
| result = await db.execute(stmt) | ||
|
|
||
| """returns the batch of SDS sheets""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etc. etc.
No description provided.