Skip to content

Expand list-valued search qualifiers into repeated chunks#3533

Open
Noethix55555 wants to merge 1 commit into
PyGithub:mainfrom
Noethix55555:fix/search-list-qualifier
Open

Expand list-valued search qualifiers into repeated chunks#3533
Noethix55555 wants to merge 1 commit into
PyGithub:mainfrom
Noethix55555:fix/search-list-qualifier

Conversation

@Noethix55555

Copy link
Copy Markdown
Contributor

Fixes #3532

Problem

The six search_* methods built qualifiers with f"{qualifier}:{value}", so a list/tuple value was serialized as a Python list repr on the wire:

g.search_repositories("x", language=["python", "ruby"])
# q -> "x language:['python', 'ruby']"

Fix

Add a shared _build_query_qualifiers helper that expands list/tuple values into repeated qualifier:value chunks (the GitHub-idiomatic form) and leaves scalar values unchanged. Applied to all six search methods.

# q -> "x language:python language:ruby"

Multi-word-value quoting is intentionally left unchanged.

Tests

Added offline tests asserting the constructed q for list, tuple, and scalar qualifiers. The list/tuple tests fail on HEAD (list repr) and pass with the fix; the scalar test is unchanged behavior.

The six search_* methods built qualifiers with f"{qualifier}:{value}",
so a list/tuple value was serialized as a Python list repr on the wire
(e.g. language:['python', 'ruby']). Expand list/tuple values into
repeated qualifier:value chunks, the GitHub-idiomatic form, via a shared
helper.
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.

search_* methods serialize list-valued qualifiers as Python list reprs

1 participant