From fd6b19d3595b8c3474cdaf7308ea8216f401857e Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Tue, 21 Nov 2023 12:18:56 +0000 Subject: [PATCH] Apply ruff format --- stringprint2/charts/chart_config.py | 2 -- stringprint2/charts/display.py | 2 -- stringprint2/frontend/forms.py | 5 ----- stringprint2/frontend/migrations/0001_initial.py | 1 - stringprint2/frontend/migrations/0002_download.py | 1 - .../frontend/migrations/0003_usersettings_tokens.py | 1 - stringprint2/frontend/migrations/0004_tokensetting.py | 1 - .../frontend/migrations/0005_auto_20190502_0952.py | 1 - stringprint2/frontend/views.py | 10 ---------- stringprint2/proj/settings.py | 1 - stringprint2/stringprint/migrations/0001_initial.py | 1 - .../migrations/0002_headerimage_image_vertical.py | 1 - .../stringprint/migrations/0003_access_password.py | 1 - .../stringprint/migrations/0004_article_public.py | 1 - .../stringprint/migrations/0005_auto_20160802_1028.py | 1 - .../stringprint/migrations/0006_asset_alt_text.py | 1 - .../stringprint/migrations/0007_asset_image_chart.py | 1 - .../stringprint/migrations/0008_auto_20160804_1141.py | 1 - .../stringprint/migrations/0009_auto_20160804_1154.py | 1 - .../migrations/0010_article_first_section_name.py | 1 - .../stringprint/migrations/0011_asset_caption.py | 1 - .../stringprint/migrations/0012_auto_20160822_1553.py | 1 - .../stringprint/migrations/0013_auto_20160829_1340.py | 1 - .../stringprint/migrations/0014_auto_20160829_1424.py | 1 - .../migrations/0015_organisation_publish_root.py | 1 - .../stringprint/migrations/0016_auto_20160830_1419.py | 1 - .../migrations/0017_article_publish_tokens.py | 1 - .../stringprint/migrations/0018_auto_20160831_0903.py | 1 - .../migrations/0019_article_pdf_location.py | 1 - .../stringprint/migrations/0020_auto_20170727_1133.py | 1 - .../0021_article_display_footnotes_at_foot.py | 1 - .../stringprint/migrations/0022_auto_20180615_1527.py | 1 - .../stringprint/migrations/0023_auto_20180707_1114.py | 1 - .../stringprint/migrations/0024_auto_20190322_1324.py | 1 - .../stringprint/migrations/0025_auto_20190424_1555.py | 1 - .../stringprint/migrations/0026_auto_20190502_0952.py | 1 - .../stringprint/migrations/0027_auto_20190502_1009.py | 1 - .../stringprint/migrations/0028_auto_20191001_1856.py | 1 - .../migrations/0029_version_paragraph_links.py | 1 - .../migrations/0030_organisation_ga_cookies.py | 1 - .../stringprint/migrations/0031_auto_20191007_1529.py | 1 - .../migrations/0032_article_include_citation.py | 1 - .../stringprint/migrations/0033_asset_size.py | 1 - .../stringprint/migrations/0034_asset_no_header.py | 1 - .../migrations/0035_article_display_toc.py | 1 - .../stringprint/migrations/0036_article_pdf_file.py | 1 - .../stringprint/migrations/0037_article_subtitle.py | 1 - .../migrations/0038_article_preprocessor.py | 1 - .../stringprint/migrations/0039_auto_20200727_0838.py | 1 - .../migrations/0040_organisation_default_values.py | 1 - .../stringprint/migrations/0041_auto_20200906_1326.py | 1 - stringprint2/stringprint/models.py | 11 ----------- stringprint2/stringprint/templatetags/extra_tags.py | 5 ----- stringprint2/stringprint/tools/charts.py | 2 -- stringprint2/stringprint/tools/deepink.py | 9 --------- stringprint2/stringprint/tools/footnote_convert.py | 1 - stringprint2/stringprint/tools/google_download.py | 2 -- stringprint2/stringprint/tools/preprocessing.py | 2 -- stringprint2/stringprint/tools/serial.py | 2 -- stringprint2/stringprint/tools/word_convert.py | 2 -- stringprint2/stringprint/views.py | 6 ------ 61 files changed, 108 deletions(-) diff --git a/stringprint2/charts/chart_config.py b/stringprint2/charts/chart_config.py index a7f8e2c..6864285 100644 --- a/stringprint2/charts/chart_config.py +++ b/stringprint2/charts/chart_config.py @@ -8,13 +8,11 @@ class ChartType(SerialBase): - registered = {} def __init__( self, chart_type, code_template, package_name="corechart", options=None ): - self.chart_type = chart_type self.package_name = package_name self.code_template = code_template diff --git a/stringprint2/charts/display.py b/stringprint2/charts/display.py index 5ca3a00..5a79dde 100644 --- a/stringprint2/charts/display.py +++ b/stringprint2/charts/display.py @@ -29,7 +29,6 @@ class ChartCollection(object): """ def __init__(self, charts: List[Any]) -> None: - if RENDER_TABLES_AS_CHARTS is False: charts = [x for x in charts if x.chart_type != "table_chart"] self.charts = charts @@ -110,7 +109,6 @@ class Chart(SerialObject): """ def __init__(self, name="", file_name="", chart_type="line_chart"): - self.chart_type = chart_type self.name = name self.filename = file_name diff --git a/stringprint2/frontend/forms.py b/stringprint2/frontend/forms.py index 92e4d01..7f03cf7 100644 --- a/stringprint2/frontend/forms.py +++ b/stringprint2/frontend/forms.py @@ -33,7 +33,6 @@ def render(self, name, value, attrs=None): class PageHeaderImageForm(forms.ModelForm): - image = forms.ImageField(label="Image", widget=AdminImageWidget, required=False) image_vertical = forms.ImageField( label="Responsive Image", @@ -85,7 +84,6 @@ class Meta: class ArticlePublishForm(forms.Form): - publish_url = forms.CharField( label="Final URL", help_text="Where will this document be visible on the web? (used for social sharing).", @@ -181,7 +179,6 @@ def validate_file_extension(value): class ReuploadWordForm(HoneyPotForm): - file = forms.FileField( label="Upload a Word file (optional)", required=False, @@ -190,7 +187,6 @@ class ReuploadWordForm(HoneyPotForm): class NewDocumentForm(HoneyPotForm): - title = forms.CharField( label="Document Title", help_text="Don't worry, this can be changed later." ) @@ -223,5 +219,4 @@ def is_valid(self): else: return True else: - return False diff --git a/stringprint2/frontend/migrations/0001_initial.py b/stringprint2/frontend/migrations/0001_initial.py index 07e564a..8d429ac 100644 --- a/stringprint2/frontend/migrations/0001_initial.py +++ b/stringprint2/frontend/migrations/0001_initial.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("stringprint", "0012_auto_20160822_1553"), diff --git a/stringprint2/frontend/migrations/0002_download.py b/stringprint2/frontend/migrations/0002_download.py index f99fadb..92ea5e2 100644 --- a/stringprint2/frontend/migrations/0002_download.py +++ b/stringprint2/frontend/migrations/0002_download.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0013_auto_20160829_1340"), ("frontend", "0001_initial"), diff --git a/stringprint2/frontend/migrations/0003_usersettings_tokens.py b/stringprint2/frontend/migrations/0003_usersettings_tokens.py index 27f9bcf..80c6e90 100644 --- a/stringprint2/frontend/migrations/0003_usersettings_tokens.py +++ b/stringprint2/frontend/migrations/0003_usersettings_tokens.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("frontend", "0002_download"), ] diff --git a/stringprint2/frontend/migrations/0004_tokensetting.py b/stringprint2/frontend/migrations/0004_tokensetting.py index 70cbe78..961e827 100644 --- a/stringprint2/frontend/migrations/0004_tokensetting.py +++ b/stringprint2/frontend/migrations/0004_tokensetting.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("frontend", "0003_usersettings_tokens"), ] diff --git a/stringprint2/frontend/migrations/0005_auto_20190502_0952.py b/stringprint2/frontend/migrations/0005_auto_20190502_0952.py index 45a58c5..567b517 100644 --- a/stringprint2/frontend/migrations/0005_auto_20190502_0952.py +++ b/stringprint2/frontend/migrations/0005_auto_20190502_0952.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("frontend", "0004_tokensetting"), ] diff --git a/stringprint2/frontend/views.py b/stringprint2/frontend/views.py index 879565b..d605b75 100644 --- a/stringprint2/frontend/views.py +++ b/stringprint2/frontend/views.py @@ -126,7 +126,6 @@ class ArticleHeadersView(ArticleEditBase, LoggedInView): url_name = "article.headers" def logic(self): - header = self.article.images.filter(title_image=True) if header.exists(): instance = header[0] @@ -241,14 +240,12 @@ def logic(self): class ArticleSettingsView(ArticleEditBase, LoggedInView): - template = "frontend//document_settings.html" url_patterns = [r"^document/([0-9]*)/settings/"] url_name = "article.settings" form = ff.ArticleEditForm def logic(self): - if self.request.POST: form = self.form(self.request.POST, instance=self.article) if form.is_valid(): @@ -289,13 +286,11 @@ def logic(self): class RegisterView(ComboView): - template = "registration//register.html" url_patterns = [r"^register/"] url_name = "register" def view(self, request): - if request.POST: form = ff.RegisterForm(request.POST) if form.is_valid(): @@ -324,7 +319,6 @@ def view(self, request): class NewDocView(LoggedInView): - template = "frontend//new_doc.html" url_patterns = [r"^document/new"] url_name = "document.new" @@ -377,7 +371,6 @@ def short_title(v): class ReuploadFormView(ArticleEditBase, LoggedInView): - template = "frontend//doc_reupload.html" url_patterns = [r"^document/([0-9]*)/reupload"] url_name = "document.reupload" @@ -407,7 +400,6 @@ def new_doc_form_logic(self): class ChangeOrgView(NewDocView): - url_patterns = [r"^orgs/change/(.*)"] url_name = "org.change" args = ("org_id",) @@ -419,7 +411,6 @@ def logic(self): class HomeView(NewDocView): - template = "frontend//home.html" url_patterns = [r"^"] url_name = "home" @@ -432,7 +423,6 @@ def logic(self): class DocListView(HomeView): - template = "frontend//doc_list.html" url_patterns = [r"^documents/list", r"^documents/list/(.*)"] url_name = "document.list" diff --git a/stringprint2/proj/settings.py b/stringprint2/proj/settings.py index 15f4b01..3107482 100644 --- a/stringprint2/proj/settings.py +++ b/stringprint2/proj/settings.py @@ -133,7 +133,6 @@ # https://docs.djangoproject.com/en/1.7/ref/settings/#databases if DEBUG: - CACHES = { "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", diff --git a/stringprint2/stringprint/migrations/0001_initial.py b/stringprint2/stringprint/migrations/0001_initial.py index c04252c..7c807bc 100644 --- a/stringprint2/stringprint/migrations/0001_initial.py +++ b/stringprint2/stringprint/migrations/0001_initial.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] diff --git a/stringprint2/stringprint/migrations/0002_headerimage_image_vertical.py b/stringprint2/stringprint/migrations/0002_headerimage_image_vertical.py index 51978b7..2e230ea 100644 --- a/stringprint2/stringprint/migrations/0002_headerimage_image_vertical.py +++ b/stringprint2/stringprint/migrations/0002_headerimage_image_vertical.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0001_initial"), ] diff --git a/stringprint2/stringprint/migrations/0003_access_password.py b/stringprint2/stringprint/migrations/0003_access_password.py index ee1f92f..358a537 100644 --- a/stringprint2/stringprint/migrations/0003_access_password.py +++ b/stringprint2/stringprint/migrations/0003_access_password.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0002_headerimage_image_vertical"), ] diff --git a/stringprint2/stringprint/migrations/0004_article_public.py b/stringprint2/stringprint/migrations/0004_article_public.py index 3a4bd63..d5cda26 100644 --- a/stringprint2/stringprint/migrations/0004_article_public.py +++ b/stringprint2/stringprint/migrations/0004_article_public.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0003_access_password"), ] diff --git a/stringprint2/stringprint/migrations/0005_auto_20160802_1028.py b/stringprint2/stringprint/migrations/0005_auto_20160802_1028.py index 436e41d..80b0ffa 100644 --- a/stringprint2/stringprint/migrations/0005_auto_20160802_1028.py +++ b/stringprint2/stringprint/migrations/0005_auto_20160802_1028.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0004_article_public"), ] diff --git a/stringprint2/stringprint/migrations/0006_asset_alt_text.py b/stringprint2/stringprint/migrations/0006_asset_alt_text.py index 5a78740..c8cd4a5 100644 --- a/stringprint2/stringprint/migrations/0006_asset_alt_text.py +++ b/stringprint2/stringprint/migrations/0006_asset_alt_text.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0005_auto_20160802_1028"), ] diff --git a/stringprint2/stringprint/migrations/0007_asset_image_chart.py b/stringprint2/stringprint/migrations/0007_asset_image_chart.py index e6a8183..30306b9 100644 --- a/stringprint2/stringprint/migrations/0007_asset_image_chart.py +++ b/stringprint2/stringprint/migrations/0007_asset_image_chart.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0006_asset_alt_text"), ] diff --git a/stringprint2/stringprint/migrations/0008_auto_20160804_1141.py b/stringprint2/stringprint/migrations/0008_auto_20160804_1141.py index 8f211aa..6df34b2 100644 --- a/stringprint2/stringprint/migrations/0008_auto_20160804_1141.py +++ b/stringprint2/stringprint/migrations/0008_auto_20160804_1141.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0007_asset_image_chart"), ] diff --git a/stringprint2/stringprint/migrations/0009_auto_20160804_1154.py b/stringprint2/stringprint/migrations/0009_auto_20160804_1154.py index 4615b09..7e94899 100644 --- a/stringprint2/stringprint/migrations/0009_auto_20160804_1154.py +++ b/stringprint2/stringprint/migrations/0009_auto_20160804_1154.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0008_auto_20160804_1141"), ] diff --git a/stringprint2/stringprint/migrations/0010_article_first_section_name.py b/stringprint2/stringprint/migrations/0010_article_first_section_name.py index 23231cd..e671424 100644 --- a/stringprint2/stringprint/migrations/0010_article_first_section_name.py +++ b/stringprint2/stringprint/migrations/0010_article_first_section_name.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0009_auto_20160804_1154"), ] diff --git a/stringprint2/stringprint/migrations/0011_asset_caption.py b/stringprint2/stringprint/migrations/0011_asset_caption.py index 5fef247..3b7881f 100644 --- a/stringprint2/stringprint/migrations/0011_asset_caption.py +++ b/stringprint2/stringprint/migrations/0011_asset_caption.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0010_article_first_section_name"), ] diff --git a/stringprint2/stringprint/migrations/0012_auto_20160822_1553.py b/stringprint2/stringprint/migrations/0012_auto_20160822_1553.py index 9012ff4..d9031b2 100644 --- a/stringprint2/stringprint/migrations/0012_auto_20160822_1553.py +++ b/stringprint2/stringprint/migrations/0012_auto_20160822_1553.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0011_asset_caption"), ] diff --git a/stringprint2/stringprint/migrations/0013_auto_20160829_1340.py b/stringprint2/stringprint/migrations/0013_auto_20160829_1340.py index fd37041..dca6264 100644 --- a/stringprint2/stringprint/migrations/0013_auto_20160829_1340.py +++ b/stringprint2/stringprint/migrations/0013_auto_20160829_1340.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0012_auto_20160822_1553"), ] diff --git a/stringprint2/stringprint/migrations/0014_auto_20160829_1424.py b/stringprint2/stringprint/migrations/0014_auto_20160829_1424.py index a244a80..5350ebc 100644 --- a/stringprint2/stringprint/migrations/0014_auto_20160829_1424.py +++ b/stringprint2/stringprint/migrations/0014_auto_20160829_1424.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0013_auto_20160829_1340"), ] diff --git a/stringprint2/stringprint/migrations/0015_organisation_publish_root.py b/stringprint2/stringprint/migrations/0015_organisation_publish_root.py index 1436dcc..5816d87 100644 --- a/stringprint2/stringprint/migrations/0015_organisation_publish_root.py +++ b/stringprint2/stringprint/migrations/0015_organisation_publish_root.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0014_auto_20160829_1424"), ] diff --git a/stringprint2/stringprint/migrations/0016_auto_20160830_1419.py b/stringprint2/stringprint/migrations/0016_auto_20160830_1419.py index e781237..7a640f7 100644 --- a/stringprint2/stringprint/migrations/0016_auto_20160830_1419.py +++ b/stringprint2/stringprint/migrations/0016_auto_20160830_1419.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0015_organisation_publish_root"), ] diff --git a/stringprint2/stringprint/migrations/0017_article_publish_tokens.py b/stringprint2/stringprint/migrations/0017_article_publish_tokens.py index de79d35..6f03250 100644 --- a/stringprint2/stringprint/migrations/0017_article_publish_tokens.py +++ b/stringprint2/stringprint/migrations/0017_article_publish_tokens.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0016_auto_20160830_1419"), ] diff --git a/stringprint2/stringprint/migrations/0018_auto_20160831_0903.py b/stringprint2/stringprint/migrations/0018_auto_20160831_0903.py index f2878fd..80efe70 100644 --- a/stringprint2/stringprint/migrations/0018_auto_20160831_0903.py +++ b/stringprint2/stringprint/migrations/0018_auto_20160831_0903.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0017_article_publish_tokens"), ] diff --git a/stringprint2/stringprint/migrations/0019_article_pdf_location.py b/stringprint2/stringprint/migrations/0019_article_pdf_location.py index fbefe4d..cbb6082 100644 --- a/stringprint2/stringprint/migrations/0019_article_pdf_location.py +++ b/stringprint2/stringprint/migrations/0019_article_pdf_location.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0018_auto_20160831_0903"), ] diff --git a/stringprint2/stringprint/migrations/0020_auto_20170727_1133.py b/stringprint2/stringprint/migrations/0020_auto_20170727_1133.py index 170d43c..82478fb 100644 --- a/stringprint2/stringprint/migrations/0020_auto_20170727_1133.py +++ b/stringprint2/stringprint/migrations/0020_auto_20170727_1133.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0019_article_pdf_location"), ] diff --git a/stringprint2/stringprint/migrations/0021_article_display_footnotes_at_foot.py b/stringprint2/stringprint/migrations/0021_article_display_footnotes_at_foot.py index 3b94daf..0aca42d 100644 --- a/stringprint2/stringprint/migrations/0021_article_display_footnotes_at_foot.py +++ b/stringprint2/stringprint/migrations/0021_article_display_footnotes_at_foot.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0020_auto_20170727_1133"), ] diff --git a/stringprint2/stringprint/migrations/0022_auto_20180615_1527.py b/stringprint2/stringprint/migrations/0022_auto_20180615_1527.py index 5a6ef70..b0c3423 100644 --- a/stringprint2/stringprint/migrations/0022_auto_20180615_1527.py +++ b/stringprint2/stringprint/migrations/0022_auto_20180615_1527.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0021_article_display_footnotes_at_foot"), ] diff --git a/stringprint2/stringprint/migrations/0023_auto_20180707_1114.py b/stringprint2/stringprint/migrations/0023_auto_20180707_1114.py index 5119619..4289f95 100644 --- a/stringprint2/stringprint/migrations/0023_auto_20180707_1114.py +++ b/stringprint2/stringprint/migrations/0023_auto_20180707_1114.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0022_auto_20180615_1527"), ] diff --git a/stringprint2/stringprint/migrations/0024_auto_20190322_1324.py b/stringprint2/stringprint/migrations/0024_auto_20190322_1324.py index 07208a0..175a307 100644 --- a/stringprint2/stringprint/migrations/0024_auto_20190322_1324.py +++ b/stringprint2/stringprint/migrations/0024_auto_20190322_1324.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0023_auto_20180707_1114"), ] diff --git a/stringprint2/stringprint/migrations/0025_auto_20190424_1555.py b/stringprint2/stringprint/migrations/0025_auto_20190424_1555.py index 04bc728..1e8d6e0 100644 --- a/stringprint2/stringprint/migrations/0025_auto_20190424_1555.py +++ b/stringprint2/stringprint/migrations/0025_auto_20190424_1555.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0024_auto_20190322_1324"), ] diff --git a/stringprint2/stringprint/migrations/0026_auto_20190502_0952.py b/stringprint2/stringprint/migrations/0026_auto_20190502_0952.py index 4528470..6eeee3b 100644 --- a/stringprint2/stringprint/migrations/0026_auto_20190502_0952.py +++ b/stringprint2/stringprint/migrations/0026_auto_20190502_0952.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0025_auto_20190424_1555"), ] diff --git a/stringprint2/stringprint/migrations/0027_auto_20190502_1009.py b/stringprint2/stringprint/migrations/0027_auto_20190502_1009.py index ed55029..47aecf7 100644 --- a/stringprint2/stringprint/migrations/0027_auto_20190502_1009.py +++ b/stringprint2/stringprint/migrations/0027_auto_20190502_1009.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0026_auto_20190502_0952"), ] diff --git a/stringprint2/stringprint/migrations/0028_auto_20191001_1856.py b/stringprint2/stringprint/migrations/0028_auto_20191001_1856.py index 6dc915f..7efbbcb 100644 --- a/stringprint2/stringprint/migrations/0028_auto_20191001_1856.py +++ b/stringprint2/stringprint/migrations/0028_auto_20191001_1856.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0027_auto_20190502_1009"), ] diff --git a/stringprint2/stringprint/migrations/0029_version_paragraph_links.py b/stringprint2/stringprint/migrations/0029_version_paragraph_links.py index 1177465..421a630 100644 --- a/stringprint2/stringprint/migrations/0029_version_paragraph_links.py +++ b/stringprint2/stringprint/migrations/0029_version_paragraph_links.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0028_auto_20191001_1856"), ] diff --git a/stringprint2/stringprint/migrations/0030_organisation_ga_cookies.py b/stringprint2/stringprint/migrations/0030_organisation_ga_cookies.py index a4b3bf9..e0a29e0 100644 --- a/stringprint2/stringprint/migrations/0030_organisation_ga_cookies.py +++ b/stringprint2/stringprint/migrations/0030_organisation_ga_cookies.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0029_version_paragraph_links"), ] diff --git a/stringprint2/stringprint/migrations/0031_auto_20191007_1529.py b/stringprint2/stringprint/migrations/0031_auto_20191007_1529.py index c516b1f..a0cc02b 100644 --- a/stringprint2/stringprint/migrations/0031_auto_20191007_1529.py +++ b/stringprint2/stringprint/migrations/0031_auto_20191007_1529.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0030_organisation_ga_cookies"), ] diff --git a/stringprint2/stringprint/migrations/0032_article_include_citation.py b/stringprint2/stringprint/migrations/0032_article_include_citation.py index 25f6239..1f05245 100644 --- a/stringprint2/stringprint/migrations/0032_article_include_citation.py +++ b/stringprint2/stringprint/migrations/0032_article_include_citation.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0031_auto_20191007_1529"), ] diff --git a/stringprint2/stringprint/migrations/0033_asset_size.py b/stringprint2/stringprint/migrations/0033_asset_size.py index 11dafc1..c676b07 100644 --- a/stringprint2/stringprint/migrations/0033_asset_size.py +++ b/stringprint2/stringprint/migrations/0033_asset_size.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0032_article_include_citation"), ] diff --git a/stringprint2/stringprint/migrations/0034_asset_no_header.py b/stringprint2/stringprint/migrations/0034_asset_no_header.py index 979e95f..b4af010 100644 --- a/stringprint2/stringprint/migrations/0034_asset_no_header.py +++ b/stringprint2/stringprint/migrations/0034_asset_no_header.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0033_asset_size"), ] diff --git a/stringprint2/stringprint/migrations/0035_article_display_toc.py b/stringprint2/stringprint/migrations/0035_article_display_toc.py index 7471993..edc4d94 100644 --- a/stringprint2/stringprint/migrations/0035_article_display_toc.py +++ b/stringprint2/stringprint/migrations/0035_article_display_toc.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0034_asset_no_header"), ] diff --git a/stringprint2/stringprint/migrations/0036_article_pdf_file.py b/stringprint2/stringprint/migrations/0036_article_pdf_file.py index 1c6a966..909f065 100644 --- a/stringprint2/stringprint/migrations/0036_article_pdf_file.py +++ b/stringprint2/stringprint/migrations/0036_article_pdf_file.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0035_article_display_toc"), ] diff --git a/stringprint2/stringprint/migrations/0037_article_subtitle.py b/stringprint2/stringprint/migrations/0037_article_subtitle.py index 047ac39..f9930f9 100644 --- a/stringprint2/stringprint/migrations/0037_article_subtitle.py +++ b/stringprint2/stringprint/migrations/0037_article_subtitle.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0036_article_pdf_file"), ] diff --git a/stringprint2/stringprint/migrations/0038_article_preprocessor.py b/stringprint2/stringprint/migrations/0038_article_preprocessor.py index 202505b..ee687c2 100644 --- a/stringprint2/stringprint/migrations/0038_article_preprocessor.py +++ b/stringprint2/stringprint/migrations/0038_article_preprocessor.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0037_article_subtitle"), ] diff --git a/stringprint2/stringprint/migrations/0039_auto_20200727_0838.py b/stringprint2/stringprint/migrations/0039_auto_20200727_0838.py index 28d5a33..0c388d4 100644 --- a/stringprint2/stringprint/migrations/0039_auto_20200727_0838.py +++ b/stringprint2/stringprint/migrations/0039_auto_20200727_0838.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0038_article_preprocessor"), ] diff --git a/stringprint2/stringprint/migrations/0040_organisation_default_values.py b/stringprint2/stringprint/migrations/0040_organisation_default_values.py index 236d665..98cf8b7 100644 --- a/stringprint2/stringprint/migrations/0040_organisation_default_values.py +++ b/stringprint2/stringprint/migrations/0040_organisation_default_values.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0039_auto_20200727_0838"), ] diff --git a/stringprint2/stringprint/migrations/0041_auto_20200906_1326.py b/stringprint2/stringprint/migrations/0041_auto_20200906_1326.py index ef649e5..a620f90 100644 --- a/stringprint2/stringprint/migrations/0041_auto_20200906_1326.py +++ b/stringprint2/stringprint/migrations/0041_auto_20200906_1326.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("stringprint", "0040_organisation_default_values"), ] diff --git a/stringprint2/stringprint/models.py b/stringprint2/stringprint/models.py index e47448a..d141acd 100644 --- a/stringprint2/stringprint/models.py +++ b/stringprint2/stringprint/models.py @@ -207,7 +207,6 @@ def safe_css(self): return mark_safe(self.custom_css) def display_fonts(self): - for f in self.fonts.split("\n"): yield f.strip() @@ -583,7 +582,6 @@ def import_assets(self, asset_folder: Path, refresh: bool) -> None: Asset.objects.filter(article=self, slug__in=slugs).delete() slugs = [] for a in assets: - no_header = False if a["content_type"] == "table-no-header": a["content_type"] = "table" @@ -748,7 +746,6 @@ def add_image( ni.image.save(internal_name, fi, save=True) fi.close() if image_vertical: - header, tail = os.path.splitext(internal_name) vert_file = header + "_vert" + tail fi = get_file(image_vertical) @@ -962,7 +959,6 @@ class BakePlainView(TextView): paragraph_lookup = c.paragraph_lookup() for k, v in paragraph_lookup.items(): - shorter_link = ".".join(k.split(".")[:6]) class BakeRedirectLinkView(RedirectLink): @@ -1093,7 +1089,6 @@ def load_article(self, request, article_slug, paragraph_slug): self.create_ebook(destination) def create_ebook(self, destination: Path) -> None: - from .views import EbookChapterView authors = self.authors.split(",") if self.authors else "" @@ -1210,7 +1205,6 @@ def create_kindle(self, destination: Path, use_temp: bool = False) -> None: if staging != destination: if os.path.exists(os.path.join(staging, self.slug + ".mobi")): - print("copying to destination") shutil.copyfile( os.path.join(staging, self.slug + ".mobi"), @@ -1239,7 +1233,6 @@ def url(self, section: str = "") -> str: return "./" else: - if section: args = (self.slug, section) else: @@ -1345,7 +1338,6 @@ def content(self) -> Version: article=self, number=self.current_version )[0] else: - v = q[0] return v @@ -1653,7 +1645,6 @@ def create_responsive(self, ignore_first: bool = True) -> None: class HeaderImage(FlexiBulkModel, HeaderMixin): - title_image = models.BooleanField(default=False) section_name = models.CharField(max_length=255, null=True, blank=True) source_loc = models.CharField(max_length=255, null=True, blank=True) @@ -2130,7 +2121,6 @@ def anchor_orphans(self, all_grafs: List[str], orphan_grafs: List[str]) -> dict: """ class MiniGraf(object): - order = [ "para_key_position", "para_key", @@ -2251,7 +2241,6 @@ def save(self, *args, **kwargs) -> None: class Asset(FlexiBulkModel, HeaderMixin): - RAW_HTML = "h" IMAGE = "i" CHART = "c" diff --git a/stringprint2/stringprint/templatetags/extra_tags.py b/stringprint2/stringprint/templatetags/extra_tags.py index 052fb30..399a639 100644 --- a/stringprint2/stringprint/templatetags/extra_tags.py +++ b/stringprint2/stringprint/templatetags/extra_tags.py @@ -42,7 +42,6 @@ def active(v1, v2): @register.simple_tag def alert(message): - if message: alert_type = "success" if "|" in message: @@ -56,7 +55,6 @@ def alert(message): @register.filter def display_asset(article, asset_id): - if hasattr(article, "render_basic_assets"): basic = True else: @@ -71,7 +69,6 @@ def display_asset(article, asset_id): @register.filter def display_header_asset(article, asset_id): - if hasattr(article, "render_basic_assets"): basic = True else: @@ -95,7 +92,6 @@ def display_asset_caption(article, asset_id): @register.filter def display_asset_text(article, asset_id): - asset = [x for x in article.cached_assets if x.id == asset_id] if asset: return asset[0].render(basic=True, kindle=False) @@ -105,7 +101,6 @@ def display_asset_text(article, asset_id): @register.filter def display_asset_kindle(article, asset_id): - asset = [x for x in article.cached_assets if x.id == asset_id] if asset: return asset[0].render(basic=True, kindle=True) diff --git a/stringprint2/stringprint/tools/charts.py b/stringprint2/stringprint/tools/charts.py index 7760388..c8bb922 100644 --- a/stringprint2/stringprint/tools/charts.py +++ b/stringprint2/stringprint/tools/charts.py @@ -151,7 +151,6 @@ def __init__(self): class GoogleLineChart(BaseChart): - package_name = "corechart" code_template = "charts//line_code.html" @@ -170,7 +169,6 @@ def compile_options(self): class GoogleTable(BaseChart): - package_name = "table" code_template = "charts//table_code.html" diff --git a/stringprint2/stringprint/tools/deepink.py b/stringprint2/stringprint/tools/deepink.py index 3d325f7..75bbe8b 100644 --- a/stringprint2/stringprint/tools/deepink.py +++ b/stringprint2/stringprint/tools/deepink.py @@ -30,7 +30,6 @@ class RandomAssignment(object): - max = 10000 def __init__(self, seed: int = 13) -> None: @@ -58,7 +57,6 @@ def get(self) -> int: class Footnote(SerialObject): - note_count = 0 # keep track of how many notes we've made all = [] @@ -252,7 +250,6 @@ def grafs_with_titles(self): return [x for x in self.grafs if x.title] def search_grafs(self) -> Iterator["Graf"]: - assets = self._version.article.assets.all() assets = {x.id: x for x in assets} @@ -299,7 +296,6 @@ def has_grafs(self) -> int: def get_grafs( self, just_titles: bool = False, change_footnotes: bool = True ) -> Iterator["Graf"]: - if hasattr(self, "stored_grafs"): if self._version.article.multipage and change_footnotes is False: for t in self.stored_grafs: @@ -419,7 +415,6 @@ class Meta: class Graf(SerialObject): - seed = 13 NORMAL = "NO" EXTENDED_START = "ES" @@ -605,7 +600,6 @@ def combo_key(self) -> str: ) def connect_to_footnote(self, text): - for l in text.split("\n"): ref = re.search("\[\^[0-9\*]+\]\:", l) if ref: @@ -805,7 +799,6 @@ def display_bare(self) -> str: return text def display_kindle(self, remove_links: bool = True) -> SafeText: - text = self.html links = BeautifulSoup(text, features="html5lib").findAll({"a": True}) @@ -841,7 +834,6 @@ def block_start(self, prev_block: Optional[bool] = None) -> None: return "StartNotes" def block_end(self, next_block: Optional[bool] = None) -> bool: - if self.blockquote and next_block is False: return True elif self.type == Graf.EXTENDED_END or self.type == Graf.EXTENDED_COMPLETE: @@ -939,7 +931,6 @@ def get_content(e: Union[NavigableString, Tag]) -> str: def process_ink(version: "Version", content: str) -> None: - Footnote.note_count = 0 processors = [ diff --git a/stringprint2/stringprint/tools/footnote_convert.py b/stringprint2/stringprint/tools/footnote_convert.py index 10d8b06..318fe65 100644 --- a/stringprint2/stringprint/tools/footnote_convert.py +++ b/stringprint2/stringprint/tools/footnote_convert.py @@ -3,7 +3,6 @@ import codecs if __name__ == "__main__": - final = [] with codecs.open( diff --git a/stringprint2/stringprint/tools/google_download.py b/stringprint2/stringprint/tools/google_download.py index 6946954..d2bcb58 100644 --- a/stringprint2/stringprint/tools/google_download.py +++ b/stringprint2/stringprint/tools/google_download.py @@ -10,14 +10,12 @@ class GoogleDownloader: - mime_types = { ".pdf": "application/pdf", ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", } def __init__(self): - data = os.environ.get("GDRIVE_SERVICE_USER", None) if data is None: raise ValueError("GDRIVE_SERVICE_USER env var not set.") diff --git a/stringprint2/stringprint/tools/preprocessing.py b/stringprint2/stringprint/tools/preprocessing.py index a5d849f..fa55061 100644 --- a/stringprint2/stringprint/tools/preprocessing.py +++ b/stringprint2/stringprint/tools/preprocessing.py @@ -38,7 +38,6 @@ class SectionActionBase: def get_sections_order( self, qt: QuickText ) -> Tuple[Dict[str, List[str]], List[str]]: - sections = {} current_header = "start" current_section = [] @@ -56,7 +55,6 @@ def get_sections_order( return sections, order def process_text(self, qt: QuickText) -> QuickText: - return qt def __call__(self, text: str) -> str: diff --git a/stringprint2/stringprint/tools/serial.py b/stringprint2/stringprint/tools/serial.py index 725b4e0..8fb4371 100644 --- a/stringprint2/stringprint/tools/serial.py +++ b/stringprint2/stringprint/tools/serial.py @@ -73,7 +73,6 @@ def restore_object(cls, obj): return [cls.restore_object(x) for x in obj] if isinstance(obj, dict): - try: # object restoration t = obj["_type"] @@ -87,7 +86,6 @@ def restore_object(cls, obj): return ins except KeyError: - return {x: cls.restore_object(y) for x, y in obj.items()} diff --git a/stringprint2/stringprint/tools/word_convert.py b/stringprint2/stringprint/tools/word_convert.py index 7d93fc4..914d10c 100644 --- a/stringprint2/stringprint/tools/word_convert.py +++ b/stringprint2/stringprint/tools/word_convert.py @@ -367,7 +367,6 @@ def get_tables(html: str) -> Tuple[str, List[Dict]]: asset_format = "

[asset:{0}]

" assets = [] for table in tables: - table_count += 1 print(f"getting table {table_count}") slug = slug_format.format(table_count) @@ -471,7 +470,6 @@ def convert_docx(file_path, demote=False) -> QuickText: def extract_assets(q: QuickText) -> None: - folder = os.path.dirname(q.filename) asset_folder = os.path.join(folder, "assets") if not os.path.exists(asset_folder): diff --git a/stringprint2/stringprint/views.py b/stringprint2/stringprint/views.py index 76ced0b..fe0e94c 100644 --- a/stringprint2/stringprint/views.py +++ b/stringprint2/stringprint/views.py @@ -39,13 +39,11 @@ def compression_callback( class AssetView(ComboView): - template = "ink//asset.html" url_patterns = [r"^asset/(.*)/(.*)/(.*)/", r"^asset/(.*)/(.*)/"] url_name = "asset_view" def view(self, request, article_slug, slug, static=None): - from charts import ChartCollection, Chart a = Asset.objects.get(article__slug=article_slug, slug=slug) @@ -110,7 +108,6 @@ def restrict(self, sections: List[Section], code: str) -> List[Section]: def view( self, request: WSGIRequest, article_slug: str, paragraph_code: str = "" ) -> dict: - a = self.get_article(request, article_slug) c = a.display_content() c.sections = self.restrict(c.sections, paragraph_code) @@ -149,7 +146,6 @@ def get_article(self, request, article_slug): return Article.objects.get(slug=article_slug) def view(self, request, article_slug, paragraph_code=""): - a = self.get_article(request, article_slug) if self.__class__.article_settings_override: @@ -196,7 +192,6 @@ def get_article(self, request, article_slug): return Article.objects.get(slug=article_slug) def view(self, request, article_slug, paragraph_code=""): - a = self.get_article(request, article_slug) if self.__class__.article_settings_override: a.__dict__.update(self.__class__.article_settings_override) @@ -436,7 +431,6 @@ def load_article(self, request, article_slug, paragraph_code): self.graf = graf def view(self, request, article_slug, paragraph_code): - self.load_article(request, article_slug, paragraph_code) self.asset_image = None self.alt = ""