Last active
April 24, 2020 15:28
-
-
Save eirenik0/8b5dbd5b15aebd76bfca6b246666c9bf to your computer and use it in GitHub Desktop.
Old value `EDGE` would be marked as deprecated by IDE and deprecation message would be printed each `BrowserType.EDGE` call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicEnumGetter(object): | |
def __init__(self, fget=None): | |
self.fget = fget | |
def __get__(self, instance, ownerclass=None): | |
return self.fget(ownerclass) | |
class BrowserType(Enum): | |
EDGE_LEGACY = "edgelegacy" | |
EDGE_CHROMIUM = "edgechromium" | |
EDGE_CHROMIUM_ONE_VERSION_BACK = "edgechromium-1" | |
EDGE_CHROMIUM_TWO_VERSIONS_BACK = "edgechromium-2" | |
@DynamicEnumGetter | |
def EDGE(self): | |
warnings.warn( | |
"The `EDGE` option that is being used in your browsers configuration" | |
" will soon be deprecated. Please change it to either `EDGE_LEGACY`" | |
" for the legacy version or to `EDGE_CHROMIUM` for the" | |
" new Chromium-based version.", | |
DeprecationWarning, | |
stacklevel=3, | |
) | |
return self.EDGE_LEGACY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment