Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
siddartham committed Feb 17, 2024
1 parent 55039f8 commit 2af1814
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 48 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ci-install:
{ python3 -m venv venv || py -3 -m venv venv ; } && \
{ venv/Scripts/activate.bat || . venv/bin/activate ; } && \
pip3 install --upgrade pip wheel && \
pip3 install -r test_requirements.txt && \
pip3 install -r requirements.txt && \
echo "Installation complete"

Expand Down Expand Up @@ -69,16 +70,15 @@ requirements:

test:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
make format
if [[ "$$(python -V)" = "Python 3.8."* ]] ;\
then tox -r -p ;\
else tox -r -e pytest ;\
fi

format:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
black . && isort . && flake8


mypy && black . && isort . && flake8

remodel:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
Expand Down
15 changes: 7 additions & 8 deletions attribute_name_validator/__main__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from typing import Any, Union, Tuple
from pathlib import Path
import shutil
import logging
import argparse
import logging
import shutil
from argparse import RawTextHelpFormatter
from .analyze import get_extra_catalog, AttributeNameValidator
from pathlib import Path
from typing import Any, Tuple, Union

from .analyze import AttributeNameValidator, get_extra_catalog
from .config import (
ATTRIBUTE_NAMING_GUIDELINES_AND_ANALYSIS_REPORT_USAGE_HTML_PATH,
CATALOG_XLSX_PATH,
CATALOG_JSON_PATH,
)
CATALOG_JSON_PATH, CATALOG_XLSX_PATH)
from .utilities import iter_csv_files


Expand Down
30 changes: 13 additions & 17 deletions attribute_name_validator/analyze.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
import sob
import csv
import shutil
import logging
import functools
import logging
import shutil
from collections import namedtuple
from configparser import ConfigParser
from math import floor
from pathlib import Path
from configparser import ConfigParser
from collections import namedtuple
from typing import Set, Generator, Callable, Union, Tuple, Iterable, Dict, List
from typing import Callable, Dict, Generator, Iterable, List, Set, Tuple, Union

import sob
from openpyxl import Workbook
from openpyxl.worksheet.worksheet import Worksheet
from openpyxl.styles import Font
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.dimensions import ColumnDimension, DimensionHolder
from openpyxl.styles import Font
from openpyxl.worksheet.worksheet import Worksheet

from . import model
from .config import (
ATTRIBUTE_NAMING_GUIDELINES_AND_ANALYSIS_REPORT_USAGE_HTML_PATH,
ADDITIONAL_QUALIFIER_NEEDED_CLASS_WORDS,
OUTPUT_XLSX_COLUMN_DIMENSIONS,
CATALOG_JSON_PATH,
CATALOG_XLSX_PATH,
)
from .utilities import (
sanitize_ini,
iter_column_names,
)
ATTRIBUTE_NAMING_GUIDELINES_AND_ANALYSIS_REPORT_USAGE_HTML_PATH,
CATALOG_JSON_PATH, CATALOG_XLSX_PATH, OUTPUT_XLSX_COLUMN_DIMENSIONS)
from .utilities import iter_column_names, sanitize_ini

# Defining the data structure for used catalog
UsedCatalog = Dict[str, Dict[str, List[str]]]
Expand Down
1 change: 1 addition & 0 deletions attribute_name_validator/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typing

import sob


Expand Down
4 changes: 2 additions & 2 deletions attribute_name_validator/utilities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Generator, IO, Tuple
from pathlib import Path
import csv
import re
from pathlib import Path
from typing import IO, Generator, Tuple


def iter_csv_files(folder: Path) -> Generator:
Expand Down
5 changes: 3 additions & 2 deletions scripts/remodel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from pathlib import Path

import sob
from oapi.oas import model
from oapi.model import Module # noqa
from pathlib import Path
from oapi.oas import model

_PROJECT_PATH: Path = Path(__file__).absolute().parent.parent
OPENAPI_JSON: str = str(_PROJECT_PATH.joinpath("openapi.json"))
Expand Down
16 changes: 8 additions & 8 deletions scripts/update_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
document to '../attribute_name_validator/catalog.json'.
"""

import shutil
import sob
import os
import shutil
from collections import namedtuple
from dataclasses import dataclass # type: ignore
from itertools import islice
from collections import namedtuple
from pathlib import Path
from typing import Any, Dict, Iterable, Tuple, Type

import sob
from openpyxl import Workbook, load_workbook # type: ignore
from openpyxl.cell import Cell # type: ignore
from typing import Iterable, Tuple, Type, Dict, Any
from pathlib import Path

from attribute_name_validator import model
from attribute_name_validator.config import (
CATALOG_JSON_PATH,
CATALOG_XLSX_PATH,
ATTRIBUTE_NAMING_GUIDELINES_AND_ANALYSIS_REPORT_USAGE_HTML_PATH,
)
CATALOG_JSON_PATH, CATALOG_XLSX_PATH)

PROJECT_PATH: Path = Path(__file__).absolute().parent.parent
CATALOG_XLSX: str = str(PROJECT_PATH.joinpath("CATALOG.xlsx"))
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mypy
pip
pytest
tox
isort
13 changes: 6 additions & 7 deletions tests/test_attribute_name_validator.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# import os
import importlib.util
import sys
import unittest
import importlib.util
from importlib.machinery import ModuleSpec
from pathlib import Path
from types import ModuleType
from typing import Optional, Any
from importlib.machinery import ModuleSpec
from attribute_name_validator.analyze import (
AttributeNameValidator,
get_extra_catalog,
)
from typing import Any, Optional

from attribute_name_validator.analyze import (AttributeNameValidator,
get_extra_catalog)
from attribute_name_validator.utilities import iter_csv_files

TEST_DIRECTORY_PATH: Path = Path(__file__).absolute().parent
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
requires =
pip
envlist = pytest, black, flake8, mypy
envlist = pytest, flake8, mypy

[testenv]
passenv =
Expand Down

0 comments on commit 2af1814

Please sign in to comment.