From 072a4c1e006adb1f958e79cc082ebdc7253a4925 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Mon, 2 Feb 2026 21:49:20 +0000 Subject: [PATCH] fix: resolve CI linting failures --- depaudit/parsers/python.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/depaudit/parsers/python.py b/depaudit/parsers/python.py index c38a75e..6a6d88b 100644 --- a/depaudit/parsers/python.py +++ b/depaudit/parsers/python.py @@ -3,14 +3,13 @@ from __future__ import annotations import re import sys from pathlib import Path -from typing import Any if sys.version_info >= (3, 11): import tomllib else: import tomli as tomllib -from depaudit.parsers import Parser, ParsedManifest, Dependency +from depaudit.parsers import Parser, ParsedManifest class PythonParser(Parser): @@ -108,7 +107,7 @@ class PythonParser(Parser): content = file_path.read_text(encoding="utf-8") install_requires_match = re.search( - r"install_requires\s*=\s*\[([^\]]*)\]", content, re.DOTALL + r"install_requires\s*=\s*\[(^\]]*)\]", content, re.DOTALL ) if install_requires_match: deps_str = install_requires_match.group(1) @@ -119,11 +118,11 @@ class PythonParser(Parser): self._create_dependency(file_path, name, version) ) - name_match = re.search(r'name\s*=\s*["']([^"\']+)["']', content) + name_match = re.search(r'name\s*=\s*["']([^"']+)["']', content) if name_match: manifest.project_name = name_match.group(1) - version_match = re.search(r'version\s*=\s*["']([^"\']+)["']', content) + version_match = re.search(r'version\s*=\s*["']([^"']+)["']', content) if version_match: manifest.project_version = version_match.group(1) @@ -147,7 +146,7 @@ class PythonParser(Parser): def _parse_pipfile(self, file_path: Path, manifest: ParsedManifest) -> None: content = file_path.read_text(encoding="utf-8") - name_match = re.search(r'name\s*=\s*["']([^"\']+)["']', content) + name_match = re.search(r'name\s*=\s*["']([^"']+)["']', content) if name_match: manifest.project_name = name_match.group(1) @@ -195,10 +194,8 @@ class PythonParser(Parser): extras_match = re.match(r"([^\[]+)(?:\[([^\]]+)\])?", req) if extras_match: name = extras_match.group(1) - extras = extras_match.group(2) else: name = req - extras = None for op in ["==", ">=", "<=", "~=", "!=", ">", "<", "==="]: if op in name: