-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'NKI-AI:main' into main
- Loading branch information
Showing
21 changed files
with
235 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import re | ||
from datetime import datetime | ||
from typing import Callable, Dict | ||
|
||
|
||
def citation_regex(new_date, content): | ||
""" | ||
Replaces the date in the CITATION.cff file with the new date | ||
""" | ||
return re.sub(r"date-released: \d{4}-\d{2}-\d{2}", f"date-released: {new_date}", content) | ||
|
||
|
||
readme_regexes = { | ||
"bibtex_year": lambda year, content: re.sub(r"\{\d{4}\}", f"{{{year}}}", content), # {2023} in bibtex | ||
"bibtex_month": lambda month, content: re.sub(r"\{\d{1,2}\}", f"{{{month}}}", content), # {5} or {12} in bibtex | ||
"plain_bib_year": lambda year, content: re.sub(r"(\d{4})", str(year), content), # (2023) in the plain bibliography | ||
} | ||
|
||
|
||
def bump_citation_file( | ||
new_date: str, | ||
filename: str = "CITATION.cff", | ||
regex_function: Callable = citation_regex, | ||
) -> None: | ||
""" | ||
Runs a specific regex function on the defined citation file | ||
""" | ||
with open(filename, "r") as f: | ||
content = f.read() | ||
|
||
with open(filename, "w") as f: | ||
content = regex_function(new_date, content) | ||
f.write(content) | ||
|
||
|
||
def bump_readme_file( | ||
year: str, | ||
month: str, | ||
regex_functions: Dict[str, Callable] = readme_regexes, | ||
filename: str = "README.md", | ||
) -> None: | ||
""" | ||
Runs the required regex functions on the README file | ||
""" | ||
with open(filename, "r") as f: | ||
content = f.read() | ||
|
||
with open(filename, "w") as f: | ||
content = regex_functions["bibtex_year"](year, content) | ||
content = regex_functions["bibtex_month"](month, content) | ||
content = regex_functions["plain_bib_year"](year, content) | ||
f.write(content) | ||
|
||
|
||
def bump_date() -> None: | ||
""" | ||
A developer function to bump the date when a version is bumped. | ||
Run after bump2version is run, since bump2version doesn't allow updating | ||
the date in e.g. README.md and CITATION.cff. | ||
""" | ||
new_date = datetime.now().strftime("%Y-%m-%d") | ||
year = str(datetime.now().year) | ||
month = str(datetime.now().month) | ||
|
||
bump_citation_file(new_date=new_date) | ||
bump_readme_file(year=year, month=month) | ||
|
||
|
||
if __name__ == "__main__": | ||
bump_date() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,3 @@ jobs: | |
pip install tox tox-gh-actions | ||
- name: Test with tox | ||
run: tox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,51 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
rev: v3.2.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-vcs-permalinks | ||
- id: check-xml | ||
- id: check-yaml | ||
args: [--unsafe] | ||
- id: end-of-file-fixer | ||
- id: fix-encoding-pragma | ||
args: [ '--pragma=# coding=utf-8' ] | ||
- id: requirements-txt-fixer | ||
- id: check-added-large-files | ||
args: [ '--maxkb=500' ] | ||
- id: sort-simple-yaml | ||
- id: trailing-whitespace | ||
- id: no-commit-to-branch | ||
args: [--branch, main] | ||
- id: forbid-new-submodules | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.8.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- id: isort | ||
name: isort (cython) | ||
types: [cython] | ||
- id: isort | ||
name: isort (pyi) | ||
types: [pyi] | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 21.6b0 | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v0.902 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
# Ignore the configuration files | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: [types-requests] | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.1.0 | ||
- id: flake8 | ||
exclude: ^docs/ | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: detect-secrets | ||
args: ['--baseline', '.secrets.baseline'] | ||
- repo: local | ||
- id: isort | ||
name: isort (python) | ||
- repo: local # Use pylint from local environment as it requires to import packages | ||
hooks: | ||
- id: pylint | ||
name: pylint | ||
entry: pylint | ||
- id: mypy | ||
name: mypy | ||
entry: mypy | ||
language: system | ||
types: [python] | ||
args: | ||
- dlup | ||
- --errors-only | ||
args: ["--strict"] | ||
files: ^dlup/ | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.4.0 | ||
hooks: | ||
- id: detect-secrets | ||
- repo: local # Use pylint from local environment as it requires to import packages | ||
hooks: | ||
- id: pylint | ||
name: pylint | ||
entry: pylint | ||
language: system | ||
types: [python] | ||
args: | ||
[ | ||
"-rn", # Only display messages | ||
"-sn", # Don't display the score | ||
"--errors-only" # Only show the errors | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cff-version: 1.2.0 | ||
message: "If you use this software, please cite it as below." | ||
authors: | ||
- family-names: "Teuwen" | ||
given-names: "Jonas" | ||
orcid: "https://orcid.org/0000-0002-1825-1428" | ||
- family-names: "Romor" | ||
given-names: "Leonardo" | ||
- family-names: "Pai" | ||
given-names: "Ajey" | ||
orcid: "https://orcid.org/0009-0003-3970-9236" | ||
- family-names: "Schirris" | ||
given-names: "Yoni" | ||
orcid: "https://orcid.org/0000-0003-0217-8737" | ||
- family-names: "Marcus" | ||
given-names: "Eric" | ||
orchid: "https://orcid.org/0000-0002-3375-6248" | ||
title: "DLUP: Deep Learning Utilities for Pathology" | ||
version: 0.3.31 | ||
date-released: 2023-10-17 | ||
url: "https://github.com/nki-ai/dlup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
|
||
__author__ = """dlup contributors""" | ||
__email__ = "[email protected]" | ||
__version__ = "0.3.29" | ||
__version__ = "0.3.31" | ||
|
||
__all__ = ("SlideImage", "RegionView", "UnsupportedSlideError", "BoundaryMode") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.