Skip to content

Commit

Permalink
fix module import at top errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 committed May 7, 2024
1 parent e57e72e commit 7873dbb
Show file tree
Hide file tree
Showing 38 changed files with 65 additions and 135 deletions.
4 changes: 2 additions & 2 deletions apps/beeswax/src/beeswax/query_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_queries(self, request_user, filters):
QUERY_HISTORY = QueryHistory(max_user=QUERY_HISTORY_CACHE_MAX_USER_COUNT, max_history_per_user=QUERY_HISTORY_CACHE_MAX_LENGTH_PER_USER)


# If fresh user get from _get_query_history_latest else get _get_query_history_from.
# If fresh user get from _get_query_history_latest else get _get_query_history_from.
# if results set from _get_query_history_from less than limit merge results with cache else call _get_query_history_latest
def get_query_history(request_user=None, start_date=None, start_time=None, query_id=None, status=None, limit=None):
_init_table()
Expand Down Expand Up @@ -195,7 +195,7 @@ def _init_table():
def _get_query_history_latest(
request_user=None, query_id=None, start_date=None, start_time=None, status=None, limit=25, force_refresh=False):
proposed_query = django_mako.render_to_string(
"select_table_query_data_latest.mako",
"select_table_query_data_latest.mako",
{'table': {
'name': 'query_data',
'request_user': request_user,
Expand Down
13 changes: 6 additions & 7 deletions apps/jobbrowser/src/jobbrowser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
# limitations under the License.

from past.builtins import cmp
from future import standard_library
standard_library.install_aliases()

from builtins import filter
from builtins import str
import functools
Expand Down Expand Up @@ -54,6 +53,11 @@

from django.utils.translation import gettext as _

from jobbrowser.conf import LOG_OFFSET, SHARE_JOBS
from jobbrowser.api import get_api, ApplicationNotRunning, JobExpired
from jobbrowser.models import can_view_job, can_kill_job, LinkJobLogs
from jobbrowser.yarn_models import Application

LOG = logging.getLogger()


Expand All @@ -63,11 +67,6 @@
LOG.warning('Hive is not enabled')
def hiveserver2_impersonation_enabled(): return True

from jobbrowser.conf import LOG_OFFSET, SHARE_JOBS
from jobbrowser.api import get_api, ApplicationNotRunning, JobExpired
from jobbrowser.models import can_view_job, can_kill_job, LinkJobLogs
from jobbrowser.yarn_models import Application


LOG_OFFSET_BYTES = LOG_OFFSET.get()

Expand Down
3 changes: 0 additions & 3 deletions apps/jobbrowser/src/jobbrowser/yarn_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import object
import logging
Expand Down
3 changes: 0 additions & 3 deletions apps/metastore/src/metastore/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library

standard_library.install_aliases()
from builtins import object
import json
import logging
Expand Down
2 changes: 0 additions & 2 deletions apps/metastore/src/metastore/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import str
import json
import logging
Expand Down
2 changes: 0 additions & 2 deletions apps/oozie/src/oozie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import range
from past.builtins import basestring
from builtins import object
Expand Down
2 changes: 0 additions & 2 deletions apps/oozie/src/oozie/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import str
from past.builtins import basestring
import json
Expand Down
2 changes: 0 additions & 2 deletions apps/oozie/src/oozie/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import str
import json
import logging
Expand Down
2 changes: 0 additions & 2 deletions apps/pig/src/pig/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import str
import json
import logging
Expand Down
3 changes: 0 additions & 3 deletions apps/proxy/src/proxy/proxy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#
# Tests for proxy app.

from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
import threading
import logging
Expand Down
17 changes: 8 additions & 9 deletions apps/useradmin/src/useradmin/ldap_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
"""

import logging
import re

import desktop.conf
from desktop.lib.python_util import CaseInsensitiveDict

from useradmin.models import User

from django.utils.encoding import smart_str

LOG = logging.getLogger()

Expand All @@ -30,15 +38,6 @@
except ImportError:
LOG.warning('ldap module not found')
SCOPE_SUBTREE = None
import re

import desktop.conf
from desktop.lib.python_util import CaseInsensitiveDict

from useradmin.models import User

from django.utils.encoding import smart_str


CACHED_LDAP_CONN = None

Expand Down
2 changes: 0 additions & 2 deletions apps/useradmin/src/useradmin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
from builtins import object
import json
import ldap
Expand Down
11 changes: 5 additions & 6 deletions apps/useradmin/src/useradmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@
import subprocess
import json

LOG = logging.getLogger()

from axes.conf import settings
from axes.models import AccessAttempt
from axes.utils import reset
try:
import ldap
except ImportError:
LOG.warning('ldap module not found')

from django.urls import reverse
from django.forms import ValidationError
Expand All @@ -56,6 +50,11 @@

from django.utils.translation import get_language, gettext as _

LOG = logging.getLogger()
try:
import ldap
except ImportError:
LOG.warning('ldap module not found')

if ENABLE_ORGANIZATIONS.get():
from useradmin.forms import OrganizationUserChangeForm as UserChangeForm, OrganizationSuperUserChangeForm as SuperUserChangeForm
Expand Down
8 changes: 4 additions & 4 deletions desktop/core/src/desktop/lib/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,9 @@
variables.
"""

# The Config object unfortunately has a kwarg called "type", and everybody is
# using it. So instead of breaking compatibility, we make a "pytype" alias.

from __future__ import print_function
from six import string_types
from builtins import object
pytype = type

import json
import logging
Expand Down Expand Up @@ -100,6 +96,10 @@
# a BoundContainer(BoundConfig) object which has all of the application's configs as members
GLOBAL_CONFIG = None

# The Config object unfortunately has a kwarg called "type", and everybody is
# using it. So instead of breaking compatibility, we make a "pytype" alias.
pytype = type

LOG = logging.getLogger()

__all__ = ["UnspecifiedConfigSection", "ConfigSection", "Config", "load_confs", "coerce_bool", "coerce_csv", "coerce_json_dict"]
Expand Down
5 changes: 2 additions & 3 deletions desktop/core/src/desktop/lib/django_mako.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from django.contrib.staticfiles.storage import staticfiles_storage
from django.http import HttpResponse

from django.template.context_processors import csrf

from mako.lookup import TemplateLookup, TemplateCollection

from desktop.lib import apputil, i18n
Expand Down Expand Up @@ -140,9 +142,6 @@ def url(view_name, *args, **view_args):
return reverse(view_name, args=args, kwargs=view_args)


from django.template.context_processors import csrf


def csrf_token(request):
"""
Returns the rendered common footer
Expand Down
3 changes: 2 additions & 1 deletion desktop/core/src/desktop/lib/django_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@

from desktop.lib.django_test_util import configure_django_for_test, create_tables
from desktop.lib.django_util import reverse_with_get, timesince, humanize_duration
configure_django_for_test()

from desktop.lib import django_util, exceptions
from django.db import models

configure_django_for_test()


class TestModel(models.Model):
class Meta(object):
Expand Down
3 changes: 0 additions & 3 deletions desktop/core/src/desktop/lib/thread_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import logging
import socket
import sys
Expand Down
3 changes: 0 additions & 3 deletions desktop/core/src/desktop/lib/thread_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library
standard_library.install_aliases()
import sys
import threading
import time

Expand Down
3 changes: 0 additions & 3 deletions desktop/core/src/desktop/lib/thrift_sasl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
# under the License.
#
""" SASL transports for Thrift. """
from __future__ import absolute_import

from future import standard_library
standard_library.install_aliases()
from thrift.transport import TTransport
from thrift.transport.TTransport import *
from thrift.protocol import TBinaryProtocol
Expand Down
4 changes: 1 addition & 3 deletions desktop/core/src/desktop/lib/thrift_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from __future__ import division
from future import standard_library
standard_library.install_aliases()

from builtins import map
from builtins import range
from past.builtins import basestring
Expand Down
3 changes: 0 additions & 3 deletions desktop/core/src/desktop/manage_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import logging
import os
import os.path
Expand Down
6 changes: 3 additions & 3 deletions desktop/core/src/desktop/management/commands/runcelery.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

from django.utils.translation import gettext as _

from celery.bin.celery import CeleryCommand
from celery.bin.celery import main as celery_main

SERVER_HELP = r"""
Run celery worker.
"""

from celery.bin.celery import CeleryCommand
from celery.bin.celery import main as celery_main

LOG = logging.getLogger()
CELERY_OPTIONS = {
'server_user': conf.SERVER_USER.get(),
Expand Down
3 changes: 0 additions & 3 deletions desktop/core/src/desktop/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from future import standard_library

standard_library.install_aliases()
import json
import logging
import os
Expand Down
9 changes: 4 additions & 5 deletions desktop/libs/aws/src/aws/s3/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
"""

import io
from future import standard_library
standard_library.install_aliases()
import logging
import unicodedata

Expand All @@ -35,18 +33,19 @@

from desktop.conf import TASK_SERVER
from desktop.lib.fsmanager import get_client
from desktop.lib.exceptions_renderable import PopupException
from aws.s3 import parse_uri
from aws.s3.s3fs import S3FileSystemException

from filebrowser.utils import generate_chunks, calculate_total_size


from django.utils.translation import gettext as _

DEFAULT_WRITE_SIZE = 1024 * 1024 * 128 # TODO: set in configuration (currently 128 MiB)

LOG = logging.getLogger()

from desktop.lib.exceptions_renderable import PopupException
from filebrowser.utils import generate_chunks, calculate_total_size


class S3FineUploaderChunkedUpload(object):
def __init__(self, request, *args, **kwargs):
Expand Down
8 changes: 3 additions & 5 deletions desktop/libs/azure/src/azure/abfs/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from future import standard_library
standard_library.install_aliases()

import logging
import sys
import unicodedata

from io import StringIO as string_io
Expand All @@ -30,14 +28,14 @@
from azure.abfs.__init__ import parse_uri
from azure.abfs.abfs import ABFSFileSystemException

from filebrowser.utils import generate_chunks, calculate_total_size

from django.utils.translation import gettext as _

DEFAULT_WRITE_SIZE = 100 * 1024 * 1024 # As per Azure doc, maximum blob size is 100MB

LOG = logging.getLogger()

from filebrowser.utils import generate_chunks, calculate_total_size


class ABFSFineUploaderChunkedUpload(object):
def __init__(self, request, *args, **kwargs):
Expand Down
Loading

0 comments on commit 7873dbb

Please sign in to comment.