This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
add travis stuff #3
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f25d50e
add travis stuff
DeNeutoy 8e9fe5f
add travis badge to readme
DeNeutoy 7cfce9a
add codecov.yaml
DeNeutoy 24358ff
add codecov badge
DeNeutoy cad4fbb
use install_requirements bash script in travis build
DeNeutoy 56d5b50
fix pylint
DeNeutoy 3c20e00
Merge branch 'master' into travis-setup
DeNeutoy fed21de
remove conda install from install_requirements
DeNeutoy 5e1c614
Merge branch 'travis-setup' of https://github.com/DeNeutoy/allennlp i…
DeNeutoy 21f10a6
see if conda install is breaking build
DeNeutoy 5e1750f
fix failing test from defaultdict refactoring
DeNeutoy 1186a64
see if making conda quiet fixes build script
DeNeutoy ecf46f4
add newline
DeNeutoy 57d8b72
upgrade to latest pylint version
DeNeutoy 2a6be1c
expain pylint commit requirement
DeNeutoy db87cb9
disable else-after-return pylint warning
DeNeutoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,10 +123,10 @@ class Vocabulary: | |
label fields in this code), you don't have to specify anything here. | ||
""" | ||
def __init__(self, | ||
counter: Dict[str, Dict[str, int]]=None, | ||
min_count: int=1, | ||
max_vocab_size: Union[int, Dict[str, int]]=None, | ||
non_padded_namespaces: List[str]=None): | ||
counter: Dict[str, Dict[str, int]] = None, | ||
min_count: int = 1, | ||
max_vocab_size: Union[int, Dict[str, int]] = None, | ||
non_padded_namespaces: List[str] = None): | ||
self._padding_token = "@@PADDING@@" | ||
self._oov_token = "@@UNKOWN@@" | ||
if non_padded_namespaces is None: | ||
|
@@ -150,7 +150,7 @@ def __init__(self, | |
if count >= min_count: | ||
self.add_token_to_namespace(token, namespace) | ||
|
||
def set_from_file(self, filename: str, oov_token: str, namespace: str="tokens"): | ||
def set_from_file(self, filename: str, oov_token: str, namespace: str = "tokens"): | ||
""" | ||
If you already have a vocabulary file for a trained model somewhere, and you really want to | ||
use that vocabulary file instead of just setting the vocabulary from a dataset, for | ||
|
@@ -182,9 +182,9 @@ def set_from_file(self, filename: str, oov_token: str, namespace: str="tokens"): | |
@classmethod | ||
def from_dataset(cls, | ||
dataset, | ||
min_count: int=1, | ||
max_vocab_size: Union[int, Dict[str, int]]=None, | ||
non_padded_namespaces: List[str]=None) -> 'Vocabulary': | ||
min_count: int = 1, | ||
max_vocab_size: Union[int, Dict[str, int]] = None, | ||
non_padded_namespaces: List[str] = None) -> 'Vocabulary': | ||
""" | ||
Constructs a vocabulary given a :class:`.Dataset` and some parameters. We count all of the | ||
vocabulary items in the dataset, then pass those counts, and the other parameters, to | ||
|
@@ -200,7 +200,7 @@ def from_dataset(cls, | |
max_vocab_size=max_vocab_size, | ||
non_padded_namespaces=non_padded_namespaces) | ||
|
||
def add_token_to_namespace(self, token: str, namespace: str='tokens') -> int: | ||
def add_token_to_namespace(self, token: str, namespace: str = 'tokens') -> int: | ||
""" | ||
Adds ``token`` to the index, if it is not already present. Either way, we return the index of | ||
the token. | ||
|
@@ -210,20 +210,18 @@ def add_token_to_namespace(self, token: str, namespace: str='tokens') -> int: | |
self._token_to_index[namespace][token] = index | ||
self._index_to_token[namespace][index] = token | ||
return index | ||
else: | ||
return self._token_to_index[namespace][token] | ||
return self._token_to_index[namespace][token] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I disagree with pylint on the readability of this particular error message, and I'm tempted to disable it. It's not a strong opinion, though - what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep agreed, i'll disable it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should disable it in |
||
|
||
def get_index_to_token_vocabulary(self, namespace: str='tokens') -> Dict[int, str]: | ||
def get_index_to_token_vocabulary(self, namespace: str = 'tokens') -> Dict[int, str]: | ||
return self._index_to_token[namespace] | ||
|
||
def get_token_index(self, token: str, namespace: str='tokens') -> int: | ||
def get_token_index(self, token: str, namespace: str = 'tokens') -> int: | ||
if token in self._token_to_index[namespace]: | ||
return self._token_to_index[namespace][token] | ||
else: | ||
return self._token_to_index[namespace][self._oov_token] | ||
return self._token_to_index[namespace][self._oov_token] | ||
|
||
def get_token_from_index(self, index: int, namespace: str='tokens') -> str: | ||
def get_token_from_index(self, index: int, namespace: str = 'tokens') -> str: | ||
return self._index_to_token[namespace][index] | ||
|
||
def get_vocab_size(self, namespace: str='tokens') -> int: | ||
def get_vocab_size(self, namespace: str = 'tokens') -> int: | ||
return len(self._token_to_index[namespace]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one should be
if not message or message[-1] != '\n':
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks