Skip to content

Commit

Permalink
Optimizing import statements for better readability and to avoid unus…
Browse files Browse the repository at this point in the history
…ed, excessive and duplicating imports in the project. (#294)
  • Loading branch information
sid88in authored and mistercrunch committed Apr 8, 2016
1 parent ee42aa7 commit eff0beb
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 38 deletions.
4 changes: 2 additions & 2 deletions caravel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import logging
import os

from flask import Flask, redirect
from flask.ext.appbuilder import SQLA, AppBuilder, IndexView
from flask.ext.appbuilder.baseviews import expose
from flask.ext.migrate import Migrate
from flask.ext.cache import Cache

from flask.ext.migrate import Migrate

APP_DIR = os.path.dirname(__file__)
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')
Expand Down
9 changes: 5 additions & 4 deletions caravel/bin/caravel
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from datetime import datetime
import logging
from datetime import datetime
from subprocess import Popen

from flask.ext.script import Manager
from caravel import app
from flask.ext.migrate import MigrateCommand
from flask.ext.script import Manager

import caravel
from caravel import db
from caravel import app
from caravel import data, utils
from caravel import db

config = app.config

Expand Down
3 changes: 2 additions & 1 deletion caravel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from __future__ import unicode_literals

import os
from flask_appbuilder.security.manager import AUTH_DB

from dateutil import tz
from flask_appbuilder.security.manager import AUTH_DB

BASE_DIR = os.path.abspath(os.path.dirname(__file__))

Expand Down
7 changes: 5 additions & 2 deletions caravel/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
from __future__ import print_function
from __future__ import unicode_literals

from collections import OrderedDict
from copy import copy

from wtforms import (
Form, SelectMultipleField, SelectField, TextField, TextAreaField,
BooleanField, IntegerField, HiddenField)
from wtforms import validators, widgets
from copy import copy

from caravel import app
from collections import OrderedDict

config = app.config


Expand Down
8 changes: 5 additions & 3 deletions caravel/migrations/env.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig

import logging
from logging.config import fileConfig

from alembic import context
from flask.ext.appbuilder import Base
from sqlalchemy import engine_from_config, pool

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
21 changes: 10 additions & 11 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,38 @@
from __future__ import print_function
from __future__ import unicode_literals

from copy import deepcopy, copy
from collections import namedtuple
from datetime import timedelta, datetime, date
import functools
import json
import logging
from six import string_types
import sqlparse
import requests
import textwrap
from collections import namedtuple
from copy import deepcopy, copy
from datetime import timedelta, datetime, date

import humanize
import pandas as pd
import requests
import sqlalchemy as sqla
import sqlparse
from dateutil.parser import parse
from flask import flash, request, g
from flask.ext.appbuilder import Model
from flask.ext.appbuilder.models.mixins import AuditMixin
import pandas as pd
import humanize
from pydruid import client
from pydruid.utils.filters import Dimension, Filter

import sqlalchemy as sqla
from six import string_types
from sqlalchemy import (
Column, Integer, String, ForeignKey, Text, Boolean, DateTime, Date,
Table, create_engine, MetaData, desc, select, and_, func)
from sqlalchemy.engine import reflection
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship
from sqlalchemy.sql import table, literal_column, text, column
from sqlalchemy.sql.elements import ColumnClause
from sqlalchemy_utils import EncryptedType

from caravel import app, db, get_session, utils
from caravel.viz import viz_types
from sqlalchemy.ext.declarative import declared_attr

config = app.config

Expand Down
8 changes: 4 additions & 4 deletions caravel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
from __future__ import print_function
from __future__ import unicode_literals

from datetime import datetime
import functools
import json
import logging
from datetime import datetime

from dateutil.parser import parse
from sqlalchemy.types import TypeDecorator, TEXT
from markdown import markdown as md
import parsedatetime
from dateutil.parser import parse
from flask import Markup
from flask_appbuilder.security.sqla import models as ab_models
from markdown import markdown as md
from sqlalchemy.types import TypeDecorator, TEXT


class memoized(object): # noqa
Expand Down
8 changes: 4 additions & 4 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from __future__ import print_function
from __future__ import unicode_literals

from datetime import datetime
import json
import logging
import re
import time
import traceback
from datetime import datetime

import pandas as pd
import sqlalchemy as sqla
from flask import (
g, request, redirect, flash, Response, render_template, Markup)
from flask.ext.appbuilder import ModelView, CompactCRUDMixin, BaseView, expose
Expand All @@ -19,12 +21,10 @@
from flask.ext.appbuilder.security.decorators import has_access
from pydruid.client import doublesum
from sqlalchemy import create_engine
import sqlalchemy as sqla
from wtforms.validators import ValidationError
import pandas as pd
from sqlalchemy import select, text
from sqlalchemy.sql.expression import TextAsFrom
from werkzeug.routing import BaseConverter
from wtforms.validators import ValidationError

from caravel import appbuilder, db, models, viz, utils, app, sm, ascii_art

Expand Down
11 changes: 5 additions & 6 deletions caravel/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@
from __future__ import print_function
from __future__ import unicode_literals

from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta
import hashlib
import json
import logging
import uuid
import hashlib
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta

import pandas as pd
from flask import flash, request, Markup
from markdown import markdown
from pandas.io.json import dumps
from six import string_types
from werkzeug.datastructures import ImmutableMultiDict
from werkzeug.urls import Href
import pandas as pd

from caravel import app, utils, cache
from caravel.forms import FormFactory

from six import string_types

config = app.config


Expand Down
2 changes: 1 addition & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import imp
import doctest
import imp
import os
import unittest

Expand Down

0 comments on commit eff0beb

Please sign in to comment.