Improve task api code quality
MEMBER
Looks good thanks, what do you think @lewtun ?
2021-05-19T13:28:54Z
https://github.com/huggingface/datasets/pull/2376#issuecomment-844107182
https://api.github.com/repos/huggingface/datasets/issues/2376
MDEyOklzc3VlQ29tbWVudDg0NDEwNzE4Mg==
https://api.github.com/repos/huggingface/datasets/issues/comments/844107182/reactions
2021-05-19T13:28:54Z
https://api.github.com/repos/huggingface/datasets/issues/comments/844107182
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
MEMBER
thanks for including the lazy `ClassLabel` class @mariosasko ! from my side this LGTM!
2021-05-20T13:54:37Z
https://github.com/huggingface/datasets/pull/2376#issuecomment-845145770
https://api.github.com/repos/huggingface/datasets/issues/2376
MDEyOklzc3VlQ29tbWVudDg0NTE0NTc3MA==
https://api.github.com/repos/huggingface/datasets/issues/comments/845145770/reactions
2021-05-20T13:54:47Z
https://api.github.com/repos/huggingface/datasets/issues/comments/845145770
https://avatars.githubusercontent.com/u/26859204?v=4
https://api.github.com/users/lewtun/events{/privacy}
https://api.github.com/users/lewtun/followers
https://api.github.com/users/lewtun/following{/other_user}
https://api.github.com/users/lewtun/gists{/gist_id}
https://github.com/lewtun
lewtun
MDQ6VXNlcjI2ODU5MjA0
https://api.github.com/users/lewtun/orgs
https://api.github.com/users/lewtun/received_events
https://api.github.com/users/lewtun/repos
https://api.github.com/users/lewtun/starred{/owner}{/repo}
https://api.github.com/users/lewtun/subscriptions
User
https://api.github.com/users/lewtun
public
Improves the code quality of the `TaskTemplate` dataclasses.

Changes:
* replaces `return NotImplemented` with raise `NotImplementedError` 
* replaces `sorted` with `len` in the uniqueness check 
* defines `label2id` and `id2label` in the `TextClassification` template as properties
* replaces the `object.__setattr__(self, attr, value)` syntax with (IMO nicer) `self.__dict__[attr] = value`