Skip to content

Commit

Permalink
if not ... is None -> if ... is not None (etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
rieder committed Oct 9, 2024
1 parent 0d41725 commit a5094d9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/amuse/rfi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __call__(self, *arguments_list, **keyword_arguments):

handle_as_array = self.must_handle_as_array(dtype_to_values)

if not self.owner is None:
if self.owner is not None:
CODE_LOG.info(
"start call '%s.%s'", self.owner.__name__, self.specification.name
)
Expand Down Expand Up @@ -140,7 +140,7 @@ def __call__(self, *arguments_list, **keyword_arguments):

result = self.converted_results(dtype_to_result, handle_as_array)

if not self.owner is None:
if self.owner is not None:
CODE_LOG.info(
"end call '%s.%s'", self.owner.__name__, self.specification.name
)
Expand Down Expand Up @@ -227,7 +227,7 @@ def result_index(self):
index = []
for parameter in self.specification.output_parameters:
index.append(parameter.name)
if not self.specification.result_type is None:
if self.specification.result_type is not None:
index.append("__result")
return index

Expand Down Expand Up @@ -259,13 +259,13 @@ def converted_results(self, dtype_to_result, must_handle_as_array):
for key, value in dtype_to_result.items():
dtype_to_array[key] = list(reversed(value))

if not result_type is None:
if result_type is not None:
return_value = dtype_to_array[result_type].pop()

for parameter in self.specification.output_parameters:
result[parameter.name] = dtype_to_array[parameter.datatype].pop()

if not result_type is None:
if result_type is not None:
result["__result"] = return_value

return result
Expand Down Expand Up @@ -770,7 +770,7 @@ def __str__(self):
p + typecode_to_name[x.datatype]
p + " "
p + x.name
if not self.result_type is None:
if self.result_type is not None:
p + ", "
p + typecode_to_name[self.result_type]
p + " "
Expand Down Expand Up @@ -800,7 +800,7 @@ def stop_interfaces(exceptions=[]):
"""
for reference in reversed(CodeInterface.instances):
x = reference()
if not x is None and x.__class__.__name__ not in exceptions:
if x is not None and x.__class__.__name__ not in exceptions:
try:
x._stop()
except:
Expand Down Expand Up @@ -928,7 +928,7 @@ def ensure_stop_interface_at_exit(cls):

@classmethod
def retrieve_reusable_channel(cls):
if not "REUSE_INSTANCE" in cls.__dict__:
if "REUSE_INSTANCE" not in cls.__dict__:
cls.REUSE_INSTANCE = set([])
s = cls.REUSE_INSTANCE
if len(s) > 0:
Expand All @@ -938,15 +938,15 @@ def retrieve_reusable_channel(cls):

@classmethod
def store_reusable_channel(cls, instance):
if not "REUSE_INSTANCE" in cls.__dict__:
if "REUSE_INSTANCE" not in cls.__dict__:
cls.REUSE_INSTANCE = set([])
s = cls.REUSE_INSTANCE
s.add(instance)
cls.classes.add(cls)

@classmethod
def stop_reusable_channels(cls):
if not "REUSE_INSTANCE" in cls.__dict__:
if "REUSE_INSTANCE" not in cls.__dict__:
cls.REUSE_INSTANCE = set([])
s = cls.REUSE_INSTANCE
while len(s) > 0:
Expand All @@ -960,7 +960,7 @@ def stop_reusable_channels(cls):

def _stop(self):
if hasattr(self, "channel"):
if not self.channel is None and self.channel.is_active():
if self.channel is not None and self.channel.is_active():
if self.reuse_worker:
self.store_reusable_channel(self.channel)
self.channel = None
Expand Down Expand Up @@ -1493,7 +1493,7 @@ def converted_results(self, dtype_to_result, must_handle_as_array, units):
result[parameter.name] = dtype_to_array[parameter.datatype].pop()
if (
self.specification.has_units
and not units[parameter.index_in_output] is None
and units[parameter.index_in_output] is not None
):
result[parameter.name] = (
result[parameter.name] | units[parameter.index_in_output]
Expand Down

0 comments on commit a5094d9

Please sign in to comment.