Skip to content

Conversation

@wkschwartz
Copy link
Contributor

  • Added some of the instance attributes from command arguments: ignore, using, app_label, verbosity, format.
  • Added class attribute: help.
  • Fixed return type of find_fixtures.

- Added some of the instance attributes from command arguments: ignore, using, app_label, verbosity, format.
- Added class attribute: help.
- Fixed return type of find_fixtures.
@wkschwartz
Copy link
Contributor Author

CI appears to have failed booting without actually running the tests. If the maintainers are interested in this patch, would they please re-start CI? I don't think I can do it myself.

@sobolevn
Copy link
Member

sobolevn commented Dec 1, 2020

Done!

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please, double check that all new attrs are not duplicating ones from BaseCommand 👍

This incorporates all type information I could glean from loaddata at
django/django@adb40d2.

- Remove `help` per review comment:
  typeddjango#536 (comment)
- Add `exclude_models` and `exclude_apps` based on the return type of
  `..utils.parse_apps_and_model_labels`.
- Change `loaddata`'s `fixture_labels` to `Sequence` of `str` instead of
  `Iterable` because in practice it's a tuple, but at a type level, the
  important thing is that `loaddata` iterates over `fixture_labels` more than
  once. General iterables (which include iterators) need not support iteration
  more than once.
- Correct the return type of `parse_name` to account for the possibility that
  the data and compression formats are `None`.
- Correct the return type of `find_fixtures` to be a list of the same type that
  `parse_name` returns.
- Add a type annotation for `SingleZipReader.read`. Django implements the method
  in a way that actually conflicts with `zipfile.ZipFile.read`'s type. This
  necessitates a `type: ignore[override]` to keep the tests passing. Mypy is
  correct that there is an override error, but Django's code is what it is.
  (And that method's signature was introduced way back in Django version 1.1,
  commit django/django@089ab18.)
@wkschwartz
Copy link
Contributor Author

CI seems ill. sudo apt-get install binutils libproj-dev gdal-bin is 404ing. eg: https://github.com/typeddjango/django-stubs/pull/536/checks?check_run_id=1481582406#step:3:63

Err:26 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libpoppler73 amd64 0.62.0-2ubuntu2.10
  404  Not Found [IP: 52.147.219.192 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/poppler/libpoppler73_0.62.0-2ubuntu2.10_amd64.deb  404  Not Found [IP: 52.147.219.192 80]

All tests and lints pass locally for me with Python 3.7 set up per https://github.com/typeddjango/django-stubs/blob/master/CONTRIBUTING.md

@wkschwartz wkschwartz requested a review from sobolevn December 2, 2020 19:48
@mkurnikov mkurnikov closed this Jan 19, 2021
@mkurnikov mkurnikov reopened this Jan 19, 2021
@mkurnikov mkurnikov merged commit 49ed9c9 into typeddjango:master Jan 19, 2021
@wkschwartz wkschwartz deleted the patch-1 branch January 20, 2021 04:09
snejus pushed a commit to snejus/django-stubs that referenced this pull request Mar 10, 2021
This incorporates all type information I could glean from loaddata at
django/django@adb40d2.

- Remove `help` per review comment:
  typeddjango#536 (comment)
- Add `exclude_models` and `exclude_apps` based on the return type of
  `..utils.parse_apps_and_model_labels`.
- Change `loaddata`'s `fixture_labels` to `Sequence` of `str` instead of
  `Iterable` because in practice it's a tuple, but at a type level, the
  important thing is that `loaddata` iterates over `fixture_labels` more than
  once. General iterables (which include iterators) need not support iteration
  more than once.
- Correct the return type of `parse_name` to account for the possibility that
  the data and compression formats are `None`.
- Correct the return type of `find_fixtures` to be a list of the same type that
  `parse_name` returns.
- Add a type annotation for `SingleZipReader.read`. Django implements the method
  in a way that actually conflicts with `zipfile.ZipFile.read`'s type. This
  necessitates a `type: ignore[override]` to keep the tests passing. Mypy is
  correct that there is an override error, but Django's code is what it is.
  (And that method's signature was introduced way back in Django version 1.1,
  commit django/django@089ab18.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants