sapling/eden/fs/cli/filesystem.py
Xavier Deguillard c51b1ed1da cli: enable pyre-strict for filesystem.py
Summary: This will force future changes to this file to be fully type checked.

Reviewed By: fanzeyi

Differential Revision: D28544421

fbshipit-source-id: 67d15e4d6ed13c139adffa7cedf7795856d87c7e
2021-05-19 19:27:06 -07:00

36 lines
803 B
Python

#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-strict
import abc
import os
import shutil
from . import util
class FsUtil(abc.ABC):
@abc.abstractmethod
def mkdir_p(self, path: str) -> str:
"""Performs `mkdir -p <path>` and returns the path."""
@abc.abstractmethod
def disk_usage(self, path: str) -> shutil._ntuple_diskusage:
"""Calls os.statvfs on the mount"""
class RealFsUtil(FsUtil):
def mkdir_p(self, path: str) -> str:
return util.mkdir_p(path)
def disk_usage(self, path: str) -> shutil._ntuple_diskusage:
return shutil.disk_usage(path)
def new() -> FsUtil:
return RealFsUtil()