How to use the traitlets.Bool function in traitlets

To help you get started, we’ve selected a few traitlets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sinhrks / cesiumpy / cesiumpy / entities / entity.py View on Github external
_common_props = ['width', 'height', 'extrudedHeight', 'show', 'fill',
                     'material', 'color', 'outline', 'outlineColor', 'outlineWidth',
                     'numberOfVerticalLines', 'rotation', 'stRotation',
                     'granularity', 'scaleByDistance', 'translucencyByDistance',
                     'scale', 'horizontalOrigin', 'verticalOrigin',
                     'eyeOffset', 'pixelOffset', 'pixelOffsetScaleByDistance']

    width = traitlets.Float(allow_none=True)
    height = traitlets.Float(allow_none=True)
    extrudedHeight = traitlets.Float(allow_none=True)
    show = traitlets.Bool(allow_none=True)
    fill = traitlets.Bool(allow_none=True)

    material = MaybeTrait(klass=cesiumpy.entities.material.Material, allow_none=True)
    color = MaybeTrait(klass=cesiumpy.color.Color, allow_none=True)
    outline = traitlets.Bool(allow_none=True)
    outlineColor = MaybeTrait(klass=cesiumpy.color.Color, allow_none=True)

    outlineWidth = traitlets.Float(allow_none=True)
    numberOfVerticalLines = traitlets.Float(allow_none=True)
    rotation = traitlets.Float(allow_none=True)
    stRotation = traitlets.Float(allow_none=True)

    scale = traitlets.Float(allow_none=True)

    horizontalOrigin = traitlets.Instance(klass=constants.HorizontalOrigin, allow_none=True)
    verticalOrigin = traitlets.Instance(klass=constants.VerticalOrigin, allow_none=True)

    eyeOffset = MaybeTrait(klass=cartesian.Cartesian3, allow_none=True)
    pixelOffset = MaybeTrait(klass=cartesian.Cartesian2, allow_none=True)

    position = traitlets.Instance(klass=cartesian.Cartesian3, allow_none=True)
github creare-com / podpac / podpac / core / algorithm / coord_select.py View on Github external
Attributes
    ----------
    source : podpac.Node
        Source node that will be evaluated with the modified coordinates.
    coordinates_source : podpac.Node
        Node that supplies the available coordinates when necessary, optional. The source node is used by default.
    lat, lon, time, alt : List
        Modification parameters for given dimension. Varies by node.
    """

    coordinates_source = NodeTrait().tag(attr=True)
    lat = tl.List().tag(attr=True)
    lon = tl.List().tag(attr=True)
    time = tl.List().tag(attr=True)
    alt = tl.List().tag(attr=True)
    substitute_eval_coords = tl.Bool(False).tag(attr=True)

    _modified_coordinates = tl.Instance(Coordinates, allow_none=True)

    @tl.default("coordinates_source")
    def _default_coordinates_source(self):
        return self.source

    @common_doc(COMMON_DOC)
    def eval(self, coordinates, output=None):
        """Evaluates this nodes using the supplied coordinates.

        Parameters
        ----------
        coordinates : podpac.Coordinates
            {requested_coordinates}
        output : podpac.UnitsDataArray, optional
github jupyterlab / jupyterlab-data-explorer / jupyterlab / jupyterlab / browser_check.py View on Github external
{'BrowserApp': {'core_mode': True}},
    "Start the app in core mode."
)
test_flags['dev-mode'] = (
    {'BrowserApp': {'dev_mode': True}},
    "Start the app in dev mode."
)


test_aliases = dict(aliases)
test_aliases['app-dir'] = 'BrowserApp.app_dir'


class BrowserApp(LabApp):

    open_browser = Bool(False)
    base_url = '/foo/'
    ip = '127.0.0.1'
    flags = test_flags
    aliases = test_aliases

    def start(self):
        web_app = self.web_app
        web_app.settings.setdefault('page_config_data', dict())
        web_app.settings['page_config_data']['browserTest'] = True
        web_app.settings['page_config_data']['buildAvailable'] = False

        pool = ThreadPoolExecutor()
        future = pool.submit(run_browser, self.display_url)
        IOLoop.current().add_future(future, self._browser_finished)
        super(BrowserApp, self).start()
github jupyter / repo2docker / repo2docker / app.py View on Github external
""",
        config=True,
    )

    # FIXME: Refactor classes to separate build & run steps
    run_cmd = List(
        [],
        help="""
        Command to run when running the container

        When left empty, a jupyter notebook is run.
        """,
        config=True,
    )

    all_ports = Bool(
        False,
        help="""
        Publish all declared ports from container whiel running.

        Equivalent to -P option to docker run
        """,
        config=True,
    )

    ports = Dict(
        {},
        help="""
        Port mappings to establish when running the container.

        Equivalent to -p {key}:{value} options to docker run.
        {key} refers to port inside container, and {value}
github Ulm-IQO / qudi / logic / notebook.py View on Github external
new_handlers.append(new_handler)
        # add 404 on the end, which will catch everything that falls through
        new_handlers.append((r'(.*)', Template404))
        return new_handlers


class NbserverListApp(JupyterApp):
    version = __version__
    description="List currently running notebook servers in this profile."
    
    flags = dict(
        json=({'NbserverListApp': {'json': True}},
              "Produce machine-readable JSON output."),
    )
    
    json = Bool(False, config=True,
          help="If True, each line of output will be a JSON object with the "
                  "details from the server info file.")

    def start(self):
        if not self.json:
            print("Currently running servers:")
        for serverinfo in list_running_servers(self.runtime_dir):
            if self.json:
                print(json.dumps(serverinfo))
            else:
                print(serverinfo['url'], "::", serverinfo['notebook_dir'])

