Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Fix config issues with Python 3.7 #1066

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pytext/config/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ class IncorrectTypeError(Exception):


def _canonical_typename(cls):
if cls.__name__.endswith(".Config"):
return cls.__name__[: -len(".Config")]
return cls.__name__
if "_name" in dir(cls):
name = cls._name
else:
name = cls.__name__
if name.endswith(".Config"):
return name[: -len(".Config")]
return name


def _extend_tuple_type(cls, value):
Expand Down
2 changes: 1 addition & 1 deletion pytext/utils/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def find_config_class(class_name):
):
if not module_part or obj.__module__ == module_part:
ret.add(obj)
except ModuleNotFoundError:
except (ModuleNotFoundError, TypeError):
continue
return ret

Expand Down