diff sat/tools/utils.py @ 4037:524856bd7b19

massive refactoring to switch from camelCase to snake_case: historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:54:42 +0200
parents 5a42c7842556
children
line wrap: on
line diff
--- a/sat/tools/utils.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat/tools/utils.py	Sat Apr 08 13:54:42 2023 +0200
@@ -67,7 +67,7 @@
 
 def partial(func, *fixed_args, **fixed_kwargs):
     # FIXME: temporary hack to workaround the fact that inspect.getargspec is not working with functools.partial
-    #        making partial unusable with current D-bus module (in addMethod).
+    #        making partial unusable with current D-bus module (in add_method).
     #        Should not be needed anywore once moved to Python 3
 
     ori_args = inspect.getargspec(func).args
@@ -93,7 +93,7 @@
     return method
 
 
-def asDeferred(func, *args, **kwargs):
+def as_deferred(func, *args, **kwargs):
     """Call a method and return a Deferred
 
     the method can be a simple callable, a Deferred or a coroutine.
@@ -184,7 +184,7 @@
     return dt.timestamp()
 
 
-def generatePassword(vocabulary=None, size=20):
+def generate_password(vocabulary=None, size=20):
     """Generate a password with random characters.
 
     @param vocabulary(iterable): characters to use to create password
@@ -199,7 +199,7 @@
     return "".join([random.choice(vocabulary) for i in range(15)])
 
 
-def getRepositoryData(module, as_string=True, is_path=False):
+def get_repository_data(module, as_string=True, is_path=False):
     """Retrieve info on current mecurial repository
 
     Data is gotten by using the following methods, in order: