def __init__(self, download_item, bucket): """""" DownloaderCore.__init__(self, download_item, bucket) #Threading stuff self.lock1 = threading.Lock() #lock to write file. self.lock2 = threading.Lock() self.chunks = download_item.chunks[:] if download_item.chunks is not None else [] #shallow copy self.chunks_control = [] self.first_flag = True self.conn_count = 0 self.max_conn = conf.get_max_conn()
def __init__(self, file_name, path_to_save, link, host, bucket, chunks): """""" DownloaderCore.__init__(self, file_name, path_to_save, link, host, bucket) #Threading stuff self.lock1 = threading.Lock() #lock to write file. self.lock2 = threading.Lock() self.lock3 = threading.Lock() self.chunks = chunks[:] if chunks is not None else [] #shallow copy self.chunks_control = [] self.first_flag = True self.conn_count = 0 self.max_conn = conf.get_max_conn()
def __init__( self, file_name, path_fsaved, link, host, bucket, chunks ): # bucket = instancia de algoritmo para limitar la banda. get_source = metodo de plugin_bridge """""" DownloaderCore.__init__(self, file_name, path_fsaved, link, host, bucket) # Threading stuff self.lock1 = threading.Lock() # lock to write file and modify size_complete attibute. self.lock2 = threading.Lock() # resume stuff # NO HACER self.dict_position = dict_position porq tendrian la mismas referencias (si uno cambia el otro tmb) # self.dict_chunks = dict_chunks.copy() #{conn_num: [int_start, int_end], } dict.copy() shallow copy es seguro solo para objetos inmutables (string, int) no listas, referencias a clases, etc. # self.dict_chunks = copy.deepcopy(dict_chunks) try: self.chunks = chunks[:] # shallow copy except TypeError: self.chunks = []
def __init__( self, file_name, path_fsaved, link, host, bucket, chunks ): #bucket = instancia de algoritmo para limitar la banda. get_source = metodo de plugin_bridge """""" DownloaderCore.__init__(self, file_name, path_fsaved, link, host, bucket) #Threading stuff self.lock1 = threading.Lock( ) #lock to write file and modify size_complete attibute. self.lock2 = threading.Lock() #resume stuff #NO HACER self.dict_position = dict_position porq tendrian la mismas referencias (si uno cambia el otro tmb) #self.dict_chunks = dict_chunks.copy() #{conn_num: [int_start, int_end], } dict.copy() shallow copy es seguro solo para objetos inmutables (string, int) no listas, referencias a clases, etc. #self.dict_chunks = copy.deepcopy(dict_chunks) try: self.chunks = chunks[:] #shallow copy except TypeError: self.chunks = []
def __init__(self, file_name, path_fsaved, link, host, bucket): #bucket = instancia de algoritmo para limitar la banda. get_source = metodo de plugin_bridge """""" DownloaderCore.__init__(self, file_name, path_fsaved, link, host, bucket)
def __init__( self, file_name, path_fsaved, link, host, bucket ): #bucket = instancia de algoritmo para limitar la banda. get_source = metodo de plugin_bridge """""" DownloaderCore.__init__(self, file_name, path_fsaved, link, host, bucket)