chore: remove sanitize (#11532)

* chore: remove sanitize

* Fix lint
This commit is contained in:
Beto Dealmeida
2020-11-02 15:13:44 -08:00
committed by GitHub
parent fac29f9dff
commit fd10c47bc6
9 changed files with 38 additions and 51 deletions

View File

@@ -15,8 +15,6 @@
# specific language governing permissions and limitations
# under the License.
import logging
import re
import unicodedata
from typing import Any, Dict, List, Optional
from sqlalchemy.orm import Session
@@ -98,18 +96,3 @@ def import_from_dict(
session.commit()
else:
logger.info("Supplied object is not a dictionary.")
def strip_accents(text: str) -> str:
text = unicodedata.normalize("NFD", text).encode("ascii", "ignore").decode("utf-8")
return str(text)
def sanitize(name: str) -> str:
"""Sanitize a post title into a directory name."""
name = name.lower().replace(" ", "_")
name = re.sub(r"[^\w]", "", name)
name = strip_accents(name)
return name