Skip to content

type: Add missing return type annotations to storage backend methods#2829

Merged
sammshen merged 2 commits intoLMCache:devfrom
SYaoJun:320_type
Mar 28, 2026
Merged

type: Add missing return type annotations to storage backend methods#2829
sammshen merged 2 commits intoLMCache:devfrom
SYaoJun:320_type

Conversation

@SYaoJun
Copy link
Copy Markdown
Contributor

@SYaoJun SYaoJun commented Mar 20, 2026

What this PR does / why we need it:

Adds missing return type annotations to improve type safety

Special notes for your reviewers:

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the codebase's type safety by systematically adding missing return type annotations to various methods within the storage backend components. This change improves code readability, facilitates static analysis, and helps prevent potential type-related errors, contributing to a more robust and maintainable system.

Highlights

  • Type Annotation Enhancement: Added missing return type annotations to several methods across s3_connector.py, local_disk_backend.py, and storage_manager.py to improve type safety and code clarity.
  • S3 Connector Methods: The _s3_download and _s3_upload methods in s3_connector.py now explicitly declare their return type as s3.S3Request.
  • Local Disk Backend Methods: The __str__ method in local_disk_backend.py now returns str, and get_allocator_backend returns LocalCPUBackend.
  • Storage Manager Methods: Return types were added to get_backend_cname (returning str), _setup_metrics (returning None), and touch_cache (returning None) in storage_manager.py.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds missing return type annotations to methods in s3_connector.py, local_disk_backend.py, and storage_manager.py. The changes are correct and align with the project's typing conventions. No issues were found.

Copy link
Copy Markdown
Contributor

@sammshen sammshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sammshen sammshen requested a review from deng451e March 22, 2026 17:52
Copy link
Copy Markdown
Collaborator

@DongDongJu DongDongJu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DongDongJu DongDongJu enabled auto-merge (squash) March 23, 2026 04:24
@github-actions github-actions Bot added the full Run comprehensive tests on this PR label Mar 23, 2026
Signed-off-by: syaojun <libevent@yeah.net>
auto-merge was automatically disabled March 24, 2026 13:57

Head branch was pushed to by a user without write access

@github-actions github-actions Bot removed the full Run comprehensive tests on this PR label Mar 24, 2026
@SYaoJun SYaoJun requested review from DongDongJu March 24, 2026 14:31
@sammshen sammshen enabled auto-merge (squash) March 25, 2026 06:57
@SYaoJun SYaoJun requested review from deng451e and sammshen March 25, 2026 15:05
Copy link
Copy Markdown
Contributor

@sammshen sammshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Collaborator

@deng451e deng451e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sammshen sammshen added the full Run comprehensive tests on this PR label Mar 27, 2026
@sammshen sammshen merged commit c806e11 into LMCache:dev Mar 28, 2026
33 checks passed
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
…MCache#2829)

Add missing return type annotations to storage backend methods

Signed-off-by: syaojun <libevent@yeah.net>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
…MCache#2829)

Add missing return type annotations to storage backend methods

Signed-off-by: syaojun <libevent@yeah.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants