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

collect formatting tests for flair package #2611

Merged

Conversation

helpmefindaname
Copy link
Collaborator

I have noticed, that my local pytest fails on master due to mypy and flake8 errors but run trough in cicd.
This is an atempt to fix it, so we have a faster feedback loop

Copy link
Collaborator

@alanakbik alanakbik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many improvements in code readability and bug fixes. Thanks a lot!

@@ -924,7 +924,15 @@ def to_dict(self, tag_type: str = None):

return {"text": self.to_original_text(), "all labels": labels}

def __getitem__(self, subscript: int) -> Union[Token, Span]:
@typing.overload
def __getitem__(self, idx: int) -> Token:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow cool construct, I had no idea one could do this!

@@ -1375,7 +1375,7 @@ def __init__(

super(WSD_RAGANATO_ALL, self).__init__(
data_folder=data_folder,
columns=columns,
column_format=columns,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for spotting and fixing this!

for predicted_span in predicted_spans:
span = Span(sentence[predicted_span[0][0] : predicted_span[0][-1] + 1])
value = self._remap_label(predicted_span[2])
for span_indices, score, label in predicted_spans:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much better readability

@@ -489,10 +489,12 @@ def __init__(self, tokens: List[Token]):

@property
def start_pos(self) -> int:
assert self.tokens[0].start_position is not None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity: why are these asserts necessary?

@alanakbik
Copy link
Collaborator

@helpmefindaname thanks a lot for these many improvements!

@alanakbik alanakbik merged commit 9697dc2 into flairNLP:master Feb 2, 2022
@helpmefindaname helpmefindaname deleted the bf/cicd_also_check_all_formattings branch June 29, 2022 20:06
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.

2 participants