Return an instance of schema for given verb.
438397
def _schema_from_verb(verb, partial=False):
    """"""
    from .verbs import Verbs
    return getattr(Verbs, verb)(partial=partial)
1122028
function inferTypeByKeyword (schema) {
  for (const keyword of objectKeywords) {
    if (keyword in schema) return 'object'
  }
  for (const keyword of arrayKeywords) {
    if (keyword in schema) return 'array'
  }
  for (const keyword of stringKeywords) {
    if (keyword in schema) return 'string'
  }
  for (const keyword of numberKeywords) {
    if (keyword in schema) return 'number'
  }
  return schema.type
}
332757
function getLegacySystemName(tuple) {
    if (Array.isArray(tuple)) {
      var verb = tuple[0]
      var path = getLegacyLambdaName(tuple[1])
      return `${verb}${path}`
    }
    else {
      var path = getLegacyLambdaName(tuple)
      return `get${path}`
    }
  }
111540
def verb(**kwargs):
    """"""
    e_tree, e_oaipmh = envelope(**kwargs)
    e_element = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, kwargs['verb']))
    return e_tree, e_element
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
        })
680114
def schematron(self, fn=None, outfn=None, ext='.sch'):
        """"""
        from .xslt import XSLT
        from . import PATH, XML, etree
        fn = fn or self.fn
        if os.path.splitext(fn)[-1].lower()==ext:
            return fn
        elif os.path.splitext(fn)[-1].lower()!='.rng':
            fn = Schema(fn=fn).trang(ext='.rng')
        rng2sch = XSLT(fn=os.path.join(PATH, 'xslts', 'rng2sch.xslt'))
        rng = XML(fn=fn)
        outfn = outfn or os.path.splitext(fn)[0]+ext
        sch = XML(fn=outfn, root=rng2sch.saxon9(rng.root).getroot())
        sch.write()
        return sch.fn
576768
def do_schema(self, line):
        
        args = self.getargs(line)

        if not args:
            for k in sorted(self.schema):
                print "%s\t%s" % (k, self.schema[k])
        elif args[0] == "--clear":
            self.schema.clear()
        else:
            fname = args[0]
            ftype = args[1]

            if not ftype in VALID_TYPES:
                print "invalid type: use %s" % list(VALID_TYPES)
            else:
                self.schema[fname] = ftype
987552
def swagger_schema(self, request):
        """"""
        if self.parent is None:
            return {}

        spec = APISpec(
            self.parent.name, self.parent.cfg.get('VERSION', ''),
            plugins=['apispec.ext.marshmallow'], basePatch=self.prefix
        )

        for paths, handler in self.handlers.items():
            spec.add_tag({
                'name': handler.name,
                'description': utils.dedent(handler.__doc__ or ''),
            })
            for path in paths:
                operations = {}
                for http_method in handler.methods:
                    method = getattr(handler, http_method.lower())
                    operation = OrderedDict({
                        'tags': [handler.name],
                        'summary': method.__doc__,
                        'produces': ['application/json'],
                        'responses': {200: {'schema': {'$ref': {'#/definitions/' + handler.name}}}}
                    })
                    operation.update(utils.load_yaml_from_docstring(method.__doc__) or {})
                    operations[http_method.lower()] = operation

                spec.add_path(self.prefix + path, operations=operations)

            if getattr(handler, 'Schema', None):
                kwargs = {}
                if getattr(handler.meta, 'model', None):
                    kwargs['description'] = utils.dedent(handler.meta.model.__doc__ or '')
                spec.definition(handler.name, schema=handler.Schema, **kwargs)

        return deepcopy(spec.to_dict())
