From 16ccc5d7d11cb08183ecb744cd8237971ed13790 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Sun, 13 Jun 2021 17:04:17 -0400 Subject: [PATCH] more pre-commit checks --- .pre-commit-config.yaml | 19 ++++++++++++++++++- hetnetpy/matrix.py | 2 +- hetnetpy/pathtools.py | 2 +- hetnetpy/permute.py | 2 +- hetnetpy/readwrite.py | 2 +- hetnetpy/stats.py | 2 +- setup.cfg | 15 +++++++++++++++ setup.py | 1 - test/graph_test.py | 2 +- test/matrix_test.py | 2 +- test/neo4j_test.py | 2 +- test/pathtools_test.py | 2 +- test/readwrite_test.py | 1 - 13 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c7723f..405439c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,23 @@ repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-merge-conflict + - id: debug-statements + - id: mixed-line-ending + - id: check-case-conflict + - id: check-yaml + - repo: https://github.com/timothycrosley/isort + rev: 5.8.0 + hooks: + - id: isort - repo: https://github.com/ambv/black - rev: stable + rev: 21.6b0 hooks: - id: black language_version: python3 + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + language_version: python3 diff --git a/hetnetpy/matrix.py b/hetnetpy/matrix.py index 999c0d3..daee367 100644 --- a/hetnetpy/matrix.py +++ b/hetnetpy/matrix.py @@ -1,6 +1,6 @@ +import logging from collections import OrderedDict -import logging import numpy import scipy.sparse diff --git a/hetnetpy/pathtools.py b/hetnetpy/pathtools.py index dd254a9..5c38a15 100644 --- a/hetnetpy/pathtools.py +++ b/hetnetpy/pathtools.py @@ -1,5 +1,5 @@ -import itertools import functools +import itertools import operator from hetnetpy.hetnet import Node, Path diff --git a/hetnetpy/permute.py b/hetnetpy/permute.py index 6f28878..b337a48 100644 --- a/hetnetpy/permute.py +++ b/hetnetpy/permute.py @@ -1,6 +1,6 @@ import collections -import random import logging +import random from hetnetpy.hetnet import Graph diff --git a/hetnetpy/readwrite.py b/hetnetpy/readwrite.py index 77765fc..901e5e8 100644 --- a/hetnetpy/readwrite.py +++ b/hetnetpy/readwrite.py @@ -1,7 +1,7 @@ import collections import csv -import io import importlib +import io import json import mimetypes import operator diff --git a/hetnetpy/stats.py b/hetnetpy/stats.py index 534f419..f117354 100644 --- a/hetnetpy/stats.py +++ b/hetnetpy/stats.py @@ -1,6 +1,6 @@ -import pandas import matplotlib import matplotlib.backends.backend_pdf +import pandas import seaborn diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a7c3b22 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,15 @@ +[flake8] +ignore = + E203 + E402 + E501 + E731 + W503 + +[isort] +profile = black +multi_line_output = 3 +include_trailing_comma = True +force_grid_wrap = 0 +use_parentheses = True +line_length = 88 diff --git a/setup.py b/setup.py index 14594be..4d0f0e2 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ import pathlib -import re import setuptools diff --git a/test/graph_test.py b/test/graph_test.py index af9e258..702c885 100644 --- a/test/graph_test.py +++ b/test/graph_test.py @@ -6,7 +6,7 @@ import hetnetpy.hetnet import hetnetpy.readwrite -from .readwrite_test import formats, extensions +from .readwrite_test import extensions, formats def test_creation(tmpdir): diff --git a/test/matrix_test.py b/test/matrix_test.py index 0934bd3..757d133 100644 --- a/test/matrix_test.py +++ b/test/matrix_test.py @@ -4,8 +4,8 @@ import pytest import scipy.sparse -from hetnetpy.matrix import metaedge_to_adjacency_matrix, sparsify_or_densify import hetnetpy.readwrite +from hetnetpy.matrix import metaedge_to_adjacency_matrix, sparsify_or_densify directory = os.path.dirname(os.path.abspath(__file__)) diff --git a/test/neo4j_test.py b/test/neo4j_test.py index 4a051cc..154fba6 100644 --- a/test/neo4j_test.py +++ b/test/neo4j_test.py @@ -1,8 +1,8 @@ import pathlib import textwrap -from neo4j import GraphDatabase import pytest +from neo4j import GraphDatabase import hetnetpy.neo4j import hetnetpy.readwrite diff --git a/test/pathtools_test.py b/test/pathtools_test.py index 7327faf..190f0b4 100644 --- a/test/pathtools_test.py +++ b/test/pathtools_test.py @@ -3,7 +3,7 @@ import pytest import hetnetpy.readwrite -from hetnetpy.pathtools import paths_between, DWPC +from hetnetpy.pathtools import DWPC, paths_between directory = os.path.dirname(os.path.abspath(__file__)) diff --git a/test/readwrite_test.py b/test/readwrite_test.py index 9e606a5..9936873 100644 --- a/test/readwrite_test.py +++ b/test/readwrite_test.py @@ -2,7 +2,6 @@ import hetnetpy.readwrite - directory = os.path.dirname(os.path.abspath(__file__)) formats = ["json", "pkl"]