| 2168 | is_token_strategy = True |
| 2169 | |
| 2170 | def _init_path( |
| 2171 | self, path, attr, wildcard_key, attr_group, raiseerr, extra_criteria |
| 2172 | ): |
| 2173 | # assert isinstance(attr, str) or attr is None |
| 2174 | if attr is not None: |
| 2175 | # the only strings accepted here are the wildcard and default |
| 2176 | # tokens, either bare or already prefixed with a wildcard key. |
| 2177 | # anything else is a leftover from the string based loader |
| 2178 | # option API removed in 2.0 and gets the same error as any |
| 2179 | # other string. note that testing only for a trailing "*", |
| 2180 | # as was formerly the case, lets a name like "addresses.*" |
| 2181 | # through to build a loader path that matches nothing |
| 2182 | if attr in _ACCEPTED_TOKENS: |
| 2183 | if wildcard_key: |
| 2184 | attr = f"{wildcard_key}:{attr}" |
| 2185 | |
| 2186 | path = path.token(attr) |
| 2187 | return path |
| 2188 | else: |
| 2189 | raise sa_exc.ArgumentError( |
| 2190 | "Strings are not accepted for attribute names in loader " |
| 2191 | "options; please use class-bound attributes directly." |
| 2192 | ) |
| 2193 | return path |
| 2194 | |
| 2195 | def _prepare_for_compile_state( |
| 2196 | self, |