Skip to content

Commit b118d96

Browse files
committed
Don't check equality with None
https://www.flake8rules.com/rules/E711.html
1 parent f38dff6 commit b118d96

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

interpreter/interpreter.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ async def async_respond(self, user_input=None):
359359
current_block.partial_json += chunk.delta.partial_json
360360

361361
if hasattr(current_block, "name"):
362-
if edit.name == None:
362+
if edit.name is None:
363363
edit.name = current_block.name
364364
edit.feed(chunk.delta.partial_json)
365365

@@ -673,7 +673,7 @@ async def async_respond(self, user_input=None):
673673
# Fix ollama
674674
stream = False
675675
actual_model = self.model.replace("ollama/", "openai/")
676-
if self.api_base == None:
676+
if self.api_base is None:
677677
api_base = "http://localhost:11434/v1/"
678678
else:
679679
api_base = self.api_base
@@ -812,28 +812,28 @@ async def async_respond(self, user_input=None):
812812
self._spinner.stop()
813813
first_token = False
814814

815-
if message == None:
815+
if message is None:
816816
message = chunk.choices[0].delta
817817

818818
if chunk.choices[0].delta.content:
819819
md.feed(chunk.choices[0].delta.content)
820820
await asyncio.sleep(0)
821821

822-
if message.content == None:
822+
if message.content is None:
823823
message.content = chunk.choices[0].delta.content
824-
elif chunk.choices[0].delta.content != None:
824+
elif chunk.choices[0].delta.content is not None:
825825
message.content += chunk.choices[0].delta.content
826826

827827
if chunk.choices[0].delta.tool_calls:
828828
if chunk.choices[0].delta.tool_calls[0].id:
829-
if message.tool_calls == None or chunk.choices[
829+
if message.tool_calls is None or chunk.choices[
830830
0
831831
].delta.tool_calls[0].id not in [
832832
t.id for t in message.tool_calls
833833
]:
834834
edit.close()
835835
edit = ToolRenderer()
836-
if message.tool_calls == None:
836+
if message.tool_calls is None:
837837
message.tool_calls = []
838838
message.tool_calls.append(
839839
chunk.choices[0].delta.tool_calls[0]
@@ -848,9 +848,9 @@ async def async_respond(self, user_input=None):
848848
tool_name = (
849849
chunk.choices[0].delta.tool_calls[0].function.name
850850
)
851-
if edit.name == None:
851+
if edit.name is None:
852852
edit.name = tool_name
853-
if current_tool_call.function.name == None:
853+
if current_tool_call.function.name is None:
854854
current_tool_call.function.name = tool_name
855855
if chunk.choices[0].delta.tool_calls[0].function.arguments:
856856
arguments_delta = (

0 commit comments

Comments
 (0)