From 697e452d8161c7a63eb31945630e70cce8ea78b4 Mon Sep 17 00:00:00 2001 From: ARCJ137442 <61109168+ARCJ137442@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:14:06 +0800 Subject: [PATCH] fix: :art: Rename functions to follow the "lower camel case" conavention --- pynars/ConsolePlus.py | 6 +++--- pynars/NARS/Control/Reasoner.py | 2 +- pynars/NARS/Operation/Register.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pynars/ConsolePlus.py b/pynars/ConsolePlus.py index ded4419..1e810ea 100644 --- a/pynars/ConsolePlus.py +++ b/pynars/ConsolePlus.py @@ -305,12 +305,12 @@ def operation_list(*keywords: List[str]) -> None: Enumerate existing operations; It can be retrieved with parameters''' keywords = keywords if keywords else [''] # Search for a matching interface name - from pynars.NARS.Operation.Register import registered_operations, getRegisteredOperationByName, registeredOperationNames - operation_names: List[str] = prefix_browse(registeredOperationNames(), *keywords) + from pynars.NARS.Operation.Register import registered_operations, get_registered_operation_by_name, registered_operation_names + operation_names: List[str] = prefix_browse(registered_operation_names(), *keywords) # Displays information about "matched interface" if operation_names: for name in operation_names: # match the list of all cmds, as long as they match the search results - not necessarily in order - op = getRegisteredOperationByName(name) + op = get_registered_operation_by_name(name) f = registered_operations[op] print(f''': { 'No function' if f == None else diff --git a/pynars/NARS/Control/Reasoner.py b/pynars/NARS/Control/Reasoner.py index 2152a1d..f8a9600 100644 --- a/pynars/NARS/Control/Reasoner.py +++ b/pynars/NARS/Control/Reasoner.py @@ -184,7 +184,7 @@ def mental_operation(self, task: Task, concept: Concept, answers_question: Task, def register_operation(self, name_operation: str, callback: Callable): '''register an operation and return the operation if successful (otherwise, return None)''' - if not Operation.isRegisteredByName(name_operation): + if not Operation.is_registered_by_name(name_operation): from pynars.Narsese import Operation as Op op = Op(name_operation) Operation.register(op, callback) diff --git a/pynars/NARS/Operation/Register.py b/pynars/NARS/Operation/Register.py index d83893a..2e4e7ab 100644 --- a/pynars/NARS/Operation/Register.py +++ b/pynars/NARS/Operation/Register.py @@ -3,7 +3,7 @@ registered_operations: Dict[Operation, Callable] = {} -def registeredOperationNames(): +def registered_operation_names(): '''''' global registered_operations return [registered_operation.word for registered_operation in registered_operations.keys()] @@ -15,7 +15,7 @@ def register(operation: Operation, callable: Callable): registered_operations[operation] = callable -def isRegisteredByName(word): +def is_registered_by_name(word): '''''' global registered_operations for registered_operation in registered_operations.keys(): @@ -24,7 +24,7 @@ def isRegisteredByName(word): return False -def getRegisteredOperationByName(word): +def get_registered_operation_by_name(word): '''''' global registered_operations for registered_operation in registered_operations.keys():