DRYer
This commit is contained in:
parent
c827a29a7b
commit
c1777b1098
@ -72,7 +72,11 @@ class ToCmdline:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
to_cmdline = ToCmdline()
|
to_cmdline_implementation = ToCmdline()
|
||||||
|
|
||||||
|
|
||||||
|
def to_cmdline(x: str) -> List[str]:
|
||||||
|
return to_cmdline_implementation(x)
|
||||||
|
|
||||||
|
|
||||||
def python_string(text: str) -> str:
|
def python_string(text: str) -> str:
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from typing import (
|
|||||||
from . import fast_data_types as defines
|
from . import fast_data_types as defines
|
||||||
from .conf.definition import OptionOrAction, option_func
|
from .conf.definition import OptionOrAction, option_func
|
||||||
from .conf.utils import (
|
from .conf.utils import (
|
||||||
choices, to_bool, to_cmdline as tc, to_color, to_color_or_none, unit_float
|
choices, to_bool, to_cmdline, to_color, to_color_or_none, unit_float
|
||||||
)
|
)
|
||||||
from .constants import config_dir, is_macos
|
from .constants import config_dir, is_macos
|
||||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||||
@ -39,10 +39,6 @@ for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
|
|||||||
character_key_name_aliases_with_ascii_lowercase[x] = x.lower()
|
character_key_name_aliases_with_ascii_lowercase[x] = x.lower()
|
||||||
|
|
||||||
|
|
||||||
def to_cmdline(x: str) -> List[str]:
|
|
||||||
return tc(x)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_mods(parts: Iterable[str], sc: str) -> Optional[int]:
|
def parse_mods(parts: Iterable[str], sc: str) -> Optional[int]:
|
||||||
|
|
||||||
def map_mod(m: str) -> str:
|
def map_mod(m: str) -> str:
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from typing import (
|
|||||||
)
|
)
|
||||||
from urllib.parse import ParseResult, unquote, urlparse
|
from urllib.parse import ParseResult, unquote, urlparse
|
||||||
|
|
||||||
from .conf.utils import to_cmdline
|
from .conf.utils import to_cmdline_implementation
|
||||||
from .config import KeyAction, parse_key_action
|
from .config import KeyAction, parse_key_action
|
||||||
from .constants import config_dir
|
from .constants import config_dir
|
||||||
from .guess_mime_type import guess_type
|
from .guess_mime_type import guess_type
|
||||||
@ -50,7 +50,7 @@ def parse(lines: Iterable[str]) -> Generator[OpenAction, None, None]:
|
|||||||
key, rest = parts
|
key, rest = parts
|
||||||
key = key.lower()
|
key = key.lower()
|
||||||
if key == 'action':
|
if key == 'action':
|
||||||
with to_cmdline.filter_env_vars('URL', 'FILE_PATH', 'FILE', 'FRAGMENT'):
|
with to_cmdline_implementation.filter_env_vars('URL', 'FILE_PATH', 'FILE', 'FRAGMENT'):
|
||||||
x = parse_key_action(rest)
|
x = parse_key_action(rest)
|
||||||
if x is not None:
|
if x is not None:
|
||||||
actions.append(x)
|
actions.append(x)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user