コード例 #1
0
def cli(
    ctx: Configuration,
    verbose: bool,
    server: str,
    token: Optional[str],
    password: Optional[str],
    output: str,
    timeout: int,
    debug: bool,
    insecure: bool,
    showexceptions: bool,
    cert: str,
    columns: str,
    no_headers: bool,
    table_format: str,
    sort_by: Optional[str],
) -> None:
    """Command line interface for Home Assistant."""
    ctx.verbose = verbose
    ctx.server = server
    ctx.token = token
    ctx.password = password
    ctx.timeout = timeout
    ctx.output = output
    ctx.debug = debug
    ctx.insecure = insecure
    ctx.showexceptions = showexceptions
    ctx.cert = cert
    ctx.columns = to_tuples(columns)
    ctx.no_headers = no_headers
    ctx.table_format = table_format
    ctx.sort_by = sort_by  # type: ignore

    _LOGGER.debug("Using settings: %s", ctx)

    if debug:
        debug_requests_on()
コード例 #2
0
def cli(
    ctx: Configuration,
    verbose: bool,
    server: str,
    token: Optional[str],
    password: Optional[str],
    output: str,
    timeout: int,
    debug: bool,
    insecure: bool,
    showexceptions: bool,
    cert: str,
    columns: str,
    no_headers: bool,
    table_format: str,
    sort_by: Optional[str],
) -> None:
    """Command line interface for Home Assistant."""
    ctx.verbose = verbose
    ctx.server = server
    ctx.token = token
    ctx.password = password
    ctx.timeout = timeout
    ctx.output = output
    ctx.debug = debug
    ctx.insecure = insecure
    ctx.showexceptions = showexceptions
    ctx.cert = cert
    ctx.columns = to_tuples(columns)
    ctx.no_headers = no_headers
    ctx.table_format = table_format
    ctx.sort_by = sort_by  # type: ignore

    _LOGGER.debug("Using settings: %s", ctx)

    if debug:
        debug_requests_on()
コード例 #3
0
def test_to_tuples_no_header():
    """Test to_tuples without header."""
    data = helper.to_tuples("entity_id,state")
    assert len(data) == 2
    assert data[0] == ("entity_id",)
    assert data[1] == ("state",)
コード例 #4
0
def test_to_tuples():
    """Basic title test on to_tuples."""
    data = helper.to_tuples("a=entity_id,b=state")
    assert len(data) == 2
    assert data[0] == ("a", "entity_id")
    assert data[1] == ("b", "state")
コード例 #5
0
def test_to_tuples_no_header():
    """Test to_tuples without header."""
    data = helper.to_tuples("entity_id,state")
    assert len(data) == 2
    assert data[0] == ("entity_id", )
    assert data[1] == ("state", )
コード例 #6
0
def test_to_tuples():
    """Basic title test on to_tuples."""
    data = helper.to_tuples("a=entity_id,b=state")
    assert len(data) == 2
    assert data[0] == ("a", "entity_id")
    assert data[1] == ("b", "state")