Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Fix pyrpoject.toml search
Browse files Browse the repository at this point in the history
  • Loading branch information
quwac committed Jan 10, 2022
1 parent 149af94 commit 9173b5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyproject-autoflake"
version = "1.0.0"
version = "1.0.1"
description = "pyproject-autoflake (pautoflake), a monkey patching wrapper to connect autoflake with pyproject.toml configuration."
authors = ["quwac <53551867+quwac@users.noreply.github.com>"]
readme = "README.md"
Expand Down
10 changes: 6 additions & 4 deletions pyproject_autoflake/pautoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
import signal
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
from typing import Dict, List, Tuple, Union

import autoflake
import toml


def _get_pyproject_toml_path(path_candidates: List[str]) -> str:
path_in_current = os.path.join(os.getcwd(), "pyproject.toml")
if os.path.exists(path_in_current):
return path_in_current

absolute_paths: List[Path] = []
for path_candidate in path_candidates:
path = Path(path_candidate)
Expand All @@ -30,9 +34,7 @@ def _get_pyproject_toml_path(path_candidates: List[str]) -> str:
raise ValueError("pyproject.toml not found.")


def _get_argv_from_toml(pyproject_path: Optional[str] = None) -> List[str]:
if pyproject_path is None:
pyproject_path = os.path.join(os.getcwd(), "pyproject.toml")
def _get_argv_from_toml(pyproject_path: str) -> List[str]:
assert (
pyproject_path is not None and pyproject_path != "" and os.path.exists(pyproject_path)
), f"pyproject.toml not found. {pyproject_path}"
Expand Down

0 comments on commit 9173b5a

Please sign in to comment.