The required API, including all external classes, fields, and
        methods that this class references
423521
def get_requires(self, ignored=tuple()):
        

        if self._requires is None:
            self._requires = set(self._get_requires())

        requires = self._requires
        return [req for req in requires if not fnmatches(req, *ignored)]
127998
private static Map<Integer, AdvancedExternalizer<?>> getExternalizersFromProps(StoreProperties props) {
      Map<Integer, AdvancedExternalizer<?>> map = new HashMap<>();
      String externalizers = props.get(MARSHALLER, EXTERNALIZERS);
      if (externalizers != null) {
         for (String ext : externalizers.split(",")) {
            String[] extArray = ext.split(":");
            String className = extArray.length > 1 ? extArray[1] : extArray[0];
            AdvancedExternalizer<?> instance = Util.getInstance(className, SerializationConfigUtil.class.getClassLoader());
            int id = extArray.length > 1 ? new Integer(extArray[0]) : instance.getId();
            map.put(id, instance);
         }
      }
      return map;
   }
970695
def _api_get(self):
        
        json = self._client.get(type(self).api_endpoint, model=self)
        self._populate(json)
1232091
function ApiClient(endpoint) {
    if (endpoint.length > 0 && endpoint.slice(-1) != "/") {
        endpoint += "/";
    }
    
    this.endpoint = endpoint;
    this.namespace = null;
}
431378
function API (parameters) {
  // Own API resource prefix (e.g. '/resource').
  this.path = parameters.path || null;

  // Own documentation.
  this.title = parameters.title || null;
  this.description = parameters.description || null;

  // Own test setup functions.
  this.beforeEachTest = parameters.beforeEachTest || null;
  this.afterEachTest = parameters.afterEachTest || null;

  // Parent API resource (or root server app).
  this.parent = parameters.parent || null;

  // API sub-resources (API instances) by relative path (e.g. '/subresource').
  this.children = {};

  // Own request handlers (handler parameters) by method (e.g. 'post').
  this.handlers = {};
}
1136898
private function SaveClassesToJson()
    {
        $classes = array();
        $enumerations = array();
        $variables = array();
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasClasses())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasClasses())
                    continue;
                
                foreach($namespace->classes as $class)
                {   
                    // Set class details
                    if($class->description)
                    {
                        $classes[$header->name][$namespace->name]
                            [$class->name]
                            ["_description"] = $class->description
                        ;
                    }
                    
                    if($class->parents)
                    {
                        foreach($class->parents as $parent)
                        {
                            $classes[$header->name][$namespace->name]
                                [$class->name]
                                ["_parents"][] = $parent
                            ;
                        }
                    }
                    
                    if($class->struct)
                    {
                        $classes[$header->name][$namespace->name]
                            [$class->name]
                            ["_struct"] = $class->struct
                        ;
                    }
                    
                    if($class->forward_declaration)
                    {
                        $classes[$header->name][$namespace->name]
                            [$class->name]
                            ["_forward_declaration"] = $class->forward_declaration
                        ;
                    }
                    
                    if($class->platforms)
                    {
                        $classes[$header->name][$namespace->name]
                            [$class->name]
                            ["_platforms"] = $class->platforms
                        ;
                    }
                    
                    // Get methods
                    foreach($class->methods as $function)
                    {
                        foreach($function->overloads as $overload)
                        {
                            $parameters = array();

                            if($overload->HasParameters())
                            {
                                foreach($overload->parameters as $parameter)
                                {
                                    $parameter_array = array();
                                
                                    $parameter_array["name"] = $parameter->name;
                                    $parameter_array["type"] = $parameter->original_type;

                                    if($parameter->is_array)
                                        $parameter_array["is_array"] = $parameter->is_array;

                                    if($parameter->default_value)
                                        $parameter_array["value"] = $parameter->default_value;


                                    if(trim($parameter->description))
                                        $parameter_array["description"] = $parameter->description;

                                    $parameters[] = $parameter_array;
                                }

                                $classes[$header->name][$namespace->name]
                                    [$class->name][$function->name][] = [
                                        "description" => $overload->description,
                                        "return_type" => $overload->return_type->original_type,
                                        "parameters" => $parameters
                                    ]
                                ;
                            }
                            else
                            {
                                $classes[$header->name][$namespace->name]
                                    [$class->name][$function->name][] = [
                                        "description" => $overload->description,
                                        "return_type" => $overload->return_type->original_type
                                    ]
                                ;
                            }
                        }
                    }
                    
                    // Get enumerations
                    foreach($class->enumerations as $enumeration)
                    {
                        if(trim($enumeration->description))
                        {
                            $enumerations[$header->name][$namespace->name]
                                [$class->name][$enumeration->name] = [
                                    "options" => $enumeration->options,
                                    "description" => $enumeration->description
                                ]
                            ;
                        }
                        else
                        {
                            $enumerations[$header->name][$namespace->name]
                                [$class->name][$enumeration->name] = [
                                    "options" => $enumeration->options
                                ]
                            ;
                        }
                    }
                    
                    // Get variables
                    foreach($class->variables as $variable)
                    {
                        $variable_array = array();
                        
                        if(trim($variable->type))
                            $variable_array["type"] = $variable->type;
                        
                        if(trim($variable->static))
                            $variable_array["static"] = $variable->static;
                        
                        if(trim($variable->protected))
                            $variable_array["protected"] = $variable->protected;
                        
                        if(trim($variable->mutable))
                            $variable_array["mutable"] = $variable->mutable;
                        
                        if(trim($variable->description))
                            $variable_array["description"] = $variable->description;
                        
                        $variables[$header->name][$namespace->name]
                            [$class->name][$variable->name] = $variable_array
                        ;
                    }
                }
            }
        }
        
        if(count($classes) > 0)
        {
            file_put_contents(
                $this->definitions_path . "classes.json", 
                Json::Encode($classes)
            );
            
            unset($classes);
        }
        
        if(count($enumerations) > 0)
        {
            file_put_contents(
                $this->definitions_path . "class_enumerations.json", 
                Json::Encode($enumerations)
            );
            
            unset($enumerations);
        }
        
        if(count($variables) > 0)
        {
            file_put_contents(
                $this->definitions_path . "class_variables.json", 
                Json::Encode($variables)
            );

            unset($variables);
        }
    }
442748
function(name, protocols, requiredInstanceMethodDefs, requiredClassMethodDefs)
{
    this.name = name;
    this.protocols = protocols;
    if (requiredInstanceMethodDefs)
        this.requiredInstanceMethods = requiredInstanceMethodDefs;
    if (requiredClassMethodDefs)
        this.requiredClassMethods = requiredClassMethodDefs;
}
1075779
private static function definition() {
        global $CFG;
        $definition = array();
        $definition['id']                = new external_value(PARAM_INT, 'definition id', VALUE_OPTIONAL);
        $definition['method']            = new external_value(PARAM_TEXT, 'method');
        $definition['name']              = new external_value(PARAM_TEXT, 'name');
        $definition['description']       = new external_value(PARAM_RAW, 'description', VALUE_OPTIONAL);
        $definition['descriptionformat'] = new external_format_value('description', VALUE_OPTIONAL);
        $definition['status']            = new external_value(PARAM_INT, 'status');
        $definition['copiedfromid']      = new external_value(PARAM_INT, 'copied from id', VALUE_OPTIONAL);
        $definition['timecreated']       = new external_value(PARAM_INT, 'creation time');
        $definition['usercreated']       = new external_value(PARAM_INT, 'user who created definition');
        $definition['timemodified']      = new external_value(PARAM_INT, 'last modified time');
        $definition['usermodified']      = new external_value(PARAM_INT, 'user who modified definition');
        $definition['timecopied']        = new external_value(PARAM_INT, 'time copied', VALUE_OPTIONAL);
        foreach (self::get_grading_methods() as $method) {
            require_once($CFG->dirroot.'/grade/grading/form/'.$method.'/lib.php');
            $details  = call_user_func('gradingform_'.$method.'_controller::get_external_definition_details');
            if ($details != null) {
                $items = array();
                foreach ($details as $key => $value) {
                    $details[$key]->required = VALUE_OPTIONAL;
                    $items[$key] = $value;
                }
                $definition[$method] = new external_single_structure($items, 'items', VALUE_OPTIONAL);
            }
        }
        return new external_single_structure($definition);
    }
449251
def external_data_configuration(self):
        
        prop = self._properties.get("externalDataConfiguration")
        if prop is not None:
            prop = ExternalConfig.from_api_repr(prop)
        return prop
410639
def from_api(cls, api, **kwargs):
        
        if not cls._api_attrs:
            raise NotImplementedError()

        def resolve_attribute_type(attr_type):
            # resolve arrays of types down to base type
            while isinstance(attr_type, list):
                attr_type = attr_type[0]
            # attribute type 'self' resolves to current class
            if attr_type == 'self':
                attr_type = cls
            # attribute type 'date' is a unix timestamp
            if attr_type == 'date':
                attr_type = datetime.datetime.fromtimestamp
            # string attributes should use unicode literals
            if attr_type is str:
                attr_type = unicode
            # if attribute type is an APIObject, use the from_api factory method and pass the `api` argument
            if hasattr(attr_type, 'from_api'):
                return lambda **kw: attr_type.from_api(api, **kw)
            return attr_type

        def instantiate_attr(attr_value, attr_type):
            if isinstance(attr_value, dict):
                return attr_type(**attr_value)
            return attr_type(attr_value)

        def instantiate_array(attr_values, attr_type):
            func = instantiate_attr
            if isinstance(attr_values[0], list):
                func = instantiate_array
            return [func(val, attr_type) for val in attr_values]

        def instantiate(attr_value, attr_type):
            if isinstance(attr_value, list):
                return instantiate_array(attr_value, attr_type)
            return instantiate_attr(attr_value, attr_type)

        instance = cls(api)
        for attr_name, attr_type, attr_default in cls._api_attrs:
            # grab the current attribute value
            attr_value = kwargs.get(attr_name, attr_default)
            # default of TypeError means a required attribute, raise Exception
            if attr_value is TypeError:
                raise TypeError('{} requires argument {}'.format(cls.__name__, attr_name))
            attr_type = resolve_attribute_type(attr_type)
            # if value has been provided from API, instantiate it using `attr_type`
            if attr_value != attr_default:
                attr_value = instantiate(attr_value, attr_type)
            # rename the 'from' variable, reserved word
            if attr_name == 'from':
                attr_name = 'froom'
            # and finally set the attribute value on the instance
            setattr(instance, attr_name, attr_value)
        return instance
638576
def api(self, name, url, **kwargs):
        """"""
        if name not in self._apis:
            raise ValueError('API name must be one of {0}, not {1!r}.'.format(
                tuple(self._apis), name))
        fields = kwargs.get('fields')
        timeout = kwargs.get('timeout')
        text = kwargs.get('text')
        html = kwargs.get('html')
        if text and html:
            raise ValueError(u'Both `text` and `html` arguments provided!')
        params = {'url': url, 'token': self._token}
        if timeout:
            params['timeout'] = timeout
        if fields:
            if not isinstance(fields, str):
                fields = ','.join(sorted(fields))
            params['fields'] = fields
        url = self.endpoint(name)
        if text or html:
            content_type = html and 'text/html' or 'text/plain'
            return self._post(url, text or html, content_type, params=params)
        return self._get(url, params=params)
397992
def pull_all_external(collector, **kwargs):
    """"""
    deps = set()

    images = collector.configuration["images"]
    for layer in Builder().layered(images):
        for image_name, image in layer:
            for dep in image.commands.external_dependencies:
                deps.add(dep)

    for dep in sorted(deps):
        kwargs["image"] = dep
        pull_arbitrary(collector, **kwargs)
1280768
private void indexResourcesAndClassInfo() {
        // Add backrefs from Info objects back to this ScanResult
        final Collection<ClassInfo> allClassInfo = classNameToClassInfo.values();
        for (final ClassInfo classInfo : allClassInfo) {
            classInfo.setScanResult(this);
        }

        // If inter-class dependencies are enabled, create placeholder ClassInfo objects for any referenced
        // classes that were not scanned
        if (scanSpec.enableInterClassDependencies) {
            for (final ClassInfo ci : new ArrayList<>(classNameToClassInfo.values())) {
                final Set<ClassInfo> refdClasses = new HashSet<>();
                for (final String refdClassName : ci.findReferencedClassNames()) {
                    // Don't add circular dependencies
                    if (!ci.getName().equals(refdClassName)) {
                        // Get ClassInfo object for the named class, or create one if it doesn't exist
                        final ClassInfo refdClassInfo = ClassInfo.getOrCreateClassInfo(refdClassName,
                                /* classModifiers are unknown */ 0, classNameToClassInfo);
                        refdClassInfo.setScanResult(this);
                        if (!refdClassInfo.isExternalClass() || scanSpec.enableExternalClasses) {
                            // Only add class to result if it is whitelisted, or external classes are enabled
                            refdClasses.add(refdClassInfo);
                        }
                    }
                }
                ci.setReferencedClasses(new ClassInfoList(refdClasses, /* sortByName = */ true));
            }
        }
    }
