Skip to content

Commit

Permalink
Use more variable type annotations compatible to 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dekuenstle committed May 16, 2018
1 parent be84f00 commit d8e4e7b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyndl/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cues_outcomes(event_file_name: str,
for start in range(number_of_processes)))
n_events = 0
cues = Counter() # type: Counter
outcomes: Counter = Counter()
outcomes = Counter() # type: Counter
for nn, cues_process, outcomes_process in results:
n_events += nn
cues += cues_process
Expand Down
2 changes: 1 addition & 1 deletion pyndl/ndl.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class WeightDict(defaultdict):
def __init__(self, *args, **kwargs) -> None:
super().__init__(lambda: defaultdict(float))

self._attrs: OrderedDict = OrderedDict()
self._attrs = OrderedDict() # type: OrderedDict

if 'attrs' in kwargs:
self.attrs = kwargs['attrs']
Expand Down
2 changes: 1 addition & 1 deletion pyndl/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def process_context(line):
with gzip.open(event_file, "wt") as outfile:
outfile.write("cues\toutcomes\n")

words: List[str] = []
words = [] # type: List[str]
for ii, line in enumerate(corpus):
if verbose and ii % 100000 == 0:
print(".", end="")
Expand Down
6 changes: 1 addition & 5 deletions pyndl/types.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from typing import Dict, Iterator, Tuple, TypeVar
from typing import Dict, Iterator, Tuple, TypeVar, Collection

try:
from typing import Collection
except ImportError:
from collections.abc import Collection

from numpy import ndarray
from xarray.core.dataarray import DataArray
Expand Down

0 comments on commit d8e4e7b

Please sign in to comment.