Skip to content

Commit

Permalink
feat: make the config file optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh672003 committed Jun 29, 2024
1 parent 07b8e69 commit 9c94ff3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pyfix-imports"
version = "0.4.1"
version = "0.4.2"
description = "python tool that will fix your missing imports"
authors = [{ name = "Rishabh", email = "[email protected]" }]
dependencies = [
Expand Down
4 changes: 2 additions & 2 deletions src/pyfix_imports/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import tomllib
from pathlib import Path
from typing import Dict

import tomllib
import xdg_base_dirs

from pyfix_imports.predefined import predefined_imports
Expand Down Expand Up @@ -37,7 +37,7 @@ def update_pred_imports(data: Dict[str, str]) -> None:
return None


def config(given_path: Path) -> None:
def config(given_path: Path | None) -> None:
path = given_path or get_config_path()

if path:
Expand Down
2 changes: 1 addition & 1 deletion src/pyfix_imports/fix_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pyfix_imports.pyflake import pyflake


def fix_code(filename: str, config_file) -> str:
def fix_code(filename: str, config_file = None) -> str:
"""Fix the python source code of a file.
Args:
Expand Down
1 change: 1 addition & 0 deletions src/pyfix_imports/pyflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def undefined_name(


def pyflake(src: str) -> Set[str]:
"""Takes the filename as an argument and Returns the set of all undefined names"""
flake_message = check(src)
modules = undefined_name(flake_message)
return modules

0 comments on commit 9c94ff3

Please sign in to comment.