From: Oleg Broytman Date: Mon, 25 Jul 2016 16:05:26 +0000 (+0300) Subject: Replace <> with != for Py3 compatibility X-Git-Tag: 3.0.0b1~9 X-Git-Url: https://git.phdru.name/?p=m_lib.git;a=commitdiff_plain;h=87ed070d1b1776366d3ddd15eef1f37a45c585ea Replace <> with != for Py3 compatibility --- diff --git a/m_lib/clock/mkclock.py b/m_lib/clock/mkclock.py index db69be6..b2dfaad 100755 --- a/m_lib/clock/mkclock.py +++ b/m_lib/clock/mkclock.py @@ -10,7 +10,7 @@ sys.stdout.flush() time.sleep(3) print('\n' + " "*len("Testing...") + '\n', end=' ') -need_clock = time.clock() <> 3 +need_clock = time.clock() != 3 outfile = open("clock.py", 'w') diff --git a/m_lib/flad/flad.py b/m_lib/flad/flad.py index 830fdfd..b2e91c8 100644 --- a/m_lib/flad/flad.py +++ b/m_lib/flad/flad.py @@ -216,7 +216,7 @@ class Flad(UserList): flush_record = 0 # Do not close record on 1st loop - if self.comment <> '': + if self.comment != '': outfile.write(self.comment) for record in self: diff --git a/m_lib/flad/fladc.py b/m_lib/flad/fladc.py index 3f5c354..6fd2f60 100644 --- a/m_lib/flad/fladc.py +++ b/m_lib/flad/fladc.py @@ -34,7 +34,7 @@ class Flad_Conf(dict): db = self.__make_db() db.load_file(f) - if len(db) <> 1: + if len(db) != 1: raise error, "incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db)) self.data = db[0] @@ -44,7 +44,7 @@ class Flad_Conf(dict): db = self.__make_db() db.load_from_file(f) - if len(db) <> 1: + if len(db) != 1: raise error, "incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db)) self.data = db[0] diff --git a/m_lib/flad/fladw.py b/m_lib/flad/fladw.py index c50d410..0acc34d 100644 --- a/m_lib/flad/fladw.py +++ b/m_lib/flad/fladw.py @@ -33,7 +33,7 @@ class Flad_WIni(flad.Flad): return match.group(1) # Signal to stop filling the record (section) and start a new one if self.first_section: - if string.strip(line) <> '': + if string.strip(line) != '': raise error, "non-empty line before 1st section" elif (string.strip(line) == '') or (string.lstrip(line)[0] == ';') : # Empty line or comment @@ -72,7 +72,7 @@ class Flad_WIni(flad.Flad): self.section = section else: - if self.first_section and (string.strip(line) <> ''): + if self.first_section and (string.strip(line) != ''): raise error, "non-empty line before 1st section" # else: line had been appended to section in __parse_line() diff --git a/m_lib/m_shutil.py b/m_lib/m_shutil.py index c8325d4..7546b0d 100755 --- a/m_lib/m_shutil.py +++ b/m_lib/m_shutil.py @@ -21,7 +21,7 @@ def mkhier(path): # Python implementation of UNIX' mkdir -p /path/to/dir #print(list_dirs) for i in range(0, len(list_dirs)): new_path = string.join(list_dirs[0:i+1], os.sep) - if (new_path <> '') and (not os.path.exists(new_path)): + if (new_path != '') and (not os.path.exists(new_path)): #print("Making", new_path) os.mkdir(new_path) diff --git a/m_lib/net/ftp/ftpscan.py b/m_lib/net/ftp/ftpscan.py index f12ef3e..469e44b 100755 --- a/m_lib/net/ftp/ftpscan.py +++ b/m_lib/net/ftp/ftpscan.py @@ -135,7 +135,7 @@ def ftpscan1(ftp_server, ftp_port=None, login=None, password=None, ftp = ReconnectingFTPWrapperClass(ftp, ftp_server, ftp_port, login, password, ftp_dir, tree) ftp.connect(ftp_server, ftp_port) ftp.login(login, password) - if ftp_dir <> '/': + if ftp_dir != '/': ftp.cwd(ftp_dir) _traverse_ftp(ftp, tree, ftp_dir) @@ -155,7 +155,7 @@ def ftpscanrecursive(ftp_server, ftp_port=None, login=None, password=None, ftp.set_pasv(passive) ftp.connect(ftp_server, ftp_port) ftp.login(login, password) - if ftp_dir <> '/': + if ftp_dir != '/': ftp.cwd(ftp_dir) lines = [] @@ -178,7 +178,7 @@ def ftpscanrecursive(ftp_server, ftp_port=None, login=None, password=None, tree.append((current_dir, files)) if line[:2] == "./": line = line[1:] # remove leading dot - elif line[0] <> '/': + elif line[0] != '/': line = '/' + line current_dir = line[:-1] files = [] diff --git a/m_lib/opdate.py b/m_lib/opdate.py index b28dec6..46b9916 100755 --- a/m_lib/opdate.py +++ b/m_lib/opdate.py @@ -49,7 +49,7 @@ class opdate_error(Exception): # def IsLeapYear(Year): - if ( (Year % 4 == 0) and (Year % 4000 <> 0) and ((Year % 100 <> 0) or (Year % 400 == 0)) ): + if ( (Year % 4 == 0) and (Year % 4000 != 0) and ((Year % 100 != 0) or (Year % 400 == 0)) ): return True return False @@ -165,7 +165,7 @@ def IncDate(Julian, Days, Months, Years): Year = Year + 1 Julian = DMYtoDate(Day, Month, Year) - if Julian <> BadDate: + if Julian != BadDate: Julian = Julian + Days + Day28Delta return Julian @@ -191,7 +191,7 @@ def IncDateTrunc(Julian, Months, Years): Year = Year + 1 Julian = DMYtoDate(Day, Month, Year) - if Julian <> BadDate: + if Julian != BadDate: MaxDay = DaysInMonth(Month, Year) if Day+Day28Delta > MaxDay: Julian = Julian + MaxDay-Day diff --git a/m_lib/pbar/tty_pbar.py b/m_lib/pbar/tty_pbar.py index a263c87..8953f6b 100644 --- a/m_lib/pbar/tty_pbar.py +++ b/m_lib/pbar/tty_pbar.py @@ -65,7 +65,7 @@ class ttyProgressBar: flush = False - if self.lng <> lng: + if self.lng != lng: self.lng = lng self.out.write(ttyProgressBar.back_c*(self.width1+self.width2)) self.out.write(ttyProgressBar.left_c*lng) @@ -73,12 +73,12 @@ class ttyProgressBar: self.percent = -1 # force to redraw percentage; the bug was fixed by William McVey flush = True - elif self.percent <> percent: + elif self.percent != percent: self.out.write(ttyProgressBar.back_c * (self.width2-1)) flush = True - if self.percent <> percent: + if self.percent != percent: self.percent = percent self.out.write(str(percent).rjust(3) + '%') flush = True