Checks that node is derivative of MPTTMeta class.
769640
def is_model_mpttmeta_subclass(node):
    """"""
    if node.name != 'MPTTMeta' or not isinstance(node.parent, ClassDef):
        return False

    parents = ('django.db.models.base.Model',
               '.Model',  # for the transformed version used in this plugin
               'django.forms.forms.Form',
               '.Form',
               'django.forms.models.ModelForm',
               '.ModelForm')
    return node_is_subclass(node.parent, *parents)
738097
def visit_classdef(self, node):
        """"""
        decorate = node.decorators.accept(self) if node.decorators else ""
        bases = ", ".join(n.accept(self) for n in node.bases)
        metaclass = node.metaclass()
        if metaclass and not node.has_metaclass_hack():
            if bases:
                bases = "(%s, metaclass=%s)" % (bases, metaclass.name)
            else:
                bases = "(metaclass=%s)" % metaclass.name
        else:
            bases = "(%s)" % bases if bases else ""
        docs = self._docs_dedent(node.doc) if node.doc else ""
        return "\n\n%sclass %s%s:%s\n%s\n" % (
            decorate,
            node.name,
            bases,
            docs,
            self._stmt_list(node.body),
        )
782938
def is_descendant_of(self, node):
        
        return (
            self.tree_id == node.tree_id and
            self.lft > node.lft and
            self.rgt < node.rgt
        )
31402
def _validate_method_decoration(meta, class_):
        
        # TODO(xion): employ some code inspection tricks to serve ClassErrors
        # as if they were thrown at the offending class's/method's definition

        super_mro = class_.__mro__[1:]
        own_methods = ((name, member)
                       for name, member in class_.__dict__.items()
                       if is_method(member))

        # check that ``@override`` modifier is present where it should be
        # and absent where it shouldn't (e.g. ``@final`` methods)
        for name, method in own_methods:
            shadowed_method, base_class = next(
                ((getattr(base, name), base)
                 for base in super_mro if hasattr(base, name)),
                (None, None)
            )
            if meta._is_override(method):
                # ``@override`` is legal only when the method actually shadows
                # a method from a superclass, and that metod is not ``@final``
                if not shadowed_method:
                    raise ClassError("unnecessary @override on %s.%s" % (
                        class_.__name__, name), class_=class_)
                if meta._is_final(shadowed_method):
                    raise ClassError(
                        "illegal @override on a @final method %s.%s" % (
                            base_class.__name__, name), class_=class_)

                # if @override had parameter supplied, verify if it was
                # the same class as the base of shadowed method
                override_base = meta._get_override_base(method)
                if override_base and base_class is not override_base:
                    if is_class(override_base):
                        raise ClassError(
                            "incorrect override base: expected %s, got %s" % (
                                base_class.__name__, override_base.__name__))
                    else:
                        raise ClassError(
                            "invalid override base specified: %s" % (
                                override_base,))

                setattr(class_, name, method.method)
            else:
                if shadowed_method and name not in meta.OVERRIDE_EXEMPTIONS:
                    if meta._is_final(shadowed_method):
                        msg = "%s.%s is hiding a @final method %s.%s" % (
                            class_.__name__, name, base_class.__name__, name)
                    else:
                        msg = ("overridden method %s.%s "
                               "must be marked with @override" % (
                                class_.__name__, name))
                    raise ClassError(msg, class_=class_)
273893
function traceSources(node, original) {
			var i,
				source,
				sources;

			if (!(node instanceof EffectNode) && !(node instanceof TransformNode)) {
				return false;
			}

			sources = node.sources;

			for (i in sources) {
				if (sources.hasOwnProperty(i)) {
					source = sources[i];

					if (source === original || traceSources(source, original)) {
						return true;
					}
				}
			}

			return false;
		}
654262
def _gorg(a):
    """"""
    assert isinstance(a, GenericMeta)
    while a.__origin__ is not None:
        a = a.__origin__
    return a
1075368
private void visitGetProp(NodeTraversal t, Node n) {
    // obj.prop or obj.method()
    // Lots of types can appear on the left, a call to a void function can
    // never be on the left. getPropertyType will decide what is acceptable
    // and what isn't.
    Node property = n.getLastChild();
    Node objNode = n.getFirstChild();
    JSType childType = getJSType(objNode);

    if (childType.isDict()) {
      report(property, TypeValidator.ILLEGAL_PROPERTY_ACCESS, "'.'", "dict");
    } else if (validator.expectNotNullOrUndefined(t, n, childType,
        "No properties on this expression", getNativeType(OBJECT_TYPE))) {
      checkPropertyAccessForGetProp(n);
    }
    ensureTyped(n);
  }
463905
function checkNodeForBitwiseOperator(node) {
            if (hasBitwiseOperator(node) && !allowedOperator(node) && !isInt32Hint(node)) {
                report(node);
            }
        }
1232686
public static boolean isNodeTheSame(Node node1, Node node2)
  {
    if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
      return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
    else
      return (node1 == node2);
  }
249433
def checkNode(self, namespaceURI=None, localName=None):
        '''
            
        '''
        namespaceURI = namespaceURI or self.namespaceURI
        localName = localName or self.name
        check = False
        if localName and self.node:
            check = self._dom.isElement(self.node, localName, namespaceURI)
        if not check:
            raise NamespaceError, 'unexpected node type %s, expecting %s' %(self.node, localName)
