At first create schemas without 'AllOf'
        :param obj:
        :return: None
511953
def _fill_schemas_from_definitions(self, obj):
        
        if obj.get('definitions'):
            self.schemas.clear()
            all_of_stack = []
            for name, definition in obj['definitions'].items():
                if 'allOf' in definition:
                    all_of_stack.append((name, definition))
                else:
                    self.schemas.create_schema(
                        definition, name, SchemaTypes.DEFINITION, root=self)
            while all_of_stack:
                name, definition = all_of_stack.pop(0)
                self.schemas.create_schema(
                    definition, name, SchemaTypes.DEFINITION, root=self)
132483
def dump(self, obj, **kwargs):
        """"""
        self.obj = obj
        return super(JSONSchema, self).dump(obj, **kwargs)
1202352
def _shallow_copy(self, obj=None, obj_type=None, **kwargs):
        
        if obj is None:
            obj = self._selected_obj.copy()
        if obj_type is None:
            obj_type = self._constructor
        if isinstance(obj, obj_type):
            obj = obj.obj
        for attr in self._attributes:
            if attr not in kwargs:
                kwargs[attr] = getattr(self, attr)
        return obj_type(obj, **kwargs)
438102
def from_dict(self,
                  dingos_obj_dict,
                  config_hooks=None,
                  namespace_dict=None,
                  ):
        


        # Instantiate default parameters




        if '@@ns' in dingos_obj_dict.keys():
            top_level_namespace = (namespace_dict.get(dingos_obj_dict.get('@@ns'),None),dingos_obj_dict.get('@@ns'))
        else:
            top_level_namespace = (None,None)

        if not config_hooks:
            config_hooks = {}

        datatype_extractor = config_hooks.get('datatype_extractor', (lambda io, f, i, n, d: False))

        special_ft_handler = config_hooks.get('special_ft_handler', None)

        attr_ignore_predicate = config_hooks.get('attr_ignore_predicate', None)

        force_nonleaf_fact_predicate = config_hooks.get('force_nonleaf_fact_predicate', None)

        if not namespace_dict:
            namespace_dict = {}


        namespace_uri_2_pk_mapping = dict(self._DCM['DataTypeNameSpace'].objects.values_list('uri','id'))


        if not self.is_empty():
            logger.debug("Non-empty info object %s (timestamp %s, pk %s ) is overwritten with new information" % (self.identifier,
                                                                                                                 self.timestamp,
                                                                                                                 self.pk))
            self.clear()


        # Flatten the DingoObjDict

        (flat_list, attrs) = dingos_obj_dict.flatten(attr_ignore_predicate=attr_ignore_predicate,
                                                     force_nonleaf_fact_predicate=force_nonleaf_fact_predicate,
                                                     namespace_dict=namespace_dict)



        for fact in flat_list:

            # Collect the information about all attributes relevant
            # for this node (i.e., they occur either directly on
            # the node or on an ancestor node).

            # The following code was used to generate a attribute dictionary::
            #
            #     attr_info = ExtendedSortedDict()
            #     for attr_node in attrs.keys():
            #         if fact['node_id'].startswith(attr_node):
            #            for (key, value) in attrs[attr_node].items():
            #                attr_info.chained_set(value, 'set', key, attr_node)
            #
            # The dictionary contained full information about also the attributes given
            # to ancestor nodes. So far, we have not required this
            # information for our imports, and thus simplify to a
            # dictionary that only contains the attributes directly
            # associated with the current node.
            #
            # If, at a later stage, we find we need this kind of information,
            # we will can use Django's MultiValueDict to add additional
            # information without changing the signature of the receiving
            # predicate and handler functions.


            attr_info = dict(attrs.get(fact['node_id'],[]))

            #for attr_node in attrs.keys():
            #    if fact['node_id'] == (attr_node):
            #        for (key, value) in attrs[attr_node].items():
            #            attr_info.chained_set(value, 'set', key, attr_node)


            # Fill dictionary with arguments for call to 'add_fact'

            add_fact_kargs = {}
            add_fact_kargs['fact_dt_kind'] = FactDataType.UNKNOWN_KIND
            add_fact_kargs['fact_dt_namespace_name'] = "%s-%s" % (
                self.iobject_family.name, self.iobject_family_revision.name)

            # See whether the datatype extractor has found a datatype for the value

            datatype_found = datatype_extractor(self, fact, attr_info, namespace_dict, add_fact_kargs)

            if not datatype_found:
                add_fact_kargs = {}
                add_fact_kargs['fact_dt_kind'] = FactDataType.NO_VOCAB
                add_fact_kargs['fact_dt_namespace_name'] = DINGOS_NAMESPACE_SLUG
                add_fact_kargs['fact_dt_namespace_uri'] = DINGOS_NAMESPACE_URI
            else:
                # Check whether the datatype extractor added namespace information
                # If not, add some here
                if not 'fact_dt_namespace_uri' in add_fact_kargs:
                    add_fact_kargs['fact_dt_namespace_uri'] = namespace_dict.get(
                        add_fact_kargs['fact_dt_namespace_name'], '%s/%s' % (
                            DINGOS_NAMESPACE_URI, self.iobject_family))

            add_fact_kargs['fact_term_name'] = fact['term']
            add_fact_kargs['fact_term_attribute'] = fact['attribute']
            add_fact_kargs['values'] = [fact['value']]
            add_fact_kargs['node_id_name'] = fact['node_id']
            add_fact_kargs['namespaces'] = fact['namespaces']
            add_fact_kargs['top_level_namespace'] = top_level_namespace

            handler_return_value = True

            logger.debug("Treating fact (before special handler list) %s with attr_info %s and kargs %s" % (fact, attr_info, add_fact_kargs))
            # Below, go through the handlers in the special_ft_handler list --
            # if the predicate returns True for the fact, execute the handler
            # on the fact. If a handler returns False/None, the fact is *not*
            # added. This should only be done, if the handler has added the
            # fact -- otherwise the sequence of node identifiers is messed up!

            if special_ft_handler:
                for (predicate, handler) in special_ft_handler:
                    if predicate(fact, attr_info):
                        handler_return_value = handler(self, fact, attr_info, add_fact_kargs)
                        if not handler_return_value:
                            break
            logger.debug("Treating fact (before special handler list) %s with attr_info %s and kargs %s" % (fact, attr_info, add_fact_kargs))
            if (handler_return_value == True):
                add_fact_kargs['ns_uri_dict'] = namespace_uri_2_pk_mapping
                e2f_obj = self.add_fact(**add_fact_kargs)
            elif not handler_return_value:
                continue
            else:
                e2f_obj = handler_return_value
        self.set_name()
421990
def obj_for(self, obj_or_name: Union[str, Element]) -> Optional[Union[str, Element]]:
        
        name = obj_or_name.name if isinstance(obj_or_name, Element) else obj_or_name
        return self.schema.classes[name] if name in self.schema.classes \
            else self.schema.slots[name] if name in self.schema.slots \
            else self.schema.types[name] if name in self.schema.types else name if name in builtin_names \
            else None
718374
def DefaultExtension(schema_obj, form_obj, schemata=None):
    """"""

    if schemata is None:
        schemata = ['systemconfig', 'profile', 'client']

    DefaultExtends = {
        'schema': {
            "properties/modules": [
                schema_obj
            ]
        },
        'form': {
            'modules': {
                'items/': form_obj
            }
        }
    }

    output = {}

    for schema in schemata:
        output[schema] = DefaultExtends

    return output
1231061
def to_simple(self, request, data, many=False, **kwargs):
        """"""
        schema = self.get_schema(request, **kwargs)
        return schema.dump(data, many=many).data if schema else data
674654
function setAlltoNoop (obj, methods) {
    utils.each(methods, function (method) {
        obj[method] = noop
    })
}
93833
def schema_from_context(context):
    """"""
    item_class = context.get('class')
    return (
        serializer_mapping[item_class] if item_class else BaseSchema,
        context.get('many', False)
    )
737358
def autoschema(self, objects, **kwargs):
        '''  '''
        return autoschema(objects=objects, exclude_keys=self.RESTRICTED_KEYS,
                          **kwargs)
761816
def json_response_schema( expected_object_schema ):
    
    schema = {
        'type': 'object',
        'properties': {
            'status': {
                'type': 'boolean',
            },
            'indexing': {
                'type': 'boolean',
            },
            'lastblock': {
                'anyOf': [
                    {
                        'type': 'integer',
                        'minimum': 0,
                    },
                    {
                        'type': 'null',
                    },
                ],
            },
        },
        'required': [
            'status',
            'indexing',
            'lastblock'
        ],
    }

    # fold in the given object schema
    schema['properties'].update( expected_object_schema['properties'] )
    schema['required'] = list(set( schema['required'] + expected_object_schema['required'] ))

    return schema
763836
def append(self, obj):
        
        if isinstance(obj, str):
            obj = KQMLToken(obj)
        self.data.append(obj)
404042
def schema():
        """"""
        return Schema({
            'script': And(Or(type(' '), type(u' ')), len),
            Optional('title', default=''): str,
            Optional('model', default={}): {Optional(And(str, len)): object},
            Optional('env', default={}): {Optional(And(str, len)): And(str, len)},
            Optional('item', default=None): object,
            Optional('dry_run', default=False): bool,
            Optional('debug', default=False): bool,
            Optional('strict', default=False): bool,
            Optional('variables', default={}): {
                Optional(And(Or(type(' '), type(u' ')), len, Regex(r'([a-zA-Z][_a-zA-Z]*)'))):
                    Or(type(' '), type(u' '))
            },
            Optional('temporary_scripts_path', default=''): Or(type(''), type(u'')),
            Optional('internal', default=False): bool
        })
1018256
function(def) {
    def = def ? def : _.result(this, 'definition');

    return _.reduce(def, function(schema, attr, key) {
      if (attr.type === 'object') {
        schema[key] = this.schema(attr.fields || {});
      } else if (attr.type === 'array') {
        if (attr.value_type === 'object') {
          schema[key] = [this.schema(attr.fields || {})];
        } else if (attr.value_type) {
          schema[key] = [attr.value_type];
        } else {
          schema[key] = [];
        }
      } else {
        schema[key] = attr.type;
      }
      return schema;
    }.bind(this), {});
  }
193204
def populate_obj(self, obj=None, form=None):
        
        if not form:
            form = current_context.data.form
        if obj is None:
            obj = AttrDict()
        form.populate_obj(obj)
        return obj
229573
def get_object_defaults(object_schema):
    
    default = {}
    for k, schema in object_schema.get('properties', {}).items():

        if schema.get('type') == 'object':
            if 'default' in schema:
                default[k] = schema['default']

            try:
                object_defaults = get_object_defaults(schema)
            except NoObjectDefaults:
                if 'default' not in schema:
                    raise NoObjectDefaults
            else:
                if 'default' not in schema:
                    default[k] = {}

                default[k].update(object_defaults)
        else:
            if 'default' in schema:
                default[k] = schema['default']

    if default:
        return default

    raise NoObjectDefaults
511535
def make_schema_from(value, env):
  

  # So this thing may not need to evaluate anything[0]
  if isinstance(value, framework.Thunk):
    value = framework.eval(value, env)

  # We're a bit messy. In general, this has evaluated to a Schema object, but not necessarily:
  # for tuples and lists, we still need to treat the objects as specs.
  if isinstance(value, schema.Schema):
    return value

  if framework.is_tuple(value):
    # If it so happens that the thing is a tuple, we need to pass in the data in a bit of a
    # different way into the schema factory (in a dictionary with {fields, required} keys).
    return schema_spec_from_tuple(value)

  if framework.is_list(value):
    # [0] This list may contain tuples, which oughta be treated as specs, or already-resolved schema
    # objects (as returned by 'int' and 'string' literals). make_schema_from
    # deals with both.
    return schema.from_spec([make_schema_from(x, env) for x in value])

  raise exceptions.EvaluationError('Can\'t make a schema from %r' % value)