Skip to content

Commit

Permalink
single import pe line
Browse files Browse the repository at this point in the history
  • Loading branch information
tolomea committed Feb 3, 2024
1 parent 080802a commit ba728fd
Show file tree
Hide file tree
Showing 35 changed files with 249 additions and 180 deletions.
7 changes: 5 additions & 2 deletions data_browser/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
from django.utils.html import format_html

from . import models
from .common import PUBLIC_PERM, has_permission, set_global_state
from .helpers import AdminMixin, attributes
from .common import PUBLIC_PERM
from .common import has_permission
from .common import set_global_state
from .helpers import AdminMixin
from .helpers import attributes


@admin.register(models.View)
Expand Down
16 changes: 7 additions & 9 deletions data_browser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
from django.shortcuts import get_object_or_404
from django.views.decorators import csrf

from .common import (
SHARE_PERM,
HttpResponse,
JsonResponse,
global_state,
set_global_state,
str_user,
users_with_permission,
)
from .common import SHARE_PERM
from .common import HttpResponse
from .common import JsonResponse
from .common import global_state
from .common import set_global_state
from .common import str_user
from .common import users_with_permission
from .models import View
from .util import group_by

Expand Down
18 changes: 9 additions & 9 deletions data_browser/migration_helpers.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from urllib.parse import parse_qsl, urlencode
from urllib.parse import parse_qsl
from urllib.parse import urlencode

from django.contrib.auth import get_user_model
from django.test import RequestFactory
from django.urls import reverse

from data_browser.types import (
IsNullType,
NumberChoiceArrayType,
NumberChoiceType,
StringChoiceArrayType,
StringChoiceType,
)
from data_browser.types import IsNullType
from data_browser.types import NumberChoiceArrayType
from data_browser.types import NumberChoiceType
from data_browser.types import StringChoiceArrayType
from data_browser.types import StringChoiceType

from .common import global_state, set_global_state
from .common import global_state
from .common import set_global_state


def _fix_filter(models, field, parts, lookup, value):
Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0002_auto_20200331_1842.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 2.0.13 on 2020-03-31 17:42

from django.db import migrations, models
from django.db import migrations
from django.db import models

import data_browser.models

Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0006_auto_20200531_1450.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 2.0.13 on 2020-05-31 13:50

from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0007_view_public_slug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 2.0.13 on 2020-06-14 10:37

from django.db import migrations, models
from django.db import migrations
from django.db import models

import data_browser.models

Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0008_view_limit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 3.0.7 on 2020-07-02 07:43

from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0010_shared.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 3.2.18 on 2023-04-11 07:09

from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion data_browser/migrations/0011_folder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 3.2.18 on 2023-04-16 11:00

from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
Expand Down
19 changes: 9 additions & 10 deletions data_browser/models.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import hyperlink
from django.db import models
from django.urls import reverse
from django.utils import crypto, timezone

from .common import (
PUBLIC_PERM,
SHARE_PERM,
global_state,
has_permission,
set_global_state,
settings,
)
from django.utils import crypto
from django.utils import timezone

from .common import PUBLIC_PERM
from .common import SHARE_PERM
from .common import global_state
from .common import has_permission
from .common import set_global_state
from .common import settings


def get_id():
Expand Down
36 changes: 23 additions & 13 deletions data_browser/orm_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from django.contrib.admin import site
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.utils import flatten_fieldsets, model_format_dict
from django.contrib.admin.utils import flatten_fieldsets
from django.contrib.admin.utils import model_format_dict
from django.contrib.auth.admin import UserAdmin
from django.core.exceptions import FieldDoesNotExist
from django.core.serializers.json import DjangoJSONEncoder
Expand All @@ -17,22 +18,31 @@
from django.urls import reverse
from django.utils.html import format_html

