| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6af8086 commit 4dbdb5a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,10 +53,6 @@ | |||
| 53 | 53 | help="The broadcast address to be used for discovery.", | |
| 54 | 54 | ) | |
| 55 | 55 | @click.option("-d", "--debug", envvar="KASA_DEBUG", default=False, is_flag=True) | |
| 56 | - @click.option("--bulb", default=False, is_flag=True) | ||
| 57 | - @click.option("--plug", default=False, is_flag=True) | ||
| 58 | - @click.option("--lightstrip", default=False, is_flag=True) | ||
| 59 | - @click.option("--strip", default=False, is_flag=True) | ||
| 60 | 56 | @click.option( | |
| 61 | 57 | "--type", | |
| 62 | 58 | envvar="KASA_TYPE", | |
@@ -65,7 +61,7 @@ | |||
| 65 | 61 | ) | |
| 66 | 62 | @click.version_option(package_name="python-kasa") | |
| 67 | 63 | @click.pass_context | |
| 68 | - async def cli(ctx, host, alias, target, debug, bulb, plug, lightstrip, strip, type): | ||
| 64 | + async def cli(ctx, host, alias, target, debug, type): | ||
| 69 | 65 | """A tool for controlling TP-Link smart home devices.""" # noqa | |
| 70 | 66 | # no need to perform any checks if we are just displaying the help | |
| 71 | 67 | if sys.argv[-1] == "--help": | |
@@ -95,19 +91,6 @@ async def cli(ctx, host, alias, target, debug, bulb, plug, lightstrip, strip, ty | |||
| 95 | 91 | await ctx.invoke(discover) | |
| 96 | 92 | return | |
| 97 | 93 | ||
| 98 | - if bulb or plug or strip or lightstrip: | ||
| 99 | - click.echo( | ||
| 100 | - "Using --bulb, --plug, --strip, and --lightstrip is deprecated. Use --type instead to define the type" | ||
| 101 | - ) | ||
| 102 | - if bulb: | ||
| 103 | - type = "bulb" | ||
| 104 | - elif plug: | ||
| 105 | - type = "plug" | ||
| 106 | - elif strip: | ||
| 107 | - type = "strip" | ||
| 108 | - elif lightstrip: | ||
| 109 | - type = "lightstrip" | ||
| 110 | - | ||
| 111 | 94 | if type is not None: | |
| 112 | 95 | dev = TYPE_TO_CLASS[type](host) | |
| 113 | 96 | else: | |
@@ -158,9 +141,8 @@ async def join(dev: SmartDevice, ssid, password, keytype): | |||
| 158 | 141 | ||
| 159 | 142 | @cli.command() | |
| 160 | 143 | @click.option("--timeout", default=3, required=False) | |
| 161 | - @click.option("--dump-raw", is_flag=True) | ||
| 162 | 144 | @click.pass_context | |
| 163 | - async def discover(ctx, timeout, dump_raw): | ||
| 145 | + async def discover(ctx, timeout): | ||
| 164 | 146 | """Discover devices in the network.""" | |
| 165 | 147 | target = ctx.parent.params["target"] | |
| 166 | 148 | click.echo(f"Discovering devices on {target} for {timeout} seconds") | |
@@ -201,8 +183,7 @@ async def sysinfo(dev): | |||
| 201 | 183 | ||
| 202 | 184 | @cli.command() | |
| 203 | 185 | @pass_dev | |
| 204 | - @click.pass_context | ||
| 205 | - async def state(ctx, dev: SmartDevice): | ||
| 186 | + async def state(dev: SmartDevice): | ||
| 206 | 187 | """Print out device state and versions.""" | |
| 207 | 188 | click.echo(click.style(f"== {dev.alias} - {dev.model} ==", bold=True)) | |
| 208 | 189 | click.echo(f"\tHost: {dev.host}") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,22 +106,6 @@ async def test_brightness(dev): | |||
| 106 | 106 | assert "Brightness: 12" in res.output | |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | - def _generate_type_class_pairs(): | ||
| 110 | - yield from TYPE_TO_CLASS.items() | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - @pytest.mark.parametrize("type_class", _generate_type_class_pairs()) | ||
| 114 | - async def test_deprecated_type(dev, type_class, mocker): | ||
| 115 | - """Make sure that using deprecated types yields a warning.""" | ||
| 116 | - type, cls = type_class | ||
| 117 | - if type == "dimmer": | ||
| 118 | - return | ||
| 119 | - runner = CliRunner() | ||
| 120 | - with mocker.patch("kasa.SmartDevice.update"): | ||
| 121 | - res = await runner.invoke(cli, ["--host", "127.0.0.2", f"--{type}"]) | ||
| 122 | - assert "Using --bulb, --plug, --strip, and --lightstrip is deprecated" in res.output | ||
| 123 | - | ||
| 124 | - | ||
| 125 | 109 | async def test_temperature(dev): | |
| 126 | 110 | pass | |
| 127 | 111 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments