usort/api.py
def usort_file(path: Path, *, write: bool = False) -> Result:
    """
    Format a single file and return a Result object.

    Ignores any configured :py:attr:`excludes` patterns.
    """

    try:
        config = Config.find(path.parent)
        data = path.read_bytes()
        result = usort(data, config, path)

        if result.output and write:
            path.write_bytes(result.output)

        return result

    except Exception as e:
        return Result(
            path=path,
            error=e,
            timings=get_timings(),
        )

    Format a single file and return a Result object.

    Ignores any configured :py:attr:`excludes` patterns.
    
Format a single file and return a Result object.
Ignores any configured :py:attr:`excludes` patterns.
Format a single file and return a Result object . Ignores any configured : py : attr : ` excludes ` patterns .
def usort_file(path: Path, *, write: bool = False) -> Result:
    try:
        config = Config.find(path.parent)
        data = path.read_bytes()
        result = usort(data, config, path)
        if result.output and write:
            path.write_bytes(result.output)
        return result
    except Exception as e:
        return Result(
            path=path,
            error=e,
            timings=get_timings(),
        )
def usort_file ( path : Path , * , write : bool = False ) -> Result : try : config = Config . find ( path . parent ) data = path . read_bytes ( ) result = usort ( data , config , path ) if result . output and write : path . write_bytes ( result . output ) return result except Exception as e : return Result ( path = path , error = e , timings = get_timings ( ) , )
Format a single file and return a Result object.
Format a single file and return a Result object .
"""
    Format a single file and return a Result object.

    Ignores any configured :py:attr:`excludes` patterns.
    """
path
Path
write
bool