Skip to content

Commit

Permalink
Mypy: removed type ignores at required_group()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Feb 8, 2024
1 parent ae9b6ff commit 8da3ba5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions openatlas/display/base_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,12 @@ def add_tabs(self) -> None:
'link_update',
id_=link_.id,
origin_id=self.entity.id)))
data.append(remove_link(
range_.name,
link_,
self.entity,
range_.class_.name))
data.append(
remove_link(
range_.name,
link_,
self.entity,
range_.class_.name))
self.tabs[range_.class_.view].table.rows.append(data)


Expand Down
12 changes: 7 additions & 5 deletions openatlas/display/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from jinja2 import pass_context
from werkzeug.exceptions import abort
from werkzeug.utils import redirect
from werkzeug.wrappers import Response

from openatlas import app
from openatlas.display.image_processing import check_processed_image
Expand Down Expand Up @@ -284,8 +285,9 @@ def profile_image(entity: Entity) -> str:

@app.template_filter()
def get_js_messages(lang: str) -> str:
js_message_file = Path('static') / 'vendor' / 'jquery_validation_plugin' \
/ f'messages_{lang}.js'
js_message_file = \
Path('static') / 'vendor' / 'jquery_validation_plugin' \
/ f'messages_{lang}.js'
if not (Path(app.root_path) / js_message_file).is_file():
return ''
return f'<script src="/{js_message_file}"></script>'
Expand Down Expand Up @@ -368,10 +370,10 @@ def get_base_table_data(entity: Entity, show_links: bool = True) -> list[Any]:
return data


def required_group(group: str): # type: ignore
def wrapper(func): # type: ignore
def required_group(group: str) -> Any:
def wrapper(func: Any) -> Any:
@wraps(func)
def wrapped(*args, **kwargs): # type: ignore
def wrapped(*args: Any, **kwargs: Any) -> Response:
if not current_user.is_authenticated:
return redirect(url_for('login', next=request.path))
if not is_authorized(group):
Expand Down

0 comments on commit 8da3ba5

Please sign in to comment.