Skip to content

Commit

Permalink
Replaced usage of unidecode with anyascii to fix license incompatibil…
Browse files Browse the repository at this point in the history
…ities

Closes #382
  • Loading branch information
AWhetter committed May 22, 2023
1 parent aab9f81 commit 0a557fc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions autoapi/mappers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from collections import OrderedDict, namedtuple
import re

import anyascii
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
import sphinx
import sphinx.util
from sphinx.util.console import colorize
from sphinx.util.osutil import ensuredir
import sphinx.util.logging
import unidecode

from ..settings import API_ROOT, TEMPLATE_DIR

Expand Down Expand Up @@ -122,7 +122,7 @@ def pathname(self):
* Break up the string as paths
"""
slug = self.name
slug = unidecode.unidecode(slug)
slug = anyascii.anyascii(slug)
slug = slug.replace("-", "")
slug = re.sub(r"[^\w\.]+", "-", slug).strip("-")
return os.path.join(*slug.split("."))
Expand Down
6 changes: 3 additions & 3 deletions autoapi/mappers/dotnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import traceback
import shutil
from typing import Dict
import unidecode

import yaml
import anyascii
from sphinx.util.osutil import ensuredir
from sphinx.util.console import colorize
import sphinx.util.logging
from sphinx.errors import ExtensionError
import yaml

from .base import PythonMapperBase, SphinxMapperBase

Expand Down Expand Up @@ -375,7 +375,7 @@ def pathname(self):
slug = self.name.split("(")[0]
except IndexError:
pass
slug = unidecode.unidecode(slug)
slug = anyascii.anyascii(slug)
slug = slug.replace("-", "")
slug = re.sub(r"[^\w\.]+", "-", slug).strip("-")
return os.path.join(*slug.split("."))
Expand Down
1 change: 1 addition & 0 deletions docs/changes/382.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced usage of unidecode with anyascii to fix license incompatibilities.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ ignore_missing_imports = true
module = "autoapi.documenters"
ignore_errors = true

[[tool.mypy.overrides]]
# https://github.com/anyascii/anyascii/issues/19
module = "anyascii"
ignore_missing_imports = true

[tool.ruff.pydocstyle]
convention = "google"

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ packages = find:
include_package_data = True
python_requires = >=3.7
install_requires =
anyascii
astroid>=2.7
Jinja2
PyYAML
sphinx>=5.2.0
unidecode

[options.extras_require]
docs =
Expand Down
2 changes: 1 addition & 1 deletion tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_filename(self):
cls = dotnet.DotNetClass({"id": "Foo.Bär"}, jinja_env=None, app=None)
assert cls.pathname == os.path.join("Foo", "Bar")
cls = dotnet.DotNetClass({"id": "Ащщ.юИфк"}, jinja_env=None, app=None)
assert cls.pathname == os.path.join("Ashchshch", "iuIfk")
assert cls.pathname == os.path.join("Ashchshch", "yuIfk")

def test_rendered_class_escaping(self):
"""Rendered class escaping"""
Expand Down

0 comments on commit 0a557fc

Please sign in to comment.