hgext/releasenotes.py
branchstable
changeset 49366 288de6f5d724
parent 49306 2e726c934fcd
child 49519 943509a58d29
--- a/hgext/releasenotes.py	Thu Jun 16 15:15:03 2022 +0200
+++ b/hgext/releasenotes.py	Thu Jun 16 15:28:54 2022 +0200
@@ -11,10 +11,8 @@
 process simpler by automating it.
 """
 
-from __future__ import absolute_import
 
 import difflib
-import errno
 import re
 
 from mercurial.i18n import _
@@ -78,7 +76,7 @@
 BULLET_SECTION = _(b'Other Changes')
 
 
-class parsedreleasenotes(object):
+class parsedreleasenotes:
     def __init__(self):
         self.sections = {}
 
@@ -171,14 +169,14 @@
                 self.addnontitleditem(section, paragraphs)
 
 
-class releasenotessections(object):
+class releasenotessections:
     def __init__(self, ui, repo=None):
         if repo:
             sections = util.sortdict(DEFAULT_SECTIONS)
             custom_sections = getcustomadmonitions(repo)
             if custom_sections:
                 sections.update(custom_sections)
-            self._sections = list(pycompat.iteritems(sections))
+            self._sections = list(sections.items())
         else:
             self._sections = list(DEFAULT_SECTIONS)
 
@@ -689,10 +687,7 @@
     try:
         with open(file_, b'rb') as fh:
             notes = parsereleasenotesfile(sections, fh.read())
-    except IOError as e:
-        if e.errno != errno.ENOENT:
-            raise
-
+    except FileNotFoundError:
         notes = parsedreleasenotes()
 
     notes.merge(ui, incoming)