mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-26 22:09:54 +00:00
Tell mypy about the types of optFlags and optParameters
This commit is contained in:
parent
6955154824
commit
84cc7c5b84
@ -4,7 +4,11 @@ import os
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from allmydata.scripts.types_ import SubCommands
|
from allmydata.scripts.types_ import (
|
||||||
|
SubCommands,
|
||||||
|
Parameters,
|
||||||
|
Flags,
|
||||||
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -47,29 +51,29 @@ WHERE_OPTS = [
|
|||||||
"Hostname to automatically set --location/--port when --listen=tcp"),
|
"Hostname to automatically set --location/--port when --listen=tcp"),
|
||||||
("listen", None, "tcp",
|
("listen", None, "tcp",
|
||||||
"Comma-separated list of listener types (tcp,tor,i2p,none)."),
|
"Comma-separated list of listener types (tcp,tor,i2p,none)."),
|
||||||
]
|
] # type: Parameters
|
||||||
|
|
||||||
TOR_OPTS = [
|
TOR_OPTS = [
|
||||||
("tor-control-port", None, None,
|
("tor-control-port", None, None,
|
||||||
"Tor's control port endpoint descriptor string (e.g. tcp:127.0.0.1:9051 or unix:/var/run/tor/control)"),
|
"Tor's control port endpoint descriptor string (e.g. tcp:127.0.0.1:9051 or unix:/var/run/tor/control)"),
|
||||||
("tor-executable", None, None,
|
("tor-executable", None, None,
|
||||||
"The 'tor' executable to run (default is to search $PATH)."),
|
"The 'tor' executable to run (default is to search $PATH)."),
|
||||||
]
|
] # type: Parameters
|
||||||
|
|
||||||
TOR_FLAGS = [
|
TOR_FLAGS = [
|
||||||
("tor-launch", None, "Launch a tor instead of connecting to a tor control port."),
|
("tor-launch", None, "Launch a tor instead of connecting to a tor control port."),
|
||||||
]
|
] # type: Flags
|
||||||
|
|
||||||
I2P_OPTS = [
|
I2P_OPTS = [
|
||||||
("i2p-sam-port", None, None,
|
("i2p-sam-port", None, None,
|
||||||
"I2P's SAM API port endpoint descriptor string (e.g. tcp:127.0.0.1:7656)"),
|
"I2P's SAM API port endpoint descriptor string (e.g. tcp:127.0.0.1:7656)"),
|
||||||
("i2p-executable", None, None,
|
("i2p-executable", None, None,
|
||||||
"(future) The 'i2prouter' executable to run (default is to search $PATH)."),
|
"(future) The 'i2prouter' executable to run (default is to search $PATH)."),
|
||||||
]
|
] # type: Parameters
|
||||||
|
|
||||||
I2P_FLAGS = [
|
I2P_FLAGS = [
|
||||||
("i2p-launch", None, "(future) Launch an I2P router instead of connecting to a SAM API port."),
|
("i2p-launch", None, "(future) Launch an I2P router instead of connecting to a SAM API port."),
|
||||||
]
|
] # type: Flags
|
||||||
|
|
||||||
def validate_where_options(o):
|
def validate_where_options(o):
|
||||||
if o['listen'] == "none":
|
if o['listen'] == "none":
|
||||||
@ -175,7 +179,7 @@ class CreateClientOptions(_CreateBaseOptions):
|
|||||||
("shares-happy", None, 7, "How many servers new files must be placed on."),
|
("shares-happy", None, 7, "How many servers new files must be placed on."),
|
||||||
("shares-total", None, 10, "Total shares required for uploaded files."),
|
("shares-total", None, 10, "Total shares required for uploaded files."),
|
||||||
("join", None, None, "Join a grid with the given Invite Code."),
|
("join", None, None, "Join a grid with the given Invite Code."),
|
||||||
]
|
] # type: Parameters
|
||||||
|
|
||||||
# This is overridden in order to ensure we get a "Wrong number of
|
# This is overridden in order to ensure we get a "Wrong number of
|
||||||
# arguments." error when more than one argument is given.
|
# arguments." error when more than one argument is given.
|
||||||
|
@ -10,3 +10,5 @@ SubCommand = Tuple[str, None, Type[Options], str]
|
|||||||
SubCommands = List[SubCommand]
|
SubCommands = List[SubCommand]
|
||||||
|
|
||||||
Parameters = List[Sequence[Any]]
|
Parameters = List[Sequence[Any]]
|
||||||
|
|
||||||
|
Flags = List[Tuple[str, None, str]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user