Skip to content

Commit

Permalink
Added pre-commit, reformatted all code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed May 9, 2024
1 parent 95c3029 commit 859c69d
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 276 deletions.
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
default_language_version:
python: python3
exclude: 'dotnet'
ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: 'monthly'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-byte-order-marker
exclude: .gitignore
- id: check-merge-conflict
- id: detect-private-key
- id: trailing-whitespace
- id: end-of-file-fixer
- id: no-commit-to-branch
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: ["--fix", "--ignore=E402"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["-L", "ans,linar,nam,tread,ot,"]
exclude: |
(?x)^(
pyproject.toml |
website/static/img/ag.svg |
website/yarn.lock |
website/docs/tutorial/code-executors.ipynb |
website/docs/topics/code-execution/custom-executor.ipynb |
website/docs/topics/non-openai-models/cloud-gemini.ipynb |
notebook/.*
)$
# See https://jaredkhan.com/blog/mypy-pre-commit
- repo: local
hooks:
- id: mypy
name: mypy
entry: "./scripts/pre-commit-mypy-run.sh"
language: python
# use your preferred Python version
# language_version: python3.8
additional_dependencies: []
types: [python]
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-black
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ python -m pip install geniusbot

![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)
![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)
</details>
</details>
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ selenium>=4.17.2
Pillow>=10.2.0
webdriver-manager>=4.0.1
piexif>=1.1.3
beautifulsoup4>=4.12.3
beautifulsoup4>=4.12.3
50 changes: 26 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,49 @@
# coding: utf-8

from setuptools import setup
from webarchiver.version import __version__, __author__, __credits__
from webarchiver.version import __version__, __author__
from pathlib import Path
import os
import re
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements

readme = Path('README.md').read_text()
readme = Path("README.md").read_text()
version = __version__
requirements = parse_requirements(os.path.join(os.path.dirname(__file__), 'requirements.txt'), session=PipSession())
requirements = parse_requirements(
os.path.join(os.path.dirname(__file__), "requirements.txt"), session=PipSession()
)
readme = re.sub(r"Version: [0-9]*\.[0-9]*\.[0-9][0-9]*", f"Version: {version}", readme)
with open("README.md", "w") as readme_file:
readme_file.write(readme)
description = 'Python tool that allows you to take multiple full page screenshots of web pages without ads.'
description = "Python tool that allows you to take multiple full page screenshots of web pages without ads."

setup(
name='webarchiver',
name="webarchiver",
version=f"{version}",
description=description,
long_description=f'{readme}',
long_description_content_type='text/markdown',
url='https://github.com/Knuckles-Team/webarchiver',
long_description=f"{readme}",
long_description_content_type="text/markdown",
url="https://github.com/Knuckles-Team/webarchiver",
author=__author__,
author_email='knucklessg1@gmail.com',
license='MIT',
packages=['webarchiver'],
author_email="knucklessg1@gmail.com",
license="MIT",
packages=["webarchiver"],
include_package_data=True,
install_requires=[str(requirement.requirement) for requirement in requirements],
py_modules=['webarchiver'],
data_files=[("webarchiver", ["webarchiver/lib/uBlock-Origin_v1.27.0.crx"])],
package_data={'webarchiver': ['webarchiver']},
py_modules=["webarchiver"],
data_files=[("webarchiver", ["webarchiver/lib/uBlock-Origin_v1.27.0.crx"])],
package_data={"webarchiver": ["webarchiver"]},
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: Public Domain',
'Environment :: Console',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
"Development Status :: 5 - Production/Stable",
"License :: Public Domain",
"Environment :: Console",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
entry_points={'console_scripts': ['webarchiver = webarchiver.webarchiver:main']},
entry_points={"console_scripts": ["webarchiver = webarchiver.webarchiver:main"]},
)
6 changes: 3 additions & 3 deletions webarchiver/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# coding: utf-8

__version__ = '0.32.4'
__author__ = 'Audel Rouhi'
__credits__ = 'Audel Rouhi'
__version__ = "0.32.4"
__author__ = "Audel Rouhi"
__credits__ = "Audel Rouhi"
Loading

0 comments on commit 859c69d

Please sign in to comment.