facebook360_dep
Facebook360 Depth Estimation Pipeline
Classes | Functions | Variables
scripts.util.system_util Namespace Reference

Classes

class  OSType
 

Functions

def get_os_type_local (platform=None)
 
def get_flags (source)
 
def get_flags_from_flagfile (flagfile_fn)
 
def list_only_visible_files (src_dir)
 
def list_only_visible_dirs (src_dir)
 
def start_subprocess (name, cmd)
 
def list_only_visible_files_recursive (src_dir)
 
def intersect_lists (*args)
 
def merge_lists (*args)
 
def extract_tar (filename, dst=None)
 
def run_command (shell_string, run_silently=False, stream=True, run_async=False, file_fn=None)
 
def sh_buffered (arg, file=sys.stdout, use_shell=True)
 
def sh_stream (arg, file=sys.stdout, use_shell=None)
 
def get_catchable_signals ()
 

Variables

 facebook360_dep_root = str(Path(os.path.abspath(__file__)).parents[2])
 
def image_type_paths = _set_image_type_paths()
 

Function Documentation

◆ extract_tar()

def scripts.util.system_util.extract_tar (   filename,
  dst = None 
)
Extracts a tar file.

Args:
    filename (str): Path to the tar file.
    dst (str, optional): Directory where extraction should produce results.

Returns:
    str: Path to the extracted directory.

◆ get_catchable_signals()

def scripts.util.system_util.get_catchable_signals ( )
Defines list of signals that can be caught (OS dependent).

Returns:
    list[signal.signal]: Signals that can be caught.

◆ get_flags()

def scripts.util.system_util.get_flags (   source)
Gets flags from a source file.

Args:
    source (str): Path to the source file (could be any extension).

Returns:
    list[dict[str, _]]: List of maps with keys "type", "name", "default", and "descr" for the
        respective fields corresponding to the flag.

◆ get_flags_from_flagfile()

def scripts.util.system_util.get_flags_from_flagfile (   flagfile_fn)

◆ get_os_type_local()

def scripts.util.system_util.get_os_type_local (   platform = None)

◆ intersect_lists()

def scripts.util.system_util.intersect_lists ( args)

◆ list_only_visible_dirs()

def scripts.util.system_util.list_only_visible_dirs (   src_dir)
Gets the visible directories in a directory.

Args:
    src_dir (str): Path to the directory.

Returns:
    list[str]: Names of visible directories (not full paths).

◆ list_only_visible_files()

def scripts.util.system_util.list_only_visible_files (   src_dir)
Gets the visible files in a directory.

Args:
    src_dir (str): Path to the directory.

Returns:
    list[str]: Names of visible files (not full paths).

◆ list_only_visible_files_recursive()

def scripts.util.system_util.list_only_visible_files_recursive (   src_dir)
Recursively gets the visible files in a directory.

Args:
    src_dir (str): Path to the directory.

Returns:
    list[str]: Names of visible files (not full paths).

◆ merge_lists()

def scripts.util.system_util.merge_lists ( args)

◆ run_command()

def scripts.util.system_util.run_command (   shell_string,
  run_silently = False,
  stream = True,
  run_async = False,
  file_fn = None 
)
Run a shell command.

Args:
    shell_string (str): Command to be run.
    run_silently (bool, optional): Whether or not to show stdout.
    stream (bool, optional): Whether or not to stream stdout. If run_silently is
        set to True, if the file_fn is not empty, or if running on a Windows host,
        this argument cannot be overrided (will be False).
    run_async (bool, optional): Whether or not to run command asynchronously. No output
        is returned if running async.
    file_fn (str, optional): Filename of where output should be saved.

Returns:
    str: stdout from executing command.

◆ sh_buffered()

def scripts.util.system_util.sh_buffered (   arg,
  file = sys.stdout,
  use_shell = True 
)
Run a shell command with buffered output.

Args:
    arg (str): Command to run.
    file (file, optional): File handler to write stdout to.
    use_shell (bool, optional): Whether or not to execute in a shell.

Returns:
    str: stdout from executing command.

◆ sh_stream()

def scripts.util.system_util.sh_stream (   arg,
  file = sys.stdout,
  use_shell = None 
)
Run a shell command with streaming output.

Args:
    arg (str): Command to run.
    file (file, optional): File handler to write stdout to.
    use_shell (bool, optional): Whether or not to execute in a shell.

Returns:
    str: stdout from executing command.

◆ start_subprocess()

def scripts.util.system_util.start_subprocess (   name,
  cmd 
)
Synchronously runs a named command.

Args:
    name (str): Process name.
    cmd (str): Command to execute.

Returns:
    int: Return code of execution.

Variable Documentation

◆ facebook360_dep_root

scripts.util.system_util.facebook360_dep_root = str(Path(os.path.abspath(__file__)).parents[2])

◆ image_type_paths

def scripts.util.system_util.image_type_paths = _set_image_type_paths()