Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-anaconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Package version to publish (e.g. 1.2.0). Leave empty to read from version.py'
description: 'Package version to publish (e.g. 1.2.1). Leave empty to read from version.py'
required: false

jobs:
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.projectKey=switcherapi_switcher-client-py
sonar.projectName=switcher-client-py
sonar.organization=switcherapi
sonar.projectVersion=1.2.0
sonar.projectVersion=1.2.1
sonar.links.homepage=https://github.com/switcherapi/switcher-client-py

sonar.sources=switcher_client
Expand Down
6 changes: 6 additions & 0 deletions switcher_client/lib/bypasser/bypasser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ class Bypasser:
"""

_bypassed_keys: ContextVar[dict[str, Key] | None] = ContextVar('bypassed_keys', default=None)
_bypass_enabled = False

@staticmethod
def assume(key: str) -> Key:
Bypasser._bypass_enabled = True

# Remove previous forced value if exists to avoid conflicts
new_key = Key(key)
bypassed_keys = dict(Bypasser._current_keys())
Expand All @@ -29,6 +32,9 @@ def forget(key: str) -> None:
@staticmethod
def search_key(key: str) -> Key | None:
""" Search for key registered via 'assume' """
if not Bypasser._bypass_enabled:
return None

return Bypasser._current_keys().get(key)

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion switcher_client/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.2.1"