From ff863694b7f341763a82af47d3f1ee5843102f9d Mon Sep 17 00:00:00 2001 From: Pratham Dubey <134331217+prathamdby@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:12:31 +0530 Subject: [PATCH 1/2] scripts: Improve the logic for the install_hook script --- scripts/install_hook.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/install_hook.py b/scripts/install_hook.py index 5ca2ee6..5e9d3d3 100644 --- a/scripts/install_hook.py +++ b/scripts/install_hook.py @@ -21,13 +21,19 @@ SCRIPT = r"""#!/bin/sh set -o noglob -python3 scripts/install_hook.py +python3 scripts/install_hook.py || python scripts/install_hook.py poetry run black . -for file in $(git diff --cached --name-only); do - test -f $file && git add $file -done""" +files=$(git diff --cached --name-only) + +if [ -n "$files" ]; then + for file in $files; do + if [ -f "$file" ]; then + git add "$file" + fi + done +fi""" def main() -> None: @@ -40,4 +46,5 @@ def main() -> None: Path(".git/hooks/pre-commit").chmod(0o700) -main() +if __name__ == "__main__": + main() From a68e76d186f276254e18ef6a40dd86f1fb0e6509 Mon Sep 17 00:00:00 2001 From: Pratham Dubey <134331217+prathamdby@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:17:43 +0530 Subject: [PATCH 2/2] Introduce the python-dotenv dependency --- poetry.lock | 16 +++++++++++++++- pyproject.toml | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 0edc6a9..9693fb8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1991,6 +1991,20 @@ tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "python-socks" version = "2.4.4" @@ -2622,4 +2636,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "bace2289d58eb80a8509559b88a930e7b7a675eb307cfde6f008da9722bbac18" +content-hash = "739c9e169b75e10213dcb3bb295d09dac82dd8eeacb919a4f445dc6a07cbedda" diff --git a/pyproject.toml b/pyproject.toml index d48a339..6154dde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ package-mode = false python = "^3.10" g4f = {extras = ["all"], version = "^0.2.5.4"} telethon = "^1.34.0" +python-dotenv = "^1.0.1" [tool.poetry.group.dev.dependencies] black = "^24.3.0"