Skip to content

Commit

Permalink
fix: lint progress
Browse files Browse the repository at this point in the history
  • Loading branch information
boulais01 committed Nov 21, 2023
1 parent d656520 commit d646e06
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 109 deletions.
11 changes: 3 additions & 8 deletions chasten/checks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
"""Extract and analyze details about specific checks."""

from typing import Dict
from typing import List
from typing import Tuple
from typing import Union

from chasten import constants
from chasten import enumerations
from chasten import util
from typing import Dict, List, Tuple, Union

from chasten import constants, enumerations, util


def extract_min_max(
Expand Down
15 changes: 3 additions & 12 deletions chasten/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,16 @@
import logging.handlers
import sys
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
from typing import Any, Dict, List, Tuple, Union

import platformdirs
import requests
import yaml
from rich.logging import RichHandler
from rich.traceback import install
from urllib3.util import Url
from urllib3.util import parse_url
from urllib3.util import Url, parse_url

from chasten import constants
from chasten import filesystem
from chasten import output
from chasten import util
from chasten import validate
from chasten import constants, filesystem, output, util, validate


def configure_tracebacks() -> None:
Expand Down
6 changes: 1 addition & 5 deletions chasten/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

from sqlite_utils import Database

from chasten import constants
from chasten import enumerations
from chasten import filesystem
from chasten import output
from chasten import util
from chasten import constants, enumerations, filesystem, output, util

CHASTEN_SQL_SELECT_QUERY = """
SELECT
Expand Down
13 changes: 2 additions & 11 deletions chasten/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@
import uuid
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import NoReturn
from typing import Optional
from typing import Tuple
from typing import Union
from typing import Any, Dict, List, NoReturn, Optional, Tuple, Union

import flatterer # type: ignore
from rich.tree import Tree

from chasten import configuration
from chasten import constants
from chasten import database
from chasten import results
from chasten import configuration, constants, database, results

CONFIGURATION_FILE_DEFAULT_CONTENTS = """
# chasten configuration
Expand Down
31 changes: 15 additions & 16 deletions chasten/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
import sys
import time
from pathlib import Path
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
from typing import Dict, List, Tuple, Union

import pyastgrep # type: ignore
import typer
from pyastgrep import search as pyastgrepsearch # type: ignore

from chasten import checks
from chasten import configuration
from chasten import constants
from chasten import database
from chasten import debug
from chasten import enumerations
from chasten import filesystem
from chasten import output
from chasten import process
from chasten import results
from chasten import server
from chasten import util
from chasten import (
checks,
configuration,
constants,
database,
debug,
enumerations,
filesystem,
output,
process,
results,
server,
util,
)

# create a Typer object to support the command-line interface
cli = typer.Typer(no_args_is_help=True)
Expand Down
10 changes: 2 additions & 8 deletions chasten/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
import logging
from copy import deepcopy
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import Any, Dict, List

from pyastgrep import search as pyastgrepsearch # type: ignore
from rich.console import Console
from rich.panel import Panel
from rich.syntax import Syntax

from chasten import checks
from chasten import configuration
from chasten import constants
from chasten import debug
from chasten import results
from chasten import checks, configuration, constants, debug, results

# declare a default logger
logger: logging.Logger = logging.getLogger()
Expand Down
9 changes: 2 additions & 7 deletions chasten/process.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"""Analyze the abstract syntax tree, its XML-based representation, and/or the search results."""

import json
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
from typing import Any, Dict, List, Tuple, Union

from pyastgrep import search as pyastgrepsearch # type: ignore
from thefuzz import fuzz # type: ignore

from chasten import constants
from chasten import enumerations
from chasten import constants, enumerations


def include_or_exclude_checks(
Expand Down
4 changes: 1 addition & 3 deletions chasten/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import uuid
from datetime import datetime
from pathlib import Path
from typing import List
from typing import Optional
from typing import Union
from typing import List, Optional, Union

from pyastgrep import search as pyastgrepsearch # type: ignore
from pydantic import BaseModel
Expand Down
3 changes: 1 addition & 2 deletions chasten/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import logging.handlers
import socketserver

from chasten import constants
from chasten import output
from chasten import constants, output

LOG_FILE = constants.server.Log_File
HOST = constants.server.Localhost
Expand Down
9 changes: 2 additions & 7 deletions chasten/validate.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
"""Validate various aspects of configurations and command-line arguments."""

from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from typing import Any, Dict, List, Tuple

import jsonschema
from jsonschema.exceptions import ValidationError

from chasten import constants
from chasten import output
from chasten import util
from chasten import constants, output, util

# intuitive description:
# a configuration file links to one or more checks files
Expand Down
12 changes: 6 additions & 6 deletions tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import hypothesis.strategies as st
import pytest
from hypothesis import HealthCheck
from hypothesis import given
from hypothesis import settings
from hypothesis import HealthCheck, given, settings
from hypothesis_jsonschema import from_schema

from chasten.checks import check_match_count
from chasten.checks import extract_min_max
from chasten.checks import is_in_closed_interval
from chasten.checks import (
check_match_count,
extract_min_max,
is_in_closed_interval,
)
from chasten.validate import JSON_SCHEMA_CHECKS

JSON_SCHEMA_COUNT = {
Expand Down
3 changes: 1 addition & 2 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import logging

import pytest
from hypothesis import given
from hypothesis import strategies
from hypothesis import given, strategies

from chasten import configuration

Expand Down
3 changes: 1 addition & 2 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from pathlib import Path

import pytest
from hypothesis import given
from hypothesis import strategies
from hypothesis import given, strategies

from chasten import constants

Expand Down
3 changes: 1 addition & 2 deletions tests/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import pytest

from chasten.debug import DebugDestination
from chasten.debug import DebugLevel
from chasten.debug import DebugDestination, DebugLevel


def test_debug_level_values():
Expand Down
6 changes: 2 additions & 4 deletions tests/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
from unittest.mock import patch

import pytest
from hypothesis import given
from hypothesis import strategies
from hypothesis import given, strategies
from rich.tree import Tree

from chasten import constants
from chasten import filesystem
from chasten import constants, filesystem


def test_valid_directory() -> None:
Expand Down
5 changes: 1 addition & 4 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
from unittest.mock import patch

import pytest
from hypothesis import HealthCheck
from hypothesis import given
from hypothesis import settings
from hypothesis import strategies
from hypothesis import HealthCheck, given, settings, strategies
from typer.testing import CliRunner

from chasten import main
Expand Down
6 changes: 2 additions & 4 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import shutil

import pytest
from hypothesis import given
from hypothesis import provisional
from hypothesis import given, provisional
from hypothesis import strategies as st

from chasten import constants
from chasten import util
from chasten import constants, util


def test_human_readable_boolean() -> None:
Expand Down
8 changes: 2 additions & 6 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
"""Pytest test suite for the validate module."""

import pytest
from hypothesis import HealthCheck
from hypothesis import given
from hypothesis import settings
from hypothesis import strategies
from hypothesis import HealthCheck, given, settings, strategies
from hypothesis_jsonschema import from_schema

from chasten.validate import JSON_SCHEMA_CONFIG
from chasten.validate import validate_configuration
from chasten.validate import JSON_SCHEMA_CONFIG, validate_configuration


def test_validate_config_valid_realistic():
Expand Down

0 comments on commit d646e06

Please sign in to comment.