]> git.phdru.name Git - m_lib.git/commitdiff
Replace <> with != for Py3 compatibility
authorOleg Broytman <phd@phdru.name>
Mon, 25 Jul 2016 16:05:26 +0000 (19:05 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 25 Jul 2016 16:10:56 +0000 (19:10 +0300)
m_lib/clock/mkclock.py
m_lib/flad/flad.py
m_lib/flad/fladc.py
m_lib/flad/fladw.py
m_lib/m_shutil.py
m_lib/net/ftp/ftpscan.py
m_lib/opdate.py
m_lib/pbar/tty_pbar.py

index db69be6cb433346644a268df024d4a72d275a585..b2dfaad384eaccf46e05d56b0d4f688afe25a7ec 100755 (executable)
@@ -10,7 +10,7 @@ sys.stdout.flush()
 time.sleep(3)
 print('\n' + " "*len("Testing...") + '\n', end=' ')
 
 time.sleep(3)
 print('\n' + " "*len("Testing...") + '\n', end=' ')
 
-need_clock = time.clock() <> 3
+need_clock = time.clock() != 3
 
 outfile = open("clock.py", 'w')
 
 
 outfile = open("clock.py", 'w')
 
index 830fdfd07beae6c9b38cdafa8f2be20bcb453cca..b2e91c87e96d9f7006cc0f6cb0669d3daf75bede 100644 (file)
@@ -216,7 +216,7 @@ class Flad(UserList):
 
       flush_record = 0 # Do not close record on 1st loop
 
 
       flush_record = 0 # Do not close record on 1st loop
 
-      if self.comment <> '':
+      if self.comment != '':
          outfile.write(self.comment)
 
       for record in self:
          outfile.write(self.comment)
 
       for record in self:
index 3f5c3541f17c758f0f3958546c905e89acd804f7..6fd2f607cf19ebbe619b57764640887bee135406 100644 (file)
@@ -34,7 +34,7 @@ class Flad_Conf(dict):
       db = self.__make_db()
       db.load_file(f)
 
       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]
          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)
 
       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]
          raise error, "incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db))
 
       self.data = db[0]
index c50d410367e825660e4185e97b96031af7002a10..0acc34de0c7530697841b442dd08e6d37d96ee12 100644 (file)
@@ -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:
          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
             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:
                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()
 
                raise error, "non-empty line before 1st section"
             # else: line had been appended to section in __parse_line()
 
index c8325d43d9aada440301bf0b702aeece1ee805b7..7546b0d3c17cf61cae3e185ce45743c1366b6e2c 100755 (executable)
@@ -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)
    #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)
 
          #print("Making", new_path)
          os.mkdir(new_path)
 
index f12ef3e1af1e170ecc22e84ce9347aa9278a5ba4..469e44be58882796908c8546927cb156da6c1596 100755 (executable)
@@ -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)
       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)
       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)
       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 = []
       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
             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 = []
                line = '/' + line
             current_dir = line[:-1]
             files = []
index b28dec67df4fe2e6a33a4baa493f6f6b80db1fd4..46b9916b401556e5d2e1bec5c7a2b8128c4036d0 100755 (executable)
@@ -49,7 +49,7 @@ class opdate_error(Exception):
 #
 
 def IsLeapYear(Year):
 #
 
 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
 
       return True
    return False
 
@@ -165,7 +165,7 @@ def IncDate(Julian, Days, Months, Years):
       Year = Year + 1
 
    Julian = DMYtoDate(Day, Month, Year)
       Year = Year + 1
 
    Julian = DMYtoDate(Day, Month, Year)
-   if Julian <> BadDate:
+   if Julian != BadDate:
       Julian = Julian + Days + Day28Delta
 
    return Julian
       Julian = Julian + Days + Day28Delta
 
    return Julian
@@ -191,7 +191,7 @@ def IncDateTrunc(Julian, Months, Years):
       Year = Year + 1
 
    Julian = DMYtoDate(Day, Month, Year)
       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
       MaxDay = DaysInMonth(Month, Year)
       if Day+Day28Delta > MaxDay:
          Julian = Julian + MaxDay-Day
index a263c877fb7f3b1fd43600576dba4f8683c54d4e..8953f6bf644d6413b4850c75fa925b4fcddca187 100644 (file)
@@ -65,7 +65,7 @@ class ttyProgressBar:
 
       flush = False
 
 
       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)
          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
 
          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
 
 
          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
          self.percent =  percent
          self.out.write(str(percent).rjust(3) + '%')
          flush = True