Uppercase DELETE_ENV_VAR

This commit is contained in:
Kovid Goyal 2021-09-16 10:16:33 +05:30
parent 5b716df45f
commit 5f32d2e56f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 6 deletions

View File

@ -209,7 +209,7 @@ def __init__(
@property
def final_env(self) -> Dict[str, str]:
from kitty.options.utils import delete_env_var
from kitty.options.utils import DELETE_ENV_VAR
env: Optional[Dict[str, str]] = getattr(self, '_final_env', None)
if env is None:
env = self._final_env = default_env().copy()
@ -233,7 +233,7 @@ def final_env(self) -> Dict[str, str]:
from .shell_integration import get_supported_shell_name
if get_supported_shell_name(self.argv[0]):
env['KITTY_SHELL_INTEGRATION'] = opts.shell_integration
env = {k: v for k, v in env.items() if v is not delete_env_var}
env = {k: v for k, v in env.items() if v is not DELETE_ENV_VAR}
return env
def fork(self) -> Optional[int]:

View File

@ -42,7 +42,7 @@
sequence_sep = '>'
func_with_args, args_funcs = key_func()
FuncArgsType = Tuple[str, Sequence[Any]]
delete_env_var = '_delete_this_env_var_'
DELETE_ENV_VAR = '_delete_this_env_var_'
class InvalidMods(ValueError):
@ -742,7 +742,7 @@ def env(val: str, current_val: Dict[str, str]) -> Iterable[Tuple[str, str]]:
v = expandvars(v, current_val)
yield key, v
else:
yield val, delete_env_var
yield val, DELETE_ENV_VAR
def kitten_alias(val: str) -> Iterable[Tuple[str, List[str]]]:

View File

@ -5,7 +5,7 @@
from . import BaseTest
from kitty.utils import log_error
from kitty.options.utils import delete_env_var
from kitty.options.utils import DELETE_ENV_VAR
class TestConfParsing(BaseTest):
@ -50,7 +50,7 @@ def keys_for_func(opts, name):
opts = p('pointer_shape_when_grabbed XXX', bad_line_num=1)
self.ae(opts.pointer_shape_when_grabbed, defaults.pointer_shape_when_grabbed)
opts = p('env A=1', 'env B=x$A', 'env C=', 'env D', 'clear_all_shortcuts y', 'kitten_alias a b --moo', 'map f1 kitten a')
self.ae(opts.env, {'A': '1', 'B': 'x1', 'C': '', 'D': delete_env_var})
self.ae(opts.env, {'A': '1', 'B': 'x1', 'C': '', 'D': DELETE_ENV_VAR})
ka = tuple(opts.keymap.values())[0]
self.ae(ka.args, ('b', '--moo'))
opts = p('kitty_mod alt')