Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 committed Aug 27, 2024
1 parent 7001787 commit 15ae04a
Show file tree
Hide file tree
Showing 397 changed files with 2,208 additions and 2,804 deletions.
1 change: 1 addition & 0 deletions apps/about/src/about/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# limitations under the License.

from django.urls import re_path

from about import views as about_views

urlpatterns = [
Expand Down
4 changes: 2 additions & 2 deletions apps/about/src/about/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from django.utils.translation import gettext as _

from desktop import appmanager
from desktop.auth.backend import is_hue_admin
from desktop.auth.decorators import admin_required
from desktop.lib.django_util import JsonResponse, render
from desktop.models import Settings, hue_version
from desktop.views import collect_usage

from django.utils.translation import gettext as _


def admin_wizard(request):
if is_hue_admin(request.user):
Expand Down
11 changes: 4 additions & 7 deletions apps/beeswax/src/beeswax/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import pytest
import sys
import logging
from unittest.mock import Mock, patch

import pytest
from django.test import TestCase
from requests.exceptions import ReadTimeout

from beeswax.api import _autocomplete, get_functions
from desktop.lib.django_test_util import make_logged_in_client
from desktop.lib.test_utils import add_to_group, grant_access
from useradmin.models import User

from beeswax.api import _autocomplete, get_functions

from unittest.mock import patch, Mock


LOG = logging.getLogger()


Expand Down
19 changes: 11 additions & 8 deletions apps/beeswax/src/beeswax/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import math
import logging
import os.path

from desktop.conf import default_ssl_cacerts, default_ssl_validate, AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD,\
AUTH_USERNAME as DEFAULT_AUTH_USERNAME
from desktop.lib.conf import ConfigSection, Config, coerce_bool, coerce_csv, coerce_password_from_script

from django.utils.translation import gettext_lazy as _t, gettext as _
from django.utils.translation import gettext as _, gettext_lazy as _t

from desktop.conf import (
AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD,
AUTH_USERNAME as DEFAULT_AUTH_USERNAME,
default_ssl_cacerts,
default_ssl_validate,
)
from desktop.lib.conf import Config, ConfigSection, coerce_bool, coerce_csv, coerce_password_from_script

LOG = logging.getLogger()

Expand Down Expand Up @@ -100,7 +103,7 @@

def get_hive_thrift_binary_port():
"""Devise port from core-site Thrift / execution mode & Http port"""
from beeswax.hive_site import hiveserver2_thrift_binary_port, get_hive_execution_mode # Cyclic dependency
from beeswax.hive_site import get_hive_execution_mode, hiveserver2_thrift_binary_port # Cyclic dependency
return hiveserver2_thrift_binary_port() or (10500 if (get_hive_execution_mode() or '').lower() == 'llap' else 10000)


Expand All @@ -113,7 +116,7 @@ def get_hive_thrift_binary_port():

def get_hive_thrift_http_port():
"""Devise port from core-site Thrift / execution mode & Http port"""
from beeswax.hive_site import hiveserver2_thrift_http_port, get_hive_execution_mode # Cyclic dependency
from beeswax.hive_site import get_hive_execution_mode, hiveserver2_thrift_http_port # Cyclic dependency
return hiveserver2_thrift_http_port() or (10501 if (get_hive_execution_mode() or '').lower() == 'llap' else 10001)


Expand Down
34 changes: 18 additions & 16 deletions apps/beeswax/src/beeswax/create_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import re
import csv
import gzip
import json
import logging
import math
import re
import logging

from django.urls import reverse
from django.http import QueryDict
from django.urls import reverse
from django.utils.translation import gettext as _

from aws.s3.s3fs import S3FileSystemException
from beeswax.common import TERMINATORS
from beeswax.design import hql_query
from beeswax.forms import (
TERMINATOR_CHOICES,
ColumnTypeFormSet,
CreateByImportDelimForm,
CreateByImportFileForm,
CreateTableForm,
PartitionTypeFormSet,
)
from beeswax.server import dbms
from beeswax.server.dbms import QueryServerException
from beeswax.views import execute_directly
from desktop.context_processors import get_app_name
from desktop.lib import django_mako, i18n
from desktop.lib.django_forms import MultiForm
from desktop.lib.django_util import render
from desktop.lib.exceptions_renderable import PopupException
from desktop.lib.django_forms import MultiForm
from desktop.models import _get_apps
from hadoop.fs import hadoopfs

from beeswax.common import TERMINATORS
from beeswax.design import hql_query
from beeswax.forms import CreateTableForm, ColumnTypeFormSet,\
PartitionTypeFormSet, CreateByImportFileForm, CreateByImportDelimForm,\
TERMINATOR_CHOICES
from beeswax.server import dbms
from beeswax.server.dbms import QueryServerException
from beeswax.views import execute_directly

from django.utils.translation import gettext as _


LOG = logging.getLogger()


Expand Down
7 changes: 3 additions & 4 deletions apps/beeswax/src/beeswax/data_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
# limitations under the License.

import json
import logging
import math

from desktop.lib import export_csvxls
from beeswax import common, conf
import logging

from django.utils.translation import gettext as _

from beeswax import common, conf
from desktop.lib import export_csvxls

LOG = logging.getLogger()

Expand Down
6 changes: 2 additions & 4 deletions apps/beeswax/src/beeswax/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
import django.http
from django import forms
from django.forms import ValidationError
from django.utils.translation import gettext as _

from notebook.sql_utils import split_statements, strip_trailing_semicolon
from desktop.lib.django_forms import BaseSimpleFormSet, MultiForm
from hadoop.cluster import get_hdfs

from django.utils.translation import gettext as _

from notebook.sql_utils import split_statements, strip_trailing_semicolon

LOG = logging.getLogger()

Expand Down
10 changes: 4 additions & 6 deletions apps/beeswax/src/beeswax/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
import sys

from django import forms
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.validators import MaxValueValidator, MinValueValidator
from django.forms import NumberInput
from django.utils.translation import gettext as _, gettext_lazy as _t

from aws.s3 import S3_ROOT, S3A_ROOT
from desktop.lib.django_forms import simple_formset_factory, DependencyAwareForm, ChoiceOrOtherField, MultiForm, SubmitButton
from filebrowser.forms import PathField

from beeswax import common
from beeswax.models import SavedQuery

from django.utils.translation import gettext as _, gettext_lazy as _t
from desktop.lib.django_forms import ChoiceOrOtherField, DependencyAwareForm, MultiForm, SubmitButton, simple_formset_factory
from filebrowser.forms import PathField


class QueryForm(MultiForm):
Expand Down
8 changes: 3 additions & 5 deletions apps/beeswax/src/beeswax/hive_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@
Helper for reading hive-site.xml
"""

import re
import errno
import socket
import logging
import os.path
import re
import socket

import beeswax.conf
from desktop.lib import security_util
from hadoop import confparse
from hadoop.ssl_client_site import get_trustore_location, get_trustore_password

import beeswax.conf


LOG = logging.getLogger()

_HIVE_SITE_PATH = None # Path to hive-site.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import csv
import logging
import json
import os
import csv
import pwd
import json
import logging

from django.core.management.base import BaseCommand
from django.utils.translation import gettext as _

from desktop.lib.exceptions_renderable import PopupException
from beeswax.conf import LOCAL_EXAMPLES_DATA_DIR
from beeswax.hive_site import has_concurrency_support
from beeswax.models import HQL, IMPALA, RDBMS, SavedQuery
from desktop.conf import USE_NEW_EDITOR
from desktop.lib.exceptions_renderable import PopupException
from desktop.models import Document2, Document2Permission
from hadoop import cluster
from notebook.models import import_saved_beeswax_query, make_notebook, MockRequest, _get_example_directory
from useradmin.models import get_default_user_group, install_sample_user, User

from beeswax.conf import LOCAL_EXAMPLES_DATA_DIR
from beeswax.hive_site import has_concurrency_support
from beeswax.models import SavedQuery, HQL, IMPALA, RDBMS

from django.utils.translation import gettext as _

from notebook.models import MockRequest, _get_example_directory, import_saved_beeswax_query, make_notebook
from useradmin.models import User, get_default_user_group, install_sample_user

LOG = logging.getLogger()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import logging
from unittest.mock import patch

import pytest
import sys

from beeswax.management.commands.beeswax_install_examples import Command, SampleQuery, SampleTable
from desktop.auth.backend import rewrite_user
from desktop.lib.django_test_util import make_logged_in_client
from desktop.models import Document2
from useradmin.models import User

from beeswax.management.commands.beeswax_install_examples import SampleTable, Command, SampleQuery

from unittest.mock import patch


LOG = logging.getLogger()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@
import logging

from django.core.management.base import BaseCommand
from django.utils.translation import gettext as _

from desktop.lib import django_mako
from beeswax import hive_site
from beeswax.design import hql_query
from beeswax.server import dbms
from beeswax.server.dbms import get_query_server_config

from beeswax.design import hql_query
from beeswax import hive_site
from desktop.lib import django_mako
from useradmin.models import install_sample_user

from django.utils.translation import gettext as _


LOG = logging.getLogger()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import sys
from desktop.models import set_user_preferences
import logging

from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.utils.translation import gettext as _, gettext_lazy as _t

from django.utils.translation import gettext_lazy as _t, gettext as _

from desktop.models import set_user_preferences

logging.basicConfig()
LOG = logging.getLogger()
Expand Down
18 changes: 7 additions & 11 deletions apps/beeswax/src/beeswax/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,25 @@
# limitations under the License.

import ast
import base64
import datetime
import json
import base64
import logging
import datetime
from enum import Enum

from django.db import models
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext as _, gettext_lazy as _t
from TCLIService.ttypes import THandleIdentifier, TOperationHandle, TOperationState, TOperationType, TSessionHandle

from enum import Enum
from TCLIService.ttypes import TSessionHandle, THandleIdentifier, TOperationState, TOperationHandle, TOperationType

from beeswax.design import HQLdesign
from desktop.lib.exceptions_renderable import PopupException
from desktop.models import Document, Document2
from desktop.redaction import global_redaction_engine
from librdbms.server import dbms as librdbms_dbms
from useradmin.models import User, UserProfile

from beeswax.design import HQLdesign

from django.utils.translation import gettext as _, gettext_lazy as _t


LOG = logging.getLogger()

QUERY_SUBMISSION_TIMEOUT = datetime.timedelta(0, 60 * 60) # 1 hour
Expand Down
Loading

0 comments on commit 15ae04a

Please sign in to comment.