7c0c307a2a8fbdb9b0eb82c275ca8c977aae90f3,decensor.py,Decensor,decensor_all_images_in_folder,#Decensor#,42
Before Change
ori_img = Image.open(ori_file_path)
self.decensor_image(ori_img, colored_img, file_name)
continue
if not found_valid:
print("Corresponding original, uncolored image not found in {ori_file_path}. \nCheck if it exists and is in the PNG or JPG format.".format(ori_file_path = ori_file_path))
else:
self.decensor_image(colored_img, colored_img, file_name)
print("--------------------------------------------------------------------------")
After Change
ori_dir = self.args.decensor_input_original_path
//since the original image might not be a png, test multiple file formats
valid_formats = {".png", ".jpg", ".jpeg"}
for test_file_name in os.listdir(ori_dir):
test_bn, test_ext = os.path.splitext(test_file_name)
if (test_bn == color_bn) and (test_ext.casefold() in valid_formats):
ori_file_path = os.path.join(ori_dir, test_file_name)
found_valid = True
ori_img = Image.open(ori_file_path)
self.decensor_image(ori_img, colored_img, file_name)
break
else: //for...else, i.e if the loop finished without encountering break
print("Corresponding original, uncolored image not found in {}.".format(ori_file_path))
print("Check if it exists and is in the PNG or JPG format.")
else:
self.decensor_image(colored_img, colored_img, file_name)
print("--------------------------------------------------------------------------")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: deeppomf/DeepCreamPy
Commit Name: 7c0c307a2a8fbdb9b0eb82c275ca8c977aae90f3
Time: 2018-10-30
Author: harjit@harjit.moe
File Name: decensor.py
Class Name: Decensor
Method Name: decensor_all_images_in_folder
Project Name: nilmtk/nilmtk
Commit Name: 03d22bbb0177117498b3021e068611c6b9421e15
Time: 2014-07-21
Author: oliparson@gmail.com
File Name: nilmtk/dataset_converters/wikienergy/download_wikienergy.py
Class Name:
Method Name: download_wikienergy
Project Name: ricsinaruto/Seq2seqChatbots
Commit Name: 984837dda09876a4e08cb672ccc6163dc09298ce
Time: 2019-05-28
Author: ricsinaruto@hotmail.com
File Name: t2t_csaky/scripts/hred_metrics.py
Class Name:
Method Name: main