diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..79a16af7e --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 120 \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py index 211771f81..0dc231826 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -3,7 +3,7 @@ import logging import importlib.util -from flask import Flask, render_template, Blueprint, flash, redirect, url_for +from flask import Flask, render_template, Blueprint from flask_login import current_user from flask_sqlalchemy import SQLAlchemy from dotenv import load_dotenv diff --git a/app/blueprints/__init__.py b/app/blueprints/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/blueprints/auth/__init__.py b/app/blueprints/auth/__init__.py index 1ce3db0cb..b6006ab1c 100644 --- a/app/blueprints/auth/__init__.py +++ b/app/blueprints/auth/__init__.py @@ -1,4 +1,3 @@ from flask import Blueprint auth_bp = Blueprint('auth', __name__, template_folder='templates') - diff --git a/app/blueprints/auth/routes.py b/app/blueprints/auth/routes.py index 894212e28..212621922 100644 --- a/app/blueprints/auth/routes.py +++ b/app/blueprints/auth/routes.py @@ -53,7 +53,7 @@ def login(): login_user(user, remember=form.remember_me.data) return redirect(url_for('public.index')) else: - error = f'Invalid credentials' + error = 'Invalid credentials' return render_template("auth/login_form.html", form=form, error=error) return render_template('auth/login_form.html', form=form) diff --git a/app/blueprints/dataset/forms.py b/app/blueprints/dataset/forms.py index 3be424de7..8f59a248a 100644 --- a/app/blueprints/dataset/forms.py +++ b/app/blueprints/dataset/forms.py @@ -23,4 +23,3 @@ class DataSetForm(FlaskForm): tags = StringField('Tags (separated by commas)') authors = FieldList(FormField(AuthorForm)) submit = SubmitField('Submit') - diff --git a/app/blueprints/dataset/models.py b/app/blueprints/dataset/models.py index 9ba738ff5..7ec00f44e 100644 --- a/app/blueprints/dataset/models.py +++ b/app/blueprints/dataset/models.py @@ -1,13 +1,14 @@ -from collections import OrderedDict from datetime import datetime from flask import request from app import db from enum import Enum -from sqlalchemy import Enum as SQLAlchemyEnum, inspect +from sqlalchemy import Enum as SQLAlchemyEnum import os + + class PublicationType(Enum): NONE = 'none' ANNOTATION_COLLECTION = 'annotationcollection' @@ -197,7 +198,12 @@ class DSDownloadRecord(db.Model): download_cookie = db.Column(db.String(36), nullable=False) # Assuming UUID4 strings def __repr__(self): - return f'' + return ( + f'' + ) class DSViewRecord(db.Model): @@ -219,7 +225,12 @@ class FileDownloadRecord(db.Model): download_cookie = db.Column(db.String(36), nullable=False) # Assuming UUID4 strings def __repr__(self): - return f'' + return ( + f'' + ) def get_human_readable_size(size): diff --git a/app/blueprints/dataset/routes.py b/app/blueprints/dataset/routes.py index 79697fdb0..319d804b8 100644 --- a/app/blueprints/dataset/routes.py +++ b/app/blueprints/dataset/routes.py @@ -75,7 +75,7 @@ def create_dataset(): deposition_doi = zenodo_get_doi(deposition_id) dataset.ds_meta_data.dataset_doi = deposition_doi app.db.session.commit() - except Exception as e: + except Exception: pass # move feature models permanently @@ -478,7 +478,7 @@ def api_create_dataset(): PART 2: SAVE BASIC DATA """ ds_meta_data = _create_ds_meta_data(info=info) - authors = _create_authors(info=info, ds_meta_data=ds_meta_data) + _create_authors(info=info, ds_meta_data=ds_meta_data) dataset = _create_dataset(user=user, ds_meta_data=ds_meta_data) """ @@ -713,4 +713,4 @@ def subdomain_index(doi): # Por ejemplo, mostrar un error 404 o redirigir a una página de error return "Dataset no encontrado", 404 - abort(404) \ No newline at end of file + abort(404) diff --git a/app/blueprints/profile/models.py b/app/blueprints/profile/models.py index 6eb90ec27..cdeeba4f5 100644 --- a/app/blueprints/profile/models.py +++ b/app/blueprints/profile/models.py @@ -13,4 +13,4 @@ class UserProfile(db.Model): def save(self): if not self.id: db.session.add(self) - db.session.commit() \ No newline at end of file + db.session.commit() diff --git a/app/blueprints/profile/routes.py b/app/blueprints/profile/routes.py index 11815c486..83eb57c04 100644 --- a/app/blueprints/profile/routes.py +++ b/app/blueprints/profile/routes.py @@ -1,4 +1,4 @@ -from flask import request, render_template, flash, redirect, url_for, current_app +from flask import request, render_template from flask_login import login_required from app.blueprints.profile import profile_bp diff --git a/app/blueprints/profile/services.py b/app/blueprints/profile/services.py index 561a1d45e..61b4c72a6 100644 --- a/app/blueprints/profile/services.py +++ b/app/blueprints/profile/services.py @@ -1,8 +1,6 @@ from app.blueprints.profile.repositories import UserProfileRepository from app.services.BaseService import BaseService -from flask import current_app - class UserProfileService(BaseService): def __init__(self): diff --git a/app/blueprints/public/routes.py b/app/blueprints/public/routes.py index 0a469263a..5832855b3 100644 --- a/app/blueprints/public/routes.py +++ b/app/blueprints/public/routes.py @@ -1,7 +1,7 @@ import logging import app -from flask import request, current_app, render_template, Blueprint +from flask import render_template from app.blueprints.public import public_bp from ..dataset.models import DataSet, DSMetaData diff --git a/app/blueprints/team/__init__.py b/app/blueprints/team/__init__.py index f09e37379..b4684f230 100644 --- a/app/blueprints/team/__init__.py +++ b/app/blueprints/team/__init__.py @@ -1,4 +1,3 @@ from flask import Blueprint team_bp = Blueprint('team', __name__, template_folder='templates') - diff --git a/app/services/BaseService.py b/app/services/BaseService.py index df6474dba..3ff8d6472 100644 --- a/app/services/BaseService.py +++ b/app/services/BaseService.py @@ -25,4 +25,4 @@ def handle_service_response(self, result, errors, success_url_redirect, success_ for error_field, error_messages in errors.items(): for error_message in error_messages: flash(f'{error_field}: {error_message}', 'error') - return render_template(error_template, form=form) \ No newline at end of file + return render_template(error_template, form=form) diff --git a/app/zenodo.py b/app/zenodo.py index 7620da01e..38b79636f 100644 --- a/app/zenodo.py +++ b/app/zenodo.py @@ -44,7 +44,7 @@ def test_full_zenodo_connection() -> Response: # Create an empty file file_path = os.path.join(current_app.root_path, "test_file.txt") - with open(file_path, 'w') as file: + with open(file_path, 'w'): pass messages = [] # List to store messages