code: def test_validate_python_files(filename: str) -> None:
      if __file__.endswith(filename):
          return  # errors in the current file are intentional
  
      source = Path(filename).read_text()
  
      forbidden_regexes = [
          ForbiddenRegex(
              regex=r"collate[-_\w]+eval|eval[-_\w]+collate|dataset[-_\w]+eval|eval[-_\w]+dataset",
              handler=lambda match: f"To follow the standard train/val/test dataset splitting terminology, please rename "
              f"'{match}' to either '{match.replace('eval', 'test')}' "
              f"or '{match.replace('eval', 'val')}'.",
          ),
          ForbiddenRegex(
              regex=r"from \.|import \.",
              handler=lambda match: f"Please use absolute imports instead of relative ones."
              f" For example: 'import .models' --> 'import cvnets.models'. Problematic code: '{match}'.",
          ),
          ForbiddenRegex(
              regex=r"class (ConvLayer|SeparableConv|TransposeConvLayer|ASPPConv|ASPPSeparableConv)\b",
              handler=lambda match: f"{match} is deprecated. Please remove it and use {match}2d.",
          ),
          ForbiddenRegex(
              regex=r"setattr\(opts.*model\.segmentation\.n_classes",
              handler=lambda match: f"'{match},...)' is deprecated. Please set it in config.",
              exclude_dirs=["tests/"],
          ),
      ]
      forbidden_regexes = {
          f"regex_{i}": item for i, item in enumerate(forbidden_regexes)
      }
  
      unified_regex = re.compile(
          "|".join(
              f"(?P<{name}>{item.regex})"
              for name, item in forbidden_regexes.items()
          )
      )
  
      if not filename.endswith("test_conventions.py"):
          match = unified_regex.search(source)
          if match:
              for name, match in match.groupdict().items():
                  if not match:
                      continue
                  for exclude_dir in forbidden_regexes[
                      name
                  ].exclude_dirs:
                      if filename.startswith(exclude_dir):
                          break
                  else:
                      message = forbidden_regexes[name].handler(match)
                      raise CodeConventionError(
                          f"{message} File: {filename}."
                      )
  
          ast = parse(source)
          CheckConventionsVisitor(filename=filename).visit(ast)
  
imports: import dataclasses
  import re
  import subprocess
  from ast import Attribute, Call, Constant, Name, NodeVisitor, parse
  from pathlib import Path
  from typing import Any, Callable, Dict, List
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_validate_python_files(filename) without return types