scripts/fixup_servicemanagement_v1_keywords.py
def fix_files(
    in_dir: pathlib.Path,
    out_dir: pathlib.Path,
    *,
    transformer=servicemanagementCallTransformer(),
):
    """Duplicate the input dir to the output dir, fixing file method calls.

    Preconditions:
    * in_dir is a real directory
    * out_dir is a real, empty directory
    """
    pyfile_gen = (
        pathlib.Path(os.path.join(root, f))
        for root, _, files in os.walk(in_dir)
        for f in files if os.path.splitext(f)[1] == ".py"
    )

    for fpath in pyfile_gen:
        with open(fpath, 'r') as f:
            src = f.read()

        # Parse the code and insert method call fixes.
        tree = cst.parse_module(src)
        updated = tree.visit(transformer)

        # Create the path and directory structure for the new file.
        updated_path = out_dir.joinpath(fpath.relative_to(in_dir))
        updated_path.parent.mkdir(parents=True, exist_ok=True)

        # Generate the updated source file at the corresponding path.
        with open(updated_path, 'w') as f:
            f.write(updated.code)
Duplicate the input dir to the output dir, fixing file method calls.

    Preconditions:
    * in_dir is a real directory
    * out_dir is a real, empty directory
    
Duplicate the input dir to the output dir, fixing file method calls.
Preconditions:
in_dir is a real directory
out_dir is a real, empty directory
Duplicate the input dir to the output dir fixing file method calls . Preconditions : in_dir is a real directory out_dir is a real empty directory
def fix_files(
    in_dir: pathlib.Path,
    out_dir: pathlib.Path,
    *,
    transformer=servicemanagementCallTransformer(),
):
    pyfile_gen = (
        pathlib.Path(os.path.join(root, f))
        for root, _, files in os.walk(in_dir)
        for f in files if os.path.splitext(f)[1] == ".py"
    )
    for fpath in pyfile_gen:
        with open(fpath, 'r') as f:
            src = f.read()
        tree = cst.parse_module(src)
        updated = tree.visit(transformer)
        updated_path = out_dir.joinpath(fpath.relative_to(in_dir))
        updated_path.parent.mkdir(parents=True, exist_ok=True)
        with open(updated_path, 'w') as f:
            f.write(updated.code)
def fix_files ( in_dir : pathlib . Path , out_dir : pathlib . Path , * , transformer = servicemanagementCallTransformer ( ) , ) : pyfile_gen = ( pathlib . Path ( os . path . join ( root , f ) ) for root , _ , files in os . walk ( in_dir ) for f in files if os . path . splitext ( f ) [ 1 ] == ".py" ) for fpath in pyfile_gen : with open ( fpath , 'r' ) as f : src = f . read ( ) tree = cst . parse_module ( src ) updated = tree . visit ( transformer ) updated_path = out_dir . joinpath ( fpath . relative_to ( in_dir ) ) updated_path . parent . mkdir ( parents = True , exist_ok = True ) with open ( updated_path , 'w' ) as f : f . write ( updated . code )
Duplicate the input dir to the output dir, fixing file method calls.
Duplicate the input dir to the output dir fixing file method calls .
"""Duplicate the input dir to the output dir, fixing file method calls.

    Preconditions:
    * in_dir is a real directory
    * out_dir is a real, empty directory
    """ # Parse the code and insert method call fixes. # Create the path and directory structure for the new file. # Generate the updated source file at the corresponding path.
in_dir
pathlib.Path
out_dir
pathlib.Path
transformer