當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。