# Path: PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_helpers.py
# def find_mod_attr(mod_name, attr):
#     mod = find_cached_module(mod_name)
#     if mod is None:
#         return None
#     return getattr(mod, attr, None)
# 
# def find_class_name(val):
#     class_name = str(val.__class__)
#     if class_name.find('.') != -1:
#         class_name = class_name.split('.')[-1]
# 
#     elif class_name.find("'") != -1: #does not have '.' (could be something like <type 'int'>)
#         class_name = class_name[class_name.index("'") + 1:]
# 
#     if class_name.endswith("'>"):
#         class_name = class_name[:-2]
# 
#     return class_name


from _pydevd_bundle.pydevd_extension_api import StrPresentationProvider
from .pydevd_helpers import find_mod_attr, find_class_name
import sys



class DjangoFormStr(object):
    def can_provide(self, type_object, type_name):
        form_class = find_mod_attr('django.forms', 'Form')
        return form_class is not None and issubclass(type_object, form_class)

    def get_str(self, val):
        return '%s: %r' % (find_class_name(val), val)


if not sys.platform.startswith("java"):

# Path: PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_helpers.py
# def find_mod_attr(mod_name, attr):
#     mod = find_cached_module(mod_name)
#     if mod is None:
#         return None
#     return getattr(mod, attr, None)
# 
# def find_class_name(val):
#     class_name = str(val.__class__)
#     if class_name.find('.') != -1:
#         class_name = class_name.split('.')[-1]
# 
#     elif class_name.find("'") != -1: #does not have '.' (could be something like <type 'int'>)
#         class_name = class_name[class_name.index("'") + 1:]
# 
#     if class_name.endswith("'>"):
#         class_name = class_name[:-2]
# 
#     return class_name


# Path: PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydevd_plugins/extensions/types/pydevd_plugins_django_form_str.py
from _pydevd_bundle.pydevd_extension_api import StrPresentationProvider
from .pydevd_helpers import find_mod_attr, find_class_name
import sys



class DjangoFormStr(object):
    def can_provide(self, type_object, type_name):
        form_class = find_mod_attr('django.forms', 'Form')
        return form_class is not None and issubclass(type_object, form_class)

    def get_str(self, val):
        return '%s: %r' % (find_class_name(val), val)


if not sys.platform.startswith("java"):

    StrPresentationProvider.register(DjangoFormStr)
