• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python oset.oset函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中spyne.util.oset.oset函数的典型用法代码示例。如果您正苦于以下问题:Python oset函数的具体用法?Python oset怎么用?Python oset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了oset函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, parent, transport, type=None):
        super(HtmlClothProtocolContext, self).__init__(parent, transport, type)

        self.assets = []
        self.eltstack = defaultdict(list)
        self.ctxstack = defaultdict(list)
        self.rootstack = oset()
        self.tags = set()
开发者ID:JacekPliszka,项目名称:spyne,代码行数:8,代码来源:_base.py


示例2: _gen_table

    def _gen_table(self, ctx, cls, inst, parent, name, gen_rows, **kwargs):
        logger.debug("Generate table for %r", cls)
        cls_attrs = self.get_cls_attrs(cls)

        attrib = {}
        table_class = oset()
        if self.table_class is not None:
            table_class.add(self.table_class)

        if self.table_name_attr is not None:
            tn = (self.table_name
                        if self.table_name is not None else cls.get_type_name())

            if self.table_name_attr == 'class':
                table_class.add(tn)
            else:
                attrib[self.table_name_attr] = tn

        attrib['class'] = ' '.join(table_class)
        if self.table_width is not None:
            attrib['width'] = self.table_width

        self.event_manager.fire_event('before_table', ctx, cls, inst, parent,
                                                                 name, **kwargs)

        with parent.element('table', attrib):
            write_header = self.header
            if cls_attrs.header is False:
                write_header = cls_attrs.header

            if write_header:
                ret = False

                subprot = self.get_subprot(ctx, cls_attrs)
                if subprot is not None:
                    ret = subprot.column_table_gen_header(ctx, cls, parent,
                                                                           name)
                if not ret:
                    self._gen_thead(ctx, cls, parent, name)

            with parent.element('tbody'):
                ret = gen_rows(ctx, cls, inst, parent, name, **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass

                self.extend_table(ctx, cls, parent, name, **kwargs)
开发者ID:ashleysommer,项目名称:spyne,代码行数:54,代码来源:column.py


示例3: fire_event

    def fire_event(self, event_name, ctx, *args, **kwargs):
        """Run all the handlers for a given event name.

        :param event_name: The event identifier, indicated by the documentation.
                           Usually, this is a string.
        :param ctx: The method context. Event-related data is conventionally
                        stored in ctx.event attribute.
        """

        handlers = self.handlers.get(event_name, oset())
        for handler in handlers:
            handler(ctx, *args, **kwargs)
开发者ID:1-bit,项目名称:spyne,代码行数:12,代码来源:_base.py


示例4: add_listener

    def add_listener(self, event_name, handler):
        """Register a handler for the given event name.

        :param event_name: The event identifier, indicated by the documentation.
                           Usually, this is a string.
        :param handler: A static python function that receives a single
                        MethodContext argument.
        """

        handlers = self.handlers.get(event_name, oset())
        handlers.add(handler)
        self.handlers[event_name] = handlers
开发者ID:1-bit,项目名称:spyne,代码行数:12,代码来源:_base.py


示例5: __init__

    def __init__(self, parent, transport, type=None):
        super(HtmlClothProtocolContext, self).__init__(parent, transport, type)

        self.assets = []
        self.eltstack = defaultdict(list)
        self.ctxstack = defaultdict(list)
        self.rootstack = oset()
        self.tags = set()
        self.objcache = dict()

        # these are supposed to be for neurons.base.screen.ScreenBase subclasses
        self.screen = None
        self.prev_view = None
        self.next_view = None
开发者ID:plq,项目名称:spyne,代码行数:14,代码来源:_base.py


示例6: __get_base_event_handlers

    def __get_base_event_handlers(self, cls_bases):
        handlers = {}

        for base in cls_bases:
            evmgr = getattr(base, 'event_manager', None)
            if evmgr is None:
                continue

            for k, v in evmgr.handlers.items():
                handler=handlers.get(k, oset())
                for h in v:
                    handler.add(h)
                handlers[k]=handler

        return handlers
开发者ID:66ru,项目名称:spyne,代码行数:15,代码来源:service.py


示例7: _gen_input_attrs_novalue

    def _gen_input_attrs_novalue(self, ctx, cls, name, cls_attrs, **kwargs):
        elt_class = oset([
            camel_case_to_uscore(cls.get_type_name()),
            name.rsplit(self.hier_delim, 1)[-1],
            re.sub(r'\[[0-9]+\]', '', name).replace(self.hier_delim, '__'),
        ])

        if self.input_class is not None:
            elt_class.add(self.input_class)
        elt_class = ' '.join(elt_class)

        elt_attrs = tdict(six.string_types, six.string_types, {
            'id': self._gen_input_elt_id(name, **kwargs),
            'name': self._gen_input_name(name),
            'type': 'text',
            'class': elt_class,
        })

        if cls_attrs.pattern is not None:
            elt_attrs['pattern'] = cls_attrs.pattern

        if cls_attrs.read_only:
            elt_attrs['readonly'] = ""

        placeholder = cls_attrs.placeholder
        if placeholder is None:
            placeholder = self.placeholder

        if isinstance(placeholder, six.string_types):
            elt_attrs['placeholder'] = placeholder

        elif placeholder:
            elt_attrs['placeholder'] = self.trc(cls, ctx.locale, name)

        # Required bool means, in HTML context, a checkbox that needs to be
        # checked, which is not what we mean here at all.
        if not issubclass(cls, Boolean):
            # We used OR here because html forms send empty values anyway. So a
            # missing value is sent as null as well.
            if cls_attrs.min_occurs >= 1 or cls_attrs.nullable == False:
                elt_attrs['required'] = ''

        return elt_attrs
开发者ID:cemrecan,项目名称:neurons,代码行数:43,代码来源:widget.py


示例8: _gen_table

    def _gen_table(self, ctx, cls, inst, parent, name, gen_rows, **kwargs):
        logger.debug("Generate table for %r", cls)

        attrib = {}
        table_class = oset()
        if self.table_class is not None:
            table_class.add(self.table_class)

        if self.table_name_attr is not None:
            tn = (self.table_name
                        if self.table_name is not None else cls.get_type_name())

            if self.table_name_attr == 'class':
                table_class.add(tn)
            else:
                attrib[self.table_name_attr] = tn

        attrib['class'] = ' '.join(table_class)

        self.event_manager.fire_event('before_table', ctx, cls, inst, parent,
                                                                 name, **kwargs)

        with parent.element('table', attrib):
            if self.header:
                self._gen_thead(ctx, cls, name, parent)

            with parent.element('tbody'):
                ret = gen_rows(ctx, cls, inst, parent, name, **kwargs)
                if isgenerator(ret):
                    try:
                        while True:
                            sv2 = (yield)
                            ret.send(sv2)
                    except Break as b:
                        try:
                            ret.throw(b)
                        except StopIteration:
                            pass

                self.extend_table(ctx, cls, parent, name, **kwargs)
开发者ID:mahdi-b,项目名称:spyne,代码行数:40,代码来源:table.py



注:本文中的spyne.util.oset.oset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test.call_wsgi_app_kwargs函数代码示例发布时间:2022-05-27
下一篇:
Python odict.odict函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap