diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index aff337d09e..0000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: -- package-ecosystem: pip - directory: "/" - schedule: - interval: weekly - day: monday - time: "03:00" - timezone: Europe/Paris - open-pull-requests-limit: 10 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..fea510bca8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-toml + - id: check-yaml + exclude: nextcloudappstore/scaffolding/app-templates/.* + - id: end-of-file-fixer + exclude: | + (?x)^( + \.tx/.*| + \.idea/.*| + locale/.*| + nextcloudappstore/core/static/.*| + nextcloudappstore/core/templates/.*| + nextcloudappstore/templates/.*| + nextcloudappstore/user/templates/.* + )$ + - id: trailing-whitespace + exclude: | + (?x)^( + \.tx/.*| + \.idea/.*| + locale/.*| + nextcloudappstore/core/static/.*| + nextcloudappstore/core/templates/.*| + nextcloudappstore/templates/.*| + nextcloudappstore/user/templates/.* + )$ + - id: mixed-line-ending + exclude: | + (?x)^( + \.tx/.*| + \.idea/.*| + locale/.*| + nextcloudappstore/core/static/.*| + nextcloudappstore/core/templates/.*| + nextcloudappstore/templates/.*| + nextcloudappstore/user/templates/.* + )$ + +- repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort diff --git a/AUTHORS.md b/AUTHORS.md index 5bb849c984..710a7402a6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -28,4 +28,4 @@ * [Sander](mailto:brantje@gmail.com) * [Susinthiran Nathan](mailto:fossxplorer@gmail.com) * [Thomas Wouters](mailto:twouters@users.noreply.github.com) -* [bakkegaard](mailto:nickbakkegaard@gmail.com) \ No newline at end of file +* [bakkegaard](mailto:nickbakkegaard@gmail.com) diff --git a/CHANGELOG.md b/CHANGELOG.md index afa72aea8c..128c9d0346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,10 @@ ## [4.0.0] - 2018-11-10 -### Added +### Added - Support for Nextcloud 14 -- Add info.xml validation for fulltextsearch and dashboard +- Add info.xml validation for fulltextsearch and dashboard ### Changed @@ -19,7 +19,7 @@ - Make test output more verbose - Pin down Travis-CI versions to match Ubuntu 16.04 -### Removed +### Removed - Removed Support for Nextcloud 11 - Removed compiled JavaScript files from version control @@ -59,7 +59,7 @@ ### Security -- Narrow down fixtures to not accidentally import test data on production systems. Check if a user with the user name **admin** was created. If so delete that user from your system. +- Narrow down fixtures to not accidentally import test data on production systems. Check if a user with the user name **admin** was created. If so delete that user from your system. ## [3.1.2] - 2018-02-02 @@ -134,10 +134,10 @@ - Moved certificate and scaffolding to separate folders - Moved Nextcloud public certificate and CRL to new folder - Trim text of most info.xml elements - + ### Removed -- Removed **auth** category, use **security** instead +- Removed **auth** category, use **security** instead - Dropped Node.js 7 support and require Node.js 8+ - Dropped support for Nextcloud 9 and 10: - owncloud tag in info.xml will not be migrated to nextcloud tags anymore diff --git a/Makefile b/Makefile index 395919a315..56d10c4519 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ prod_version=12.0.0 .PHONY: lint lint: - $(pycodestyle) $(CURDIR)/nextcloudappstore --exclude=migrations,development.py + $(pycodestyle) $(CURDIR)/nextcloudappstore --exclude=migrations,development.py --max-line-length=80 $(mypy) --ignore-missing-imports $(CURDIR)/nextcloudappstore/api/v1/release $(mypy) --ignore-missing-imports $(CURDIR)/nextcloudappstore/certificate $(bandit) -r $(CURDIR)/nextcloudappstore -c $(CURDIR)/.bandit.yml diff --git a/docs/conf.py b/docs/conf.py index 20e1a738ee..23d20de1ee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -125,6 +125,7 @@ todo_include_todos = False # a list of builtin themes. # import sphinx_rtd_theme + html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] diff --git a/docs/developer.rst b/docs/developer.rst index 09fcffaf0d..b7faa02884 100644 --- a/docs/developer.rst +++ b/docs/developer.rst @@ -1,7 +1,7 @@ App Developer Guide =================== -Note: Documentation and a tutorial about App Development itself (vs "app development and the App Store") is found at +Note: Documentation and a tutorial about App Development itself (vs "app development and the App Store") is found at `https://docs.nextcloud.com/server/stable/developer_manual/app/index.html `_. Most of today's developers publish their source code on GitHub, BitBucket, GitLab or on their own GitLab instance. These tools typically also provide a way to release new versions based on Git tags or by uploading custom archives. diff --git a/docs/index.rst b/docs/index.rst index dd45cb4bc2..fa5ab214dd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -65,4 +65,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/prodinstalldocker.rst b/docs/prodinstalldocker.rst index 013acd9c22..3a3d27638f 100644 --- a/docs/prodinstalldocker.rst +++ b/docs/prodinstalldocker.rst @@ -327,4 +327,3 @@ After obtaining the token from GitHub, add it anywhere in your settings file (** To automate syncing you might want to add the command as a cronjob and schedule it every hour. .. note:: Only one sync command should be run at a time, otherwise race conditions might cause unpredictable results. To ensure this use a proper cronjob daemon that supports running only one command at a time, for instance `SystemD timers `_ - diff --git a/docs/translation.rst b/docs/translation.rst index 07adcf9587..0ec2908cb8 100644 --- a/docs/translation.rst +++ b/docs/translation.rst @@ -51,4 +51,3 @@ Translations are managed on `Transifex `_. Select the language you want to translate and hit the **Translate** or **view strings online** button. Translated content will be pulled daily from Transifex. - diff --git a/docs/upgradenotices.rst b/docs/upgradenotices.rst index d1f1b9de28..4f08d1910b 100644 --- a/docs/upgradenotices.rst +++ b/docs/upgradenotices.rst @@ -11,5 +11,3 @@ Configuring Nextcloud Release Sync **3.2.0** changed the way Nextcloud releases are managed in the App Store. Instead of manually adjusting releases in the admin interface or importing updated fixtures via JSON files releases are now synced directly from GitHub. Consult :ref:`prod_install_release_sync` or if you are using Docker :ref:`prod_install_release_sync_docker` in order to run or configure the release sync command. - - diff --git a/nextcloudappstore/api/urls.py b/nextcloudappstore/api/urls.py index 512de3e293..835ecd8ddb 100644 --- a/nextcloudappstore/api/urls.py +++ b/nextcloudappstore/api/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url, include +from django.conf.urls import include, url app_name = 'api' diff --git a/nextcloudappstore/api/v1/release/__init__.py b/nextcloudappstore/api/v1/release/__init__.py index 98aa35ebd4..47cde83ff7 100644 --- a/nextcloudappstore/api/v1/release/__init__.py +++ b/nextcloudappstore/api/v1/release/__init__.py @@ -1,4 +1,5 @@ from django.conf import settings # type: ignore + from nextcloudappstore.core.facades import read_relative_file diff --git a/nextcloudappstore/api/v1/release/importer.py b/nextcloudappstore/api/v1/release/importer.py index 1c77736174..624fac8ef4 100644 --- a/nextcloudappstore/api/v1/release/importer.py +++ b/nextcloudappstore/api/v1/release/importer.py @@ -1,14 +1,16 @@ -from typing import Dict, Any, Set, Tuple # type: ignore +from typing import Any, Dict, Set, Tuple # type: ignore -from django.utils import timezone from django.conf import settings # type: ignore +from django.utils import timezone from semantic_version import Version # type: ignore from nextcloudappstore.core.facades import any_match -from nextcloudappstore.core.models import App, Screenshot, Category, \ - AppRelease, ShellCommand, License, Database, DatabaseDependency, \ - PhpExtensionDependency, PhpExtension, AppAuthor -from nextcloudappstore.core.versioning import to_spec, to_raw_spec +from nextcloudappstore.core.models import (App, AppAuthor, AppRelease, Category, + Database, DatabaseDependency, + License, PhpExtension, + PhpExtensionDependency, Screenshot, + ShellCommand) +from nextcloudappstore.core.versioning import to_raw_spec, to_spec def none_to_empty_string(value: str) -> str: diff --git a/nextcloudappstore/api/v1/release/parser.py b/nextcloudappstore/api/v1/release/parser.py index 5729c3c84d..8fa0b1fd5c 100644 --- a/nextcloudappstore/api/v1/release/parser.py +++ b/nextcloudappstore/api/v1/release/parser.py @@ -2,15 +2,15 @@ import re import tarfile # type: ignore from functools import reduce from pathlib import Path -from typing import Dict, Any, List, Set, Pattern +from typing import Any, Dict, List, Pattern, Set import lxml.etree # type: ignore -from rest_framework.exceptions import ParseError, \ - ValidationError # type: ignore +from rest_framework.exceptions import ValidationError # type: ignore +from rest_framework.exceptions import ParseError from nextcloudappstore.api.v1.release import ReleaseConfig -from nextcloudappstore.core.versioning import pad_max_version, \ - pad_min_version, raw_version +from nextcloudappstore.core.versioning import (pad_max_version, pad_min_version, + raw_version) class MaxFileSizeExceeded(ValidationError): diff --git a/nextcloudappstore/api/v1/release/provider.py b/nextcloudappstore/api/v1/release/provider.py index 702843252c..b2c8711b60 100644 --- a/nextcloudappstore/api/v1/release/provider.py +++ b/nextcloudappstore/api/v1/release/provider.py @@ -1,13 +1,13 @@ -from typing import Dict, Tuple, Any +from typing import Any, Dict, Tuple from rest_framework.exceptions import ValidationError from nextcloudappstore.api.v1.release import ReleaseConfig -from nextcloudappstore.api.v1.release.downloader import \ - AppReleaseDownloader -from nextcloudappstore.api.v1.release.parser import \ - GunZipAppMetadataExtractor, parse_app_metadata, parse_changelog, \ - validate_database +from nextcloudappstore.api.v1.release.downloader import AppReleaseDownloader +from nextcloudappstore.api.v1.release.parser import (GunZipAppMetadataExtractor, + parse_app_metadata, + parse_changelog, + validate_database) class InvalidAppDirectoryException(ValidationError): diff --git a/nextcloudappstore/api/v1/serializers.py b/nextcloudappstore/api/v1/serializers.py index 15d2372f83..9fc9d55ddc 100644 --- a/nextcloudappstore/api/v1/serializers.py +++ b/nextcloudappstore/api/v1/serializers.py @@ -2,11 +2,12 @@ from django.contrib.auth import get_user_model from parler_rest.fields import TranslatedFieldsField from parler_rest.serializers import TranslatableModelSerializer from rest_framework import serializers -from rest_framework.fields import SerializerMethodField, DateTimeField +from rest_framework.fields import DateTimeField, SerializerMethodField -from nextcloudappstore.core.models import PhpExtensionDependency, \ - DatabaseDependency, Category, AppAuthor, AppRelease, Screenshot, \ - AppRating, App, NextcloudRelease +from nextcloudappstore.core.models import (App, AppAuthor, AppRating, + AppRelease, Category, + DatabaseDependency, NextcloudRelease, + PhpExtensionDependency, Screenshot) from nextcloudappstore.core.validators import HttpsUrlValidator diff --git a/nextcloudappstore/api/v1/tests/__init__.py b/nextcloudappstore/api/v1/tests/__init__.py index d00a861d27..fff555d455 100644 --- a/nextcloudappstore/api/v1/tests/__init__.py +++ b/nextcloudappstore/api/v1/tests/__init__.py @@ -1,6 +1,6 @@ from .test_app import * +from .test_app_register import * from .test_app_release import * +from .test_app_release_provider import * from .test_parser import * from .test_release_importer import * -from .test_app_release_provider import * -from .test_app_register import * diff --git a/nextcloudappstore/api/v1/tests/test_app_release_provider.py b/nextcloudappstore/api/v1/tests/test_app_release_provider.py index 6bcbe98e57..1419dec04a 100644 --- a/nextcloudappstore/api/v1/tests/test_app_release_provider.py +++ b/nextcloudappstore/api/v1/tests/test_app_release_provider.py @@ -1,17 +1,16 @@ from unittest.mock import MagicMock from django.test import TestCase -from nextcloudappstore.api.v1.release.downloader import \ - AppReleaseDownloader -from nextcloudappstore.api.v1.release.parser import \ - GunZipAppMetadataExtractor, AppMetaData -from nextcloudappstore.api.v1.release.provider import \ - AppReleaseProvider, \ - InvalidAppDirectoryException -from nextcloudappstore.core.facades import read_relative_file, \ - resolve_file_relative_path from pymple import Container +from nextcloudappstore.api.v1.release.downloader import AppReleaseDownloader +from nextcloudappstore.api.v1.release.parser import (AppMetaData, + GunZipAppMetadataExtractor) +from nextcloudappstore.api.v1.release.provider import ( + AppReleaseProvider, InvalidAppDirectoryException) +from nextcloudappstore.core.facades import (read_relative_file, + resolve_file_relative_path) + class FakeDownload: filename = resolve_file_relative_path(__file__, diff --git a/nextcloudappstore/api/v1/tests/test_parser.py b/nextcloudappstore/api/v1/tests/test_parser.py index 181e747154..0839a034dd 100644 --- a/nextcloudappstore/api/v1/tests/test_parser.py +++ b/nextcloudappstore/api/v1/tests/test_parser.py @@ -5,14 +5,14 @@ from django.test import TestCase from rest_framework.exceptions import ParseError from nextcloudappstore.api.v1.release import ReleaseConfig -from nextcloudappstore.api.v1.release.parser import \ - parse_app_metadata, GunZipAppMetadataExtractor, \ - InvalidAppPackageStructureException, \ - UnsupportedAppArchiveException, InvalidAppMetadataXmlException, \ - fix_partial_translations, parse_changelog, ForbiddenLinkException, \ - validate_database, BlacklistedMemberException -from nextcloudappstore.core.facades import resolve_file_relative_path, \ - read_file_contents +from nextcloudappstore.api.v1.release.parser import ( + BlacklistedMemberException, ForbiddenLinkException, + GunZipAppMetadataExtractor, InvalidAppMetadataXmlException, + InvalidAppPackageStructureException, UnsupportedAppArchiveException, + fix_partial_translations, parse_app_metadata, parse_changelog, + validate_database) +from nextcloudappstore.core.facades import (read_file_contents, + resolve_file_relative_path) class ParserTest(TestCase): diff --git a/nextcloudappstore/api/v1/tests/test_release_importer.py b/nextcloudappstore/api/v1/tests/test_release_importer.py index d714e7e0a0..5063dafcf7 100644 --- a/nextcloudappstore/api/v1/tests/test_release_importer.py +++ b/nextcloudappstore/api/v1/tests/test_release_importer.py @@ -1,5 +1,5 @@ -from django.contrib.auth import get_user_model from django.conf import settings +from django.contrib.auth import get_user_model from django.test import TestCase from pymple import Container @@ -7,7 +7,7 @@ from nextcloudappstore.api.v1.release import ReleaseConfig from nextcloudappstore.api.v1.release.importer import AppImporter from nextcloudappstore.api.v1.release.parser import parse_app_metadata from nextcloudappstore.core.facades import read_relative_file -from nextcloudappstore.core.models import App, Screenshot, Database +from nextcloudappstore.core.models import App, Database, Screenshot class ImporterTest(TestCase): diff --git a/nextcloudappstore/api/v1/urls.py b/nextcloudappstore/api/v1/urls.py index 9ea2d6ddc5..8066867d6b 100644 --- a/nextcloudappstore/api/v1/urls.py +++ b/nextcloudappstore/api/v1/urls.py @@ -1,10 +1,14 @@ from django.conf.urls import url from django.views.decorators.http import etag -from nextcloudappstore.api.v1.views import AppView, AppReleaseView, \ - CategoryView, SessionObtainAuthToken, RegenerateAuthToken, AppRatingView, \ - AppRegisterView, NextcloudReleaseView, AppsView -from nextcloudappstore.core.caching import app_ratings_etag, categories_etag, \ - apps_etag, nextcloud_release_etag, apps_all_etag + +from nextcloudappstore.api.v1.views import (AppRatingView, AppRegisterView, + AppReleaseView, AppsView, AppView, + CategoryView, NextcloudReleaseView, + RegenerateAuthToken, + SessionObtainAuthToken) +from nextcloudappstore.core.caching import (app_ratings_etag, apps_all_etag, + apps_etag, categories_etag, + nextcloud_release_etag) from nextcloudappstore.core.versioning import SEMVER_REGEX app_name = 'v1' diff --git a/nextcloudappstore/api/v1/views.py b/nextcloudappstore/api/v1/views.py index cf84410d86..92a72fae87 100644 --- a/nextcloudappstore/api/v1/views.py +++ b/nextcloudappstore/api/v1/views.py @@ -7,22 +7,25 @@ from requests import HTTPError from rest_framework import authentication, parsers, renderers # type: ignore from rest_framework.authtoken.models import Token from rest_framework.authtoken.serializers import AuthTokenSerializer -from rest_framework.exceptions import ValidationError, PermissionDenied -from rest_framework.generics import DestroyAPIView, \ - get_object_or_404, ListAPIView # type: ignore +from rest_framework.exceptions import PermissionDenied, ValidationError +from rest_framework.generics import DestroyAPIView # type: ignore +from rest_framework.generics import ListAPIView, get_object_or_404 from rest_framework.permissions import IsAuthenticated # type: ignore from rest_framework.response import Response # type: ignore from rest_framework.views import APIView from nextcloudappstore.api.v1.release.importer import AppImporter from nextcloudappstore.api.v1.release.provider import AppReleaseProvider -from nextcloudappstore.api.v1.serializers import AppSerializer, \ - AppReleaseDownloadSerializer, CategorySerializer, AppRatingSerializer, \ - AppRegisterSerializer, NextcloudReleaseSerializer +from nextcloudappstore.api.v1.serializers import (AppRatingSerializer, + AppRegisterSerializer, + AppReleaseDownloadSerializer, + AppSerializer, + CategorySerializer, + NextcloudReleaseSerializer) from nextcloudappstore.certificate.validator import CertificateValidator from nextcloudappstore.core.facades import read_file_contents -from nextcloudappstore.core.models import App, AppRelease, Category, \ - AppRating, NextcloudRelease +from nextcloudappstore.core.models import (App, AppRating, AppRelease, Category, + NextcloudRelease) from nextcloudappstore.core.permissions import UpdateDeletePermission from nextcloudappstore.core.throttling import PostThrottle from nextcloudappstore.core.versioning import version_in_spec diff --git a/nextcloudappstore/certificate/tests/test_validator.py b/nextcloudappstore/certificate/tests/test_validator.py index 8442dbb84d..6a90c730b1 100644 --- a/nextcloudappstore/certificate/tests/test_validator.py +++ b/nextcloudappstore/certificate/tests/test_validator.py @@ -1,11 +1,12 @@ from django.test import TestCase from pymple import Container -from nextcloudappstore.certificate.validator import CertificateValidator, \ - InvalidCertificateException, CertificateConfiguration, \ - InvalidSignatureException, CertificateAppIdMismatchException -from nextcloudappstore.core.facades import read_relative_file, \ - resolve_file_relative_path +from nextcloudappstore.certificate.validator import ( + CertificateAppIdMismatchException, CertificateConfiguration, + CertificateValidator, InvalidCertificateException, + InvalidSignatureException) +from nextcloudappstore.core.facades import (read_relative_file, + resolve_file_relative_path) class ValidatorTest(TestCase): diff --git a/nextcloudappstore/certificate/validator.py b/nextcloudappstore/certificate/validator.py index cdeb08ac26..6c6e374e06 100644 --- a/nextcloudappstore/certificate/validator.py +++ b/nextcloudappstore/certificate/validator.py @@ -3,9 +3,9 @@ from base64 import b64decode from typing import Optional import pem -from OpenSSL.crypto import FILETYPE_PEM, load_certificate, verify, X509, \ - X509Store, X509StoreContext, load_crl, X509StoreFlags from django.conf import settings # type: ignore +from OpenSSL.crypto import (FILETYPE_PEM, X509, X509Store, X509StoreContext, + X509StoreFlags, load_certificate, load_crl, verify) from rest_framework.exceptions import ValidationError logger = logging.getLogger(__name__) diff --git a/nextcloudappstore/core/admin.py b/nextcloudappstore/core/admin.py index 50aa7546cd..67a29d4479 100644 --- a/nextcloudappstore/core/admin.py +++ b/nextcloudappstore/core/admin.py @@ -1,10 +1,13 @@ from django.contrib import admin from parler.admin import TranslatableAdmin -from nextcloudappstore.core.models import DatabaseDependency, AppRelease, \ - ShellCommand, Screenshot, PhpExtensionDependency, License, PhpExtension, \ - Database, AppRating, App, Category, AppAuthor, AppReleaseDeleteLog, \ - NextcloudRelease +from nextcloudappstore.core.models import (App, AppAuthor, AppRating, + AppRelease, AppReleaseDeleteLog, + Category, Database, + DatabaseDependency, License, + NextcloudRelease, PhpExtension, + PhpExtensionDependency, Screenshot, + ShellCommand) class DatabaseDependencyInline(admin.TabularInline): diff --git a/nextcloudappstore/core/caching.py b/nextcloudappstore/core/caching.py index 957d7e43a8..e8e4e006e7 100644 --- a/nextcloudappstore/core/caching.py +++ b/nextcloudappstore/core/caching.py @@ -1,9 +1,10 @@ -from typing import List, Tuple, Any +from typing import Any, List, Tuple + from django.db.models import Max, QuerySet from semantic_version import Version -from nextcloudappstore.core.models import App, AppReleaseDeleteLog, Category, \ - AppRating, NextcloudRelease +from nextcloudappstore.core.models import (App, AppRating, AppReleaseDeleteLog, + Category, NextcloudRelease) def create_etag(pairs: List[Tuple[QuerySet, str]]) -> str: diff --git a/nextcloudappstore/core/facades.py b/nextcloudappstore/core/facades.py index 36988945ba..189dfce7e6 100644 --- a/nextcloudappstore/core/facades.py +++ b/nextcloudappstore/core/facades.py @@ -1,6 +1,6 @@ import os from itertools import chain -from typing import Iterable, TypeVar, Callable, Set +from typing import Callable, Iterable, Set, TypeVar """ Contains small utility and shortcut functions diff --git a/nextcloudappstore/core/feeds.py b/nextcloudappstore/core/feeds.py index 94aab6686b..172c575f0e 100644 --- a/nextcloudappstore/core/feeds.py +++ b/nextcloudappstore/core/feeds.py @@ -1,14 +1,13 @@ +from bleach import clean from django.conf import settings from django.contrib.syndication.views import Feed -from django.urls import reverse -from django.urls import reverse_lazy +from django.urls import reverse, reverse_lazy from django.utils.feedgenerator import Atom1Feed from django.utils.translation import ugettext_lazy as _ # type: ignore +from markdown import markdown from parler.models import TranslationDoesNotExist from nextcloudappstore.core.models import AppRelease -from markdown import markdown -from bleach import clean class AppReleaseRssFeed(Feed): diff --git a/nextcloudappstore/core/forms.py b/nextcloudappstore/core/forms.py index f23216bfaa..12bb3be59d 100644 --- a/nextcloudappstore/core/forms.py +++ b/nextcloudappstore/core/forms.py @@ -1,8 +1,8 @@ from django.conf import settings -from django.forms import Form, CharField, Textarea, ChoiceField, RadioSelect, \ - BooleanField, TextInput -from django.utils.translation import get_language_info, \ - ugettext_lazy as _ # type: ignore +from django.forms import (BooleanField, CharField, ChoiceField, Form, + RadioSelect, Textarea, TextInput) +from django.utils.translation import get_language_info +from django.utils.translation import ugettext_lazy as _ # type: ignore from nextcloudappstore.core.models import App, AppRating diff --git a/nextcloudappstore/core/management/commands/importdbtranslations.py b/nextcloudappstore/core/management/commands/importdbtranslations.py index 442ffbc834..17f3608153 100644 --- a/nextcloudappstore/core/management/commands/importdbtranslations.py +++ b/nextcloudappstore/core/management/commands/importdbtranslations.py @@ -1,6 +1,5 @@ from django.conf import settings -from django.core.management import BaseCommand -from django.core.management import CommandError +from django.core.management import BaseCommand, CommandError from django.utils.translation import activate, ugettext from parler.models import TranslatableModel from parler.utils.context import switch_language diff --git a/nextcloudappstore/core/management/commands/syncnextcloudreleases.py b/nextcloudappstore/core/management/commands/syncnextcloudreleases.py index 4897472d68..db5319f326 100644 --- a/nextcloudappstore/core/management/commands/syncnextcloudreleases.py +++ b/nextcloudappstore/core/management/commands/syncnextcloudreleases.py @@ -1,10 +1,9 @@ import requests from django.conf import settings -from django.core.management import BaseCommand -from django.core.management import CommandError +from django.core.management import BaseCommand, CommandError -from nextcloudappstore.core.github import get_supported_releases, \ - GitHubClient, sync_releases +from nextcloudappstore.core.github import (GitHubClient, get_supported_releases, + sync_releases) class Command(BaseCommand): diff --git a/nextcloudappstore/core/management/commands/tests/test_translations.py b/nextcloudappstore/core/management/commands/tests/test_translations.py index 4101b86c06..dc6346a82b 100644 --- a/nextcloudappstore/core/management/commands/tests/test_translations.py +++ b/nextcloudappstore/core/management/commands/tests/test_translations.py @@ -1,11 +1,12 @@ import time +import unittest +from io import StringIO + from django.core.management import call_command from django.test import TestCase -from io import StringIO -import unittest -from nextcloudappstore.core.facades import read_relative_file, \ - write_relative_file +from nextcloudappstore.core.facades import (read_relative_file, + write_relative_file) from nextcloudappstore.core.models import Category diff --git a/nextcloudappstore/core/migrations/0001_initial.py b/nextcloudappstore/core/migrations/0001_initial.py index e0ad4bec08..93377d2a8e 100644 --- a/nextcloudappstore/core/migrations/0001_initial.py +++ b/nextcloudappstore/core/migrations/0001_initial.py @@ -2,11 +2,11 @@ # Generated by Django 1.9.8 on 2016-09-09 18:45 from __future__ import unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import parler.models +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/nextcloudappstore/core/migrations/0004_appownershiptransfer.py b/nextcloudappstore/core/migrations/0004_appownershiptransfer.py index d197c5d6d4..fd8075f2a7 100644 --- a/nextcloudappstore/core/migrations/0004_appownershiptransfer.py +++ b/nextcloudappstore/core/migrations/0004_appownershiptransfer.py @@ -2,9 +2,9 @@ # Generated by Django 1.10.1 on 2016-09-26 09:03 from __future__ import unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/nextcloudappstore/core/migrations/0007_auto_20161005_1424.py b/nextcloudappstore/core/migrations/0007_auto_20161005_1424.py index d93e37c8e2..2627499407 100644 --- a/nextcloudappstore/core/migrations/0007_auto_20161005_1424.py +++ b/nextcloudappstore/core/migrations/0007_auto_20161005_1424.py @@ -2,8 +2,9 @@ # Generated by Django 1.10.2 on 2016-10-05 14:24 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models + class Migration(migrations.Migration): diff --git a/nextcloudappstore/core/migrations/0008_migrate_changelogs.py b/nextcloudappstore/core/migrations/0008_migrate_changelogs.py index 57623ebf1a..381f1946bc 100644 --- a/nextcloudappstore/core/migrations/0008_migrate_changelogs.py +++ b/nextcloudappstore/core/migrations/0008_migrate_changelogs.py @@ -2,8 +2,8 @@ # Generated by Django 1.10.2 on 2016-10-05 14:24 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models def create_default_changelogs(apps, schema_editor): diff --git a/nextcloudappstore/core/migrations/0022_auto_20200328_1055.py b/nextcloudappstore/core/migrations/0022_auto_20200328_1055.py index 63b5974268..fc3afa7cec 100644 --- a/nextcloudappstore/core/migrations/0022_auto_20200328_1055.py +++ b/nextcloudappstore/core/migrations/0022_auto_20200328_1055.py @@ -1,6 +1,6 @@ -from django.db import migrations, models import django.db.models.deletion import parler.fields +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/nextcloudappstore/core/models.py b/nextcloudappstore/core/models.py index 443499863a..2f1bc0ba23 100644 --- a/nextcloudappstore/core/models.py +++ b/nextcloudappstore/core/models.py @@ -5,23 +5,23 @@ from typing import Tuple from django.conf import settings # type: ignore from django.contrib.auth.models import User # type: ignore -from django.db.models import Manager -from django.db.models import ManyToManyField, ForeignKey, \ - URLField, IntegerField, CharField, CASCADE, TextField, \ - DateTimeField, Model, BooleanField, EmailField, Q, \ - FloatField # type: ignore +from django.db.models import FloatField # type: ignore +from django.db.models import (CASCADE, BooleanField, CharField, DateTimeField, + EmailField, ForeignKey, IntegerField, Manager, + ManyToManyField, Model, Q, TextField, URLField) from django.db.models.signals import post_delete from django.dispatch import receiver from django.utils import timezone from django.utils.translation import ugettext_lazy as _ # type: ignore -from parler.models import TranslatedFields, TranslatableModel, \ - TranslatableManager # type: ignore -from semantic_version import Version, Spec +from parler.models import TranslatableManager # type: ignore +from parler.models import TranslatableModel, TranslatedFields +from semantic_version import Spec, Version from nextcloudappstore.core.facades import distinct from nextcloudappstore.core.rating import compute_rating -from nextcloudappstore.core.versioning import pad_min_version, \ - pad_max_inc_version, AppSemVer, group_by_main_version +from nextcloudappstore.core.versioning import (AppSemVer, group_by_main_version, + pad_max_inc_version, + pad_min_version) class AppManager(TranslatableManager): diff --git a/nextcloudappstore/core/templatetags/markdown.py b/nextcloudappstore/core/templatetags/markdown.py index a60bb042ee..6b3c2d0ac6 100644 --- a/nextcloudappstore/core/templatetags/markdown.py +++ b/nextcloudappstore/core/templatetags/markdown.py @@ -1,8 +1,8 @@ +from bleach import clean +from django import template from django.conf import settings from django.utils.safestring import mark_safe -from django import template from markdown import markdown as default_markdown -from bleach import clean register = template.Library() diff --git a/nextcloudappstore/core/templatetags/sort_by_version.py b/nextcloudappstore/core/templatetags/sort_by_version.py index 1628e131fa..157438806d 100644 --- a/nextcloudappstore/core/templatetags/sort_by_version.py +++ b/nextcloudappstore/core/templatetags/sort_by_version.py @@ -1,7 +1,8 @@ from django import template -from nextcloudappstore.core.versioning import pad_min_version from semantic_version import Version +from nextcloudappstore.core.versioning import pad_min_version + register = template.Library() diff --git a/nextcloudappstore/core/tests/e2e/base.py b/nextcloudappstore/core/tests/e2e/base.py index 3a9c71a7f6..50229e82ce 100644 --- a/nextcloudappstore/core/tests/e2e/base.py +++ b/nextcloudappstore/core/tests/e2e/base.py @@ -1,4 +1,4 @@ -from typing import Dict, Callable, Any +from typing import Any, Callable, Dict from urllib.parse import urlparse from django.contrib.staticfiles.testing import StaticLiveServerTestCase @@ -9,8 +9,8 @@ from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.support import expected_conditions as exp_cond from selenium.webdriver.support.wait import WebDriverWait -from nextcloudappstore.core.tests.e2e import TEST_USER, TEST_EMAIL, \ - TEST_PASSWORD, SELENIUM_WAIT_SEC +from nextcloudappstore.core.tests.e2e import (SELENIUM_WAIT_SEC, TEST_EMAIL, + TEST_PASSWORD, TEST_USER) from nextcloudappstore.user.facades import create_user, delete_user diff --git a/nextcloudappstore/core/tests/e2e/test_app_registration.py b/nextcloudappstore/core/tests/e2e/test_app_registration.py index 2a3e1e5412..80af818745 100644 --- a/nextcloudappstore/core/tests/e2e/test_app_registration.py +++ b/nextcloudappstore/core/tests/e2e/test_app_registration.py @@ -1,12 +1,12 @@ -from nextcloudappstore.core.facades import resolve_file_relative_path, \ - read_relative_file +from django.test import tag + +from nextcloudappstore.core.facades import (read_relative_file, + resolve_file_relative_path) from nextcloudappstore.core.models import App from nextcloudappstore.core.tests.e2e import TEST_APP_SIG from nextcloudappstore.core.tests.e2e.app_dev_steps import AppDevSteps from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - @tag('e2e') class AppRegistrationTest(BaseStoreTest, AppDevSteps): diff --git a/nextcloudappstore/core/tests/e2e/test_app_upload.py b/nextcloudappstore/core/tests/e2e/test_app_upload.py index bdc89320a9..8e44d37119 100644 --- a/nextcloudappstore/core/tests/e2e/test_app_upload.py +++ b/nextcloudappstore/core/tests/e2e/test_app_upload.py @@ -1,11 +1,10 @@ -from nextcloudappstore.core.tests.e2e import NEWS_ARCHIVE_URL, \ - NEWS_ARCHIVE_SIGNATURE, \ - NEWS_CERT +from django.test import tag + +from nextcloudappstore.core.tests.e2e import (NEWS_ARCHIVE_SIGNATURE, + NEWS_ARCHIVE_URL, NEWS_CERT) from nextcloudappstore.core.tests.e2e.app_dev_steps import AppDevSteps from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - @tag('e2e') class UploadAppReleaseTest(BaseStoreTest, AppDevSteps): diff --git a/nextcloudappstore/core/tests/e2e/test_app_upload_invalid.py b/nextcloudappstore/core/tests/e2e/test_app_upload_invalid.py index b92c9007e5..8de624d457 100644 --- a/nextcloudappstore/core/tests/e2e/test_app_upload_invalid.py +++ b/nextcloudappstore/core/tests/e2e/test_app_upload_invalid.py @@ -1,7 +1,7 @@ -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class UploadInvalidAppReleaseTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_change_language.py b/nextcloudappstore/core/tests/e2e/test_change_language.py index b1126d57b7..9be6165579 100644 --- a/nextcloudappstore/core/tests/e2e/test_change_language.py +++ b/nextcloudappstore/core/tests/e2e/test_change_language.py @@ -1,3 +1,4 @@ +from django.test import tag from selenium.webdriver.support.expected_conditions import staleness_of from selenium.webdriver.support.select import Select from selenium.webdriver.support.wait import WebDriverWait @@ -5,8 +6,6 @@ from selenium.webdriver.support.wait import WebDriverWait from nextcloudappstore.core.tests.e2e import SELENIUM_WAIT_SEC from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - @tag('e2e') class ChangeLanguageTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_comment.py b/nextcloudappstore/core/tests/e2e/test_comment.py index 656eb6de30..280f878b95 100644 --- a/nextcloudappstore/core/tests/e2e/test_comment.py +++ b/nextcloudappstore/core/tests/e2e/test_comment.py @@ -1,11 +1,10 @@ from enum import Enum +from django.test import tag from selenium.webdriver.support.select import Select from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - class Rating(Enum): BAD = 'id_rating_0' diff --git a/nextcloudappstore/core/tests/e2e/test_delete_account.py b/nextcloudappstore/core/tests/e2e/test_delete_account.py index 3e16cee7a8..4ccfa1ac6d 100644 --- a/nextcloudappstore/core/tests/e2e/test_delete_account.py +++ b/nextcloudappstore/core/tests/e2e/test_delete_account.py @@ -1,7 +1,7 @@ -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class DeleteAccountTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_feeds.py b/nextcloudappstore/core/tests/e2e/test_feeds.py index e9c6e7265d..fbfe4e83a4 100644 --- a/nextcloudappstore/core/tests/e2e/test_feeds.py +++ b/nextcloudappstore/core/tests/e2e/test_feeds.py @@ -1,9 +1,8 @@ import requests +from django.test import tag from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - @tag('e2e') class FeedTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_owner_transfer.py b/nextcloudappstore/core/tests/e2e/test_owner_transfer.py index ed0bcf30a0..7b29d5cac0 100644 --- a/nextcloudappstore/core/tests/e2e/test_owner_transfer.py +++ b/nextcloudappstore/core/tests/e2e/test_owner_transfer.py @@ -1,3 +1,4 @@ +from django.test import tag from django.urls import reverse from nextcloudappstore.core.tests.e2e import NEWS_CERT @@ -5,8 +6,6 @@ from nextcloudappstore.core.tests.e2e.app_dev_steps import AppDevSteps from nextcloudappstore.core.tests.e2e.base import BaseStoreTest from nextcloudappstore.user.facades import verify_email -from django.test import tag - @tag('e2e') class AppTransferTestTest(BaseStoreTest, AppDevSteps): diff --git a/nextcloudappstore/core/tests/e2e/test_profile_token.py b/nextcloudappstore/core/tests/e2e/test_profile_token.py index c399fc59c8..4a91a1b99f 100644 --- a/nextcloudappstore/core/tests/e2e/test_profile_token.py +++ b/nextcloudappstore/core/tests/e2e/test_profile_token.py @@ -1,7 +1,7 @@ -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class ProfileTokenTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_scaffolding.py b/nextcloudappstore/core/tests/e2e/test_scaffolding.py index 06a6161343..878d02872f 100644 --- a/nextcloudappstore/core/tests/e2e/test_scaffolding.py +++ b/nextcloudappstore/core/tests/e2e/test_scaffolding.py @@ -1,7 +1,7 @@ -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class ScaffoldTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_update_account.py b/nextcloudappstore/core/tests/e2e/test_update_account.py index 19b0e44bcb..58ca1c5c02 100644 --- a/nextcloudappstore/core/tests/e2e/test_update_account.py +++ b/nextcloudappstore/core/tests/e2e/test_update_account.py @@ -1,8 +1,8 @@ +from django.test import tag + from nextcloudappstore.core.tests.e2e import TEST_PASSWORD from nextcloudappstore.core.tests.e2e.base import BaseStoreTest -from django.test import tag - @tag('e2e') class UpdateAccountTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_update_password.py b/nextcloudappstore/core/tests/e2e/test_update_password.py index 83eccdf993..6018b365d8 100644 --- a/nextcloudappstore/core/tests/e2e/test_update_password.py +++ b/nextcloudappstore/core/tests/e2e/test_update_password.py @@ -1,8 +1,8 @@ -from nextcloudappstore.core.tests.e2e import TEST_USER, TEST_PASSWORD -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e import TEST_PASSWORD, TEST_USER +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class UpdatePasswordTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/e2e/test_user_register.py b/nextcloudappstore/core/tests/e2e/test_user_register.py index adb87b9e55..0d8373c168 100644 --- a/nextcloudappstore/core/tests/e2e/test_user_register.py +++ b/nextcloudappstore/core/tests/e2e/test_user_register.py @@ -1,9 +1,9 @@ import os -from nextcloudappstore.core.tests.e2e.base import BaseStoreTest - from django.test import tag +from nextcloudappstore.core.tests.e2e.base import BaseStoreTest + @tag('e2e') class UserRegisterTest(BaseStoreTest): diff --git a/nextcloudappstore/core/tests/test_caching.py b/nextcloudappstore/core/tests/test_caching.py index e4d08a088a..fb8c8af5e0 100644 --- a/nextcloudappstore/core/tests/test_caching.py +++ b/nextcloudappstore/core/tests/test_caching.py @@ -3,10 +3,10 @@ from urllib.request import Request from django.contrib.auth.models import User from django.test import TestCase -from nextcloudappstore.core.caching import nextcloud_release_etag, \ - categories_etag, app_ratings_etag -from nextcloudappstore.core.models import NextcloudRelease, Category, \ - AppRating, App +from nextcloudappstore.core.caching import (app_ratings_etag, categories_etag, + nextcloud_release_etag) +from nextcloudappstore.core.models import (App, AppRating, Category, + NextcloudRelease) class CachingTest(TestCase): diff --git a/nextcloudappstore/core/tests/test_cert_delete_releases.py b/nextcloudappstore/core/tests/test_cert_delete_releases.py index ade7ba3609..eda8b6f876 100644 --- a/nextcloudappstore/core/tests/test_cert_delete_releases.py +++ b/nextcloudappstore/core/tests/test_cert_delete_releases.py @@ -1,5 +1,6 @@ from django.contrib.auth.models import User from django.test import TestCase + from nextcloudappstore.core.models import App, AppRelease diff --git a/nextcloudappstore/core/tests/test_compatibility.py b/nextcloudappstore/core/tests/test_compatibility.py index f63ee536d1..0e7b694ed1 100644 --- a/nextcloudappstore/core/tests/test_compatibility.py +++ b/nextcloudappstore/core/tests/test_compatibility.py @@ -1,5 +1,6 @@ from django.contrib.auth import get_user_model from django.test import TestCase + from nextcloudappstore.core.models import App, AppRelease, NextcloudRelease diff --git a/nextcloudappstore/core/tests/test_deletion_log.py b/nextcloudappstore/core/tests/test_deletion_log.py index 31b04e7263..e77ac69923 100644 --- a/nextcloudappstore/core/tests/test_deletion_log.py +++ b/nextcloudappstore/core/tests/test_deletion_log.py @@ -1,5 +1,6 @@ from django.contrib.auth import get_user_model from django.test import TestCase + from nextcloudappstore.core.models import App, AppRelease, AppReleaseDeleteLog diff --git a/nextcloudappstore/core/tests/test_github.py b/nextcloudappstore/core/tests/test_github.py index fecc1f3bfc..ea226626fa 100644 --- a/nextcloudappstore/core/tests/test_github.py +++ b/nextcloudappstore/core/tests/test_github.py @@ -1,12 +1,12 @@ import json -from typing import Dict, Any +from typing import Any, Dict from unittest.mock import MagicMock from django.test import TestCase from nextcloudappstore.core.facades import read_relative_file -from nextcloudappstore.core.github import GitHubClient, \ - get_supported_releases, sync_releases +from nextcloudappstore.core.github import (GitHubClient, get_supported_releases, + sync_releases) from nextcloudappstore.core.models import NextcloudRelease diff --git a/nextcloudappstore/core/tests/test_search.py b/nextcloudappstore/core/tests/test_search.py index 816c1fd363..a4f24c9994 100644 --- a/nextcloudappstore/core/tests/test_search.py +++ b/nextcloudappstore/core/tests/test_search.py @@ -1,5 +1,6 @@ from django.contrib.auth import get_user_model from django.test import TestCase + from nextcloudappstore.core.models import App, AppRelease diff --git a/nextcloudappstore/core/tests/test_versioning.py b/nextcloudappstore/core/tests/test_versioning.py index 1e30a0a6bd..54052cfee4 100644 --- a/nextcloudappstore/core/tests/test_versioning.py +++ b/nextcloudappstore/core/tests/test_versioning.py @@ -2,11 +2,14 @@ import time from collections import OrderedDict from datetime import datetime from sys import maxsize + from django.test import TestCase -from nextcloudappstore.core.versioning import pad_min_version, to_spec, \ - pad_max_version, pad_max_inc_version, raw_version, to_raw_spec, \ - AppSemVer, \ - group_by_main_version + +from nextcloudappstore.core.versioning import (AppSemVer, group_by_main_version, + pad_max_inc_version, + pad_max_version, pad_min_version, + raw_version, to_raw_spec, + to_spec) class VersioningTest(TestCase): diff --git a/nextcloudappstore/core/versioning.py b/nextcloudappstore/core/versioning.py index 33c50a79e9..9fc721e9cc 100644 --- a/nextcloudappstore/core/versioning.py +++ b/nextcloudappstore/core/versioning.py @@ -1,9 +1,9 @@ from datetime import datetime from functools import reduce from sys import maxsize -from typing import Dict, Any, List +from typing import Any, Dict, List -from semantic_version import Version, Spec +from semantic_version import Spec, Version SEMVER_REGEX = (r'(?:0|[1-9][0-9]*)' r'\.(?:0|[1-9][0-9]*)' diff --git a/nextcloudappstore/core/views.py b/nextcloudappstore/core/views.py index 905db267d3..09b5c0b430 100644 --- a/nextcloudappstore/core/views.py +++ b/nextcloudappstore/core/views.py @@ -18,9 +18,9 @@ from semantic_version import Version from nextcloudappstore.core.caching import app_etag from nextcloudappstore.core.facades import flatmap -from nextcloudappstore.core.forms import AppRatingForm, AppReleaseUploadForm, \ - AppRegisterForm -from nextcloudappstore.core.models import App, Category, AppRating +from nextcloudappstore.core.forms import (AppRatingForm, AppRegisterForm, + AppReleaseUploadForm) +from nextcloudappstore.core.models import App, AppRating, Category from nextcloudappstore.core.serializers import AppRatingSerializer from nextcloudappstore.core.versioning import pad_min_version diff --git a/nextcloudappstore/scaffolding/app-templates/24/app/.github/workflows/reuse.yml b/nextcloudappstore/scaffolding/app-templates/24/app/.github/workflows/reuse.yml index 11c46d3a1a..67da505f24 100644 --- a/nextcloudappstore/scaffolding/app-templates/24/app/.github/workflows/reuse.yml +++ b/nextcloudappstore/scaffolding/app-templates/24/app/.github/workflows/reuse.yml @@ -9,7 +9,7 @@ on: [push, pull_request] jobs: test: runs-on: ubuntu-latest - steps: + steps: - uses: actions/checkout@v2 - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 \ No newline at end of file + uses: fsfe/reuse-action@v1 diff --git a/nextcloudappstore/scaffolding/app-templates/24/app/.gitignore b/nextcloudappstore/scaffolding/app-templates/24/app/.gitignore index 90b0b2bcea..8495aaa36f 100644 --- a/nextcloudappstore/scaffolding/app-templates/24/app/.gitignore +++ b/nextcloudappstore/scaffolding/app-templates/24/app/.gitignore @@ -6,4 +6,4 @@ /build/ node_modules/ /.php_cs.cache -js/*hot-update.* \ No newline at end of file +js/*hot-update.* diff --git a/nextcloudappstore/scaffolding/app-templates/24/app/img/app.svg.license b/nextcloudappstore/scaffolding/app-templates/24/app/img/app.svg.license index 87338c60b4..cb06d85653 100644 --- a/nextcloudappstore/scaffolding/app-templates/24/app/img/app.svg.license +++ b/nextcloudappstore/scaffolding/app-templates/24/app/img/app.svg.license @@ -1,2 +1,2 @@ SPDX-FileCopyrightText: {{ app.author_name }} <{{ app.author_mail }}> -SPDX-License-Identifier: {{ app.license }} \ No newline at end of file +SPDX-License-Identifier: {{ app.license }} diff --git a/nextcloudappstore/scaffolding/app-templates/25/app/.gitignore b/nextcloudappstore/scaffolding/app-templates/25/app/.gitignore index 90b0b2bcea..8495aaa36f 100644 --- a/nextcloudappstore/scaffolding/app-templates/25/app/.gitignore +++ b/nextcloudappstore/scaffolding/app-templates/25/app/.gitignore @@ -6,4 +6,4 @@ /build/ node_modules/ /.php_cs.cache -js/*hot-update.* \ No newline at end of file +js/*hot-update.* diff --git a/nextcloudappstore/scaffolding/app-templates/25/app/img/app.svg.license b/nextcloudappstore/scaffolding/app-templates/25/app/img/app.svg.license index 87338c60b4..cb06d85653 100644 --- a/nextcloudappstore/scaffolding/app-templates/25/app/img/app.svg.license +++ b/nextcloudappstore/scaffolding/app-templates/25/app/img/app.svg.license @@ -1,2 +1,2 @@ SPDX-FileCopyrightText: {{ app.author_name }} <{{ app.author_mail }}> -SPDX-License-Identifier: {{ app.license }} \ No newline at end of file +SPDX-License-Identifier: {{ app.license }} diff --git a/nextcloudappstore/scaffolding/archive.py b/nextcloudappstore/scaffolding/archive.py index 771647b77c..ccaee0802a 100644 --- a/nextcloudappstore/scaffolding/archive.py +++ b/nextcloudappstore/scaffolding/archive.py @@ -2,7 +2,7 @@ import re import tarfile from io import BytesIO from os import walk -from os.path import join, isdir, relpath, islink +from os.path import isdir, join, relpath from typing import Dict from django.conf import settings diff --git a/nextcloudappstore/scaffolding/forms.py b/nextcloudappstore/scaffolding/forms.py index 9e117c89b6..c893131da8 100644 --- a/nextcloudappstore/scaffolding/forms.py +++ b/nextcloudappstore/scaffolding/forms.py @@ -1,21 +1,20 @@ import re -from os import listdir import uuid +from os import listdir import requests from django.conf import settings from django.core.exceptions import ValidationError from django.core.mail import send_mail -from django.forms import Textarea, Form, URLField, MultipleChoiceField, \ - TextInput, BooleanField +from django.forms import (BooleanField, Form, MultipleChoiceField, Textarea, + TextInput, URLField) +from django.forms.fields import CharField, ChoiceField, EmailField, HiddenInput +from django.utils.functional import lazy from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ # type: ignore -from django.forms.fields import EmailField, CharField, ChoiceField,\ - HiddenInput from nextcloudappstore.core.facades import resolve_file_relative_path from nextcloudappstore.core.models import App, Category, Screenshot -from django.utils.functional import lazy def get_categories(): diff --git a/nextcloudappstore/scaffolding/tests/test_archive.py b/nextcloudappstore/scaffolding/tests/test_archive.py index e9b49a64a7..a271644090 100644 --- a/nextcloudappstore/scaffolding/tests/test_archive.py +++ b/nextcloudappstore/scaffolding/tests/test_archive.py @@ -3,7 +3,7 @@ import tarfile from django.test import TestCase from nextcloudappstore.core.facades import read_relative_file -from nextcloudappstore.scaffolding.archive import build_files, build_archive +from nextcloudappstore.scaffolding.archive import build_archive, build_files class ArchiveTest(TestCase): diff --git a/nextcloudappstore/scaffolding/views.py b/nextcloudappstore/scaffolding/views.py index ff9075205b..7effb8e769 100644 --- a/nextcloudappstore/scaffolding/views.py +++ b/nextcloudappstore/scaffolding/views.py @@ -1,18 +1,17 @@ -from django.http import HttpResponse, Http404 -from django.views.generic import FormView -from django.contrib.auth.mixins import LoginRequiredMixin -from django.urls import reverse - -from nextcloudappstore.core.models import App, Screenshot, NextcloudRelease -from nextcloudappstore.scaffolding.archive import build_archive -from nextcloudappstore.scaffolding.forms import AppScaffoldingForm, \ - IntegrationScaffoldingForm - -from django.conf import settings - import csv from datetime import datetime +from django.conf import settings +from django.contrib.auth.mixins import LoginRequiredMixin +from django.http import Http404, HttpResponse +from django.urls import reverse +from django.views.generic import FormView + +from nextcloudappstore.core.models import App, NextcloudRelease, Screenshot +from nextcloudappstore.scaffolding.archive import build_archive +from nextcloudappstore.scaffolding.forms import (AppScaffoldingForm, + IntegrationScaffoldingForm) + class AppScaffoldingView(FormView): template_name = 'app/scaffold.html' diff --git a/nextcloudappstore/urls.py b/nextcloudappstore/urls.py index a61a92aab7..9ca1dab762 100644 --- a/nextcloudappstore/urls.py +++ b/nextcloudappstore/urls.py @@ -2,7 +2,7 @@ from allauth.account.views import signup from allauth.socialaccount.views import signup as social_signup from csp.decorators import csp_update from django.conf import settings -from django.conf.urls import url, include +from django.conf.urls import include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.contrib.auth.decorators import login_required @@ -11,11 +11,12 @@ from django.views.decorators.http import etag from nextcloudappstore.core.caching import app_rating_etag from nextcloudappstore.core.feeds import AppReleaseAtomFeed, AppReleaseRssFeed -from nextcloudappstore.core.views import CategoryAppListView, AppDetailView, \ - app_description, AppReleasesView, AppUploadView, AppRatingApi, \ - AppRegisterView -from nextcloudappstore.scaffolding.views import AppScaffoldingView, \ - IntegrationScaffoldingView +from nextcloudappstore.core.views import (AppDetailView, AppRatingApi, + AppRegisterView, AppReleasesView, + AppUploadView, CategoryAppListView, + app_description) +from nextcloudappstore.scaffolding.views import (AppScaffoldingView, + IntegrationScaffoldingView) admin.site.login = login_required(admin.site.login) diff --git a/nextcloudappstore/user/facades.py b/nextcloudappstore/user/facades.py index 3983967121..3a063ab9fe 100644 --- a/nextcloudappstore/user/facades.py +++ b/nextcloudappstore/user/facades.py @@ -1,7 +1,7 @@ from allauth.account.models import EmailAddress from django.contrib.auth import get_user_model -from rest_framework.authtoken.models import Token from django.db import transaction +from rest_framework.authtoken.models import Token def create_user(username: str, password: str, email: str, verify: bool = True): diff --git a/nextcloudappstore/user/forms.py b/nextcloudappstore/user/forms.py index bbf5584e63..537ce024b0 100644 --- a/nextcloudappstore/user/forms.py +++ b/nextcloudappstore/user/forms.py @@ -1,11 +1,11 @@ from allauth.account.forms import EmailAwarePasswordResetTokenGenerator -from allauth.account.utils import filter_users_by_email, user_username, \ - user_pk_to_url_str +from allauth.account.utils import (filter_users_by_email, user_pk_to_url_str, + user_username) +from captcha.fields import CaptchaField from django import forms from django.contrib.auth import get_user_model -from django.forms import EmailField, CharField, PasswordInput +from django.forms import CharField, EmailField, PasswordInput from django.utils.translation import ugettext_lazy as _ -from captcha.fields import CaptchaField class SignupFormRecaptcha(forms.Form): diff --git a/nextcloudappstore/user/management/commands/tests/test_createuser.py b/nextcloudappstore/user/management/commands/tests/test_createuser.py index d1c785b786..efa5495cee 100644 --- a/nextcloudappstore/user/management/commands/tests/test_createuser.py +++ b/nextcloudappstore/user/management/commands/tests/test_createuser.py @@ -1,7 +1,8 @@ +from io import StringIO + from django.contrib.auth import get_user_model from django.core.management import call_command from django.test import TestCase -from io import StringIO class CreateUserCommandTest(TestCase): diff --git a/nextcloudappstore/user/management/commands/tests/test_setdefaultadminpassword.py b/nextcloudappstore/user/management/commands/tests/test_setdefaultadminpassword.py index 88aae4c0ca..a6469cec59 100644 --- a/nextcloudappstore/user/management/commands/tests/test_setdefaultadminpassword.py +++ b/nextcloudappstore/user/management/commands/tests/test_setdefaultadminpassword.py @@ -1,7 +1,8 @@ +from io import StringIO + from django.contrib.auth import get_user_model from django.core.management import call_command from django.test import TestCase -from io import StringIO class SetDefaultAdminPasswordCommandTest(TestCase): diff --git a/nextcloudappstore/user/management/commands/tests/test_setupsocial.py b/nextcloudappstore/user/management/commands/tests/test_setupsocial.py index 598562aa6e..5fcc136c6f 100644 --- a/nextcloudappstore/user/management/commands/tests/test_setupsocial.py +++ b/nextcloudappstore/user/management/commands/tests/test_setupsocial.py @@ -1,8 +1,9 @@ +from io import StringIO + from allauth.socialaccount.models import SocialApp from django.contrib.sites.models import Site from django.core.management import call_command from django.test import TestCase -from io import StringIO class SetupSocialCommandTest(TestCase): diff --git a/nextcloudappstore/user/management/commands/tests/test_updatetoken.py b/nextcloudappstore/user/management/commands/tests/test_updatetoken.py index 7aa2ee32d8..cb033e247f 100644 --- a/nextcloudappstore/user/management/commands/tests/test_updatetoken.py +++ b/nextcloudappstore/user/management/commands/tests/test_updatetoken.py @@ -1,6 +1,7 @@ +from io import StringIO + from django.core.management import call_command from django.test import TestCase -from io import StringIO from rest_framework.authtoken.models import Token from nextcloudappstore.user.facades import create_user diff --git a/nextcloudappstore/user/management/commands/tests/test_verifyemail.py b/nextcloudappstore/user/management/commands/tests/test_verifyemail.py index 9b7cb1b1a9..db45243b26 100644 --- a/nextcloudappstore/user/management/commands/tests/test_verifyemail.py +++ b/nextcloudappstore/user/management/commands/tests/test_verifyemail.py @@ -1,7 +1,8 @@ +from io import StringIO + from allauth.account.models import EmailAddress from django.core.management import call_command from django.test import TestCase -from io import StringIO from nextcloudappstore.user.facades import create_user diff --git a/nextcloudappstore/user/signals.py b/nextcloudappstore/user/signals.py index 96df9de659..aabe705170 100644 --- a/nextcloudappstore/user/signals.py +++ b/nextcloudappstore/user/signals.py @@ -1,11 +1,10 @@ from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import User +from django.core.mail import send_mail from django.db.models.signals import post_save, pre_save from django.dispatch import receiver -from django.core.mail import send_mail from django.utils.translation import gettext as _ - from rest_framework.authtoken.models import Token from nextcloudappstore.user.facades import update_token diff --git a/nextcloudappstore/user/urls.py b/nextcloudappstore/user/urls.py index 84043efcbc..d661fa1b66 100644 --- a/nextcloudappstore/user/urls.py +++ b/nextcloudappstore/user/urls.py @@ -1,9 +1,10 @@ from django.conf.urls import url -from nextcloudappstore.user.views import PasswordView, AccountView, \ - APITokenView, DeleteAccountView, ChangeLanguageView, TransferAppsView, \ - IntegrationsView from nextcloudappstore.scaffolding.views import IntegrationScaffoldingView +from nextcloudappstore.user.views import (AccountView, APITokenView, + ChangeLanguageView, DeleteAccountView, + IntegrationsView, PasswordView, + TransferAppsView) app_name = 'user' diff --git a/nextcloudappstore/user/views.py b/nextcloudappstore/user/views.py index 3e090b0b9e..7b4333a227 100644 --- a/nextcloudappstore/user/views.py +++ b/nextcloudappstore/user/views.py @@ -3,14 +3,12 @@ from allauth.account.views import PasswordChangeView from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Q -from django.urls import reverse_lazy -from django.shortcuts import redirect, render, get_object_or_404 -from django.urls import reverse -from django.views.generic import TemplateView -from django.views.generic import UpdateView +from django.shortcuts import get_object_or_404, redirect, render +from django.urls import reverse, reverse_lazy +from django.views.generic import TemplateView, UpdateView from nextcloudappstore.core.models import App -from nextcloudappstore.user.forms import DeleteAccountForm, AccountForm +from nextcloudappstore.user.forms import AccountForm, DeleteAccountForm class IntegrationsView(LoginRequiredMixin, TemplateView): diff --git a/nextcloudappstore/wsgi.py b/nextcloudappstore/wsgi.py index bb4227d1cf..0ca969647f 100644 --- a/nextcloudappstore/wsgi.py +++ b/nextcloudappstore/wsgi.py @@ -8,7 +8,7 @@ https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os -from os.path import pardir, join, dirname, abspath, realpath, isfile +from os.path import abspath, dirname, isfile, join, pardir, realpath from django.core.wsgi import get_wsgi_application diff --git a/scripts/development/proddata.py b/scripts/development/proddata.py index 90459ad515..aadbb19b56 100644 --- a/scripts/development/proddata.py +++ b/scripts/development/proddata.py @@ -5,7 +5,7 @@ import sys from requests import get -from . import import_app, ADMIN, import_release +from . import ADMIN, import_app, import_release APPS_URL = 'https://apps.nextcloud.com/api/v1/platform/%s/apps.json' diff --git a/scripts/development/testdata.py b/scripts/development/testdata.py index f8493c97c4..7b155ce1f5 100644 --- a/scripts/development/testdata.py +++ b/scripts/development/testdata.py @@ -1,4 +1,4 @@ -from . import import_app, import_release, ADMIN +from . import ADMIN, import_app, import_release twofactor_cert = """ -----BEGIN CERTIFICATE----- diff --git a/scripts/generate_authors.py b/scripts/generate_authors.py index f5f25fffa8..80785cf086 100644 --- a/scripts/generate_authors.py +++ b/scripts/generate_authors.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 -import subprocess import re -from typing import List, Dict, Tuple, Iterator - +import subprocess from os import pardir -from os.path import dirname, realpath, join +from os.path import dirname, join, realpath +from typing import Dict, Iterator, List, Tuple def get_git_authors() -> List[str]: