Skip to content

Commit

Permalink
run ruff . --fix on the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Jun 14, 2024
1 parent 4346f3b commit 7ab6ef0
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 48 deletions.
9 changes: 4 additions & 5 deletions classRepresentation/methodGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def getParametersCXX(self):
# needed to lenRow
if (
self.getReturn().isArray()
and configGiws().getDisableReturnSize() != True
and configGiws().getDisableReturnSize() is not True
):
str += ", "

Expand Down Expand Up @@ -129,8 +129,7 @@ def __createMethodBody(self):
arrayOfStringDeclared = True

if (
paramType.specificPreProcessing(parameter, self.getDetachThread())
!= None
paramType.specificPreProcessing(parameter, self.getDetachThread()) is not None
):
str += paramType.specificPreProcessing(
parameter, self.getDetachThread()
Expand Down Expand Up @@ -216,7 +215,7 @@ def generateCXXHeader(self):
static = ""

ret = ""
if self.getReturn().isArray() and configGiws().getDisableReturnSize() != True:
if self.getReturn().isArray() and configGiws().getDisableReturnSize() is not True:
if len(self.__parameters) != 0:
ret += ", "
if self.getReturn().getDimensionArray() == 1:
Expand All @@ -243,7 +242,7 @@ def generateCXXBody(self, className):
)

ret = ""
if self.getReturn().isArray() and configGiws().getDisableReturnSize() != True:
if self.getReturn().isArray() and configGiws().getDisableReturnSize() is not True:
if len(self.__parameters) != 0:
ret += ", "
if self.getReturn().getDimensionArray() == 1:
Expand Down
22 changes: 11 additions & 11 deletions classRepresentation/objectGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def __getDeclarationOfCachingMethodID(self):
# Avoids to load the class String each time we need it
if (
isinstance(param.getType(), stringDataGiws)
and param.getType().isArray() == True
and stringClassSet != True
and param.getType().isArray() is True
and stringClassSet is not True
and method.getModifier() != "static"
):
str += """
Expand All @@ -94,7 +94,7 @@ def __getDeclarationOfCachingMethodID(self):
"""
stringClassSet = True

if self.getExtendedClass() != None:
if self.getExtendedClass() is not None:
# Get the father object to work on it.
str += self.getExtendedClass().__getDeclarationOfCachingMethodID()

Expand Down Expand Up @@ -165,7 +165,7 @@ def __getConstructorWhichInstanciateTheNewObject(self):
self.getName(),
self.__getConstructorProfileWhichInstanciateTheNewObject(),
)
if self.getExtendedClass() != None:
if self.getExtendedClass() is not None:
constructorProfile += """ : %s(fakeGiwsDataType::fakeGiwsDataType())""" % (
self.getExtendedClass().getName()
)
Expand Down Expand Up @@ -260,7 +260,7 @@ def __getConstructorWhichUsesAnAlreadyExistingJObject(self):
self.getName(),
self.__getConstructorProfileWhichUsesAnAlreadyExistingJObject(),
)
if self.getExtendedClass() != None:
if self.getExtendedClass() is not None:
constructorProfile += """ : %s(fakeGiwsDataType::fakeGiwsDataType()) """ % (
self.getExtendedClass().getName()
)
Expand Down Expand Up @@ -330,7 +330,7 @@ def getConstructorWhichInstanciateTheNewObjectHeaderCXX(self):

def __getFakeConstructorForExtendedClasses(self):
str = ""
if self.getExtendedClass() == None:
if self.getExtendedClass() is None:
# It is a potential master class, add the fake constructor
str += """
/**
Expand Down Expand Up @@ -359,8 +359,8 @@ def getMethodsProfileForMethodIdCache(self):
# Avoids to load the class String each time we need it
if (
isinstance(param.getType(), stringDataGiws)
and param.getType().isArray() == True
and stringClassSet != True
and param.getType().isArray() is True
and stringClassSet is not True
):
str += """jclass stringArrayClass;
"""
Expand All @@ -370,7 +370,7 @@ def getMethodsProfileForMethodIdCache(self):

def getProtectedFields(self):
str = ""
if self.getExtendedClass() == None:
if self.getExtendedClass() is None:
str += """
jobject instance;
jclass instanceClass; // cache class
Expand All @@ -395,7 +395,7 @@ def getMethodsCXX(self, type="header"):
def generateCXXHeader(self, packageName):
JNIObjectName = packageName + "/" + self.getName()

