#72 Use print with Python 3 syntax
Merged 6 years ago by frantisekz. Opened 6 years ago by frantisekz.
fedora-qa/ frantisekz/blockerbugs modern_print  into  develop

file modified
+18 -18
@@ -40,19 +40,19 @@ 

      current_rev = context.get_current_revision()

  

      if current_rev:

-         print "Database already initialized and at rev %s - not re-initializing" % current_rev

+         print("Database already initialized and at rev %s - not re-initializing" % current_rev)

      else:

-         print "Initializing Database"

+         print("Initializing Database")

          db.drop_all()

          db.create_all()

  

-         print "Initializing alembic version"

+         print("Initializing alembic version")

  

          al_command.stamp(alembic_cfg, "head")

  

  

  def upgrade_db():

-     print "Upgrading Database to Latest Revision"

+     print("Upgrading Database to Latest Revision")

      alembic_cfg = get_alembic_config()

      al_command.upgrade(alembic_cfg, "head")

  
@@ -60,9 +60,9 @@ 

  def add_release(number):

      existing_release = Release.query.filter_by(number=number).count()

      if existing_release > 0:

-         print "Release %s already exists, not adding" % number

+         print("Release %s already exists, not adding" % number)

      else:

-         print "Adding release %s" % number

+         print("Adding release %s" % number)

          release_num = int(number)

          new_release = Release(release_num)

          db.session.add(new_release)
@@ -76,9 +76,9 @@ 

  

      current_milestones = Milestone.query.filter_by(active=True).count()

      if existing_milestone > 0:

-         print "Milestone already exists, not adding: %s-%s (%s, %s)" % (number, version, blocker, fe)

+         print("Milestone already exists, not adding: %s-%s (%s, %s)" % (number, version, blocker, fe))

      else:

-         print "Adding milestone: %s-%s (%s, %s)" % (number, version, blocker, fe)

+         print("Adding milestone: %s-%s (%s, %s)" % (number, version, blocker, fe))

          release_num = int(number)

          release = Release.query.filter_by(number=release_num).first()

          if not release:
@@ -103,7 +103,7 @@ 

  def generate_config(dburi=None):

      config_filename = os.path.abspath('conf/settings.py')

      if os.path.exists(config_filename):

-         print "configuration file %s already exists, exiting" % config_filename

+         print("configuration file %s already exists, exiting" % config_filename)

          sys.exit(0)

  

      secret_key = os.urandom(24).encode('string_escape')
@@ -134,14 +134,14 @@ 

              if not new_bug:

                  missing_bugs.append(bugid)

  

-         print "========================================"

-         print "Fedora %d %s Missing Blocker Bugs" % (milestone.release.number, milestone.version)

-         print "========================================"

+         print("========================================")

+         print("Fedora %d %s Missing Blocker Bugs" % (milestone.release.number, milestone.version))

+         print("========================================")

          if len(missing_bugs) > 0:

              for bug in missing_bugs:

-                 print "  * %d" % bug

+                 print("  * %d" % bug)

          else:

-             print "  No missing bugs found"

+             print("  No missing bugs found")

  

  

  def sync_bugs(fullsync=False, docheck=False):
@@ -158,7 +158,7 @@ 

      sync.update_active(full_sync=fullsync)

  

      if docheck:

-         print "Checking bug sync status"

+         print("Checking bug sync status")

          check_blockers(bzurl)

  

  
@@ -196,13 +196,13 @@ 

      (options, args) = parser.parse_args()

  

      if len(args) < 1:

-         print "need to have at least 1 command"

+         print("need to have at least 1 command")

          sys.exit(1)

  

      command = args[0]

      if not command in possible_commands:

-         print 'Invalid command: %s' % command

-         print 'Please use one of the following commands: %s' % str(possible_commands)

+         print("Invalid command: %s" % command)

+         print("Please use one of the following commands: %s" % str(possible_commands))

          sys.exit(1)

  

      if command == 'sync':

file modified
+1 -1
@@ -86,7 +86,7 @@ 

                  db.session.delete(oldbug)

              db.session.commit()

          else:

-             print "no old bug found to delete!"

+             print("no old bug found to delete!")

  

  

      # test that a bug which is no longer blocking a tracker but not marked as

Use print("") instead of print ""

This is compatible with both Python 2 and Python 3, no need to use the old syntax.

many ACK much OK such LGTM so patch very changes

(also, please rebase before merging)

rebased onto 1ca0e47

6 years ago

Pull-Request has been merged by frantisekz

6 years ago