Skip to content

CLN replace authors with the standard line #29250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

adrinjalali
Copy link
Member

Towards #20813

This replaces the authors lines with what we've discussed.

For the record, this is the code doing it:

import re


def replace_authors_section(file_path):
    with open(file_path, "r") as file:
        content = "".join(file.readlines())

    # Find the authors section
    new_code = re.sub(
        r"# Author.*# SPDX-License-Identifier: BSD-3-Clause",
        r"# Authors: The scikit-learn developers\n# SPDX-License-Identifier: BSD-3-Clause",
        content,
        flags=re.DOTALL,
    )
    # Write the modified content back to the file
    with open(file_path, "w") as file:
        file.write(new_code)


# Example usage
with open("/tmp/files.txt", "r") as file:
    files = file.readlines()
root = "/path/to/scikit-learn/"
for f_name in files:
    print(f_name)
    replace_authors_section(root + f_name.rstrip("\n"))

And files.txt comes from:

$ git grep "# SPDX-License-Identifier: BSD-3-Clause" | awk -F":" '{print $1}' > /tmp/files.txt

cc @scikit-learn/core-devs

Copy link

github-actions bot commented Jun 13, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: a5f17d7. Link to the linter CI: here

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @adrinjalali.

@adrinjalali
Copy link
Member Author

Should we merge this then now?

Copy link
Member

@betatim betatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having randomly inspected the diff, LGTM

@jjerphan jjerphan enabled auto-merge (squash) June 17, 2024 16:53
@jjerphan jjerphan disabled auto-merge June 17, 2024 16:53
@jjerphan jjerphan enabled auto-merge (squash) June 17, 2024 16:54
@jjerphan jjerphan merged commit 51c8e0e into scikit-learn:main Jun 17, 2024
28 checks passed
@adrinjalali adrinjalali deleted the authors branch June 18, 2024 07:35
@jeremiedbb jeremiedbb mentioned this pull request Jul 2, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants