Making cue client python3 compatible

Change-Id: Ic4df05376b053d9c2193bd5a8e6ac2ba1e736722
This commit is contained in:
Steve Leon 2015-08-10 10:23:52 -07:00 committed by Min Pae
parent 50c5360d57
commit 55248186d7
3 changed files with 11 additions and 7 deletions

View File

@ -15,9 +15,9 @@
# under the License.
import abc
import json
from urllib import urlencode
import six
from six.moves.urllib.parse import urlencode
@six.add_metaclass(abc.ABCMeta)

View File

@ -1,3 +1,4 @@
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2012-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -55,7 +56,7 @@ def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):
return tuple(row)
def resource_string(*args, **kwargs):
def resource_filename(*args, **kwargs):
"""Return specified resource as a string"""
if len(args) == 0:
raise ValueError()
@ -73,12 +74,15 @@ def resource_string(*args, **kwargs):
# 'resource: %s' % resource_path)
pass
return pkg_resources.resource_string(package, resource_path)
return pkg_resources.resource_filename(package, resource_path)
def load_schema(version, name, package=None):
"""Load json schema from resources"""
schema_string = resource_string('schemas', version, '%s.json' % name,
package=package)
schema_filename = resource_filename('schemas', version, '%s.json' % name,
package=package)
return json.loads(schema_string)
with open(schema_filename) as schema_file:
schema_json = json.load(schema_file)
return schema_json

View File

@ -1,5 +1,5 @@
[tox]
envlist = py27,flake8
envlist = py27,py34,flake8
minversion = 1.6
[testenv]