mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Shut up, ruff
This commit is contained in:
parent
8d6cc71939
commit
3fb8a352e1
2 changed files with 8 additions and 9 deletions
|
|
@ -45,9 +45,9 @@ def bump_version(part: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2: # noqa: PLR2004
|
||||||
print("Usage: python scripts/bump_version.py [major|minor|patch|to:X.Y.Z]")
|
print("Usage: python scripts/bump_version.py [major|minor|patch|to:X.Y.Z]") # noqa: T201
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
new_version = bump_version(sys.argv[1])
|
new_version = bump_version(sys.argv[1])
|
||||||
print(f"Bumped version to {new_version}")
|
print(f"Bumped version to {new_version}") # noqa: T201
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ def get_telegram_api_version() -> str:
|
||||||
|
|
||||||
|
|
||||||
def replace_line(content: str, pattern: re.Pattern, new_value: str) -> str:
|
def replace_line(content: str, pattern: re.Pattern, new_value: str) -> str:
|
||||||
result = pattern.sub(f"\\g<1>{new_value}\\g<2>", content)
|
return pattern.sub(f"\\g<1>{new_value}\\g<2>", content)
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def write_package_meta(api_version: str) -> None:
|
def write_package_meta(api_version: str) -> None:
|
||||||
|
|
@ -55,7 +54,7 @@ def write_package_meta(api_version: str) -> None:
|
||||||
|
|
||||||
content = replace_line(content, API_VERSION, api_version)
|
content = replace_line(content, API_VERSION, api_version)
|
||||||
|
|
||||||
print(f"Write {path}")
|
print(f"Write {path}") # noqa: T201
|
||||||
path.write_text(content)
|
path.write_text(content)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,7 +63,7 @@ def write_readme(api_version: str) -> None:
|
||||||
content = path.read_text()
|
content = path.read_text()
|
||||||
content = replace_line(content, API_VERSION_BADGE, api_version)
|
content = replace_line(content, API_VERSION_BADGE, api_version)
|
||||||
content = replace_line(content, API_VERSION_LINE, api_version)
|
content = replace_line(content, API_VERSION_LINE, api_version)
|
||||||
print(f"Write {path}")
|
print(f"Write {path}") # noqa: T201
|
||||||
path.write_text(content)
|
path.write_text(content)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,14 +71,14 @@ def write_docs_index(api_version: str) -> None:
|
||||||
path = Path.cwd() / "docs" / "index.rst"
|
path = Path.cwd() / "docs" / "index.rst"
|
||||||
content = path.read_text()
|
content = path.read_text()
|
||||||
content = replace_line(content, API_VERSION_BADGE, api_version)
|
content = replace_line(content, API_VERSION_BADGE, api_version)
|
||||||
print(f"Write {path}")
|
print(f"Write {path}") # noqa: T201
|
||||||
path.write_text(content)
|
path.write_text(content)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
api_version = get_telegram_api_version()
|
api_version = get_telegram_api_version()
|
||||||
|
|
||||||
print(f"Telegram Bot API version: {api_version}")
|
print(f"Telegram Bot API version: {api_version}") # noqa: T201
|
||||||
write_package_meta(api_version=api_version)
|
write_package_meta(api_version=api_version)
|
||||||
write_readme(api_version=api_version)
|
write_readme(api_version=api_version)
|
||||||
write_docs_index(api_version=api_version)
|
write_docs_index(api_version=api_version)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue