Skip to content

Move the write-and-close helpers from S3FileSystem to S3File #1034

Description

@laughingman7743

Problem

S3FileSystem has two static helpers that write to a file opened for writing and close it without committing on failure:

Neither uses the filesystem. Both operate only on the S3File they receive, and call its private _close_without_commit() from outside the class. AioS3FileSystem does not inherit S3FileSystem, so it reaches them through its internal filesystem (self._sync_fs._write_and_close(...), self._sync_fs._write_file_and_close(...)), although AioS3File inherits S3File.

Proposed change

Move both helpers to S3File as instance methods, next to _close_without_commit(), and call them on the opened file:

self.open(path, "wb", **kwargs)._write_and_close(value)
self.open(rpath, "wb", ...)._write_file_and_close(local, callback)

Private methods only; no behavior change.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions