Skip to content

Apply polish to project#6

Open
ngie-eign wants to merge 8 commits into
Gigahawk:masterfrom
ngie-eign:polish
Open

Apply polish to project#6
ngie-eign wants to merge 8 commits into
Gigahawk:masterfrom
ngie-eign:polish

Conversation

@ngie-eign

@ngie-eign ngie-eign commented Mar 19, 2026

Copy link
Copy Markdown

This change addresses a number of low-hanging fruit changes to make the project easier to maintain/use with alternate tools like pipx, etc.

It also applies some basic niceties suggested via black and ruff format.

Sidenote: this version doesn't successfully scrape all of the courses I'm currently enrolled in, but it's a move in the right direction. It needs to do more "deep inspection" in the course pages to gather all of the available media/files instead of assuming files/, media/, etc, exists and is accessible.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change adds `Forbidden` to a number of `canvasapi` calls so the
script doesn't fall flat on its face with newer versions of the API.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
The previous `Pipfile` was stale and didn't have any real customizations
that differed from the vanilla `pipenv install`'ed version.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
- Mention `pipx` usage.
- Suggest `pipenv run` usage.
- Remove explicit dependencies.
  - This is articulated in [pyproject.toml](/pyproject.toml).

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
### Logging changes

This change converts multiple f-string non-lazy logging statements to
lazy logging statements for performance and for functional reasons (to
avoid possible crashes). Moreover, `exc_info=True` is used with some
calls to dump out exception stacks when necessary instead of getting a
partial answer with `str(e)`. Finally, this change converts multiple
logging calls from direct formatting anti-patterns, e.g.,
`logging.error(str(foo))` to safer/more performant format string
equivalents, e.g., `logging.error("%s", foo)`.

Finally, while here convert a URL "MRU cache" from a `list` to a
`collections.Counter` object. Although the number of URLs in a class is
likely small, there can be a slight performance benefit of using
`dict.__contains__` instead of `list.__contains__`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant