Skip to content

[Regression: 0.470->0.501] Lots of new errors relating to "uninhabited" in Django-based app code #2978

Closed
@inducer

Description

@inducer
git clone https://github.com/inducer/relate
cd relate
./run-mypy.sh

used to work with no warnings in 0.470. Now, it spews this:

course/content.py:877: error: <uninhabited> has no attribute "id"
course/content.py:1445: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/content.py:1446: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:179: error: <uninhabited> has no attribute "exam"
course/utils.py:533: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:534: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:583: error: <uninhabited> has no attribute "permissions"
course/enrollment.py:129: error: <uninhabited> has no attribute "roles"
course/enrollment.py:143: error: <uninhabited> has no attribute "permissions"
course/views.py:156: error: <uninhabited> has no attribute "has_permission"
course/flow.py:416: error: <uninhabited> has no attribute "user"
course/flow.py:633: error: <uninhabited> has no attribute "answer"
course/flow.py:830: error: <uninhabited> has no attribute "get_most_recent_grade"
course/flow.py:848: error: Unsupported left operand type for + (some union)
course/flow.py:855: error: Unsupported left operand type for + (some union)
course/flow.py:862: error: Unsupported left operand type for + (some union)
course/flow.py:923: error: <uninhabited> has no attribute "is_submitted_answer"
course/flow.py:924: error: <uninhabited> has no attribute "save"
course/flow.py:1264: error: <uninhabited> has no attribute "get_most_recent_grade"

Focusing on the first error:

https://github.com/inducer/relate/blob/fed97182f4e8940bb032a224c5cbcd007a8bd722/course/content.py#L877

it should be clear that course is an instance of Course (i.e. not None).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions