update versions for pre-commit (#741)

This commit is contained in:
Markos Gogoulos 2023-03-14 14:09:52 +02:00 committed by GitHub
parent 4b0718c43f
commit a3997bfb1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 21 additions and 19 deletions

17
.github/workflows/pre-commit.yml vendored Normal file
View File

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

View File

@ -1,15 +1,15 @@
repos: repos:
- repo: https://github.com/pycqa/flake8 - repo: https://github.com/pycqa/flake8
rev: 3.7.9 rev: 6.0.0
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.5.4 rev: 5.12.0
hooks: hooks:
- id: isort - id: isort
args: ["--profile", "black"] args: ["--profile", "black"]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.3.0 rev: 23.1.0
hooks: hooks:
- id: black - id: black
language_version: python3 language_version: python3

View File

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [] dependencies = []

View File

@ -5,7 +5,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [

View File

@ -18,7 +18,6 @@ class FastPaginationWithoutCount(PageNumberPagination):
django_paginator_class = FasterDjangoPaginator django_paginator_class = FasterDjangoPaginator
def get_paginated_response(self, data): def get_paginated_response(self, data):
return Response( return Response(
OrderedDict( OrderedDict(
[ [

View File

@ -102,7 +102,7 @@ class SearchRSSFeed(Feed):
description = "Latest Media RSS feed" description = "Latest Media RSS feed"
def link(self, obj): def link(self, obj):
return f"/rss/search" return "/rss/search"
def get_object(self, request): def get_object(self, request):
category = request.GET.get("c", "") category = request.GET.get("c", "")

View File

@ -305,7 +305,6 @@ def show_related_media_author(media, request, limit):
def show_related_media_calculated(media, request, limit): def show_related_media_calculated(media, request, limit):
"""Return a list of related media based on ML recommendations """Return a list of related media based on ML recommendations
A big todo! A big todo!
""" """

View File

@ -10,7 +10,6 @@ import files.models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [] dependencies = []

View File

@ -8,7 +8,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [

View File

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('files', '0002_auto_20201201_0712'), ('files', '0002_auto_20201201_0712'),
] ]

View File

@ -314,7 +314,6 @@ class Media(models.Model):
self.__original_uploaded_poster = self.uploaded_poster self.__original_uploaded_poster = self.uploaded_poster
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.title: if not self.title:
self.title = self.media_file.path.split("/")[-1] 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 # will run only when a poster is uploaded for the first time
if self.uploaded_poster and self.uploaded_poster != self.__original_uploaded_poster: if self.uploaded_poster and self.uploaded_poster != self.__original_uploaded_poster:
with open(self.uploaded_poster.path, "rb") as f: with open(self.uploaded_poster.path, "rb") as f:
# set this otherwise gets to infinite loop # set this otherwise gets to infinite loop
self.__original_uploaded_poster = self.uploaded_poster self.__original_uploaded_poster = self.uploaded_poster
@ -580,9 +578,7 @@ class Media(models.Model):
# attempt to break media file in chunks # attempt to break media file in chunks
if self.duration > settings.CHUNKIZE_VIDEO_DURATION and chunkize: if self.duration > settings.CHUNKIZE_VIDEO_DURATION and chunkize:
for profile in profiles: for profile in profiles:
if profile.extension == "gif": if profile.extension == "gif":
profiles.remove(profile) profiles.remove(profile)
encoding = Encoding(media=self, profile=profile) encoding = Encoding(media=self, profile=profile)

View File

@ -268,7 +268,6 @@ def encode_media(
# return False # return False
with tempfile.TemporaryDirectory(dir=settings.TEMP_DIRECTORY) as temp_dir: with tempfile.TemporaryDirectory(dir=settings.TEMP_DIRECTORY) as temp_dir:
tf = create_temp_file(suffix=".{0}".format(profile.extension), dir=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) tfpass = create_temp_file(suffix=".{0}".format(profile.extension), dir=temp_dir)
ffmpeg_commands = produce_ffmpeg_commands( ffmpeg_commands = produce_ffmpeg_commands(

View File

@ -10,7 +10,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [

View File

@ -176,7 +176,6 @@ Sender email: %s\n
class UserList(APIView): class UserList(APIView):
permission_classes = (permissions.IsAuthenticatedOrReadOnly,) permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
parser_classes = (JSONParser, MultiPartParser, FormParser, FileUploadParser) parser_classes = (JSONParser, MultiPartParser, FormParser, FileUploadParser)