Skip to content

Commit

Permalink
Remove more Python 2 artifacts (#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay authored Jun 21, 2024
1 parent 66c7832 commit 6a3e5a2
Show file tree
Hide file tree
Showing 26 changed files with 4 additions and 76 deletions.
2 changes: 0 additions & 2 deletions src/rosdep2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
rosdep library and command-line tool
"""

from __future__ import print_function

from ._version import __version__

import sys
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/catkin_packages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os
import sys

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/catkin_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"""

from __future__ import print_function

import os

from subprocess import Popen, PIPE, CalledProcessError
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import sys
import traceback
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
Script for installing rdmanifest-described resources
"""

from __future__ import print_function

import os
import sys
from optparse import OptionParser
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Tully Foote/[email protected], Ken Conley/[email protected]

from __future__ import print_function

import os
import subprocess
import traceback
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Tully Foote/[email protected], Ken Conley/[email protected]

from __future__ import print_function

import sys
import yaml

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
Command-line interface to rosdep library
"""

from __future__ import print_function

import errno
import os
import sys
Expand Down
7 changes: 0 additions & 7 deletions src/rosdep2/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@
except ImportError:
import pickle

try:
FileNotFoundError
except NameError:
# Python 2 compatibility
# https://stackoverflow.com/questions/21367320/
FileNotFoundError = IOError

import rospkg

from ._version import __version__
Expand Down
1 change: 0 additions & 1 deletion src/rosdep2/platforms/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

# Author Tully Foote/[email protected]

from __future__ import print_function
import subprocess
import sys

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/platforms/cygwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Tingfan Wu [email protected]

from __future__ import print_function

from rospkg.os_detect import OS_CYGWIN

from .source import SOURCE_INSTALLER
Expand Down
1 change: 0 additions & 1 deletion src/rosdep2/platforms/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

# Author Tully Foote, Ken Conley

from __future__ import print_function
import subprocess
import sys

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/platforms/gem.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

# Author Ruben Smits/[email protected]

from __future__ import print_function

import subprocess

from ..core import InstallFailed
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/platforms/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import subprocess

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/platforms/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Tully Foote/[email protected]

from __future__ import print_function

import os
import subprocess
import sys
Expand Down
1 change: 0 additions & 1 deletion src/rosdep2/platforms/redhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

# Author Tully Foote/[email protected]

from __future__ import print_function
import subprocess
import sys

Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/platforms/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Tully Foote/[email protected]

from __future__ import print_function

import os
try:
from urllib.request import urlretrieve
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/rospack.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
is a ROSpackage or a system dependency
"""

from __future__ import print_function

import subprocess

from .main import _get_default_RosdepLookup
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/rospkg_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
filesystem.
"""

from __future__ import print_function

import os

import catkin_pkg.package
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/shell_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Tully Foote/[email protected]

from __future__ import print_function

import os
import sys
import stat
Expand Down
2 changes: 0 additions & 2 deletions src/rosdep2/sources_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

# Author Ken Conley/[email protected]

from __future__ import print_function

import os
import sys
import yaml
Expand Down
8 changes: 3 additions & 5 deletions test/test_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function

import os
import subprocess
import sys
Expand All @@ -28,9 +26,9 @@ def test_flake8():
# See: https://flake8.pycqa.org/en/latest/user/python-api.html
# Calling through subprocess is the most stable way to run it.

# We still need to support Python 2.7, so we can't use run()
ret_code = subprocess.call(
result = subprocess.run(
[sys.executable, "-m", "flake8"],
cwd=os.path.dirname(os.path.dirname(__file__)),
check=False,
)
assert 0 == ret_code, "flake8 found violations"
assert 0 == result.returncode, "flake8 found violations"
22 changes: 1 addition & 21 deletions test/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,9 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import sys

try:
from tempfile import TemporaryDirectory
except ImportError:
import tempfile
import shutil

class TemporaryDirectory(object):
"""Python 2 compatible class."""

def __init__(self):
self.name = None

def __enter__(self):
self.name = tempfile.mkdtemp()
return self.name

def __exit__(self, t, v, tb):
shutil.rmtree(self.name)
from tempfile import TemporaryDirectory

from rosdep2.meta import MetaDatabase

Expand Down
2 changes: 0 additions & 2 deletions test/test_rosdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import sys

Expand Down
2 changes: 0 additions & 2 deletions test/test_rosdep_installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

from contextlib import contextmanager
from unittest import SkipTest
from unittest.mock import Mock, patch
Expand Down
2 changes: 0 additions & 2 deletions test/test_rosdep_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import yaml

Expand Down

0 comments on commit 6a3e5a2

Please sign in to comment.