Skip to content

Commit

Permalink
Isort + CI
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Oct 11, 2023
1 parent d08aaf6 commit 33b9ce9
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 102 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/isort.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Isort
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: isort/isort-action@master
with:
configuration: --profile black
2 changes: 1 addition & 1 deletion src/design/plone/ioprenoto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Init and utils."""
from zope.i18nmessageid import MessageFactory
from redturtle.prenotazioni import config
from zope.i18nmessageid import MessageFactory

_ = MessageFactory("design.plone.ioprenoto")

Expand Down
3 changes: 1 addition & 2 deletions src/design/plone/ioprenoto/adapters/stringinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from plone.registry.interfaces import IRegistry
from plone.volto.interfaces import IVoltoSettings
from redturtle.prenotazioni.adapters import stringinterp as base
from zope.component import adapter
from zope.component import getUtility
from zope.component import adapter, getUtility
from zope.interface import Interface


Expand Down
12 changes: 6 additions & 6 deletions src/design/plone/ioprenoto/behaviors/additional_fields.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from design.plone.ioprenoto import _
from plone.autoform.interfaces import IFormFieldProvider
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.app.vocabularies.catalog import CatalogSource
from plone.supermodel import model
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.autoform import directives
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel import model
from z3c.relationfield.schema import RelationChoice, RelationList
from zope.interface import provider
from zope.schema import Text
from z3c.relationfield.schema import RelationChoice
from z3c.relationfield.schema import RelationList

from design.plone.ioprenoto import _


@provider(IFormFieldProvider)
Expand Down
2 changes: 1 addition & 1 deletion src/design/plone/ioprenoto/locales/update.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

import os
import pkg_resources
import subprocess

import pkg_resources

domain = "design.plone.ioprenoto"
os.chdir(pkg_resources.resource_filename(domain, ""))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer
from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION
from plone import api
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.interfaces import ISerializeToJson, ISerializeToJsonSummary
from plone.restapi.serializer.dxcontent import SerializeFolderToJson
from plone.restapi.serializer.summary import DefaultJSONSummarySerializer
from redturtle.prenotazioni.content.prenotazioni_folder import IPrenotazioniFolder
from zope.component import adapter
from zope.interface import implementer

from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION
from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer

# TODO: move to registry
PRENOTAZIONE_APPUNTAMENTO_ADDRESS = "prenotazione-appuntamenti-uffici"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
from design.plone.contenttypes.restapi.serializers.servizio import (
SerializeServizioToJsonSummary as ServizioSummaryOriginal,
)
from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.interfaces import ISerializeToJson, ISerializeToJsonSummary
from plone.restapi.serializer.dxcontent import SerializeFolderToJson
from zc.relation.interfaces import ICatalog
from zope.component import adapter
from zope.component import getUtility
from zope.component import adapter, getUtility
from zope.interface import implementer
from zope.intid.interfaces import IIntIds
from zope.intid.interfaces import IntIdMissingError
from zope.intid.interfaces import IIntIds, IntIdMissingError

from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer


def has_backreferences(service):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

from plone import api
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.serializer.converters import json_compatible
from plone.restapi.services import Service
from zc.relation.interfaces import ICatalog
from zope.component import getMultiAdapter, getUtility
from zope.intid.interfaces import IIntIds
from plone.restapi.serializer.converters import json_compatible


class BookableList(Service):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-
from plone import api
from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION
from redturtle.prenotazioni.restapi.services.bookings.search import (
from redturtle.prenotazioni.restapi.services.bookings.search import ( # noqa: E501
BookingsSearch as BookingsSearchBase,
)
from redturtle.prenotazioni.restapi.services.bookings.search import (
BookingsSearchFolder as BookingsSearchFolderBase,
) # noqa: E501
)
from zope.interface import implementer
from zope.publisher.interfaces import IPublishTraverse

from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION


# TODO: in alternativa si poteva sovrascrivere il serializer
@implementer(IPublishTraverse)
Expand Down
15 changes: 7 additions & 8 deletions src/design/plone/ioprenoto/testing.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
from design.plone.policy.testing import DesignPlonePolicyRestApiLayer
from design.plone.policy.testing import DesignPlonePolicyLayer
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
import collective.contentrules.mailfromfield
import redturtle.prenotazioni
from design.plone.policy.testing import (
DesignPlonePolicyLayer,
DesignPlonePolicyRestApiLayer,
)
from plone.app.testing import FunctionalTesting, IntegrationTesting, applyProfile
from plone.testing import z2


import design.plone.ioprenoto
import redturtle.prenotazioni
import collective.contentrules.mailfromfield

try:
import design.plone.iocittadino
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-

from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING
import unittest

from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.app.testing import TEST_USER_ID, setRoles

import unittest
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING


class TestPrenotazioniFolder(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# -*- coding: utf-8 -*-
import unittest
from datetime import date
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING

import transaction
from plone import api
from plone.app.testing import (
SITE_OWNER_NAME,
SITE_OWNER_PASSWORD,
TEST_USER_ID,
setRoles,
)
from plone.restapi.testing import RelativeSession
from plone.restapi.serializer.converters import json_compatible
from plone.restapi.testing import RelativeSession

import unittest
import transaction
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING


class TestBookingSchema(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
import unittest

from plone.app.testing import TEST_USER_ID, setRoles
from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory


import unittest
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING


class CustomRequiredFieldsTest(unittest.TestCase):
Expand Down
16 changes: 6 additions & 10 deletions src/design/plone/ioprenoto/tests/test_prenotazione_add.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
from datetime import date
from datetime import timedelta
from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.restapi.testing import RelativeSession
from redturtle.prenotazioni.testing import (
REDTURTLE_PRENOTAZIONI_API_FUNCTIONAL_TESTING,
)

import unittest
from datetime import date, timedelta

import transaction
from plone import api
from plone.app.testing import TEST_USER_ID, setRoles
from plone.restapi.testing import RelativeSession
from redturtle.prenotazioni.testing import REDTURTLE_PRENOTAZIONI_API_FUNCTIONAL_TESTING


class TestPrenotazioniRestAPIAdd(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING
import unittest

from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.app.testing import TEST_USER_NAME
from plone.app.testing import TEST_USER_PASSWORD
from plone.app.testing import TEST_USER_ID, TEST_USER_NAME, TEST_USER_PASSWORD, setRoles
from plone.restapi.testing import RelativeSession
from transaction import commit

import unittest
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING


class SummarySerializerTest(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING
import unittest

from plone import api
from plone.app.testing import setRoles
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import TEST_USER_ID
from plone.app.testing import (
SITE_OWNER_NAME,
SITE_OWNER_PASSWORD,
TEST_USER_ID,
setRoles,
)
from plone.restapi.testing import RelativeSession
from transaction import commit
from z3c.relationfield.relation import RelationValue
Expand All @@ -13,7 +16,7 @@
from zope.intid.interfaces import IIntIds
from zope.lifecycleevent import ObjectModifiedEvent

import unittest
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING


class SummarySerializerTest(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# -*- coding: utf-8 -*-
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING
import unittest

from plone import api
from plone.app.testing import setRoles
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import TEST_USER_ID
from plone.app.testing import (
SITE_OWNER_NAME,
SITE_OWNER_PASSWORD,
TEST_USER_ID,
setRoles,
)
from plone.app.textfield.value import RichTextValue
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.testing import RelativeSession
from transaction import commit
from z3c.relationfield.relation import RelationValue
from zope.component import getMultiAdapter
from zope.component import queryUtility
from zope.component import getMultiAdapter, queryUtility
from zope.intid.interfaces import IIntIds
from plone.app.textfield.value import RichTextValue

import unittest
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING


class BookableUOListTest(unittest.TestCase):
Expand Down
17 changes: 9 additions & 8 deletions src/design/plone/ioprenoto/tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
"""Setup tests for this package."""
import unittest

from plone import api
from plone.app.testing import TEST_USER_ID, setRoles

from design.plone.ioprenoto.testing import ( # noqa: E501
DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING,
)
from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID

import unittest


try:
from Products.CMFPlone.utils import get_installer
Expand All @@ -35,9 +34,10 @@ def test_product_installed(self):

def test_browserlayer(self):
"""Test that IDesignPloneIoprenotoLayer is registered."""
from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer
from plone.browserlayer import utils

from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer

self.assertIn(IDesignPloneIoprenotoLayer, utils.registered_layers())


Expand All @@ -61,7 +61,8 @@ def test_product_uninstalled(self):

def test_browserlayer_removed(self):
"""Test that IDesignPloneIoprenotoLayer is removed."""
from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer
from plone.browserlayer import utils

from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer

self.assertNotIn(IDesignPloneIoprenotoLayer, utils.registered_layers())
23 changes: 8 additions & 15 deletions src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# -*- coding: utf-8 -*-
from datetime import date
import unittest
from datetime import date, datetime

import transaction
from plone import api
from plone.app.testing import (
TEST_USER_ID,
setRoles,
)
from design.plone.ioprenoto.testing import (
DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING,
)
from datetime import datetime
from plone.app.testing import TEST_USER_ID, setRoles
from plone.registry.interfaces import IRegistry
from plone.stringinterp.interfaces import IStringSubstitution
from plone.stringinterp.interfaces import IContextWrapper
from plone.stringinterp.interfaces import IContextWrapper, IStringSubstitution
from plone.volto.interfaces import IVoltoSettings
from redturtle.prenotazioni.adapters.booker import IBooker
from zope.component import getAdapter
from zope.component import getUtility
from zope.component import getAdapter, getUtility

import unittest
import transaction
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING


class TestStringinterpOverrides(unittest.TestCase):
Expand Down
Loading

0 comments on commit 33b9ce9

Please sign in to comment.