Skip to content

Commit

Permalink
Blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
chiatt committed Aug 3, 2024
1 parent 1fa78b3 commit 318bf66
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 115 deletions.
2 changes: 1 addition & 1 deletion disco/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class DiscoConfig(AppConfig):
is_arches_application = True

def ready(self):
generate_frontend_configuration()
generate_frontend_configuration()
6 changes: 3 additions & 3 deletions disco/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
if platform.system().lower() == "windows":
os.environ.setdefault("FORKED_BY_MULTIPROCESSING", "1")

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'disco.settings')
app = Celery('disco')
app.config_from_object('django.conf:settings', namespace='CELERY')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "disco.settings")
app = Celery("disco")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()
21 changes: 14 additions & 7 deletions disco/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.conf import settings
import os


class Migration(migrations.Migration):

initial = True
Expand All @@ -22,10 +23,10 @@ def add_document_templates(apps, schema_editor):
name="Example Template",
description="This is an example template",
defaults={
"template":"document_templates/example-template.docx",
"preview":"document_templates/72cc4dcf-9500-418f-a42e-7d980937a9db_preview.pdf",
"thumbnail":"document_templates/72cc4dcf-9500-418f-a42e-7d980937a9db_thumbnail.png",
}
"template": "document_templates/example-template.docx",
"preview": "document_templates/72cc4dcf-9500-418f-a42e-7d980937a9db_preview.pdf",
"thumbnail": "document_templates/72cc4dcf-9500-418f-a42e-7d980937a9db_thumbnail.png",
},
)

file_names = (
Expand All @@ -35,13 +36,19 @@ def add_document_templates(apps, schema_editor):
)

for name in file_names:
with open(os.path.join(settings.APP_NAME, 'document_templates', name), 'rb') as template_file:
default_storage.save(os.path.join('document_templates', name), File(template_file))
with open(
os.path.join(settings.APP_NAME, "document_templates", name), "rb"
) as template_file:
default_storage.save(
os.path.join("document_templates", name), File(template_file)
)

def remove_document_templates(apps, schema_editor):
ArchesTemplate = apps.get_model("arches_templating", "ArchesTemplate")

example_template = ArchesTemplate.objects.get(templateid="72cc4dcf-9500-418f-a42e-7d980937a9db")
example_template = ArchesTemplate.objects.get(
templateid="72cc4dcf-9500-418f-a42e-7d980937a9db"
)
example_template.delete()

operations = [
Expand Down
14 changes: 12 additions & 2 deletions disco/search_indexes/sample_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@

class SampleIndex(BaseIndex):
def prepare_index(self):
self.index_metadata = {"mappings": {"properties": {"tile_count": {"type": "keyword"}, "graph_id": {"type": "keyword"}}}}
self.index_metadata = {
"mappings": {
"properties": {
"tile_count": {"type": "keyword"},
"graph_id": {"type": "keyword"},
}
}
}
super(SampleIndex, self).prepare_index()

def get_documents_to_index(self, resourceinstance, tiles):
return ({"tile_count": len(tiles), "graph_id": resourceinstance.graph_id}, str(resourceinstance.resourceinstanceid))
return (
{"tile_count": len(tiles), "graph_id": resourceinstance.graph_id},
str(resourceinstance.resourceinstanceid),
)
Loading

0 comments on commit 318bf66

Please sign in to comment.