Skip to content

Commit

Permalink
no relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tolomea committed Feb 3, 2024
1 parent ab65ba2 commit 323214c
Show file tree
Hide file tree
Showing 26 changed files with 166 additions and 175 deletions.
12 changes: 6 additions & 6 deletions data_browser/admin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.contrib import admin
from django.utils.html import format_html

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


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

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
from data_browser.common import SHARE_PERM
from data_browser.common import HttpResponse
from data_browser.common import JsonResponse
from data_browser.common import global_state
from data_browser.common import set_global_state
from data_browser.common import str_user
from data_browser.common import users_with_permission
from data_browser.models import View
from data_browser.util import group_by


def clean_str(field, value):
Expand Down
6 changes: 3 additions & 3 deletions data_browser/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.contrib.contenttypes.models import ContentType
from django.utils.functional import cached_property

from . import version
from data_browser import version


class Settings:
Expand Down Expand Up @@ -51,7 +51,7 @@ def has_permission(user, permission):


def users_with_permission(permission):
from .models import View
from data_browser.models import View

ct = ContentType.objects.get_for_model(View)
perm = Permission.objects.get(codename=permission, content_type=ct)
Expand Down Expand Up @@ -185,7 +185,7 @@ def __init__(

@cached_property
def models(self):
from .orm_admin import get_models
from data_browser.orm_admin import get_models

old = global_state._state
global_state._state = None
Expand Down
2 changes: 1 addition & 1 deletion data_browser/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.db.models import BooleanField
from django.urls import reverse

from .common import settings
from data_browser.common import settings


def attributes(**kwargs):
Expand Down
5 changes: 2 additions & 3 deletions data_browser/migration_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
from django.test import RequestFactory
from django.urls import reverse

from data_browser.common import global_state
from data_browser.common import set_global_state
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
from .common import set_global_state


def _fix_filter(models, field, parts, lookup, value):
if lookup == "is_null":
Expand Down
14 changes: 7 additions & 7 deletions data_browser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
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
from data_browser.common import PUBLIC_PERM
from data_browser.common import SHARE_PERM
from data_browser.common import global_state
from data_browser.common import has_permission
from data_browser.common import set_global_state
from data_browser.common import settings


def get_id():
Expand Down Expand Up @@ -43,7 +43,7 @@ class Meta:
limit = models.IntegerField(blank=False, null=False, default=1000)

def get_query(self):
from .query import Query
from data_browser.query import Query

params = list(hyperlink.parse(f"?{self.query}").query)
params.append(("limit", str(self.limit)))
Expand Down
50 changes: 25 additions & 25 deletions data_browser/orm_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
from django.urls import reverse
from django.utils.html import format_html

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
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
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
from data_browser.common import JsonResponse
from data_browser.common import debug_log
from data_browser.common import global_state
from data_browser.common import settings
from data_browser.helpers import AdminMixin
from data_browser.helpers import _AnnotationDescriptor
from data_browser.helpers import _get_option
from data_browser.helpers import attributes
from data_browser.orm_aggregates import get_aggregates_for_type
from data_browser.orm_debug import DebugQS
from data_browser.orm_fields import OrmAnnotatedField
from data_browser.orm_fields import OrmCalculatedField
from data_browser.orm_fields import OrmConcreteField
from data_browser.orm_fields import OrmFileField
from data_browser.orm_fields import OrmFkField
from data_browser.orm_fields import OrmRawField
from data_browser.orm_functions import get_functions_for_type
from data_browser.orm_types import get_field_type
from data_browser.types import TYPES
from data_browser.types import BooleanType
from data_browser.types import JSONType
from data_browser.types import NumberType
from data_browser.types import StringType
from data_browser.util import str_to_field
from data_browser.util import title_case


@dataclass
Expand Down
22 changes: 11 additions & 11 deletions data_browser/orm_aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
from django.db.models import Value
from django.db.models.functions import Cast

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
from data_browser.orm_fields import OrmBaseField
from data_browser.orm_fields import OrmBoundField
from data_browser.types import ARRAY_TYPES
from data_browser.types import TYPES
from data_browser.types import BaseType
from data_browser.types import BooleanType
from data_browser.types import DateTimeType
from data_browser.types import DateType
from data_browser.types import DurationType
from data_browser.types import NumberType
from data_browser.util import annotation_path

try:
from django.contrib.postgres.aggregates import ArrayAgg
Expand Down
24 changes: 12 additions & 12 deletions data_browser/orm_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
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
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
from data_browser.common import global_state
from data_browser.orm_debug import DebugQS
from data_browser.types import ASC
from data_browser.types import BaseType
from data_browser.types import BooleanType
from data_browser.types import DateTimeType
from data_browser.types import DateType
from data_browser.types import HTMLType
from data_browser.types import UnknownType
from data_browser.types import URLType
from data_browser.util import annotation_path


@dataclass
Expand Down Expand Up @@ -212,7 +212,7 @@ def format(obj):

class OrmBoundAnnotatedField(OrmBoundField):
def _annotate(self, qs, debug=False):
from .orm_admin import admin_get_queryset
from data_browser.orm_admin import admin_get_queryset

if debug:
subquery = DebugQS("Subquery")
Expand Down
26 changes: 13 additions & 13 deletions data_browser/orm_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
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
from data_browser.orm_fields import OrmBaseField
from data_browser.orm_fields import OrmBoundField
from data_browser.types import ARRAY_TYPES
from data_browser.types import ASC
from data_browser.types import TYPES
from data_browser.types import BaseType
from data_browser.types import DateTimeType
from data_browser.types import DateType
from data_browser.types import IsNullType
from data_browser.types import NumberChoiceType
from data_browser.types import NumberType
from data_browser.types import StringType
from data_browser.util import annotation_path

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

from .types import ArrayTypeMixin
from .types import IsNullType
from .types import StringType
from data_browser.types import ArrayTypeMixin
from data_browser.types import IsNullType
from data_browser.types import StringType


def get_django_filter(field_type, path_str, lookup, filter_value):
Expand Down
6 changes: 3 additions & 3 deletions data_browser/orm_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from django.core.serializers.json import DjangoJSONEncoder

from .orm_lookups import get_django_filter
from .query import BoundQuery
from .types import DSC
from data_browser.orm_lookups import get_django_filter
from data_browser.query import BoundQuery
from data_browser.types import DSC


def _filter(qs, path_str, filter_):
Expand Down
36 changes: 18 additions & 18 deletions data_browser/orm_types.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
from django.db import models
from django.db.models import JSONField

from .common import debug_log
from .types import BooleanType
from .types import DateTimeType
from .types import DateType
from .types import DurationType
from .types import JSONType
from .types import NumberArrayType
from .types import NumberChoiceArrayType
from .types import NumberChoiceType
from .types import NumberType
from .types import StringableType
from .types import StringArrayType
from .types import StringChoiceArrayType
from .types import StringChoiceType
from .types import StringType
from .types import UnknownType
from .types import URLType
from .types import UUIDType
from data_browser.common import debug_log
from data_browser.types import BooleanType
from data_browser.types import DateTimeType
from data_browser.types import DateType
from data_browser.types import DurationType
from data_browser.types import JSONType
from data_browser.types import NumberArrayType
from data_browser.types import NumberChoiceArrayType
from data_browser.types import NumberChoiceType
from data_browser.types import NumberType
from data_browser.types import StringableType
from data_browser.types import StringArrayType
from data_browser.types import StringChoiceArrayType
from data_browser.types import StringChoiceType
from data_browser.types import StringType
from data_browser.types import UnknownType
from data_browser.types import URLType
from data_browser.types import UUIDType

try:
from django.contrib.postgres.fields import ArrayField
Expand Down
6 changes: 3 additions & 3 deletions data_browser/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from django.urls import reverse
from django.utils.functional import cached_property

from .common import settings
from .types import ASC
from .types import DSC
from data_browser.common import settings
from data_browser.types import ASC
from data_browser.types import DSC


@dataclasses.dataclass
Expand Down
6 changes: 3 additions & 3 deletions data_browser/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from django.utils import html
from django.utils import timezone

from .common import all_subclasses
from .common import debug_log
from .common import get_optimal_decimal_places
from data_browser.common import all_subclasses
from data_browser.common import debug_log
from data_browser.common import get_optimal_decimal_places

ASC, DSC = "asc", "dsc"

Expand Down
16 changes: 8 additions & 8 deletions data_browser/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from django.views.generic.base import RedirectView
from django.views.static import serve

from .api import view_detail
from .api import view_list
from .common import settings
from .views import proxy_js_dev_server
from .views import query
from .views import query_ctx
from .views import query_html
from .views import view
from data_browser.api import view_detail
from data_browser.api import view_list
from data_browser.common import settings
from data_browser.views import proxy_js_dev_server
from data_browser.views import query
from data_browser.views import query_ctx
from data_browser.views import query_html
from data_browser.views import view

FE_BUILD_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fe_build")
WEB_ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web_root")
Expand Down
Loading

0 comments on commit 323214c

Please sign in to comment.