@@ -104,7 +104,12 @@ def __init__(self, internal_id=None,
104104
105105
106106
107- def __str__ (self ):
107+ def __str__ (self ) -> str :
108+ """
109+ Return a description of this object
110+
111+ :return:
112+ """
108113 return f"RAW match structure (object of class NodeSpecs):\n " \
109114 f" internal_id: { self .internal_id } " \
110115 f" labels: { self .labels } " \
@@ -191,11 +196,13 @@ def __init__(self, node_specs, dummy_node_name_if_missing=None):
191196
192197 """
193198 IMPORTANT: By our convention -
194- if internal_id is provided, all other conditions are DISREGARDED;
195- if it's missing, an implicit AND operation applies to all the specified conditions
199+ 1) if internal_id is provided, all other conditions are DISREGARDED;
200+ 2) if it's missing, an implicit "AND" operation applies to all the specified conditions
201+
202+ TODO: maybe ditch (1) and give an option to what boolean to use in (2)
196203 """
197- if node_specs .internal_id is not None : # If an internal node ID is specified, it over-rides all the other conditions
198- # CAUTION: internal_id might be 0 ; that's a valid Neo4j node ID
204+ if node_specs .internal_id is not None : # If an internal node ID is specified, it over-rides all the other conditions
205+ # CAUTION: internal_id might be 0 ; that's a valid Neo4j node ID
199206 cypher_match = f"({ dummy_node_name } )"
200207 cypher_where = f"id({ dummy_node_name } ) = { node_specs .internal_id } "
201208 self .node = cypher_match
@@ -290,7 +297,11 @@ def __init__(self, node_specs, dummy_node_name_if_missing=None):
290297
291298
292299
293- def __str__ (self ):
300+ def __str__ (self ) -> str :
301+ """
302+ Return a description of this object
303+ :return:
304+ """
294305 return f"CYPHER-PROCESSED match structure (object of class CypherMatch):\n " \
295306 f" node: { self .node } " \
296307 f" where: { self .where } " \
@@ -336,7 +347,12 @@ def unpack_match(self) -> list:
336347
337348
338349 def extract_where_clause (self ) -> str :
339- # TODO: new method to test. Cleanup the WHERE clause, and prefix the "WHERE" keyword as needed
350+ """
351+ Cleanup the WHERE clause, and prefix the "WHERE" keyword as needed
352+
353+ TODO: new method to test
354+ :return:
355+ """
340356 return CypherUtils .prepare_where ([self .where ])
341357
342358
@@ -371,6 +387,8 @@ def process_match_structure(cls, handle: Union[int, NodeSpecs], dummy_node_name=
371387 Accept either a valid internal database node ID, or a "NodeSpecs" object (a "raw match"),
372388 and turn it into a "CypherMatch" object (a "processed match")
373389
390+ Note: no database operation is performed
391+
374392 :param handle: Either an integer with a valid internal database ID,
375393 or an object of type NodeSpecs
376394 :param dummy_node_name: A string that will be used inside a Cypher query, to refer to nodes
@@ -491,6 +509,8 @@ def valid_internal_id(cls, internal_id: int) -> bool:
491509 :param internal_id: An alleged internal database ID
492510 :return: True if internal_id is a valid internal database ID, or False otherwise
493511 """
512+ # TODO: put the actual logic here, instead of in assert_valid_internal_id()
513+ # TODO: provide a method by the same name in NeoCore
494514 try :
495515 cls .assert_valid_internal_id (internal_id )
496516 return True
@@ -503,7 +523,7 @@ def valid_internal_id(cls, internal_id: int) -> bool:
503523 def prepare_labels (cls , labels :Union [str , List [str ], Tuple [str ]]) -> str :
504524 """
505525 Turn the given string, or list/tuple of strings - representing one or more Neo4j labels - into a string
506- suitable for inclusion in a Cypher query.
526+ suitable for inclusion into a Cypher query.
507527 Blanks ARE allowed in the names.
508528 EXAMPLES:
509529 "" or None both give rise to ""
0 commit comments