if self.getExtendedClass() == None:
if self.getExtendedClass() is None:
classProfile = """class GIWSEXPORT %s {""" % (self.getName())
else:
classProfile = """class GIWSEXPORT %s : public %s {
Expand Down Expand Up @@ -548,7 +548,7 @@ def needCaching(self):

for method in self.__methods:
for param in method.getParameters():
if param.getType().isByteBufferBased() == True:
if param.getType().isByteBufferBased() is True:
return True

return False
Expand Down
2 changes: 0 additions & 2 deletions classRepresentation/parameterGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#
# For more information, see the file COPYING

from datatypes.dataGiws import dataGiws
from datatypes.dataBufferGiws import dataBufferGiws
from datatypes.dataFactoryGiws import dataFactoryGiws


Expand Down
2 changes: 0 additions & 2 deletions datatypes/ByteBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class ByteBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/CharBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class CharBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/DoubleBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class DoubleBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/FloatBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class FloatBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/IntBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class IntBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/LongBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class LongBufferDataGiws(dataBufferGiws):
Expand Down
2 changes: 0 additions & 2 deletions datatypes/ShortBufferDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# For more information, see the file COPYING

from datatypes.dataBufferGiws import dataBufferGiws
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork


class ShortBufferDataGiws(dataBufferGiws):
Expand Down
4 changes: 2 additions & 2 deletions datatypes/booleanDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def specificPostProcessing(self, detachThread):
if self.isArray():
str = JNIFrameWork().getExceptionCheckProfile(detachThread)
strCommon = ""
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
strCommon += "int *lenRow;"
strCommon += """
*lenRow = curEnv->GetArrayLength(res);
Expand All @@ -135,7 +135,7 @@ def specificPostProcessing(self, detachThread):
"""
)
else:
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
str += "int *lenCol;"
return (
str
Expand Down
10 changes: 5 additions & 5 deletions datatypes/dataBufferGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ def specificPreProcessing(self, parameter, detachThread):
# Management of the error when not enough memory to create the
# XXXXXBuffer
if configGiws().getThrowsException():
errorMgntMem = """%sthrow %s::JniBadAllocException(curEnv);""" % (
"""%sthrow %s::JniBadAllocException(curEnv);""" % (
detachThread,
configGiws().getExceptionFileName(),
)
else:
errorMgntMem = """std::cerr << "Could not allocate Java %s array, memory full." << std::endl;%s
"""std::cerr << "Could not allocate Java %s array, memory full." << std::endl;%s
exit(EXIT_FAILURE);""" % (
self.getJavaBufferType(),
detachThread,
)

errorMgntMemBis = self.__errorMemoryByteBuffer(detachThread)
self.__errorMemoryByteBuffer(detachThread)

str = """
Expand Down Expand Up @@ -189,7 +189,7 @@ def specificPostProcessing(self, detachThread):
if self.isArray():
strCommon = ""
strDeclaration = ""
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
strCommon += "int lenRow;"
else:
# The size of the array is returned as output argument of the
Expand Down Expand Up @@ -217,7 +217,7 @@ def specificPostProcessing(self, detachThread):
)
return str
else:
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
str += "int lenCol;"
str += (
strCommon
Expand Down
2 changes: 0 additions & 2 deletions datatypes/dataFactoryGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from datatypes.FloatBufferDataGiws import FloatBufferDataGiws
from datatypes.IntBufferDataGiws import IntBufferDataGiws
from datatypes.ShortBufferDataGiws import ShortBufferDataGiws
import datatypes

""" Factory which create the different data types """

Expand All @@ -74,7 +73,6 @@ def __init__(self):
"DoubleBuffer": DoubleBufferDataGiws,
"ByteBuffer": ByteBufferDataGiws,
"CharBuffer": CharBufferDataGiws,
"DoubleBuffer": DoubleBufferDataGiws,
"FloatBuffer": FloatBufferDataGiws,
"IntBuffer": IntBufferDataGiws,
"LongBuffer": LongBufferDataGiws,
Expand Down
9 changes: 4 additions & 5 deletions datatypes/dataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#
# For more information, see the file COPYING

import sys
from configGiws import configGiws
from JNIFrameWork import JNIFrameWork

Expand Down Expand Up @@ -258,9 +257,9 @@ def specificPostDeleteMemory(self, parameter):
def specificPostProcessing(self, detachThread):
"""Preprocessing after calling the java method"""

javaType = self.getJavaTypeSyntax()
self.getJavaTypeSyntax()
javaTypeNotArray = self.getJavaTypeSyntaxForceNotArray()
shortType = self.getJavaShortType(forceNotArray=True)
self.getJavaShortType(forceNotArray=True)
nativeTypeForceNotArray = self.getNativeTypeForceNotArray()

if self.isArray():
Expand All @@ -269,7 +268,7 @@ def specificPostProcessing(self, detachThread):
str += JNIFrameWork().getExceptionCheckProfile(detachThread)
strCommon = ""
strDeclaration = ""
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
strCommon += "int lenRow;"
else:
# The size of the array is returned as output argument of the
Expand Down Expand Up @@ -308,7 +307,7 @@ def specificPostProcessing(self, detachThread):
return str

else:
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
str += "int lenCol;"
str += (
strCommon
Expand Down
4 changes: 2 additions & 2 deletions datatypes/stringDataGiws.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def specificPostProcessing(self, detachThread):
if self.isArray():
strCommon = ""
strDeclaration = ""
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
strCommon += "int lenRow;"
else:
# The size of the array is returned as output argument of the
Expand Down Expand Up @@ -253,7 +253,7 @@ def specificPostProcessing(self, detachThread):
)
return str
else:
if configGiws().getDisableReturnSize() == True:
if configGiws().getDisableReturnSize() is True:
str += "int lenCol;"
str += (
strCommon
Expand Down

0 comments on commit 7ab6ef0

Please sign in to comment.