From 146f258e54c27b2c6d30c2d4b586b40e71abc2b1 Mon Sep 17 00:00:00 2001 From: Dan Puttick Date: Wed, 30 Nov 2016 21:04:59 -0500 Subject: [PATCH] Refactored mimetype code into its own method --- kittengroomer/helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kittengroomer/helpers.py b/kittengroomer/helpers.py index 3a20a74..0461d0e 100644 --- a/kittengroomer/helpers.py +++ b/kittengroomer/helpers.py @@ -2,12 +2,13 @@ # -*- coding: utf-8 -*- import os import sys -import magic import hashlib import shutil -from twiggy import quick_setup, log import argparse +import magic +from twiggy import quick_setup, log + class KittenGroomerError(Exception): def __init__(self, message): @@ -37,7 +38,9 @@ class FileBase(object): self.log_details = {'filepath': self.src_path} self.log_string = '' a, self.extension = os.path.splitext(self.src_path) + self._get_mimetype() + def _get_mimetype(self): if os.path.islink(self.src_path): # magic will throw an IOError on a broken symlink self.mimetype = 'inode/symlink'