Skip to content

Commit

Permalink
Fix warning about flask JSONEncoder deprecation (mindsdb#8869)
Browse files Browse the repository at this point in the history
* fix jsonencoder warning

* remove whitespace
  • Loading branch information
hamishfagg authored Mar 11, 2024
1 parent 3925869 commit 992af66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
9 changes: 2 additions & 7 deletions mindsdb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import secrets
import traceback
import threading
from textwrap import dedent
from packaging import version

from mindsdb.__about__ import __version__ as mindsdb_version
Expand Down Expand Up @@ -209,12 +208,8 @@ def do_clean_process_marks():
import_meta = handler_meta.get("import", {})
if import_meta.get("success", False) is not True:
logger.info(
dedent(
"""
Some handlers cannot be imported. You can check list of available handlers by execute command in sql editor:
select * from information_schema.handlers;
"""
)
"""Some handlers cannot be imported. You can check list of available handlers by execute command in sql editor:
select * from information_schema.handlers;"""
)
break
# @TODO Backwards compatibility for tests, remove later
Expand Down
5 changes: 2 additions & 3 deletions mindsdb/api/mongo/utilities/mongodb_query.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import datetime as dt
from json import JSONEncoder

import json
from bson import ObjectId


class MongoJSONEncoder(JSONEncoder):
class MongoJSONEncoder(json.JSONEncoder):

def default(self, obj):
if isinstance(obj, dt.datetime):
Expand Down
4 changes: 2 additions & 2 deletions mindsdb/utilities/json_encoder.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime, date, timedelta
from decimal import Decimal
import numpy as np
from flask.json import JSONEncoder
import pandas as pd
import json


class CustomJSONEncoder(JSONEncoder):
class CustomJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarray):
return obj.tolist()
Expand Down

0 comments on commit 992af66

Please sign in to comment.