Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
btylerburton committed May 23, 2024
1 parent bb102d5 commit e280583
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from flask_bootstrap import Bootstrap
from flask_migrate import Migrate

from database.models import db
from app.scripts.load_manager import load_manager
from database.models import db

load_dotenv()

Expand Down
3 changes: 2 additions & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from flask import Blueprint, flash, jsonify, redirect, render_template, request

from .forms import HarvestSourceForm, OrganizationForm
from database.interface import HarvesterDBInterface

from .forms import HarvestSourceForm, OrganizationForm

mod = Blueprint("harvest", __name__)
db = HarvesterDBInterface()

Expand Down
1 change: 1 addition & 0 deletions app/scripts/load_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from database.interface import HarvesterDBInterface
from harvester.utils import CFHandler

Expand Down
1 change: 1 addition & 0 deletions database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from dotenv import load_dotenv

load_dotenv()
Expand Down
9 changes: 2 additions & 7 deletions database/interface.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import os
import uuid

from sqlalchemy import create_engine, inspect, or_, text
from sqlalchemy.exc import NoResultFound
from sqlalchemy.orm import scoped_session, sessionmaker

from .models import (
HarvestError,
HarvestJob,
HarvestRecord,
HarvestSource,
Organization,
)
from .models import HarvestError, HarvestJob, HarvestRecord, HarvestSource, Organization

DATABASE_URI = os.getenv("DATABASE_URI")

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

from dotenv import load_dotenv

from harvester.logger_config import LOGGING_CONFIG

from database.interface import HarvesterDBInterface
from harvester.logger_config import LOGGING_CONFIG

load_dotenv()

Expand Down
3 changes: 1 addition & 2 deletions harvester/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
from datetime import datetime

from database.interface import HarvesterDBInterface
from . import db_interface
from . import HarvesterDBInterface, db_interface


# critical exceptions
Expand Down
12 changes: 4 additions & 8 deletions harvester/harvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import ckanapi
import requests

from jsonschema import Draft202012Validator

from . import HarvesterDBInterface, db_interface
from .ckan_utils import ckanify_dcatus
from .exceptions import (
CompareException,
Expand All @@ -21,19 +21,15 @@
SynchronizeException,
ValidationException,
)

from .utils import (
dataset_to_hash,
open_json,
download_file,
sort_dataset,
get_title_from_fgdc,
download_waf,
get_title_from_fgdc,
open_json,
sort_dataset,
traverse_waf,
)
from database.interface import HarvesterDBInterface

from . import db_interface

# requests data
session = requests.Session()
Expand Down
2 changes: 1 addition & 1 deletion harvester/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from typing import Union

import requests
from bs4 import BeautifulSoup
import sansjson
from bs4 import BeautifulSoup
from cloudfoundry_client.client import CloudFoundryClient
from cloudfoundry_client.v3.tasks import TaskManager

Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import logging
import os
from pathlib import Path
from unittest.mock import patch

import pytest
from dotenv import load_dotenv
from flask import Flask
from sqlalchemy.orm import scoped_session, sessionmaker

from app import create_app
from flask import Flask
from database.interface import HarvesterDBInterface
from database.models import db
from harvester.utils import CFHandler
Expand Down
12 changes: 8 additions & 4 deletions tests/integration/cf/test_load_manager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from unittest.mock import patch

import pytest

from unittest.mock import patch
from app.scripts.load_manager import load_manager, sort_jobs
from app.scripts.load_manager import CFHandler
from app.scripts.load_manager import HarvesterDBInterface
from app.scripts.load_manager import (
CFHandler,
HarvesterDBInterface,
load_manager,
sort_jobs,
)


@pytest.fixture
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/exception/test_exception_handling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ruff: noqa: F841

from unittest.mock import patch

import ckanapi
import pytest

import harvester
from harvester.exceptions import (
DCATUSToCKANException,
Expand All @@ -10,10 +15,6 @@
)
from harvester.harvest import HarvestSource

import ckanapi
import pytest
from unittest.mock import patch


class TestExceptionHandling:
def test_bad_harvest_source_url_exception(
Expand Down

1 comment on commit e280583

@github-actions
Copy link

Choose a reason for hiding this comment

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

Tests Skipped Failures Errors Time
41 0 💤 0 ❌ 0 🔥 10.754s ⏱️

Please sign in to comment.