MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / in_range

Method in_range

python/example_code/glue/question.py:118–131  ·  view source on GitHub ↗

Validate that the answer is within a range. The answer must be of a type that can be compared to the lower and upper bounds. :return: The answer, if it is within the range; otherwise, None.

(lower, upper)

Source from the content-addressed store, hash-verified

116
117 @staticmethod
118 def in_range(lower, upper):
119 """
120 Validate that the answer is within a range. The answer must be of a type that can
121 be compared to the lower and upper bounds.
122 :return: The answer, if it is within the range; otherwise, None.
123 """
124
125 def _validate(answer):
126 return (
127 answer if lower <= answer <= upper else None,
128 f"{answer} must be between {lower} and {upper}.",
129 )
130
131 return _validate
132
133
134# snippet-end:[python.example_code.glue.helper.Question]

Callers 9

run_scenarioMethod · 0.45
run_scenarioFunction · 0.45
set_user_parametersMethod · 0.45
run_scenarioFunction · 0.45
update_parametersMethod · 0.45
runMethod · 0.45
_create_filter_policyMethod · 0.45
_publish_messagesMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected