mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Optimise Python imports.
This commit is contained in:
@@ -7,11 +7,13 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from flask import Blueprint
|
||||
from collections import defaultdict
|
||||
from operator import attrgetter
|
||||
from .preferences import Preferences
|
||||
|
||||
from flask import Blueprint
|
||||
|
||||
from .paths import get_storage_directory
|
||||
from .preferences import Preferences
|
||||
|
||||
|
||||
class PgAdminModule(Blueprint):
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
|
||||
"""Utility functions for dealing with AJAX."""
|
||||
|
||||
from flask import Response
|
||||
from flask.ext.babel import gettext as _
|
||||
import simplejson as json
|
||||
import datetime
|
||||
import decimal
|
||||
|
||||
import simplejson as json
|
||||
from flask import Response
|
||||
from flask.ext.babel import gettext as _
|
||||
|
||||
|
||||
class DataTypeJSONEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
"""This File Provides Cryptography."""
|
||||
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto import Random
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
from Crypto import Random
|
||||
from Crypto.Cipher import AES
|
||||
|
||||
padding_string = b'}'
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
##########################################################################
|
||||
|
||||
from flask import current_app
|
||||
|
||||
from .registry import DriverRegistry
|
||||
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
"""Implement the Base class for Driver and Connection"""
|
||||
|
||||
from abc import ABCMeta, abstractmethod, abstractproperty
|
||||
from .registry import DriverRegistry
|
||||
|
||||
import six
|
||||
|
||||
from .registry import DriverRegistry
|
||||
|
||||
|
||||
@six.add_metaclass(DriverRegistry)
|
||||
class BaseDriver(object):
|
||||
|
||||
@@ -20,18 +20,16 @@ import select
|
||||
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from psycopg2.extensions import adapt
|
||||
|
||||
from flask import g, current_app, session
|
||||
from flask.ext.babel import gettext
|
||||
from flask.ext.security import current_user
|
||||
from pgadmin.utils.crypto import decrypt
|
||||
from psycopg2.extensions import adapt
|
||||
|
||||
import config
|
||||
from pgadmin.model import Server, User
|
||||
from pgadmin.utils.crypto import decrypt
|
||||
from ..abstract import BaseDriver, BaseConnection
|
||||
from .keywords import ScanKeyword
|
||||
|
||||
from ..abstract import BaseDriver, BaseConnection
|
||||
|
||||
_ = gettext
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
|
||||
if __name__ == '__main__':
|
||||
include_dir = os.popen('pg_config --includedir').read().rstrip()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
##########################################################################
|
||||
|
||||
from abc import ABCMeta
|
||||
|
||||
from flask.ext.babel import gettext
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
PRIORITY = 100
|
||||
|
||||
class MenuItem(object):
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
"""This file contains functions fetching different utility paths."""
|
||||
|
||||
import os
|
||||
|
||||
from flask.ext.security import current_user, login_required
|
||||
|
||||
import config
|
||||
|
||||
|
||||
|
||||
@@ -12,14 +12,16 @@ Utility classes to register, getter, setter functions for the preferences of a
|
||||
module within the system.
|
||||
"""
|
||||
|
||||
import decimal
|
||||
|
||||
import dateutil.parser as dateutil_parser
|
||||
from flask import current_app
|
||||
from flask.ext.babel import gettext
|
||||
from flask.ext.security import current_user
|
||||
|
||||
from pgadmin.model import db, Preferences as PrefTable, \
|
||||
ModulePreference as ModulePrefTable, UserPreference as UserPrefTable, \
|
||||
PreferenceCategory as PrefCategoryTbl
|
||||
from flask.ext.babel import gettext
|
||||
import dateutil.parser as dateutil_parser
|
||||
import decimal
|
||||
|
||||
|
||||
class _Preference(object):
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#
|
||||
##############################################################
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import unittest
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
|
||||
class TestsGeneratorRegistry(ABCMeta):
|
||||
|
||||
@@ -15,10 +15,11 @@ Credit/Reference: http://flask.pocoo.org/snippets/86/
|
||||
Modified to support both Python 2.6+ & Python 3.x
|
||||
"""
|
||||
|
||||
import os
|
||||
import errno
|
||||
import os
|
||||
import sqlite3
|
||||
from uuid import uuid4
|
||||
|
||||
try:
|
||||
from cPickle import dumps, loads
|
||||
except:
|
||||
|
||||
@@ -9,21 +9,23 @@
|
||||
|
||||
"""A blueprint module implementing the sql auto complete feature."""
|
||||
|
||||
import sys
|
||||
import re
|
||||
import sqlparse
|
||||
import itertools
|
||||
import operator
|
||||
import re
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
|
||||
import sqlparse
|
||||
from flask import render_template
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from sqlparse.sql import Comparison, Identifier, Where
|
||||
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from .completion import Completion
|
||||
from .function_metadata import FunctionMetadata
|
||||
from .parseutils import (
|
||||
last_word, extract_tables, find_prev_keyword, parse_partial_identifier)
|
||||
from .prioritization import PrevalenceCounter
|
||||
from .completion import Completion
|
||||
from .function_metadata import FunctionMetadata
|
||||
from flask import render_template
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
@@ -4,8 +4,6 @@ Using Completion class from
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from six import with_metaclass
|
||||
|
||||
__all__ = (
|
||||
'Completion'
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Copied from http://code.activestate.com/recipes/576611-counter-class/
|
||||
"""
|
||||
|
||||
from operator import itemgetter
|
||||
from heapq import nlargest
|
||||
from itertools import repeat, ifilter
|
||||
from operator import itemgetter
|
||||
|
||||
|
||||
class Counter(dict):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import re
|
||||
|
||||
import sqlparse
|
||||
from sqlparse.tokens import Whitespace, Comment, Keyword, Name, Punctuation
|
||||
|
||||
|
||||
table_def_regex = re.compile(r'^TABLE\s*\((.+)\)$', re.IGNORECASE)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import re
|
||||
import sqlparse
|
||||
from collections import namedtuple
|
||||
|
||||
import sqlparse
|
||||
from sqlparse.sql import IdentifierList, Identifier, Function
|
||||
from sqlparse.tokens import Keyword, DML, Punctuation, Token, Error
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
import sqlparse
|
||||
from sqlparse.tokens import Name
|
||||
from collections import defaultdict
|
||||
|
||||
white_space_regex = re.compile('\\s+', re.MULTILINE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user