Skip to content

b2sdk: create_file prioritization should accept an enum, not a string #602

Description

@ffumero2003

Description

Bucket.create_file and Bucket.create_file_stream accept source prioritization as a string, with the supported values being local, remote and local_verification. An enum would make the valid values discoverable through the type system and turn a typo into an immediate error rather than a silently different plan.

This was recorded as a .. TODO:: directive in doc/source/advanced.rst, where it was invisible in published builds and carried no owner or acceptance criteria. It is tracked here instead, as part of #601.

Note that this is an API design change rather than a documentation change, so it is filed separately from the documentation work in #601.

Steps to reproduce

bucket.create_file(input_sources, remote_name, file_info, prioritize='local')
bucket.create_file(input_sources, remote_name, file_info, prioritize='locol')  # typo, not rejected at the call site

Expected behavior

Prioritization should be expressed as an enum, with the string values continuing to be accepted for backwards compatibility within the current interface version.

Actual behavior

Only strings are accepted, and an unrecognised value is not caught at the call site.

Environment

  • Python version: Any supported version
  • b2sdk version: master at f3ab7b71
  • OS: Any

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions