Skip to content

Commit 4b0fd53

Browse files
committed
Merge branch 'release/5.0.0'
2 parents 12bb59d + 13e7d27 commit 4b0fd53

File tree

11 files changed

+7
-282
lines changed

11 files changed

+7
-282
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
max-parallel: 4
1919
matrix:
20-
python-version: [3.6, 3.7]
20+
python-version: [3.7, 3.8, 3.9, '3.10']
2121

2222
steps:
2323
- uses: actions/checkout@v1

doc/source/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog
33
#########
44

5+
Version 5.0.0 (2022-12-15)
6+
~~~~~~~~~~~~~~~~~~~~~~~~~~
7+
8+
- BREAKING: remove support for JSON serialization
9+
510
Version 4.5 (2022-08-24)
611
~~~~~~~~~~~~~~~~~~~~~~~~
712

doc/source/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ User guide
3535

3636
structure
3737
visualization
38-
serialization
3938

4039

4140
API documentation

doc/source/reference.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ SlidingWindowFeature
5151
:members:
5252
:special-members:
5353

54-
*************
55-
Serialization
56-
*************
57-
58-
.. automodule:: pyannote.core.json
59-
:members:
60-
6154
*************
6255
Visualization
6356
*************

doc/source/serialization.rst

Lines changed: 0 additions & 27 deletions
This file was deleted.

pyannote/core/annotation.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,10 @@
128128
from sortedcontainers import SortedDict
129129

130130
from . import (
131-
PYANNOTE_URI,
132-
PYANNOTE_MODALITY,
133131
PYANNOTE_SEGMENT,
134132
PYANNOTE_TRACK,
135133
PYANNOTE_LABEL,
136134
)
137-
from .json import PYANNOTE_JSON, PYANNOTE_JSON_CONTENT
138135
from .segment import Segment, SlidingWindow
139136
from .timeline import Timeline
140137
from .feature import SlidingWindowFeature
@@ -1499,47 +1496,6 @@ def discretize(
14991496

15001497
return SlidingWindowFeature(data, resolution, labels=labels)
15011498

1502-
def for_json(self) -> Dict:
1503-
"""Serialization
1504-
1505-
See also
1506-
--------
1507-
:mod:`pyannote.core.json`
1508-
"""
1509-
1510-
data = {PYANNOTE_JSON: self.__class__.__name__}
1511-
content = [
1512-
{PYANNOTE_SEGMENT: s.for_json(), PYANNOTE_TRACK: t, PYANNOTE_LABEL: l}
1513-
for s, t, l in self.itertracks(yield_label=True)
1514-
]
1515-
data[PYANNOTE_JSON_CONTENT] = content
1516-
1517-
if self.uri:
1518-
data[PYANNOTE_URI] = self.uri
1519-
1520-
if self.modality:
1521-
data[PYANNOTE_MODALITY] = self.modality
1522-
1523-
return data
1524-
1525-
@classmethod
1526-
def from_json(cls, data: Dict) -> "Annotation":
1527-
"""Deserialization
1528-
1529-
See also
1530-
--------
1531-
:mod:`pyannote.core.json`
1532-
"""
1533-
uri = data.get(PYANNOTE_URI, None)
1534-
modality = data.get(PYANNOTE_MODALITY, None)
1535-
records = []
1536-
for record_dict in data[PYANNOTE_JSON_CONTENT]:
1537-
segment = Segment.from_json(record_dict[PYANNOTE_SEGMENT])
1538-
track = record_dict[PYANNOTE_TRACK]
1539-
label = record_dict[PYANNOTE_LABEL]
1540-
records.append((segment, track, label))
1541-
return Annotation.from_records(records, uri, modality)
1542-
15431499
@classmethod
15441500
def from_records(
15451501
cls,

pyannote/core/json.py

Lines changed: 0 additions & 142 deletions
This file was deleted.

pyannote/core/segment.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -368,25 +368,6 @@ def __repr__(self):
368368
"""
369369
return '<Segment(%g, %g)>' % (self.start, self.end)
370370

371-
def for_json(self):
372-
"""Serialization
373-
374-
See also
375-
--------
376-
:mod:`pyannote.core.json`
377-
"""
378-
return {'start': self.start, 'end': self.end}
379-
380-
@classmethod
381-
def from_json(cls, data):
382-
"""Deserialization
383-
384-
See also
385-
--------
386-
:mod:`pyannote.core.json`
387-
"""
388-
return cls(start=data['start'], end=data['end'])
389-
390371
def _repr_png_(self):
391372
"""IPython notebook support
392373

pyannote/core/timeline.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494

9595
from sortedcontainers import SortedList
9696

97-
from . import PYANNOTE_URI, PYANNOTE_SEGMENT
98-
from .json import PYANNOTE_JSON, PYANNOTE_JSON_CONTENT
97+
from . import PYANNOTE_SEGMENT
9998
from .segment import Segment
10099
from .utils.types import Support, Label, CropMode
101100

@@ -1110,35 +1109,6 @@ def write_uem(self, file: TextIO):
11101109
for line in self._iter_uem():
11111110
file.write(line)
11121111

1113-
def for_json(self):
1114-
"""Serialization
1115-
1116-
See also
1117-
--------
1118-
:mod:`pyannote.core.json`
1119-
"""
1120-
1121-
data = {PYANNOTE_JSON: self.__class__.__name__}
1122-
data[PYANNOTE_JSON_CONTENT] = [s.for_json() for s in self]
1123-
1124-
if self.uri:
1125-
data[PYANNOTE_URI] = self.uri
1126-
1127-
return data
1128-
1129-
@classmethod
1130-
def from_json(cls, data):
1131-
"""Deserialization
1132-
1133-
See also
1134-
--------
1135-
:mod:`pyannote.core.json`
1136-
"""
1137-
1138-
uri = data.get(PYANNOTE_URI, None)
1139-
segments = [Segment.from_json(s) for s in data[PYANNOTE_JSON_CONTENT]]
1140-
return cls(segments=segments, uri=uri)
1141-
11421112
def _repr_png_(self):
11431113
"""IPython notebook support
11441114

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
'sortedcontainers >= 2.0.4',
4040
'numpy >= 1.10.4',
4141
'scipy >= 1.1',
42-
'simplejson >= 3.8.1',
4342
"dataclasses >= 0.7; python_version <'3.7'",
4443
'typing-extensions >= 3.7.4.1'
4544
],

0 commit comments

Comments
 (0)