<commit_before>#!/usr/bin/python

'''
created on 08/08/2015

@author: <NAME>
'''

import urllib
import os

class ImagesDownload(object):
		
	# relative file path
	def filePath(self, fileName):
		dirPath = os.path.dirname(__file__)						
		relFilePath = os.path.join(dirPath, fileName)
		return dirPath, relFilePath		

	# read file content
	def readFile(self, filePath):
		with open(filePath) as textFile:
		    textFileContent = textFile.readlines()
	    	return textFileContent	

	# download images				
	def downloadImages(self, dirname, urlData):
		for idx, val in enumerate(urlData):
			urllib.urlretrieve(val, dirname+"/"+str(idx)+".jpg")		    

if __name__ == '__main__':

	try:
		images = ImagesDownload()
		dirname, imageBookPath = images.filePath('ImageCollection.txt')
		imageBookData = images.readFile(imageBookPath)
		images.downloadImages(dirname, imageBookData)<commit_msg>create a new directory for downloads<commit_after>#!/usr/bin/python

'''
created on 08/08/2015

@author: <NAME>
'''

import urllib
import os

class ImagesDownload(object):
		
	# relative file path
	def filePath(self, fileName):
		dirPath = os.path.dirname(__file__)						
		relFilePath = os.path.join(dirPath, fileName)
		return dirPath, relFilePath		

	# read file content
	def readFile(self, filePath):
		with open(filePath) as textFile:
		    textFileContent = textFile.readlines()
	    	return textFileContent	

	# download images				
	def downloadImages(self, dirname, urlData):
		if not os.path.exists('pictures'): os.makedirs('pictures')
		dirname = dirname+'/pictures'
		for idx, val in enumerate(urlData):
			urllib.urlretrieve(val, dirname+"/"+str(idx)+".jpg")		    

if __name__ == '__main__':

	try:
		images = ImagesDownload()
		dirname, imageBookPath = images.filePath('ImageCollection.txt')
		imageBookData = images.readFile(imageBookPath)
		images.downloadImages(dirname, imageBookData)
{'fraction_non_alphanumeric': 0.1170550847457627, 'fraction_numerical': 0.00847457627118644, 'mean_word_length': 4.412607449856734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1954539', 'n_tokens_mistral': 689, 'n_tokens_neox': 611, 'n_words': 142}