Upgrade syntax using `pyupgrade --py36-plus` .
Manually drop several `six` imports.
Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
Fix the following traceback:
```
/usr/users/ga002/soranzon/software/galaxyproject_galaxy/scripts/db_shell.py in printquery(statement, bind)
60 if bind is None:
61 bind = statement.session.get_bind(
---> 62 statement._mapper_zero_or_none())
63 statement = statement.statement
64 elif bind is None:
AttributeError: 'Query' object has no attribute '_mapper_zero_or_none'
```
due to the removal of `_mapper_zero_or_none()` in SQLAlchemy commit
https://github.com/sqlalchemy/sqlalchemy/commit/234a5b9723fbbb9747c0f9e3917baf8500b73370
These aggregate all the jobs contributing to an implicitly created HistoryDatasetCollectionAssociation.
- Model enhancements that allow this.
- API endpoint for jobs summary of history content (somewhat uniform across HDAs and HDCAs just for consistency).
- Test cases.
- Rework history contents API a bit to eliminate more costly state summary checks by default.
Shared across Tool Shed and Galaxy to reduce code duplication. Previously this was just a bunch, making it a real class allows placing some shared logic in there.
This refactoring also eliminates some global variables galaxy.model.mapping.Session, galaxy.model.mapping.context, and same for tool shed. This may break things, but these are things that should probably be fixed anyway.
In particular small changes to db_shell.py and a unit test that depended on these global variables have been updated. The functional test frameworks likewise needed to be updated to not depend on these - these changes were more substantial.
To fix these functional tests, I essentially replace old references to global variables in Galaxy with references to global variables just defined in the test framework in test/functional/database_contexts.py (a slight improvement).
Namely create_db.py,db_shell.py, and manage_db.py.
Move duplicated code into lib/galaxy/model/orm/scripts.py - add unit tests. PEP-8 clean up of all 4 files. Add incoherent incoherent comment at top of manage_db.py.
As a result of the code de-duplication create_db.py should be usable with the tool shed now.
Will be refactoring lib/galaxy/model/orm/scripts.py to work with new tool shed install database - it will be good to have a place to test these and allow manage_db.py and clean_db.py to work immediately.