Skip to content

Commit 7a5ada7

Browse files
committed
models.Node comments grammar fix
1 parent 4e7e8af commit 7a5ada7

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ dist/
1717

1818
tests/reports/*.xml
1919
.python-version
20+
.aider*

business_logic/models/node.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
class Node(NS_Node):
1919
"""
2020
Derived from `treebeard.NS_Node <https://django-treebeard.readthedocs.io/en/latest/ns_tree.html#treebeard.ns_tree.NS_Node>`_.
21-
Holds structure of syntax tree. All objects are linked using the
21+
Holds the structure of the syntax tree. All objects are linked using the
2222
`django contenttypes framework <https://docs.djangoproject.com/en/2.1/ref/contrib/contenttypes/>`_.
2323
Interprets code using the :func:`business_logic.models.Node.interpret` method.
24-
Can acts as parent of code block if not contains content_object.
25-
Can contains comment.
24+
Can act as a parent of a code block if it does not contain a content_object.
25+
Can contain a comment.
2626
2727
See Also:
2828
* :class:`business_logic.models.NodeCache`
@@ -54,7 +54,7 @@ def ensure_content_object_saved(**kwargs):
5454
@classmethod
5555
def add_root(cls, **kwargs):
5656
"""
57-
Adds a root node to the tree. Saves content_objects if needed.
57+
Adds a root node to the tree. Saves content_objects if necessary.
5858
Args:
5959
**kwargs: kwargs for :class:`business_logic.models.Node` constructor
6060
@@ -66,7 +66,7 @@ def add_root(cls, **kwargs):
6666

6767
def add_child(self, **kwargs):
6868
"""
69-
Adds a child to the node. Saves content_objects if needed.
69+
Adds a child to the node. Saves content_objects if necessary.
7070
7171
Args:
7272
**kwargs: kwargs for :class:`business_logic.models.Node` constructor
@@ -79,7 +79,7 @@ def add_child(self, **kwargs):
7979

8080
def delete(self):
8181
"""
82-
Removes a node and all it’s descendants, and content_objects if needed.
82+
Removes a node and all its descendants, and content_objects if necessary.
8383
"""
8484
if (self.object_id and self.content_object and
8585
self.content_type.app_label == ContentType.objects.get_for_model(self.__class__).app_label):
@@ -92,10 +92,10 @@ def delete(self):
9292

9393
def clone(self):
9494
"""
95-
Creates a clone of entire tree starting from self
95+
Creates a clone of the entire tree starting from self.
9696
9797
Returns:
98-
:class:`business_logic.models.Node`: root node of cloned tree
98+
:class:`business_logic.models.Node`: root node of the cloned tree.
9999
100100
"""
101101
class CloneVisitor(NodeVisitor):
@@ -133,7 +133,7 @@ def visit(self, node):
133133

134134
def interpret(self, ctx):
135135
"""
136-
Interprets the held code.
136+
Interprets the code held.
137137
138138
Args:
139139
ctx(:class:`business_logic.models.Context`): execution context
@@ -204,7 +204,7 @@ def is_content_object_interpret_children_itself(self):
204204

205205
def pprint(self):
206206
"""
207-
Prints entire tree starting from self to stdout.
207+
Prints the entire tree starting from self to stdout.
208208
209209
Utility function for development purposes.
210210
"""
@@ -223,18 +223,18 @@ def visit(self, node):
223223

224224
class NodeCache:
225225
"""
226-
Creates cache with preloaded content objects for entire tree
227-
on first call of get_children().
226+
Creates a cache with preloaded content objects for the entire tree
227+
on the first call of get_children().
228228
229-
Uses `1 + n` SQL queries, where n is count of used content types.
229+
Uses `1 + n` SQL queries, where n is the count of used content types.
230230
231231
"""
232232
def __init__(self):
233233
self._initialized = False
234234

235235
def get_children(self, node):
236236
"""
237-
Returns cached child nodes
237+
Returns the cached child nodes.
238238
239239
Args:
240240
node(:class:`business_logic.models.Node`): parent node
@@ -285,11 +285,11 @@ def _initialize(self, node):
285285

286286
class NodeCacheHolder(object):
287287
"""
288-
Implements get_children() function using :class:`business_logic.models.NodeCache`
288+
Implements the get_children() function using :class:`business_logic.models.NodeCache`.
289289
"""
290290
def get_children(self, node):
291291
"""
292-
Returns cached child nodes
292+
Returns the cached child nodes.
293293
294294
Args:
295295
node(:class:`business_logic.models.Node`): parent node
@@ -306,8 +306,8 @@ class NodeVisitor(NodeCacheHolder):
306306
"""
307307
Utility class for tree traversal.
308308
309-
Derived class should implement the :func:`business_logic.models.NodeVisitor.visit` method.
310-
Traversal is made by executing :func:`business_logic.models.NodeVisitor.preorder`
309+
The derived class should implement the :func:`business_logic.models.NodeVisitor.visit` method.
310+
Traversal is made by executing the :func:`business_logic.models.NodeVisitor.preorder`
311311
or :func:`business_logic.models.NodeVisitor.postorder` method.
312312
313313
Examples:
@@ -316,7 +316,7 @@ class NodeVisitor(NodeCacheHolder):
316316
"""
317317
def visit(self, node, *args, **kwargs):
318318
"""
319-
Main method which should be realised in derived classes
319+
Main method which should be implemented in derived classes.
320320
321321
Args:
322322
node(:class:`business_logic.models.Node`): currently processed node
@@ -332,7 +332,7 @@ def preorder(self, node, *args, **kwargs):
332332
Tree traversal from top to bottom.
333333
334334
Args:
335-
node(:class:`business_logic.models.Node`): node for starting tree traversal
335+
node(:class:`business_logic.models.Node`): node for starting the tree traversal
336336
*args: arbitrary args which should be passed to :func:`business_logic.models.NodeVisitor.visit`
337337
**kwargs: arbitrary kwargs which should be passed to :func:`business_logic.models.NodeVisitor.visit`
338338
"""
@@ -345,7 +345,7 @@ def postorder(self, node, *args, **kwargs):
345345
Tree traversal from bottom to top.
346346
347347
Args:
348-
node(:class:`business_logic.models.Node`): node for starting tree traversal
348+
node(:class:`business_logic.models.Node`): node for starting the tree traversal
349349
*args: arbitrary args which should be passed to :func:`business_logic.models.NodeVisitor.visit`
350350
**kwargs: arbitrary kwargs which should be passed to :func:`business_logic.models.NodeVisitor.visit`
351351
"""

0 commit comments

Comments
 (0)