当前位置: 首页>>代码示例>>Python>>正文


Python traitlets.Unicode方法代码示例

本文整理汇总了Python中traitlets.Unicode方法的典型用法代码示例。如果您正苦于以下问题:Python traitlets.Unicode方法的具体用法?Python traitlets.Unicode怎么用?Python traitlets.Unicode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在traitlets的用法示例。


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

示例1: parse_feeder_metadata

# 需要导入模块: import traitlets [as 别名]
# 或者: from traitlets import Unicode [as 别名]
def parse_feeder_metadata(self, model):
        PowerSources = self.filter_edges_by_class("substation")

        for node1, node2 in PowerSources:
            print(self.nxGraph[node1][node2])
            Source = PowerSource(model)
            Source.name = self.nxGraph[node1][node2]["name"]
            Source.connecting_element = node1
            Source.nominal_voltage = (
                1.732 * float(self.nxGraph[node1][node2]["kv"]) * 1000
            )
            Source.operating_voltage = float(self.nxGraph[node1][node2]["Vpu"])
            Source.substation = True
            Source.transformer = False
            Source.is_sourcebus = True
            Source.connection_type = (
                "Y" if self.nxGraph[node1][node2]["conn"] == "W" else "D"
            )
            # Source.phases = [Unicode(default_value=x) for x in self.nxGraph[node1][node2]['phases']]

        print("Feeder") 
开发者ID:NREL,项目名称:ditto,代码行数:23,代码来源:read.py

示例2: __init__

# 需要导入模块: import traitlets [as 别名]
# 或者: from traitlets import Unicode [as 别名]
def __init__(self, **kwargs):
        super(WidgetTraitTuple, self).__init__(Instance(Widget), Unicode(), **kwargs) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:4,代码来源:widget_link.py

示例3: test_get_interact_value

# 需要导入模块: import traitlets [as 别名]
# 或者: from traitlets import Unicode [as 别名]
def test_get_interact_value():
    from ipywidgets.widgets import ValueWidget
    from traitlets import Unicode
    class TheAnswer(ValueWidget):
        _model_name = Unicode('TheAnswer')
        description = Unicode()
        def get_interact_value(self):
            return 42
    w = TheAnswer()
    c = interactive(lambda v: v, v=w)
    c.update()
    nt.assert_equal(c.result, 42) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:14,代码来源:test_interaction.py

示例4: make_layout

# 需要导入模块: import traitlets [as 别名]
# 或者: from traitlets import Unicode [as 别名]
def make_layout(layout=None, **kwargs):
    from ipywidgets import Layout
    import traitlets

    if layout is None:
        layout = Layout()
    for key, val in kwargs.items():
        # note that this is the type of the class descriptor, not the instance attribute
        if isinstance(getattr(Layout, key), traitlets.Unicode):
            val = in_pixels(val)
        setattr(layout, key, val)
    return layout 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:14,代码来源:utils.py

示例5: _quick_widget

# 需要导入模块: import traitlets [as 别名]
# 或者: from traitlets import Unicode [as 别名]
def _quick_widget(package_name, version, has_view=True):
    def quick_widget_decorator(cls):
        from traitlets import Unicode
        name = cls.__name__
        if name.endswith('Model'):
            name = name[:-5]

        cls._model_name = Unicode(name + 'Model').tag(sync=True)
        cls._model_name.class_init(cls, '_model_name')

        cls._model_module = Unicode(package_name).tag(sync=True)
        cls._model_module.class_init(cls, '_model_module')

        cls._model_module_version = Unicode(version).tag(sync=True)
        cls._model_module_version.class_init(cls, '_model_module_version')

        if has_view:
            cls._view_module = Unicode(package_name).tag(sync=True)
            cls._view_module.class_init(cls, '_view_module')

            cls._view_module_version = Unicode(version).tag(sync=True)
            cls._view_module_version.class_init(cls, '_view_module_version')

            cls._view_name = Unicode(name + 'View').tag(sync=True)
            cls._view_name.class_init(cls, '_view_name')

        cls = widgets.register(cls)
        return cls

    return quick_widget_decorator 
开发者ID:RoboStack,项目名称:jupyter-ros,代码行数:32,代码来源:ros3d.py


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