Sort and clean up imports

This commit is contained in:
Lukáš Kucharczyk 2023-01-15 23:39:52 +01:00
parent 6b7ed0dbb5
commit 6fa049e1b1
17 changed files with 63 additions and 40 deletions

20
poetry.lock generated
View File

@ -417,6 +417,24 @@ files = [
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
] ]
[[package]]
name = "isort"
version = "5.11.4"
description = "A Python utility / library to sort Python imports."
category = "dev"
optional = false
python-versions = ">=3.7.0"
files = [
{file = "isort-5.11.4-py3-none-any.whl", hash = "sha256:c033fd0edb91000a7f09527fe5c75321878f98322a77ddcc81adbd83724afb7b"},
{file = "isort-5.11.4.tar.gz", hash = "sha256:6db30c5ded9815d813932c04c2f85a360bcdd35fed496f4d8f35495ef0a261b6"},
]
[package.extras]
colors = ["colorama (>=0.4.3,<0.5.0)"]
pipfile-deprecated-finder = ["pipreqs", "requirementslib"]
plugins = ["setuptools"]
requirements-deprecated-finder = ["pip-api", "pipreqs"]
[[package]] [[package]]
name = "jsbeautifier" name = "jsbeautifier"
version = "1.14.7" version = "1.14.7"
@ -1279,4 +1297,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "01d5c9b89b638c993f8540298dedfa79321b3aac1b2af70da58ef77706d0a113" content-hash = "bf02e951b8c14fbe6f2709b6df7f9664f99ad5fbf7195d8e7b18c8574d00e683"

View File

@ -23,6 +23,7 @@ django-extensions = "^3.2.1"
werkzeug = "^2.2.2" werkzeug = "^2.2.2"
djhtml = "^1.5.2" djhtml = "^1.5.2"
djlint = "^1.19.11" djlint = "^1.19.11"
isort = "^5.11.4"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]

View File

@ -1,14 +1,12 @@
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.dates import date2num
import base64 import base64
from io import BytesIO
from tracker.models import Session
from django.db.models import Sum, IntegerField, F
from django.db.models.functions import TruncDay
import logging
from datetime import datetime from datetime import datetime
from django.db.models import QuerySet from io import BytesIO
import matplotlib.pyplot as plt
import pandas as pd
from django.db.models import F, IntegerField, QuerySet, Sum
from django.db.models.functions import TruncDay
from tracker.models import Session
def key_value_to_value_value(data): def key_value_to_value_value(data):

View File

@ -1,7 +1,8 @@
from datetime import datetime, timedelta
from django.conf import settings
from zoneinfo import ZoneInfo
import re import re
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
from django.conf import settings
def now() -> datetime: def now() -> datetime:

View File

@ -1,5 +1,6 @@
from django.contrib import admin from django.contrib import admin
from .models import Game, Purchase, Platform, Session
from .models import Game, Platform, Purchase, Session
# Register your models here. # Register your models here.
admin.site.register(Game) admin.site.register(Game)

View File

@ -1,5 +1,6 @@
from django import forms from django import forms
from .models import Session, Purchase, Game, Platform
from .models import Game, Platform, Purchase, Session
class SessionForm(forms.ModelForm): class SessionForm(forms.ModelForm):

View File

@ -1,7 +1,7 @@
# Generated by Django 4.1.4 on 2023-01-02 18:27 # Generated by Django 4.1.4 on 2023-01-02 18:27
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,6 +1,7 @@
# Generated by Django 4.1.4 on 2023-01-02 18:55 # Generated by Django 4.1.4 on 2023-01-02 18:55
import datetime import datetime
from django.db import migrations, models from django.db import migrations, models

View File

@ -1,6 +1,7 @@
# Generated by Django 4.1.5 on 2023-01-09 14:49 # Generated by Django 4.1.5 on 2023-01-09 14:49
import datetime import datetime
from django.db import migrations, models from django.db import migrations, models

View File

@ -1,8 +1,9 @@
# Generated by Django 4.1.5 on 2023-01-09 17:43 # Generated by Django 4.1.5 on 2023-01-09 17:43
from django.db import migrations
from datetime import timedelta from datetime import timedelta
from django.db import migrations
def set_duration_calculated_none_to_zero(apps, schema_editor): def set_duration_calculated_none_to_zero(apps, schema_editor):
Session = apps.get_model("tracker", "Session") Session = apps.get_model("tracker", "Session")

View File

@ -1,8 +1,9 @@
# Generated by Django 4.1.5 on 2023-01-09 18:04 # Generated by Django 4.1.5 on 2023-01-09 18:04
from django.db import migrations
from datetime import timedelta from datetime import timedelta
from django.db import migrations
def set_duration_manual_none_to_zero(apps, schema_editor): def set_duration_manual_none_to_zero(apps, schema_editor):
Session = apps.get_model("tracker", "Session") Session = apps.get_model("tracker", "Session")

View File

@ -1,11 +1,11 @@
from django.db import models
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.conf import settings
from zoneinfo import ZoneInfo
from common.util.time import format_duration
from django.db.models import Sum, F
from django.db.models import Manager
from typing import Any from typing import Any
from zoneinfo import ZoneInfo
from common.util.time import format_duration
from django.conf import settings
from django.db import models
from django.db.models import F, Manager, Sum
class Game(models.Model): class Game(models.Model):

View File

@ -1,7 +1,8 @@
import os
import time
from django import template from django import template
from django.conf import settings from django.conf import settings
import time
import os
register = template.Library() register = template.Library()

View File

@ -1,14 +1,13 @@
from django.shortcuts import render, redirect from datetime import datetime
from .models import Game, Platform, Purchase, Session
from .forms import SessionForm, PurchaseForm, GameForm, PlatformForm
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
from django.conf import settings
from common.util.time import now as now_with_tz, format_duration
from django.db.models import Sum
import logging
from common.util.plots import playtime_over_time_chart from common.util.plots import playtime_over_time_chart
from common.util.time import now as now_with_tz
from django.conf import settings
from django.shortcuts import redirect, render
from .forms import GameForm, PlatformForm, PurchaseForm, SessionForm
from .models import Game, Platform, Purchase, Session
def model_counts(request): def model_counts(request):

View File

@ -10,9 +10,8 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/ https://docs.djangoproject.com/en/4.1/ref/settings/
""" """
from pathlib import Path
import logging
import os import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent

View File

@ -13,11 +13,10 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.views.generic import RedirectView from django.views.generic import RedirectView
from django.conf import settings
urlpatterns = [ urlpatterns = [
path("", RedirectView.as_view(url="/tracker/list-sessions")), path("", RedirectView.as_view(url="/tracker/list-sessions")),

View File

@ -1,7 +1,8 @@
import unittest import unittest
from web.common.util.time import format_duration
from datetime import timedelta from datetime import timedelta
from web.common.util.time import format_duration
class FormatDurationTest(unittest.TestCase): class FormatDurationTest(unittest.TestCase):
def setUp(self) -> None: def setUp(self) -> None: