While there, refactor thread handling in AppViews since it was not
practical.
Some issues found with mypy and fixed by this commit:
src/admin/views/ApiViews.py:240: error: Name "user_ddid" is not defined
src/admin/lib/nextcloud.py:331: error: Name "group" is not defined
src/admin/lib/nextcloud.py:394: error: Name "ProviderUserNotExists" is not defined
src/admin/lib/admin.py:1604: error: Trying to read deleted variable "se"
src/admin/lib/admin.py:1798: error: Trying to read deleted variable "se"
src/admin/lib/admin.py:1903: error: Name "group" is not defined
With this commit, code from the admin module can be re-used and thanks
to adding type-hints in most places we are able to discover some bugs.
This commit attempts to fix only that which was necessary to:
- Add a reasonable amount of type hints
- Disentangle the module
There are already some issues that have been discovered by mypy.
This is all relative to the dd-sso/admin directory.
With https://pipenv.pypa.io/en/latest/ it is simple to setup a
development environment (pipenv install --dev).
By running:
echo "PYTHONPATH=$(pwd)/src" > .env
The admin module will be loaded in the virtualenvironment and e.g.
running mypy src/admin will throw different errors in the existing code.