-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix all typing issues, re-adding Mypy to pre-commit checks (#1948)
- Loading branch information
Showing
144 changed files
with
2,570 additions
and
2,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
|
||
make install-test | ||
pytest --allow-hosts=127.0.0.1,::1,$(hostname -i),$(getent ahosts db-test | awk '/STREAM/ { print $1}'),$(getent ahosts redis-test | awk '/STREAM/ { print $1}') --gherkin-terminal-reporter -vv --showlocals --cov=funnel | ||
pytest "--allow-hosts=127.0.0.1,::1,$(hostname -i),$(getent ahosts db-test | awk '/STREAM/ { print $1}'),$(getent ahosts redis-test | awk '/STREAM/ { print $1}')" --gherkin-terminal-reporter -vv --showlocals --cov=funnel | ||
coverage lcov -o coverage/funnel.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Auth proxy.""" | ||
|
||
from coaster.auth import ( | ||
CurrentAuth as CurrentAuthBase, | ||
GetCurrentAuth, | ||
add_auth_anchor, | ||
add_auth_attribute, | ||
request_has_auth, | ||
) | ||
|
||
from . import all_apps | ||
from .models import User | ||
|
||
__all__ = [ | ||
'CurrentAuth', | ||
'add_auth_attribute', | ||
'add_auth_anchor', | ||
'current_auth', | ||
'request_has_auth', | ||
] | ||
|
||
|
||
class CurrentAuth(CurrentAuthBase): | ||
"""CurrentAuth for Funnel.""" | ||
|
||
# These attrs are typed as not-optional because they're typically accessed in a view | ||
# that is already gated with the `@requires_login` or related decorator, so they're | ||
# guaranteed to be present within the view. However, this will require a type-ignore | ||
# for any code that tests `if current_auth.actor`, so those will need a rewrite to | ||
# `if current_auth`. When auth clients become supported actors, this may need some | ||
# form of PEP 647 typeguard to identify the actor's exact type. | ||
|
||
user: User | ||
actor: User | ||
|
||
|
||
current_auth = GetCurrentAuth.proxy(CurrentAuth) | ||
|
||
# Install this proxy in all apps, overriding the proxy provided by coaster.app.init_app | ||
for _app in all_apps: | ||
_app.jinja_env.globals['current_auth'] = current_auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.