Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Sep 21, 2023
1 parent 813b906 commit 881558d
Show file tree
Hide file tree
Showing 240 changed files with 1,971 additions and 2,221 deletions.
9 changes: 4 additions & 5 deletions docs/zdgbook/examples/PollImplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@


class PollImplementation:
"""
A multiple choice poll, implements the Poll interface.
"""A multiple choice poll, implements the Poll interface.
The poll has a question and a sequence of responses. Votes
are stored in a dictionary which maps response indexes to a
number of votes.
The poll has a question and a sequence of responses. Votes are
stored in a dictionary which maps response indexes to a number of
votes.
"""

__implements__ = Poll
Expand Down
9 changes: 4 additions & 5 deletions docs/zdgbook/examples/PollProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@


class PollProduct(Implicit, Persistent, RoleManager, Item):
"""
Poll product class, implements Poll interface.
"""Poll product class, implements Poll interface.
The poll has a question and a sequence of responses. Votes
are stored in a dictionary which maps response indexes to a
number of votes.
The poll has a question and a sequence of responses. Votes are
stored in a dictionary which maps response indexes to a number of
votes.
"""

__implements__ = Poll
Expand Down
20 changes: 7 additions & 13 deletions src/App/ApplicationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def db(self):


class DatabaseChooser(Tabs, Traversable, Implicit):
""" Choose which database to view
"""
"""Choose which database to view."""

__allow_access_to_unprotected_subobjects__ = 1

Expand All @@ -69,8 +68,7 @@ class DatabaseChooser(Tabs, Traversable, Implicit):

def getDatabaseNames(self, quote=False):
configuration = getConfiguration()
names = configuration.dbtab.listDatabaseNames()
names.sort()
names = sorted(configuration.dbtab.listDatabaseNames())
if quote:
return [(name, parse.quote(name)) for name in names]
return names
Expand All @@ -94,8 +92,7 @@ def __bobo_traverse__(self, request, name):


class ConfigurationViewer(Tabs, Traversable, Implicit):
""" Provides information about the running configuration
"""
"""Provides information about the running configuration."""
manage = manage_main = manage_workspace = DTMLFile('dtml/cpConfiguration',
globals())
manage_main._setName('manage_main')
Expand Down Expand Up @@ -145,8 +142,7 @@ def manage_getConfiguration(self):


class DebugManager(Tabs, Traversable, Implicit):
""" Debug and profiling information
"""
"""Debug and profiling information."""
manage = manage_main = manage_workspace = DTMLFile('dtml/debug', globals())
manage_main._setName('manage_main')
id = 'DebugInfo'
Expand Down Expand Up @@ -240,8 +236,7 @@ class ApplicationManager(CacheManager,
Tabs,
Traversable,
Implicit):
"""System management
"""
"""System management."""
__allow_access_to_unprotected_subobjects__ = 1
__roles__ = ('Manager',)

Expand Down Expand Up @@ -312,8 +307,7 @@ def getCLIENT_HOME(self):


class AltDatabaseManager(Traversable, UndoSupport):
""" Database management DBTab-style
"""
"""Database management DBTab-style."""
id = 'DatabaseManagement'
name = title = 'Database Management'
meta_type = 'Database Management'
Expand Down Expand Up @@ -371,7 +365,7 @@ def manage_minimize(self, value=1, REQUEST=None):

@requestmethod('POST')
def manage_pack(self, days=0, REQUEST=None):
"""Pack the database"""
"""Pack the database."""
if not isinstance(days, (int, float)):
try:
days = float(days)
Expand Down
16 changes: 6 additions & 10 deletions src/App/CacheManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
##############################################################################
"""Cache management support.
This class is mixed into the application manager in App.ApplicationManager.
This class is mixed into the application manager in
App.ApplicationManager.
"""

from AccessControl.class_init import InitializeClass
from Acquisition import aq_parent


class CacheManager:
"""Cache management mix-in
"""
"""Cache management mix-in."""

def _getDB(self):
try:
Expand All @@ -34,10 +34,8 @@ def cache_size(self):
return db.getCacheSize()

def cache_detail(self, REQUEST=None):
"""
Returns the name of the classes of the objects in the cache
and the number of objects in the cache for each class.
"""
"""Returns the name of the classes of the objects in the cache and the
number of objects in the cache for each class."""
detail = self._getDB().cacheDetail()
if REQUEST is not None:
# format as text
Expand All @@ -48,9 +46,7 @@ def cache_detail(self, REQUEST=None):
return detail

def cache_extreme_detail(self, REQUEST=None):
"""
Returns information about each object in the cache.
"""
"""Returns information about each object in the cache."""
detail = self._getDB().cacheExtremeDetail()
if REQUEST is not None:
# sort the list.
Expand Down
42 changes: 21 additions & 21 deletions src/App/Dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Common HTML dialog boxes.
"""Common HTML dialog boxes
MessageDialog(title, message, action, [target])
MessageDialog(title, message, action, [target])
A very simple dialog used to display an HTML page titled title,
displaying message message and an OK button. Clicking the OK
button will take the browser to the URL specified in action.
The *optional* target argument can be used to force a (frames
capable) browser to load the URL specified in action into a specific
frame. (Specifying '_new' will cause the browser to load the
specified URL into a new window, for example).
A very simple dialog used to display an HTML page titled title,
displaying message message and an OK button. Clicking the OK
button will take the browser to the URL specified in action.
The *optional* target argument can be used to force a (frames
capable) browser to load the URL specified in action into a specific
frame. (Specifying '_new' will cause the browser to load the
specified URL into a new window, for example).
example usage:
<PRE>
return MessageDialog(title='Just thought you should know...',
message='You have wiped out your data.',
action='/paid_tech_support/prices.html',
target='_top')
</PRE>"""
example usage:
<PRE>
return MessageDialog(title='Just thought you should know...',
message='You have wiped out your data.',
action='/paid_tech_support/prices.html',
target='_top')
</PRE>
"""

from App.special_dtml import HTML


class MessageDialogHTML(HTML):
"""A special version of HTML which is always published as text/html
"""
"""A special version of HTML which is always published as text/html."""

def __call__(self, *args, **kw):
class _HTMLString(str):
"""A special string that will be published as text/html
"""
"""A special string that will be published as text/html."""

def asHTML(self):
return self
return _HTMLString(super().__call__(*args, **kw))
Expand Down
2 changes: 1 addition & 1 deletion src/App/Extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _getPath(home, prefix, name, suffixes):


def getPath(prefix, name, checkProduct=1, suffixes=('',), cfg=None):
"""Find a file in one of several relative locations
"""Find a file in one of several relative locations.
Arguments:
Expand Down
14 changes: 5 additions & 9 deletions src/App/FactoryDispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@


def _product_packages():
"""Returns all product packages including the regularly defined
zope2 packages and those without the Products namespace package.
"""
"""Returns all product packages including the regularly defined zope2
packages and those without the Products namespace package."""
import Products

_packages = {}
Expand All @@ -46,8 +45,7 @@ def _product_packages():


class Product(Base):
"""Model a non-persistent product wrapper.
"""
"""Model a non-persistent product wrapper."""

security = ClassSecurityInfo()

Expand Down Expand Up @@ -96,8 +94,7 @@ def __bobo_traverse__(self, REQUEST, name):


class FactoryDispatcher(Implicit):
"""Provide a namespace for product "methods"
"""
"""Provide a namespace for product "methods"."""

security = ClassSecurityInfo()

Expand Down Expand Up @@ -158,8 +155,7 @@ def __getattr__(self, name):

# Provide a replacement for manage_main that does a redirection:
def manage_main(trueself, self, REQUEST, update_menu=0):
"""Implement a contents view by redirecting to the true view
"""
"""Implement a contents view by redirecting to the true view."""
REQUEST.RESPONSE.redirect(self.DestinationURL() + '/manage_main')


Expand Down
6 changes: 3 additions & 3 deletions src/App/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Image object that is stored in a file"""
"""Image object that is stored in a file."""

import os.path
import stat
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(self, path, _prefix=None):
self.lmh = rfc1123_date(self.lmt)

def index_html(self, REQUEST, RESPONSE):
"""Default document"""
"""Default document."""
# HTTP If-Modified-Since header handling. This is duplicated
# from OFS.Image.Image - it really should be consolidated
# somewhere...
Expand Down Expand Up @@ -122,7 +122,7 @@ def index_html(self, REQUEST, RESPONSE):

@security.public
def HEAD(self, REQUEST, RESPONSE):
""" """
""""""
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Last-Modified', self.lmh)
return ''
Expand Down
10 changes: 4 additions & 6 deletions src/App/Management.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Standard management interface support
"""
"""Standard management interface support."""

import html
import itertools
Expand Down Expand Up @@ -69,8 +68,7 @@ def filtered_manage_options(self, REQUEST=None):
manage_workspace__roles__ = ('Authenticated',)

def manage_workspace(self, REQUEST):
"""Dispatch to first interface in manage_options
"""
"""Dispatch to first interface in manage_options."""
options = self.filtered_manage_options(REQUEST)
try:
m = options[0]['action']
Expand Down Expand Up @@ -138,7 +136,7 @@ def tabs_path_info(self, script, path):

@implementer(INavigation)
class Navigation(Base):
"""Basic navigation UI support"""
"""Basic navigation UI support."""

security = ClassSecurityInfo()

Expand Down Expand Up @@ -183,7 +181,7 @@ def manage_page_header(self, *args, **kw):

@security.public
def manage_zmi_logout(self, REQUEST, RESPONSE):
"""Logout current user"""
"""Logout current user."""
p = getattr(REQUEST, '_logout_path', None)
if p is not None:
return self.restrictedTraverse(*p)
Expand Down
6 changes: 2 additions & 4 deletions src/App/ProductContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Objects providing context for product initialization
"""
"""Objects providing context for product initialization."""

import os
from logging import getLogger
Expand Down Expand Up @@ -47,7 +46,7 @@ def registerClass(self, instance_class=None, meta_type='',
icon=None, permissions=None, legacy=(),
visibility="Global", interfaces=_marker,
container_filter=None):
"""Register a constructor
"""Register a constructor.
Keyword arguments are used to provide meta data:
Expand Down Expand Up @@ -92,7 +91,6 @@ class will be registered.
filter is called before showing ObjectManager's Add list,
and before pasting (after object copy or cut), but not
before calling an object's constructor.
"""
pack = self.__pack
initial = constructors[0]
Expand Down
6 changes: 2 additions & 4 deletions src/App/Undo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Undo support.
"""
"""Undo support."""

import binascii

Expand Down Expand Up @@ -99,8 +98,7 @@ def undoable_transactions(self, first_transaction=None,

@security.protected(undo_changes)
def manage_undo_transactions(self, transaction_info=(), REQUEST=None):
"""
"""
""""""
tids = []
descriptions = []
for tid in transaction_info:
Expand Down
6 changes: 3 additions & 3 deletions src/App/ZApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Implement an bobo_application object that is BoboPOS3 aware
"""Implement an bobo_application object that is BoboPOS3 aware.
This module provides a wrapper that causes a database connection to be created
and used when bobo publishes a bobo_application object.
This module provides a wrapper that causes a database connection to be
created and used when bobo publishes a bobo_application object.
"""


Expand Down
Loading

0 comments on commit 881558d

Please sign in to comment.