Skip to content

Commit

Permalink
Remove some old Python 2 code (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua authored Jul 30, 2024
1 parent 542ae9b commit ea348fe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 19 deletions.
14 changes: 2 additions & 12 deletions breathe/apidoc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
breathe.apidoc
~~~~~~~~~~~~~~
Expand All @@ -14,7 +13,6 @@
:copyright: Originally by Sphinx Team, C++ modifications by Tatsuyuki Ishi
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function

import os
import sys
Expand All @@ -24,14 +22,6 @@

from breathe import __version__

# Account for FileNotFoundError in Python 2
# IOError is broader but will hopefully suffice
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError


# Reference: Doxygen XSD schema file, CompoundKind only
# Only what breathe supports are included
# Translates identifier to English
Expand Down Expand Up @@ -71,7 +61,7 @@ def write_file(name, text, args):
if exc.errno != errno.EEXIST:
raise
try:
with open(fname, "r") as target:
with open(fname) as target:
orig = target.read()
if orig == text:
print_info("File %s up to date, skipping." % fname, args)
Expand Down Expand Up @@ -141,7 +131,7 @@ def recurse_tree(args):

class TypeAction(argparse.Action):
def __init__(self, option_strings, dest, **kwargs):
super(TypeAction, self).__init__(option_strings, dest, **kwargs)
super().__init__(option_strings, dest, **kwargs)
self.default = TYPEDICT.keys()
self.metavar = ",".join(TYPEDICT.keys())

Expand Down
4 changes: 2 additions & 2 deletions breathe/parser/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def __init__(self, char=None, valueOf_=''):
# end class docCharTypeSub


class verbatimTypeSub(object):
class verbatimTypeSub:
"""
New node type. Structure is largely pillaged from other nodes in order to
match the set.
Expand Down Expand Up @@ -1200,7 +1200,7 @@ def parse(inFilename):

try:
doc = minidom.parse(inFilename)
except IOError as e:
except OSError as e:
raise FileIOError(e)
except ExpatError as e:
raise ParseError(e)
Expand Down
4 changes: 2 additions & 2 deletions breathe/parser/compoundsuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def getName(self):
return self.name


class _MemberSpec(object):
class _MemberSpec:
def __init__(self, name='', data_type='', container=0):
self.name = name
self.data_type = data_type
Expand Down Expand Up @@ -2632,7 +2632,7 @@ def buildChildren(self, child_, nodeName_):
value_.append(text_.nodeValue)
# We make this unicode so that our unicode renderer catch-all picks it up
# otherwise it would go through as 'str' and we'd have to pick it up too
valuestr_ = u' '
valuestr_ = ' '
obj_ = self.mixedclass_(MixedContainer.CategorySimple,
MixedContainer.TypeString, 'sp', valuestr_)
self.content_.append(obj_)
Expand Down
2 changes: 1 addition & 1 deletion breathe/parser/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FileIOError(Exception):
def parse(inFilename):
try:
doc = minidom.parse(inFilename)
except IOError as e:
except OSError as e:
raise FileIOError(e)
except ExpatError as e:
raise ParseError(e)
Expand Down
2 changes: 1 addition & 1 deletion breathe/parser/indexsuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def getName(self):
return self.name


class _MemberSpec(object):
class _MemberSpec:
def __init__(self, name='', data_type='', container=0):
self.name = name
self.data_type = data_type
Expand Down
1 change: 0 additions & 1 deletion tests/warnings/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Test Breathe Warnings documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 5 18:57:21 2014.
Expand Down

0 comments on commit ea348fe

Please sign in to comment.