#-----------------------------------------------------------------------------
# Aliases and Flags
#-----------------------------------------------------------------------------
github jupyter / jupyter_console / jupyter_console / ptshell.py View on Github external
own is_complete handler.
        """
    )
    kernel_is_complete_timeout = Float(1, config=True,
        help="""Timeout (in seconds) for giving up on a kernel's is_complete
        response.

        If the kernel does not respond at any point within this time,
        the kernel will no longer be asked if code is complete, and the
        console will default to the built-in is_complete test.
        """
    )

    # This is configurable on JupyterConsoleApp; this copy is not configurable
    # to avoid a duplicate config option.
    confirm_exit = Bool(True,
        help="""Set to display confirmation dialog on exit.
        You can always use 'exit' or 'quit', to force a
        direct exit without any confirmation.
        """
    )

    highlight_matching_brackets = Bool(True,
        help="Highlight matching brackets.",
    ).tag(config=True)

    manager = Instance('jupyter_client.KernelManager', allow_none=True)
    client = Instance('jupyter_client.KernelClient', allow_none=True)

    def _client_changed(self, name, old, new):
        self.session_id = new.session.session
    session_id = Unicode()
github vscosta / yap-6.3 / packages / python / yap_kernel / yap_ipython / core / formatters.py View on Github external
and :attr:`deferred_printers`.

    Users should use these dictionaries to register functions that will be
    used to compute the format data for their objects (if those objects don't
    have the special print methods). The easiest way of using these
    dictionaries is through the :meth:`for_type` and :meth:`for_type_by_name`
    methods.

    If no function/callable is found to compute the format data, ``None`` is
    returned and this format type is not used.
    """

    format_type = Unicode('text/plain')
    _return_type = str

    enabled = Bool(True).tag(config=True)

    print_method = ObjectName('__repr__')

    # The singleton printers.
    # Maps the IDs of the builtin singleton objects to the format functions.
    singleton_printers = Dict().tag(config=True)

    # The type-specific printers.
    # Map type objects to the format functions.
    type_printers = Dict().tag(config=True)

    # The deferred-import type-specific printers.
    # Map (modulename, classname) pairs to the format functions.
    deferred_printers = Dict().tag(config=True)
    
    @catch_format_error
github nintendops / DynamicFusion_Body / ENV / lib / python3.5 / site-packages / IPython / core / history.py View on Github external
def _dir_hist_default(self):
        try:
            return [py3compat.getcwd()]
        except OSError:
            return []

    # A dict of output history, keyed with ints from the shell's
    # execution count.
    output_hist = Dict()
    # The text/plain repr of outputs.
    output_hist_reprs = Dict()

    # The number of the current session in the history database
    session_number = Integer()
    
    db_log_output = Bool(False,
        help="Should the history database include output? (default: no)"
    ).tag(config=True)
    db_cache_size = Integer(0,
        help="Write to database every x commands (higher values save disk access & power).\n"
        "Values of 1 or less effectively disable caching."
    ).tag(config=True)
    # The input and output caches
    db_input_cache = List()
    db_output_cache = List()
    
    # History saving in separate thread
    save_thread = Instance('IPython.core.history.HistorySavingThread',
                           allow_none=True)
    try:               # Event is a function returning an instance of _Event...
        save_flag = Instance(threading._Event, allow_none=True)
    except AttributeError:         # ...until Python 3.3, when it's a class.
github K3D-tools / K3D-jupyter / k3d / objects.py View on Github external
def __getitem__(self, name):
        return getattr(self, name)


class Drawable(widgets.Widget):
    """
    Base class for drawable objects and groups.
    """

    _model_name = Unicode('ObjectModel').tag(sync=True)
    _model_module = Unicode('k3d').tag(sync=True)
    _model_module_version = Unicode(version).tag(sync=True)

    id = Integer().tag(sync=True)
    name = Unicode(default_value=None, allow_none=True).tag(sync=True)
    visible = Bool(True).tag(sync=True)
    compression_level = Integer().tag(sync=True)

    def __getitem__(self, name):
        return getattr(self, name)

    def __init__(self, **kwargs):
        self.id = id(self)

        super(Drawable, self).__init__(**kwargs)

    def __iter__(self):
        return (self,).__iter__()

    def __add__(self, other):
        return Group(self, other)
github dheerajchand / ubuntu-django-nginx-ansible / projectenv / lib / python2.7 / site-packages / IPython / terminal / interactiveshell.py View on Github external
prompts = Instance(Prompts)

    @default('prompts')
    def _prompts_default(self):
        return self.prompts_class(self)

    @observe('prompts')
    def _(self, change):
        self._update_layout()

    @default('displayhook_class')
    def _displayhook_class_default(self):
        return RichPromptDisplayHook

    term_title = Bool(True,
        help="Automatically set the terminal title"
    ).tag(config=True)

    display_completions = Enum(('column', 'multicolumn','readlinelike'),
        help= ( "Options for displaying tab completions, 'column', 'multicolumn', and "
                "'readlinelike'. These options are for `prompt_toolkit`, see "
                "`prompt_toolkit` documentation for more information."
                ),
        default_value='multicolumn').tag(config=True)

    highlight_matching_brackets = Bool(True,
        help="Highlight matching brackets.",
    ).tag(config=True)

    extra_open_editor_shortcuts = Bool(False,
        help="Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. "