Skip to content

fs: hide gdrive_* methods #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pydrive2/fs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def upload_fobj(self, stream, rpath, callback=None, **kwargs):
stream = CallbackIOWrapper(
callback.relative_update, stream, "read"
)
return self.gdrive_upload_fobj(
return self._gdrive_upload_fobj(
posixpath.basename(rpath.rstrip("/")), parent_id, stream
)

Expand All @@ -518,7 +518,7 @@ def put_file(self, lpath, rpath, callback=None, **kwargs):
self.upload_fobj(stream, rpath, callback=callback)

@_gdrive_retry
def gdrive_upload_fobj(self, title, parent_id, stream, callback=None):
def _gdrive_upload_fobj(self, title, parent_id, stream, callback=None):
item = self.client.CreateFile(
{"title": title, "parents": [{"id": parent_id}]}
)
Expand All @@ -537,12 +537,12 @@ def cp_file(self, lpath, rpath, **kwargs):

def get_file(self, lpath, rpath, callback=None, block_size=None, **kwargs):
item_id = self._get_item_id(lpath)
return self.gdrive_get_file(
return self._gdrive_get_file(
item_id, rpath, callback=callback, block_size=block_size
)

@_gdrive_retry
def gdrive_get_file(self, item_id, rpath, callback=None, block_size=None):
def _gdrive_get_file(self, item_id, rpath, callback=None, block_size=None):
param = {"id": item_id}
# it does not create a file on the remote
gdrive_file = self.client.CreateFile(param)
Expand All @@ -568,10 +568,10 @@ def _open(self, path, mode, **kwargs):
return GDriveBufferedWriter(self, path)
else:
item_id = self._get_item_id(path)
return self.gdrive_open_file(item_id)
return self._gdrive_open_file(item_id)

@_gdrive_retry
def gdrive_open_file(self, item_id):
def _gdrive_open_file(self, item_id):
param = {"id": item_id}
# it does not create a file on the remote
gdrive_file = self.client.CreateFile(param)
Expand All @@ -580,10 +580,10 @@ def gdrive_open_file(self, item_id):

def rm_file(self, path):
item_id = self._get_item_id(path)
self.gdrive_delete_file(item_id)
self._gdrive_delete_file(item_id)

@_gdrive_retry
def gdrive_delete_file(self, item_id):
def _gdrive_delete_file(self, item_id):
from pydrive2.files import ApiRequestError

param = {"id": item_id}
Expand Down