it's a piece of information used several times in the swh stack.
Details
- Reviewers
vlorentz - Group Reviewers
Reviewers - Commits
- rDMOD85f36f84347a: Add a SWH_MODEL_OBJECT_TYPES map {cls.objet_type: cls} in model.py
Diff Detail
- Repository
- rDMOD Data model
- Branch
- master
- Lint
Lint Skipped - Unit
Unit Tests Skipped - Build Status
Buildable 28371 Build 44363: Phabricator diff pipeline on jenkins Jenkins console · Jenkins Build 44362: arc lint + arc unit
Event Timeline
Build is green
Patch application report for D7536 (id=27326)
Rebasing onto ba7af7447e...
Current branch diff-target is up to date.
Changes applied before test
commit c2c1c605aa4b43f995e08e60ac13fcda0b6aec42
Author: David Douard <david.douard@sdfa3.org>
Date: Fri Apr 8 12:42:54 2022 +0200
Add a SWH_MODEL_OBJECT_TYPES map {cls.objet_type: cls} in model.py
it's a piece of information used several times in the swh stack.See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/469/ for more details.
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 | Wouldn't this work? If not, use type instead of Type[BaseModel] | |
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 | with the proposed annotation, mypy is unhappy because '"type" has no attribute "object_type"' | |
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 | would need to be able to declare the object_type on BaseModel as "pure abstract Final" or something I guess. | |
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 | I tried to declare (but initialize) object_type on BaseModel as: class BaseModel:
object_type: Final[str]but then mypy complains because "Final name must be initialized with a value" | |
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 | just this: class BaseModel:
object_type: stror you can keep # type: ignore on the SWH_MODEL_OBJECT_TYPES definition (but keep the type annotation, as it will be useful to users of the dict) | |
| swh/model/model.py | ||
|---|---|---|
| 1523–1524 |
already tried this last week: error: Cannot override writable attribute "object_type" with a final one for each model class definition.
ah, took me some time to get what you mean, ok will try this. | |
Add type annotation for SWH_MODEL_OBJECT_TYPES
even if we still need the \#type ignore stanza...
Build is green
Patch application report for D7536 (id=27356)
Rebasing onto 9231cd0d62...
First, rewinding head to replay your work on top of it...
Applying: Add a SWH_MODEL_OBJECT_TYPES map {cls.objet_type: cls} in model.pyChanges applied before test
commit 193df45b5990682a355fb13a041f9874ba9904f7
Author: David Douard <david.douard@sdfa3.org>
Date: Fri Apr 8 12:42:54 2022 +0200
Add a SWH_MODEL_OBJECT_TYPES map {cls.objet_type: cls} in model.py
it's a piece of information used several times in the swh stack.See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/470/ for more details.
Build is green
Patch application report for D7536 (id=27357)
Rebasing onto 9231cd0d62...
Current branch diff-target is up to date.
Changes applied before test
commit 85f36f84347af09b4a6a097b553b24299c0d7110
Author: David Douard <david.douard@sdfa3.org>
Date: Fri Apr 8 12:42:54 2022 +0200
Add a SWH_MODEL_OBJECT_TYPES map {cls.objet_type: cls} in model.py
it's a piece of information used several times in the swh stack.See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/471/ for more details.