Skip to content

Commit

Permalink
Merge branch 'master' into amend-dicomweb-assetstore
Browse files Browse the repository at this point in the history
  • Loading branch information
willdunklin authored Oct 17, 2023
2 parents c959266 + 97b63b3 commit 750884d
Show file tree
Hide file tree
Showing 43 changed files with 204 additions and 58 deletions.
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ jobs:
- coverage
- store_artifacts:
path: build/test/artifacts
py312:
machine:
image: ubuntu-2004:202111-02
steps:
- checkout
- allservices:
version: "3.12"
node: v14
- tox:
env: test-py312
- coverage
- store_artifacts:
path: build/test/artifacts
lint_and_docs:
executor: toxandnode
steps:
Expand Down Expand Up @@ -318,6 +331,13 @@ workflows:
branches:
ignore:
- gh-pages
- py312:
filters:
tags:
only: /^v.*/
branches:
ignore:
- gh-pages
- lint_and_docs:
filters:
tags:
Expand All @@ -333,6 +353,7 @@ workflows:
- py39
- py310
- py311
- py312
- lint_and_docs
filters:
tags:
Expand All @@ -348,6 +369,7 @@ workflows:
- py39
- py310
- py311
- py312
- lint_and_docs
filters:
tags:
Expand All @@ -362,6 +384,7 @@ workflows:
- py39
- py310
- py311
- py312
- lint_and_docs
filters:
tags:
Expand All @@ -386,5 +409,6 @@ workflows:
- py39
- py310
- py311
- py312
- lint_and_docs
- wheels
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand Down Expand Up @@ -44,7 +44,7 @@ repos:
files: README.rst
name: rst-linter of README.rst
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args:
Expand All @@ -62,15 +62,15 @@ repos:
- '--options'
- './girder/girder_large_image/web_client/package.json'
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py36-plus
- --keep-percent-format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.286
rev: v0.1.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

