-
Notifications
You must be signed in to change notification settings - Fork 17
Allow Prefix Removal for Struct and Enums #259
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
Conversation
WalkthroughCentralized prefix-removal into a utility and threaded configurable prefix-removal lists from the binding generator into enum, struct, and function renderers; renderers and the symbol tracker now register and emit transformed Python-facing names instead of original C++ identifiers. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Cfg as Configuration
participant Gen as BindingGenerator
participant UT as Utils:_apply_prefix_removal
participant ER as EnumRenderer
participant SR as StructRenderer
participant FR as FunctionRenderer
participant SYM as BaseRenderer/SymbolTracker
Cfg->>Gen: provide api_prefix_removal map
Gen->>ER: instantiate with enum_prefix_removal
Gen->>SR: instantiate with struct_prefix_removal
Gen->>FR: instantiate/pass function prefix removal
ER->>UT: _apply_prefix_removal("__internal__Bar", ["__internal__","__nv__"])
UT-->>ER: "Bar" and enumerators "BAR_A","BAR_B"
ER->>SYM: register "Bar" in _enum_symbols / __all__
SR->>UT: _apply_prefix_removal("__internal__Foo", ["__internal__"])
UT-->>SR: "Foo"
SR->>SYM: register "Foo" as public type name / aliases
FR->>UT: _apply_prefix_removal("prefix_foo", [...])
UT-->>FR: "foo"
FR->>SYM: register "foo" in function symbols
SYM->>SYM: assemble and emit __all__ and _ENUM_SYMBOLS using transformed names
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code graph analysis (3)numbast/src/numbast/static/enum.py (2)
numbast/src/numbast/tools/tests/test_prefix_removal.py (2)
numbast/src/numbast/static/struct.py (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (16)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
numbast/src/numbast/tools/tests/test_prefix_removal.py (1)
4-49: Add explicit__all__assertions for enums.The test nicely checks function and struct prefix removal and exercises the enum in a kernel, but it never asserts that:
Baris present in__all__, and__internal__Baris absent.Adding these would fully cover the enum side of the feature:
# Verify that the function is exposed as "foo" (without the "prefix_" prefix) assert "foo" in alls, f"Expected 'foo' in __all__, got: {alls}" assert "Foo" in alls, f"Expected 'Foo' in __all__, got: {alls}" # Verify that the original name "prefix_foo" is NOT exposed assert "prefix_foo" not in alls, ( f"Expected 'prefix_foo' NOT in __all__, got: {alls}" ) assert "__internal__Foo" not in alls, ( f"Expected '__internal__Foo' NOT in __all__, got: {alls}" ) + assert "Bar" in alls, f"Expected 'Bar' in __all__, got: {alls}" + assert "__internal__Bar" not in alls, ( + f"Expected '__internal__Bar' NOT in __all__, got: {alls}" + )numbast/src/numbast/static/struct.py (2)
1044-1057: Avoid mutable default argument.Line 1050 uses a mutable default
struct_prefix_removal: list[str] = []. In Python, default mutable arguments are shared across all calls, which can lead to unexpected behavior if the list is ever modified.Apply this diff:
def __init__( self, decl: Struct, parent_type: type | None, data_model: type | None, header_path: os.PathLike | str, - struct_prefix_removal: list[str] = [], + struct_prefix_removal: list[str] | None = None, aliases: list[str] = [], ): super().__init__(decl) self._python_struct_name = _apply_prefix_removal( - decl.name, struct_prefix_removal + decl.name, struct_prefix_removal or [] )Note: The same issue exists for
aliasesparameter.
1375-1418: Avoid mutable default argument.Line 1380 uses a mutable default
struct_prefix_removal: list[str] = []. Same issue as inStaticStructRenderer.Apply this diff:
def __init__( self, decls: list[Struct], specs: dict[str, tuple[type | None, type | None, os.PathLike]], default_header: os.PathLike | str | None = None, - struct_prefix_removal: list[str] = [], + struct_prefix_removal: list[str] | None = None, excludes: list[str] = [], ): self._decls = decls self._specs = specs self._default_header = default_header - self._struct_prefix_removal = struct_prefix_removal + self._struct_prefix_removal = struct_prefix_removal or []Note: The same issue exists for
excludesparameter.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (9)
numbast/src/numbast/static/enum.py(4 hunks)numbast/src/numbast/static/function.py(2 hunks)numbast/src/numbast/static/renderer.py(3 hunks)numbast/src/numbast/static/struct.py(19 hunks)numbast/src/numbast/tools/static_binding_generator.py(4 hunks)numbast/src/numbast/tools/tests/config/prefix_removal.yml.j2(1 hunks)numbast/src/numbast/tools/tests/prefix_removal.cuh(1 hunks)numbast/src/numbast/tools/tests/test_prefix_removal.py(2 hunks)numbast/src/numbast/utils.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
numbast/src/numbast/tools/static_binding_generator.py (1)
numbast/src/numbast/static/enum.py (1)
StaticEnumsRenderer(63-105)
numbast/src/numbast/static/enum.py (2)
numbast/src/numbast/utils.py (1)
_apply_prefix_removal(321-338)numbast/src/numbast/static/types.py (1)
register_enum_type_str(19-22)
numbast/src/numbast/tools/tests/test_prefix_removal.py (3)
numbast/src/numbast/tools/tests/test_macros.py (2)
kernel(16-32)kernel(23-26)numbast/src/numbast/tools/tests/test_cli.py (4)
kernel(19-35)kernel(25-28)kernel(343-345)kernel(455-456)numbast/src/numbast/static/tests/data/src/struct.cu (1)
get_x(10-10)
numbast/src/numbast/static/function.py (1)
numbast/src/numbast/utils.py (2)
make_function_shim(125-177)_apply_prefix_removal(321-338)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test Conda Python / test (amd64, 3.10, 12.8.0, rockylinux8, l4, earliest)
- GitHub Check: Test Wheels / amd64, 3.13, 13.0.1, ubuntu24.04, l4
🔇 Additional comments (13)
numbast/src/numbast/tools/tests/config/prefix_removal.yml.j2 (1)
12-22: Config wiring for struct/enum prefix removal looks consistent.The added
Types,Data Models, andAPI Prefix Removal.Struct/Enumentries line up with the new prefix-removal flow and should give the generator what it needs for__internal__Fooand__internal__Bar.numbast/src/numbast/tools/tests/prefix_removal.cuh (1)
8-17: Struct and enum fixtures for prefix removal look sound.
__internal__Fooand__internal__Barare minimal but sufficient to exercise struct construction, method access, and enum usage under prefix removal.numbast/src/numbast/static/function.py (1)
19-20: Function prefix removal via shared helper and symbol override looks correct.Using
_apply_prefix_removalto compute_python_func_nameand then swapping the_function_symbolsentry to the Python-facing name keeps__all__aligned with the exposed API while leaving operator handling unchanged. The guardedremoveavoids issues when the base name isn’t present.Also applies to: 416-426, 433-439
numbast/src/numbast/static/struct.py (10)
22-28: LGTM!The import of
_apply_prefix_removalis correctly added and will be used inStaticStructRenderer.__init__to derive the Python-facing struct name.
143-157: LGTM!The
python_struct_nameparameter is properly added and stored for use in the lowering template.
249-259: LGTM!Correctly using
_python_struct_namein the lowering template so the@lowerdecorator registers against the Python-facing struct name.
338-397: LGTM!The
python_struct_nameparameter is correctly threaded throughStaticStructCtorsRendererand passed to child renderers. The typing template properly uses the Python-facing name forglobals()lookup.
729-791: LGTM!The
StaticStructRegularMethodRenderercorrectly accepts and usespython_struct_name. Thesignature_strproperty properly references_struct_type_namefor the receiver type, and the lowering template at line 838 correctly uses the Python-facing struct name.
879-915: LGTM!The
python_struct_nameparameter is correctly propagated to childStaticStructRegularMethodRendererinstances.
1080-1096: LGTM!Internal naming correctly uses
_python_struct_namefor Python-facing identifiers. TheCTYPE_TO_NBTYPE_STRmapping appropriately uses the raw C++ struct name as key (for C type resolution) while mapping to the Python-derived type name.
1110-1130: LGTM!The
_python_struct_nameis correctly used in both the typing and Python API templates, ensuring users see the prefix-removed name.
1226-1259: LGTM!The
_python_struct_nameis correctly propagated to both the regular methods renderer and constructors renderer.
1261-1277: Verify: Conversion operators don't need prefix removal.The
StaticStructConversionOperatorRendererandStaticStructConversionOperatorsRendererclasses were not updated withpython_struct_name. This appears intentional since@lower_castuses type objects rather than string names, so the prefix-removed naming flows through the type system automatically.Please confirm this is the intended behavior—that conversion operators inherit the correct naming via
_struct_type_namewithout needing explicitpython_struct_namepropagation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
numbast/src/numbast/tools/tests/test_symbol_exposure.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
numbast/src/numbast/tools/tests/test_symbol_exposure.py (2)
numbast/src/numbast/static/renderer.py (1)
clear_base_renderer_cache(125-133)numbast/src/numbast/static/function.py (1)
clear_function_apis_registry(712-719)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build Conda Python / build (arm64, 3.10, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.10, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.11, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.11, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.13, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.12, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.12, 12.9.1, rockylinux8)
🔇 Additional comments (1)
numbast/src/numbast/tools/tests/test_symbol_exposure.py (1)
8-9: New cache/reset imports look correct and localizedThe imports for
clear_base_renderer_cacheandclear_function_apis_registrymatch their definitions and keep the test’s dependencies explicit. No issues here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
numbast/src/numbast/static/enum.py (1)
71-76: Fix mutable default argument and incorrect type annotation.Two issues:
- Using a mutable default argument (
enum_prefix_removal: list[str] = []) is a Python anti-pattern.- The type annotation
list[tuple[set[str], str]]is incorrect; the code appends strings (line 85) and joins them (line 90), so it should belist[str].Apply this diff:
- def __init__(self, decls: list[Enum], enum_prefix_removal: list[str] = []): + def __init__(self, decls: list[Enum], enum_prefix_removal: list[str] | None = None): super().__init__(decls) self._decls = decls - self._enum_prefix_removal = enum_prefix_removal + self._enum_prefix_removal = enum_prefix_removal or [] - self._python_rendered: list[tuple[set[str], str]] = [] + self._python_rendered: list[str] = []
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
numbast/src/numbast/static/enum.py(3 hunks)numbast/src/numbast/static/renderer.py(4 hunks)numbast/src/numbast/static/types.py(1 hunks)numbast/src/numbast/tools/tests/config/prefix_removal.yml.j2(1 hunks)numbast/src/numbast/tools/tests/prefix_removal.cuh(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
numbast/src/numbast/static/enum.py (2)
numbast/src/numbast/utils.py (1)
_apply_prefix_removal(321-338)numbast/src/numbast/static/types.py (1)
register_enum_type_str(19-23)
🔇 Additional comments (9)
numbast/src/numbast/static/types.py (1)
20-20: LGTM! Clear documentation added.The docstring accurately describes the function's purpose in the enum type registration flow.
numbast/src/numbast/tools/tests/config/prefix_removal.yml.j2 (1)
12-23: LGTM! Test configuration properly structured.The configuration correctly declares the test types and prefix removal rules for structs and enums, supporting the new prefix removal feature.
numbast/src/numbast/tools/tests/prefix_removal.cuh (1)
8-17: LGTM! Test coverage for prefix removal is comprehensive.The test code properly exercises multiple prefix scenarios:
__internal__for the struct and enum name, and__nv__for enum members.numbast/src/numbast/static/enum.py (2)
47-47: LGTM! C-type registration correctly uses original and transformed names.The call to
register_enum_type_strproperly uses the original C++ enum name (self._decl.name) as the key and the transformed Python name (self._enum_name) as the value, maintaining the correct mapping for C++ types with prefixes.
50-58: LGTM! Enum member prefix removal implemented correctly.The code properly applies prefix removal to each enum member before rendering, ensuring both the enum name and its members have prefixes stripped as specified in the PR objectives.
numbast/src/numbast/static/renderer.py (4)
86-88: LGTM! Enum symbol tracking follows established patterns.The
_enum_symbolslist follows the same design as the existing_nbtype_symbols,_record_symbols, and_function_symbolslists.
134-134: LGTM! Cache clearing properly includes enum symbols.The
_enum_symbols.clear()call ensures enum state is reset consistently with other symbol caches, addressing the past review concern.
252-261: LGTM! Enum symbol getter mirrors existing patterns.The
_get_enum_symbols()function follows the same structure as_get_nbtype_symbols(),_get_record_symbols(), and_get_function_symbols().
276-283: LGTM! Enum symbols properly integrated into all exposure.Enum symbols are correctly added to the
__all__export list alongside other symbol types.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
numbast/src/numbast/utils.py (1)
321-338: Document theprefix_to_removeparameter.The docstring is missing documentation for the
prefix_to_removeparameter in the Parameters section. Based on learnings, this was requested in a previous review but appears incomplete.Apply this diff:
Parameters ---------- name : str The original struct, function or enum type name, or named enum values. + prefix_to_remove : list[str] + List of prefixes to attempt removal from the name. Returns
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
numbast/src/numbast/static/enum.py(3 hunks)numbast/src/numbast/tools/static_binding_generator.py(5 hunks)numbast/src/numbast/utils.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
numbast/src/numbast/tools/static_binding_generator.py (2)
numbast/src/numbast/static/struct.py (1)
StaticStructsRenderer(1346-1454)numbast/src/numbast/static/enum.py (1)
StaticEnumsRenderer(67-109)
numbast/src/numbast/static/enum.py (2)
numbast/src/numbast/utils.py (1)
_apply_prefix_removal(321-338)numbast/src/numbast/static/types.py (1)
register_enum_type_str(19-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Test Wheels / amd64, 3.10, 12.9.1, ubuntu24.04, l4
- GitHub Check: Test Wheels / arm64, 3.11, 12.9.1, ubuntu24.04, a100
- GitHub Check: Test Wheels / amd64, 3.13, 13.0.1, ubuntu24.04, l4
- GitHub Check: Test Wheels / arm64, 3.12, 13.0.1, ubuntu24.04, a100
- GitHub Check: Build Conda Python / build (arm64, 3.12, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.11, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.12, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.10, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (arm64, 3.13, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.11, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.13, 12.9.1, rockylinux8)
- GitHub Check: Build Conda Python / build (amd64, 3.10, 12.9.1, rockylinux8)
🔇 Additional comments (8)
numbast/src/numbast/tools/static_binding_generator.py (4)
91-92: LGTM! Docstring improvement enhances discoverability.The update clearly lists the acceptable keywords for
api_prefix_removal, making it easy for users to discover and use struct/enum prefix-removal features.
378-385: LGTM! Struct prefix-removal parameter correctly threaded.The
struct_prefix_removalparameter is properly added to the function signature and passed through toStaticStructsRenderer.
426-431: LGTM! Enum prefix-removal parameter correctly threaded.The
enum_prefix_removalparameter is properly added to the function signature and passed through toStaticEnumsRenderer.
530-532: LGTM! Configuration properly propagated to renderers.The prefix-removal configuration is correctly extracted from
config.api_prefix_removalusing safe.get()access and passed to the appropriate rendering functions.Also applies to: 538-538
numbast/src/numbast/static/enum.py (4)
32-42: LGTM! Mutable default argument correctly fixed.The constructor properly uses
Noneas the default and falls back to an empty list, avoiding the mutable default argument anti-pattern. The prefix-removal logic is correctly applied to compute the Python-facing enum name.
49-49: LGTM! Enum type registration correctly maps C++ name to Python name.The registration correctly uses the original C++ name (
self._decl.name) as the key and the prefix-stripped name (self._enum_name) as the value, ensuring C++ types with prefixes map correctly to the generated Python enums.
55-60: LGTM! Prefix removal correctly applied to enum members.Each enumerator now has prefix removal applied via
_apply_prefix_removal, ensuring both the enum type name and its members are consistently transformed for Python, as specified in the PR objectives.
78-78: LGTM! Type annotation correctly fixed.The
_python_renderedtype annotation is now correctly specified aslist[str], matching its actual usage where string blocks are appended and later joined.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Note Docstrings generation - SKIPPED |
Docstrings generation was requested by @isVoid. * #259 (comment) The following files were modified: * `numbast/src/numbast/static/enum.py` * `numbast/src/numbast/static/function.py` * `numbast/src/numbast/static/renderer.py` * `numbast/src/numbast/static/struct.py` * `numbast/src/numbast/static/types.py` * `numbast/src/numbast/tools/static_binding_generator.py` * `numbast/src/numbast/tools/tests/test_prefix_removal.py` * `numbast/src/numbast/utils.py`
Docstrings generation was requested by @isVoid. * #259 (comment) The following files were modified: * `numbast/src/numbast/static/enum.py` * `numbast/src/numbast/static/function.py` * `numbast/src/numbast/static/renderer.py` * `numbast/src/numbast/static/struct.py` * `numbast/src/numbast/static/types.py` * `numbast/src/numbast/tools/static_binding_generator.py` * `numbast/src/numbast/tools/tests/test_prefix_removal.py` * `numbast/src/numbast/utils.py` <details> <summary>These files were kept as they were</summary> * `numbast/src/numbast/tools/tests/test_symbol_exposure.py` </details> <details> <summary>These file types are not supported</summary> * `numbast/src/numbast/tools/tests/config/prefix_removal.yml.j2` * `numbast/src/numbast/tools/tests/prefix_removal.cuh` </details> <details> <summary>ℹ️ Note</summary><blockquote> CodeRabbit cannot perform edits on its own pull requests yet. </blockquote></details> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Michael Wang <isVoid@users.noreply.github.com>
Numbast 0.6.0 updates numba-cuda pinnings to 0.21.0+ - bump 0.6.0 - Eagerly use all vended `numba.cuda` modules, Bump supported Numba-CUDA version to 0.21+ (#239) - Support Functions Typed with `__nv_bfloat16_raw` (#262) - Use `TargetRegistry.lower_cast` in separate registry mode (#263) - 📝 Add docstrings to `fea-enum-prefix-removal` (#261) - Allow Prefix Removal for Struct and Enums (#259) - Enable CodeRabbit Auto Review (#257) - use readme.md as PYPI description readme (#254) Co-authored-by: Michael Wang <isVoid@users.noreply.github.com>
Manual `clear_base_renderer_cache()` and `clear_function_apis_registry()` calls scattered across test files to prevent cross-test pollution. Consolidates these into a single `autouse` fixture. ## Changes - **`conftest.py`**: Added `reset_state()` fixture with `autouse=True` that executes both clear functions before each test - **`test_symbol_exposure.py`**: Removed manual clear calls (now handled by fixture) - **`test_cli.py`**: Removed manual clear calls from 10 test functions ## Impact All 15 test files in `numbast/src/numbast/tools/tests/` now automatically reset state before each test. Single point of maintenance for state reset logic. ```python @pytest.fixture(autouse=True) def reset_state(): """Reset global state before each test to avoid cross-test pollution.""" clear_base_renderer_cache() clear_function_apis_registry() yield ``` <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Refactor state reset calls into a shared pytest fixture</issue_title> > <issue_description>## Description > > In `numbast/src/numbast/tools/tests/test_symbol_exposure.py`, the test manually calls `clear_base_renderer_cache()` and `clear_function_apis_registry()` at the start to avoid cross-test pollution. > > ## Proposed Change > > Refactor these calls into a shared pytest fixture (optionally with `autouse=True`) that can be: > - Placed in the test module or a `conftest.py` > - Automatically run before each test to guarantee state reset > - Centralized for reuse across multiple tests if needed > > ## Context > > - PR: #259 > - Discussion: #259 (comment) > - Requested by: @isVoid > > ## Implementation Notes > > The fixture should: > 1. Import and execute `clear_base_renderer_cache()` from `numbast.static.renderer` > 2. Import and execute `clear_function_apis_registry()` from `numbast.static.function` > 3. Yield control to allow for future teardown/cleanup logic if needed > 4. Consider using `autouse=True` to automatically apply to all tests in scope</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #260 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: isVoid <13521008+isVoid@users.noreply.github.com>
This is a sub-issue from #247 . Previously we have prefix removal feature for standalone functions. This PR expands the feature to Struct and Enums. Assuming a prefix named
_prefix_is to be removed, a struct named_prefix_Foois namedFooin python. A enum defined below:enum _prefix_Fruit { _prefix_Apple, _prefix_Banana };will be exported as:
in python. This is to say that the prefix removal is applicable to both enum name as well as the members.
Summary by CodeRabbit
New Features
Refactor
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.