TypeNotFoundError
 Perform type lookup

 @param [Object] object

 @return [Object]
   if found

 @raise [TypeNotFoundError]
   otherwise

 @api private
6954
def call(object)
      current = target = object.class
      while current != Object
        if registry.key?(current)
          return registry.fetch(current)
        end
        current = current.superclass
      end

      fail TypeNotFoundError, target
    end
141451
def _lookupIterator(self, val):
        
        if val is None:
            return lambda el, *args: el
        return val if _.isCallable(val) else lambda obj, *args: obj[val]
14306
def check_type(type)
      if type.respond_to?(:validate!)
        type.validate!(self)
      elsif klass = self.class.factory(type.to_s)
        klass.new.validate!(self)
      else
        raise "invalid type supplied for validation check"
      end
    end
26450
def method_missing(method_name, *_args)
      if attrs.key?(method_name.to_s)
        attrs[method_name.to_s]
      else
        super(method_name)
      end
    end
495436
def _validate_version(request)
      unless self.class.versions.include?(request.version)
        _error!(Errors::NotFoundError, request.version)
      end
    end
616480
def check_types(key='root', expected=TYPES, actual=self, opts={})
      bad_type(key, expected, actual, opts) unless actual.is_a? expected.class
      case actual
      when Hash then actual.each { |k, v| check_types(k, expected[k], v) }
      when Enumerable then actual.each { |v| check_types(key, expected.first, v, enum: true) }
      end
    end
539407
def find(cls, name):
        ''''''
        if not cls.mapping:  # pragma: no branch
            for _, obj in inspect.getmembers(exceptions):
                if inspect.isclass(obj):
                    if issubclass(obj, exceptions.NSQException):  # pragma: no branch
                        if hasattr(obj, 'name'):
                            cls.mapping[obj.name] = obj
        klass = cls.mapping.get(name)
        if klass == None:
            raise TypeError('No matching exception for %s' % name)
        return klass
182657
def method_missing(method, *args, &code)
    success = false
    result  = nil

    if method.to_s.match(/^set\_([a-z].*)$/)
      name = $1.to_sym

      if @types.has_key?(name) && args.length > 2
        @types[name].set([ args[0], args[1] ], args[2]) if args.length > 2
        success = true
      end

    elsif method.to_s.match(/^remove\_([a-z].*)$/)
      name = $1.to_sym

      if @types.has_key?(name) && args.length > 0
        @types[name].delete([ args[0], args[1] ])
        success = true
      end

    else
      name = @plurals[method.to_sym]

      if name && @types.has_key?(name)
        result  = @types[name]
        success = true
      end
    end
    super unless success # Raise NoMethodError
    result
  end
1348670
def [](lookup)
      if lookup.is_a?(Integer)
        children.fetch(lookup)
      else
        found = find_all(lookup)
        case found.size
        when 1
          found.first
        when 0
          raise "No children of type #{lookup}"
        else
          raise "Ambiguous lookup #{lookup}, found #{found}."
        end
      end
    end
1287247
def _check_embedded_object(embedded_object, type, value, element_kind,
                           element_name):
    # pylint: disable=redefined-builtin
    

    if embedded_object not in ('instance', 'object'):
        raise ValueError(
            _format("{0} {1!A} specifies an invalid value for "
                    "embedded_object: {2!A} (must be 'instance' or 'object')",
                    element_kind, element_name, embedded_object))

    if type != 'string':
        raise ValueError(
            _format("{0} {1!A} specifies embedded_object {2!A} but its CIM "
                    "type is invalid: {3!A} (must be 'string')",
                    element_kind, element_name, embedded_object, type))

    if value is not None:
        if isinstance(value, list):
            if value:
                v0 = value[0]  # Check the first array element
                if v0 is not None and \
                        not isinstance(v0, (CIMInstance, CIMClass)):
                    raise ValueError(
                        _format("Array {0} {1!A} specifies embedded_object "
                                "{2!A} but the Python type of its first array "
                                "value is invalid: {3} (must be CIMInstance "
                                "or CIMClass)",
                                element_kind, element_name, embedded_object,
                                builtin_type(v0)))
        else:
            if not isinstance(value, (CIMInstance, CIMClass)):
                raise ValueError(
                    _format("{0} {1!A} specifies embedded_object {2!A} but "
                            "the Python type of its value is invalid: {3} "
                            "(must be CIMInstance or CIMClass)",
                            element_kind, element_name, embedded_object,
                            builtin_type(value)))
1162356
def getObjectFromShortCode(short_code,type=nil)
      method = 'getObjectFromShortCode'
      type = BaseObj if not type
      args = {:short_code=>short_code}
      return_object type,method,args,true
    end
949947
def normalizeInternalObjectType(value, cls, name):
    
    if not isinstance(value, cls):
        raise TypeError("%s must be a %s instance, not %s."
                        % (name, name, type(value).__name__))
    return value
61366
def edit(object, method_name)
      method = LookupPath.new(object).find(method_name.to_s) or
        raise NoMethodError, "no method `#{method_name}' in lookup path of #{object.class} instance"
      file, line = method.source_location
      if !file
        raise NoSourceLocationError, "no source location for #{method.owner}##{method.name}"
      elsif !File.exist?(file)
        raise NoSourceFileError, "cannot find source file: #{file}"
      else
        run(file, line)
      end
    end
263885
def _jsTypeof(o):
    ''''''
    if o == None:
        return 'object'
    elif o == Undefined:
        return 'undefined'
    elif isinstance(o, bool):
        return 'boolean'
    if isinstance(o, int) or isinstance(o, float):
        return 'number'
    elif isinstance(o, list) or isinstance(o, dict):
        return 'object'
    elif isinstance(o, stringtype):
        return 'string'
    raise ValueError('Unknown type for object %s (%s)' % (o, type(o)))
1178983
def domain_error!(first, *args)
      first = [first]+args unless args.empty?
      raise TypeError, "Can't convert `#{first.inspect}` into #{self}", caller
    end
1236750
def method_missing(method, *args, &block) #:nodoc:
      method_in_snake_case = method.to_s.snake_case # this way Java/JRuby styles are compatible

      if @operations.keys.include?(method_in_snake_case)
        op_name, param_types = @operations[method_in_snake_case]
        @connection.invoke @object_name,
                           op_name,
                           args.to_java(:Object),
                           param_types.to_java(:String)
      else
        super
      end
    end
724765
def object_exists?(object_name)
      safe_name = "'#{object_name.gsub('\'','\'\'')}'"
      klass = self.class.name

      sql =
          if klass == 'ActiveRecord::ConnectionAdapters::SQLServerAdapter'
            # use sysobjects table.
            "SELECT COUNT(*) AS \"one\" FROM \"sysobjects\" WHERE \"name\"=#{safe_name}"
          elsif klass == 'ActiveRecord::ConnectionAdapters::SQLite3Adapter'
            # use sqlite_master table.
            "SELECT COUNT(*) AS \"one\" FROM \"sqlite_master\" WHERE (\"type\"='table' OR \"type\"='view') AND (\"name\"=#{safe_name})"
          else
            # query the information_schema TABLES and ROUTINES views.
            "SELECT SUM(Z.\"one\") AS \"one\" FROM (SELECT COUNT(*) AS \"one\" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=#{safe_name} UNION SELECT COUNT(*) AS \"one\" FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME=#{safe_name}) AS Z"
          end

      result = exec_query(sql).first

      result && result['one'] >= 1
    end