From 1097c2366ffcb4356ba84f74c7daf42bcfe720bf Mon Sep 17 00:00:00 2001 From: Fahrzin Hemmati Date: Mon, 10 May 2021 17:44:12 -0700 Subject: 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]]` --- slugify/slugify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1