### Improvements
- Style can specify a dtype of 'source' to maintain the original dtype even when compositing frames ([#1326](../../pull/1326))
- Max Merge option in Frame Selector ([#1306](../../pull/1306))
- Max Merge option in Frame Selector ([#1306](../../pull/1306), [#1330](../../pull/1330), [#1336](../../pull/1336))
- Improve tifffile associated image detection ([#1333](../../pull/1333))
- Guard against throwing a javascript warning ([#1337](../../pull/1337))
- Test on Python 3.12 ([#1335](../../pull/1335))

### Changes
- Prohibit bioformats and vips from reading mrxs directly ([#1328](../../pull/1328))
- Handle Python 3.12 deprecating utcnow ([#1331](../../pull/1331))
- Turn down logging about annotation ACLs ([#1332](../../pull/1332))

## 1.25.0

Expand Down Expand Up @@ -493,7 +498,7 @@
## 1.15.1

### Improvements
- When scaling heatmap annoations, use an appropriate value ([#878](../../pull/878))
- When scaling heatmap annotations, use an appropriate value ([#878](../../pull/878))
- Use the girder client build time for cache control ([#879](../../pull/879))

## 1.15.0
Expand Down
4 changes: 2 additions & 2 deletions docs/girder_config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ This is used to specify a list of preset defaults, in order of precedence.
These presets are to be automatically applied to an image in this folder if they are applicable.
In the case that a preset is not applicable to an image, the next item in this list will be used.

** Important: the presets named in this list must have corresponding entries in the `imageFramePresets` configuration, else this configuration will have no effect. **
** Important: the presets named in this list must have corresponding entries in the ``imageFramePresets`` configuration, else this configuration will have no effect. **

::

Expand All @@ -362,7 +362,7 @@ In the case that a preset is not applicable to an image, the next item in this l
::

---
# This example would be used with the example for `imageFramePresets` shown above.
# This example would be used with the example for ``imageFramePresets`` shown above.
# Images with 7 or more channels would use "Auto Ranged Channels"
# Images with fewer than 7 but at least 4 channels would use "Channels with Min and Max"
# Images with 3 channels would use "3 channels"
Expand Down
3 changes: 2 additions & 1 deletion girder/girder_large_image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def _updateJob(event):
'status': status,
},
user={'_id': job.get('userId')},
expires=datetime.datetime.utcnow() + datetime.timedelta(seconds=30))
expires=(datetime.datetime.now(datetime.timezone.utc) +
datetime.timedelta(seconds=30)))


def checkForLargeImageFiles(event):
Expand Down
10 changes: 7 additions & 3 deletions girder/girder_large_image/rest/large_image_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ def cacheClear(self, params):
time.sleep(0.1)
after = cache_util.cachesInfo()
gc.collect()
return {'cacheCleared': datetime.datetime.utcnow(), 'before': before, 'after': after}
return {
'cacheCleared': datetime.datetime.now(datetime.timezone.utc),
'before': before,
'after': after,
}

@describeRoute(
Description('Get information on caches.'),
Expand Down Expand Up @@ -671,5 +675,5 @@ def run(self):
restart = Restart(cherrypy.engine)
restart.subscribe()
restart.start()
return {'restarted': datetime.datetime.utcnow()}
return {'status': 'updated', 'time': datetime.datetime.utcnow()}
return {'restarted': datetime.datetime.now(datetime.timezone.utc)}
return {'status': 'updated', 'time': datetime.datetime.now(datetime.timezone.utc)}
16 changes: 13 additions & 3 deletions girder/girder_large_image/web_client/vue/components/DualInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
:disabled="merge"
>
</td>
<td style="width: 100%">
<td class="slider-control-cell">
<input
v-model="value"
type="range"
Expand All @@ -64,13 +64,13 @@ export default {
</td>
<td
v-show="merge !== undefined"
style="min-width: 150px; text-align: right;"
class="max-merge-cell"
:title="'Max Merge ' + label"
>
<input
:id="'maxMerge'+label"
v-model="merge"
type="checkbox"
style="margin: 0px 5px 0px 10px"
>
<label :for="'maxMerge'+label">Max Merge</label>
</td>
Expand Down Expand Up @@ -110,4 +110,14 @@ export default {
top: -1px;
left: 50%;
}
.slider-control-cell {
width: 100%;
}
.max-merge-cell {
min-width: 125px;
text-align: right;
}
.max-merge-cell input[type="checkbox"] {
margin: 0px 2px 0px 0px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default Vue.extend({
this.histogramParamStyles = {};
Array.from([2, 3]).forEach((modeID) => {
const mergedStyle = this.maxMergeStyle();
if (mergedStyle.bands.length) {
if (mergedStyle && mergedStyle.bands && mergedStyle.bands.length) {
const simpleMergedStyleString = JSON.stringify({
dtype: 'source',
bands: mergedStyle.bands.map((b) => ({
Expand Down Expand Up @@ -173,7 +173,7 @@ export default Vue.extend({
// no max merge permutations to apply, keep old bandsArray
newBandsArray = bandsArray;
}
return {bands: newBandsArray};
return newBandsArray.length ? {bands: newBandsArray} : style;
},
fillMetadata() {
if (!this.metadata.frames) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
if (presets) {
this.itemPresets = presets;
}
if (this.liConfig.imageFramePresets) {
if (this.liConfig && this.liConfig.imageFramePresets) {
this.folderPresets = this.liConfig.imageFramePresets.filter(this.presetApplicable);
if (this.liConfig.imageFramePresetDefaults) {
this.liConfig.imageFramePresetDefaults.every(({name}) => {
Expand Down
1 change: 1 addition & 0 deletions girder/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def prerelease_local_scheme(version):
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
install_requires=[
'girder>=3.1.18',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,21 +759,21 @@ def _migrateACL(self, annotation):

item = Item().load(annotation['itemId'], force=True)
if item is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing item %s', annotation['_id'])
return annotation

folder = Folder().load(item['folderId'], force=True)
if folder is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing folder %s', annotation['_id'])
return annotation

user = None
if annotation.get('creatorId'):
user = User().load(annotation['creatorId'], force=True)
if user is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing user %s', annotation['_id'])
return annotation

Expand All @@ -787,7 +787,7 @@ def _migrateACL(self, annotation):
return annotation

def createAnnotation(self, item, creator, annotation, public=None):
now = datetime.datetime.utcnow()
now = datetime.datetime.now(datetime.timezone.utc)
doc = {
'itemId': item['_id'],
'creatorId': creator['_id'],
Expand Down Expand Up @@ -815,7 +815,7 @@ def createAnnotation(self, item, creator, annotation, public=None):
type='large_image_annotation.create',
data={'_id': doc['_id'], 'itemId': doc['itemId']},
user=creator,
expires=datetime.datetime.utcnow() + datetime.timedelta(seconds=1))
expires=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=1))
return doc

def load(self, id, region=None, getElements=True, *args, **kwargs):
Expand Down Expand Up @@ -888,7 +888,7 @@ def deleteElements(query, *args, **kwargs):
type='large_image_annotation.remove',
data={'_id': annotation['_id'], 'itemId': annotation['itemId']},
user=User().load(annotation['creatorId'], force=True),
expires=datetime.datetime.utcnow() + datetime.timedelta(seconds=1))
expires=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=1))
return result

def save(self, annotation, *args, **kwargs):
Expand Down Expand Up @@ -987,14 +987,14 @@ def updateAnnotation(self, annotation, updateUser=None):
:param updateUser: the user who is creating the update.
:returns: the annotation document that was updated.
"""
annotation['updated'] = datetime.datetime.utcnow()
annotation['updated'] = datetime.datetime.now(datetime.timezone.utc)
annotation['updatedId'] = updateUser['_id'] if updateUser else None
annotation = self.save(annotation)
Notification().createNotification(
type='large_image_annotation.update',
data={'_id': annotation['_id'], 'itemId': annotation['itemId']},
user=User().load(annotation['creatorId'], force=True),
expires=datetime.datetime.utcnow() + datetime.timedelta(seconds=1))
expires=datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=1))
return annotation

def _similarElementStructure(self, a, b, parentKey=None): # noqa
Expand Down Expand Up @@ -1324,7 +1324,7 @@ def removeOldAnnotations(self, remove=False, minAgeInDays=30, keepInactiveVersio
if (remove and minAgeInDays < 7) or minAgeInDays < 0:
msg = 'minAgeInDays must be >= 7'
raise ValidationException(msg)
age = datetime.datetime.utcnow() + datetime.timedelta(-minAgeInDays)
age = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(-minAgeInDays)
if keepInactiveVersions < 0:
msg = 'keepInactiveVersions mist be non-negative'
raise ValidationException(msg)
Expand Down Expand Up @@ -1425,7 +1425,7 @@ def setMetadata(self, annotation, metadata, allowNull=False):

self.validateKeys(annotation['annotation']['attributes'])

annotation['updated'] = datetime.datetime.utcnow()
annotation['updated'] = datetime.datetime.now(datetime.timezone.utc)

# Validate and save the annotation
return super().save(annotation)
Expand All @@ -1451,6 +1451,6 @@ def deleteMetadata(self, annotation, fields):
for field in fields:
annotation['annotation']['attributes'].pop(field, None)

annotation['updated'] = datetime.datetime.utcnow()
annotation['updated'] = datetime.datetime.now(datetime.timezone.utc)

return super().save(annotation)
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def updateElements(self, annotation):
elements = annotation['annotation'].get('elements', [])
if not len(elements):
return
now = datetime.datetime.utcnow()
now = datetime.datetime.now(datetime.timezone.utc)
threads = multiprocessing.cpu_count()
chunkSize = int(max(100000 // threads, 10000))
with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as pool:
Expand Down
1 change: 1 addition & 0 deletions girder_annotation/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def prerelease_local_scheme(version):
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
install_requires=[
'jsonschema>=2.5.1',
Expand Down
8 changes: 4 additions & 4 deletions girder_annotation/test_annotation/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def testMigrateAnnotationAccessControlNoItemError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -711,7 +711,7 @@ def testMigrateAnnotationAccessControlNoFolderError(self, user, admin):
Item().save(item)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -728,7 +728,7 @@ def testMigrateAnnotationAccessControlNoUserError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -745,6 +745,6 @@ def testMigrateAnnotationAccessControlNullUserError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot
Loading

0 comments on commit 750884d

Please sign in to comment.