From b5af6bd31867235a85afefaf459de2162adbf31d Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 21 Nov 2026 01:24:42 +0900 Subject: [PATCH 1/2] fix(pypi): evaluate the env markers like packaging does The marker evaluation did not validate the markers and did not follow the spec for the less common inputs. Rewrite it as a tokenizer, a parser that validates the marker and a single pass evaluator. Tokenizer: * A variable followed by a closing parenthesis was dropped, e.g. `('arm' in platform_machine)` failed to evaluate. * Parenthesis and the other kind of quotes are allowed in the strings. * The deprecated PEP 345 names, e.g. `os.name`, are supported. Validation: * Invalid markers, e.g. unterminated strings, unbalanced parenthesis, dangling operators or unknown variables, are now an error instead of evaluating to something truthy. Comparison: * `platform_release` is compared as a version and `platform_version` is not, as per the spec. * The comparison falls back to the string comparison if the expression is not a valid version specifier, e.g. when using the `in` operator. * The ordered comparison of strings is not defined, so `<` and `>` are always false and `<=` and `>=` check the equality. The cases from the packaging test-suite are added to the conformance tests and the results are the same as of packaging for all of them, including the markers that are an error to evaluate. The markers are tokenized with the string methods instead of one character at a time and they are evaluated without building a tree of structs and closures. The evaluation of a long marker takes 3 times fewer steps, which is 2 times faster in Bazel. `parse` returns a value that `evaluate` accepts instead of the string, so that a marker that is evaluated for many environments is only parsed once. Comparing two variables, which `packaging` does not evaluate correctly either, is an error instead of being false. `to_string` and `marker_expr` were not used and are removed. --- news/pypi-env-marker-conformance.fixed.md | 4 + news/pypi-env-marker-validation.changed.md | 6 + python/private/BUILD.bazel | 1 - python/private/pypi/BUILD.bazel | 5 +- python/private/pypi/pep508_evaluate.bzl | 781 +++++------ tests/perf/BUILD.bazel | 1 - tests/perf/README.md | 25 +- tests/perf/steps_test.py | 19 +- tests/perf/workloads.bzl | 7 +- tests/pypi/pep508/BUILD.bazel | 10 + tests/pypi/pep508/evaluate_tests.bzl | 186 ++- tests/pypi/pep508/packaging_cases.bzl | 1235 +++++++++++++++++ .../pep508/packaging_conformance_tests.bzl | 84 ++ tests/support/pypa_packaging/BUILD.bazel | 5 + tests/support/pypa_packaging/generate.py | 149 ++ 15 files changed, 2076 insertions(+), 442 deletions(-) create mode 100644 news/pypi-env-marker-conformance.fixed.md create mode 100644 news/pypi-env-marker-validation.changed.md create mode 100644 tests/pypi/pep508/packaging_cases.bzl create mode 100644 tests/pypi/pep508/packaging_conformance_tests.bzl diff --git a/news/pypi-env-marker-conformance.fixed.md b/news/pypi-env-marker-conformance.fixed.md new file mode 100644 index 0000000000..b4b7e7011f --- /dev/null +++ b/news/pypi-env-marker-conformance.fixed.md @@ -0,0 +1,4 @@ +(pypi) The environment markers are evaluated as described in the +[dependency specifiers spec](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers): +`platform_release` is compared as a version, `platform_version` is compared +as a string and the deprecated variable names like `os.name` are supported. diff --git a/news/pypi-env-marker-validation.changed.md b/news/pypi-env-marker-validation.changed.md new file mode 100644 index 0000000000..1c886f8753 --- /dev/null +++ b/news/pypi-env-marker-validation.changed.md @@ -0,0 +1,6 @@ +(pypi) Invalid environment markers, e.g. with unbalanced parenthesis or unknown +variables, are now an error instead of being evaluated to true. The `<`, `<=`, +`>` and `>=` operators no longer compare the strings that are not versions +lexicographically: `<` and `>` are false and `<=` and `>=` check the equality, +as described in the +[dependency specifiers spec](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers). diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 47fb78d8c9..78e4c48cd2 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -79,7 +79,6 @@ define_uncachable_version_file( exports_files( [ "coverage.patch", - "enum.bzl", "py_package.bzl", "py_wheel.bzl", "version.bzl", diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 5d51f2a01e..1bc83e1754 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -302,10 +302,7 @@ bzl_library( bzl_library( name = "pep508_evaluate", srcs = ["pep508_evaluate.bzl"], - deps = [ - "//python/private:enum", - "//python/private:version", - ], + deps = ["//python/private:version"], ) bzl_library( diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index fba7e1a53b..29a52aeaaf 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -12,160 +12,332 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This module is for implementing PEP508 in starlark as FeatureFlagInfo +"""Parsing and evaluation of the environment markers. + +See https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers """ -load("//python/private:enum.bzl", "enum") load("//python/private:version.bzl", "version") -# The expression parsing and resolution for the PEP508 is below -# +# The variables that can be used in the markers. The values tell if the +# variable is compared as a version if the other side of the expression is a +# valid version specifier. +_VARIABLES = { + "dependency_groups": False, + "extra": False, + "extras": False, + "implementation_name": False, + "implementation_version": True, + "os_name": False, + "platform_machine": False, + "platform_python_implementation": False, + "platform_release": True, + "platform_system": False, + "platform_version": False, + "python_full_version": True, + "python_version": True, + "sys_platform": False, +} -_STATE = enum( - STRING = "string", - VAR = "var", - OP = "op", - NONE = "none", -) -_BRACKETS = "()" -_OPCHARS = "<>!=~" -_QUOTES = "'\"" -_WSP = " \t" -_NON_VERSION_VAR_NAMES = [ - "implementation_name", - "os_name", - "platform_machine", - "platform_python_implementation", - "platform_release", - "platform_system", - "sys_platform", - "extra", -] +# The deprecated names that are still found in the metadata of old packages. +_VARIABLE_ALIASES = { + "os.name": "os_name", + "platform.machine": "platform_machine", + "platform.python_implementation": "platform_python_implementation", + "platform.version": "platform_version", + "python_implementation": "platform_python_implementation", + "sys.platform": "sys_platform", +} + +_VERSION_OPERATORS = { + "!=": version.is_ne, + "<": version.is_lt, + "<=": version.is_le, + "==": version.is_eq, + ">": version.is_gt, + ">=": version.is_ge, + "~=": version.is_compatible, +} +_OPERATORS = ["!=", "<", "<=", "==", "===", ">", ">=", "in", "not in", "~="] +_OPERATOR_CHARS = "<>!=~" _AND = "and" _OR = "or" _NOT = "not" + +# The key of the `env` that has the functions to normalize the strings that +# the variables are compared with, e.g. `{"platform_machine": lambda x: ...}`. +# The variables that are compared as versions cannot be normalized. _ENV_ALIASES = "_aliases" def tokenize(marker): - """Tokenize the input string. - - The output will have double-quoted values (i.e. the quoting will be normalized) and all of the whitespace will be trimmed. + """Tokenize the marker, this is only exposed for the tests. Args: - marker: {type}`str` The input to tokenize. + marker: {type}`str` The marker to tokenize. Returns: - The {type}`str` that is the list of recognized tokens that should be parsed. + {type}`list[str]` The tokens without whitespace. The strings are quoted + with `"` unless they contain it. """ - if not marker: - return [] + tokens, err = _tokenize(marker) + if err: + fail(_error(err, marker)) + + return tokens + +def _error(err, marker): + return "{} in the marker: {}".format(err, marker) +def _tokenize(marker): + """Tokenize the marker. + + Returns: + A tuple of the list of tokens and an error message, where one of them is None. + """ tokens = [] - token = "" - state = _STATE.NONE - char = "" - - # Due to the `continue` in the loop, we will be processing chars at a slower pace - for _ in range(2 * len(marker)): - if token and (state == _STATE.NONE or not marker): - if tokens and token == "in" and tokens[-1] == _NOT: - tokens[-1] += " " + token - else: - tokens.append(token) - token = "" - - if not marker: - return tokens - - char = marker[0] - if char in _BRACKETS: - state = _STATE.NONE - token = char - elif state == _STATE.STRING and char in _QUOTES: - state = _STATE.NONE - token = '"{}"'.format(token) - elif ( - (state == _STATE.VAR and not char.isalnum() and char != "_") or - (state == _STATE.OP and char not in _OPCHARS) - ): - state = _STATE.NONE - continue # Skip consuming the char below - elif state == _STATE.NONE: - # Transition from _STATE.NONE to something or stay in NONE - if char in _QUOTES: - state = _STATE.STRING - elif char.isalnum(): - state = _STATE.VAR - token += char - elif char in _OPCHARS: - state = _STATE.OP - token += char - elif char in _WSP: - state = _STATE.NONE - else: - fail("BUG: Cannot parse '{}' in {} ({})".format(char, state, marker)) + rest = marker + + # Anything can be in the strings, so find them and tokenize what is + # between them. Each iteration handles one string, which is at least 2 chars. + for _ in range(len(marker) // 2 + 1): + double = rest.find('"') + single = rest.find("'") + if double < 0 and single < 0: + break + + if single < 0 or (double >= 0 and double < single): + start, quote = double, '"' else: - token += char + start, quote = single, "'" - # Consume the char - marker = marker[1:] + end = rest.find(quote, start + 1) + if end < 0: + return None, "Unterminated string" - return fail("BUG: failed to process the marker in allocated cycles: {}".format(marker)) + err = _tokenize_unquoted(rest[:start], tokens) + if err: + return None, err -def evaluate(marker, *, env, strict = True, **kwargs): - """Evaluate the marker against a given env. + tokens.append(_quote(rest[start + 1:end])) + rest = rest[end + 1:] + + err = _tokenize_unquoted(rest, tokens) + if err: + return None, err + + return tokens, None + +def _quote(value): + return "'{}'".format(value) if '"' in value else '"{}"'.format(value) + +def _tokenize_unquoted(text, tokens): + """Tokenize the text that does not have strings. Args: - marker: {type}`str` The string marker to evaluate. - env: {type}`dict[str, str]` The environment to evaluate the marker against. - strict: {type}`bool` A setting to not fail on missing values in the env. - **kwargs: Extra kwargs to be passed to the expression evaluator. + text: {type}`str` The text to tokenize. + tokens: {type}`list[str]` The list to append the tokens to. Returns: - The {type}`bool | str` If the marker is compatible with the given env. If strict is - `False`, then the output type is `str` which will represent the remaining - expression that has not been evaluated. + {type}`str | None` the error message if the text is invalid. """ - tokens = tokenize(marker) + for word in text.replace("(", " ( ").replace(")", " ) ").replace("\t", " ").split(" "): + if not word: + continue + elif word == "in" and tokens and tokens[-1] == _NOT: + tokens[-1] = "not in" + elif word in ["(", ")"] or not word.strip(_OPERATOR_CHARS) or _is_name(word): + tokens.append(word) + else: + # There is no whitespace between the variable and the operator, + # e.g. `os_name==` or `<=python_version`. + name = word.strip(_OPERATOR_CHARS) + if not _is_name(name): + return "Cannot parse '{}'".format(word) - ast = _new_expr(marker = marker, **kwargs) - for _ in range(len(tokens) * 2): - if not tokens: - break + before, _, after = word.partition(name) + tokens.extend([token for token in [before, name, after] if token]) - tokens = ast.parse(env = env, tokens = tokens, strict = strict) - - if not tokens: - return ast.value() - - fail("Could not evaluate: {}".format(marker)) - -_STRING_REPLACEMENTS = { - "!=": "neq", - "(": "_", - ")": "_", - "<": "lt", - "<=": "lteq", - "==": "eq", - "===": "eeq", - ">": "gt", - ">=": "gteq", - "not in": "not_in", - "~==": "cmp", -} + return None + +def _is_name(word): + return word[0].isalnum() and word.replace("_", "").replace(".", "").isalnum() + +def parse(marker): + """Parse the marker, so that it can be evaluated many times. + + Use this if the same marker is evaluated for many environments, because + parsing the marker takes about as long as evaluating it. + + Args: + marker: {type}`str` The marker to parse. + + Returns: + An opaque value that can be passed to {obj}`evaluate` instead of the marker. + """ + parsed, err = _parse(marker) + if err: + fail(_error(err, marker)) + + return parsed + +def _parse(marker): + """Parse the marker. + + Returns: + A tuple of the parsed marker and an error message, where one of them + is None. The parsed marker is the list of tokens, where each + ` ` expression is replaced with the + struct that is returned by `_parse_expr`. + """ + tokens, err = _tokenize(marker) + if err: + return None, err + + parsed = [] + depth = 0 + want_operand = True + skip = 0 + for i, token in enumerate(tokens): + if skip: + skip -= 1 + continue + elif not want_operand: + if token == ")": + depth -= 1 + elif token in [_AND, _OR]: + want_operand = True + else: + return None, "Expected 'and', 'or' or ')', but got '{}'".format(token) + elif token == "(": + depth += 1 + elif token == _NOT: + # NOTE: the spec does not have the `not` operator, it is our extension. + pass + else: + token, err = _parse_expr(tokens[i:i + 3]) + if err: + return None, err + skip = 2 + want_operand = False + + if depth < 0: + return None, "Unbalanced ')'" + parsed.append(token) + + if tokens and want_operand: + return None, "Unexpected end" + if depth: + return None, "Unbalanced '('" + + return parsed, None + +def _parse_expr(tokens): + """Parse ` ` or ` `. + + The grammar also allows comparing two variables or two strings, but + nothing needs that and `packaging` does not evaluate those correctly, so + they are not supported. + + Returns: + A tuple of the parsed expression and an error message, where one of + them is None. + """ + if len(tokens) != 3 or tokens[1] not in _OPERATORS: + return None, "Expected ' ' at '{}'".format(" ".join(tokens)) + + left, op, right = tokens + value_is_left = left[0] in "\"'" + if value_is_left == (right[0] in "\"'"): + return None, "Expected a variable and a quoted string at '{}'".format(" ".join(tokens)) -def to_string(marker): - return "_".join([ - _STRING_REPLACEMENTS.get(t, t) - for t in tokenize(marker) - ]).replace("\"", "") + name, value = (right, left[1:-1]) if value_is_left else (left, right[1:-1]) + name = _VARIABLE_ALIASES.get(name, name) + if name not in _VARIABLES: + return None, "Unknown variable '{}'".format(name) -def _and_fn(x, y): - """Our custom `and` evaluation function. + is_version = _VARIABLES[name] + return struct( + name = name, + op = op, + value = value, + value_is_left = value_is_left, + is_version = is_version, + # The variable is the specifier if the value is on the left. + specifier = _specifier(op, value) if is_version and not value_is_left else None, + # For returning the expressions that cannot be evaluated. + string = " ".join(tokens), + ), None + +def evaluate(marker, *, env, strict = True, _fail = fail): + """Evaluate the marker against a given env. + + Args: + marker: {type}`str` The marker to evaluate or the value returned by + {obj}`parse`. + env: {type}`dict[str, str]` The values of the variables. If it has + the `_aliases` key, then its value is a dict of functions to + normalize the strings that the variables are compared with, which + is how e.g. `platform_machine == "arm64"` is true for `aarch64`. + strict: {type}`bool` Whether to fail if a variable is not in the + `env`. If it is `False`, then the expressions with such variables + are not evaluated. + _fail: Used for tests - The values are either bools or strings, which are the expressions that - could not be evaluated because `marker_expr` was set to `strict = False`. + Returns: + {type}`bool | str` Whether the marker is compatible with the `env`. If + `strict` is `False` and the result depends on the variables that are + not in the `env`, then the marker with only those variables is + returned. """ + if type(marker) == "string": + parsed, err = _parse(marker) + if err: + return _fail(_error(err, marker)) + else: + parsed = marker + + # Starlark does not have recursion, hence there is a stack with a frame + # for each open parenthesis. Because `not` binds tighter than `and`, which + # binds tighter than `or`, a frame is: + # * The value of the `or` operands that we have seen so far. + # * The value of the `and` operands that we have seen since the last `or`. + # * The number of `not` to apply to the next operand. + frame = [False, True, 0] + stack = [frame] + for token in parsed: + if token == _AND: + continue + elif type(token) == "struct": + value = _evaluate_expr(token, env, strict, _fail) + elif token == _OR: + frame[0] = _or(frame[0], frame[1]) + frame[1] = True + continue + elif token == _NOT: + frame[2] += 1 + continue + elif token == "(": + frame = [False, True, 0] + stack.append(frame) + continue + else: # token == ")" + stack.pop() + value = _or(frame[0], frame[1]) + if type(value) == "string": + value = "({})".format(value) + frame = stack[-1] + + for _ in range(frame[2]): + value = "not {}".format(value) if type(value) == "string" else not value + frame[2] = 0 + frame[1] = _and(frame[1], value) + + return _or(frame[0], frame[1]) + +# The operands of `_and` and `_or` are either bools or strings, which are the +# expressions that could not be evaluated because `strict = False`. + +def _and(x, y): if x == False or y == False: return False elif x == True: @@ -175,12 +347,7 @@ def _and_fn(x, y): else: return "{} and {}".format(x, y) -def _or_fn(x, y): - """Our custom `or` evaluation function. - - The values are either bools or strings, which are the expressions that - could not be evaluated because `marker_expr` was set to `strict = False`. - """ +def _or(x, y): if x == True or y == True: return True elif x == False: @@ -190,131 +357,40 @@ def _or_fn(x, y): else: return "{} or {}".format(x, y) -def _not_fn(x): - """Our custom `not` evaluation function. +def _evaluate_expr(expr, env, strict, _fail): + """Evaluate the expression that is returned by `_parse_expr`. - Allow partial evaluation if the value is a string. + Returns: + {type}`bool | str` the result or the expression itself if the variable + is not in the `env` and `strict` is `False`. """ - if type(x) == type(""): - return "not {}".format(x) - else: - return not x - -def _new_expr( - *, - marker, - and_fn = _and_fn, - or_fn = _or_fn, - not_fn = _not_fn): - # buildifier: disable=uninitialized - self = struct( - marker = marker, - tree = [], - parse = lambda **kwargs: _parse(self, **kwargs), - value = lambda: _value(self), - # This is a way for us to have a handle to the currently constructed - # expression tree branch. - current = lambda: self._current[-1] if self._current else None, - _current = [], - _and = and_fn, - _or = or_fn, - _not = not_fn, - ) - return self - -def _parse(self, *, env, tokens, strict = False): - """The parse function takes the consumed tokens and returns the remaining.""" - token, remaining = tokens[0], tokens[1:] - - if token == "(": - expr = _open_parenthesis(self) - elif token == ")": - expr = _close_parenthesis(self) - elif token == _AND: - expr = _and_expr(self) - elif token == _OR: - expr = _or_expr(self) - elif token == _NOT: - expr = _not_expr(self) - else: - expr = marker_expr(env = env, strict = strict, *tokens[:3]) - remaining = tokens[3:] - - _append(self, expr) - return remaining - -def _value(self): - """Evaluate the expression tree""" - if not self.tree: - # Basic case where no marker should evaluate to True - return True - - for _ in range(len(self.tree)): - if len(self.tree) == 1: - return self.tree[0] - - # Resolve all of the `or` expressions as it is safe to do now since all - # `and` and `not` expressions have been taken care of by now. - if getattr(self.tree[-2], "op", None) == _OR: - current = self.tree.pop() - self.tree[-1] = self.tree[-1].value(current) + if expr.name not in env: + if not strict: + return expr.string + + return _fail("The variable '{}' is not in the environment, cannot evaluate: {}".format( + expr.name, + expr.string, + )) + + env_value = env[expr.name] + if expr.is_version: + if expr.value_is_left: + return _version_expr(expr.value, expr.op, env_value, _specifier(expr.op, env_value), _fail) else: - break - - fail("BUG: invalid state: {}".format(self.tree)) - -def marker_expr(left, op, right, *, env, strict = True): - """Evaluate a marker expression + return _version_expr(env_value, expr.op, expr.value, expr.specifier, _fail) - Args: - left: {type}`str` the env identifier or a value quoted in `"`. - op: {type}`str` the operation to carry out. - right: {type}`str` the env identifier or a value quoted in `"`. - strict: {type}`bool` if false, only evaluates the values that are present - in the environment, otherwise returns the original expression. - env: {type}`dict[str, str]` the `env` to substitute `env` identifiers in - the ` ` expression. Note, if `env` has a key - "_aliases", then we will do normalization so that we can ensure - that e.g. `aarch64` evaluation in the `platform_machine` works the - same way irrespective if the marker uses `arm64` or `aarch64` value - in the expression. - - Returns: - {type}`bool` if the expression evaluation result or {type}`str` if the expression - could not be evaluated. - """ - var_name = None - if right not in env and left not in env and not strict: - return "{} {} {}".format(left, op, right) - if left[0] == '"': - var_name = right - right = env[right] - left = left.strip("\"") - - if _ENV_ALIASES in env: - # Normalize the literal value using per-variable normalization - # functions. This handles platform aliases (e.g. arm64 -> aarch64) - # and PEP 685 extra name normalization (e.g. db-backend -> db_backend). - left = env.get(_ENV_ALIASES, {}).get(var_name, lambda x: x)(left) + value = expr.value + normalize = env.get(_ENV_ALIASES, {}).get(expr.name) + if normalize: + value = normalize(value) + if expr.value_is_left: + return _string_expr(value, expr.op, env_value, _fail) else: - var_name = left - left = env[left] - right = right.strip("\"") - - if _ENV_ALIASES in env: - # See the note above on normalization - right = env.get(_ENV_ALIASES, {}).get(var_name, lambda x: x)(right) - - if var_name in _NON_VERSION_VAR_NAMES: - return _env_expr(left, op, right) - elif var_name.endswith("_version"): - return _version_expr(left, op, right) - else: - # Do not fail here, just evaluate the expression to False. - return False + return _string_expr(env_value, expr.op, value, _fail) -def _env_expr(left, op, right): +def _string_expr(left, op, right, _fail): """Evaluate a string comparison expression""" if op == "==": return left == right @@ -324,170 +400,67 @@ def _env_expr(left, op, right): return left in right elif op == "not in": return left not in right - elif op == "<": - return left < right - elif op == "<=": - return left <= right - elif op == ">": - return left > right - elif op == ">=": - return left >= right + elif op in ["<", ">"]: + # The ordered comparison is only defined for versions, which means + # that only the equality can be checked. + return False + elif op in ["<=", ">="]: + return left == right else: - return fail("unsupported op: '{}' {} '{}'".format(left, op, right)) - -def _version_expr(left, op, right): - """Evaluate a version comparison expression""" - _left = version.parse(left) - _right = version.parse(right) - if _left == None or _right == None: - # Per spec, if either can't be normalized to a version, then - # fallback to simple string comparison. Usually this is `platform_version` - # or `platform_release`, which vary depending on platform. - return _env_expr(left, op, right) + return _fail("The operator '{}' can only be used with versions: '{}' {} '{}'".format(op, left, op, right)) + +def _specifier(op, value): + """Parse the version of the `` version specifier. + Returns: + `None` if it is not a valid version specifier. Otherwise the string to + compare with for `===` and the parsed version for the other operators. + """ if op == "===": - return version.is_eeq(_left, _right) - elif op == "!=": - return version.is_ne(_left, _right) - elif op == "==": - return version.is_eq(_left, _right) - elif op == "<": - return version.is_lt(_left, _right) - elif op == ">": - return version.is_gt(_left, _right) - elif op == "<=": - return version.is_le(_left, _right) - elif op == ">=": - return version.is_ge(_left, _right) - elif op == "~=": - return version.is_compatible(_left, _right) + # The arbitrary equality accepts anything that can be in a list of + # specifiers, see + # https://packaging.python.org/en/latest/specifications/version-specifiers/#arbitrary-equality + value = value.strip().lower() + return None if [c for c in " \t\n;)".elems() if c in value] else value + elif op not in _VERSION_OPERATORS: + return None + + spec = version.parse(value) + if spec == None: + return None + elif op in ["==", "!="]: + return spec + elif spec.is_prefix or spec.local: + # Only the equality can be used with prefix matching or local versions. + return None + elif op == "~=" and len(spec.release) < 2: + return None else: - return False # Let's just ignore the invalid ops - -# Code to allowing to combine expressions with logical operators - -def _append(self, value): - if value == None: - return - - current = self.current() or self - op = getattr(value, "op", None) - - if op == _NOT: - current.tree.append(value) - elif op in [_AND, _OR]: - value.append(current.tree[-1]) - current.tree[-1] = value - elif not current.tree: - current.tree.append(value) - elif hasattr(current.tree[-1], "append"): - current.tree[-1].append(value) - elif hasattr(current.tree, "_append"): - current.tree._append(value) - else: - fail("Cannot evaluate '{}' in '{}', current: {}".format(value, self.marker, current)) - -def _open_parenthesis(self): - """Add an extra node into the tree to perform evaluate inside parenthesis.""" - self._current.append(_new_expr( - marker = self.marker, - and_fn = self._and, - or_fn = self._or, - not_fn = self._not, - )) - -def _close_parenthesis(self): - """Backtrack and evaluate the expression within parenthesis.""" - value = self._current.pop().value() - if type(value) == type(""): - return "({})".format(value) - else: - return value - -def _not_expr(self): - """Add an extra node into the tree to perform an 'not' operation.""" - - def _append(value): - """Append a value to the not expression node. - - This codifies `not` precedence over `and` and performs backtracking to - evaluate any `not` statements and forward the value to the first `and` - statement if needed. - """ - - current = self.current() or self - current.tree[-1] = self._not(value) - - for _ in range(len(current.tree)): - if not len(current.tree) > 1: - break - - op = getattr(current.tree[-2], "op", None) - if op == None: - pass - elif op == _NOT: - value = current.tree.pop() - current.tree[-1] = self._not(value) - continue - elif op == _AND: - value = current.tree.pop() - current.tree[-1].append(value) - elif op != _OR: - fail("BUG: '{} not' compound is unsupported".format(current.tree[-1])) - - break - - return struct( - op = _NOT, - append = _append, - ) + return spec -def _and_expr(self): - """Add an extra node into the tree to perform an 'and' operation""" - maybe_value = [None] +def _version_expr(left, op, right, specifier, _fail): + """Evaluate a version comparison expression. - def _append(value): - """Append a value to the and expression node. - - Here we backtrack, but we only evaluate the current `and` statement - - all of the `not` statements will be by now evaluated and `or` - statements need to be evaluated later. - """ - if maybe_value[0] == None: - maybe_value[0] = value - return - - current = self.current() or self - current.tree[-1] = self._and(maybe_value[0], value) - - return struct( - op = _AND, - append = _append, - # private fields that help debugging - _maybe_value = maybe_value, - ) - -def _or_expr(self): - """Add an extra node into the tree to perform an 'or' operation""" - maybe_value = [None] - - def _append(value): - """Append a value to the or expression node. - - Here we just append the extra values to the tree and the `or` - statements will be evaluated in the _value() function. - """ - if maybe_value[0] == None: - maybe_value[0] = value - return + Args: + left: {type}`str` The version to check. + op: {type}`str` The operator. + right: {type}`str` The version of the specifier. + specifier: The result of `_specifier(op, right)`. + _fail: The function to report the errors with. - current = self.current() or self - current.tree.append(value) + Returns: + {type}`bool` + """ + if specifier == None: + # Per spec, if it is not a valid version specifier, then fallback to + # the string comparison. + return _string_expr(left, op, right, _fail) + elif op == "===": + return left.strip().lower() == specifier + + candidate = version.parse(left) + if candidate == None or candidate.is_prefix: + # Something that is not a version cannot match a version specifier. + return False - return struct( - op = _OR, - value = lambda x: self._or(maybe_value[0], x), - append = _append, - # private fields that help debugging - _maybe_value = maybe_value, - ) + return _VERSION_OPERATORS[op](candidate, specifier) diff --git a/tests/perf/BUILD.bazel b/tests/perf/BUILD.bazel index bbbe3eb44b..4a198cd04f 100644 --- a/tests/perf/BUILD.bazel +++ b/tests/perf/BUILD.bazel @@ -13,7 +13,6 @@ py_library( ], data = [ "workloads.bzl", - "//python/private:enum.bzl", "//python/private:version.bzl", "//python/private/pypi:bzl", ], diff --git a/tests/perf/README.md b/tests/perf/README.md index ad582515fb..ace9113bc1 100644 --- a/tests/perf/README.md +++ b/tests/perf/README.md @@ -80,14 +80,17 @@ The time is of Bazel 9.1.1 on a laptop, only the ratios are meaningful. | Workload | Steps | Bazel, µs | |---|---:|---:| -| `evaluate_long` | 6376 | 781.4 | -| `evaluate_non_strict` | 703 | 74.2 | -| `evaluate_string` | 362 | 34.9 | -| `evaluate_two_strings` | 750 | 81.3 | -| `evaluate_version` | 525 | 69.9 | -| `tokenize_long` | 4870 | 424.0 | -| `tokenize_no_whitespace` | 563 | 49.6 | -| `tokenize_version` | 305 | 27.5 | +| `evaluate_long` | 1974 | 383.6 | +| `evaluate_long_parsed` | 693 | 114.1 | +| `evaluate_non_strict` | 286 | 58.4 | +| `evaluate_string` | 122 | 24.5 | +| `evaluate_two_strings` | 229 | 43.0 | +| `evaluate_version` | 283 | 56.4 | +| `evaluate_version_parsed` | 132 | 21.3 | +| `parse_long` | 1284 | 231.5 | +| `tokenize_long` | 514 | 112.9 | +| `tokenize_no_whitespace` | 84 | 23.0 | +| `tokenize_version` | 48 | 10.8 | | `version_is_compatible` | 64 | 8.6 | | `version_is_eq_prefix` | 10 | 2.5 | | `version_is_ge` | 54 | 6.2 | @@ -109,3 +112,9 @@ The notable changes of the results, the numbers are the steps. | Parse the release-only versions without the parser | `version_parse_release` | 881 | 53 | | | `evaluate_version` | 1975 | 525 | | | `evaluate_long` | 11056 | 6376 | +| Rewrite the marker evaluation | `tokenize_long` | 4870 | 514 | +| | `evaluate_string` | 362 | 122 | +| | `evaluate_version` | 525 | 283 | +| | `evaluate_long` | 6376 | 1974 | +| Evaluate the markers that are parsed with `parse` | `evaluate_version_parsed` | 283 | 132 | +| | `evaluate_long_parsed` | 1974 | 693 | diff --git a/tests/perf/steps_test.py b/tests/perf/steps_test.py index 8a4e10e81e..3fb53383d6 100644 --- a/tests/perf/steps_test.py +++ b/tests/perf/steps_test.py @@ -9,14 +9,17 @@ # numbers with the output of `bazel run //tests/perf:benchmark`. _STEPS = { # keep sorted - "evaluate_long": 6376, - "evaluate_non_strict": 703, - "evaluate_string": 362, - "evaluate_two_strings": 750, - "evaluate_version": 525, - "tokenize_long": 4870, - "tokenize_no_whitespace": 563, - "tokenize_version": 305, + "evaluate_long": 1974, + "evaluate_long_parsed": 693, + "evaluate_non_strict": 286, + "evaluate_string": 122, + "evaluate_two_strings": 229, + "evaluate_version": 283, + "evaluate_version_parsed": 132, + "parse_long": 1284, + "tokenize_long": 514, + "tokenize_no_whitespace": 84, + "tokenize_version": 48, "version_is_compatible": 64, "version_is_eq_prefix": 10, "version_is_ge": 54, diff --git a/tests/perf/workloads.bzl b/tests/perf/workloads.bzl index 74fa9f562e..ef17a480b0 100644 --- a/tests/perf/workloads.bzl +++ b/tests/perf/workloads.bzl @@ -1,7 +1,7 @@ """The workloads that are measured by the benchmarks and the steps test.""" load("//python/private:version.bzl", "version") # buildifier: disable=bzl-visibility -load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "tokenize") # buildifier: disable=bzl-visibility +load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "parse", "tokenize") # buildifier: disable=bzl-visibility _ENV = { "extra": "foo", @@ -27,6 +27,8 @@ _LONG_MARKER = ( " and platform_machine != 'x86_64' and sys_platform == 'linux')" + " or sys_platform == 'darwin' or sys_platform == 'win32'" ) +_PARSED_LONG_MARKER = parse(_LONG_MARKER) +_PARSED_VERSION_MARKER = parse("python_version >= '3.8'") _V_3_8 = version.parse("3.8") _V_3_11_4 = version.parse("3.11.4") @@ -35,6 +37,7 @@ _V_3_11_PREFIX = version.parse("3.11.*") WORKLOADS = { # keep sorted "evaluate_long": lambda: evaluate(_LONG_MARKER, env = _ENV), + "evaluate_long_parsed": lambda: evaluate(_PARSED_LONG_MARKER, env = _ENV), "evaluate_non_strict": lambda: evaluate( "python_version < '3.11' and extra == 'dev'", env = {"extra": "dev"}, @@ -43,6 +46,8 @@ WORKLOADS = { "evaluate_string": lambda: evaluate("sys_platform == 'win32'", env = _ENV), "evaluate_two_strings": lambda: evaluate("os_name == 'posix' and sys_platform == 'linux'", env = _ENV), "evaluate_version": lambda: evaluate("python_version >= '3.8'", env = _ENV), + "evaluate_version_parsed": lambda: evaluate(_PARSED_VERSION_MARKER, env = _ENV), + "parse_long": lambda: parse(_LONG_MARKER), "tokenize_long": lambda: tokenize(_LONG_MARKER), "tokenize_no_whitespace": lambda: tokenize("python_version>='3.8' and os_name=='posix'"), "tokenize_version": lambda: tokenize("python_version >= '3.8'"), diff --git a/tests/pypi/pep508/BUILD.bazel b/tests/pypi/pep508/BUILD.bazel index 36fce0fa89..a65fffefa3 100644 --- a/tests/pypi/pep508/BUILD.bazel +++ b/tests/pypi/pep508/BUILD.bazel @@ -1,8 +1,14 @@ load(":deps_tests.bzl", "deps_test_suite") load(":env_tests.bzl", "env_test_suite") load(":evaluate_tests.bzl", "evaluate_test_suite") +load(":packaging_conformance_tests.bzl", "packaging_conformance_test_suite") load(":requirement_tests.bzl", "requirement_test_suite") +exports_files( + ["packaging_cases.bzl"], + visibility = ["//tests/support/pypa_packaging:__pkg__"], +) + deps_test_suite( name = "deps_tests", ) @@ -15,6 +21,10 @@ evaluate_test_suite( name = "evaluate_tests", ) +packaging_conformance_test_suite( + name = "packaging_conformance_tests", +) + requirement_test_suite( name = "requirement_tests", ) diff --git a/tests/pypi/pep508/evaluate_tests.bzl b/tests/pypi/pep508/evaluate_tests.bzl index 9145a9cf8f..5b521d5ccf 100644 --- a/tests/pypi/pep508/evaluate_tests.bzl +++ b/tests/pypi/pep508/evaluate_tests.bzl @@ -15,7 +15,7 @@ load("@rules_testing//lib:test_suite.bzl", "test_suite") load("//python/private/pypi:pep508_env.bzl", pep508_env = "env") # buildifier: disable=bzl-visibility -load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "tokenize") # buildifier: disable=bzl-visibility +load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "parse", "tokenize") # buildifier: disable=bzl-visibility _tests = [] @@ -30,6 +30,7 @@ def _tokenize_tests(env): "": [], "'osx' == os_name": ['"osx"', "==", "os_name"], "'x' not in os_name": ['"x"', "not in", "os_name"], + "('arm' in platform_machine)": ["(", '"arm"', "in", "platform_machine", ")"], "()": ["(", ")"], "(os_name == 'osx' and not os_name == 'posix') or os_name == \"win\"": [ "(", @@ -48,8 +49,25 @@ def _tokenize_tests(env): '"win"', ], "os_name\t==\t'osx'": ["os_name", "==", '"osx"'], + "os_name == \"it's\"": ["os_name", "==", '"it\'s"'], "os_name == 'osx'": ["os_name", "==", '"osx"'], + "platform.version == '#1 SMP (Debian)'": ["platform.version", "==", '"#1 SMP (Debian)"'], "python_version <= \"1.0\"": ["python_version", "<=", '"1.0"'], + "python_version<'3'and(os_name=='nt'or os_name!='nt')": [ + "python_version", + "<", + '"3"', + "and", + "(", + "os_name", + "==", + '"nt"', + "or", + "os_name", + "!=", + '"nt"', + ")", + ], "python_version>='1.0.0'": ["python_version", ">=", '"1.0.0"'], "python_version~='1.0.0'": ["python_version", "~=", '"1.0.0"'], }.items(): @@ -58,14 +76,47 @@ def _tokenize_tests(env): _tests.append(_tokenize_tests) +def _evaluate_invalid_tests(env): + for input in [ + "(", + ")", + "()", + "(())", + "(os_name == 'posix'", + "os_name == 'posix')", + "and os_name == 'posix'", + "not", + "os_name", + "os_name 'posix'", + "os_name <> 'posix'", + "os_name = 'posix'", + "os_name ==", + "os_name == 'posix", + "os_name == 'posix\"", + "os_name == 'posix' and", + "os_name == 'posix' and and os_name == 'posix'", + "os_name == 'posix' or or os_name == 'posix'", + "os_name == 'posix' os_name == 'posix'", + "os_name == 'posix'\n", + "os_name == posix", + "'posix' == 'posix'", + "unknown_variable == 'posix'", + # The variables that are not in the spec are invalid even if they are in the env. + "in_env == 'posix'", + ]: + got = evaluate(input, env = {"in_env": "posix", "os_name": "posix"}, _fail = lambda _: "invalid") + env.expect.where(expression = input).that_str(str(got)).equals("invalid") + +_tests.append(_evaluate_invalid_tests) + def _evaluate_non_version_env_tests(env): for var_name in [ "implementation_name", "os_name", "platform_machine", "platform_python_implementation", - "platform_release", "platform_system", + "platform_version", "sys_platform", "extra", ]: @@ -100,7 +151,7 @@ def _evaluate_version_env_tests(env): for var_name in [ "python_version", "implementation_version", - "platform_version", + "platform_release", "python_full_version", ]: # Given @@ -135,11 +186,65 @@ def _evaluate_version_env_tests(env): _tests.append(_evaluate_version_env_tests) -def _evaluate_platform_version_is_special(env): +def _evaluate_version_as_string_tests(env): + marker_env = {"python_version": "3.11"} + for input, want in { + # The operators that are only defined for strings + "'3.1' in python_version": True, + "'3.9' in python_version": False, + "python_version in '3.10 3.11'": True, + "python_version not in '3.11'": False, + "python_version not in '3.9'": True, + # Not valid version specifiers, so they are compared as strings + "python_version == 'foo'": False, + "python_version != 'foo'": True, + "python_version >= '3.*'": False, + "python_version >= '3.11+local'": False, + "python_version < 'foo'": False, + # Arbitrary equality + "python_version === '3.11'": True, + "python_version === '3.11.0'": False, + }.items(): # buildifier: @unsorted-dict-items + _check_evaluate(env, input, want, marker_env) + + # Something that is not a version does not match any version specifier. + for input in [ + "python_version == '3.11'", + "python_version != '3.11'", + "python_version >= '3.11'", + ]: + _check_evaluate(env, input, False, {"python_version": "foo"}) + +_tests.append(_evaluate_version_as_string_tests) + +def _evaluate_deprecated_names_tests(env): + marker_env = { + "os_name": "posix", + "platform_machine": "x86_64", + "platform_python_implementation": "CPython", + "platform_version": "#1 SMP", + "sys_platform": "linux", + } + for input, want in { + "os.name == 'posix'": True, + "platform.machine != 'x86_64'": False, + "platform.python_implementation == 'CPython'": True, + "platform.version == '#1 SMP'": True, + "python_implementation == 'CPython'": True, + "sys.platform == 'linux'": True, + }.items(): + _check_evaluate(env, input, want, marker_env) + + # The original name is kept when the expression cannot be evaluated. + _check_evaluate(env, input, input.replace("'", '"'), {}, strict = False) + +_tests.append(_evaluate_deprecated_names_tests) + +def _evaluate_platform_version_is_a_string(env): # Given marker_env = {"platform_version": "FooBar Linux v1.2.3"} - # When the platform version is not + # When the platform version is not a version input = "platform_version == '0'" _check_evaluate(env, input, False, marker_env) @@ -151,14 +256,12 @@ def _evaluate_platform_version_is_special(env): # env is supplied. _check_evaluate(env, input, input.replace("'", '"'), {}, strict = False) -_tests.append(_evaluate_platform_version_is_special) +_tests.append(_evaluate_platform_version_is_a_string) def _logical_expression_tests(env): for input, want in { # Basic "": True, - "(())": True, - "()": True, # expr "os_name == 'fo'": False, @@ -202,14 +305,9 @@ def _logical_expression_tests(env): }.items(): # buildifier: @unsorted-dict-items _check_evaluate(env, input, want, {"os_name": "foo"}) - if not input.strip("()"): - # These cases will just return True, because they will be evaluated - # and the brackets will be processed. - continue - # Check that the non-strict eval gives us back the input when no env # is supplied. - _check_evaluate(env, input, input.replace("'", '"'), {}, strict = False) + _check_evaluate(env, input, input.replace("'", '"') or True, {}, strict = False) _tests.append(_logical_expression_tests) @@ -268,6 +366,63 @@ def _evaluate_with_aliases(env): _tests.append(_evaluate_with_aliases) +def _evaluate_parsed_tests(env): + marker = parse("python_version >= '3.10' and (sys_platform == 'linux' or extra == 'foo')") + for values, want in [ + ({"python_version": "3.9", "sys_platform": "linux"}, False), + ({"python_version": "3.10", "sys_platform": "linux"}, True), + ({"python_version": "3.11", "sys_platform": "win32"}, "(extra == \"foo\")"), + ({"extra": "foo", "python_version": "3.11", "sys_platform": "win32"}, True), + ({"extra": "foo", "sys_platform": "win32"}, "python_version >= \"3.10\""), + ]: + got = evaluate(marker, env = values, strict = False) + env.expect.where(values = values).that_bool(got).equals(want) + +_tests.append(_evaluate_parsed_tests) + +def _evaluate_partial_roundtrip_tests(env): + """Evaluating what could not be evaluated must give the same result.""" + full_env = { + "extra": "foo", + "os_name": "posix", + "platform_version": "a \"b\" c", + "python_version": "3.11", + "sys_platform": "linux", + } + partial_envs = [ + {k: v for k, v in full_env.items() if k not in missing} + for missing in [ + ["extra"], + ["os_name", "sys_platform"], + ["platform_version", "python_version"], + full_env.keys(), + ] + ] + for marker in [ + "extra == 'foo' or os_name == 'nt'", + "extra == 'bar' or os_name == 'nt'", + "(extra == 'foo' or os_name == 'nt') and sys_platform == 'linux'", + "(extra == 'bar' or os_name == 'posix') and python_version < '3.11'", + "extra == 'foo' and (os_name == 'nt' or python_version >= '3.8')", + "not (extra == 'foo' or os_name == 'nt') or sys_platform == 'linux'", + "not extra == 'bar' and not os_name == 'nt'", + "platform_version == 'a \"b\" c' and extra == 'foo'", + "platform_version == \"it's\" or python_version >= '3.8' and os_name == 'posix'", + ]: + want = evaluate(marker, env = full_env) + for partial_env in partial_envs: + got = evaluate(marker, env = partial_env, strict = False) + where = env.expect.where(marker = marker, env = partial_env, partial = got) + + # Guard against returning a marker that is always true instead + # of `True`, which is what we used to do. + where.that_bool(got in ["", "()"]).equals(False) + if type(got) == "string": + got = evaluate(got, env = full_env) + where.that_bool(got).equals(want) + +_tests.append(_evaluate_partial_roundtrip_tests) + def _expr_case(expr, want, env): return struct(expr = expr.strip(), want = want, env = env) @@ -286,7 +441,8 @@ _MISC_EXPRESSIONS = [ _expr_case('python_version > "1.7.post2"', True, {"python_version": "1.7.post3"}), _expr_case('python_version > "1.7.post2"', False, {"python_version": "1.7.0"}), _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.1"}), - _expr_case('python_version > "1.7.1+local"', True, {"python_version": "1.7.2"}), + # Not a valid version specifier, so it is not compared as a version + _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.2"}), # Extra cases for the '<' operator _expr_case('python_version < "1.7.1"', False, {"python_version": "1.7.2"}), _expr_case('python_version < "1.7.3"', True, {"python_version": "1.7.2"}), diff --git a/tests/pypi/pep508/packaging_cases.bzl b/tests/pypi/pep508/packaging_cases.bzl new file mode 100644 index 0000000000..8ac7570da1 --- /dev/null +++ b/tests/pypi/pep508/packaging_cases.bzl @@ -0,0 +1,1235 @@ +"""Conformance test cases generated from `packaging==26.3`. + +GENERATED FILE, DO NOT EDIT. Update with: + + bazel run //tests/support/pypa_packaging:update +""" + +# The (name, value) of the default environment for the cases below. +MARKER_ENV = [ + ("extra", "foo"), + ("implementation_name", "cpython"), + ("implementation_version", "3.11.4"), + ("os_name", "posix"), + ("platform_machine", "x86_64"), + ("platform_python_implementation", "CPython"), + ("platform_release", "6.1.0"), + ("platform_system", "Linux"), + ("platform_version", "#1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29)"), + ("python_full_version", "3.11.4"), + ("python_version", "3.11"), + ("sys_platform", "linux"), +] + +# (marker, JSON of the environment overrides, expected) +EVALUATE_CASES = [ + ("os_name == 'foo'", "{\"os_name\": \"foo\"}", True), + ("os_name == 'foo'", "{\"os_name\": \"bar\"}", False), + ("'2.7' in python_version", "{\"python_version\": \"2.7.5\"}", True), + ("'2.7' not in python_version", "{\"python_version\": \"2.7\"}", False), + ("os_name == 'foo' and python_version ~= '2.7.0'", "{\"os_name\": \"foo\", \"python_version\": \"2.7.6\"}", True), + ("python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')", "{\"os_name\": \"foo\", \"python_version\": \"2.7.4\"}", True), + ("python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')", "{\"os_name\": \"bar\", \"python_version\": \"2.7.4\"}", True), + ("python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')", "{\"os_name\": \"other\", \"python_version\": \"2.7.4\"}", False), + ("extra == 'security'", "{\"extra\": \"quux\"}", False), + ("extra == 'security'", "{\"extra\": \"security\"}", True), + ("extra == 'SECURITY'", "{\"extra\": \"security\"}", True), + ("extra == 'security'", "{\"extra\": \"SECURITY\"}", True), + ("extra == 'pep-685-norm'", "{\"extra\": \"PEP_685...norm\"}", True), + ("extra == 'Different.punctuation..is...equal'", "{\"extra\": \"different__punctuation_is_EQUAL\"}", True), + ("sys.platform == 'win32'", "{\"sys_platform\": \"linux2\"}", False), + ("platform.version in 'Ubuntu'", "{\"platform_version\": \"#39\"}", False), + ("platform.machine=='x86_64'", "{\"platform_machine\": \"x86_64\"}", True), + ("platform.python_implementation=='Jython'", "{\"platform_python_implementation\": \"CPython\"}", False), + ("python_version == '2.5' and platform.python_implementation!= 'Jython'", "{\"python_version\": \"2.7\"}", False), + ("extra == \"v2\"", "{\"extra\": \"\"}", False), + ("extra == \"v2\"", "{\"extra\": \"v2\"}", True), + ("extra == \"v2\"", "{\"extra\": \"v2a3\"}", False), + ("extra == \"v2a3\"", "{\"extra\": \"v2\"}", False), + ("extra == \"v2a3\"", "{\"extra\": \"v2a3\"}", True), +] + +# Strings that are not valid markers. +INVALID_MARKERS = [ + "this_isnt_a_real_variable >= '1.0'", + "python_version", + "(python_version)", + "python_version >= 1.0 and (python_version)", + "(python_version == \"2.7\" and os_name == \"linux\"", + "(python_version == \"2.7\") with random text", + "python_version >= \"3\"\n", + "python_version >= \"3\"\r", + "python_version >= \"3\"\r\n", +] + +# (variable, operator, value, results); the results are T/F/E(rror) for +# ` ` and ` `. +MARKER_TABLE = [ + ("extra", "===", "1.0", "EE"), + ("extra", "===", "5.6a0", "EE"), + ("extra", "===", "dog", "EE"), + ("extra", "===", "freebsd", "EE"), + ("extra", "===", "literally any string can go here", "EE"), + ("extra", "===", "things @#4 dsfd (((", "EE"), + ("extra", "==", "1.0", "FF"), + ("extra", "==", "5.6a0", "FF"), + ("extra", "==", "dog", "FF"), + ("extra", "==", "freebsd", "FF"), + ("extra", "==", "literally any string can go here", "FF"), + ("extra", "==", "things @#4 dsfd (((", "FF"), + ("extra", ">=", "1.0", "FF"), + ("extra", ">=", "5.6a0", "FF"), + ("extra", ">=", "dog", "FF"), + ("extra", ">=", "freebsd", "FF"), + ("extra", ">=", "literally any string can go here", "FF"), + ("extra", ">=", "things @#4 dsfd (((", "FF"), + ("extra", "<=", "1.0", "FF"), + ("extra", "<=", "5.6a0", "FF"), + ("extra", "<=", "dog", "FF"), + ("extra", "<=", "freebsd", "FF"), + ("extra", "<=", "literally any string can go here", "FF"), + ("extra", "<=", "things @#4 dsfd (((", "FF"), + ("extra", "!=", "1.0", "TT"), + ("extra", "!=", "5.6a0", "TT"), + ("extra", "!=", "dog", "TT"), + ("extra", "!=", "freebsd", "TT"), + ("extra", "!=", "literally any string can go here", "TT"), + ("extra", "!=", "things @#4 dsfd (((", "TT"), + ("extra", "~=", "1.0", "EE"), + ("extra", "~=", "5.6a0", "EE"), + ("extra", "~=", "dog", "EE"), + ("extra", "~=", "freebsd", "EE"), + ("extra", "~=", "literally any string can go here", "EE"), + ("extra", "~=", "things @#4 dsfd (((", "EE"), + ("extra", ">", "1.0", "FF"), + ("extra", ">", "5.6a0", "FF"), + ("extra", ">", "dog", "FF"), + ("extra", ">", "freebsd", "FF"), + ("extra", ">", "literally any string can go here", "FF"), + ("extra", ">", "things @#4 dsfd (((", "FF"), + ("extra", "<", "1.0", "FF"), + ("extra", "<", "5.6a0", "FF"), + ("extra", "<", "dog", "FF"), + ("extra", "<", "freebsd", "FF"), + ("extra", "<", "literally any string can go here", "FF"), + ("extra", "<", "things @#4 dsfd (((", "FF"), + ("extra", "in", "1.0", "FF"), + ("extra", "in", "5.6a0", "FF"), + ("extra", "in", "dog", "FF"), + ("extra", "in", "freebsd", "FF"), + ("extra", "in", "literally any string can go here", "FF"), + ("extra", "in", "things @#4 dsfd (((", "FF"), + ("extra", "not in", "1.0", "TT"), + ("extra", "not in", "5.6a0", "TT"), + ("extra", "not in", "dog", "TT"), + ("extra", "not in", "freebsd", "TT"), + ("extra", "not in", "literally any string can go here", "TT"), + ("extra", "not in", "things @#4 dsfd (((", "TT"), + ("implementation_name", "===", "1.0", "EE"), + ("implementation_name", "===", "5.6a0", "EE"), + ("implementation_name", "===", "dog", "EE"), + ("implementation_name", "===", "freebsd", "EE"), + ("implementation_name", "===", "literally any string can go here", "EE"), + ("implementation_name", "===", "things @#4 dsfd (((", "EE"), + ("implementation_name", "==", "1.0", "FF"), + ("implementation_name", "==", "5.6a0", "FF"), + ("implementation_name", "==", "dog", "FF"), + ("implementation_name", "==", "freebsd", "FF"), + ("implementation_name", "==", "literally any string can go here", "FF"), + ("implementation_name", "==", "things @#4 dsfd (((", "FF"), + ("implementation_name", ">=", "1.0", "FF"), + ("implementation_name", ">=", "5.6a0", "FF"), + ("implementation_name", ">=", "dog", "FF"), + ("implementation_name", ">=", "freebsd", "FF"), + ("implementation_name", ">=", "literally any string can go here", "FF"), + ("implementation_name", ">=", "things @#4 dsfd (((", "FF"), + ("implementation_name", "<=", "1.0", "FF"), + ("implementation_name", "<=", "5.6a0", "FF"), + ("implementation_name", "<=", "dog", "FF"), + ("implementation_name", "<=", "freebsd", "FF"), + ("implementation_name", "<=", "literally any string can go here", "FF"), + ("implementation_name", "<=", "things @#4 dsfd (((", "FF"), + ("implementation_name", "!=", "1.0", "TT"), + ("implementation_name", "!=", "5.6a0", "TT"), + ("implementation_name", "!=", "dog", "TT"), + ("implementation_name", "!=", "freebsd", "TT"), + ("implementation_name", "!=", "literally any string can go here", "TT"), + ("implementation_name", "!=", "things @#4 dsfd (((", "TT"), + ("implementation_name", "~=", "1.0", "EE"), + ("implementation_name", "~=", "5.6a0", "EE"), + ("implementation_name", "~=", "dog", "EE"), + ("implementation_name", "~=", "freebsd", "EE"), + ("implementation_name", "~=", "literally any string can go here", "EE"), + ("implementation_name", "~=", "things @#4 dsfd (((", "EE"), + ("implementation_name", ">", "1.0", "FF"), + ("implementation_name", ">", "5.6a0", "FF"), + ("implementation_name", ">", "dog", "FF"), + ("implementation_name", ">", "freebsd", "FF"), + ("implementation_name", ">", "literally any string can go here", "FF"), + ("implementation_name", ">", "things @#4 dsfd (((", "FF"), + ("implementation_name", "<", "1.0", "FF"), + ("implementation_name", "<", "5.6a0", "FF"), + ("implementation_name", "<", "dog", "FF"), + ("implementation_name", "<", "freebsd", "FF"), + ("implementation_name", "<", "literally any string can go here", "FF"), + ("implementation_name", "<", "things @#4 dsfd (((", "FF"), + ("implementation_name", "in", "1.0", "FF"), + ("implementation_name", "in", "5.6a0", "FF"), + ("implementation_name", "in", "dog", "FF"), + ("implementation_name", "in", "freebsd", "FF"), + ("implementation_name", "in", "literally any string can go here", "FF"), + ("implementation_name", "in", "things @#4 dsfd (((", "FF"), + ("implementation_name", "not in", "1.0", "TT"), + ("implementation_name", "not in", "5.6a0", "TT"), + ("implementation_name", "not in", "dog", "TT"), + ("implementation_name", "not in", "freebsd", "TT"), + ("implementation_name", "not in", "literally any string can go here", "TT"), + ("implementation_name", "not in", "things @#4 dsfd (((", "TT"), + ("implementation_version", "===", "1.0", "FF"), + ("implementation_version", "===", "5.6a0", "FF"), + ("implementation_version", "===", "dog", "FF"), + ("implementation_version", "===", "freebsd", "FF"), + ("implementation_version", "===", "literally any string can go here", "EF"), + ("implementation_version", "===", "things @#4 dsfd (((", "EF"), + ("implementation_version", "==", "1.0", "FF"), + ("implementation_version", "==", "5.6a0", "FF"), + ("implementation_version", "==", "dog", "FF"), + ("implementation_version", "==", "freebsd", "FF"), + ("implementation_version", "==", "literally any string can go here", "FF"), + ("implementation_version", "==", "things @#4 dsfd (((", "FF"), + ("implementation_version", ">=", "1.0", "TF"), + ("implementation_version", ">=", "5.6a0", "FT"), + ("implementation_version", ">=", "dog", "FF"), + ("implementation_version", ">=", "freebsd", "FF"), + ("implementation_version", ">=", "literally any string can go here", "FF"), + ("implementation_version", ">=", "things @#4 dsfd (((", "FF"), + ("implementation_version", "<=", "1.0", "FT"), + ("implementation_version", "<=", "5.6a0", "TF"), + ("implementation_version", "<=", "dog", "FF"), + ("implementation_version", "<=", "freebsd", "FF"), + ("implementation_version", "<=", "literally any string can go here", "FF"), + ("implementation_version", "<=", "things @#4 dsfd (((", "FF"), + ("implementation_version", "!=", "1.0", "TT"), + ("implementation_version", "!=", "5.6a0", "TT"), + ("implementation_version", "!=", "dog", "TF"), + ("implementation_version", "!=", "freebsd", "TF"), + ("implementation_version", "!=", "literally any string can go here", "TF"), + ("implementation_version", "!=", "things @#4 dsfd (((", "TF"), + ("implementation_version", "~=", "1.0", "FF"), + ("implementation_version", "~=", "5.6a0", "FF"), + ("implementation_version", "~=", "dog", "EF"), + ("implementation_version", "~=", "freebsd", "EF"), + ("implementation_version", "~=", "literally any string can go here", "EF"), + ("implementation_version", "~=", "things @#4 dsfd (((", "EF"), + ("implementation_version", ">", "1.0", "TF"), + ("implementation_version", ">", "5.6a0", "FT"), + ("implementation_version", ">", "dog", "FF"), + ("implementation_version", ">", "freebsd", "FF"), + ("implementation_version", ">", "literally any string can go here", "FF"), + ("implementation_version", ">", "things @#4 dsfd (((", "FF"), + ("implementation_version", "<", "1.0", "FT"), + ("implementation_version", "<", "5.6a0", "TF"), + ("implementation_version", "<", "dog", "FF"), + ("implementation_version", "<", "freebsd", "FF"), + ("implementation_version", "<", "literally any string can go here", "FF"), + ("implementation_version", "<", "things @#4 dsfd (((", "FF"), + ("implementation_version", "in", "1.0", "FF"), + ("implementation_version", "in", "5.6a0", "FF"), + ("implementation_version", "in", "dog", "FF"), + ("implementation_version", "in", "freebsd", "FF"), + ("implementation_version", "in", "literally any string can go here", "FF"), + ("implementation_version", "in", "things @#4 dsfd (((", "FF"), + ("implementation_version", "not in", "1.0", "TT"), + ("implementation_version", "not in", "5.6a0", "TT"), + ("implementation_version", "not in", "dog", "TT"), + ("implementation_version", "not in", "freebsd", "TT"), + ("implementation_version", "not in", "literally any string can go here", "TT"), + ("implementation_version", "not in", "things @#4 dsfd (((", "TT"), + ("os_name", "===", "1.0", "EE"), + ("os_name", "===", "5.6a0", "EE"), + ("os_name", "===", "dog", "EE"), + ("os_name", "===", "freebsd", "EE"), + ("os_name", "===", "literally any string can go here", "EE"), + ("os_name", "===", "things @#4 dsfd (((", "EE"), + ("os_name", "==", "1.0", "FF"), + ("os_name", "==", "5.6a0", "FF"), + ("os_name", "==", "dog", "FF"), + ("os_name", "==", "freebsd", "FF"), + ("os_name", "==", "literally any string can go here", "FF"), + ("os_name", "==", "things @#4 dsfd (((", "FF"), + ("os_name", ">=", "1.0", "FF"), + ("os_name", ">=", "5.6a0", "FF"), + ("os_name", ">=", "dog", "FF"), + ("os_name", ">=", "freebsd", "FF"), + ("os_name", ">=", "literally any string can go here", "FF"), + ("os_name", ">=", "things @#4 dsfd (((", "FF"), + ("os_name", "<=", "1.0", "FF"), + ("os_name", "<=", "5.6a0", "FF"), + ("os_name", "<=", "dog", "FF"), + ("os_name", "<=", "freebsd", "FF"), + ("os_name", "<=", "literally any string can go here", "FF"), + ("os_name", "<=", "things @#4 dsfd (((", "FF"), + ("os_name", "!=", "1.0", "TT"), + ("os_name", "!=", "5.6a0", "TT"), + ("os_name", "!=", "dog", "TT"), + ("os_name", "!=", "freebsd", "TT"), + ("os_name", "!=", "literally any string can go here", "TT"), + ("os_name", "!=", "things @#4 dsfd (((", "TT"), + ("os_name", "~=", "1.0", "EE"), + ("os_name", "~=", "5.6a0", "EE"), + ("os_name", "~=", "dog", "EE"), + ("os_name", "~=", "freebsd", "EE"), + ("os_name", "~=", "literally any string can go here", "EE"), + ("os_name", "~=", "things @#4 dsfd (((", "EE"), + ("os_name", ">", "1.0", "FF"), + ("os_name", ">", "5.6a0", "FF"), + ("os_name", ">", "dog", "FF"), + ("os_name", ">", "freebsd", "FF"), + ("os_name", ">", "literally any string can go here", "FF"), + ("os_name", ">", "things @#4 dsfd (((", "FF"), + ("os_name", "<", "1.0", "FF"), + ("os_name", "<", "5.6a0", "FF"), + ("os_name", "<", "dog", "FF"), + ("os_name", "<", "freebsd", "FF"), + ("os_name", "<", "literally any string can go here", "FF"), + ("os_name", "<", "things @#4 dsfd (((", "FF"), + ("os_name", "in", "1.0", "FF"), + ("os_name", "in", "5.6a0", "FF"), + ("os_name", "in", "dog", "FF"), + ("os_name", "in", "freebsd", "FF"), + ("os_name", "in", "literally any string can go here", "FF"), + ("os_name", "in", "things @#4 dsfd (((", "FF"), + ("os_name", "not in", "1.0", "TT"), + ("os_name", "not in", "5.6a0", "TT"), + ("os_name", "not in", "dog", "TT"), + ("os_name", "not in", "freebsd", "TT"), + ("os_name", "not in", "literally any string can go here", "TT"), + ("os_name", "not in", "things @#4 dsfd (((", "TT"), + ("platform_machine", "===", "1.0", "EE"), + ("platform_machine", "===", "5.6a0", "EE"), + ("platform_machine", "===", "dog", "EE"), + ("platform_machine", "===", "freebsd", "EE"), + ("platform_machine", "===", "literally any string can go here", "EE"), + ("platform_machine", "===", "things @#4 dsfd (((", "EE"), + ("platform_machine", "==", "1.0", "FF"), + ("platform_machine", "==", "5.6a0", "FF"), + ("platform_machine", "==", "dog", "FF"), + ("platform_machine", "==", "freebsd", "FF"), + ("platform_machine", "==", "literally any string can go here", "FF"), + ("platform_machine", "==", "things @#4 dsfd (((", "FF"), + ("platform_machine", ">=", "1.0", "FF"), + ("platform_machine", ">=", "5.6a0", "FF"), + ("platform_machine", ">=", "dog", "FF"), + ("platform_machine", ">=", "freebsd", "FF"), + ("platform_machine", ">=", "literally any string can go here", "FF"), + ("platform_machine", ">=", "things @#4 dsfd (((", "FF"), + ("platform_machine", "<=", "1.0", "FF"), + ("platform_machine", "<=", "5.6a0", "FF"), + ("platform_machine", "<=", "dog", "FF"), + ("platform_machine", "<=", "freebsd", "FF"), + ("platform_machine", "<=", "literally any string can go here", "FF"), + ("platform_machine", "<=", "things @#4 dsfd (((", "FF"), + ("platform_machine", "!=", "1.0", "TT"), + ("platform_machine", "!=", "5.6a0", "TT"), + ("platform_machine", "!=", "dog", "TT"), + ("platform_machine", "!=", "freebsd", "TT"), + ("platform_machine", "!=", "literally any string can go here", "TT"), + ("platform_machine", "!=", "things @#4 dsfd (((", "TT"), + ("platform_machine", "~=", "1.0", "EE"), + ("platform_machine", "~=", "5.6a0", "EE"), + ("platform_machine", "~=", "dog", "EE"), + ("platform_machine", "~=", "freebsd", "EE"), + ("platform_machine", "~=", "literally any string can go here", "EE"), + ("platform_machine", "~=", "things @#4 dsfd (((", "EE"), + ("platform_machine", ">", "1.0", "FF"), + ("platform_machine", ">", "5.6a0", "FF"), + ("platform_machine", ">", "dog", "FF"), + ("platform_machine", ">", "freebsd", "FF"), + ("platform_machine", ">", "literally any string can go here", "FF"), + ("platform_machine", ">", "things @#4 dsfd (((", "FF"), + ("platform_machine", "<", "1.0", "FF"), + ("platform_machine", "<", "5.6a0", "FF"), + ("platform_machine", "<", "dog", "FF"), + ("platform_machine", "<", "freebsd", "FF"), + ("platform_machine", "<", "literally any string can go here", "FF"), + ("platform_machine", "<", "things @#4 dsfd (((", "FF"), + ("platform_machine", "in", "1.0", "FF"), + ("platform_machine", "in", "5.6a0", "FF"), + ("platform_machine", "in", "dog", "FF"), + ("platform_machine", "in", "freebsd", "FF"), + ("platform_machine", "in", "literally any string can go here", "FF"), + ("platform_machine", "in", "things @#4 dsfd (((", "FF"), + ("platform_machine", "not in", "1.0", "TT"), + ("platform_machine", "not in", "5.6a0", "TT"), + ("platform_machine", "not in", "dog", "TT"), + ("platform_machine", "not in", "freebsd", "TT"), + ("platform_machine", "not in", "literally any string can go here", "TT"), + ("platform_machine", "not in", "things @#4 dsfd (((", "TT"), + ("platform_release", "===", "1.0", "FF"), + ("platform_release", "===", "5.6a0", "FF"), + ("platform_release", "===", "dog", "FF"), + ("platform_release", "===", "freebsd", "FF"), + ("platform_release", "===", "literally any string can go here", "EF"), + ("platform_release", "===", "things @#4 dsfd (((", "EF"), + ("platform_release", "==", "1.0", "FF"), + ("platform_release", "==", "5.6a0", "FF"), + ("platform_release", "==", "dog", "FF"), + ("platform_release", "==", "freebsd", "FF"), + ("platform_release", "==", "literally any string can go here", "FF"), + ("platform_release", "==", "things @#4 dsfd (((", "FF"), + ("platform_release", ">=", "1.0", "TF"), + ("platform_release", ">=", "5.6a0", "TF"), + ("platform_release", ">=", "dog", "FF"), + ("platform_release", ">=", "freebsd", "FF"), + ("platform_release", ">=", "literally any string can go here", "FF"), + ("platform_release", ">=", "things @#4 dsfd (((", "FF"), + ("platform_release", "<=", "1.0", "FT"), + ("platform_release", "<=", "5.6a0", "FT"), + ("platform_release", "<=", "dog", "FF"), + ("platform_release", "<=", "freebsd", "FF"), + ("platform_release", "<=", "literally any string can go here", "FF"), + ("platform_release", "<=", "things @#4 dsfd (((", "FF"), + ("platform_release", "!=", "1.0", "TT"), + ("platform_release", "!=", "5.6a0", "TT"), + ("platform_release", "!=", "dog", "TF"), + ("platform_release", "!=", "freebsd", "TF"), + ("platform_release", "!=", "literally any string can go here", "TF"), + ("platform_release", "!=", "things @#4 dsfd (((", "TF"), + ("platform_release", "~=", "1.0", "FF"), + ("platform_release", "~=", "5.6a0", "FF"), + ("platform_release", "~=", "dog", "EF"), + ("platform_release", "~=", "freebsd", "EF"), + ("platform_release", "~=", "literally any string can go here", "EF"), + ("platform_release", "~=", "things @#4 dsfd (((", "EF"), + ("platform_release", ">", "1.0", "TF"), + ("platform_release", ">", "5.6a0", "TF"), + ("platform_release", ">", "dog", "FF"), + ("platform_release", ">", "freebsd", "FF"), + ("platform_release", ">", "literally any string can go here", "FF"), + ("platform_release", ">", "things @#4 dsfd (((", "FF"), + ("platform_release", "<", "1.0", "FT"), + ("platform_release", "<", "5.6a0", "FT"), + ("platform_release", "<", "dog", "FF"), + ("platform_release", "<", "freebsd", "FF"), + ("platform_release", "<", "literally any string can go here", "FF"), + ("platform_release", "<", "things @#4 dsfd (((", "FF"), + ("platform_release", "in", "1.0", "FT"), + ("platform_release", "in", "5.6a0", "FF"), + ("platform_release", "in", "dog", "FF"), + ("platform_release", "in", "freebsd", "FF"), + ("platform_release", "in", "literally any string can go here", "FF"), + ("platform_release", "in", "things @#4 dsfd (((", "FF"), + ("platform_release", "not in", "1.0", "TF"), + ("platform_release", "not in", "5.6a0", "TT"), + ("platform_release", "not in", "dog", "TT"), + ("platform_release", "not in", "freebsd", "TT"), + ("platform_release", "not in", "literally any string can go here", "TT"), + ("platform_release", "not in", "things @#4 dsfd (((", "TT"), + ("platform_system", "===", "1.0", "EE"), + ("platform_system", "===", "5.6a0", "EE"), + ("platform_system", "===", "dog", "EE"), + ("platform_system", "===", "freebsd", "EE"), + ("platform_system", "===", "literally any string can go here", "EE"), + ("platform_system", "===", "things @#4 dsfd (((", "EE"), + ("platform_system", "==", "1.0", "FF"), + ("platform_system", "==", "5.6a0", "FF"), + ("platform_system", "==", "dog", "FF"), + ("platform_system", "==", "freebsd", "FF"), + ("platform_system", "==", "literally any string can go here", "FF"), + ("platform_system", "==", "things @#4 dsfd (((", "FF"), + ("platform_system", ">=", "1.0", "FF"), + ("platform_system", ">=", "5.6a0", "FF"), + ("platform_system", ">=", "dog", "FF"), + ("platform_system", ">=", "freebsd", "FF"), + ("platform_system", ">=", "literally any string can go here", "FF"), + ("platform_system", ">=", "things @#4 dsfd (((", "FF"), + ("platform_system", "<=", "1.0", "FF"), + ("platform_system", "<=", "5.6a0", "FF"), + ("platform_system", "<=", "dog", "FF"), + ("platform_system", "<=", "freebsd", "FF"), + ("platform_system", "<=", "literally any string can go here", "FF"), + ("platform_system", "<=", "things @#4 dsfd (((", "FF"), + ("platform_system", "!=", "1.0", "TT"), + ("platform_system", "!=", "5.6a0", "TT"), + ("platform_system", "!=", "dog", "TT"), + ("platform_system", "!=", "freebsd", "TT"), + ("platform_system", "!=", "literally any string can go here", "TT"), + ("platform_system", "!=", "things @#4 dsfd (((", "TT"), + ("platform_system", "~=", "1.0", "EE"), + ("platform_system", "~=", "5.6a0", "EE"), + ("platform_system", "~=", "dog", "EE"), + ("platform_system", "~=", "freebsd", "EE"), + ("platform_system", "~=", "literally any string can go here", "EE"), + ("platform_system", "~=", "things @#4 dsfd (((", "EE"), + ("platform_system", ">", "1.0", "FF"), + ("platform_system", ">", "5.6a0", "FF"), + ("platform_system", ">", "dog", "FF"), + ("platform_system", ">", "freebsd", "FF"), + ("platform_system", ">", "literally any string can go here", "FF"), + ("platform_system", ">", "things @#4 dsfd (((", "FF"), + ("platform_system", "<", "1.0", "FF"), + ("platform_system", "<", "5.6a0", "FF"), + ("platform_system", "<", "dog", "FF"), + ("platform_system", "<", "freebsd", "FF"), + ("platform_system", "<", "literally any string can go here", "FF"), + ("platform_system", "<", "things @#4 dsfd (((", "FF"), + ("platform_system", "in", "1.0", "FF"), + ("platform_system", "in", "5.6a0", "FF"), + ("platform_system", "in", "dog", "FF"), + ("platform_system", "in", "freebsd", "FF"), + ("platform_system", "in", "literally any string can go here", "FF"), + ("platform_system", "in", "things @#4 dsfd (((", "FF"), + ("platform_system", "not in", "1.0", "TT"), + ("platform_system", "not in", "5.6a0", "TT"), + ("platform_system", "not in", "dog", "TT"), + ("platform_system", "not in", "freebsd", "TT"), + ("platform_system", "not in", "literally any string can go here", "TT"), + ("platform_system", "not in", "things @#4 dsfd (((", "TT"), + ("platform_version", "===", "1.0", "EE"), + ("platform_version", "===", "5.6a0", "EE"), + ("platform_version", "===", "dog", "EE"), + ("platform_version", "===", "freebsd", "EE"), + ("platform_version", "===", "literally any string can go here", "EE"), + ("platform_version", "===", "things @#4 dsfd (((", "EE"), + ("platform_version", "==", "1.0", "FF"), + ("platform_version", "==", "5.6a0", "FF"), + ("platform_version", "==", "dog", "FF"), + ("platform_version", "==", "freebsd", "FF"), + ("platform_version", "==", "literally any string can go here", "FF"), + ("platform_version", "==", "things @#4 dsfd (((", "FF"), + ("platform_version", ">=", "1.0", "FF"), + ("platform_version", ">=", "5.6a0", "FF"), + ("platform_version", ">=", "dog", "FF"), + ("platform_version", ">=", "freebsd", "FF"), + ("platform_version", ">=", "literally any string can go here", "FF"), + ("platform_version", ">=", "things @#4 dsfd (((", "FF"), + ("platform_version", "<=", "1.0", "FF"), + ("platform_version", "<=", "5.6a0", "FF"), + ("platform_version", "<=", "dog", "FF"), + ("platform_version", "<=", "freebsd", "FF"), + ("platform_version", "<=", "literally any string can go here", "FF"), + ("platform_version", "<=", "things @#4 dsfd (((", "FF"), + ("platform_version", "!=", "1.0", "TT"), + ("platform_version", "!=", "5.6a0", "TT"), + ("platform_version", "!=", "dog", "TT"), + ("platform_version", "!=", "freebsd", "TT"), + ("platform_version", "!=", "literally any string can go here", "TT"), + ("platform_version", "!=", "things @#4 dsfd (((", "TT"), + ("platform_version", "~=", "1.0", "EE"), + ("platform_version", "~=", "5.6a0", "EE"), + ("platform_version", "~=", "dog", "EE"), + ("platform_version", "~=", "freebsd", "EE"), + ("platform_version", "~=", "literally any string can go here", "EE"), + ("platform_version", "~=", "things @#4 dsfd (((", "EE"), + ("platform_version", ">", "1.0", "FF"), + ("platform_version", ">", "5.6a0", "FF"), + ("platform_version", ">", "dog", "FF"), + ("platform_version", ">", "freebsd", "FF"), + ("platform_version", ">", "literally any string can go here", "FF"), + ("platform_version", ">", "things @#4 dsfd (((", "FF"), + ("platform_version", "<", "1.0", "FF"), + ("platform_version", "<", "5.6a0", "FF"), + ("platform_version", "<", "dog", "FF"), + ("platform_version", "<", "freebsd", "FF"), + ("platform_version", "<", "literally any string can go here", "FF"), + ("platform_version", "<", "things @#4 dsfd (((", "FF"), + ("platform_version", "in", "1.0", "FF"), + ("platform_version", "in", "5.6a0", "FF"), + ("platform_version", "in", "dog", "FF"), + ("platform_version", "in", "freebsd", "FF"), + ("platform_version", "in", "literally any string can go here", "FF"), + ("platform_version", "in", "things @#4 dsfd (((", "FF"), + ("platform_version", "not in", "1.0", "TT"), + ("platform_version", "not in", "5.6a0", "TT"), + ("platform_version", "not in", "dog", "TT"), + ("platform_version", "not in", "freebsd", "TT"), + ("platform_version", "not in", "literally any string can go here", "TT"), + ("platform_version", "not in", "things @#4 dsfd (((", "TT"), + ("python_full_version", "===", "1.0", "FF"), + ("python_full_version", "===", "5.6a0", "FF"), + ("python_full_version", "===", "dog", "FF"), + ("python_full_version", "===", "freebsd", "FF"), + ("python_full_version", "===", "literally any string can go here", "EF"), + ("python_full_version", "===", "things @#4 dsfd (((", "EF"), + ("python_full_version", "==", "1.0", "FF"), + ("python_full_version", "==", "5.6a0", "FF"), + ("python_full_version", "==", "dog", "FF"), + ("python_full_version", "==", "freebsd", "FF"), + ("python_full_version", "==", "literally any string can go here", "FF"), + ("python_full_version", "==", "things @#4 dsfd (((", "FF"), + ("python_full_version", ">=", "1.0", "TF"), + ("python_full_version", ">=", "5.6a0", "FT"), + ("python_full_version", ">=", "dog", "FF"), + ("python_full_version", ">=", "freebsd", "FF"), + ("python_full_version", ">=", "literally any string can go here", "FF"), + ("python_full_version", ">=", "things @#4 dsfd (((", "FF"), + ("python_full_version", "<=", "1.0", "FT"), + ("python_full_version", "<=", "5.6a0", "TF"), + ("python_full_version", "<=", "dog", "FF"), + ("python_full_version", "<=", "freebsd", "FF"), + ("python_full_version", "<=", "literally any string can go here", "FF"), + ("python_full_version", "<=", "things @#4 dsfd (((", "FF"), + ("python_full_version", "!=", "1.0", "TT"), + ("python_full_version", "!=", "5.6a0", "TT"), + ("python_full_version", "!=", "dog", "TF"), + ("python_full_version", "!=", "freebsd", "TF"), + ("python_full_version", "!=", "literally any string can go here", "TF"), + ("python_full_version", "!=", "things @#4 dsfd (((", "TF"), + ("python_full_version", "~=", "1.0", "FF"), + ("python_full_version", "~=", "5.6a0", "FF"), + ("python_full_version", "~=", "dog", "EF"), + ("python_full_version", "~=", "freebsd", "EF"), + ("python_full_version", "~=", "literally any string can go here", "EF"), + ("python_full_version", "~=", "things @#4 dsfd (((", "EF"), + ("python_full_version", ">", "1.0", "TF"), + ("python_full_version", ">", "5.6a0", "FT"), + ("python_full_version", ">", "dog", "FF"), + ("python_full_version", ">", "freebsd", "FF"), + ("python_full_version", ">", "literally any string can go here", "FF"), + ("python_full_version", ">", "things @#4 dsfd (((", "FF"), + ("python_full_version", "<", "1.0", "FT"), + ("python_full_version", "<", "5.6a0", "TF"), + ("python_full_version", "<", "dog", "FF"), + ("python_full_version", "<", "freebsd", "FF"), + ("python_full_version", "<", "literally any string can go here", "FF"), + ("python_full_version", "<", "things @#4 dsfd (((", "FF"), + ("python_full_version", "in", "1.0", "FF"), + ("python_full_version", "in", "5.6a0", "FF"), + ("python_full_version", "in", "dog", "FF"), + ("python_full_version", "in", "freebsd", "FF"), + ("python_full_version", "in", "literally any string can go here", "FF"), + ("python_full_version", "in", "things @#4 dsfd (((", "FF"), + ("python_full_version", "not in", "1.0", "TT"), + ("python_full_version", "not in", "5.6a0", "TT"), + ("python_full_version", "not in", "dog", "TT"), + ("python_full_version", "not in", "freebsd", "TT"), + ("python_full_version", "not in", "literally any string can go here", "TT"), + ("python_full_version", "not in", "things @#4 dsfd (((", "TT"), + ("python_version", "===", "1.0", "FF"), + ("python_version", "===", "5.6a0", "FF"), + ("python_version", "===", "dog", "FF"), + ("python_version", "===", "freebsd", "FF"), + ("python_version", "===", "literally any string can go here", "EF"), + ("python_version", "===", "things @#4 dsfd (((", "EF"), + ("python_version", "==", "1.0", "FF"), + ("python_version", "==", "5.6a0", "FF"), + ("python_version", "==", "dog", "FF"), + ("python_version", "==", "freebsd", "FF"), + ("python_version", "==", "literally any string can go here", "FF"), + ("python_version", "==", "things @#4 dsfd (((", "FF"), + ("python_version", ">=", "1.0", "TF"), + ("python_version", ">=", "5.6a0", "FT"), + ("python_version", ">=", "dog", "FF"), + ("python_version", ">=", "freebsd", "FF"), + ("python_version", ">=", "literally any string can go here", "FF"), + ("python_version", ">=", "things @#4 dsfd (((", "FF"), + ("python_version", "<=", "1.0", "FT"), + ("python_version", "<=", "5.6a0", "TF"), + ("python_version", "<=", "dog", "FF"), + ("python_version", "<=", "freebsd", "FF"), + ("python_version", "<=", "literally any string can go here", "FF"), + ("python_version", "<=", "things @#4 dsfd (((", "FF"), + ("python_version", "!=", "1.0", "TT"), + ("python_version", "!=", "5.6a0", "TT"), + ("python_version", "!=", "dog", "TF"), + ("python_version", "!=", "freebsd", "TF"), + ("python_version", "!=", "literally any string can go here", "TF"), + ("python_version", "!=", "things @#4 dsfd (((", "TF"), + ("python_version", "~=", "1.0", "FF"), + ("python_version", "~=", "5.6a0", "FF"), + ("python_version", "~=", "dog", "EF"), + ("python_version", "~=", "freebsd", "EF"), + ("python_version", "~=", "literally any string can go here", "EF"), + ("python_version", "~=", "things @#4 dsfd (((", "EF"), + ("python_version", ">", "1.0", "TF"), + ("python_version", ">", "5.6a0", "FT"), + ("python_version", ">", "dog", "FF"), + ("python_version", ">", "freebsd", "FF"), + ("python_version", ">", "literally any string can go here", "FF"), + ("python_version", ">", "things @#4 dsfd (((", "FF"), + ("python_version", "<", "1.0", "FT"), + ("python_version", "<", "5.6a0", "TF"), + ("python_version", "<", "dog", "FF"), + ("python_version", "<", "freebsd", "FF"), + ("python_version", "<", "literally any string can go here", "FF"), + ("python_version", "<", "things @#4 dsfd (((", "FF"), + ("python_version", "in", "1.0", "FF"), + ("python_version", "in", "5.6a0", "FF"), + ("python_version", "in", "dog", "FF"), + ("python_version", "in", "freebsd", "FF"), + ("python_version", "in", "literally any string can go here", "FF"), + ("python_version", "in", "things @#4 dsfd (((", "FF"), + ("python_version", "not in", "1.0", "TT"), + ("python_version", "not in", "5.6a0", "TT"), + ("python_version", "not in", "dog", "TT"), + ("python_version", "not in", "freebsd", "TT"), + ("python_version", "not in", "literally any string can go here", "TT"), + ("python_version", "not in", "things @#4 dsfd (((", "TT"), + ("platform_python_implementation", "===", "1.0", "EE"), + ("platform_python_implementation", "===", "5.6a0", "EE"), + ("platform_python_implementation", "===", "dog", "EE"), + ("platform_python_implementation", "===", "freebsd", "EE"), + ("platform_python_implementation", "===", "literally any string can go here", "EE"), + ("platform_python_implementation", "===", "things @#4 dsfd (((", "EE"), + ("platform_python_implementation", "==", "1.0", "FF"), + ("platform_python_implementation", "==", "5.6a0", "FF"), + ("platform_python_implementation", "==", "dog", "FF"), + ("platform_python_implementation", "==", "freebsd", "FF"), + ("platform_python_implementation", "==", "literally any string can go here", "FF"), + ("platform_python_implementation", "==", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", ">=", "1.0", "FF"), + ("platform_python_implementation", ">=", "5.6a0", "FF"), + ("platform_python_implementation", ">=", "dog", "FF"), + ("platform_python_implementation", ">=", "freebsd", "FF"), + ("platform_python_implementation", ">=", "literally any string can go here", "FF"), + ("platform_python_implementation", ">=", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", "<=", "1.0", "FF"), + ("platform_python_implementation", "<=", "5.6a0", "FF"), + ("platform_python_implementation", "<=", "dog", "FF"), + ("platform_python_implementation", "<=", "freebsd", "FF"), + ("platform_python_implementation", "<=", "literally any string can go here", "FF"), + ("platform_python_implementation", "<=", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", "!=", "1.0", "TT"), + ("platform_python_implementation", "!=", "5.6a0", "TT"), + ("platform_python_implementation", "!=", "dog", "TT"), + ("platform_python_implementation", "!=", "freebsd", "TT"), + ("platform_python_implementation", "!=", "literally any string can go here", "TT"), + ("platform_python_implementation", "!=", "things @#4 dsfd (((", "TT"), + ("platform_python_implementation", "~=", "1.0", "EE"), + ("platform_python_implementation", "~=", "5.6a0", "EE"), + ("platform_python_implementation", "~=", "dog", "EE"), + ("platform_python_implementation", "~=", "freebsd", "EE"), + ("platform_python_implementation", "~=", "literally any string can go here", "EE"), + ("platform_python_implementation", "~=", "things @#4 dsfd (((", "EE"), + ("platform_python_implementation", ">", "1.0", "FF"), + ("platform_python_implementation", ">", "5.6a0", "FF"), + ("platform_python_implementation", ">", "dog", "FF"), + ("platform_python_implementation", ">", "freebsd", "FF"), + ("platform_python_implementation", ">", "literally any string can go here", "FF"), + ("platform_python_implementation", ">", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", "<", "1.0", "FF"), + ("platform_python_implementation", "<", "5.6a0", "FF"), + ("platform_python_implementation", "<", "dog", "FF"), + ("platform_python_implementation", "<", "freebsd", "FF"), + ("platform_python_implementation", "<", "literally any string can go here", "FF"), + ("platform_python_implementation", "<", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", "in", "1.0", "FF"), + ("platform_python_implementation", "in", "5.6a0", "FF"), + ("platform_python_implementation", "in", "dog", "FF"), + ("platform_python_implementation", "in", "freebsd", "FF"), + ("platform_python_implementation", "in", "literally any string can go here", "FF"), + ("platform_python_implementation", "in", "things @#4 dsfd (((", "FF"), + ("platform_python_implementation", "not in", "1.0", "TT"), + ("platform_python_implementation", "not in", "5.6a0", "TT"), + ("platform_python_implementation", "not in", "dog", "TT"), + ("platform_python_implementation", "not in", "freebsd", "TT"), + ("platform_python_implementation", "not in", "literally any string can go here", "TT"), + ("platform_python_implementation", "not in", "things @#4 dsfd (((", "TT"), + ("sys_platform", "===", "1.0", "EE"), + ("sys_platform", "===", "5.6a0", "EE"), + ("sys_platform", "===", "dog", "EE"), + ("sys_platform", "===", "freebsd", "EE"), + ("sys_platform", "===", "literally any string can go here", "EE"), + ("sys_platform", "===", "things @#4 dsfd (((", "EE"), + ("sys_platform", "==", "1.0", "FF"), + ("sys_platform", "==", "5.6a0", "FF"), + ("sys_platform", "==", "dog", "FF"), + ("sys_platform", "==", "freebsd", "FF"), + ("sys_platform", "==", "literally any string can go here", "FF"), + ("sys_platform", "==", "things @#4 dsfd (((", "FF"), + ("sys_platform", ">=", "1.0", "FF"), + ("sys_platform", ">=", "5.6a0", "FF"), + ("sys_platform", ">=", "dog", "FF"), + ("sys_platform", ">=", "freebsd", "FF"), + ("sys_platform", ">=", "literally any string can go here", "FF"), + ("sys_platform", ">=", "things @#4 dsfd (((", "FF"), + ("sys_platform", "<=", "1.0", "FF"), + ("sys_platform", "<=", "5.6a0", "FF"), + ("sys_platform", "<=", "dog", "FF"), + ("sys_platform", "<=", "freebsd", "FF"), + ("sys_platform", "<=", "literally any string can go here", "FF"), + ("sys_platform", "<=", "things @#4 dsfd (((", "FF"), + ("sys_platform", "!=", "1.0", "TT"), + ("sys_platform", "!=", "5.6a0", "TT"), + ("sys_platform", "!=", "dog", "TT"), + ("sys_platform", "!=", "freebsd", "TT"), + ("sys_platform", "!=", "literally any string can go here", "TT"), + ("sys_platform", "!=", "things @#4 dsfd (((", "TT"), + ("sys_platform", "~=", "1.0", "EE"), + ("sys_platform", "~=", "5.6a0", "EE"), + ("sys_platform", "~=", "dog", "EE"), + ("sys_platform", "~=", "freebsd", "EE"), + ("sys_platform", "~=", "literally any string can go here", "EE"), + ("sys_platform", "~=", "things @#4 dsfd (((", "EE"), + ("sys_platform", ">", "1.0", "FF"), + ("sys_platform", ">", "5.6a0", "FF"), + ("sys_platform", ">", "dog", "FF"), + ("sys_platform", ">", "freebsd", "FF"), + ("sys_platform", ">", "literally any string can go here", "FF"), + ("sys_platform", ">", "things @#4 dsfd (((", "FF"), + ("sys_platform", "<", "1.0", "FF"), + ("sys_platform", "<", "5.6a0", "FF"), + ("sys_platform", "<", "dog", "FF"), + ("sys_platform", "<", "freebsd", "FF"), + ("sys_platform", "<", "literally any string can go here", "FF"), + ("sys_platform", "<", "things @#4 dsfd (((", "FF"), + ("sys_platform", "in", "1.0", "FF"), + ("sys_platform", "in", "5.6a0", "FF"), + ("sys_platform", "in", "dog", "FF"), + ("sys_platform", "in", "freebsd", "FF"), + ("sys_platform", "in", "literally any string can go here", "FF"), + ("sys_platform", "in", "things @#4 dsfd (((", "FF"), + ("sys_platform", "not in", "1.0", "TT"), + ("sys_platform", "not in", "5.6a0", "TT"), + ("sys_platform", "not in", "dog", "TT"), + ("sys_platform", "not in", "freebsd", "TT"), + ("sys_platform", "not in", "literally any string can go here", "TT"), + ("sys_platform", "not in", "things @#4 dsfd (((", "TT"), + ("os.name", "===", "1.0", "EE"), + ("os.name", "===", "5.6a0", "EE"), + ("os.name", "===", "dog", "EE"), + ("os.name", "===", "freebsd", "EE"), + ("os.name", "===", "literally any string can go here", "EE"), + ("os.name", "===", "things @#4 dsfd (((", "EE"), + ("os.name", "==", "1.0", "FF"), + ("os.name", "==", "5.6a0", "FF"), + ("os.name", "==", "dog", "FF"), + ("os.name", "==", "freebsd", "FF"), + ("os.name", "==", "literally any string can go here", "FF"), + ("os.name", "==", "things @#4 dsfd (((", "FF"), + ("os.name", ">=", "1.0", "FF"), + ("os.name", ">=", "5.6a0", "FF"), + ("os.name", ">=", "dog", "FF"), + ("os.name", ">=", "freebsd", "FF"), + ("os.name", ">=", "literally any string can go here", "FF"), + ("os.name", ">=", "things @#4 dsfd (((", "FF"), + ("os.name", "<=", "1.0", "FF"), + ("os.name", "<=", "5.6a0", "FF"), + ("os.name", "<=", "dog", "FF"), + ("os.name", "<=", "freebsd", "FF"), + ("os.name", "<=", "literally any string can go here", "FF"), + ("os.name", "<=", "things @#4 dsfd (((", "FF"), + ("os.name", "!=", "1.0", "TT"), + ("os.name", "!=", "5.6a0", "TT"), + ("os.name", "!=", "dog", "TT"), + ("os.name", "!=", "freebsd", "TT"), + ("os.name", "!=", "literally any string can go here", "TT"), + ("os.name", "!=", "things @#4 dsfd (((", "TT"), + ("os.name", "~=", "1.0", "EE"), + ("os.name", "~=", "5.6a0", "EE"), + ("os.name", "~=", "dog", "EE"), + ("os.name", "~=", "freebsd", "EE"), + ("os.name", "~=", "literally any string can go here", "EE"), + ("os.name", "~=", "things @#4 dsfd (((", "EE"), + ("os.name", ">", "1.0", "FF"), + ("os.name", ">", "5.6a0", "FF"), + ("os.name", ">", "dog", "FF"), + ("os.name", ">", "freebsd", "FF"), + ("os.name", ">", "literally any string can go here", "FF"), + ("os.name", ">", "things @#4 dsfd (((", "FF"), + ("os.name", "<", "1.0", "FF"), + ("os.name", "<", "5.6a0", "FF"), + ("os.name", "<", "dog", "FF"), + ("os.name", "<", "freebsd", "FF"), + ("os.name", "<", "literally any string can go here", "FF"), + ("os.name", "<", "things @#4 dsfd (((", "FF"), + ("os.name", "in", "1.0", "FF"), + ("os.name", "in", "5.6a0", "FF"), + ("os.name", "in", "dog", "FF"), + ("os.name", "in", "freebsd", "FF"), + ("os.name", "in", "literally any string can go here", "FF"), + ("os.name", "in", "things @#4 dsfd (((", "FF"), + ("os.name", "not in", "1.0", "TT"), + ("os.name", "not in", "5.6a0", "TT"), + ("os.name", "not in", "dog", "TT"), + ("os.name", "not in", "freebsd", "TT"), + ("os.name", "not in", "literally any string can go here", "TT"), + ("os.name", "not in", "things @#4 dsfd (((", "TT"), + ("sys.platform", "===", "1.0", "EE"), + ("sys.platform", "===", "5.6a0", "EE"), + ("sys.platform", "===", "dog", "EE"), + ("sys.platform", "===", "freebsd", "EE"), + ("sys.platform", "===", "literally any string can go here", "EE"), + ("sys.platform", "===", "things @#4 dsfd (((", "EE"), + ("sys.platform", "==", "1.0", "FF"), + ("sys.platform", "==", "5.6a0", "FF"), + ("sys.platform", "==", "dog", "FF"), + ("sys.platform", "==", "freebsd", "FF"), + ("sys.platform", "==", "literally any string can go here", "FF"), + ("sys.platform", "==", "things @#4 dsfd (((", "FF"), + ("sys.platform", ">=", "1.0", "FF"), + ("sys.platform", ">=", "5.6a0", "FF"), + ("sys.platform", ">=", "dog", "FF"), + ("sys.platform", ">=", "freebsd", "FF"), + ("sys.platform", ">=", "literally any string can go here", "FF"), + ("sys.platform", ">=", "things @#4 dsfd (((", "FF"), + ("sys.platform", "<=", "1.0", "FF"), + ("sys.platform", "<=", "5.6a0", "FF"), + ("sys.platform", "<=", "dog", "FF"), + ("sys.platform", "<=", "freebsd", "FF"), + ("sys.platform", "<=", "literally any string can go here", "FF"), + ("sys.platform", "<=", "things @#4 dsfd (((", "FF"), + ("sys.platform", "!=", "1.0", "TT"), + ("sys.platform", "!=", "5.6a0", "TT"), + ("sys.platform", "!=", "dog", "TT"), + ("sys.platform", "!=", "freebsd", "TT"), + ("sys.platform", "!=", "literally any string can go here", "TT"), + ("sys.platform", "!=", "things @#4 dsfd (((", "TT"), + ("sys.platform", "~=", "1.0", "EE"), + ("sys.platform", "~=", "5.6a0", "EE"), + ("sys.platform", "~=", "dog", "EE"), + ("sys.platform", "~=", "freebsd", "EE"), + ("sys.platform", "~=", "literally any string can go here", "EE"), + ("sys.platform", "~=", "things @#4 dsfd (((", "EE"), + ("sys.platform", ">", "1.0", "FF"), + ("sys.platform", ">", "5.6a0", "FF"), + ("sys.platform", ">", "dog", "FF"), + ("sys.platform", ">", "freebsd", "FF"), + ("sys.platform", ">", "literally any string can go here", "FF"), + ("sys.platform", ">", "things @#4 dsfd (((", "FF"), + ("sys.platform", "<", "1.0", "FF"), + ("sys.platform", "<", "5.6a0", "FF"), + ("sys.platform", "<", "dog", "FF"), + ("sys.platform", "<", "freebsd", "FF"), + ("sys.platform", "<", "literally any string can go here", "FF"), + ("sys.platform", "<", "things @#4 dsfd (((", "FF"), + ("sys.platform", "in", "1.0", "FF"), + ("sys.platform", "in", "5.6a0", "FF"), + ("sys.platform", "in", "dog", "FF"), + ("sys.platform", "in", "freebsd", "FF"), + ("sys.platform", "in", "literally any string can go here", "FF"), + ("sys.platform", "in", "things @#4 dsfd (((", "FF"), + ("sys.platform", "not in", "1.0", "TT"), + ("sys.platform", "not in", "5.6a0", "TT"), + ("sys.platform", "not in", "dog", "TT"), + ("sys.platform", "not in", "freebsd", "TT"), + ("sys.platform", "not in", "literally any string can go here", "TT"), + ("sys.platform", "not in", "things @#4 dsfd (((", "TT"), + ("platform.version", "===", "1.0", "EE"), + ("platform.version", "===", "5.6a0", "EE"), + ("platform.version", "===", "dog", "EE"), + ("platform.version", "===", "freebsd", "EE"), + ("platform.version", "===", "literally any string can go here", "EE"), + ("platform.version", "===", "things @#4 dsfd (((", "EE"), + ("platform.version", "==", "1.0", "FF"), + ("platform.version", "==", "5.6a0", "FF"), + ("platform.version", "==", "dog", "FF"), + ("platform.version", "==", "freebsd", "FF"), + ("platform.version", "==", "literally any string can go here", "FF"), + ("platform.version", "==", "things @#4 dsfd (((", "FF"), + ("platform.version", ">=", "1.0", "FF"), + ("platform.version", ">=", "5.6a0", "FF"), + ("platform.version", ">=", "dog", "FF"), + ("platform.version", ">=", "freebsd", "FF"), + ("platform.version", ">=", "literally any string can go here", "FF"), + ("platform.version", ">=", "things @#4 dsfd (((", "FF"), + ("platform.version", "<=", "1.0", "FF"), + ("platform.version", "<=", "5.6a0", "FF"), + ("platform.version", "<=", "dog", "FF"), + ("platform.version", "<=", "freebsd", "FF"), + ("platform.version", "<=", "literally any string can go here", "FF"), + ("platform.version", "<=", "things @#4 dsfd (((", "FF"), + ("platform.version", "!=", "1.0", "TT"), + ("platform.version", "!=", "5.6a0", "TT"), + ("platform.version", "!=", "dog", "TT"), + ("platform.version", "!=", "freebsd", "TT"), + ("platform.version", "!=", "literally any string can go here", "TT"), + ("platform.version", "!=", "things @#4 dsfd (((", "TT"), + ("platform.version", "~=", "1.0", "EE"), + ("platform.version", "~=", "5.6a0", "EE"), + ("platform.version", "~=", "dog", "EE"), + ("platform.version", "~=", "freebsd", "EE"), + ("platform.version", "~=", "literally any string can go here", "EE"), + ("platform.version", "~=", "things @#4 dsfd (((", "EE"), + ("platform.version", ">", "1.0", "FF"), + ("platform.version", ">", "5.6a0", "FF"), + ("platform.version", ">", "dog", "FF"), + ("platform.version", ">", "freebsd", "FF"), + ("platform.version", ">", "literally any string can go here", "FF"), + ("platform.version", ">", "things @#4 dsfd (((", "FF"), + ("platform.version", "<", "1.0", "FF"), + ("platform.version", "<", "5.6a0", "FF"), + ("platform.version", "<", "dog", "FF"), + ("platform.version", "<", "freebsd", "FF"), + ("platform.version", "<", "literally any string can go here", "FF"), + ("platform.version", "<", "things @#4 dsfd (((", "FF"), + ("platform.version", "in", "1.0", "FF"), + ("platform.version", "in", "5.6a0", "FF"), + ("platform.version", "in", "dog", "FF"), + ("platform.version", "in", "freebsd", "FF"), + ("platform.version", "in", "literally any string can go here", "FF"), + ("platform.version", "in", "things @#4 dsfd (((", "FF"), + ("platform.version", "not in", "1.0", "TT"), + ("platform.version", "not in", "5.6a0", "TT"), + ("platform.version", "not in", "dog", "TT"), + ("platform.version", "not in", "freebsd", "TT"), + ("platform.version", "not in", "literally any string can go here", "TT"), + ("platform.version", "not in", "things @#4 dsfd (((", "TT"), + ("platform.machine", "===", "1.0", "EE"), + ("platform.machine", "===", "5.6a0", "EE"), + ("platform.machine", "===", "dog", "EE"), + ("platform.machine", "===", "freebsd", "EE"), + ("platform.machine", "===", "literally any string can go here", "EE"), + ("platform.machine", "===", "things @#4 dsfd (((", "EE"), + ("platform.machine", "==", "1.0", "FF"), + ("platform.machine", "==", "5.6a0", "FF"), + ("platform.machine", "==", "dog", "FF"), + ("platform.machine", "==", "freebsd", "FF"), + ("platform.machine", "==", "literally any string can go here", "FF"), + ("platform.machine", "==", "things @#4 dsfd (((", "FF"), + ("platform.machine", ">=", "1.0", "FF"), + ("platform.machine", ">=", "5.6a0", "FF"), + ("platform.machine", ">=", "dog", "FF"), + ("platform.machine", ">=", "freebsd", "FF"), + ("platform.machine", ">=", "literally any string can go here", "FF"), + ("platform.machine", ">=", "things @#4 dsfd (((", "FF"), + ("platform.machine", "<=", "1.0", "FF"), + ("platform.machine", "<=", "5.6a0", "FF"), + ("platform.machine", "<=", "dog", "FF"), + ("platform.machine", "<=", "freebsd", "FF"), + ("platform.machine", "<=", "literally any string can go here", "FF"), + ("platform.machine", "<=", "things @#4 dsfd (((", "FF"), + ("platform.machine", "!=", "1.0", "TT"), + ("platform.machine", "!=", "5.6a0", "TT"), + ("platform.machine", "!=", "dog", "TT"), + ("platform.machine", "!=", "freebsd", "TT"), + ("platform.machine", "!=", "literally any string can go here", "TT"), + ("platform.machine", "!=", "things @#4 dsfd (((", "TT"), + ("platform.machine", "~=", "1.0", "EE"), + ("platform.machine", "~=", "5.6a0", "EE"), + ("platform.machine", "~=", "dog", "EE"), + ("platform.machine", "~=", "freebsd", "EE"), + ("platform.machine", "~=", "literally any string can go here", "EE"), + ("platform.machine", "~=", "things @#4 dsfd (((", "EE"), + ("platform.machine", ">", "1.0", "FF"), + ("platform.machine", ">", "5.6a0", "FF"), + ("platform.machine", ">", "dog", "FF"), + ("platform.machine", ">", "freebsd", "FF"), + ("platform.machine", ">", "literally any string can go here", "FF"), + ("platform.machine", ">", "things @#4 dsfd (((", "FF"), + ("platform.machine", "<", "1.0", "FF"), + ("platform.machine", "<", "5.6a0", "FF"), + ("platform.machine", "<", "dog", "FF"), + ("platform.machine", "<", "freebsd", "FF"), + ("platform.machine", "<", "literally any string can go here", "FF"), + ("platform.machine", "<", "things @#4 dsfd (((", "FF"), + ("platform.machine", "in", "1.0", "FF"), + ("platform.machine", "in", "5.6a0", "FF"), + ("platform.machine", "in", "dog", "FF"), + ("platform.machine", "in", "freebsd", "FF"), + ("platform.machine", "in", "literally any string can go here", "FF"), + ("platform.machine", "in", "things @#4 dsfd (((", "FF"), + ("platform.machine", "not in", "1.0", "TT"), + ("platform.machine", "not in", "5.6a0", "TT"), + ("platform.machine", "not in", "dog", "TT"), + ("platform.machine", "not in", "freebsd", "TT"), + ("platform.machine", "not in", "literally any string can go here", "TT"), + ("platform.machine", "not in", "things @#4 dsfd (((", "TT"), + ("platform.python_implementation", "===", "1.0", "EE"), + ("platform.python_implementation", "===", "5.6a0", "EE"), + ("platform.python_implementation", "===", "dog", "EE"), + ("platform.python_implementation", "===", "freebsd", "EE"), + ("platform.python_implementation", "===", "literally any string can go here", "EE"), + ("platform.python_implementation", "===", "things @#4 dsfd (((", "EE"), + ("platform.python_implementation", "==", "1.0", "FF"), + ("platform.python_implementation", "==", "5.6a0", "FF"), + ("platform.python_implementation", "==", "dog", "FF"), + ("platform.python_implementation", "==", "freebsd", "FF"), + ("platform.python_implementation", "==", "literally any string can go here", "FF"), + ("platform.python_implementation", "==", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", ">=", "1.0", "FF"), + ("platform.python_implementation", ">=", "5.6a0", "FF"), + ("platform.python_implementation", ">=", "dog", "FF"), + ("platform.python_implementation", ">=", "freebsd", "FF"), + ("platform.python_implementation", ">=", "literally any string can go here", "FF"), + ("platform.python_implementation", ">=", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", "<=", "1.0", "FF"), + ("platform.python_implementation", "<=", "5.6a0", "FF"), + ("platform.python_implementation", "<=", "dog", "FF"), + ("platform.python_implementation", "<=", "freebsd", "FF"), + ("platform.python_implementation", "<=", "literally any string can go here", "FF"), + ("platform.python_implementation", "<=", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", "!=", "1.0", "TT"), + ("platform.python_implementation", "!=", "5.6a0", "TT"), + ("platform.python_implementation", "!=", "dog", "TT"), + ("platform.python_implementation", "!=", "freebsd", "TT"), + ("platform.python_implementation", "!=", "literally any string can go here", "TT"), + ("platform.python_implementation", "!=", "things @#4 dsfd (((", "TT"), + ("platform.python_implementation", "~=", "1.0", "EE"), + ("platform.python_implementation", "~=", "5.6a0", "EE"), + ("platform.python_implementation", "~=", "dog", "EE"), + ("platform.python_implementation", "~=", "freebsd", "EE"), + ("platform.python_implementation", "~=", "literally any string can go here", "EE"), + ("platform.python_implementation", "~=", "things @#4 dsfd (((", "EE"), + ("platform.python_implementation", ">", "1.0", "FF"), + ("platform.python_implementation", ">", "5.6a0", "FF"), + ("platform.python_implementation", ">", "dog", "FF"), + ("platform.python_implementation", ">", "freebsd", "FF"), + ("platform.python_implementation", ">", "literally any string can go here", "FF"), + ("platform.python_implementation", ">", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", "<", "1.0", "FF"), + ("platform.python_implementation", "<", "5.6a0", "FF"), + ("platform.python_implementation", "<", "dog", "FF"), + ("platform.python_implementation", "<", "freebsd", "FF"), + ("platform.python_implementation", "<", "literally any string can go here", "FF"), + ("platform.python_implementation", "<", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", "in", "1.0", "FF"), + ("platform.python_implementation", "in", "5.6a0", "FF"), + ("platform.python_implementation", "in", "dog", "FF"), + ("platform.python_implementation", "in", "freebsd", "FF"), + ("platform.python_implementation", "in", "literally any string can go here", "FF"), + ("platform.python_implementation", "in", "things @#4 dsfd (((", "FF"), + ("platform.python_implementation", "not in", "1.0", "TT"), + ("platform.python_implementation", "not in", "5.6a0", "TT"), + ("platform.python_implementation", "not in", "dog", "TT"), + ("platform.python_implementation", "not in", "freebsd", "TT"), + ("platform.python_implementation", "not in", "literally any string can go here", "TT"), + ("platform.python_implementation", "not in", "things @#4 dsfd (((", "TT"), + ("python_implementation", "===", "1.0", "EE"), + ("python_implementation", "===", "5.6a0", "EE"), + ("python_implementation", "===", "dog", "EE"), + ("python_implementation", "===", "freebsd", "EE"), + ("python_implementation", "===", "literally any string can go here", "EE"), + ("python_implementation", "===", "things @#4 dsfd (((", "EE"), + ("python_implementation", "==", "1.0", "FF"), + ("python_implementation", "==", "5.6a0", "FF"), + ("python_implementation", "==", "dog", "FF"), + ("python_implementation", "==", "freebsd", "FF"), + ("python_implementation", "==", "literally any string can go here", "FF"), + ("python_implementation", "==", "things @#4 dsfd (((", "FF"), + ("python_implementation", ">=", "1.0", "FF"), + ("python_implementation", ">=", "5.6a0", "FF"), + ("python_implementation", ">=", "dog", "FF"), + ("python_implementation", ">=", "freebsd", "FF"), + ("python_implementation", ">=", "literally any string can go here", "FF"), + ("python_implementation", ">=", "things @#4 dsfd (((", "FF"), + ("python_implementation", "<=", "1.0", "FF"), + ("python_implementation", "<=", "5.6a0", "FF"), + ("python_implementation", "<=", "dog", "FF"), + ("python_implementation", "<=", "freebsd", "FF"), + ("python_implementation", "<=", "literally any string can go here", "FF"), + ("python_implementation", "<=", "things @#4 dsfd (((", "FF"), + ("python_implementation", "!=", "1.0", "TT"), + ("python_implementation", "!=", "5.6a0", "TT"), + ("python_implementation", "!=", "dog", "TT"), + ("python_implementation", "!=", "freebsd", "TT"), + ("python_implementation", "!=", "literally any string can go here", "TT"), + ("python_implementation", "!=", "things @#4 dsfd (((", "TT"), + ("python_implementation", "~=", "1.0", "EE"), + ("python_implementation", "~=", "5.6a0", "EE"), + ("python_implementation", "~=", "dog", "EE"), + ("python_implementation", "~=", "freebsd", "EE"), + ("python_implementation", "~=", "literally any string can go here", "EE"), + ("python_implementation", "~=", "things @#4 dsfd (((", "EE"), + ("python_implementation", ">", "1.0", "FF"), + ("python_implementation", ">", "5.6a0", "FF"), + ("python_implementation", ">", "dog", "FF"), + ("python_implementation", ">", "freebsd", "FF"), + ("python_implementation", ">", "literally any string can go here", "FF"), + ("python_implementation", ">", "things @#4 dsfd (((", "FF"), + ("python_implementation", "<", "1.0", "FF"), + ("python_implementation", "<", "5.6a0", "FF"), + ("python_implementation", "<", "dog", "FF"), + ("python_implementation", "<", "freebsd", "FF"), + ("python_implementation", "<", "literally any string can go here", "FF"), + ("python_implementation", "<", "things @#4 dsfd (((", "FF"), + ("python_implementation", "in", "1.0", "FF"), + ("python_implementation", "in", "5.6a0", "FF"), + ("python_implementation", "in", "dog", "FF"), + ("python_implementation", "in", "freebsd", "FF"), + ("python_implementation", "in", "literally any string can go here", "FF"), + ("python_implementation", "in", "things @#4 dsfd (((", "FF"), + ("python_implementation", "not in", "1.0", "TT"), + ("python_implementation", "not in", "5.6a0", "TT"), + ("python_implementation", "not in", "dog", "TT"), + ("python_implementation", "not in", "freebsd", "TT"), + ("python_implementation", "not in", "literally any string can go here", "TT"), + ("python_implementation", "not in", "things @#4 dsfd (((", "TT"), +] + +# (marker, expected) +LOGIC_CASES = [ + ("\"arm\" in platform_machine and \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" or python_full_version < \"3.11.4\" and \"arm\" in platform_machine and ((python_full_version < \"3.11.4\" and \"posix\" == os_name) or os_name == \"posix\" or os_name == \"posix\" or python_version >= \"3.8\" and python_full_version < \"3.11.4\" or sys_platform != 'linux' and os_name == \"posix\" and \"arm\" in platform_machine or python_full_version < \"3.11.4\") or ((python_version >= \"3.8\" or os_name == \"posix\") or (platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and python_full_version < \"3.11.4\" and extra == \"foo\")) and os_name == \"posix\"", True), + ("\"arm\" in platform_machine and (platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine or os_name == \"posix\") or (\"posix\" == os_name and python_full_version < \"3.11.4\" or os_name == \"posix\") or extra == \"foo\" or \"arm\" in platform_machine and \"posix\" == os_name and extra == \"foo\" and \"posix\" == os_name and sys_platform != 'linux' and python_version >= \"3.8\" or extra == \"foo\" or platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine or os_name == \"nt\" and os_name == \"posix\" or ((\"posix\" == os_name and os_name == \"nt\" and extra == \"foo\" or python_full_version < \"3.11.4\") or \"arm\" in platform_machine and extra == \"foo\" or sys_platform != 'linux' or (\"posix\" == os_name or os_name == \"posix\") and os_name == \"nt\")", True), + ("\"arm\" in platform_machine or (sys_platform != 'linux' or \"arm\" in platform_machine) and python_full_version < \"3.11.4\" and python_version >= \"3.8\" and python_version >= \"3.8\" and python_full_version < \"3.11.4\"", False), + ("\"posix\" == os_name", True), + ("\"posix\" == os_name and (sys_platform != 'linux' or python_full_version < \"3.11.4\" and extra == \"foo\") or \"arm\" in platform_machine and \"posix\" == os_name or platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine and os_name == \"nt\" or \"arm\" in platform_machine and (extra == \"foo\" and python_version >= \"3.8\" and \"arm\" in platform_machine)", True), + ("\"posix\" == os_name and sys_platform != 'linux' or \"posix\" == os_name and os_name == \"nt\" or os_name == \"posix\" or platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" and (os_name == \"nt\" and os_name == \"posix\" or os_name == \"nt\" or \"arm\" in platform_machine) or (extra == \"foo\" or os_name == \"nt\" and os_name == \"posix\")", True), + ("\"posix\" == os_name or \"arm\" in platform_machine or os_name == \"posix\" and os_name == \"posix\" or python_version >= \"3.8\" or extra == \"foo\" and python_version >= \"3.8\" or \"arm\" in platform_machine or \"arm\" in platform_machine and os_name == \"posix\" and platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine", True), + ("(\"arm\" in platform_machine and ((\"posix\" == os_name or platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine or python_full_version < \"3.11.4\") and os_name == \"nt\" or platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" or python_version >= \"3.8\" and (os_name == \"nt\" or sys_platform != 'linux' or \"posix\" == os_name)) and (os_name == \"posix\" and extra == \"foo\" or python_version >= \"3.8\") or python_full_version < \"3.11.4\" and python_version >= \"3.8\")", False), + ("(\"arm\" in platform_machine and python_full_version < \"3.11.4\" or (sys_platform != 'linux' and sys_platform != 'linux' and os_name == \"posix\") or (os_name == \"nt\" or python_version >= \"3.8\" and \"arm\" in platform_machine or \"arm\" in platform_machine) and (os_name == \"posix\" and extra == \"foo\" and python_version >= \"3.8\" or os_name == \"nt\" and python_version >= \"3.8\" and \"arm\" in platform_machine or os_name == \"nt\" and os_name == \"nt\") or python_full_version < \"3.11.4\")", False), + ("(\"arm\" in platform_machine or python_full_version < \"3.11.4\" and extra == \"foo\") or (platform_machine in \"x86_64 amd64\" and os_name == \"nt\" or python_full_version < \"3.11.4\" or os_name == \"nt\") or \"arm\" in platform_machine or extra == \"foo\" or \"posix\" == os_name and os_name == \"nt\" or os_name == \"nt\" and platform_machine in \"x86_64 amd64\" and extra == \"foo\" and python_full_version < \"3.11.4\" or (os_name == \"nt\" or \"arm\" in platform_machine) and python_full_version < \"3.11.4\" and \"arm\" in platform_machine", True), + ("(\"arm\" in platform_machine or python_version >= \"3.8\" and extra == \"foo\" or extra == \"foo\" or (python_version >= \"3.8\" or \"arm\" in platform_machine and python_full_version < \"3.11.4\") or (python_full_version < \"3.11.4\" and \"arm\" in platform_machine)) and \"arm\" in platform_machine and os_name == \"posix\" or sys_platform != 'linux' and os_name == \"posix\" and sys_platform != 'linux' and sys_platform != 'linux' and os_name == \"posix\" or extra == \"foo\" or python_version >= \"3.8\" or python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" and (sys_platform != 'linux' and sys_platform != 'linux') or sys_platform != 'linux' or python_version >= \"3.8\" or extra == \"foo\" and os_name == \"posix\"", True), + ("(\"posix\" == os_name and os_name == \"posix\" or os_name == \"nt\" or python_version >= \"3.8\" or \"posix\" == os_name and os_name == \"nt\" or (extra == \"foo\" or \"posix\" == os_name and python_version >= \"3.8\")) and (platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" or \"posix\" == os_name) or python_full_version < \"3.11.4\" and (python_full_version < \"3.11.4\" or extra == \"foo\" or \"arm\" in platform_machine) or (os_name == \"posix\" and python_full_version < \"3.11.4\") or \"arm\" in platform_machine or (os_name == \"posix\" or os_name == \"posix\" or (\"arm\" in platform_machine and sys_platform != 'linux' and python_version >= \"3.8\") or (extra == \"foo\" and os_name == \"posix\" or extra == \"foo\"))", True), + ("(\"posix\" == os_name and platform_machine in \"x86_64 amd64\" or (\"posix\" == os_name or python_version >= \"3.8\" or os_name == \"posix\" or platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" or (os_name == \"nt\" or platform_machine in \"x86_64 amd64\" or \"posix\" == os_name)) or (python_full_version < \"3.11.4\" and extra == \"foo\" and python_full_version < \"3.11.4\" or python_full_version < \"3.11.4\" or \"arm\" in platform_machine))", True), + ("(\"posix\" == os_name and sys_platform != 'linux' and extra == \"foo\" or sys_platform != 'linux') or python_version >= \"3.8\" or \"arm\" in platform_machine or extra == \"foo\" or (python_full_version < \"3.11.4\" or extra == \"foo\" and os_name == \"posix\" and extra == \"foo\" or platform_machine in \"x86_64 amd64\" or (extra == \"foo\" or python_version >= \"3.8\" or sys_platform != 'linux'))", True), + ("(\"posix\" == os_name and sys_platform != 'linux' or platform_machine in \"x86_64 amd64\" or \"posix\" == os_name or sys_platform != 'linux' and python_version >= \"3.8\" or (os_name == \"nt\" or os_name == \"nt\") or (os_name == \"posix\" and platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine and \"posix\" == os_name) or ((extra == \"foo\" or \"arm\" in platform_machine or python_version >= \"3.8\") or (os_name == \"posix\" and os_name == \"posix\" or platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\") and sys_platform != 'linux' and \"arm\" in platform_machine or os_name == \"nt\" or os_name == \"posix\"))", True), + ("(\"posix\" == os_name or \"arm\" in platform_machine and ((python_version >= \"3.8\" or python_version >= \"3.8\" or python_version >= \"3.8\" and sys_platform != 'linux') or (os_name == \"nt\" or extra == \"foo\")))", True), + ("(\"posix\" == os_name or \"arm\" in platform_machine and sys_platform != 'linux' and \"posix\" == os_name and \"posix\" == os_name or extra == \"foo\" and (extra == \"foo\" or os_name == \"posix\") and (extra == \"foo\" and \"arm\" in platform_machine and \"arm\" in platform_machine and \"arm\" in platform_machine) or python_full_version < \"3.11.4\" and python_version >= \"3.8\")", True), + ("((\"posix\" == os_name and (python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\" and sys_platform != 'linux' or python_full_version < \"3.11.4\") and (os_name == \"nt\" or platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine) or (os_name == \"posix\" or \"posix\" == os_name and os_name == \"posix\")) and os_name == \"posix\" or python_version >= \"3.8\" or \"arm\" in platform_machine and sys_platform != 'linux' and (python_version >= \"3.8\" or \"arm\" in platform_machine and os_name == \"posix\") and (sys_platform != 'linux' or extra == \"foo\" and os_name == \"posix\" and extra == \"foo\") or platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" and extra == \"foo\" and platform_machine in \"x86_64 amd64\" and os_name == \"nt\" and (python_version >= \"3.8\" and \"posix\" == os_name))", True), + ("(((\"arm\" in platform_machine and python_full_version < \"3.11.4\" and python_version >= \"3.8\") or python_version >= \"3.8\" and os_name == \"nt\" or sys_platform != 'linux' or \"arm\" in platform_machine) or os_name == \"nt\" and extra == \"foo\" and (python_full_version < \"3.11.4\" and python_version >= \"3.8\" or os_name == \"posix\" and python_full_version < \"3.11.4\") and os_name == \"nt\" or os_name == \"posix\" or (os_name == \"posix\" or sys_platform != 'linux'))", True), + ("(((extra == \"foo\" and python_full_version < \"3.11.4\" or python_full_version < \"3.11.4\") or (\"arm\" in platform_machine or os_name == \"nt\") or python_full_version < \"3.11.4\" or sys_platform != 'linux' and platform_machine in \"x86_64 amd64\" and extra == \"foo\" and (\"arm\" in platform_machine and os_name == \"nt\")) and (platform_machine in \"x86_64 amd64\" or os_name == \"posix\" or platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" or (os_name == \"posix\" or sys_platform != 'linux' or \"arm\" in platform_machine and sys_platform != 'linux')) and sys_platform != 'linux' and \"posix\" == os_name and (os_name == \"nt\" and python_full_version < \"3.11.4\" and sys_platform != 'linux' and \"arm\" in platform_machine) and (\"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\") or os_name == \"posix\" and (\"arm\" in platform_machine and extra == \"foo\" or python_version >= \"3.8\" or os_name == \"nt\") and (python_full_version < \"3.11.4\" or os_name == \"nt\" or \"posix\" == os_name))", True), + ("(((os_name == \"nt\" and sys_platform != 'linux' or os_name == \"posix\") or os_name == \"nt\" or platform_machine in \"x86_64 amd64\" and (sys_platform != 'linux' or extra == \"foo\") or (os_name == \"nt\" and python_version >= \"3.8\" and os_name == \"nt\")) and python_version >= \"3.8\" and (\"arm\" in platform_machine or \"posix\" == os_name and \"arm\" in platform_machine) or os_name == \"posix\")", True), + ("(((os_name == \"posix\" or os_name == \"posix\") or (os_name == \"posix\" and python_full_version < \"3.11.4\")) and \"arm\" in platform_machine or ((python_full_version < \"3.11.4\" or python_version >= \"3.8\" or platform_machine in \"x86_64 amd64\" or os_name == \"posix\") or (platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine) and (platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\") or \"posix\" == os_name))", True), + ("(((sys_platform != 'linux' and platform_machine in \"x86_64 amd64\" or platform_machine in \"x86_64 amd64\" and extra == \"foo\") and (\"posix\" == os_name or \"posix\" == os_name and \"arm\" in platform_machine) or os_name == \"posix\" or (python_version >= \"3.8\" or \"arm\" in platform_machine or platform_machine in \"x86_64 amd64\" and extra == \"foo\")) or os_name == \"nt\" and \"posix\" == os_name and platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" and sys_platform != 'linux' and extra == \"foo\" and python_full_version < \"3.11.4\")", True), + ("((extra == \"foo\" or (\"posix\" == os_name and python_full_version < \"3.11.4\" or platform_machine in \"x86_64 amd64\") and os_name == \"posix\" and python_version >= \"3.8\" and python_full_version < \"3.11.4\" and platform_machine in \"x86_64 amd64\") and ((\"posix\" == os_name and python_full_version < \"3.11.4\" or python_full_version < \"3.11.4\" and \"posix\" == os_name) and sys_platform != 'linux' and os_name == \"posix\" and \"arm\" in platform_machine))", False), + ("((os_name == \"nt\" and \"posix\" == os_name and os_name == \"posix\" or sys_platform != 'linux') and (\"arm\" in platform_machine and python_version >= \"3.8\")) or ((os_name == \"nt\" and extra == \"foo\" or os_name == \"nt\") and (sys_platform != 'linux' or extra == \"foo\") or extra == \"foo\" and \"posix\" == os_name or platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\") or python_version >= \"3.8\" and os_name == \"nt\" and (\"posix\" == os_name or python_full_version < \"3.11.4\") or (python_version >= \"3.8\" and python_full_version < \"3.11.4\" or extra == \"foo\" and os_name == \"posix\") and python_full_version < \"3.11.4\" or sys_platform != 'linux' or sys_platform != 'linux' and extra == \"foo\" or (sys_platform != 'linux' and \"arm\" in platform_machine and python_full_version < \"3.11.4\")", True), + ("((os_name == \"nt\" or \"posix\" == os_name or (os_name == \"posix\" or sys_platform != 'linux' and python_full_version < \"3.11.4\") or \"posix\" == os_name) or os_name == \"posix\" and extra == \"foo\" or extra == \"foo\" or \"posix\" == os_name and (sys_platform != 'linux' and \"arm\" in platform_machine and extra == \"foo\") and (os_name == \"posix\" or \"arm\" in platform_machine or python_version >= \"3.8\" or os_name == \"nt\") and python_full_version < \"3.11.4\")", True), + ("((os_name == \"nt\" or platform_machine in \"x86_64 amd64\" or os_name == \"posix\" or python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\" or sys_platform != 'linux' and (os_name == \"nt\" or extra == \"foo\" and \"arm\" in platform_machine) or (python_version >= \"3.8\" and sys_platform != 'linux' and os_name == \"posix\")) and sys_platform != 'linux')", False), + ("((os_name == \"posix\" and \"arm\" in platform_machine) and (python_version >= \"3.8\" or os_name == \"nt\") and sys_platform != 'linux' or extra == \"foo\" and \"posix\" == os_name and platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" and platform_machine in \"x86_64 amd64\" or python_version >= \"3.8\" or platform_machine in \"x86_64 amd64\")", True), + ("((os_name == \"posix\" and extra == \"foo\") and os_name == \"nt\" or (extra == \"foo\" or python_version >= \"3.8\" and os_name == \"nt\") and \"arm\" in platform_machine or ((python_version >= \"3.8\" or os_name == \"posix\" and python_full_version < \"3.11.4\") or (os_name == \"posix\" or os_name == \"posix\") or (platform_machine in \"x86_64 amd64\" or extra == \"foo\" and sys_platform != 'linux')))", True), + ("((platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine or \"arm\" in platform_machine) and sys_platform != 'linux')", False), + ("((python_full_version < \"3.11.4\" or os_name == \"posix\" and (os_name == \"nt\" or os_name == \"nt\" or sys_platform != 'linux' or python_version >= \"3.8\") and (platform_machine in \"x86_64 amd64\" and sys_platform != 'linux' and extra == \"foo\")) and sys_platform != 'linux')", False), + ("((python_version >= \"3.8\" and os_name == \"nt\" and \"arm\" in platform_machine or platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" or os_name == \"nt\" or (python_version >= \"3.8\" and python_version >= \"3.8\" or extra == \"foo\" or os_name == \"posix\")) and python_full_version < \"3.11.4\" and \"posix\" == os_name or python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\" or os_name == \"posix\" and python_version >= \"3.8\" or (extra == \"foo\" or python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\") or os_name == \"posix\" or os_name == \"posix\" or python_version >= \"3.8\" and \"posix\" == os_name)", True), + ("((python_version >= \"3.8\" and os_name == \"posix\" or sys_platform != 'linux' or python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" and \"posix\" == os_name or (sys_platform != 'linux' or python_version >= \"3.8\")) and (python_version >= \"3.8\" or python_full_version < \"3.11.4\" and os_name == \"posix\" or python_version >= \"3.8\" and sys_platform != 'linux' or python_version >= \"3.8\"))", True), + ("((python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" and \"posix\" == os_name and python_full_version < \"3.11.4\") or sys_platform != 'linux' and extra == \"foo\" and sys_platform != 'linux' and os_name == \"nt\" or (python_full_version < \"3.11.4\" and python_version >= \"3.8\") and os_name == \"posix\" and os_name == \"nt\" or (\"posix\" == os_name and python_version >= \"3.8\" or \"posix\" == os_name) and (os_name == \"nt\" and \"posix\" == os_name and extra == \"foo\" and \"arm\" in platform_machine) or (extra == \"foo\" and extra == \"foo\" and \"arm\" in platform_machine or sys_platform != 'linux'))", False), + ("((python_version >= \"3.8\" or (platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\") or (os_name == \"posix\" and os_name == \"posix\") or (platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\")) and (sys_platform != 'linux' and sys_platform != 'linux' or os_name == \"posix\" or sys_platform != 'linux' and os_name == \"posix\" or python_version >= \"3.8\" and python_version >= \"3.8\" or sys_platform != 'linux' and platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\") or (extra == \"foo\" or os_name == \"posix\" or os_name == \"posix\" and \"posix\" == os_name and \"posix\" == os_name and os_name == \"posix\" and os_name == \"nt\"))", True), + ("((python_version >= \"3.8\" or extra == \"foo\" and python_version >= \"3.8\") or (python_full_version < \"3.11.4\" and extra == \"foo\")) and os_name == \"posix\"", True), + ("((python_version >= \"3.8\" or os_name == \"nt\" or extra == \"foo\") and python_full_version < \"3.11.4\" and extra == \"foo\") or os_name == \"posix\" and python_version >= \"3.8\" and python_full_version < \"3.11.4\" and (\"posix\" == os_name or \"arm\" in platform_machine) and \"arm\" in platform_machine or \"arm\" in platform_machine and os_name == \"posix\" or os_name == \"posix\" and os_name == \"nt\" and python_full_version < \"3.11.4\" or os_name == \"nt\" or \"arm\" in platform_machine or os_name == \"nt\"", False), + ("((python_version >= \"3.8\" or python_full_version < \"3.11.4\" or extra == \"foo\" or os_name == \"posix\" or (extra == \"foo\" or extra == \"foo\" and \"arm\" in platform_machine) or \"posix\" == os_name or sys_platform != 'linux' or extra == \"foo\") and extra == \"foo\" or extra == \"foo\" and sys_platform != 'linux' and sys_platform != 'linux' or os_name == \"nt\" and \"arm\" in platform_machine)", True), + ("((sys_platform != 'linux' and (\"posix\" == os_name and sys_platform != 'linux' and os_name == \"nt\") or (python_version >= \"3.8\" or \"posix\" == os_name and \"arm\" in platform_machine or os_name == \"nt\")) and (python_full_version < \"3.11.4\" and python_version >= \"3.8\" and \"posix\" == os_name and (sys_platform != 'linux' and platform_machine in \"x86_64 amd64\" and os_name == \"nt\")))", False), + ("(extra == \"foo\" and \"arm\" in platform_machine or python_full_version < \"3.11.4\" and os_name == \"nt\") and (python_full_version < \"3.11.4\" or os_name == \"nt\" or python_version >= \"3.8\") and (python_full_version < \"3.11.4\" or os_name == \"posix\" and os_name == \"nt\") or platform_machine in \"x86_64 amd64\" or (\"posix\" == os_name or extra == \"foo\" and extra == \"foo\" and \"arm\" in platform_machine) or os_name == \"posix\"", True), + ("(extra == \"foo\" or python_version >= \"3.8\" or ((\"arm\" in platform_machine and sys_platform != 'linux' or \"posix\" == os_name) and os_name == \"nt\" and python_full_version < \"3.11.4\" and \"posix\" == os_name and sys_platform != 'linux') or \"posix\" == os_name and sys_platform != 'linux' or \"arm\" in platform_machine and \"posix\" == os_name or python_version >= \"3.8\" and sys_platform != 'linux' or python_full_version < \"3.11.4\" and sys_platform != 'linux' or \"arm\" in platform_machine)", True), + ("(extra == \"foo\" or python_version >= \"3.8\" or os_name == \"posix\" and \"arm\" in platform_machine and \"posix\" == os_name or extra == \"foo\" or \"posix\" == os_name and extra == \"foo\" or os_name == \"nt\") or ((os_name == \"nt\" and extra == \"foo\" or python_full_version < \"3.11.4\") or extra == \"foo\" or python_full_version < \"3.11.4\" and python_version >= \"3.8\" or (python_full_version < \"3.11.4\" and python_version >= \"3.8\" or os_name == \"nt\" or \"arm\" in platform_machine)) or python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\"", True), + ("(extra == \"foo\" or python_version >= \"3.8\") or (extra == \"foo\" and \"posix\" == os_name or os_name == \"posix\") or (\"posix\" == os_name and platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine and os_name == \"nt\") and \"arm\" in platform_machine and extra == \"foo\" or \"posix\" == os_name or (extra == \"foo\" or \"posix\" == os_name or python_version >= \"3.8\" and extra == \"foo\" and sys_platform != 'linux' or os_name == \"nt\") or extra == \"foo\" or os_name == \"nt\" or python_full_version < \"3.11.4\" or \"posix\" == os_name and python_full_version < \"3.11.4\" and \"arm\" in platform_machine and \"posix\" == os_name", True), + ("(os_name == \"nt\" and extra == \"foo\" and sys_platform != 'linux' or \"posix\" == os_name and extra == \"foo\" and os_name == \"nt\" and ((python_full_version < \"3.11.4\" and os_name == \"nt\") or (python_full_version < \"3.11.4\" and \"arm\" in platform_machine and python_full_version < \"3.11.4\" and python_version >= \"3.8\") or (os_name == \"nt\" or sys_platform != 'linux' or \"posix\" == os_name) or os_name == \"nt\" and \"posix\" == os_name and \"arm\" in platform_machine and sys_platform != 'linux') or ((os_name == \"nt\" or \"posix\" == os_name) and os_name == \"nt\" and (os_name == \"nt\" and os_name == \"posix\" or python_full_version < \"3.11.4\")))", False), + ("(os_name == \"nt\" and platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and \"posix\" == os_name and python_version >= \"3.8\" and extra == \"foo\" or python_version >= \"3.8\" and extra == \"foo\" and (os_name == \"posix\" and os_name == \"posix\" or extra == \"foo\") and os_name == \"nt\" or \"arm\" in platform_machine and \"arm\" in platform_machine or os_name == \"posix\" and (os_name == \"nt\" or python_full_version < \"3.11.4\" or sys_platform != 'linux' or extra == \"foo\" and os_name == \"nt\" and os_name == \"posix\" and os_name == \"posix\" or platform_machine in \"x86_64 amd64\" or platform_machine in \"x86_64 amd64\"))", True), + ("(os_name == \"nt\" or \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" or python_full_version < \"3.11.4\" and (sys_platform != 'linux' and os_name == \"posix\" and \"posix\" == os_name) or (\"arm\" in platform_machine or \"arm\" in platform_machine and extra == \"foo\") and platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and python_version >= \"3.8\" and sys_platform != 'linux') and extra == \"foo\" or python_version >= \"3.8\" or sys_platform != 'linux' or python_full_version < \"3.11.4\" or (os_name == \"nt\" or python_full_version < \"3.11.4\" and \"posix\" == os_name and os_name == \"nt\") and os_name == \"posix\" and python_full_version < \"3.11.4\" or \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" and (platform_machine in \"x86_64 amd64\" and extra == \"foo\" or python_version >= \"3.8\" or extra == \"foo\") and sys_platform != 'linux' and os_name == \"posix\" or python_version >= \"3.8\" or os_name == \"nt\" and \"posix\" == os_name and extra == \"foo\" or os_name == \"posix\" or extra == \"foo\"", True), + ("(os_name == \"nt\" or \"posix\" == os_name or \"posix\" == os_name and \"arm\" in platform_machine) and \"arm\" in platform_machine and python_version >= \"3.8\" and python_full_version < \"3.11.4\" or extra == \"foo\" and (os_name == \"posix\" and \"posix\" == os_name) or extra == \"foo\" and (python_version >= \"3.8\" and os_name == \"posix\" and \"posix\" == os_name) and \"posix\" == os_name and sys_platform != 'linux' and python_full_version < \"3.11.4\" and extra == \"foo\" or os_name == \"posix\" or \"arm\" in platform_machine and \"arm\" in platform_machine and python_full_version < \"3.11.4\"", True), + ("(os_name == \"nt\" or os_name == \"nt\" or \"posix\" == os_name or \"arm\" in platform_machine or (sys_platform != 'linux' and sys_platform != 'linux' and python_version >= \"3.8\") or extra == \"foo\" or (os_name == \"posix\" or (python_full_version < \"3.11.4\" and platform_machine in \"x86_64 amd64\") or sys_platform != 'linux' or (\"posix\" == os_name or python_version >= \"3.8\")) and (\"arm\" in platform_machine or (os_name == \"posix\" or os_name == \"nt\" or \"posix\" == os_name) or python_version >= \"3.8\" or platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" or os_name == \"posix\") and ((\"arm\" in platform_machine and python_full_version < \"3.11.4\" or os_name == \"posix\" and extra == \"foo\") and (os_name == \"nt\" and \"arm\" in platform_machine or os_name == \"nt\" or platform_machine in \"x86_64 amd64\")))", True), + ("(os_name == \"posix\" and extra == \"foo\" or extra == \"foo\" and os_name == \"posix\" and os_name == \"posix\" or os_name == \"nt\") or sys_platform != 'linux' and os_name == \"nt\" and (python_version >= \"3.8\" or platform_machine in \"x86_64 amd64\" or platform_machine in \"x86_64 amd64\" and \"posix\" == os_name and (platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine and os_name == \"nt\"))", True), + ("(os_name == \"posix\" or ((sys_platform != 'linux' and sys_platform != 'linux') and \"posix\" == os_name) or (python_full_version < \"3.11.4\" or os_name == \"nt\"))", True), + ("(platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" or \"arm\" in platform_machine and sys_platform != 'linux' and python_full_version < \"3.11.4\" or \"arm\" in platform_machine or (\"arm\" in platform_machine and \"posix\" == os_name and python_full_version < \"3.11.4\")) or (python_full_version < \"3.11.4\" and sys_platform != 'linux' or \"posix\" == os_name and os_name == \"nt\" or \"arm\" in platform_machine and sys_platform != 'linux' or python_version >= \"3.8\" or python_full_version < \"3.11.4\" or sys_platform != 'linux') or sys_platform != 'linux'", True), + ("(platform_machine in \"x86_64 amd64\" or (sys_platform != 'linux' and extra == \"foo\" and \"arm\" in platform_machine and \"arm\" in platform_machine and python_full_version < \"3.11.4\" and os_name == \"nt\" and os_name == \"posix\") or (python_full_version < \"3.11.4\" or os_name == \"posix\" or (python_full_version < \"3.11.4\" or \"posix\" == os_name or \"posix\" == os_name or python_full_version < \"3.11.4\")))", True), + ("(python_full_version < \"3.11.4\" and \"posix\" == os_name or os_name == \"posix\" and \"arm\" in platform_machine or os_name == \"posix\" and extra == \"foo\" and ((\"arm\" in platform_machine or platform_machine in \"x86_64 amd64\") or python_version >= \"3.8\") and (python_full_version < \"3.11.4\" and platform_machine in \"x86_64 amd64\" and (os_name == \"nt\" or platform_machine in \"x86_64 amd64\") or (os_name == \"nt\" or os_name == \"nt\" or \"arm\" in platform_machine and os_name == \"nt\") or \"posix\" == os_name and \"posix\" == os_name and python_version >= \"3.8\"))", True), + ("(python_full_version < \"3.11.4\" and (sys_platform != 'linux' and \"posix\" == os_name or \"arm\" in platform_machine or sys_platform != 'linux' and os_name == \"nt\") and (platform_machine in \"x86_64 amd64\" or extra == \"foo\" and python_full_version < \"3.11.4\" or \"posix\" == os_name) and python_full_version < \"3.11.4\")", False), + ("(python_full_version < \"3.11.4\" or sys_platform != 'linux' or sys_platform != 'linux' and sys_platform != 'linux' or \"arm\" in platform_machine and sys_platform != 'linux' and \"arm\" in platform_machine) and os_name == \"nt\" or platform_machine in \"x86_64 amd64\" and os_name == \"posix\" or \"arm\" in platform_machine and sys_platform != 'linux' and python_version >= \"3.8\"", True), + ("(python_version >= \"3.8\" or \"posix\" == os_name or \"posix\" == os_name and platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine and python_version >= \"3.8\" or python_version >= \"3.8\")", True), + ("(python_version >= \"3.8\" or (os_name == \"nt\" and python_version >= \"3.8\" and python_version >= \"3.8\" or \"posix\" == os_name) or (os_name == \"nt\" and \"posix\" == os_name or extra == \"foo\") and (\"arm\" in platform_machine or os_name == \"posix\" or python_version >= \"3.8\") and (extra == \"foo\" and os_name == \"posix\" or os_name == \"nt\") and \"arm\" in platform_machine)", True), + ("(sys_platform != 'linux' or \"posix\" == os_name and extra == \"foo\" and sys_platform != 'linux') and \"arm\" in platform_machine and \"arm\" in platform_machine or (extra == \"foo\" or \"arm\" in platform_machine and os_name == \"posix\" and python_full_version < \"3.11.4\" and platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" and \"posix\" == os_name)", True), + ("extra == \"foo\"", True), + ("extra == \"foo\" and ((python_full_version < \"3.11.4\" and os_name == \"nt\") or sys_platform != 'linux') or \"arm\" in platform_machine or os_name == \"nt\" and extra == \"foo\" and \"arm\" in platform_machine and \"posix\" == os_name", False), + ("extra == \"foo\" or python_version >= \"3.8\" or \"posix\" == os_name and (python_full_version < \"3.11.4\" and os_name == \"nt\" and python_full_version < \"3.11.4\") or \"arm\" in platform_machine and os_name == \"nt\" or (\"posix\" == os_name or extra == \"foo\" and \"arm\" in platform_machine or \"arm\" in platform_machine or (platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\")) or sys_platform != 'linux' and \"arm\" in platform_machine and os_name == \"posix\" or python_version >= \"3.8\" or platform_machine in \"x86_64 amd64\"", True), + ("os_name == \"nt\"", False), + ("os_name == \"nt\" and (\"posix\" == os_name and platform_machine in \"x86_64 amd64\" and os_name == \"posix\" or \"posix\" == os_name) or os_name == \"posix\" and python_full_version < \"3.11.4\" and sys_platform != 'linux'", False), + ("os_name == \"nt\" and os_name == \"posix\"", False), + ("os_name == \"posix\"", True), + ("os_name == \"posix\" and \"posix\" == os_name or extra == \"foo\" and extra == \"foo\" or \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine and extra == \"foo\" or os_name == \"nt\" or python_version >= \"3.8\" and python_version >= \"3.8\" or (platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine or platform_machine in \"x86_64 amd64\")", True), + ("os_name == \"posix\" and extra == \"foo\" and platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine or python_full_version < \"3.11.4\"", False), + ("os_name == \"posix\" or (\"arm\" in platform_machine and \"posix\" == os_name or \"posix\" == os_name or python_version >= \"3.8\" or (platform_machine in \"x86_64 amd64\" and extra == \"foo\" or python_full_version < \"3.11.4\" and os_name == \"posix\"))", True), + ("os_name == \"posix\" or extra == \"foo\" or (extra == \"foo\" or \"arm\" in platform_machine and \"arm\" in platform_machine) and (os_name == \"posix\" or os_name == \"posix\") or os_name == \"nt\" and (os_name == \"posix\" and \"posix\" == os_name or python_full_version < \"3.11.4\") or python_version >= \"3.8\" or sys_platform != 'linux' and os_name == \"nt\" or (os_name == \"posix\" and \"posix\" == os_name and platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\") or platform_machine in \"x86_64 amd64\" or os_name == \"posix\" and python_version >= \"3.8\" or python_version >= \"3.8\" and \"arm\" in platform_machine", True), + ("platform_machine in \"x86_64 amd64\"", True), + ("platform_machine in \"x86_64 amd64\" and extra == \"foo\" and platform_machine in \"x86_64 amd64\" and os_name == \"posix\" or extra == \"foo\" or (python_full_version < \"3.11.4\" and os_name == \"posix\" or \"arm\" in platform_machine) or extra == \"foo\"", True), + ("platform_machine in \"x86_64 amd64\" or \"arm\" in platform_machine or \"posix\" == os_name and (sys_platform != 'linux' and (sys_platform != 'linux' and extra == \"foo\" and os_name == \"posix\" and platform_machine in \"x86_64 amd64\") or os_name == \"posix\" and python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\" and os_name == \"nt\")", True), + ("platform_machine in \"x86_64 amd64\" or extra == \"foo\" and platform_machine in \"x86_64 amd64\" and (\"arm\" in platform_machine or os_name == \"nt\") or extra == \"foo\" or \"arm\" in platform_machine and os_name == \"posix\" and sys_platform != 'linux' or (platform_machine in \"x86_64 amd64\" or sys_platform != 'linux' and \"arm\" in platform_machine) or (python_version >= \"3.8\" and (os_name == \"nt\" and \"arm\" in platform_machine and os_name == \"nt\" and extra == \"foo\") and (\"posix\" == os_name or os_name == \"posix\") and \"posix\" == os_name)", True), + ("python_full_version < \"3.11.4\"", False), + ("python_full_version < \"3.11.4\" and \"arm\" in platform_machine and sys_platform != 'linux' and os_name == \"nt\" or \"arm\" in platform_machine and (python_version >= \"3.8\" and os_name == \"nt\" or os_name == \"posix\") and python_version >= \"3.8\" or extra == \"foo\" or (\"posix\" == os_name and os_name == \"nt\" and \"posix\" == os_name) or python_version >= \"3.8\" or \"posix\" == os_name and sys_platform != 'linux' or sys_platform != 'linux' and (python_full_version < \"3.11.4\" and (sys_platform != 'linux' or \"arm\" in platform_machine and os_name == \"posix\" and python_version >= \"3.8\") and \"arm\" in platform_machine) and sys_platform != 'linux' or extra == \"foo\" and \"arm\" in platform_machine or os_name == \"nt\" or extra == \"foo\" and python_full_version < \"3.11.4\"", True), + ("python_full_version < \"3.11.4\" and \"posix\" == os_name or os_name == \"nt\" or sys_platform != 'linux' or os_name == \"posix\" or \"arm\" in platform_machine or python_version >= \"3.8\" or python_version >= \"3.8\" and python_version >= \"3.8\" or sys_platform != 'linux' or python_full_version < \"3.11.4\" or extra == \"foo\" or (python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" or python_full_version < \"3.11.4\" and python_full_version < \"3.11.4\" or os_name == \"posix\" and \"arm\" in platform_machine or sys_platform != 'linux' and (os_name == \"nt\" or \"arm\" in platform_machine and \"arm\" in platform_machine or python_full_version < \"3.11.4\") or platform_machine in \"x86_64 amd64\" or \"posix\" == os_name)", True), + ("python_full_version < \"3.11.4\" and (platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" and extra == \"foo\") and \"arm\" in platform_machine and python_version >= \"3.8\" and python_full_version < \"3.11.4\" or python_version >= \"3.8\" or (python_version >= \"3.8\" and os_name == \"posix\" or \"arm\" in platform_machine and platform_machine in \"x86_64 amd64\" or python_version >= \"3.8\" and os_name == \"nt\" or python_full_version < \"3.11.4\")", True), + ("python_version >= \"3.8\"", True), + ("python_version >= \"3.8\" and (python_version >= \"3.8\" and platform_machine in \"x86_64 amd64\" and python_version >= \"3.8\" and os_name == \"nt\" or platform_machine in \"x86_64 amd64\" and \"arm\" in platform_machine) or ((platform_machine in \"x86_64 amd64\" and platform_machine in \"x86_64 amd64\" and python_full_version < \"3.11.4\" and python_version >= \"3.8\") and (extra == \"foo\" and python_version >= \"3.8\" or os_name == \"posix\") and python_version >= \"3.8\" or \"posix\" == os_name)", True), + ("python_version >= \"3.8\" and (python_version >= \"3.8\" or extra == \"foo\" and os_name == \"nt\" and \"posix\" == os_name) or extra == \"foo\" and os_name == \"posix\" or os_name == \"posix\"", True), + ("python_version >= \"3.8\" or ((os_name == \"posix\" and extra == \"foo\" and platform_machine in \"x86_64 amd64\" or python_full_version < \"3.11.4\") or (python_version >= \"3.8\" or os_name == \"nt\" or python_version >= \"3.8\" or sys_platform != 'linux'))", True), + ("python_version >= \"3.8\" or (os_name == \"nt\" and extra == \"foo\" and python_full_version < \"3.11.4\" and os_name == \"posix\") or ((sys_platform != 'linux' and python_full_version < \"3.11.4\" and extra == \"foo\") or (os_name == \"nt\" and \"posix\" == os_name) or os_name == \"posix\" or os_name == \"nt\")", True), + ("sys_platform != 'linux'", False), +] diff --git a/tests/pypi/pep508/packaging_conformance_tests.bzl b/tests/pypi/pep508/packaging_conformance_tests.bzl new file mode 100644 index 0000000000..9cda459d57 --- /dev/null +++ b/tests/pypi/pep508/packaging_conformance_tests.bzl @@ -0,0 +1,84 @@ +"""Conformance tests that use the cases from the `packaging` project. + +The cases in `packaging_cases.bzl` are generated, see +`//tests/support/pypa_packaging`. +""" + +load("@rules_testing//lib:test_suite.bzl", "test_suite") +load("//python/private:normalize_name.bzl", "normalize_name") # buildifier: disable=bzl-visibility +load("//python/private/pypi:pep508_evaluate.bzl", "evaluate") # buildifier: disable=bzl-visibility +load( + ":packaging_cases.bzl", + "EVALUATE_CASES", + "INVALID_MARKERS", + "LOGIC_CASES", + "MARKER_ENV", + "MARKER_TABLE", +) + +_tests = [] + +def _env(overrides = {}): + env = dict(MARKER_ENV) | overrides | { + "_aliases": {"extra": normalize_name}, + } + + # The extra in the environment is expected to be already normalized. + env["extra"] = normalize_name(env["extra"]) + return env + +def _test_packaging_evaluate(env): + failures = [] + for marker, overrides, want in EVALUATE_CASES: + got = evaluate(marker, env = _env(json.decode(overrides))) + if got != want: + failures.append("{} with {}: got {}, want {}".format(marker, overrides, got, want)) + + env.expect.that_collection(failures).contains_exactly([]) + +_tests.append(_test_packaging_evaluate) + +def _test_packaging_invalid_markers(env): + failures = [ + marker + for marker in INVALID_MARKERS + if evaluate(marker, env = _env(), _fail = lambda _: "invalid") != "invalid" + ] + env.expect.that_collection(failures).contains_exactly([]) + +_tests.append(_test_packaging_invalid_markers) + +def _test_packaging_marker_table(env): + failures = [] + marker_env = _env() + for variable, op, value, results in MARKER_TABLE: + for marker, result in [ + ('{} {} "{}"'.format(variable, op, value), results[0]), + ('"{}" {} {}'.format(value, op, variable), results[1]), + ]: + want = {"E": "error", "F": False, "T": True}[result] + got = evaluate(marker, env = marker_env, _fail = lambda _: "error") + if got != want: + failures.append("{}: got {}, want {}".format(marker, got, want)) + + env.expect.that_collection(failures).contains_exactly([]) + +_tests.append(_test_packaging_marker_table) + +def _test_packaging_logic(env): + failures = [] + marker_env = _env() + for marker, want in LOGIC_CASES: + got = evaluate(marker, env = marker_env) + if got != want: + failures.append("{}: got {}, want {}".format(marker, got, want)) + + env.expect.that_collection(failures).contains_exactly([]) + +_tests.append(_test_packaging_logic) + +def packaging_conformance_test_suite(name): + test_suite( + name = name, + basic_tests = _tests, + ) diff --git a/tests/support/pypa_packaging/BUILD.bazel b/tests/support/pypa_packaging/BUILD.bazel index c05cd26397..c53229aa25 100644 --- a/tests/support/pypa_packaging/BUILD.bazel +++ b/tests/support/pypa_packaging/BUILD.bazel @@ -5,9 +5,11 @@ load("//tests/support:support.bzl", "SUPPORTS_BZLMOD") _ARGS = [ "--test-version=$(rlocationpath @pypa_packaging//:tests/test_version.py)", "--test-specifiers=$(rlocationpath @pypa_packaging//:tests/test_specifiers.py)", + "--test-markers=$(rlocationpath @pypa_packaging//:tests/test_markers.py)", ] _DATA = [ + "@pypa_packaging//:tests/test_markers.py", "@pypa_packaging//:tests/test_specifiers.py", "@pypa_packaging//:tests/test_version.py", ] @@ -24,6 +26,7 @@ py_binary( name = "update", srcs = ["generate.py"], args = _ARGS + [ + "--marker-cases=tests/pypi/pep508/packaging_cases.bzl", "--version-cases=tests/version/packaging_cases.bzl", ], data = _DATA, @@ -37,9 +40,11 @@ py_test( srcs = ["generate.py"], args = _ARGS + [ "--check", + "--marker-cases=$(rlocationpath //tests/pypi/pep508:packaging_cases.bzl)", "--version-cases=$(rlocationpath //tests/version:packaging_cases.bzl)", ], data = _DATA + [ + "//tests/pypi/pep508:packaging_cases.bzl", "//tests/version:packaging_cases.bzl", ], main = "generate.py", diff --git a/tests/support/pypa_packaging/generate.py b/tests/support/pypa_packaging/generate.py index 0810524444..775af7986a 100644 --- a/tests/support/pypa_packaging/generate.py +++ b/tests/support/pypa_packaging/generate.py @@ -17,11 +17,13 @@ import operator import os import pathlib +import random import sys import types import typing import packaging +from packaging.markers import InvalidMarker, Marker, UndefinedComparison from packaging.specifiers import InvalidSpecifier, Specifier _HEADER = '''"""Conformance test cases generated from `packaging=={version}`. @@ -91,6 +93,38 @@ ] +# The environment that is used to evaluate the markers, unless the test case +# overrides the values. +_MARKER_ENV = { + "extra": "foo", + "implementation_name": "cpython", + "implementation_version": "3.11.4", + "os_name": "posix", + "platform_machine": "x86_64", + "platform_python_implementation": "CPython", + "platform_release": "6.1.0", + "platform_system": "Linux", + "platform_version": "#1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29)", + "python_full_version": "3.11.4", + "python_version": "3.11", + "sys_platform": "linux", +} + +# The expressions that are combined with `and`, `or` and parenthesis to test +# the precedence and the grouping. +_MARKER_ATOMS = [ + 'os_name == "posix"', + 'os_name == "nt"', + "sys_platform != 'linux'", + 'python_version >= "3.8"', + 'python_full_version < "3.11.4"', + 'platform_machine in "x86_64 amd64"', + '"arm" in platform_machine', + '"posix" == os_name', + 'extra == "foo"', +] + + def _pytest_stub(): """A minimal stand-in so that the test modules do not need pytest.""" return types.SimpleNamespace(param=lambda *args, **kwargs: args) @@ -238,6 +272,114 @@ def version_cases(test_version, test_specifiers): ) +def _evaluate_marker(marker, env): + try: + return Marker(marker).evaluate(env) + except (InvalidMarker, UndefinedComparison): + return None + + +def _random_marker(rng, depth): + if depth == 0 or rng.random() < 0.3: + return rng.choice(_MARKER_ATOMS) + + marker = _random_marker(rng, depth - 1) + for _ in range(rng.randint(1, 3)): + marker += rng.choice([" and ", " or "]) + _random_marker(rng, depth - 1) + + return "({})".format(marker) if rng.random() < 0.5 else marker + + +def _marker_table(variables, operators, values): + rows = [] + for variable, op, value in itertools.product(variables, operators, values): + # The test builds the markers the same way. + assert '"' not in value, value + result = "" + for marker in [ + '{} {} "{}"'.format(variable, op, value), + '"{}" {} {}'.format(value, op, variable), + ]: + got = _evaluate_marker(marker, _MARKER_ENV) + # "E" means that it is an error to evaluate the marker. + result += "E" if got is None else "T" if got else "F" + rows.append((variable, op, value, result)) + return rows + + +def marker_cases(test_markers): + """Generate the test cases for `//python/private/pypi:pep508_evaluate.bzl`.""" + markers = _TestModule(test_markers) + + evaluate_cases = [] + for test_name in [ + "test_evaluates", + "test_evaluate_pep345_markers", + "test_version_like_equality", + ]: + for marker, env, expected in markers.parametrize(test_name): + if env is None: + # These depend on the interpreter that runs the tests. + continue + + got = _evaluate_marker(marker, _MARKER_ENV | env) + if got != expected: + raise ValueError( + "The default environment changes the result of: " + marker + ) + evaluate_cases.append((marker, json.dumps(env, sort_keys=True), expected)) + + invalid = markers.parametrize("test_parses_invalid") + [ + 'python_version >= "3"' + line_break + for line_break in markers.parametrize("test_parses_invalid_trailing_line_break") + ] + + rng = random.Random(508) + logic = {} + for _ in range(100): + marker = _random_marker(rng, 3) + logic[marker] = _evaluate_marker(marker, _MARKER_ENV) + + ns = markers.namespace + return "".join( + [ + _HEADER.format(version=packaging.__version__), + _list( + "MARKER_ENV", + sorted(_MARKER_ENV.items()), + "The (name, value) of the default environment for the cases below.", + ), + _list( + "EVALUATE_CASES", + evaluate_cases, + "(marker, JSON of the environment overrides, expected)", + ), + _list( + "INVALID_MARKERS", + invalid, + "Strings that are not valid markers.", + ), + _list( + "MARKER_TABLE", + _marker_table( + ns["VARIABLES"] + + ns["PEP_345_VARIABLES"] + + ns["SETUPTOOLS_VARIABLES"], + ns["OPERATORS"], + ns["VALUES"], + ), + "(variable, operator, value, results); the results are T/F/E(rror) for\n" + "# ` ` and ` `.", + ), + _list( + "LOGIC_CASES", + sorted(logic.items()), + "(marker, expected)", + ), + ] + ) + + def _resolve(path): """Resolve a path that may be a runfiles path.""" if os.path.exists(path): @@ -257,11 +399,17 @@ def main(argv): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--test-version", required=True) parser.add_argument("--test-specifiers", required=True) + parser.add_argument("--test-markers", required=True) parser.add_argument( "--version-cases", required=True, help="The file with the version test cases to write or check.", ) + parser.add_argument( + "--marker-cases", + required=True, + help="The file with the marker test cases to write or check.", + ) parser.add_argument( "--check", action="store_true", @@ -274,6 +422,7 @@ def main(argv): _resolve(args.test_version), _resolve(args.test_specifiers), ), + args.marker_cases: marker_cases(_resolve(args.test_markers)), } stale = [] From 57a22a84415c7c3df25274391c36afa94566f402 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 21 Nov 2026 03:44:46 +0900 Subject: [PATCH 2/2] ci: retrigger the checks that failed due to infrastructure