Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixed TypeError type is not subscriptable in datasets #28

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

marmg
Copy link
Collaborator

@marmg marmg commented Nov 7, 2022

Status Type ⚠️ Core Change Issue
Ready Bug No Link

Problem

It seems next typing fails with Python < 3.9:
def load_medmentions() -> DatasetDict[DatasetWithEntities]:

This is due to the class DatasetDict of datasets extending dict. dict is a type, and it's not subscriptable in Python<3.9 (for typing it's used Dict, not dict)

See Related StackOverflow post

Solution

Now, instead of return typing DatasetDict[DatasetWithEntities] is Dict[Union[str, Split], DatasetWithEntities]

Closes #3

Signed-off-by: Marcos Martinez <Marcos.Martinez.Galindo@ibm.com>
@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 91.72% // Head: 91.73% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (c6194cd) compared to base (79c1d29).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage   91.72%   91.73%           
=======================================
  Files          53       53           
  Lines        2030     2032    +2     
=======================================
+ Hits         1862     1864    +2     
  Misses        168      168           
Impacted Files Coverage Δ
...ot/evaluation/dataset/med_mentions/med_mentions.py 100.00% <100.00%> (ø)
zshot/evaluation/dataset/ontonotes/onto_notes.py 64.58% <100.00%> (+0.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@marmg marmg merged commit d80d1f6 into main Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] TypeError when printing DatasetWithEntities
1 participant