Skip to content

Escape backslash in logcrawler regex - #1444

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
MBK-fr:fix/invalid-escape-sequence-syntaxwarning
Sep 15, 2026
Merged

ErikBjare merged 1 commit into
ActivityWatch:masterfrom
MBK-fr:fix/invalid-escape-sequence-syntaxwarning

Conversation

@MBK-fr

@MBK-fr MBK-fr commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Problem

scripts/logcrawler.py builds a regex from a non-raw string literal containing \d, so Python 3.12+ raises SyntaxWarning: invalid escape sequence '\d'.

Why it matters for ActivityWatch

The project runs Python 3.12 in CI, so the warning surfaces on import.

Fix

Escape the backslash; the compiled regex is byte-for-byte identical (ruff W605-style).

Verification

In-memory compile() under -W error is clean after (raised before); AST unchanged.


🤖 Generated with Claude Code

https://claude.ai/code/session_014HBQNzAf5C2E3MiJC48HQw

scripts/logcrawler.py builds a regex from a non-raw string literal
containing `\d`, so Python 3.12+ raises SyntaxWarning: invalid escape
sequence '\d'. ActivityWatch runs 3.12 in CI. Escaping the backslash
keeps the compiled regex identical (ruff W605-style).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HBQNzAf5C2E3MiJC48HQw
@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge because it removes the warning without changing runtime behavior.

Summary

The PR escapes the backslashes in the log crawler’s date regex string literal, eliminating Python 3.12’s invalid-escape warning while preserving the compiled regex behavior.

  • Updates the three \d escapes to valid Python string-literal escapes.
  • Does not alter the date-matching pattern or log-crawling behavior.

Reviews (1) · Last reviewed commit: "Escape backslash in logcrawler regex"

@ErikBjare
ErikBjare merged commit d14cd44 into ActivityWatch:master Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants