Skip to content

Fixed the Code Generation Script & Model CLI Description#671

Merged
srikanthbachala20 merged 3 commits intomasterfrom
Fix-Code-Script
Jul 3, 2025
Merged

Fixed the Code Generation Script & Model CLI Description#671
srikanthbachala20 merged 3 commits intomasterfrom
Fix-Code-Script

Conversation

@srikanthbachala20
Copy link
Copy Markdown
Contributor

This pull request includes updates to the clarifai/runners/utils/code_script.py file to improve string formatting and handle default values more robustly. The most important changes involve updating how base_url is formatted and refining the handling of iterators for string field types.

String Formatting Improvements:

  • Updated the base_url string formatting in async def main() to ensure the value is enclosed in single quotes, improving consistency and preventing potential issues with special characters. ([clarifai/runners/utils/code_script.pyL130-R130](https://github.com/Clarifai/clarifai-python/pull/671/files#diff-f990dbbc37fac6c569969b0e28e173a20b80fd30f5db1899e0f5b435b71f753dL130-R130))

Default Value Handling:

  • Modified the _set_default_value function to handle string field types (str) specifically when creating iterators, ensuring the default value is wrapped in single quotes for strings. ([clarifai/runners/utils/code_script.pyR324-R326](https://github.com/Clarifai/clarifai-python/pull/671/files#diff-f990dbbc37fac6c569969b0e28e173a20b80fd30f5db1899e0f5b435b71f753dR324-R326))

@srikanthbachala20 srikanthbachala20 requested review from Copilot, luv-bansal, mogith-pn and zeiler and removed request for Copilot and luv-bansal July 3, 2025 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Improves string quoting consistency in the code generation script and adds special handling for string defaults in iterator contexts.

  • Encloses base_url in single quotes to prevent formatting issues with special characters.
  • Adds a branch in _set_default_value to wrap string defaults in quotes when creating iterators.
Comments suppressed due to low confidence (1)

clarifai/runners/utils/code_script.py:323

  • Add unit tests covering the new string-iterator branch, including edge cases where default_value contains quotes or special characters.
    if is_iterator:

Comment thread clarifai/runners/utils/code_script.py
Comment thread clarifai/runners/utils/code_script.py Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 3, 2025

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 46%
clarifai.cli.templates 28%
clarifai.client 69%
clarifai.client.auth 66%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 72%
clarifai.runners 12%
clarifai.runners.models 58%
clarifai.runners.pipeline_steps 46%
clarifai.runners.pipelines 85%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 58%
clarifai.utils 73%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 64% (7268 / 11394)

Minimum allowed line rate is 50%

Copy link
Copy Markdown
Contributor

@luv-bansal luv-bansal left a comment

Choose a reason for hiding this comment

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

Looks good

@srikanthbachala20 srikanthbachala20 merged commit 3b09f4f into master Jul 3, 2025
14 of 15 checks passed
@srikanthbachala20 srikanthbachala20 deleted the Fix-Code-Script branch July 3, 2025 07:22
@srikanthbachala20 srikanthbachala20 mentioned this pull request Jul 7, 2025
srikanthbachala20 added a commit that referenced this pull request Jul 29, 2025
* Fixed the Code Generation Script & odel CLI Description

* Fixed the Code Generation Script & odel CLI Description

* Fixed the Code Generation Script & odel CLI Description
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.

3 participants