fixing pep8 issues

This commit is contained in:
Xavier Fiechter 2023-08-11 23:12:48 +02:00
parent b26b9573ba
commit 9e29ed4356
14 changed files with 43 additions and 36 deletions

View file

@ -7,17 +7,35 @@ from django.contrib.auth.decorators import login_required
@login_required
def stream_labels_as_jsonl(request, labelbase_id):
"""
Google Chrome blocks downloads that it considers to be potentially dangerous or harmful to your computer. If you are trying to download a file that Chrome is blocking, there are a few ways to resolve the issue:
Google Chrome blocks downloads that it considers to be potentially dangerous
or harmful to your computer. If you are trying to download a file that
Chrome is blocking, there are a few ways to resolve the issue:
Whitelist the site: If you trust the site from which you are downloading the file, you can add it to your list of trusted sites in Chrome. To do this, go to the site, click the lock icon in the address bar, and then click "Site settings". In the "Permissions" section, click "Downloads", and then toggle the switch next to "Block dangerous and deceptive downloads" to "Off".
Whitelist the site: If you trust the site from which you are downloading
the file, you can add it to your list of trusted sites in Chrome.
To do this, go to the site, click the lock icon in the address bar, and
then click "Site settings". In the "Permissions" section, click
"Downloads", and then toggle the switch next to "Block dangerous
and deceptive downloads" to "Off".
Download the file in Incognito mode: Chrome blocks downloads based on your browsing history, so downloading the file in Incognito mode may bypass the block. To open an Incognito window, click the three dots in the upper-right corner of Chrome, and then click "New incognito window".
Download the file in Incognito mode: Chrome blocks downloads based on
your browsing history, so downloading the file in Incognito mode may
bypass the block. To open an Incognito window, click the three dots in
the upper-right corner of Chrome, and then click "New incognito window".
Change the file extension: Sometimes, changing the file extension from .exe or .zip to .txt, for example, can help bypass the block. However, this may not always work, and the file may still be harmful even if the extension is changed.
Change the file extension: Sometimes, changing the file extension
from .exe or .zip to .txt, for example, can help bypass the block.
However, this may not always work, and the file may still be harmful
even if the extension is changed.
Use a different browser: If none of the above methods work, you can try downloading the file using a different browser, such as Mozilla Firefox or Microsoft Edge.
Use a different browser: If none of the above methods work, you can try
downloading the file using a different browser, such as Mozilla Firefox
or Microsoft Edge.
Keep in mind that Chrome's download protection is in place to help keep your computer safe, so only download files from sources that you trust. If you are unsure whether a file is safe, it's always a good idea to scan it with an antivirus program before downloading.
Keep in mind that Chrome's download protection is in place to help keep
your computer safe, so only download files from sources that you trust.
If you are unsure whether a file is safe, it's always a good idea to scan
it with an antivirus program before downloading.
"""
def get_queryset():

View file

@ -1 +0,0 @@
from django.contrib import admin

View file

@ -1 +0,0 @@
from django.db import models

View file

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View file

@ -1,10 +1,9 @@
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
import tempfile
import os
import json
from labelbase.models import Labelbase, Label
from labelbase.models import Labelbase
from labelbase.serializers import LabelSerializer
from django.shortcuts import get_object_or_404
from django.contrib import messages

View file

@ -62,9 +62,9 @@ class Label(models.Model):
)
origin = encrypt(
models.CharField(
help_text=("Optional key origin information referencing the wallet "
"associated with the label. The origin property should "
"only appear where type is 'tx'.")
help_text=("""Optional key origin information referencing the wallet
associated with the label. The origin property should
only appear where type is 'tx'.""")
max_length=160,
default="",
blank=True,
@ -72,9 +72,9 @@ class Label(models.Model):
)
spendable = encrypt(
models.BooleanField(
help_text=("One of true or false, denoting if an output should be "
"spendable by the wallet. The spendable property only "
"where type is 'output'.")
help_text=("""One of true or false, denoting if an output should be
spendable by the wallet. The spendable property only
where type is 'output'.""")
max_length=160,
default=False,
)

View file

@ -1,6 +1,7 @@
import os
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from pathlib import Path
from configparser import RawConfigParser
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -37,8 +38,7 @@ else:
ALLOWED_HOSTS = [proj_config.get("internal", "allowed_host")]
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn="https://3b833ae08ccc4ff68793e961fff4921c@o4504646963232768.ingest.sentry.io/4504646967361536",
@ -128,7 +128,7 @@ DATABASES = {
"USER": proj_config.get("database", "user"),
"OPTIONS": {"charset": "utf8mb4"},
"PASSWORD": proj_config.get("database", "password"),
'HOST': 'localhost',
'HOST': 'localhost',
'PORT': 3306,
}
}

View file

@ -1,11 +1,9 @@
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.views import LogoutView
from django.urls import include, path
from two_factor.urls import urlpatterns as tf_urls
from labelbase.api import LabelAPIView, LabelbaseAPIView
from rest_framework.documentation import include_docs_urls
from rest_framework.urlpatterns import format_suffix_patterns
from django.contrib.auth.decorators import login_required
from userprofile.views import ProfileView, APIKeyView
from .views import (
@ -88,7 +86,11 @@ urlpatterns = [
login_required(LabelbaseFormView.as_view()),
name="labelbase_new"
),
# path('labelbase/<int:labelbase_id>/label/<int:label_id>/edit/', login_required(LabelUpdateView.as_view()), name='edit_label'),
# path(
# 'labelbase/<int:labelbase_id>/label/<int:label_id>/edit/',
# login_required(LabelUpdateView.as_view()),
# name='edit_label'
#),
path(
"label/<int:pk>/edit/",
login_required(LabelUpdateView.as_view()),

View file

@ -16,6 +16,7 @@ from labelbase.forms import LabelForm, LabelbaseForm
from django.http import HttpResponseRedirect
from rest_framework.authtoken.models import Token
class AboutView(TemplateView):
template_name = "about.html"

View file

@ -6,4 +6,4 @@ class UserprofileConfig(AppConfig):
name = "userprofile"
def ready(self):
import userprofile.signals
import userprofile.signals # noqa: F401

View file

@ -5,7 +5,6 @@ from labelbase.models import Labelbase
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
mempool_endpoint = models.CharField(
max_length=160,
default="https://mempool.space",

View file

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View file

@ -1,19 +1,15 @@
from django.shortcuts import render
from django.views.generic import TemplateView # FormView,
from django.views.generic import TemplateView
from rest_framework.authtoken.models import Token
class ProfileView(TemplateView):
""" """
template_name = "profile.html"
class APIKeyView(TemplateView):
""" """
template_name = "apikey.html"
def get_context_data(self, **kwargs):
context = super(APIKeyView, self).get_context_data(**kwargs)
context["api_token"] = Token.objects.get(user_id=self.request.user.id)