[entropy*] fix improper usage of == '' and == ""

This commit is contained in:
Fabio Erculiani
2009-10-06 19:45:26 +02:00
parent 2faa745af0
commit e231d4a510
6 changed files with 13 additions and 10 deletions
+3 -3
View File
@@ -2644,7 +2644,7 @@ class EntropyRepository:
"""
def mymf(source):
if (not source) or (source == "") or \
if (not source) or \
(not self.entropyTools.is_valid_string(source)):
return 0
@@ -8672,12 +8672,12 @@ class EntropyRepository:
if (not justname) and \
((direction == "~") or (direction == "=") or \
(direction == '' and not justname) or (direction == '' and \
((not direction) and (not justname)) or ((not direction) and \
not justname and strippedAtom.endswith("*"))):
# any revision within the version specified
# OR the specified version
if (direction == '' and not justname):
if ((not direction) and (not justname)):
direction = "="
# remove gentoo revision (-r0 if none)
+1 -1
View File
@@ -185,7 +185,7 @@ def xtermTitleReset():
global default_xterm_title
if default_xterm_title is None:
prompt_command = os.getenv('PROMPT_COMMAND')
if prompt_command == "":
if not prompt_command:
default_xterm_title = ""
elif prompt_command is not None:
from entropy.tools import getstatusoutput
+1 -1
View File
@@ -433,7 +433,7 @@ class SocketHost:
data += self.request.recv(1024)
if self.__data_counter is None:
if data == '': # client wants to close
if not data: # client wants to close
return True
elif data == self.server.processor.HostInterface.answers['noop']:
return False
+1 -1
View File
@@ -2005,7 +2005,7 @@ class Client:
data = do_receive()
if self.buffer_length == None:
self.buffered_data = ''
if (data == '') or (data == self.answers['cl']):
if (not data) or (data == self.answers['cl']):
# nein! no support, KAPUTT!
# RAUSS!
if not self.quiet:
+3 -3
View File
@@ -2965,7 +2965,7 @@ def extract_ftp_data(ftpuri):
@rtype:
"""
ftpuser = ftpuri.split("ftp://")[-1].split(":")[0]
if (ftpuser == ""):
if (not ftpuser):
ftpuser = "anonymous@"
ftppassword = "anonymous"
else:
@@ -2973,12 +2973,12 @@ def extract_ftp_data(ftpuri):
if len(ftppassword) > 1:
ftppassword = '@'.join(ftppassword)
ftppassword = ftppassword.split(":")[-1]
if (ftppassword == ""):
if (not ftppassword):
ftppassword = "anonymous"
else:
ftppassword = ftppassword[0]
ftppassword = ftppassword.split(":")[-1]
if (ftppassword == ""):
if (not ftppassword):
ftppassword = "anonymous"
ftpport = ftpuri.split(":")[-1]
+4 -1
View File
@@ -258,7 +258,8 @@ class UrlFetcher:
while True:
try:
rsx = self.__remotefile.read(self.__buffersize)
if rsx == '': break
if not rsx:
break
if self.__abort_check_func != None:
self.__abort_check_func()
if self.__thread_stop_func != None:
@@ -498,8 +499,10 @@ class MultipleUrlFetcher:
t = ParallelTask(do_download, self.__download_statuses, th_id, downloader)
self.__thread_pool[th_id] = t
t.start()
self.show_download_files_info()
self.__show_progress = True
while len(self.__url_path_list) != len(self.__download_statuses):
try:
time.sleep(0.5)