diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d0269a5..778ad1c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: - '3.12' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # - name: Cache pip # uses: actions/cache@v3 # with: @@ -24,7 +24,7 @@ jobs: # v1-pip-${{ runner.os }} # v1-pip- - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install mreg-cli @@ -46,9 +46,9 @@ jobs: - "3.12" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/ci/diff.py b/ci/diff.py index bb13a6f8..392d6edd 100644 --- a/ci/diff.py +++ b/ci/diff.py @@ -1,26 +1,52 @@ +from __future__ import annotations + import difflib import json import re import sys from typing import Any, Dict, List - -def replace_timestamps(obj: Any) -> Any: - """Recursively replace timestamp values in a JSON object. - - :param obj: A JSON object (dict, list, or primitive type). - :returns: A new object with timestamps replaced. - """ - timestamp_pattern = re.compile( - r"\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[+-]\d{2}:\d{2})?|\d{4}-\d{2}-\d{2}" - ) - if isinstance(obj, dict): - return {k: replace_timestamps(v) for k, v in obj.items()} - elif isinstance(obj, list): - return [replace_timestamps(elem) for elem in obj] - elif isinstance(obj, str): - return timestamp_pattern.sub("