1342911
def node_is_subclass(cls, *subclass_names):
    """"""
    if not isinstance(cls, (ClassDef, Instance)):
        return False

    # if cls.bases == YES:
    #     return False
    for base_cls in cls.bases:
        try:
            for inf in base_cls.inferred():  # pragma no branch
                if inf.qname() in subclass_names:
                    return True

                if inf != cls and node_is_subclass(  # pragma no branch
                        inf, *subclass_names):
                    # check up the hierarchy in case we are a subclass of
                    # a subclass of a subclass ...
                    return True
        except InferenceError:  # pragma no cover
            continue

    return False
1869
def checkattr(metacls, attr, value):
        
        if not isinstance(value, (
                types.MethodType,
                types.FunctionType,
                classmethod,
                staticmethod,
                property)):
            if attr in dir(type('dummy', (object,), {})) + \
                    ['__metaclass__', '__qualname__']:
                return
            if attr.startswith('_'):
                raise SyntaxError(
                    "TreeModel attribute `{0}` "
                    "must not start with `_`".format(attr))
            if not inspect.isclass(value):
                if not isinstance(value, Column):
                    raise TypeError(
                        "TreeModel attribute `{0}` "
                        "must be an instance of "
                        "`rootpy.tree.treetypes.Column`".format(attr))
                return
            if not issubclass(value, (ROOT.TObject, ROOT.ObjectProxy)):
                raise TypeError(
                    "TreeModel attribute `{0}` must inherit "
                    "from `ROOT.TObject` or `ROOT.ObjectProxy`".format(
                        attr))
513407
function checkStrictModeIdentifier(node) {
            if (inStrictMode &&
                node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ &&
                node.originalKeywordKind <= 114 /* LastFutureReservedWord */ &&
                !ts.isIdentifierName(node) &&
                !ts.isInAmbientContext(node)) {
                // Report error only if there are no parse errors in file
                if (!file.parseDiagnostics.length) {
                    file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));
                }
            }
        }
1332074
def visit_classdef(self, node, parent, newstyle=None):
        """"""
        node, doc = self._get_doc(node)
        newnode = nodes.ClassDef(node.name, doc, node.lineno, node.col_offset, parent)
        metaclass = None
        if PY3:
            for keyword in node.keywords:
                if keyword.arg == "metaclass":
                    metaclass = self.visit(keyword, newnode).value
                    break
        if node.decorator_list:
            decorators = self.visit_decorators(node, newnode)
        else:
            decorators = None
        newnode.postinit(
            [self.visit(child, newnode) for child in node.bases],
            [self.visit(child, newnode) for child in node.body],
            decorators,
            newstyle,
            metaclass,
            [
                self.visit(kwd, newnode)
                for kwd in node.keywords
                if kwd.arg != "metaclass"
            ]
            if PY3
            else [],
        )
        return newnode
435296
public void checkForValidOffsets(final Node node)
    {
        int offset = 0;

        for (final Type edt : containedTypeByNameMap.values())
        {
            final int offsetAttribute = edt.offsetAttribute();

            if (-1 != offsetAttribute)
            {
                if (offsetAttribute < offset)
                {
                    XmlSchemaParser.handleError(
                        node,
                        String.format("composite element \"%s\" has incorrect offset specified", edt.name()));
                }

                offset = offsetAttribute;
            }

            offset += edt.encodedLength();
        }
    }
57848
private static boolean isPropertyTree(Node expectedGetprop) {
    if (!expectedGetprop.isGetProp()) {
      return false;
    }

    Node leftChild = expectedGetprop.getFirstChild();
    if (!leftChild.isThis() && !isPropertyTree(leftChild)) {
      return false;
    }

    Node retVal = leftChild.getNext();
    return NodeUtil.getStringValue(retVal) != null;
  }
461205
private static void checkObjectLiteralOrClass(NodeTraversal t, Node n) {
    Set<String> getters = new HashSet<>();
    Set<String> setters = new HashSet<>();
    Set<String> staticGetters = new HashSet<>();
    Set<String> staticSetters = new HashSet<>();
    for (Node key = n.getFirstChild();
         key != null;
         key = key.getNext()) {
      if (key.isEmpty() || key.isComputedProp()) {
        continue;
      }
      if (key.isSpread()) {
        continue;
      }
      String keyName = key.getString();
      if (!key.isSetterDef()) {
        // normal property and getter cases
        Set<String> set = key.isStaticMember() ? staticGetters : getters;
        if (!set.add(keyName)) {
          if (n.isClassMembers()) {
            t.report(key, DUPLICATE_CLASS_METHODS, keyName);
          } else {
            t.report(key, DUPLICATE_OBJECT_KEY, keyName);
          }
        }
      }
      if (!key.isGetterDef()) {
        // normal property and setter cases
        Set<String> set = key.isStaticMember() ? staticSetters : setters;
        if (!set.add(keyName)) {
          if (n.isClassMembers()) {
            t.report(key, DUPLICATE_CLASS_METHODS, keyName);
          } else {
            t.report(key, DUPLICATE_OBJECT_KEY, keyName);
          }
        }
      }
    }
  }