06dc59afe4657c009430a4673f1504feb69d2736,torchtext/data/example.py,Example,fromdict,#Any#Any#Any#,51
Before Change
@classmethod
def fromdict(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 key, vals in fields.items():
if key not in data:
raise ValueError("Specified key {} was not found in "
"the input data".format(key))
if vals is not None:
if not isinstance(vals, list):
vals = [vals]
for val in vals:
name, field = val
setattr(ex, name, field.preprocess(data[key]))
return ex
@classmethod
def fromCSV(cls, data, fields, field_to_index=None):
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
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 fromCSV(cls, data, fields, field_to_index=None):
warnings.warn("{} class has ".format(self.__class__.__name__) +
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
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: 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: 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: fromJSON
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