From a6b9496549877b3f411db1c6f9c6a6cabca7e908 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 12 Dec 2024 11:08:48 -0800 Subject: [PATCH] Drop Python 2 support --- rnapolii/modeling/.template.deposition.ipynb | 6 ++---- rnapolii/modeling/deposition-colab.ipynb | 6 ++---- rnapolii/modeling/deposition.ipynb | 6 ++---- rnapolii/modeling/deposition.py | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/rnapolii/modeling/.template.deposition.ipynb b/rnapolii/modeling/.template.deposition.ipynb index 4760f8f..07e1f5b 100644 --- a/rnapolii/modeling/.template.deposition.ipynb +++ b/rnapolii/modeling/.template.deposition.ipynb @@ -1095,11 +1095,9 @@ "outputs": [], "source": [ "try:\n", - " import urllib.request as urllib2 # python3\n", - "except ImportError:\n", - " import urllib2 # python2\n", + "import urllib.request\n", "\n", - "fh = urllib2.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", + "fh = urllib.request.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", "s, = ihm.reader.read(fh)\n", "print(s.title, s.restraints, s.ensembles, s.state_groups)" ] diff --git a/rnapolii/modeling/deposition-colab.ipynb b/rnapolii/modeling/deposition-colab.ipynb index 3f0583c..9517281 100644 --- a/rnapolii/modeling/deposition-colab.ipynb +++ b/rnapolii/modeling/deposition-colab.ipynb @@ -1088,11 +1088,9 @@ "outputs": [], "source": [ "try:\n", - " import urllib.request as urllib2 # python3\n", - "except ImportError:\n", - " import urllib2 # python2\n", + "import urllib.request\n", "\n", - "fh = urllib2.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", + "fh = urllib.request.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", "s, = ihm.reader.read(fh)\n", "print(s.title, s.restraints, s.ensembles, s.state_groups)" ] diff --git a/rnapolii/modeling/deposition.ipynb b/rnapolii/modeling/deposition.ipynb index 6b65ee1..2b5d389 100644 --- a/rnapolii/modeling/deposition.ipynb +++ b/rnapolii/modeling/deposition.ipynb @@ -1060,11 +1060,9 @@ "outputs": [], "source": [ "try:\n", - " import urllib.request as urllib2 # python3\n", - "except ImportError:\n", - " import urllib2 # python2\n", + "import urllib.request\n", "\n", - "fh = urllib2.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", + "fh = urllib.request.urlopen('https://pdb-ihm.org/cif/8zze.cif')\n", "s, = ihm.reader.read(fh)\n", "print(s.title, s.restraints, s.ensembles, s.state_groups)" ] diff --git a/rnapolii/modeling/deposition.py b/rnapolii/modeling/deposition.py index a01ddd8..5c3e408 100755 --- a/rnapolii/modeling/deposition.py +++ b/rnapolii/modeling/deposition.py @@ -340,10 +340,8 @@ print(s.title, s.restraints, s.ensembles, s.state_groups) try: - import urllib.request as urllib2 # python3 -except ImportError: - import urllib2 # python2 +import urllib.request -fh = urllib2.urlopen('https://pdb-ihm.org/cif/8zze.cif') +fh = urllib.request.urlopen('https://pdb-ihm.org/cif/8zze.cif') s, = ihm.reader.read(fh) print(s.title, s.restraints, s.ensembles, s.state_groups)