Skip to content

Conversation

@endolith
Copy link
Contributor

Describe the changes you have made:

Replace == None with is None

https://www.flake8rules.com/rules/E711.html

Reference any relevant issues (e.g. "Fixes #000"):

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs)
  • I have read docs/CONTRIBUTING.md
  • I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

@endolith
Copy link
Contributor Author

(This section is pretty hard to read. Would be better to give meaningful names to things like chunk.choices[0].delta.content?)

@endolith
Copy link
Contributor Author

(I didn't actually run the test suite for any of these, probably should try that.)

@Notnaton
Copy link
Collaborator

(This section is pretty hard to read. Would be better to give meaningful names to things like chunk.choices[0].delta.content?)

No, this is the official API https://docs.litellm.ai/docs/

@Notnaton Notnaton mentioned this pull request Mar 25, 2025
6 tasks
@Notnaton Notnaton self-assigned this Mar 25, 2025
@endolith
Copy link
Contributor Author

(This section is pretty hard to read. Would be better to give meaningful names to things like chunk.choices[0].delta.content?)

No, this is the official API https://docs.litellm.ai/docs/

I don't see it there?

I mean things like, instead of

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

    if message.content is None:
        message.content = chunk.choices[0].delta.content
    elif chunk.choices[0].delta.content is not None:
        message.content += chunk.choices[0].delta.content

it could be:

delta = chunk.choices[0].delta
if delta.content:
    md.feed(delta.content)
    await asyncio.sleep(0)

    if message.content is None:
        message.content = delta.content
    elif delta.content is not None:
        message.content += delta.content

or other simplifications, instead of repeatedly accessing deeply nested things

@Notnaton
Copy link
Collaborator

(This section is pretty hard to read. Would be better to give meaningful names to things like chunk.choices[0].delta.content?)

No, this is the official API https://docs.litellm.ai/docs/

I don't see it there?

I mean things like, instead of

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

    if message.content is None:
        message.content = chunk.choices[0].delta.content
    elif chunk.choices[0].delta.content is not None:
        message.content += chunk.choices[0].delta.content

it could be:

delta = chunk.choices[0].delta
if delta.content:
    md.feed(delta.content)
    await asyncio.sleep(0)

    if message.content is None:
        message.content = delta.content
    elif delta.content is not None:
        message.content += delta.content

or other simplifications, instead of repeatedly accessing deeply nested things

Aah I see, I think that would be ok

@Notnaton Notnaton merged commit 7fe61da into openinterpreter:development Mar 30, 2025
@endolith endolith deleted the none_equality branch March 30, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants