Skip to content

CG-10705: API to remove async from functions#936

Draft
codegen-sh[bot] wants to merge 1 commit intodevelopfrom
feature/CG-10705-remove-async-from-functions
Draft

CG-10705: API to remove async from functions#936
codegen-sh[bot] wants to merge 1 commit intodevelopfrom
feature/CG-10705-remove-async-from-functions

Conversation

@codegen-sh
Copy link
Contributor

@codegen-sh codegen-sh bot commented Mar 21, 2025

This PR adds a new API method remove_async() to the Function class that allows removing the async keyword from functions.

Changes

  • Added a new method remove_async() to the Function class in src/codegen/sdk/core/function.py
  • The method checks if a function is async and removes the async keyword if present
  • The method handles whitespace properly to maintain code formatting

Usage

# Find an async function
async_function = codebase.find_function("my_async_function")

# Remove the async keyword
async_function.remove_async()

This complements the existing asyncify() method which adds the async keyword to functions.

Resolves CG-10705

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.

0 participants