You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defmkdir(fs: GDriveFileSystem, path, create_parents=True):
"""Create directory entry at path"""iffs.exists(path):
raiseFileExistsError(path)
dst_id=fs._get_item_id(fs._parent(path), create=create_parents)
basename=posixpath.basename(path.rstrip("/"))
fs._gdrive_create_dir(dst_id, basename)
# create a GDriveFileSystem instance with a path that point to an empy folderroot="root/tmp/"fs=GDriveFileSystem(root, auth)
# dump the cacheprint(json.dumps(fs._ids_cache, indent=4))
{
"dirs": {
"tmp": [
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
]
},
"ids": {
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx": "tmp"
},
"root_id": "1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
}
# create a folderfolder=posixpath.join(root, "folder")
mkdir(fs, folder)
# the cache did not changeprint(json.dumps(fs._ids_cache, indent=4))
{
"dirs": {
"tmp": [
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
]
},
"ids": {
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx": "tmp"
},
"root_id": "1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
}
# use the ls method to get the content of the folder we just createdprint(fs.ls(folder))
[]
# there is a new entry in the cache: "root/tmp/folder"print(json.dumps(fs._ids_cache, indent=4))
{
"dirs": {
"tmp": [
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
],
"root/tmp/folder": [
"1VKRRnGmZm_Dvmn0G8xQjqwQxbZ9vW0Hf"
]
},
"ids": {
"1BClMfgL7BMV61-5SdWAvc8njvkPgicyx": "tmp",
"1VKRRnGmZm_Dvmn0G8xQjqwQxbZ9vW0Hf": "root/tmp/folder"
},
"root_id": "1BClMfgL7BMV61-5SdWAvc8njvkPgicyx"
}
As we can see, there is an inconsistency between items added in the initialization phase of the cache and items added by ls:
items added on the initialization of _ids_cache does not have the root/ prefix
code
https://github.com/iterative/PyDrive2/blob/b700387d05b4ef853607bc54ce0561d571456fc6/pydrive2/fs/spec.py#L247-L266
items added by ls have the root/ prefix
code
https://github.com/iterative/PyDrive2/blob/b700387d05b4ef853607bc54ce0561d571456fc6/pydrive2/fs/spec.py#L427-L467
Is this the expected behavior?
The text was updated successfully, but these errors were encountered:
Consider this minimal working example:
The
mkdir
method is from #222As we can see, there is an inconsistency between items added in the initialization phase of the cache and items added by ls:
_ids_cache
does not have theroot/
prefixcode
https://github.com/iterative/PyDrive2/blob/b700387d05b4ef853607bc54ce0561d571456fc6/pydrive2/fs/spec.py#L247-L266ls
have theroot/
prefixcode
https://github.com/iterative/PyDrive2/blob/b700387d05b4ef853607bc54ce0561d571456fc6/pydrive2/fs/spec.py#L427-L467Is this the expected behavior?
The text was updated successfully, but these errors were encountered: