MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _init_path

Method _init_path

lib/sqlalchemy/orm/strategy_options.py:2170–2187  ·  view source on GitHub ↗
(
        self, path, attr, wildcard_key, attr_group, raiseerr, extra_criteria
    )

Source from the content-addressed store, hash-verified

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 default_token = attr.endswith(_DEFAULT_TOKEN)
2176 if attr.endswith(_WILDCARD_TOKEN) or default_token:
2177 if wildcard_key:
2178 attr = f"{wildcard_key}:{attr}"
2179
2180 path = path.token(attr)
2181 return path
2182 else:
2183 raise sa_exc.ArgumentError(
2184 "Strings are not accepted for attribute names in loader "
2185 "options; please use class-bound attributes directly."
2186 )
2187 return path
2188
2189 def _prepare_for_compile_state(
2190 self,

Callers

nothing calls this directly

Calls 2

tokenMethod · 0.80
endswithMethod · 0.45

Tested by

no test coverage detected