Skip to content

Commit 7ce45cf

Browse files
committed
style: Use single backticks in comments and docstrings
beep boop
1 parent 783c683 commit 7ce45cf

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

flagsmith/models.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ class Flags:
8888
_pipeline_analytics_processor: typing.Optional[PipelineAnalyticsProcessor] = None
8989
_identity_identifier: typing.Optional[str] = None
9090
_traits: typing.Optional[typing.Dict[str, typing.Any]] = None
91-
# Lazy-evaluation state. When ``_context`` is set, ``flags`` is a
91+
# Lazy-evaluation state. When `_context` is set, `flags` is a
9292
# per-feature memo rather than a fully-materialised snapshot; unseen
9393
# features are resolved on demand via the engine primitives and
94-
# cached back into ``flags``. Left as ``None`` by the eager code
95-
# paths (``from_evaluation_result`` / ``from_api_flags``).
94+
# cached back into `flags`. Left as `None` by the eager code
95+
# paths (`from_evaluation_result` / `from_api_flags`).
9696
_context: typing.Optional[SDKEvaluationContext] = None
9797
_overrides_index: typing.Optional[SegmentOverridesIndex] = None
9898
_fully_materialised: bool = False
@@ -135,10 +135,10 @@ def from_evaluation_context(
135135
identity_identifier: typing.Optional[str] = None,
136136
traits: typing.Optional[typing.Dict[str, typing.Any]] = None,
137137
) -> Flags:
138-
"""Build a lazy ``Flags`` backed by an evaluation context.
138+
"""Build a lazy `Flags` backed by an evaluation context.
139139
140140
No engine work is done here — flags are resolved on first access
141-
via :meth:`_resolve_flag`. Reusing the same ``overrides_index``
141+
via :meth:`_resolve_flag`. Reusing the same `overrides_index`
142142
across calls amortises its construction cost (it's rebuilt only
143143
when the environment doc refreshes, not per identity).
144144
"""
@@ -231,7 +231,7 @@ def get_flag(self, feature_name: str) -> typing.Union[DefaultFlag, Flag]:
231231
try:
232232
flag = self.flags[feature_name]
233233
except KeyError:
234-
# Lazy path: if this ``Flags`` wraps an evaluation context and
234+
# Lazy path: if this `Flags` wraps an evaluation context and
235235
# the feature exists in it, resolve and memoise now. Otherwise
236236
# fall through to the default_flag_handler / not-found error,
237237
# preserving the eager-mode behaviour byte-for-byte.
@@ -266,7 +266,7 @@ def get_flag(self, feature_name: str) -> typing.Union[DefaultFlag, Flag]:
266266
def _resolve_flag(self, feature_name: str) -> Flag:
267267
"""Evaluate a single feature against the lazy context.
268268
269-
Goes through the engine's public ``get_evaluation_result`` so
269+
Goes through the engine's public `get_evaluation_result` so
270270
identity-key enrichment, multivariate hashing, percentage-split
271271
rules and override-priority handling all stay where they
272272
belong (in the engine). The performance win comes from passing
@@ -277,7 +277,7 @@ def _resolve_flag(self, feature_name: str) -> Flag:
277277
"""
278278
context = self._context
279279
overrides_index = self._overrides_index
280-
# ``get_flag`` / ``all_flags`` gate this call behind the same
280+
# `get_flag` / `all_flags` gate this call behind the same
281281
# non-None checks; assert here so type checkers can narrow.
282282
assert context is not None and overrides_index is not None
283283

tests/test_flagsmith.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ def test_get_identity_flags_uses_local_environment_when_available(
194194
# Given
195195
flagsmith._evaluation_context = evaluation_context
196196
flagsmith.enable_local_evaluation = True
197-
# ``Flags`` materialises identity flags via ``engine.get_evaluation_result``
198-
# imported from ``flagsmith.models``, so patch it where it's actually used.
197+
# `Flags` materialises identity flags via `engine.get_evaluation_result`
198+
# imported from `flagsmith.models`, so patch it where it's actually used.
199199
mock_get_evaluation_result = mocker.patch(
200200
"flagsmith.models.engine.get_evaluation_result",
201201
autospec=True,
@@ -260,8 +260,8 @@ def test_get_identity_flags_includes_segments_in_evaluation_context(
260260

261261
mock_get_evaluation_result.return_value = expected_evaluation_result
262262

263-
# When: ``all_flags`` triggers the bulk evaluation path on the lazy
264-
# ``Flags`` object, which is where the full identity context — segments
263+
# When: `all_flags` triggers the bulk evaluation path on the lazy
264+
# `Flags` object, which is where the full identity context — segments
265265
# included — is passed to the engine.
266266
local_eval_flagsmith.get_identity_flags(identifier, traits).all_flags()
267267

tests/test_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ def test_get_flag_without_pipeline_processor() -> None:
179179
def lazy_context_factory() -> LazyContextFactory:
180180
"""Factory for minimal evaluation contexts used by the lazy-Flags tests.
181181
182-
The returned context has a ``target`` feature with a single segment
183-
override (matches when ``tier == segment_match_value``, priority 0)
184-
plus ``extra_features`` no-override "noise" features whose values
182+
The returned context has a `target` feature with a single segment
183+
override (matches when `tier == segment_match_value`, priority 0)
184+
plus `extra_features` no-override "noise" features whose values
185185
should come straight off the base feature context.
186186
"""
187187

@@ -259,7 +259,7 @@ def lazy_context(
259259

260260
@pytest.fixture
261261
def lazy_flags(lazy_context: SDKEvaluationContext) -> Flags:
262-
"""Lazy ``Flags`` built from the default context, no analytics, no handler."""
262+
"""Lazy `Flags` built from the default context, no analytics, no handler."""
263263
return Flags.from_evaluation_context(
264264
context=lazy_context,
265265
overrides_index=build_segment_overrides_index(lazy_context),

0 commit comments

Comments
 (0)