本文整理汇总了Python中utils.utils.Utils.remove_dir_content方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.remove_dir_content方法的具体用法?Python Utils.remove_dir_content怎么用?Python Utils.remove_dir_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.utils.Utils
的用法示例。
在下文中一共展示了Utils.remove_dir_content方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from utils.utils import Utils [as 别名]
# 或者: from utils.utils.Utils import remove_dir_content [as 别名]
def __init__(self, config, phishtank, openphish, cleanmx):
logging.debug("Instantiating the '%s' class" % (self.__class__.__name__))
self._cfg = config
self._phishtank = phishtank
self._openphish = openphish
self._cleanmx = cleanmx
Utils.remove_dir_content(self._cfg['dir_out'])
示例2: save_ph_ws
# 需要导入模块: from utils.utils import Utils [as 别名]
# 或者: from utils.utils.Utils import remove_dir_content [as 别名]
def save_ph_ws(ph_ws):
logging.debug("XMLAdapter is storing phishing websites...")
Utils.remove_dir_content(XMLAdapter.config['dir_out'])
for cm_name, cm in ph_ws.items():
if len(cm) > 0:
try:
file_ph_ws_name = os.path.join(XMLAdapter.config['dir_out'], cm_name + '.xml')
file_ph_ws = open(file_ph_ws_name, 'w')
file_ph_ws.write(dicttoxml.dicttoxml(ph_ws))
file_ph_ws.close()
except OSError, e:
logging.error("Error saving phishing websites in xml format: %s" % (e))
raise OSError
示例3: save_ph_ws
# 需要导入模块: from utils.utils import Utils [as 别名]
# 或者: from utils.utils.Utils import remove_dir_content [as 别名]
def save_ph_ws(ph_ws):
logging.debug("CSVAdapter is storing phishing websites...")
Utils.remove_dir_content(CSVAdapter.config['dir_out'])
for cm_name, cm in ph_ws.items():
if len(cm) > 0:
try:
file_ph_ws_name = os.path.join(CSVAdapter.config['dir_out'], cm_name + '.csv')
file_ph_ws = open(file_ph_ws_name, 'w')
for cm_elems in cm:
cm_elems_string = ''
for cm_elem_key in sorted(cm_elems):
if type(cm_elems[cm_elem_key]) is int:
cm_elems_string += str(cm_elems[cm_elem_key]) + ','
else:
cm_elems_string += cm_elems[cm_elem_key].encode('utf-8') + ','
cm_elems_string = cm_elems_string[:-1]
file_ph_ws.write(cm_elems_string + '\n')
file_ph_ws.close()
except OSError, e:
logging.error("Error saving phishing websites in csv format: %s" % (e))
raise OSError
示例4: run
# 需要导入模块: from utils.utils import Utils [as 别名]
# 或者: from utils.utils.Utils import remove_dir_content [as 别名]
def run(self):
logging.debug("Extracting files...")
Utils.remove_dir_content(self._cfg['dir_out'])
while Utils.compute_file_number(self._cfg['dir_in']) > 1:
self._walk_dir(self._cfg['dir_in'], self._cfg['dir_out'])
Utils.remove_dir_content(self._cfg['dir_in'])