mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Require Config to have a default (#143150)
With aliases coming soon, we want to reject alias + default combo, so we need defaults to be passed in. On top of this, this simplifies statically type checking config. Pull Request resolved: https://github.com/pytorch/pytorch/pull/143150 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
bf711a9cce
commit
9d05c8110d
@ -20,7 +20,7 @@ magic_cache_config_ignored = True
|
||||
# [@compile_ignored: debug]
|
||||
e_compile_ignored = True
|
||||
e_config = Config(default=True)
|
||||
e_jk = Config(justknob="does_not_exist")
|
||||
e_jk = Config(justknob="does_not_exist", default=True)
|
||||
e_jk_false = Config(justknob="does_not_exist", default=False)
|
||||
e_env_default = Config(env_name_default="ENV_TRUE", default=False)
|
||||
e_env_default_FALSE = Config(env_name_default="ENV_FALSE", default=True)
|
||||
|
@ -51,7 +51,7 @@ class Config:
|
||||
default behaviour. I.e. user overrides take preference.
|
||||
"""
|
||||
|
||||
default: Any = True
|
||||
default: Any
|
||||
justknob: Optional[str] = None
|
||||
env_name_default: Optional[str] = None
|
||||
env_name_force: Optional[str] = None
|
||||
@ -59,7 +59,7 @@ class Config:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
default: Any = True,
|
||||
default: Any,
|
||||
justknob: Optional[str] = None,
|
||||
env_name_default: Optional[str] = None,
|
||||
env_name_force: Optional[str] = None,
|
||||
|
Reference in New Issue
Block a user