[ContentUnderstanding] Remove ContentRange class and use plain strings for content range#45788
Conversation
Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>
|
@copilot If should remove class |
Based on the previous feedback ("Python/JS samples should use plain strings as the direct equivalent"), removing
My recommendation: keep If you decide you want me to remove it, I can:
Let me know if you'd like me to proceed with the removal. |
Yes, please proceed with the removal. We only use raw string instead of type class. |
Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>
Done in commit
|
|
@copilot In file |
Now that ContentRange class is removed and all content ranges are plain strings, the [START *_with_raw_content_range] sections duplicated values already shown in the typed content range sections (e.g. "1-3,5,9-" appeared twice in binary samples, "0-5000" twice in video URL samples). Removed the redundant sections from all four sample files. Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>
Correct — those were leftover "raw string" sections from when |
8f8f84e
into
changjian-wang/add-contentrange-samples-doc-audio-video
Removes the
ContentRangehelper class entirely from the Python SDK. Content range values are now passed as plain strings directly — the only supported approach.Changes
models/_content_range.py— removed theContentRangeclasstests/test_content_range.py— tests for the now-removed classmodels/_patch.py: RemovedContentRangeimport and"ContentRange"from__all___patch.py/aio/_patch.py: Changedcontent_rangeparameter type fromOptional[Union[str, ContentRange]]toOptional[str]; removedstr(content_range)conversion; updated docstringssample_analyze_binary.py/ async): RemovedContentRangeimport; replaced all factory calls with plain strings (e.g.,ContentRange.pages_from(3)→"3-",ContentRange.combine(...)→"1-3,5,9-"); removed redundant[START *_with_raw_content_range]sections that duplicated values already shown in the typed content range sectionssample_analyze_url.py/ async): RemovedContentRangeimport andtimedeltaimport; replaced all factory calls with plain strings (e.g.,ContentRange.time_range(timedelta(0), timedelta(seconds=5))→"0-5000",ContentRange.time_range_from(timedelta(seconds=10))→"10000-"); removed redundant[START *_with_raw_content_range]sections for video and audio that duplicated"0-5000"and"5000-"already shown abovetest_sample_analyze_binary.pyandtest_sample_analyze_url.pyto removeContentRangeimport and replace all factory calls with plain strings; simplified test methods to use plain strings directly✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.