From 9fc2068b27197353ed6b3c47d6d022aac699eea0 Mon Sep 17 00:00:00 2001 From: Henrique Pereira Date: Wed, 30 Apr 2014 10:52:21 -0300 Subject: [PATCH 1/2] Removed function wrappers No need to write wrappers if you can import them with custom names --- youtube_dl_gui/Utils.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index 6b12cc6..f2aca58 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -5,6 +5,12 @@ import sys import locale import subprocess +import os.remove as remove_file +import os.path.exists as file_exist +import os.path.getsize as get_file_size +import os.makedirs as make_dir + + def remove_empty_items(array): return [x for x in array if x != ''] @@ -39,9 +45,6 @@ def video_is_dash(video): def have_dash_audio(audio): return audio != "NO SOUND" -def remove_file(filename): - os.remove(filename) - def get_path_seperator(): return '\\' if os.name == 'nt' else '/' @@ -65,18 +68,12 @@ def abs_path(filename): path.pop() return get_path_seperator().join(path) -def file_exist(filename): - return os.path.exists(filename) - def get_os_type(): return os.name def get_filesize(path): return os.path.getsize(path) -def makedir(path): - os.makedirs(path) - def get_filename(path): return path.split(get_path_seperator())[-1] From bb3da2c0be700af04474428b7dbef89203f5e1e5 Mon Sep 17 00:00:00 2001 From: Henrique Pereira Date: Wed, 30 Apr 2014 13:55:05 -0300 Subject: [PATCH 2/2] Updated utils.py Correct names now inplace --- youtube_dl_gui/Utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index f2aca58..4435766 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -7,8 +7,8 @@ import subprocess import os.remove as remove_file import os.path.exists as file_exist -import os.path.getsize as get_file_size -import os.makedirs as make_dir +import os.path.getsize as get_filesize +import os.makedirs as makedir def remove_empty_items(array): @@ -71,8 +71,6 @@ def abs_path(filename): def get_os_type(): return os.name -def get_filesize(path): - return os.path.getsize(path) def get_filename(path): return path.split(get_path_seperator())[-1]