Skip to content

Commit

Permalink
Please the linter
Browse files Browse the repository at this point in the history
For #229
  • Loading branch information
philgyford committed Feb 14, 2022
1 parent c7cd4ef commit 6aca66d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 23 deletions.
40 changes: 35 additions & 5 deletions ditto/twitter/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ class AccountAdmin(admin.ModelAdmin):
)

fieldsets = (
(None, {"fields": ("user", "is_active",)}),
(
None,
{
"fields": (
"user",
"is_active",
)
},
),
(
"API",
{
Expand All @@ -29,7 +37,8 @@ class AccountAdmin(admin.ModelAdmin):
),
"description": (
"Keys and secrets require creation of an app at "
'<a href="https://developer.twitter.com/portal">developer.twitter.com/portal</a>'
'<a href="https://developer.twitter.com/portal">'
"developer.twitter.com/portal</a>"
),
},
),
Expand Down Expand Up @@ -123,7 +132,13 @@ class MediaAdmin(admin.ModelAdmin):
),
(
"Data",
{"classes": ("collapse",), "fields": ("time_created", "time_modified",)},
{
"classes": ("collapse",),
"fields": (
"time_created",
"time_modified",
),
},
),
)

Expand Down Expand Up @@ -240,7 +255,12 @@ class TweetAdmin(DittoItemModelAdmin):
"Data",
{
"classes": ("collapse",),
"fields": ("raw", "fetch_time", "time_created", "time_modified",),
"fields": (
"raw",
"fetch_time",
"time_created",
"time_modified",
),
},
),
)
Expand Down Expand Up @@ -309,7 +329,17 @@ class UserAdmin(admin.ModelAdmin):
)
},
),
("Data", {"fields": ("raw", "fetch_time", "time_created", "time_modified",)}),
(
"Data",
{
"fields": (
"raw",
"fetch_time",
"time_created",
"time_modified",
)
},
),
)

formfield_overrides = {
Expand Down
5 changes: 3 additions & 2 deletions ditto/twitter/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ def _save_media(self, directory):
media_obj.media_type != "video"
and media_obj.has_file is False
):
# We don't save video files - only image files, and mp4s for # GIFs - and only want to do this if we don't already have a
# file.
# We don't save video files - only image files, and mp4s
# for # GIFs - and only want to do this if we don't already
# have a file.

if (
media_obj.media_type == "animated_gif"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@
class Migration(migrations.Migration):

dependencies = [
('twitter', '0056_add_count_index'),
("twitter", "0056_add_count_index"),
]

operations = [
migrations.AlterField(
model_name='account',
name='access_token',
field=models.CharField(blank=True, max_length=255, verbose_name='Access Token'),
model_name="account",
name="access_token",
field=models.CharField(
blank=True, max_length=255, verbose_name="Access Token"
),
),
migrations.AlterField(
model_name='account',
name='access_token_secret',
field=models.CharField(blank=True, max_length=255, verbose_name='Access Token Secret'),
model_name="account",
name="access_token_secret",
field=models.CharField(
blank=True, max_length=255, verbose_name="Access Token Secret"
),
),
migrations.AlterField(
model_name='account',
name='consumer_key',
field=models.CharField(blank=True, max_length=255, verbose_name='API Key'),
model_name="account",
name="consumer_key",
field=models.CharField(blank=True, max_length=255, verbose_name="API Key"),
),
migrations.AlterField(
model_name='account',
name='consumer_secret',
field=models.CharField(blank=True, max_length=255, verbose_name='API Key Secret'),
model_name="account",
name="consumer_secret",
field=models.CharField(
blank=True, max_length=255, verbose_name="API Key Secret"
),
),
]
4 changes: 1 addition & 3 deletions tests/twitter/test_ingest_v2.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import json
import os
from unittest.mock import call, mock_open, patch

from django.test import TestCase

from ditto.twitter import factories
from ditto.twitter.ingest import IngestError, Version2TweetIngester
from ditto.twitter.ingest import Version2TweetIngester
from ditto.twitter.models import Tweet, User


Expand Down

0 comments on commit 6aca66d

Please sign in to comment.