示例#1
0
def mock_inspect_getmembers(object, predicate=None):
    import azure.cli.core.tests.test_help_loaders as possible_loaders

    if "azure.cli.core._help_loaders" in repr(object) and "is_loader_cls" in repr(predicate):
        result = inspect_getmembers(object, predicate)
        result.extend(inspect_getmembers(possible_loaders, predicate))
        return list(set(result))
    else:
        return inspect_getmembers(object, predicate)
示例#2
0
def mock_inspect_getmembers(object, predicate=None):
    import azure.cli.core.tests.test_help_loaders as possible_loaders

    if "azure.cli.core._help_loaders" in repr(object) and "is_loader_cls" in repr(predicate):
        result = inspect_getmembers(object, predicate)
        result.extend(inspect_getmembers(possible_loaders, predicate))
        return list(set(result))
    else:
        return inspect_getmembers(object, predicate)
示例#3
0
def _get_model(model_name):
    model_names = inspect_getmembers(models, inspect_isclass)
    for (imported_model_name, class_object) in model_names:
        if imported_model_name == model_name:
            return json_loads(
                serializers.serialize('json', class_object.objects.all()))
    else:
        raise ViewDoesNotExist(model_name)
示例#4
0
 def _getmembers(self):
     x = inspect_getmembers(self.__class__, lambda a: SproutSchema._find(a))
     return [i[1] for i in x]