New version of black, new whitespace
This commit is contained in:
@ -6,7 +6,7 @@ from bookwyrm import models
|
||||
|
||||
|
||||
def update_related(canonical, obj):
|
||||
""" update all the models with fk to the object being removed """
|
||||
"""update all the models with fk to the object being removed"""
|
||||
# move related models to canonical
|
||||
related_models = [
|
||||
(r.remote_field.name, r.related_model) for r in canonical._meta.related_objects
|
||||
@ -24,7 +24,7 @@ def update_related(canonical, obj):
|
||||
|
||||
|
||||
def copy_data(canonical, obj):
|
||||
""" try to get the most data possible """
|
||||
"""try to get the most data possible"""
|
||||
for data_field in obj._meta.get_fields():
|
||||
if not hasattr(data_field, "activitypub_field"):
|
||||
continue
|
||||
@ -38,7 +38,7 @@ def copy_data(canonical, obj):
|
||||
|
||||
|
||||
def dedupe_model(model):
|
||||
""" combine duplicate editions and update related models """
|
||||
"""combine duplicate editions and update related models"""
|
||||
fields = model._meta.get_fields()
|
||||
dedupe_fields = [
|
||||
f for f in fields if hasattr(f, "deduplication_field") and f.deduplication_field
|
||||
@ -68,12 +68,12 @@ def dedupe_model(model):
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
""" dedplucate allllll the book data models """
|
||||
"""dedplucate allllll the book data models"""
|
||||
|
||||
help = "merges duplicate book data"
|
||||
# pylint: disable=no-self-use,unused-argument
|
||||
def handle(self, *args, **options):
|
||||
""" run deudplications """
|
||||
"""run deudplications"""
|
||||
dedupe_model(models.Edition)
|
||||
dedupe_model(models.Work)
|
||||
dedupe_model(models.Author)
|
||||
|
@ -10,15 +10,15 @@ r = redis.Redis(
|
||||
|
||||
|
||||
def erase_streams():
|
||||
""" throw the whole redis away """
|
||||
"""throw the whole redis away"""
|
||||
r.flushall()
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
""" delete activity streams for all users """
|
||||
"""delete activity streams for all users"""
|
||||
|
||||
help = "Delete all the user streams"
|
||||
# pylint: disable=no-self-use,unused-argument
|
||||
def handle(self, *args, **options):
|
||||
""" flush all, baby """
|
||||
"""flush all, baby"""
|
||||
erase_streams()
|
||||
|
@ -108,7 +108,7 @@ def init_connectors():
|
||||
|
||||
|
||||
def init_federated_servers():
|
||||
""" big no to nazis """
|
||||
"""big no to nazis"""
|
||||
built_in_blocks = ["gab.ai", "gab.com"]
|
||||
for server in built_in_blocks:
|
||||
FederatedServer.objects.create(
|
||||
|
@ -10,7 +10,7 @@ r = redis.Redis(
|
||||
|
||||
|
||||
def populate_streams():
|
||||
""" build all the streams for all the users """
|
||||
"""build all the streams for all the users"""
|
||||
users = models.User.objects.filter(
|
||||
local=True,
|
||||
is_active=True,
|
||||
@ -21,10 +21,10 @@ def populate_streams():
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
""" start all over with user streams """
|
||||
"""start all over with user streams"""
|
||||
|
||||
help = "Populate streams for all users"
|
||||
# pylint: disable=no-self-use,unused-argument
|
||||
def handle(self, *args, **options):
|
||||
""" run feed builder """
|
||||
"""run feed builder"""
|
||||
populate_streams()
|
||||
|
@ -5,7 +5,7 @@ from bookwyrm import models
|
||||
|
||||
|
||||
def remove_editions():
|
||||
""" combine duplicate editions and update related models """
|
||||
"""combine duplicate editions and update related models"""
|
||||
# not in use
|
||||
filters = {
|
||||
"%s__isnull" % r.name: True for r in models.Edition._meta.related_objects
|
||||
@ -33,10 +33,10 @@ def remove_editions():
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
""" dedplucate allllll the book data models """
|
||||
"""dedplucate allllll the book data models"""
|
||||
|
||||
help = "merges duplicate book data"
|
||||
# pylint: disable=no-self-use,unused-argument
|
||||
def handle(self, *args, **options):
|
||||
""" run deudplications """
|
||||
"""run deudplications"""
|
||||
remove_editions()
|
||||
|
Reference in New Issue
Block a user