Merge branch 'master' of github.com:mongodb/mongo-python-driver

This commit is contained in:
Steven Silvester 2025-01-21 09:28:38 -06:00
commit 89984e1cbf
No known key found for this signature in database
GPG Key ID: B1BF5EC3A8B32F91
2 changed files with 29 additions and 22 deletions

View File

@ -1,5 +1,5 @@
mypy==1.14.1
pyright==1.1.391
pyright==1.1.392.post0
typing_extensions
-r ./encryption.txt
-r ./ocsp.txt

View File

@ -149,6 +149,10 @@ _pymongo_dest_base = "./pymongo/synchronous/"
_gridfs_dest_base = "./gridfs/synchronous/"
_test_dest_base = "./test/"
if not Path.exists(Path(_pymongo_dest_base)):
Path.mkdir(Path(_pymongo_dest_base))
if not Path.exists(Path(_gridfs_dest_base)):
Path.mkdir(Path(_gridfs_dest_base))
async_files = [
_pymongo_base + f for f in listdir(_pymongo_base) if (Path(_pymongo_base) / f).is_file()
@ -170,18 +174,6 @@ test_files = [
if (Path(_test_base) / f).is_file() and not async_only_test(f)
]
sync_files = [
_pymongo_dest_base + f
for f in listdir(_pymongo_dest_base)
if (Path(_pymongo_dest_base) / f).is_file()
]
sync_gridfs_files = [
_gridfs_dest_base + f
for f in listdir(_gridfs_dest_base)
if (Path(_gridfs_dest_base) / f).is_file()
]
# Add each asynchronized test here as part of the converting PR
converted_tests = [
"__init__.py",
@ -223,15 +215,10 @@ converted_tests = [
"unified_format.py",
]
sync_test_files = [
_test_dest_base + f for f in converted_tests if (Path(_test_dest_base) / f).is_file()
]
docstring_translate_files = sync_files + sync_gridfs_files + sync_test_files
def process_files(files: list[str]) -> None:
def process_files(
files: list[str], docstring_translate_files: list[str], sync_test_files: list[str]
) -> None:
for file in files:
if "__init__" not in file or "__init__" and "test" in file:
with open(file, "r+") as f:
@ -374,7 +361,27 @@ def main() -> None:
unasync_directory(async_files, _pymongo_base, _pymongo_dest_base, replacements)
unasync_directory(gridfs_files, _gridfs_base, _gridfs_dest_base, replacements)
unasync_directory(test_files, _test_base, _test_dest_base, replacements)
process_files(sync_files + sync_gridfs_files + sync_test_files)
sync_files = [
_pymongo_dest_base + f
for f in listdir(_pymongo_dest_base)
if (Path(_pymongo_dest_base) / f).is_file()
]
sync_gridfs_files = [
_gridfs_dest_base + f
for f in listdir(_gridfs_dest_base)
if (Path(_gridfs_dest_base) / f).is_file()
]
sync_test_files = [
_test_dest_base + f for f in converted_tests if (Path(_test_dest_base) / f).is_file()
]
docstring_translate_files = sync_files + sync_gridfs_files + sync_test_files
process_files(
sync_files + sync_gridfs_files + sync_test_files, docstring_translate_files, sync_test_files
)
if __name__ == "__main__":