Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
These are mostly documentation changes. Some of the docstrings might influence the public availability of the methods on an object.

Co-authored-by: Michael Howitz <[email protected]>
  • Loading branch information
sallner and Michael Howitz authored Sep 22, 2023
1 parent 3743bf1 commit e0f172c
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: pre-commit

on:
pull_request:

Expand Down
5 changes: 1 addition & 4 deletions src/OFS/DTMLDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):

# Replace change_dtml_methods by change_dtml_documents
__ac_permissions__ = tuple([
# fmt: off
(perms[0] == change_dtml_methods) and # NOQA: W504
(change_dtml_documents, perms[1]) or perms
# fmt: on
(change_dtml_documents, perms[1]) if (perms[0] == change_dtml_methods) else perms
for perms in DTMLMethod.__ac_permissions__])

def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
Expand Down
4 changes: 2 additions & 2 deletions src/OFS/EtagSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@


class EtagBaseInterface(Interface):
"""\\ Basic Etag support interface, meaning the object supports generating
"""Basic Etag support interface, meaning the object supports generating
an Etag that can be used by certain HTTP and WebDAV Requests."""
def http__etag():
"""\\ Entity tags are used for comparing two or more entities from the
"""Entity tags are used for comparing two or more entities from the
same requested resource.
Predominantly used for Caching, Etags can also be used to deal
Expand Down
4 changes: 3 additions & 1 deletion src/OFS/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,9 @@ def tag(
intelligently for 'height', 'width', and 'alt'. If specified,
the 'scale', 'xscale', and 'yscale' keyword arguments will be
used to automatically adjust the output height and width values
of the image tag. # Since 'class' is a Python reserved word, it
of the image tag.
Since 'class' is a Python reserved word, it
cannot be passed in directly in keyword arguments which is a
problem if you are trying to use 'tag()' to include a CSS class.
The tag() method will accept a 'css_class' argument that will be
Expand Down
1 change: 0 additions & 1 deletion src/OFS/PropertySheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ def get(self, name, default=None):

@security.protected(manage_properties)
def manage_addPropertySheet(self, id, ns, REQUEST=None):
""""""
md = {'xmlns': ns}
ps = self.PropertySheetClass(id, md)
self.addPropertySheet(ps)
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/SimpleItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def raise_standardErrorMessage(
tb = None

def manage(self, URL1):
""""""
"""Redirect to manage_main."""
raise Redirect("%s/manage_main" % URL1)

# This keeps simple items from acquiring their parents
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class ILockItem(Interface):
# XXX: WAAAA! What is a ctor doing in the interface?
def __init__(creator, owner, depth=0, timeout='Infinity',
locktype='write', lockscope='exclusive', token=None):
"""\\ If any of the following are untrue, a **ValueError** exception
"""If any of the following are untrue, a **ValueError** exception
will be raised.
- **creator** MUST be a Zope user object or string to find a
Expand Down
1 change: 0 additions & 1 deletion src/OFS/tests/testFindSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class DummyItem(FindSupport):
""""""

def __init__(self, id, text=''):
self.id = id
Expand Down
4 changes: 2 additions & 2 deletions src/OFS/userfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def manage_userFolderProperties(
REQUEST=None,
manage_tabs_message=None
):
""""""
"""Manage user folder properties."""
return self._userFolderProperties(
self,
REQUEST,
Expand Down Expand Up @@ -321,7 +321,7 @@ def _createInitialUser(self):


def manage_addUserFolder(self, dtself=None, REQUEST=None, **ignored):
""""""
"""Add a user folder."""
f = UserFolder()
self = self.this()
try:
Expand Down
2 changes: 1 addition & 1 deletion src/Products/Five/browser/tests/test_defaultview.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_default_view():


def test_default_method_args_marshalling():
"""\\ Test the default call method of a view, with respect to possible
"""Test the default call method of a view, with respect to possible
breakage of argument marshalling from other components.
This is not directly a bug in Five, just a change that enables
Expand Down
2 changes: 1 addition & 1 deletion src/Products/SiteAccess/VirtualHostMonster.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def __bobo_traverse__(self, request, name):


def manage_addVirtualHostMonster(self, id=None, REQUEST=None, **ignored):
""""""
"""Add a virtual host monster."""
container = self.this()
vhm = VirtualHostMonster()
container._setObject(vhm.getId(), vhm)
Expand Down
8 changes: 2 additions & 6 deletions src/Shared/DC/Scripts/Signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,14 @@ def __init__(self, varnames=(), argcount=-1):
def __eq__(self, other):
if not isinstance(other, FuncCode):
return False
# fmt: off
return ((self.co_argcount, self.co_varnames) == # NOQA: W504
return ((self.co_argcount, self.co_varnames) ==
(other.co_argcount, other.co_varnames))
# fmt: on

def __lt__(self, other):
if not isinstance(other, FuncCode):
return False
# fmt: off
return ((self.co_argcount, self.co_varnames) < # NOQA: W504
return ((self.co_argcount, self.co_varnames) <
(other.co_argcount, other.co_varnames))
# fmt: on


def _setFuncSignature(self, defaults=None, varnames=(), argcount=-1):
Expand Down
5 changes: 3 additions & 2 deletions src/Testing/ZopeTestCase/ZopeLite.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
Typically used as in
import ZopeLite as Zope2 Zope2.installProduct('SomeProduct') app =
Zope2.app()
>>> import ZopeLite as Zope2
>>> Zope2.installProduct('SomeProduct')
>>> app = Zope2.app()
"""

import os
Expand Down
3 changes: 1 addition & 2 deletions src/ZPublisher/tests/testHTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,7 @@ def test_unauthorized_no_debug_mode(self):
except Unauthorized as raised:
self.assertEqual(response.status, 200) # publisher sets 401 later
self.assertIn(
"You are not authorized "
"to access this resource.",
"You are not authorized to access this resource.",
str(raised)
)
else:
Expand Down
1 change: 0 additions & 1 deletion src/ZPublisher/tests/test_pubevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ def cleanup():


def _succeed():
""""""
return 'success'


Expand Down
2 changes: 1 addition & 1 deletion src/webdav/hookable_PUT.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def PUT_factory(self, name, typ, body):
""""""
"""PUT factory"""
if TEXT_PATTERN.match(typ):
return OFS.DTMLMethod.DTMLMethod('', __name__=name)
return None

0 comments on commit e0f172c

Please sign in to comment.