Skip to content

QUERYDSL

Phan Văn Hoà - 潘文和 - 반문화 edited this page Aug 16, 2024 · 1 revision

retarded cunts

import os
import re

def update_java_files():
    """
    Finds all .java files in the current directory structure and updates
    lines containing exactly "@param <T>" to "@param <T> the type".
    """

    for root, _, files in os.walk("."):
        for file in files:
            if file.endswith(".java"):
                file_path = os.path.join(root, file)
                update_file(file_path)

def update_file(file_path):
    """
    Updates the specified .java file by replacing exactly "@param <T>" with "@param <T> the type".
    """

    with open(file_path, "r+") as f:
        content = f.readlines()
        new_content = []
        for line in content:
            if re.match(r"^\s*\*\s*@param <T>$", line):
                new_content.append(line.replace("@param <T>", "@param <T> the type"))
            else:
                new_content.append(line)
        f.seek(0)
        f.write("".join(new_content))
        f.truncate()

if __name__ == "__main__":
    update_java_files()

eye

Clone this wiki locally