compatibility to python 3.6 ...

This commit is contained in:
Steve Nyemba 2019-11-04 21:51:20 -06:00
parent 92d4e952e1
commit d0a0334f7a
5 changed files with 45 additions and 17 deletions

View File

@ -45,12 +45,24 @@ __author__ = 'The Phi Technology'
import numpy as np
import json
import importlib
from common import Reader, Writer #, factory
import disk
import queue
import couch
import mongo
import s3
import sys
if sys.version_info[0] > 2 :
from transport.common import Reader, Writer #, factory
from transport import disk
from transport import queue as queue
from transport import couch as couch
from transport import mongo as mongo
from transport import s3 as s3
else:
from common import Reader, Writer #, factory
import disk
import queue
import couch
import mongo
import s3
class factory :
@staticmethod
def instance(**args):
@ -78,7 +90,7 @@ class factory :
try:
anObject = eval( aClassName)
#setattr(anObject,'name',source)
except Exception,e:
except Exception as e:
print ['Error ',e]
return anObject

View File

@ -7,7 +7,11 @@ This file is a wrapper around couchdb using IBM Cloudant SDK that has an interfa
"""
import cloudant
import json
from common import Reader,Writer
import sys
if sys.version_info[0] > 2 :
from transport.common import Reader, Writer
else:
from common import Reader, Writer
class Couch:
"""
This class is a wrapper for read/write against couchdb. The class captures common operations for read/write.

View File

@ -6,7 +6,11 @@ This file is a wrapper around mongodb for reading/writing content against a mong
"""
from pymongo import MongoClient
# from transport import Reader,Writer
from common import Reader, Writer
import sys
if sys.version_info[0] > 2 :
from transport.common import Reader, Writer
else:
from common import Reader, Writer
import json
class Mongo :
"""

View File

@ -10,7 +10,11 @@ from datetime import datetime
import re
import json
import os
from common import Reader, Writer
import sys
if sys.version_info[0] > 2 :
from transport.common import Reader, Writer
else:
from common import Reader, Writer
import json
class MessageQueue:

View File

@ -8,9 +8,13 @@ from datetime import datetime
import boto
import botocore
from smart_open import smart_open
from common import Reader, Writer
import sys
if sys.version_info[0] > 2 :
from transport.common import Reader, Writer
else:
from common import Reader, Writer
import json
from common import Reader, Writer
class s3 :
"""