Move Devnull to the utils module.

This commit is contained in:
Simon Conseil
2014-09-27 00:06:38 +02:00
parent 5215451d96
commit 307e2aa0f6
2 changed files with 12 additions and 11 deletions

View File

@@ -42,21 +42,12 @@ from . import image, video, signals
from .compat import UnicodeMixin, strxfrm, url_quote
from .image import process_image, get_exif_tags
from .settings import get_thumb
from .utils import copy, check_or_create_dir, url_from_path, read_markdown
from .utils import (Devnull, copy, check_or_create_dir, url_from_path,
read_markdown)
from .video import process_video
from .writer import Writer
class Devnull(object):
"""'Black hole' for output that should not be printed"""
def write(self, *_):
pass
def flush(self, *_):
pass
class Media(UnicodeMixin):
"""Base Class for media files.

View File

@@ -29,6 +29,16 @@ from subprocess import Popen, PIPE
from . import compat
class Devnull(object):
"""'Black hole' for output that should not be printed"""
def write(self, *_):
pass
def flush(self, *_):
pass
def copy(src, dst, symlink=False):
"""Copy or symlink the file."""
func = os.symlink if symlink else shutil.copy2