Fix formatting and docstrings and remove deprecated function

This commit is contained in:
ines 2017-05-28 00:04:04 +02:00
parent db116cbeda
commit c8543c8237
2 changed files with 9 additions and 15 deletions

View File

@ -177,10 +177,13 @@ def get_async(stream, numpy_array):
def itershuffle(iterable, bufsize=1000):
"""Shuffle an iterator. This works by holding `bufsize` items back
and yielding them sometime later. Obviously, this is not unbiased --
and yielding them sometime later. Obviously, this is not unbiased
but should be good enough for batching. Larger bufsize means less bias.
From https://gist.github.com/andres-erbsen/1307752
iterable (iterable): Iterator to shuffle.
bufsize (int): Items to hold back.
YIELDS (iterable): The shuffled iterator.
"""
iterable = iter(iterable)
buf = []
@ -315,17 +318,16 @@ def normalize_slice(length, start, stop, step=None):
def compounding(start, stop, compound):
'''Yield an infinite series of compounding values. Each time the
"""Yield an infinite series of compounding values. Each time the
generator is called, a value is produced by multiplying the previous
value by the compound rate.
EXAMPLE
EXAMPLE:
>>> sizes = compounding(1., 10., 1.5)
>>> assert next(sizes) == 1.
>>> assert next(sizes) == 1 * 1.5
>>> assert next(sizes) == 1.5 * 1.5
'''
"""
def clip(value):
return max(value, stop) if (start>stop) else min(value, stop)
curr = float(start)
@ -335,7 +337,7 @@ def compounding(start, stop, compound):
def decaying(start, stop, decay):
'''Yield an infinite series of linearly decaying values.'''
"""Yield an infinite series of linearly decaying values."""
def clip(value):
return max(value, stop) if (start>stop) else min(value, stop)
nr_upd = 1.
@ -344,12 +346,6 @@ def decaying(start, stop, decay):
nr_upd += 1
def check_renamed_kwargs(renamed, kwargs):
for old, new in renamed.items():
if old in kwargs:
raise TypeError("Keyword argument %s now renamed to %s" % (old, new))
def read_json(location):
"""Open and load JSON from file.

View File

@ -53,8 +53,6 @@ cdef class Vocab:
vice versa.
RETURNS (Vocab): The newly constructed vocab object.
"""
util.check_renamed_kwargs({'get_lex_attr': 'lex_attr_getters'}, deprecated_kwargs)
lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {}
tag_map = tag_map if tag_map is not None else {}
if lemmatizer in (None, True, False):