from .common import JsonResponse, debug_log, global_state, settings
from .helpers import AdminMixin, _AnnotationDescriptor, _get_option, attributes
from .common import JsonResponse
from .common import debug_log
from .common import global_state
from .common import settings
from .helpers import AdminMixin
from .helpers import _AnnotationDescriptor
from .helpers import _get_option
from .helpers import attributes
from .orm_aggregates import get_aggregates_for_type
from .orm_debug import DebugQS
from .orm_fields import (
OrmAnnotatedField,
OrmCalculatedField,
OrmConcreteField,
OrmFileField,
OrmFkField,
OrmRawField,
)
from .orm_fields import OrmAnnotatedField
from .orm_fields import OrmCalculatedField
from .orm_fields import OrmConcreteField
from .orm_fields import OrmFileField
from .orm_fields import OrmFkField
from .orm_fields import OrmRawField
from .orm_functions import get_functions_for_type
from .orm_types import get_field_type
from .types import TYPES, BooleanType, JSONType, NumberType, StringType
from .util import str_to_field, title_case
from .types import TYPES
from .types import BooleanType
from .types import JSONType
from .types import NumberType
from .types import StringType
from .util import str_to_field
from .util import title_case


@dataclass(kw_only=True)
Expand Down
25 changes: 13 additions & 12 deletions data_browser/orm_aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

from django.conf import settings
from django.db import models
from django.db.models import DurationField, IntegerField, Value
from django.db.models import DurationField
from django.db.models import IntegerField
from django.db.models import Value
from django.db.models.functions import Cast

from .orm_fields import OrmBaseField, OrmBoundField
from .types import (
ARRAY_TYPES,
TYPES,
BaseType,
BooleanType,
DateTimeType,
DateType,
DurationType,
NumberType,
)
from .orm_fields import OrmBaseField
from .orm_fields import OrmBoundField
from .types import ARRAY_TYPES
from .types import TYPES
from .types import BaseType
from .types import BooleanType
from .types import DateTimeType
from .types import DateType
from .types import DurationType
from .types import NumberType
from .util import annotation_path

try:
Expand Down
8 changes: 6 additions & 2 deletions data_browser/orm_debug.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import contextlib
from textwrap import dedent, indent
from textwrap import dedent
from textwrap import indent

from django.db.models import ExpressionWrapper, F, Field, Q
from django.db.models import ExpressionWrapper
from django.db.models import F
from django.db.models import Field
from django.db.models import Q

SPACES = " "

Expand Down
24 changes: 12 additions & 12 deletions data_browser/orm_fields.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from dataclasses import dataclass
from typing import Sequence, Tuple
from typing import Sequence
from typing import Tuple

from django.db import models
from django.db.models import OuterRef, Subquery
from django.db.models import OuterRef
from django.db.models import Subquery

from .common import global_state
from .orm_debug import DebugQS
from .types import (
ASC,
BaseType,
BooleanType,
DateTimeType,
DateType,
HTMLType,
UnknownType,
URLType,
)
from .types import ASC
from .types import BaseType
from .types import BooleanType
from .types import DateTimeType
from .types import DateType
from .types import HTMLType
from .types import UnknownType
from .types import URLType
from .util import annotation_path


Expand Down
36 changes: 20 additions & 16 deletions data_browser/orm_functions.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
from dataclasses import dataclass, field
from dataclasses import dataclass
from dataclasses import field
from typing import Optional

from django.db.models import BooleanField, DateField, ExpressionWrapper, Q, functions

from .orm_fields import OrmBaseField, OrmBoundField
from .types import (
ARRAY_TYPES,
ASC,
TYPES,
BaseType,
DateTimeType,
DateType,
IsNullType,
NumberChoiceType,
NumberType,
StringType,
)
from django.db.models import BooleanField
from django.db.models import DateField
from django.db.models import ExpressionWrapper
from django.db.models import Q
from django.db.models import functions

from .orm_fields import OrmBaseField
from .orm_fields import OrmBoundField
from .types import ARRAY_TYPES
from .types import ASC
from .types import TYPES
from .types import BaseType
from .types import DateTimeType
from .types import DateType
from .types import IsNullType
from .types import NumberChoiceType
from .types import NumberType
from .types import StringType
from .util import annotation_path

try:
Expand Down
4 changes: 3 additions & 1 deletion data_browser/orm_lookups.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.db.models import Q

from .types import ArrayTypeMixin, IsNullType, StringType
from .types import ArrayTypeMixin
from .types import IsNullType
from .types import StringType


def get_django_filter(field_type, path_str, lookup, filter_value):
Expand Down
Loading

0 comments on commit ba728fd

Please sign in to comment.