diff --git a/django/labellabor/views.py b/django/labellabor/views.py
index ca8d377..4ae9992 100644
--- a/django/labellabor/views.py
+++ b/django/labellabor/views.py
@@ -1,7 +1,6 @@
import os
import time
import tempfile
-import json
from django.conf import settings
from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import redirect, resolve_url
@@ -22,14 +21,11 @@ from django.http import HttpResponseRedirect
from django.http import FileResponse
from rest_framework.authtoken.models import Token
from bip329.bip329_writer import BIP329JSONLWriter, BIP329JSONLEncryptedWriter
-from django.utils.safestring import mark_safe
from django.urls import reverse
from django_datatables_view.base_datatable_view import BaseDatatableView
-from django.utils.html import escape
from django.template.loader import render_to_string
from .utils import hashtag_to_badge, extract_fiat_value
-from labelbase.utils import compute_type_ref_hash
from finances.models import OutputStat
from finances.tasks import check_all_outputs
@@ -68,7 +64,6 @@ class LabelDeleteView(DeleteView):
error_url = "/#failed"
def post(self, request, *args, **kwargs):
- dummy + yummy
self.object = self.get_object()
if self.object.labelbase.user != self.request.user:
return redirect(self.error_url)
@@ -122,10 +117,11 @@ class LabelbaseDatatableView(BaseDatatableView):
elif column == 'type':
return "{}".format(row.get_type_display())
elif column == 'ref':
- return render_to_string('labelbase_dt_ref.html',
- context={'row': row,
- 'mempool_url': row.get_mempool_url(),
- }, request=self.request)
+ ctx = {
+ 'row': row,
+ 'mempool_url': row.get_mempool_url(),
+ }
+ return render_to_string('labelbase_dt_ref.html', context=ctx, request=self.request)
elif column == 'label':
if row.label is None:
return ""
@@ -144,10 +140,10 @@ class LabelbaseDatatableView(BaseDatatableView):
else:
spendable_formatted = 'true' if spendable_value else 'false'
# if spendable_formatted == 'true':
- # return f' {spendable_formatted } '
+ # return f' {spendable_formatted }' # noqa
# elif spendable_formatted == 'false':
- # return f'{spendable_formatted }'
- return f'{spendable_formatted }'
+ # return f'{spendable_formatted }' # noqa
+ return f'{spendable_formatted}'
else:
return super(LabelbaseDatatableView, self).render_column(row, column)
@@ -170,7 +166,6 @@ class LabelbaseDatatableView(BaseDatatableView):
if record.origin and search in record.origin.lower():
res_ids.append(record.id)
continue
-
return qs.filter(id__in=res_ids)
return qs
@@ -277,33 +272,6 @@ class StatsAndKPIView(View):
"active_labelbase_id": labelbase_id})
-"""
-
-
-def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context["active_labelbase_id"] = self.object.labelbase.id
- context["labelbase"] = self.object.labelbase
- context["action"] = self.kwargs.get('action', 'unspent-outputs')
- if context["action"] == "labeling":
- #mempool_api = self.object.labelbase.get_mempool_api()
- if self.object.type == "tx":
- mempool_api = self.object.labelbase.get_mempool_api()
- context["res_tx"] = mempool_api.get_transaction(self.object.ref)
-
- if self.object.type == "output":
- context["output"] = OutputStat.objects.filter(type_ref_hash= \
- self.object.type_ref_hash).last()
-
- return context
-
-
-
-
-
-"""
-
-
class TreeMapsView(ListView):
context_object_name = "label_list"
@@ -462,13 +430,17 @@ class FixAndMergeLabelsView(View):
for key_all_identical, duplicates in record_groups_all_identical.items():
if len(duplicates) > 1:
type_val, ref_val, label_val, origin_val, spendable_cal = key_all_identical
- # print(f"Duplicates for labelbase_id={labelbase_id}, type='{type_val}', ref='{ref_val}', label='{label_val}':")
for record in duplicates:
if record not in all_identical_records:
all_identical_records.append(record)
- # print(f" ID: {record.id}, origin: {record.origin}, spendable: {record.spendable}")
- resulting_duplicates_all_identical.append({'type': type_val, 'ref': ref_val, 'label': label_val,
- 'origin': origin_val, 'spendable': spendable_cal}) # nonsense, but counts
+ res_rec = {
+ 'type': type_val,
+ 'ref': ref_val,
+ 'label': label_val,
+ 'origin': origin_val,
+ 'spendable': spendable_cal
+ }
+ resulting_duplicates_all_identical.append(res_rec) # nonsense, but counts
fix_suggestions = len(resulting_duplicates_type_and_ref) + \
len(resulting_duplicates_type_and_ref_and_label) + \
diff --git a/django/uuid_upload_path/__init__.py b/django/uuid_upload_path/__init__.py
index e9f438d..32e81a4 100644
--- a/django/uuid_upload_path/__init__.py
+++ b/django/uuid_upload_path/__init__.py
@@ -10,5 +10,5 @@ Developed by Dave Hall.
__version__ = (1, 0, 0)
-from uuid_upload_path.uuid import uuid
-from uuid_upload_path.storage import upload_to_factory, upload_to
+from uuid_upload_path.uuid import uuid # noqa
+from uuid_upload_path.storage import upload_to_factory, upload_to # noqa