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

[ci] enforce flake8 (fixes #161) #222

Merged
merged 1 commit into from
Oct 29, 2022
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
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ repos:
hooks:
- id: isort
args: ["--profile", "black", --line-length=100]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the latest version as of today: https://pypi.org/project/flake8/#history

hooks:
- id: flake8
2 changes: 1 addition & 1 deletion hamilton/data_quality/default_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def arg(cls) -> str:
def _append_pandera_to_default_validators():
"""Utility method to append pandera validators as needed"""
try:
import pandera
import pandera # noqa: F401
except ModuleNotFoundError:
logger.info(
"Cannot import pandera from pandera_validators. Run pip install sf-hamilton[pandera] if needed."
Expand Down
6 changes: 3 additions & 3 deletions hamilton/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def create_function_graph(

def create_graphviz_graph(
nodes: Set[node.Node], user_nodes: Set[node.Node], comment: str, graphviz_kwargs: dict
) -> "graphviz.Digraph":
) -> "graphviz.Digraph": # noqa: F821
"""Helper function to create a graphviz graph.

:param nodes: The set of computational nodes
Expand All @@ -136,7 +136,7 @@ def create_graphviz_graph(

def create_networkx_graph(
nodes: Set[node.Node], user_nodes: Set[node.Node], name: str
) -> "networkx.DiGraph":
) -> "networkx.DiGraph": # noqa: F821
"""Helper function to create a networkx graph.

:param nodes: The set of computational nodes
Expand Down Expand Up @@ -272,7 +272,7 @@ def display(
"""
# Check to see if optional dependencies have been installed.
try:
import graphviz
import graphviz # noqa: F401
except ModuleNotFoundError:
logger.exception(
" graphviz is required for visualizing the function graph. Install it with:"
Expand Down
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 100
exclude = build/,.git/
ignore =
E203, # whitespace before ':' \
E402, # module level import not at top of file \
E501, # line too long \
W503, # line break before binary operator \
W605 # invalid escape sequence
2 changes: 1 addition & 1 deletion tests/resources/bad_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module for more dummy functions to test graph things with.
"""
# we import this to check we don't pull in this function when parsing this module.
from tests.resources import only_import_me
from tests.resources import only_import_me # noqa: F401


def A(b, c) -> int:
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/cyclic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module for cyclic functions to test graph things with.
"""
# we import this to check we don't pull in this function when parsing this module.
from tests.resources import only_import_me
from tests.resources import only_import_me # noqa: F401


def A(b: int, c: int) -> int:
Expand Down