From 2c74cdb0b3b6aba516b6e543d1b7c18248d5cc0c Mon Sep 17 00:00:00 2001 From: zx Date: Fri, 26 Apr 2024 20:04:27 -0400 Subject: [PATCH] chore: remove unnecessary typing --- .mypy.ini | 2 ++ .ruff.toml | 5 +++++ cyan.py | 21 +++++++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .mypy.ini create mode 100644 .ruff.toml mode change 100644 => 100755 cyan.py diff --git a/.mypy.ini b/.mypy.ini new file mode 100644 index 0000000..4c10470 --- /dev/null +++ b/.mypy.ini @@ -0,0 +1,2 @@ +[mypy] +python_version = 3.12.3 diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..782b4a4 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,5 @@ +line-length = 78 +indent-width = 4 + +[lint] +select = ["E", "F"] diff --git a/cyan.py b/cyan.py old mode 100644 new mode 100755 index 0ca5d0f..32cd01c --- a/cyan.py +++ b/cyan.py @@ -1,27 +1,32 @@ +#!/usr/bin/python3 # cyan, aka pyzule-rw; by zx, 2024 import os import sys import argparse -parser: argparse.ArgumentParser = argparse.ArgumentParser( +parser = argparse.ArgumentParser( description="cyan, an azule \"clone\" for modifying iOS apps") parser.add_argument("-o", metavar="output", help="if unspecified, overwrites input") parser.add_argument("-f", metavar="file", nargs="+", help="a tweak to inject/item to be added to the bundle") -parser.add_argument("input", help="the app to be modified (.app/.ipa)") -args: argparse.Namespace = parser.parse_args() -INPUT: str = os.path.realpath(args.input) -WORKING_DIR: str = os.getcwd() -PZ_DIR: str = os.path.expanduser("~/.config/cyan") -changed: bool = False +parser.add_argument("--overwrite", action="store_true", + help="skip overwrite confirmation") + +parser.add_argument("input", help="the app to be modified (.app/.ipa)") +args = parser.parse_args() + +INPUT = os.path.realpath(args.input) +WORKING_DIR = os.getcwd() +PZ_DIR = os.path.expanduser("~/.config/cyan") +changed = False if not (INPUT.endswith(".ipa") or INPUT.endswith(".app")): sys.exit("[!] input must be a .ipa/.app") elif not os.path.exists(INPUT): sys.exit("[!] input does not exist") elif not args.o and (input("[<] override your input file? [y/N] ").strip() - .lower() not in ("y", "yes")): + .lower() not in ("y", "yes")): sys.exit("[!] not overriding input, missing -o")