diff options
author | Fahrzin Hemmati <fahhem@users.noreply.github.com> | 2021-05-10 17:44:12 -0700 |
---|---|---|
committer | Val Neekman <un33kvu@gmail.com> | 2021-05-12 13:25:01 -0400 |
commit | 1097c2366ffcb4356ba84f74c7daf42bcfe720bf (patch) | |
tree | a96b9569cae2e09b8cf98282be792c4f8d07d353 | |
parent | 937779c77420f4acb8acd775bc2c35ed94f1393d (diff) | |
download | python-slugify-1097c2366ffcb4356ba84f74c7daf42bcfe720bf.tar.gz |
Add better typing for slugify.slugify
Currently, mypy understands the type as `Iterable[str]`, which doesn't match what should actually be passed in, which is `Iterable[Iterable[str]]` or, ideally, `Iterable[Tuple[str, str]]`
-rw-r--r-- | slugify/slugify.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/slugify/slugify.py b/slugify/slugify.py index bb3aa95..2097c41 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -1,5 +1,6 @@ import re import unicodedata +import typing import types import sys @@ -76,7 +77,7 @@ def smart_truncate(string, max_length=0, word_boundary=False, separator=' ', sav def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, word_boundary=False, separator=DEFAULT_SEPARATOR, save_order=False, stopwords=(), regex_pattern=None, lowercase=True, - replacements=()): + replacements: typing.Iterable[typing.Iterable[str]]=()): """ Make a slug from the given text. :param text (str): initial text |