469381
function SchemaTypeWrapper(type) {
  var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];


  return new SchemaType(type, options);
}
328930
def get_field_def(
    schema,  # type: GraphQLSchema
    parent_type,  # type: Union[GraphQLInterfaceType, GraphQLObjectType]
    field_ast,  # type: Field
):
    # type: (...) -> Optional[GraphQLField]
    """"""
    name = field_ast.name.value
    if name == "__schema" and schema.get_query_type() == parent_type:
        return SchemaMetaFieldDef

    elif name == "__type" and schema.get_query_type() == parent_type:
        return TypeMetaFieldDef

    elif name == "__typename" and isinstance(
        parent_type, (GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType)
    ):
        return TypeNameMetaFieldDef

    elif isinstance(parent_type, (GraphQLObjectType, GraphQLInterfaceType)):
        return parent_type.fields.get(name)
1214612
def from_schema(cls, schema, handlers={}, **kwargs):
        
        return cls(
            schema.get('$id', schema.get('id', '')) if isinstance(schema, dict) else '',
            schema,
            handlers=handlers,
            **kwargs
        )
463193
public static <T> Schema<T> createFrom(RuntimeSchema<T> rs,
            Factory vf, Predicate.Factory pf,
            String... args)
    {
        return createFrom(rs, rs.instantiator, vf, pf, args);
    }
658152
function inferTypeByKeyword(schema) {
  for (const keyword of objectKeywords) {
    if (keyword in schema) {
      return 'object'
    }
  }
  for (const keyword of arrayKeywords) {
    if (keyword in schema) {
      return 'array'
    }
  }
  return schema.type
}
89154
def _pull_schema_definition(self, fname):
        """"""
        std_url = urlopen(self._ontology_file)
        cached_std = open(fname, "w+")
        cached_std.write(std_url.read())
        cached_std.close()
1067763
def to_schema(self):
        """"""
        process_type = self.metadata.process_type
        if not process_type.endswith(':'):
            process_type = '{}:'.format(process_type)

        schema = {
            'slug': self.metadata.slug,
            'name': self.metadata.name,
            'type': process_type,
            'version': self.metadata.version,
            'data_name': '',
            'requirements': {
                'executor': {
                    'docker': {
                        'image': 'resolwe/base:ubuntu-18.04',
                    },
                },
            },
        }

        if self.metadata.description is not None:
            schema['description'] = self.metadata.description
        if self.metadata.category is not None:
            schema['category'] = self.metadata.category
        if self.metadata.scheduling_class is not None:
            schema['scheduling_class'] = self.metadata.scheduling_class
        if self.metadata.persistence is not None:
            schema['persistence'] = self.metadata.persistence
        if self.metadata.requirements is not None:
            schema['requirements'] = self.metadata.requirements
        if self.metadata.data_name is not None:
            schema['data_name'] = self.metadata.data_name
        if self.metadata.entity is not None:
            schema['entity'] = self.metadata.entity

        if self.inputs:
            schema['input'] = []
            for field in self.inputs.values():
                schema['input'].append(field.to_schema())

        if self.outputs:
            schema['output'] = []
            for field in self.outputs.values():
                schema['output'].append(field.to_schema())

        schema['run'] = {
            'language': 'python',
            'program': self.source or '',
        }

        return schema
545460
def _if(cls, verb):
        
        pred = verb.predicate
        data = verb.data
        groups = set(_get_groups(verb))

        # force predicate
        if isinstance(pred, str):
            if not pred.endswith('_dtype'):
                pred = '{}_dtype'.format(pred)
            pred = getattr(pdtypes, pred)
        elif pdtypes.is_bool_dtype(np.array(pred)):
            # Turn boolean array into a predicate function
            it = iter(pred)

            def pred(col):
                return next(it)

        return [col for col in data
                if pred(data[col]) and col not in groups]
452096
def use_schema(schema, list_view=False, locations=None):
    

    def decorator(func):
        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            use_args_wrapper = parser.use_args(schema, locations=locations)
            # Function wrapped with use_args
            func_with_args = use_args_wrapper(func)
            ret = func_with_args(*args, **kwargs)
            # Serialize and jsonify the return value
            return jsonify(schema.dump(ret, many=list_view).data)

        return wrapped

    return decorator