06dc59afe4657c009430a4673f1504feb69d2736,torchtext/data/example.py,Example,fromlist,#Any#Any#Any#,77
Before Change
@classmethod
def fromlist(cls, data, fields):
warnings.warn("Example class will be retired soon and moved to torchtext.legacy. Please see the most recent release notes for further information.", UserWarning)
ex = cls()
for (name, field), val in zip(fields, data):
if field is not None:
if isinstance(val, str):
val = val.rstrip("\n")
// Handle field tuples
if isinstance(name, tuple):
for n, f in zip(name, field):
setattr(ex, n, f.preprocess(val))
else:
setattr(ex, name, field.preprocess(val))
return ex
@classmethod
def fromtree(cls, data, fields, subtrees=False):
warnings.warn("Example class will be retired soon and moved to torchtext.legacy. Please see the most recent release notes for further information.", UserWarning)
After Change
@classmethod
def fromlist(cls, data, fields):
warnings.warn("{} class has ".format(self.__class__.__name__) +
"been retired and moved to torchtext.legacy. Please " +
"import from torchtext.legacy.data if you still want it.", UserWarning)
raise ImportWarning
@classmethod
def fromtree(cls, data, fields, subtrees=False):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 15
Instances
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromlist
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromlist
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromdict
Project Name: pytorch/text
Commit Name: 06dc59afe4657c009430a4673f1504feb69d2736
Time: 2021-02-17
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromJSON