Skip to content

Commit 7ea6371

Browse files
committed
RF: drop python2 support
1 parent 56015df commit 7ea6371

File tree

5 files changed

+5
-16
lines changed

5 files changed

+5
-16
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# vim ft=yaml
22
language: python
33
python:
4-
- 2.7
54
- 3.5
65
- 3.6
76
- 3.7

heudiconv/convert.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ def conversion_info(subject, outdir, info, filegroup, ses):
7272
try:
7373
files = filegroup[item]
7474
except KeyError:
75-
PY3 = sys.version_info[0] >= 3
76-
files = filegroup[(str if PY3 else unicode)(item)]
75+
files = filegroup[str(item)]
7776
outprefix = template.format(**parameters)
7877
convert_info.append((op.join(outpath, outprefix),
7978
outtype, files))

heudiconv/info.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
'Environment :: Console',
1313
'Intended Audience :: Science/Research',
1414
'License :: OSI Approved :: Apache Software License',
15-
'Programming Language :: Python :: 2.7',
1615
'Programming Language :: Python :: 3.5',
1716
'Programming Language :: Python :: 3.6',
1817
'Programming Language :: Python :: 3.7',
1918
'Topic :: Scientific/Engineering'
2019
]
2120

22-
PYTHON_REQUIRES = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*"
21+
PYTHON_REQUIRES = ">=3.5"
2322

2423
REQUIRES = [
2524
'nibabel',

heudiconv/tests/test_main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ def test_main_help(stdout):
3535
assert stdout.getvalue().startswith("usage: ")
3636

3737

38-
@patch('sys.stderr' if sys.version_info[:2] <= (3, 3) else
39-
'sys.stdout', new_callable=StringIO)
38+
@patch('sys.stdout', new_callable=StringIO)
4039
def test_main_version(std):
4140
with pytest.raises(SystemExit):
4241
runner(['--version'])

heudiconv/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
import logging
2020
lgr = logging.getLogger(__name__)
2121

22-
if sys.version_info[0] > 2:
23-
from json.decoder import JSONDecodeError
24-
else:
25-
JSONDecodeError = ValueError
22+
from json.decoder import JSONDecodeError
2623

2724

2825
seqinfo_fields = [
@@ -115,9 +112,7 @@ def anonymize_sid(sid, anon_sid_cmd):
115112
cmd = [anon_sid_cmd, sid]
116113
shell_return = check_output(cmd)
117114

118-
if all([sys.version_info[0] > 2,
119-
isinstance(shell_return, bytes),
120-
isinstance(sid, str)]):
115+
if isinstance(shell_return, bytes) and isinstance(sid, str):
121116
anon_sid = shell_return.decode()
122117
else:
123118
anon_sid = shell_return
@@ -490,8 +485,6 @@ def create_tree(path, tree, archives_leading_dir=True):
490485
create_tree(full_name, load, archives_leading_dir=archives_leading_dir)
491486
else:
492487
with open(full_name, 'w') as f:
493-
if sys.version_info[0] == 2 and not isinstance(load, str):
494-
load = load.encode('utf-8')
495488
f.write(load)
496489
if executable:
497490
os.chmod(full_name, os.stat(full_name).st_mode | stat.S_IEXEC)

0 commit comments

Comments
 (0)