MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _init

Method _init

lib/sqlalchemy/sql/selectable.py:2149–2164  ·  view source on GitHub ↗
(  # type: ignore[override]
        self,
        selectable: Any,
        *,
        name: Optional[str] = None,
        sampling: Union[float, Function[Any]],
        seed: Optional[roles.ExpressionElementRole[Any]] = None,
    )

Source from the content-addressed store, hash-verified

2147
2148 @util.preload_module("sqlalchemy.sql.functions")
2149 def _init( # type: ignore[override]
2150 self,
2151 selectable: Any,
2152 *,
2153 name: Optional[str] = None,
2154 sampling: Union[float, Function[Any]],
2155 seed: Optional[roles.ExpressionElementRole[Any]] = None,
2156 ) -> None:
2157 assert sampling is not None
2158 functions = util.preloaded.sql_functions
2159 if not isinstance(sampling, functions.Function):
2160 sampling = functions.func.system(sampling)
2161
2162 self.sampling: Function[Any] = sampling
2163 self.seed = seed
2164 super()._init(selectable, name=name)
2165
2166 def _get_method(self) -> Function[Any]:
2167 return self.sampling

Callers

nothing calls this directly

Calls 1

_initMethod · 0.45

Tested by

no test coverage detected