From a3997bfb1cc6cc7d275e9954f58b643baa9ff9ce Mon Sep 17 00:00:00 2001 From: Markos Gogoulos Date: Tue, 14 Mar 2023 14:09:52 +0200 Subject: [PATCH] update versions for pre-commit (#741) --- .github/workflows/pre-commit.yml | 17 +++++++++++++++++ .pre-commit-config.yaml | 6 +++--- actions/migrations/0001_initial.py | 1 - actions/migrations/0002_mediaaction_media.py | 1 - actions/migrations/0003_auto_20201201_0712.py | 1 - cms/custom_pagination.py | 1 - files/feeds.py | 2 +- files/methods.py | 1 - files/migrations/0001_initial.py | 1 - files/migrations/0002_auto_20201201_0712.py | 1 - files/migrations/0003_auto_20210927_1245.py | 1 - files/models.py | 4 ---- files/tasks.py | 1 - users/migrations/0001_initial.py | 1 - users/views.py | 1 - 15 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..a8850e5 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit + +on: + pull_request: + push: + branches: + - main + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f971259..ff66faa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,15 @@ repos: - repo: https://github.com/pycqa/flake8 - rev: 3.7.9 + rev: 6.0.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort - rev: 5.5.4 + rev: 5.12.0 hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.1.0 hooks: - id: black language_version: python3 diff --git a/actions/migrations/0001_initial.py b/actions/migrations/0001_initial.py index 4f6a65d..2f93ac1 100644 --- a/actions/migrations/0001_initial.py +++ b/actions/migrations/0001_initial.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/actions/migrations/0002_mediaaction_media.py b/actions/migrations/0002_mediaaction_media.py index 7e12bc7..d0dd73f 100644 --- a/actions/migrations/0002_mediaaction_media.py +++ b/actions/migrations/0002_mediaaction_media.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/actions/migrations/0003_auto_20201201_0712.py b/actions/migrations/0003_auto_20201201_0712.py index 596a010..826da4a 100644 --- a/actions/migrations/0003_auto_20201201_0712.py +++ b/actions/migrations/0003_auto_20201201_0712.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/cms/custom_pagination.py b/cms/custom_pagination.py index 792ca40..cde5e4e 100644 --- a/cms/custom_pagination.py +++ b/cms/custom_pagination.py @@ -18,7 +18,6 @@ class FastPaginationWithoutCount(PageNumberPagination): django_paginator_class = FasterDjangoPaginator def get_paginated_response(self, data): - return Response( OrderedDict( [ diff --git a/files/feeds.py b/files/feeds.py index 60ca575..62cff1e 100644 --- a/files/feeds.py +++ b/files/feeds.py @@ -102,7 +102,7 @@ class SearchRSSFeed(Feed): description = "Latest Media RSS feed" def link(self, obj): - return f"/rss/search" + return "/rss/search" def get_object(self, request): category = request.GET.get("c", "") diff --git a/files/methods.py b/files/methods.py index 60c599d..2ea207f 100644 --- a/files/methods.py +++ b/files/methods.py @@ -305,7 +305,6 @@ def show_related_media_author(media, request, limit): def show_related_media_calculated(media, request, limit): - """Return a list of related media based on ML recommendations A big todo! """ diff --git a/files/migrations/0001_initial.py b/files/migrations/0001_initial.py index 3e9f82a..7f0963b 100644 --- a/files/migrations/0001_initial.py +++ b/files/migrations/0001_initial.py @@ -10,7 +10,6 @@ import files.models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/files/migrations/0002_auto_20201201_0712.py b/files/migrations/0002_auto_20201201_0712.py index 1a2310a..5f072c5 100644 --- a/files/migrations/0002_auto_20201201_0712.py +++ b/files/migrations/0002_auto_20201201_0712.py @@ -8,7 +8,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/files/migrations/0003_auto_20210927_1245.py b/files/migrations/0003_auto_20210927_1245.py index d0fd13c..8af6a98 100644 --- a/files/migrations/0003_auto_20210927_1245.py +++ b/files/migrations/0003_auto_20210927_1245.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('files', '0002_auto_20201201_0712'), ] diff --git a/files/models.py b/files/models.py index 52c833c..acd38ce 100644 --- a/files/models.py +++ b/files/models.py @@ -314,7 +314,6 @@ class Media(models.Model): self.__original_uploaded_poster = self.uploaded_poster def save(self, *args, **kwargs): - if not self.title: self.title = self.media_file.path.split("/")[-1] @@ -372,7 +371,6 @@ class Media(models.Model): # will run only when a poster is uploaded for the first time if self.uploaded_poster and self.uploaded_poster != self.__original_uploaded_poster: with open(self.uploaded_poster.path, "rb") as f: - # set this otherwise gets to infinite loop self.__original_uploaded_poster = self.uploaded_poster @@ -580,9 +578,7 @@ class Media(models.Model): # attempt to break media file in chunks if self.duration > settings.CHUNKIZE_VIDEO_DURATION and chunkize: - for profile in profiles: - if profile.extension == "gif": profiles.remove(profile) encoding = Encoding(media=self, profile=profile) diff --git a/files/tasks.py b/files/tasks.py index ab649c0..005fc80 100644 --- a/files/tasks.py +++ b/files/tasks.py @@ -268,7 +268,6 @@ def encode_media( # return False with tempfile.TemporaryDirectory(dir=settings.TEMP_DIRECTORY) as temp_dir: - tf = create_temp_file(suffix=".{0}".format(profile.extension), dir=temp_dir) tfpass = create_temp_file(suffix=".{0}".format(profile.extension), dir=temp_dir) ffmpeg_commands = produce_ffmpeg_commands( diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py index e5f5238..eaa8421 100644 --- a/users/migrations/0001_initial.py +++ b/users/migrations/0001_initial.py @@ -10,7 +10,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/users/views.py b/users/views.py index dcf9b31..acf1425 100644 --- a/users/views.py +++ b/users/views.py @@ -176,7 +176,6 @@ Sender email: %s\n class UserList(APIView): - permission_classes = (permissions.IsAuthenticatedOrReadOnly,) parser_classes = (JSONParser, MultiPartParser, FormParser, FileUploadParser)