-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00313c9
commit 68f273c
Showing
17 changed files
with
116 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
select = ["ALL"] | ||
ignore = ["ANN101", "ANN102", "D203", "D211", "D212", "D213", "UP009", "S101", "S314", "INP001", "FLY002", "TD002", "TD003"] | ||
|
||
exclude = ["docs"] |
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
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
|
||
|
||
@group() | ||
def campusonline(): | ||
def campusonline() -> None: | ||
"""Campusonline CLI.""" | ||
|
||
|
||
|
@@ -28,16 +28,27 @@ def campusonline(): | |
@option("--campusonline-id", type=STRING) | ||
@option("--token", type=STRING) | ||
@option("--user-email", type=STRING, default="[email protected]") | ||
@option("--no-color", is_flag=True) | ||
def import_thesis(endpoint, campusonline_id, token, user_email, no_color=False): | ||
@option("--no-color", is_flag=True, default=False) | ||
def import_thesis( | ||
endpoint: str, | ||
campusonline_id: str, | ||
token: str, | ||
user_email: str, | ||
no_color: bool, # noqa: FBT001 | ||
) -> None: | ||
"""Import metadata and file (aka one thesis) from campusonline.""" | ||
import_func = current_app.config["CAMPUSONLINE_IMPORT_FUNC"] | ||
theses_filters = current_app.config["CAMPUSONLINE_THESES_FILTERS"] | ||
recipients = current_app.config["CAMPUSONLINE_ERROR_MAIL_RECIPIENTS"] | ||
sender = current_app.config["CAMPUSONLINE_ERROR_MAIL_SENDER"] | ||
|
||
configs = CampusOnlineConfigs( | ||
endpoint, token, user_email, theses_filters, recipients, sender | ||
endpoint, | ||
token, | ||
user_email, | ||
theses_filters, | ||
recipients, | ||
sender, | ||
) | ||
record = import_from_campusonline(import_func, campusonline_id, configs) | ||
|
||
|
@@ -50,7 +61,11 @@ def import_thesis(endpoint, campusonline_id, token, user_email, no_color=False): | |
@option("--endpoint", type=URL) | ||
@option("--token", type=STRING) | ||
@option("--no-color", is_flag=True) | ||
def fetch_ids(endpoint, token, no_color): | ||
def fetch_ids( | ||
endpoint: str, | ||
token: str, | ||
no_color: bool, # noqa: FBT001 | ||
) -> None: | ||
"""Fetch all to import ids.""" | ||
theses_filters = current_app.config["CAMPUSONLINE_THESES_FILTERS"] | ||
ids = fetch_all_ids(endpoint, token, theses_filters) | ||
|
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,22 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2021-2022 Graz University of Technology. | ||
# Copyright (C) 2021-2023 Graz University of Technology. | ||
# | ||
# invenio-campusonline is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
|
||
"""This module is used to import/export from/to the CampusOnline System.""" | ||
"""The module is used to import/export from/to the CampusOnline System.""" | ||
|
||
from flask import Flask | ||
|
||
|
||
class InvenioCampusonline: | ||
"""invenio-campusonline extension.""" | ||
|
||
def __init__(self, app=None): | ||
def __init__(self, app: Flask = None) -> None: | ||
"""Extension initialization.""" | ||
if app: | ||
self.init_app(app) | ||
|
||
def init_app(self, app): | ||
def init_app(self, app: Flask) -> None: | ||
"""Flask application initialization.""" | ||
app.extensions["invenio-campusonline"] = self |
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.