Skip to content

Commit

Permalink
refactor: divide views by file, black, isort,ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Sep 7, 2023
1 parent 570ea83 commit 71b5dd1
Show file tree
Hide file tree
Showing 23 changed files with 326 additions and 314 deletions.
3 changes: 1 addition & 2 deletions ckanext/tour/col_renderers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

from ckanext.toolbelt.decorators import Collector

import ckanext.admin_panel.types as ap_types
from ckanext.toolbelt.decorators import Collector

renderer, get_renderers = Collector("tour").split()

Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/logic/action.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import Any, cast
from datetime import datetime as dt
from typing import Any, cast

import ckan.model as model
import ckan.plugins.toolkit as tk
Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/logic/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ckan.logic.schema import validator_args

from ckanext.tour.model import TourStep, Tour
from ckanext.tour.model import Tour, TourStep

Schema = Dict[str, Any]

Expand Down
7 changes: 4 additions & 3 deletions ckanext/tour/migration/tour/env.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-

from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig

import os
from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config, pool

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
Create Date: 2023-07-23 13:20:58.129326
"""
from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "c9e5d4235e58"
Expand Down
7 changes: 3 additions & 4 deletions ckanext/tour/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
from datetime import datetime
from typing import Any

from sqlalchemy import Column, DateTime, ForeignKey, Text
from sqlalchemy.orm import Query, relationship
from typing_extensions import Self

from ckan import model
from ckan.model.types import make_uuid
from ckan.plugins import toolkit as tk
from sqlalchemy import Column, DateTime, ForeignKey, Text
from sqlalchemy.orm import Query, relationship
from typing_extensions import Self

from ckanext.tour.exception import TourStepFileError

Expand Down
4 changes: 2 additions & 2 deletions ckanext/tour/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import ckan.plugins.toolkit as tk

from ckanext.admin_panel.interfaces import IAdminPanel
from ckanext.admin_panel.types import SectionConfig, ConfigurationItem, ColRenderer

from ckanext.admin_panel.types import (ColRenderer, ConfigurationItem,
SectionConfig)
from ckanext.tour.col_renderers import get_renderers


Expand Down
17 changes: 0 additions & 17 deletions ckanext/tour/templates/tour/base.html

This file was deleted.

2 changes: 1 addition & 1 deletion ckanext/tour/templates/tour/tour_404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'tour/base.html' %}
{% extends 'admin_panel/base.html' %}

{% import 'macros/form.html' as form %}

Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/templates/tour/tour_add.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'tour/base.html' %}
{% extends 'admin_panel/base.html' %}

{% import 'macros/form.html' as form %}

Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/templates/tour/tour_delete.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'tour/base.html' %}
{% extends 'admin_panel/base.html' %}

{% import 'macros/form.html' as form %}

Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/templates/tour/tour_edit.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'tour/base.html' %}
{% extends 'admin_panel/base.html' %}

{% import 'macros/form.html' as form %}

Expand Down
2 changes: 1 addition & 1 deletion ckanext/tour/templates/tour/tour_list.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'tour/base.html' %}
{% extends 'admin_panel/base.html' %}

{% import 'macros/autoform.html' as autoform %}
{% import 'macros/form.html' as form %}
Expand Down
5 changes: 2 additions & 3 deletions ckanext/tour/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from io import BytesIO

import pytest
from faker import Faker
from pytest_factoryboy import register

from ckan.lib import uploader
from ckan.tests import factories
from faker import Faker
from pytest_factoryboy import register

import ckanext.tour.tests.factories as tour_factories
from ckanext.tour.tests.helpers import CSV_DATA, FakeFileStorage
Expand Down
1 change: 0 additions & 1 deletion ckanext/tour/tests/factories.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from io import BytesIO

import factory

from ckan.tests import factories

from ckanext.tour import model as tour_model
Expand Down
8 changes: 2 additions & 6 deletions ckanext/tour/tests/logic/test_action.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from turtle import position
import pytest

import ckan.plugins.toolkit as tk
import pytest
from ckan.tests.helpers import call_action

import ckanext.tour.model as tour_model
Expand Down Expand Up @@ -60,9 +58,7 @@ def test_upload_multiple_image(
tour_id=tour["id"], image=[tour_image_data(), tour_image_data()]
)

def test_missing_element(
self, tour_factory, tour_step_factory, tour_image_data
):
def test_missing_element(self, tour_factory, tour_step_factory, tour_image_data):
tour = tour_factory(steps=[])

with pytest.raises(tk.ValidationError, match="Missing value"):
Expand Down
Loading

0 comments on commit 71b5dd1

Please sign in to comment.