Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Jul 11, 2023
1 parent 05eaf9c commit c0599fd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion girder/girder_large_image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
from .loadmodelcache import invalidateLoadModelCache
from .models.image_item import ImageItem
from .rest import addSystemEndpoints
from .rest.item_meta import InternalMetadataItemResource
from .rest.large_image_resource import LargeImageResource
from .rest.tiles import TilesItemResource
from .rest.item_meta import InternalMetadataItemResource

try:
from importlib.metadata import PackageNotFoundError
Expand Down
66 changes: 33 additions & 33 deletions girder/girder_large_image/rest/item_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,83 +17,83 @@
from girder.api import access
from girder.api.describe import Description, describeRoute
from girder.api.rest import loadmodel
from girder.constants import AccessType, TokenScope
from girder.api.v1.item import Item
from girder.constants import AccessType, TokenScope


class InternalMetadataItemResource(Item):
def __init__(self, apiRoot):
super().__init__()
apiRoot.item.route(
"GET", (":itemId", "internal_metadata", ":key"), self.getMetadataKey
'GET', (':itemId', 'internal_metadata', ':key'), self.getMetadataKey
)
apiRoot.item.route(
"PUT", (":itemId", "internal_metadata", ":key"), self.updateMetadataKey
'PUT', (':itemId', 'internal_metadata', ':key'), self.updateMetadataKey
)
apiRoot.item.route(
"DELETE", (":itemId", "internal_metadata", ":key"), self.deleteMetadataKey
'DELETE', (':itemId', 'internal_metadata', ':key'), self.deleteMetadataKey
)

@describeRoute(
Description("Get the value for a single internal metadata key on this item.")
.param("itemId", "The ID of the item.", paramType="path")
Description('Get the value for a single internal metadata key on this item.')
.param('itemId', 'The ID of the item.', paramType='path')
.param(
"key",
"The metadata key to retrieve.",
paramType="path",
default="meta",
'key',
'The metadata key to retrieve.',
paramType='path',
default='meta',
)
.errorResponse("ID was invalid.")
.errorResponse("Read access was denied for the item.", 403)
.errorResponse('ID was invalid.')
.errorResponse('Read access was denied for the item.', 403)
)
@access.user(scope=TokenScope.DATA_READ)
@loadmodel(model="item", map={"itemId": "item"}, level=AccessType.READ)
@loadmodel(model='item', map={'itemId': 'item'}, level=AccessType.READ)
def getMetadataKey(self, item, key, params):
if key not in item:
return None
return item[key]

@describeRoute(
Description(
"Overwrite the value for a single internal metadata key on this item."
'Overwrite the value for a single internal metadata key on this item.'
)
.param("itemId", "The ID of the item.", paramType="path")
.param('itemId', 'The ID of the item.', paramType='path')
.param(
"key",
'key',
'The metadata key which should have a new value. \
The default key, "meta" is equivalent to the external metadata. \
Editing the "meta" key is equivalent to using PUT /item/{id}/metadata.',
paramType="path",
default="meta",
paramType='path',
default='meta',
)
.param(
"value",
"The new value that should be written for the chosen metadata key",
paramType="body",
'value',
'The new value that should be written for the chosen metadata key',
paramType='body',
)
.errorResponse("ID was invalid.")
.errorResponse("Write access was denied for the item.", 403)
.errorResponse('ID was invalid.')
.errorResponse('Write access was denied for the item.', 403)
)
@access.user(scope=TokenScope.DATA_WRITE)
@loadmodel(model="item", map={"itemId": "item"}, level=AccessType.WRITE)
@loadmodel(model='item', map={'itemId': 'item'}, level=AccessType.WRITE)
def updateMetadataKey(self, item, key, params):
item[key] = self.getBodyJson()
self._model.save(item)

@describeRoute(
Description("Delete a single internal metadata key on this item.")
.param("itemId", "The ID of the item.", paramType="path")
Description('Delete a single internal metadata key on this item.')
.param('itemId', 'The ID of the item.', paramType='path')
.param(
"key",
"The metadata key to delete.",
paramType="path",
default="meta",
'key',
'The metadata key to delete.',
paramType='path',
default='meta',
)
.errorResponse("ID was invalid.")
.errorResponse("Write access was denied for the item.", 403)
.errorResponse('ID was invalid.')
.errorResponse('Write access was denied for the item.', 403)
)
@access.user(scope=TokenScope.DATA_WRITE)
@loadmodel(model="item", map={"itemId": "item"}, level=AccessType.READ)
@loadmodel(model='item', map={'itemId': 'item'}, level=AccessType.READ)
def deleteMetadataKey(self, item, key, params):
if key in item:
del item[key]
Expand Down

0 comments on commit c0599fd

Please sign in to comment.