Skip to content

[CI] bump mypy version to 1.16.0 #19548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ repos:
entry: tools/mypy.sh 0 "local"
language: python
types: [python]
additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests, pydantic]
additional_dependencies: &mypy_deps [mypy==1.16.0, types-cachetools,
types-setuptools, types-PyYAML, types-requests, pydantic]
stages: [pre-commit] # Don't run in CI
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name: Run mypy for Python 3.9
Expand Down
9 changes: 7 additions & 2 deletions vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ def extract_tool_calls_streaming(
return delta

try:

current_tool_call = partial_json_parser.loads(
tool_call_portion or "{}",
flags) if tool_call_portion else None
Expand All @@ -252,7 +251,7 @@ def extract_tool_calls_streaming(
# case - we haven't sent the tool name yet. If it's available, send
# it. otherwise, wait until it's available.
if not self.current_tool_name_sent:
if (current_tool_call is None):
if current_tool_call is None:
return None
function_name: Union[str, None] = current_tool_call.get("name")
if function_name:
Expand Down Expand Up @@ -292,6 +291,8 @@ def extract_tool_calls_streaming(
# JSON to the current partially-parsed JSON
prev_arguments = (
self.prev_tool_call_arr[self.current_tool_id].get("arguments"))
if current_tool_call is None:
return None
cur_arguments = current_tool_call.get("arguments")

logger.debug("diffing old arguments: %s", prev_arguments)
Expand Down Expand Up @@ -359,9 +360,13 @@ def extract_tool_calls_streaming(
# handle saving the state for the current tool into
# the "prev" list for use in diffing for the next iteration
if self.current_tool_id == len(self.prev_tool_call_arr) - 1:
if current_tool_call is None:
return None
self.prev_tool_call_arr[self.current_tool_id] = \
current_tool_call
else:
if current_tool_call is None:
return None
self.prev_tool_call_arr.append(current_tool_call)

return delta
Expand Down
3 changes: 2 additions & 1 deletion vllm/sampling_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ def update_from_generation_config(
if eos_ids:
self._all_stop_token_ids.update(eos_ids)
if not self.ignore_eos:
eos_ids.update(self.stop_token_ids)
if self.stop_token_ids is not None:
eos_ids.update(self.stop_token_ids)
self.stop_token_ids = list(eos_ids)

def update_from_tokenizer(self, tokenizer: AnyTokenizer) -> None:
Expand Down
Loading