Skip to content

Slash notation causes mypy to throw an error #469

Open
@HWiese1980

Description

@HWiese1980

cloudpathlib: 0.19.0
Python: 3.12
mypy: 1.11.2

When doing the following:

path = cloudpathlib.S3Path("s3://somebucket") / some_string / some_path / something_else

Mypy throws the following error:

error: Unsupported operand types for / ("S3Path" and "AnyPath") [operator]
error: Unsupported operand types for / ("S3Path" and "S3Path") [operator]
note: Right operand is of type "Path | CloudPath | AnyPath | S3Path"
error: Unsupported left operand type for / ("None")  [operator]
note: Left operand is of type "Path | S3Path | None"

In my opinion this is valid code. The result obviously ought to be an S3Path object merged from the original S3Path object, a string, another path-like object (could be a relative PosixPath even) and something totally different, as long as it can be interpreted as a path component.

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