Skip to content

Commit

Permalink
Merge pull request #15 from YeetCode-devs/staging/prathamdby
Browse files Browse the repository at this point in the history
Improve the install_hook script's logic and add the python-dotenv dependency in poetry
  • Loading branch information
hakimifr authored Mar 19, 2024
2 parents 9207eed + a68e76d commit 885fb46
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 12 additions & 5 deletions scripts/install_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -40,4 +46,5 @@ def main() -> None:
Path(".git/hooks/pre-commit").chmod(0o700)


main()
if __name__ == "__main__":
main()

0 comments on commit 885fb46

Please sign in to comment.