7620: Start removing dependencies on requests (#7643)

* 7620: Start removing dependencies on requests

* Patch urllib.request.urlopen instead of requests.get

* Try to fix flake8

* More work on flake8 import errors

* First attempt at using urllib with cookies

* Fix pylint/flake8

* Fix test_deliver_slice_csv_attachment

* Fix test_deliver_slice_csv_inline

* Import requests and pydruid conditionally, remove dependency on prison

* Fix flake errors

* Fix load_examples

* Please flake

* Skip tests depending on optional deps

* Try to please flake

* Address review comments

* Remove Druid-related UI

* Revert "Remove Druid-related UI"

This reverts commit d7e0f166cc3f3dd2496b4a666e177f0c191aeb0f.

* Skip a few tests more

* Put imports in right order

* Apply black patch

* Please flake

* Please black, silence flake

* Use flake8 silencing the right way

* Add deps for CI
This commit is contained in:
Gianluca Ciccarelli
2019-08-02 20:01:28 +03:00
committed by Maxime Beauchemin
parent cbac428b28
commit e23920b8ba
13 changed files with 249 additions and 82 deletions

View File

@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
# pylint: disable=C,R,W
# flake8: noqa I202
"""Utility functions used across Superset"""
from datetime import date, datetime, time, timedelta
import decimal
@@ -51,7 +52,11 @@ import markdown as md
import numpy
import pandas as pd
import parsedatetime
from pydruid.utils.having import Having
try:
from pydruid.utils.having import Having
except ImportError:
pass
import sqlalchemy as sa
from sqlalchemy import event, exc, select, Text
from sqlalchemy.dialects.mysql import MEDIUMTEXT
@@ -72,6 +77,25 @@ JS_MAX_INTEGER = 9007199254740991 # Largest int Java Script can handle 2^53-1
sources = {"chart": 0, "dashboard": 1, "sql_lab": 2}
try:
# Having might not have been imported.
class DimSelector(Having):
def __init__(self, **args):
# Just a hack to prevent any exceptions
Having.__init__(self, type="equalTo", aggregation=None, value=None)
self.having = {
"having": {
"type": "dimSelector",
"dimension": args["dimension"],
"value": args["value"],
}
}
except NameError:
pass
def flasher(msg, severity=None):
"""Flask's flash if available, logging call if not"""
@@ -179,20 +203,6 @@ def string_to_num(s: str):
return None
class DimSelector(Having):
def __init__(self, **args):
# Just a hack to prevent any exceptions
Having.__init__(self, type="equalTo", aggregation=None, value=None)
self.having = {
"having": {
"type": "dimSelector",
"dimension": args["dimension"],
"value": args["value"],
}
}
def list_minus(l: List, minus: List) -> List:
"""Returns l without what is in minus