Skip to content

Commit cf1e168

Browse files
committed
Merge tag 'v0.5.3' into debian
[0.5.3] - 2019-01-12 Minor hot bugfix release Fixed - Do not shorten spaces in the dates while pretty printing .json * tag 'v0.5.3': Changelog+version boost for 0.5.3 FIX: issue template fix: actually use template for issues maint: outline issue reporting, ignore certain files when docker building BF: avoid changing spacing in the dates strings while tuning pretty printed json Show must go on
2 parents f6ce229 + d3ddacb commit cf1e168

File tree

6 files changed

+46
-3
lines changed

6 files changed

+46
-3
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dockerfile
2+
.git/

.github/ISSUE_TEMPLATE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Summary
2+
<!-- If you are having conversion troubles, please share as much
3+
relevant information as possible. This includes, but is not limited to:
4+
- log of conversion
5+
- heuristic
6+
-->
7+
8+
9+
10+
### Platform details:
11+
12+
Choose one:
13+
- [ ] Local environment
14+
<!-- If selected, please provide OS and python version -->
15+
- [ ] Container
16+
<!-- If selected, please provide container name and tag"-->
17+
18+
- Heudiconv version:
19+
<!-- Command: heudiconv --version -->

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented (for humans) in this file
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.5.3] - 2019-01-12
8+
9+
Minor hot bugfix release
10+
11+
### Fixed
12+
- Do not shorten spaces in the dates while pretty printing .json
13+
714
## [0.5.2] - 2019-01-04
815

916
A variety of bugfixes

heudiconv/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.5.2"
1+
__version__ = "0.5.3"
22
__author__ = "HeuDiConv team and contributors"
33
__url__ = "https://github.com/nipy/heudiconv"
44
__packagename__ = 'heudiconv'

heudiconv/tests/test_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ def test_json_dumps_pretty():
5252
== '{\n "a": -1,\n "b": "123",\n "c": [1, 2, 3],\n "d": ["1.0", "2.0"]\n}'
5353
assert pretty({'a': ["0.3", "-1.9128906358217845e-12", "0.2"]}) \
5454
== '{\n "a": ["0.3", "-1.9128906358217845e-12", "0.2"]\n}'
55+
# original, longer string
56+
tstr = 'f9a7d4be-a7d7-47d2-9de0-b21e9cd10755||' \
57+
'Sequence: ve11b/master r/50434d5; ' \
58+
'Mar 3 2017 10:46:13 by eja'
59+
# just the date which reveals the issue
60+
# tstr = 'Mar 3 2017 10:46:13 by eja'
61+
assert pretty({'WipMemBlock': tstr}) == '{\n "WipMemBlock": "%s"\n}' % tstr

heudiconv/utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,16 @@ def json_dumps_pretty(j, indent=2, sort_keys=True):
217217
# uniform no spaces before ]
218218
js_ = re.sub(" *\]", "]", js_)
219219
# uniform spacing before numbers
220-
js_ = re.sub(' *("?[-+.0-9e]+"?)(?P<space> ?)[ \n]*',
221-
r' \1\g<space>', js_)
220+
# But that thing could screw up dates within strings which would have 2 spaces
221+
# in a date like Mar 3 2017, so we do negative lookahead to avoid changing
222+
# in those cases
223+
#import pdb; pdb.set_trace()
224+
js_ = re.sub(
225+
'(?<!\w{3})' # negative lookbehind for the month
226+
' *("?[-+.0-9e]+"?)'
227+
'(?! [123]\d{3})' # negative lookahead for a year
228+
'(?P<space> ?)[ \n]*',
229+
r' \1\g<space>', js_)
222230
# no spaces after [
223231
js_ = re.sub('\[ ', '[', js_)
224232
# the load from the original dump and reload from tuned up

0 commit comments

Comments
 (0)