From dbe59378e21ec9568b9323d521c2cb6095a46656 Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Wed, 21 Aug 2024 16:30:52 -0400 Subject: [PATCH] fix warnings (#183) With Python 3.12, we are getting syntax warnings that the `\d` sequence is invalid. The best practice is to make regex compiles raw strings. --- .github/workflows/pr.yml | 8 ++++++-- .github/workflows/release.yml | 9 +++++++-- .../mkdocs_atlas_formatting_plugin/block.py | 10 +++++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7c85dd35..cca5a817 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,13 +6,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: 17 + java-version: '17' distribution: 'zulu' + - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '3' + - run: pip install -r requirements.txt + - run: mkdocs build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 942cc827..0d4f788e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,14 +11,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: 17 + java-version: '17' distribution: 'zulu' + - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: '3' + - run: pip install -r requirements.txt + - run: git fetch origin gh-pages:gh-pages + - run: mkdocs gh-deploy diff --git a/plugins/mkdocs-atlas-formatting-plugin/mkdocs_atlas_formatting_plugin/block.py b/plugins/mkdocs-atlas-formatting-plugin/mkdocs_atlas_formatting_plugin/block.py index e3163ed9..cf93a590 100644 --- a/plugins/mkdocs-atlas-formatting-plugin/mkdocs_atlas_formatting_plugin/block.py +++ b/plugins/mkdocs-atlas-formatting-plugin/mkdocs_atlas_formatting_plugin/block.py @@ -24,11 +24,11 @@ class Block: ATLAS_URI ] - example_pattern = re.compile('([^:]+): (.+)') - options_pattern = re.compile('.+@@@ ([a-z\\-]+)(?:$| { (.+) })') - query_pattern = re.compile('.*q=([^&]+)') - number_pattern = re.compile('^[-+]?\d+(.\d)?$') - color_pattern = re.compile('^1(,1)+$') + example_pattern = re.compile(r'([^:]+): (.+)') + options_pattern = re.compile(r'.+@@@ ([a-z\\-]+)(?:$| { (.+) })') + query_pattern = re.compile(r'.*q=([^&]+)') + number_pattern = re.compile(r'^[-+]?\d+(.\d)?$') + color_pattern = re.compile(r'^1(,1)+$') def __init__(self, webserver: Optional[NoopWebserver] = None) -> None: self.webserver: AtlasWebServer = AtlasWebServer() if not webserver else webserver