redis-om-python/make_sync.py

39 lines
877 B
Python
Raw Normal View History

2021-11-10 00:59:10 +01:00
import os
from pathlib import Path
import unasync
2021-11-10 20:31:02 +01:00
ADDITIONAL_REPLACEMENTS = {
"aredis_om": "redis_om",
"aioredis": "redis",
":tests.": ":tests_sync.",
}
2021-11-10 00:59:10 +01:00
def main():
rules = [
unasync.Rule(
fromdir="/aredis_om/",
todir="/redis_om/",
2021-11-10 20:31:02 +01:00
additional_replacements=ADDITIONAL_REPLACEMENTS,
),
unasync.Rule(
fromdir="/tests/",
todir="/tests_sync/",
additional_replacements=ADDITIONAL_REPLACEMENTS,
2021-11-10 00:59:10 +01:00
),
]
filepaths = []
for root, _, filenames in os.walk(
2021-11-10 20:31:02 +01:00
Path(__file__).absolute().parent
2021-11-10 00:59:10 +01:00
):
for filename in filenames:
if filename.rpartition(".")[-1] in ("py", "pyi",):
filepaths.append(os.path.join(root, filename))
unasync.unasync_files(filepaths, rules)
if __name__ == "__main__":
main()