P4: Fix pep8 error in cyborg/api
Change-Id: I46699623b99add526aff2121e60ad7e88c107da1
This commit is contained in:
parent
1e7561a0f3
commit
e8a3803615
@ -31,9 +31,8 @@ class APIBase(wtypes.Base):
|
|||||||
|
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
"""Render this object as a dict of its fields."""
|
"""Render this object as a dict of its fields."""
|
||||||
return dict((k, getattr(self, k))
|
return {k: getattr(self, k) for k in self.fields
|
||||||
for k in self.fields
|
if hasattr(self, k) and getattr(self, k) != wsme.Unset}
|
||||||
if hasattr(self, k) and getattr(self, k) != wsme.Unset)
|
|
||||||
|
|
||||||
|
|
||||||
class CyborgController(rest.RestController):
|
class CyborgController(rest.RestController):
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import pecan
|
|
||||||
from six.moves import http_client
|
from six.moves import http_client
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
@ -23,11 +22,8 @@ from cyborg.api.controllers import base
|
|||||||
from cyborg.api.controllers import link
|
from cyborg.api.controllers import link
|
||||||
from cyborg.api.controllers.v1 import deployables
|
from cyborg.api.controllers.v1 import deployables
|
||||||
from cyborg.api.controllers.v1 import types
|
from cyborg.api.controllers.v1 import types
|
||||||
from cyborg.api.controllers.v1 import utils as api_utils
|
|
||||||
from cyborg.api import expose
|
from cyborg.api import expose
|
||||||
from cyborg.common import exception
|
|
||||||
from cyborg.common import policy
|
from cyborg.common import policy
|
||||||
from cyborg import objects
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
@ -195,5 +191,4 @@ class AcceleratorsController(AcceleratorsControllerBase):
|
|||||||
:param uuid: UUID of an accelerator.
|
:param uuid: UUID of an accelerator.
|
||||||
"""
|
"""
|
||||||
LOG.warning("v1 APIs for accelerator objects are deprecated.")
|
LOG.warning("v1 APIs for accelerator objects are deprecated.")
|
||||||
context = pecan.request.context
|
pass
|
||||||
obj_acc = self._resource or self._get_resource(uuid)
|
|
||||||
|
@ -130,7 +130,7 @@ class DeployablesController(base.CyborgController):
|
|||||||
obj_dep = objects.Deployable.get(pecan.request.context, uuid)
|
obj_dep = objects.Deployable.get(pecan.request.context, uuid)
|
||||||
# Set attribute of the new bitstream/image information
|
# Set attribute of the new bitstream/image information
|
||||||
obj_dep.add_attribute(pecan.request.context, 'image_uuid', image_uuid)
|
obj_dep.add_attribute(pecan.request.context, 'image_uuid', image_uuid)
|
||||||
# TODO (Li Liu) Trigger the program api in Agnet.
|
# TODO(Li Liu) Trigger the program api in Agnet.
|
||||||
agent_api.program_fpga_with_bitstream(pecan.request.context,
|
agent_api.program_fpga_with_bitstream(pecan.request.context,
|
||||||
uuid,
|
uuid,
|
||||||
image_uuid)
|
image_uuid)
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import wsme
|
import wsme
|
||||||
@ -90,7 +90,7 @@ class JsonType(wtypes.UserType):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def validate(value):
|
def validate(value):
|
||||||
try:
|
try:
|
||||||
json.dumps(value)
|
jsonutils.dumps(value)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise exception.InvalidJsonType(value=value)
|
raise exception.InvalidJsonType(value=value)
|
||||||
else:
|
else:
|
||||||
|
2
tox.ini
2
tox.ini
@ -107,7 +107,7 @@ show-source = True
|
|||||||
ignore = E123,E125,H405
|
ignore = E123,E125,H405
|
||||||
builtins = _
|
builtins = _
|
||||||
enable-extensions = H106,H203,H904
|
enable-extensions = H106,H203,H904
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes,cyborg/accelerator/,cyborg/api,cyborg/agent/,cyborg/db,dyborg/hacking/,cyborg/tests/,cyborg/image,cyborg/objects
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes,cyborg/accelerator/,cyborg/agent/,cyborg/db,dyborg/hacking/,cyborg/tests/,cyborg/image,cyborg/objects
|
||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
local-check-factory = cyborg.hacking.checks.factory
|
local-check-factory = cyborg.hacking.checks.factory
|
||||||
|
Loading…
Reference in New Issue
Block a user