Skip to content
Snippets Groups Projects

client: make API response typify-ing optional

3 unresolved threads

Closes #2646 (closed).


Migrated from D4160 (view on Phabricator)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
236 yield from self.directory(swhid_, typify)
235 237 elif obj_type == CONTENT:
236 yield from [self.content(swhid_)]
238 yield from [self.content(swhid_, typify)]
237 239 else:
238 240 raise ValueError(f"invalid object type: {obj_type}")
239 241
240 def content(self, swhid: SWHIDish, **req_args) -> Dict[str, Any]:
242 def content(
243 self, swhid: SWHIDish, typify: bool = True, **req_args
244 ) -> Dict[str, Any]:
241 245 """Retrieve information about a content object
242 246
243 247 Args:
244 248 swhid: object persistent identifier
249 typify: if True, convert return value to pythonic types wherever
  • "if True, convert return value to pythonic types wherever possible, otherwise return raw JSON types (default: True)"

    same in all other occurrences of this arg description string

  • Please register or sign in to reply
  • 143 147 assert visits[0]["snapshot"] is None
    144 148 snapshot_swhid = "swh:1:snp:456550ea74af4e2eecaa406629efaaf0b9b5f976"
    145 149 assert visits[7]["snapshot"] == parse_swhid(snapshot_swhid)
    150
    151
    152 def test_get_json(web_api_client, web_api_mock):
  • Merge request was returned for changes

    • update documentation string
    • rename new test to test_get_json
  • Build is green

    Patch application report for D4160 (id=14665)

    Rebasing onto 677e9856...

    Current branch diff-target is up to date.
    Changes applied before test
    commit bb23b299617e5c3d337032b21da3151ecb744a33
    Author: Thibault Allançon <haltode@gmail.com>
    Date:   Tue Oct 6 14:28:03 2020 +0200
    
        client: make API response typify-ing optional
        
        Closes #2646.

    See https://jenkins.softwareheritage.org/job/DWCLI/job/tests-on-diff/22/ for more details.

  • 235 237 elif obj_type == CONTENT:
    236 yield from [self.content(swhid_)]
    238 yield from [self.content(swhid_, typify)]
    237 239 else:
    238 240 raise ValueError(f"invalid object type: {obj_type}")
    239 241
    240 def content(self, swhid: SWHIDish, **req_args) -> Dict[str, Any]:
    242 def content(
    243 self, swhid: SWHIDish, typify: bool = True, **req_args
    244 ) -> Dict[str, Any]:
    241 245 """Retrieve information about a content object
    242 246
    243 247 Args:
    244 248 swhid: object persistent identifier
    249 typify: if True, convert return value to pythonic types wherever
    250 possible, otherwise return raw JSON types (default: True)
  • Merge request was returned for changes

  • Fix indentation in documentation string

  • Build is green

    Patch application report for D4160 (id=14666)

    Rebasing onto 677e9856...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 5d04bc970f17dab54e97916b55cd850c3603f6bd
    Author: Thibault Allançon <haltode@gmail.com>
    Date:   Tue Oct 6 14:28:03 2020 +0200
    
        client: make API response typify-ing optional
        
        Closes #2646.

    See https://jenkins.softwareheritage.org/job/DWCLI/job/tests-on-diff/23/ for more details.

  • Merge request was accepted

  • Stefano Zacchiroli approved this merge request

    approved this merge request

  • Merge request was merged

  • Please register or sign in to reply
    Loading