+pre-commit, +isort, -dependabot

Signed-off-by: bigcat88 <bigcat88@icloud.com>
This commit is contained in:
Alexander Piskun 2023-05-16 13:55:53 +03:00 коммит произвёл bigcat88
Родитель 786110cb04
Коммит 0238dde05f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 1F0BF0EC3CF22721
88 изменённых файлов: 292 добавлений и 243 удалений

10
.github/dependabot.yml поставляемый
Просмотреть файл

@ -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

45
.pre-commit-config.yaml Normal file
Просмотреть файл

@ -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

Просмотреть файл

@ -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)
* [bakkegaard](mailto:nickbakkegaard@gmail.com)

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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()]

Просмотреть файл

@ -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 <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.

Просмотреть файл

@ -65,4 +65,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

Просмотреть файл

@ -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 <https://wiki.archlinux.org/index.php/Systemd/Timers>`_

Просмотреть файл

@ -51,4 +51,3 @@ Translations are managed on `Transifex <https://www.transifex.com/nextcloud/next
All translatable languages for the App Store can be found on its `resources page <https://www.transifex.com/nextcloud/nextcloud/appstore/>`_. Select the language you want to translate and hit the **Translate** or **view strings online** button.
Translated content will be pulled daily from Transifex.

Просмотреть файл

@ -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.

Просмотреть файл

@ -1,4 +1,4 @@
from django.conf.urls import url, include
from django.conf.urls import include, url
app_name = 'api'

Просмотреть файл

@ -1,4 +1,5 @@
from django.conf import settings # type: ignore
from nextcloudappstore.core.facades import read_relative_file

Просмотреть файл

@ -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:

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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 *

Просмотреть файл

@ -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__,

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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'

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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__)

Просмотреть файл

@ -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):

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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()

Просмотреть файл

@ -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()

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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'

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from django.test import TestCase
from nextcloudappstore.core.models import App, AppRelease

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -1,5 +1,6 @@
from django.contrib.auth import get_user_model
from django.test import TestCase
from nextcloudappstore.core.models import App, AppRelease

Просмотреть файл

@ -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):

Просмотреть файл

@ -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]*)'

Просмотреть файл

@ -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

Просмотреть файл

@ -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
uses: fsfe/reuse-action@v1

Просмотреть файл

@ -6,4 +6,4 @@
/build/
node_modules/
/.php_cs.cache
js/*hot-update.*
js/*hot-update.*

Просмотреть файл

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: {{ app.author_name }} <{{ app.author_mail }}>
SPDX-License-Identifier: {{ app.license }}
SPDX-License-Identifier: {{ app.license }}

Просмотреть файл

@ -6,4 +6,4 @@
/build/
node_modules/
/.php_cs.cache
js/*hot-update.*
js/*hot-update.*

Просмотреть файл

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: {{ app.author_name }} <{{ app.author_mail }}>
SPDX-License-Identifier: {{ app.license }}
SPDX-License-Identifier: {{ app.license }}

Просмотреть файл

@ -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

Просмотреть файл

@ -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():

Просмотреть файл

@ -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):

Просмотреть файл

@ -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'

Просмотреть файл

@ -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)

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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'

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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'

Просмотреть файл

@ -1,4 +1,4 @@
from . import import_app, import_release, ADMIN
from . import ADMIN, import_app, import_release
twofactor_cert = """
-----BEGIN CERTIFICATE-----

Просмотреть файл

@ -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]: