From 3693804f64f12b6147823b0bdd720db6049cb4a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:43:01 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pre_commit_hooks/check_naming_convention.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pre_commit_hooks/check_naming_convention.py b/pre_commit_hooks/check_naming_convention.py index 52c80e5..9fdbf61 100644 --- a/pre_commit_hooks/check_naming_convention.py +++ b/pre_commit_hooks/check_naming_convention.py @@ -1,10 +1,13 @@ +from __future__ import annotations + +import os import re import sys -import os + def check_naming_convention(files): for file_path in files: - with open(file_path, 'r') as file: + with open(file_path) as file: lines = file.readlines() for line_num, line in enumerate(lines, start=1): words = re.findall(r'\b[a-zA-Z0-9_]+\b', line) @@ -13,8 +16,8 @@ def check_naming_convention(files): continue # Valid snake_case elif re.match(r'^[A-Z][a-zA-Z0-9]*$', word): if '_' in word: - print(f"WARNING: CamelCase with underscores found in {os.path.basename(file_path)}:{line_num}: {word}") + print(f'WARNING: CamelCase with underscores found in {os.path.basename(file_path)}:{line_num}: {word}') continue # Valid CamelCase else: - print(f"ERROR: Invalid naming convention in {os.path.basename(file_path)}:{line_num}: {word}") + print(f'ERROR: Invalid naming convention in {os.path.basename(file_path)}:{line_num}: {word}') sys.exit(1)