Skip to content

Commit

Permalink
Isort + config isort + ci isort (#80)
Browse files Browse the repository at this point in the history
* Isort + config

* Bad rebase fix

* changelog

* fix isort

---------

Co-authored-by: Mauro Amico <[email protected]>
  • Loading branch information
folix-01 and mamico authored Nov 17, 2023
1 parent 665103a commit 3aacb1a
Show file tree
Hide file tree
Showing 45 changed files with 163 additions and 129 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/isort.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Run isort
on:
- push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@v1
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
profile=black
force_single_line = true
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
5.4.1 (unreleased)
------------------

- Nothing changed yet.
- Isort
[folix-01]


5.4.0 (2023-11-14)
Expand All @@ -17,7 +18,6 @@ Changelog
original rules adding 'Allow: /*?expand*'
[lucabel]


5.3.0 (2023-10-25)
------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from setuptools import find_packages
from setuptools import setup


long_description = "\n\n".join(
[
open("README.rst").read(),
Expand Down
8 changes: 4 additions & 4 deletions src/redturtle/volto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
"""Init and utils."""
import logging
import re

from plone.app.content.browser.vocabulary import PERMISSIONS
from plone.folder.nogopip import GopipIndex
from plone.restapi.serializer import utils
from Products.ZCatalog.Catalog import Catalog
from redturtle.volto.catalogplan import Catalog_sorted_search_indexes
from zope.i18nmessageid import MessageFactory
from ZTUtils.Lazy import LazyCat
from ZTUtils.Lazy import LazyMap

import logging
import re

from redturtle.volto.catalogplan import Catalog_sorted_search_indexes

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/volto/adapters/stringinterp.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from plone.stringinterp.adapters import BaseSubstitution
from Products.CMFCore.interfaces import IContentish
from redturtle.volto import _
from zope.component import adapter

from redturtle.volto import _

try:
from plone.stringinterp import _ as stringinterp_mf
Expand Down
1 change: 1 addition & 0 deletions src/redturtle/volto/browser/controlpanel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper
from plone.app.registry.browser.controlpanel import RegistryEditForm

from redturtle.volto import _
from redturtle.volto.interfaces import IRedTurtleVoltoSettings

Expand Down
9 changes: 4 additions & 5 deletions src/redturtle/volto/browser/find_blocks.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
from Acquisition import aq_base
import json
import logging
from copy import deepcopy

from Acquisition import aq_base
from plone import api
from plone.dexterity.utils import iterSchemata
from Products.Five import BrowserView
from zope.schema import getFieldsInOrder

import json
import logging


logger = logging.getLogger(__name__)

BLOCKS = [
Expand Down
12 changes: 6 additions & 6 deletions src/redturtle/volto/browser/fix_links.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
import json
import logging
import re
from urllib.parse import urlparse
from urllib.parse import urlunparse

from Acquisition import aq_base
from plone import api
from plone.dexterity.utils import iterSchemata
from plone.restapi.interfaces import IFieldDeserializer
from Products.Five import BrowserView
from zope.component import queryMultiAdapter
from zope.schema import getFieldsInOrder
from urllib.parse import urlparse, urlunparse

import json
import logging
import re


logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/volto/browser/sitemap.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
import datetime

from BTrees.OOBTree import OOBTree
from plone.app.layout.sitemap.sitemap import SiteMapView as LayoutSiteMapView
from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.interfaces import IPloneSiteRoot
from zope.component import getUtility

import datetime


class SiteMapView(LayoutSiteMapView):
def objects(self):
Expand Down
1 change: 0 additions & 1 deletion src/redturtle/volto/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os


MAX_LIMIT = int(os.environ.get("REDTURTLE_VOLTO_MAX_LIMIT_SEARCH") or 500)
3 changes: 2 additions & 1 deletion src/redturtle/volto/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from plone.restapi.controlpanels.interfaces import IControlpanel
from redturtle.volto import _
from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.schema import Bool

from redturtle.volto import _


class IRedturtleVoltoLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/volto/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 = "redturtle.volto"
os.chdir(pkg_resources.resource_filename(domain, ""))
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/volto/monkey.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
import os

from Acquisition import aq_base
from plone.app.caching import purge
from plone.app.event.base import dt_start_of_day
Expand All @@ -10,9 +13,6 @@
from Products.CMFPlone.interfaces import IConstrainTypes
from zope.globalrequest import getRequest

import datetime
import os


def occurrences(self, range_start=None, range_end=None):
"""Return all occurrences of an event, possibly within a start and end
Expand Down
3 changes: 2 additions & 1 deletion src/redturtle/volto/restapi/deserializer/blocks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from copy import deepcopy

from plone.restapi.behaviors import IBlocks
from plone.restapi.deserializer.blocks import path2uid
from plone.restapi.interfaces import IBlockFieldDeserializationTransformer
from Products.CMFPlone.interfaces import IPloneSiteRoot
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from zope.component import adapter
from zope.interface import implementer

from redturtle.volto.interfaces import IRedturtleVoltoLayer

EXCLUDE_KEYS = ["@type", "token", "value", "@id", "query"]
EXCLUDE_TYPES = ["title", "listing", "calendar", "searchEvents"]
Expand Down
8 changes: 4 additions & 4 deletions src/redturtle/volto/restapi/deserializer/dxfields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
import dateutil
import lxml
import pytz
from plone.app.contenttypes.interfaces import ILink
from plone.app.dexterity.behaviors.metadata import IPublication
from plone.app.event.base import default_timezone
Expand All @@ -18,7 +21,6 @@
from Products.CMFPlone.utils import safe_unicode
from pytz import timezone
from pytz import utc
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from z3c.form.interfaces import IDataManager
from zope.component import adapter
from zope.component import getMultiAdapter
Expand All @@ -27,9 +29,7 @@
from zope.schema.interfaces import IDatetime
from zope.schema.interfaces import ITextLine

import dateutil
import lxml
import pytz
from redturtle.volto.interfaces import IRedturtleVoltoLayer


@implementer(IFieldDeserializer)
Expand Down
7 changes: 4 additions & 3 deletions src/redturtle/volto/restapi/search/query.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
import re

from plone.restapi.interfaces import IIndexQueryParser
from plone.restapi.search.query import (
ZCTextIndexQueryParser as BaseZCTextIndexQueryParser,
)
from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import implementer

import re
from redturtle.volto.interfaces import IRedturtleVoltoLayer


@implementer(IIndexQueryParser)
Expand Down
3 changes: 2 additions & 1 deletion src/redturtle/volto/restapi/serializer/blocks.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
from copy import deepcopy

from plone import api
from plone.restapi.behaviors import IBlocks
from plone.restapi.interfaces import IBlockFieldSerializationTransformer
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.serializer.blocks import uid_to_url
from Products.CMFPlone.interfaces import IPloneSiteRoot
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from zope.component import adapter
from zope.component import getMultiAdapter
from zope.globalrequest import getRequest
from zope.interface import implementer

from redturtle.volto.interfaces import IRedturtleVoltoLayer

EXCLUDE_KEYS = ["@type"]
EXCLUDE_TYPES = ["title", "listing"]
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/volto/restapi/serializer/dxfields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import re

from plone.app.contenttypes.interfaces import ILink
from plone.app.contenttypes.utils import replace_link_variables_by_paths
from plone.app.dexterity.behaviors.metadata import IPublication
Expand All @@ -7,14 +9,12 @@
from plone.restapi.serializer.converters import json_compatible
from plone.restapi.serializer.dxfields import DefaultFieldSerializer
from plone.restapi.serializer.utils import uid_to_url
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from zope.component import adapter
from zope.interface import implementer
from zope.schema.interfaces import IDatetime
from zope.schema.interfaces import ITextLine

import re

from redturtle.volto.interfaces import IRedturtleVoltoLayer

RESOLVEUID_RE = re.compile(".*?/resolve[Uu]id/([^/]*)/?(.*)$")

Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/volto/restapi/serializer/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
DefaultJSONSummarySerializer as BaseSerializer,
)
from plone.restapi.serializer.utils import uid_to_url
from redturtle.volto.interfaces import IRedturtleVoltoLayer
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import implementer

from redturtle.volto.interfaces import IRedturtleVoltoLayer

EMPTY_STRINGS = ["None"]

Expand Down
7 changes: 4 additions & 3 deletions src/redturtle/volto/restapi/services/controlpanel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from plone.restapi.controlpanels import RegistryConfigletPanel
from redturtle.volto.interfaces import IRedTurtleVoltoSettings
from redturtle.volto.interfaces import IRedTurtleVoltoSettingsControlpanel
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import implementer

from redturtle.volto.interfaces import IRedTurtleVoltoSettings
from redturtle.volto.interfaces import IRedTurtleVoltoSettingsControlpanel


@adapter(Interface, Interface)
Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/volto/restapi/services/navigation/get.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
from plone.app.layout.navigation.navtree import buildFolderTree
from plone.app.layout.navigation.navtree import NavtreeStrategyBase
from plone.app.layout.navigation.navtree import buildFolderTree
from plone.dexterity.interfaces import IDexterityContainer
from plone.restapi.interfaces import IExpandableElement
from plone.restapi.services import Service
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import implementer


@implementer(IExpandableElement)
Expand Down
10 changes: 5 additions & 5 deletions src/redturtle/volto/restapi/services/querystringsearch/get.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
import logging
from datetime import datetime
from urllib import parse

from DateTime import DateTime
from plone import api
from plone.app.event.base import get_events
Expand All @@ -11,17 +14,14 @@
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.interfaces import ISerializeToJsonSummary
from plone.restapi.services import Service
from plone.restapi.services.querystringsearch.get import SUPPORT_NOT_UUID_QUERIES
from plone.restapi.services.querystringsearch.get import (
QuerystringSearch as BaseQuerystringSearch,
)
from plone.restapi.services.querystringsearch.get import SUPPORT_NOT_UUID_QUERIES
from redturtle.volto.config import MAX_LIMIT
from urllib import parse
from zExceptions import BadRequest
from zope.component import getMultiAdapter

import logging

from redturtle.volto.config import MAX_LIMIT

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/volto/restapi/services/search/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from plone.restapi.search.handler import SearchHandler as OriginalHandler
from plone.restapi.search.utils import unflatten_dotted_dict
from plone.restapi.services import Service
from zope.component import getMultiAdapter

from redturtle.volto import logger
from redturtle.volto.config import MAX_LIMIT
from redturtle.volto.interfaces import IRedTurtleVoltoSettings
from zope.component import getMultiAdapter


# search for 'ranking' in 'SearchableText' and rank very high
# when the term is in 'Subject' and high when it is in 'Title'.
Expand Down
Loading

0 comments on commit 3aacb1a

Please sign in to comment.