Skip to content

fix: use identity check for None comparison (PEP 8 E711)#3849

Open
harshadkhetpal wants to merge 1 commit intolm-sys:mainfrom
harshadkhetpal:fix/pep8-is-none-model-worker
Open

fix: use identity check for None comparison (PEP 8 E711)#3849
harshadkhetpal wants to merge 1 commit intolm-sys:mainfrom
harshadkhetpal:fix/pep8-is-none-model-worker

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace == None with is None identity check in model_worker.py per PEP 8 (E711).

Python's is operator is the recommended way to compare with singletons like None. Using == can produce unexpected results if a class defines a custom __eq__ method.

Change:

# Before
if self.tokenizer.pad_token == None:

# After
if self.tokenizer.pad_token is None:

Testing

No behavior change — identity check with is is functionally equivalent to == for None comparisons in standard usage.

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.

1 participant