Test the presence of a given layer type.

        :param class_: Layer class you're interested in.
        :param became: Allow transformed layers in results
351737
def has_layer(self, class_: Type[L], became: bool=True) -> bool:
        

        return (class_ in self._index or
                (became and class_ in self._transformed))
603390
def _is_metaclass(klass, seen=None):
    
    if klass.name == "type":
        return True
    if seen is None:
        seen = set()
    for base in klass.bases:
        try:
            for baseobj in base.infer():
                baseobj_name = baseobj.qname()
                if baseobj_name in seen:
                    continue
                else:
                    seen.add(baseobj_name)
                if isinstance(baseobj, bases.Instance):
                    # not abstract
                    return False
                if baseobj is util.Uninferable:
                    continue
                if baseobj is klass:
                    continue
                if not isinstance(baseobj, ClassDef):
                    continue
                if baseobj._type == "metaclass":
                    return True
                if _is_metaclass(baseobj, seen):
                    return True
        except exceptions.InferenceError:
            continue
    return False
814259
def _in_class(self, node):
        """"""
        # Move left one indentation level and check if that callable is a class
        indent = self._get_indent(node)
        for indent_dict in reversed(self._indent_stack):  # pragma: no branch
            if (indent_dict["level"] < indent) or (indent_dict["type"] == "module"):
                return indent_dict["type"] == "class"
522329
def _subclassed(base, *classes):
        
        return all(map(lambda obj: isinstance(obj, base), classes))
922029
@SuppressWarnings("unchecked")
    private ClassesTransformer<T> getTyped(ClassesTransformer<? extends T> classesTransformer) {
        return (ClassesTransformer<T>) classesTransformer;
    }
706052
private static Class checkClass(ProtoFile protoFile, Type type, Map<String, String> mappedUniName,
            boolean isUniName) {
        String packageName = protoFile.getPackageName();
        String defaultClsName = type.getName();
        // to check if has "java_package" option and "java_outer_classname"
        List<Option> options = protoFile.getOptions();
        if (options != null) {
            for (Option option : options) {
                if (option.getName().equals(JAVA_PACKAGE_OPTION)) {
                    packageName = option.getValue().toString();
                } else if (option.getName().equals(JAVA_OUTER_CLASSNAME_OPTION)) {
                    defaultClsName = option.getValue().toString();
                }
            }
        }

        String simpleName = getProxyClassName(defaultClsName, mappedUniName, isUniName);
        String className = packageName + PACKAGE_SPLIT_CHAR + simpleName;

        Class<?> c = null;
        try {
            c = Class.forName(className);
        } catch (ClassNotFoundException e1) {
            // if class not found so should generate a new java source class.
            c = null;
        }

        return c;
    }
590049
private void checkTypeDepth(Feature feature, Class<?> current)
    {
        for (final Class<?> type : current.getInterfaces())
        {
            if (type.isAnnotationPresent(FeatureInterface.class))
            {
                final Feature old;
                // CHECKSTYLE IGNORE LINE: InnerAssignment
                if ((old = typeToFeature.put(type.asSubclass(Feature.class), feature)) != null)
                {
                    throw new LionEngineException(ERROR_FEATURE_EXISTS
                                                  + feature.getClass()
                                                  + AS
                                                  + type
                                                  + WITH
                                                  + old.getClass());
                }
                checkTypeDepth(feature, type);
            }
        }
        final Class<?> parent = current.getSuperclass();
        if (parent != null)
        {
            checkTypeDepth(feature, parent);
        }
    }
1006645
def checkAndCreateClasses(self, classes):
        
        actual_classes = self['puppetclasses'].keys()
        for i in classes:
            if i not in actual_classes:
                self['puppetclasses'].append(i)
        self.reload()
        return set(classes).issubset(set((self['puppetclasses'].keys())))
611002
def object_isinstance(node, class_or_seq, context=None):
    
    obj_type = object_type(node, context)
    if obj_type is util.Uninferable:
        return util.Uninferable
    return _object_type_is_subclass(obj_type, class_or_seq, context=context)
620165
def load_dynamic_class(fqn, subclass):
    
    if not isinstance(fqn, basestring):
        return fqn

    cls = load_class_from_name(fqn)

    if cls == subclass or not issubclass(cls, subclass):
        raise TypeError("%s is not a valid %s" % (fqn, subclass.__name__))

    return cls
682080
def typeOf(cls, expected_type): #pylint: disable=no-self-argument,invalid-name,no-self-use
        
        if isinstance(expected_type, type):
            options = {}
            options["target_type"] = expected_type
            return Matcher("__TYPE__", options)
        ErrorHandler.matcher_type_error(expected_type)
288760
public static boolean isGeneratedClass(Class<?> type) {
        return null != type && type != GeneratedClass.class
                && GeneratedClass.class.isAssignableFrom(type);
    }
1290590
def mix_proxy_into_inner_classes
      klass = Processing::App.sketch_class
      klass.constants.each do |name|
        const = klass.const_get name
        next if const.class != Class || const.to_s.match(/^Java::/)

        const.class_eval 'include Processing::Proxy', __FILE__, __LINE__
      end
    end
77007
@Override
    public boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        processEntityClass(topLevelClass, introspectedTable);
        return false;
    }
455989
def class_in_progress(stack=None):
    """"""
    if stack is None:
        stack = inspect.stack()
    for frame in stack:
        statement_list = frame[4]
        if statement_list is None:
            continue
        if statement_list[0].strip().startswith('class '):
            return True
    return False
986026
def is_layer(layer, layer_type):
    '''
    '''

    if layer_type == "Input":
        return isinstance(layer, StubInput)
    elif layer_type == "Conv":
        return isinstance(layer, StubConv)
    elif layer_type == "Dense":
        return isinstance(layer, (StubDense,))
    elif layer_type == "BatchNormalization":
        return isinstance(layer, (StubBatchNormalization,))
    elif layer_type == "Concatenate":
        return isinstance(layer, (StubConcatenate,))
    elif layer_type == "Add":
        return isinstance(layer, (StubAdd,))
    elif layer_type == "Pooling":
        return isinstance(layer, StubPooling)
    elif layer_type == "Dropout":
        return isinstance(layer, (StubDropout,))
    elif layer_type == "Softmax":
        return isinstance(layer, (StubSoftmax,))
    elif layer_type == "ReLU":
        return isinstance(layer, (StubReLU,))
    elif layer_type == "Flatten":
        return isinstance(layer, (StubFlatten,))
    elif layer_type == "GlobalAveragePooling":
        return isinstance(layer, StubGlobalPooling)
1266327
def klass_for_type(type, singular=false)
      type = type.singularize unless singular
      type.classify.constantize
    end