Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize on ruff for python formatting/linting via pre-commits #183

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ repos:
exclude: testing/baselines
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.1a1
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4 # 6.0.0 requires Python 3.8
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: flake8
- id: ruff
args: [--fix]
- id: ruff-format

exclude: doc/ext/sphinxarg
10 changes: 5 additions & 5 deletions zeekpkg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import logging

__version__ = "3.0.1-6"
__all__ = ["manager", "package", "source", "template", "uservar"]
__all__ = ["manager", "package", "source", "template", "uservar"] # noqa: F405

LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())

from .manager import *
from .package import *
from .source import *
from .uservar import *
from .manager import * # noqa: E402, F403
from .package import * # noqa: E402, F403
from .source import * # noqa: E402, F403
from .uservar import * # noqa: E402, F403
5 changes: 2 additions & 3 deletions zeekpkg/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A module for instantiating different types of Zeek packages.
"""

import abc
import configparser
import re
Expand Down Expand Up @@ -797,9 +798,7 @@ def _git_init(self, tmpl):
"""Initial commit.

zkg {} created this package from template "{}"
using {}{}.""".format(
__version__, tmpl.name(), ver_info, features_info
)
using {}{}.""".format(__version__, tmpl.name(), ver_info, features_info)
)


Expand Down
1 change: 1 addition & 0 deletions zeekpkg/uservar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
by packages that the user can provide in a variety of ways, including
responses to zkg's input prompting.
"""

import os
import re
import readline
Expand Down
10 changes: 5 additions & 5 deletions zkg
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,26 @@ ZKG_DEFAULT_SOURCE = "https://github.com/zeek/packages"
# The default package template
ZKG_DEFAULT_TEMPLATE = "https://github.com/zeek/package-template"

from zeekpkg._util import (
from zeekpkg._util import ( # noqa: E402
delete_path,
make_dir,
find_program,
read_zeek_config_line,
std_encoding,
)
from zeekpkg.package import (
from zeekpkg.package import ( # noqa: E402
BUILTIN_SCHEME,
TRACKING_METHOD_VERSION,
)
from zeekpkg.template import (
from zeekpkg.template import ( # noqa: E402
LoadError,
Template,
)
from zeekpkg.uservar import (
from zeekpkg.uservar import ( # noqa: E402
UserVar,
)

import zeekpkg
import zeekpkg # noqa: E402


def confirmation_prompt(prompt, default_to_yes=True):
Expand Down
Loading