727529
def build_api_struct(self):
        
        self.clean()
        r = {
            "type": self._type,
            "requested": self._requested,
            "value": self._value
        }
        if self._tags:
            r["tags"] = self._tags

        return r
944764
private Map<String, List<String>> findImplementations(ClassLoader loader,
                                                          List<Class<?>> interfaceClasses) throws MojoExecutionException {
        Map<String, List<String>> serviceImplementations = new HashMap<String, List<String>>();
        for (String interfaceClassName : getServices()) {
            serviceImplementations.put(interfaceClassName, new ArrayList<String>());
        }
        getLog().info("Scanning generated classes for implementations...");
        File classFolder = getClassFolder();
        List<String> classNames = listCompiledClasses(classFolder);
        // List<String> classNames = listCompiledClassesRegex( classFolder );
        for (String className : classNames) {
            try {
                if(getLog().isDebugEnabled()){
                    getLog().debug("checking class: " + className);
                }
                Class<?> cls = loader.loadClass(className);
                int mods = cls.getModifiers();
                if (!cls.isAnonymousClass() && !cls.isInterface()
                        && !cls.isEnum() && !Modifier.isAbstract(mods)
                        && Modifier.isPublic(mods)) {
                    for (Class<?> interfaceCls : interfaceClasses) {
                        if (!interfaceCls.equals(cls) && interfaceCls.isAssignableFrom(cls)) {
                            
                            // if the includes section isn't empty, we need to respect the choice and only include the items that are shown there.
                            if (includes == null || includes.length == 0) {
                                serviceImplementations.get(interfaceCls.getName()).add(className);
                            } else {
                                for ( String include : includes )
                                {
                                    if(SelectorUtils.match(include, className)) {
                                        serviceImplementations.get(interfaceCls.getName()).add(className);
                                    }
                                }
                            }
                            
                        }
                    }
                }
            } catch (ClassNotFoundException e1) {
                getLog().warn(e1);
            } catch (NoClassDefFoundError e2) {
                getLog().warn(e2);
            }
            
        }
        
        // in the next iteration we start to process with the excludes
        if (excludes != null && excludes.length != 0) {
            Set<Entry<String,List<String>>> entrySet = serviceImplementations.entrySet();
            for ( Entry<String, List<String>> entry : entrySet )
            {
                classNames = entry.getValue();
                ListIterator<String> classNamesIter = classNames.listIterator();
                
                while ( classNamesIter.hasNext())
                {
                    String className = classNamesIter.next();
                    for ( String exclude : excludes )
                    {
                        if(SelectorUtils.match(exclude, className)) {
                          classNamesIter.remove();
                          break;
                        }
                    }
                }
            }
        }
        return serviceImplementations;
    }
1149743
protected function requireClasses()
    {
        foreach ($this->classes as $classPath => $className) {

            $className = '\\' . ltrim($className, '\\');
//            if (preg_match('/dbQuery/', $className)) {
//                trace('sdf');
//            }
            if (file_exists($classPath)
                && !preg_match('/\/api\/generated\//', $className)
                && !preg_match('/activerecord\/dbQuery/', $className)
                && !preg_match('/samson\/activerecord\//', $className)
                && !preg_match('/Field.php$/', $classPath)
                && !preg_match('/Navigation.php$/', $classPath)
                && !preg_match('/TableVirtualCollection.php$/', $classPath)
                && !preg_match('/TableVirtualEntity.php$/', $classPath)
                && !preg_match('/TableVirtualQuery.php$/', $classPath)
                && !class_exists($className)
            ) {
                require_once($classPath);
            }
        }
    }
754249
def get_external_method(class_object, method_name, *args, **kwargs):
    
    related_model = get_external_model(class_object)
    if related_model is not None:
        f = getattr(related_model, method_name, None)
        if f:
            instance = related_model()
            return f(instance, *args, **kwargs)
        else:
            return None
    return None