Skip to content

Commit

Permalink
pre-commit: use ruff's UP rules instead of pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Dec 18, 2023
1 parent 985e94c commit a401b15
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
9 changes: 1 addition & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ repos:
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
name: Upgrade code

#- repo: https://github.com/myint/docformatter
# rev: v1.5.0
# hooks:
Expand Down Expand Up @@ -53,7 +46,7 @@ repos:
- mdformat_frontmatter

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
rev: v0.1.8
hooks:
- id: ruff
args: ["--fix"]
7 changes: 1 addition & 6 deletions papermill/adl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ def listdir(self, url):
"""Returns a list of the files under the specified path"""
(store_name, path) = self._split_url(url)
adapter = self._create_adapter(store_name)
return [
"adl://{store_name}.azuredatalakestore.net/{path_to_child}".format(
store_name=store_name, path_to_child=path_to_child
)
for path_to_child in adapter.ls(path)
]
return [f"adl://{store_name}.azuredatalakestore.net/{path_to_child}" for path_to_child in adapter.ls(path)]

def read(self, url):
"""Read storage at a given url"""
Expand Down
6 changes: 1 addition & 5 deletions papermill/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
def print_papermill_version(ctx, param, value):
if not value:
return
print(
"{version} from {path} ({pyver})".format(
version=papermill_version, path=__file__, pyver=platform.python_version()
)
)
print(f"{papermill_version} from {__file__} ({platform.python_version()})")
ctx.exit()


Expand Down
10 changes: 5 additions & 5 deletions papermill/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class PapermillParameterOverwriteWarning(PapermillWarning):
def missing_dependency_generator(package, dep):
def missing_dep():
raise PapermillOptionalDependencyException(
"The {package} optional dependency is missing. "
"Please run pip install papermill[{dep}] to install this dependency".format(package=package, dep=dep)
f"The {package} optional dependency is missing. "
f"Please run pip install papermill[{dep}] to install this dependency"
)

return missing_dep
Expand All @@ -69,9 +69,9 @@ def missing_dep():
def missing_environment_variable_generator(package, env_key):
def missing_dep():
raise PapermillOptionalDependencyException(
"The {package} optional dependency is present, but the environment "
"variable {env_key} is not set. Please set this variable as "
"required by {package} on your platform.".format(package=package, env_key=env_key)
f"The {package} optional dependency is present, but the environment "
f"variable {env_key} is not set. Please set this variable as "
f"required by {package} on your platform."
)

return missing_dep
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ignore-words-list = "dne, compiletime"


[tool.ruff]
target-version = "py38"
line-length = 120
# Enable Pyflakes `E` and `F` codes by default.
select = [
Expand All @@ -48,6 +49,7 @@ select = [
# "D", # see: https://pypi.org/project/pydocstyle
# "N", # see: https://pypi.org/project/pep8-naming
"RUF100", # unnecessary noqa comment
"UP", # pyupgrade
]
#extend-select = [
# "C4", # see: https://pypi.org/project/flake8-comprehensions
Expand Down

0 comments on commit a401b15

Please sign in to comment.