Skip to content

Commit

Permalink
Isort (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 authored Sep 25, 2023
1 parent 05a0d59 commit 00191f9
Show file tree
Hide file tree
Showing 87 changed files with 493 additions and 539 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: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile=black
15 changes: 6 additions & 9 deletions src/redturtle/prenotazioni/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from logging import FileHandler, Formatter, getLogger

import dateutil
import pytz
from AccessControl import Unauthorized
from App.config import getConfiguration
from datetime import datetime
from datetime import timedelta
from DateTime import DateTime
from dateutil.tz.tz import tzutc
from logging import FileHandler
from logging import Formatter
from logging import getLogger
from plone import api
from plone.api.exc import UserNotFoundError
from plone.app.event.base import default_timezone
from redturtle.prenotazioni.utils import is_migration
from six.moves import map
from zope.i18nmessageid import MessageFactory

import dateutil
import pytz

from redturtle.prenotazioni.utils import is_migration

logger = getLogger("redturtle.prenotazioni")
_ = MessageFactory("redturtle.prenotazioni")
Expand Down
10 changes: 4 additions & 6 deletions src/redturtle/prenotazioni/actions/mail.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from Acquisition import aq_base
from Acquisition import aq_inner
import six
from Acquisition import aq_base, aq_inner
from collective.contentrules.mailfromfield import logger
from collective.contentrules.mailfromfield.actions.mail import IMailFromFieldAction
from collective.contentrules.mailfromfield.actions.mail import (
Expand All @@ -10,13 +10,11 @@
from plone.dexterity.interfaces import IDexterityContainer
from plone.event.interfaces import IICalendar
from Products.CMFPlone.interfaces.siteroot import IPloneSiteRoot
from redturtle.prenotazioni.prenotazione_event import IMovedPrenotazione
from six.moves import filter
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import Interface, implementer

import six
from redturtle.prenotazioni.prenotazione_event import IMovedPrenotazione


class MailActionExecutor(BaseExecutor):
Expand Down
22 changes: 10 additions & 12 deletions src/redturtle/prenotazioni/adapters/booker.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# -*- coding: utf-8 -*-
import math
from datetime import timedelta
from random import choice

from plone import api
from plone.memoize.instance import memoize
from random import choice
from redturtle.prenotazioni import _
from redturtle.prenotazioni import datetime_with_tz
from redturtle.prenotazioni import logger
from redturtle.prenotazioni.adapters.slot import BaseSlot
from redturtle.prenotazioni.config import VERIFIED_BOOKING
from redturtle.prenotazioni.content.prenotazione import VACATION_TYPE
from redturtle.prenotazioni.prenotazione_event import MovedPrenotazione
from redturtle.prenotazioni.utilities.dateutils import exceedes_date_limit
from six.moves.urllib.parse import parse_qs
from six.moves.urllib.parse import urlparse
from six.moves.urllib.parse import parse_qs, urlparse
from zope.annotation.interfaces import IAnnotations
from zope.component import Interface
from zope.event import notify
from zope.interface import implementer

import math
from redturtle.prenotazioni import _, datetime_with_tz, logger
from redturtle.prenotazioni.adapters.slot import BaseSlot
from redturtle.prenotazioni.config import VERIFIED_BOOKING
from redturtle.prenotazioni.content.prenotazione import VACATION_TYPE
from redturtle.prenotazioni.prenotazione_event import MovedPrenotazione
from redturtle.prenotazioni.utilities.dateutils import exceedes_date_limit


class BookerException(Exception):
Expand Down
5 changes: 3 additions & 2 deletions src/redturtle/prenotazioni/adapters/conflict.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from datetime import timedelta

import six
from plone.memoize.instance import memoize
from Products.CMFCore.utils import getToolByName
from redturtle.prenotazioni.adapters.slot import BaseSlot
from six.moves import range
from zope.component import Interface
from zope.interface import implementer

import six
from redturtle.prenotazioni.adapters.slot import BaseSlot


class IConflictManager(Interface):
Expand Down
15 changes: 4 additions & 11 deletions src/redturtle/prenotazioni/adapters/ical.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# -*- coding: utf-8 -*-
import icalendar

from Acquisition import aq_inner
from plone.app.event.base import default_timezone
from plone.app.event.ical.exporter import ICalendarEventComponent
from plone.app.event.ical.exporter import PRODID
from plone.app.event.ical.exporter import VERSION
from plone.event.interfaces import IICalendar
from plone.event.interfaces import IICalendarEventComponent
from plone.app.event.ical.exporter import PRODID, VERSION, ICalendarEventComponent
from plone.event.interfaces import IICalendar, IICalendarEventComponent
from plone.registry.interfaces import IRegistry
from plone.stringinterp.interfaces import IStringSubstitution
from plone.stringinterp.interfaces import IContextWrapper
from zope.component import getAdapter
from zope.component import getUtility
from plone.stringinterp.interfaces import IContextWrapper, IStringSubstitution
from zope.component import getAdapter, getUtility
from zope.interface import implementer


from redturtle.prenotazioni import _


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

from plone import api
from plone.event.interfaces import IICalendar
from plone.stringinterp.interfaces import IContextWrapper
from plone.stringinterp.interfaces import IStringInterpolator
from plone.stringinterp.interfaces import IContextWrapper, IStringInterpolator
from Products.DCWorkflow.interfaces import IAfterTransitionEvent
from zope.component import adapter, getAdapter
from zope.interface import implementer

from redturtle.prenotazioni import logger
from redturtle.prenotazioni.content.prenotazione import IPrenotazione
from redturtle.prenotazioni.interfaces import IPrenotazioneEmailMessage
from redturtle.prenotazioni.prenotazione_event import IMovedPrenotazione
from zope.component import adapter
from zope.component import getAdapter
from zope.interface import implementer


class PrenotazioneEventEmailMessage:
Expand Down
3 changes: 1 addition & 2 deletions src/redturtle/prenotazioni/adapters/slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from DateTime import DateTime
from plone.app.event.base import default_timezone
from pyinter.interval import Interval
from six.moves import map
from six.moves import range
from six.moves import map, range
from zope.component import Interface
from zope.interface import implementer

Expand Down
3 changes: 1 addition & 2 deletions src/redturtle/prenotazioni/adapters/stringinterp.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from plone.app.event.base import default_timezone
from plone.stringinterp.adapters import BaseSubstitution
from redturtle.prenotazioni import _
from redturtle.prenotazioni import logger
from zope.component import adapter
from zope.interface import Interface

from redturtle.prenotazioni import _, logger

try:
from plone.app.event.base import spell_date
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/prenotazioni/behaviors/booking_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
from redturtle.prenotazioni import _
from zope import schema
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider
from zope.interface import implementer, provider

from redturtle.prenotazioni import _


@provider(IFormFieldProvider)
Expand Down
3 changes: 2 additions & 1 deletion src/redturtle/prenotazioni/browser/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from plone import api
from plone.memoize.view import memoize
from Products.Five.browser import BrowserView
from zExceptions import NotFound

from redturtle.prenotazioni.adapters.conflict import IConflictManager
from redturtle.prenotazioni.content.prenotazioni_folder import IPrenotazioniFolder
from zExceptions import NotFound


class BaseView(BrowserView):
Expand Down
10 changes: 5 additions & 5 deletions src/redturtle/prenotazioni/browser/delete_reservation.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
from datetime import datetime, time

from AccessControl import Unauthorized
from datetime import datetime
from datetime import time
from plone import api
from plone.memoize.view import memoize
from plone.protect import CheckAuthenticator
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from redturtle.prenotazioni import _
from zExceptions import Forbidden
from zExceptions import NotFound
from zExceptions import Forbidden, NotFound
from zope.i18n import translate

from redturtle.prenotazioni import _


class BaseView(BrowserView):
@property
Expand Down
1 change: 1 addition & 0 deletions src/redturtle/prenotazioni/browser/prenotazione.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from plone.memoize.view import memoize
from plone.protect.authenticator import createToken
from Products.Five.browser import BrowserView

from redturtle.prenotazioni.config import MIN_IN_DAY
from redturtle.prenotazioni.utilities.urls import urlify

Expand Down
30 changes: 13 additions & 17 deletions src/redturtle/prenotazioni/browser/prenotazione_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@
from plone import api
from plone.memoize.view import memoize
from plone.z3cform.layout import wrap_form
from redturtle.prenotazioni import _
from redturtle.prenotazioni import datetime_with_tz
from redturtle.prenotazioni.adapters.booker import BookerException
from redturtle.prenotazioni.adapters.booker import IBooker
from z3c.form import button, field, form
from z3c.form.interfaces import (
HIDDEN_MODE,
ActionExecutionError,
WidgetActionExecutionError,
)
from zope.component import getUtility
from zope.interface import Invalid, implementer
from zope.schema import Text, TextLine
from zope.schema.interfaces import IVocabularyFactory

from redturtle.prenotazioni import _, datetime_with_tz
from redturtle.prenotazioni.adapters.booker import BookerException, IBooker
from redturtle.prenotazioni.browser.week import TIPOLOGIA_PRENOTAZIONE_NAME_COOKIE
from redturtle.prenotazioni.browser.z3c_custom_widget import CustomRadioFieldWidget
from redturtle.prenotazioni.config import REQUIRABLE_AND_VISIBLE_FIELDS
from redturtle.prenotazioni.content.prenotazione import IPrenotazione
from redturtle.prenotazioni.utilities.urls import urlify
from z3c.form import button
from z3c.form import field
from z3c.form import form
from z3c.form.interfaces import ActionExecutionError
from z3c.form.interfaces import HIDDEN_MODE
from z3c.form.interfaces import WidgetActionExecutionError
from zope.component import getUtility
from zope.interface import implementer
from zope.interface import Invalid
from zope.schema import Text
from zope.schema import TextLine
from zope.schema.interfaces import IVocabularyFactory


DEFAULT_REQUIRED_FIELDS = []

Expand Down
24 changes: 8 additions & 16 deletions src/redturtle/prenotazioni/browser/prenotazione_move.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# -*- coding: utf-8 -*-
import logging

from plone import api
from plone.memoize.view import memoize
from plone.protect.utils import addTokenToUrl
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from redturtle.prenotazioni import _
from redturtle.prenotazioni import datetime_with_tz
from redturtle.prenotazioni import tznow
from redturtle.prenotazioni.adapters.booker import BookerException
from redturtle.prenotazioni.adapters.booker import IBooker
from redturtle.prenotazioni.utilities.urls import urlify
from z3c.form import button
from z3c.form import field
from z3c.form import form
from z3c.form import button, field, form
from z3c.form.interfaces import ActionExecutionError
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import Invalid
from zope.schema import Datetime
from zope.schema import TextLine

import logging
from zope.interface import Interface, Invalid, implementer
from zope.schema import Datetime, TextLine

from redturtle.prenotazioni import _, datetime_with_tz, tznow
from redturtle.prenotazioni.adapters.booker import BookerException, IBooker
from redturtle.prenotazioni.utilities.urls import urlify

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions src/redturtle/prenotazioni/browser/prenotazione_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from Products.statusmessages.interfaces import IStatusMessage

from redturtle.prenotazioni import _
from redturtle.prenotazioni.utilities.urls import urlify

Expand Down
32 changes: 12 additions & 20 deletions src/redturtle/prenotazioni/browser/prenotazioni_context_state.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
# -*- coding: utf-8 -*-
from datetime import date
from datetime import datetime
from datetime import timedelta
import itertools
import json
import logging
from datetime import date, datetime, timedelta

import six
from DateTime import DateTime
from plone import api
from plone.memoize.view import memoize
from Products.Five.browser import BrowserView
from redturtle.prenotazioni import _
from redturtle.prenotazioni import get_or_create_obj
from redturtle.prenotazioni import tznow
from six.moves import map, range

from redturtle.prenotazioni import _, get_or_create_obj, tznow
from redturtle.prenotazioni.adapters.booker import IBooker
from redturtle.prenotazioni.adapters.conflict import IConflictManager
from redturtle.prenotazioni.adapters.slot import BaseSlot
from redturtle.prenotazioni.adapters.slot import ISlot
from redturtle.prenotazioni.config import PAUSE_PORTAL_TYPE
from redturtle.prenotazioni.config import PAUSE_SLOT
from redturtle.prenotazioni.adapters.slot import BaseSlot, ISlot
from redturtle.prenotazioni.config import PAUSE_PORTAL_TYPE, PAUSE_SLOT
from redturtle.prenotazioni.content.pause import Pause
from redturtle.prenotazioni.utilities.dateutils import hm2DT
from redturtle.prenotazioni.utilities.dateutils import hm2seconds
from redturtle.prenotazioni.utilities.dateutils import hm2DT, hm2seconds
from redturtle.prenotazioni.utilities.urls import urlify
from six.moves import map
from six.moves import range

import itertools
import json
import logging
import six


logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser import BrowserView
from zope.i18n import translate
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary


class PrenotazioniPortalState(BrowserView):
Expand Down
Loading

0 comments on commit 00191f9

Please sign in to comment.