MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _init

Method _init

lib/sqlalchemy/sql/selectable.py:2097–2112  ·  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

2095
2096 @util.preload_module("sqlalchemy.sql.functions")
2097 def _init( # type: ignore[override]
2098 self,
2099 selectable: Any,
2100 *,
2101 name: Optional[str] = None,
2102 sampling: Union[float, Function[Any]],
2103 seed: Optional[roles.ExpressionElementRole[Any]] = None,
2104 ) -> None:
2105 assert sampling is not None
2106 functions = util.preloaded.sql_functions
2107 if not isinstance(sampling, functions.Function):
2108 sampling = functions.func.system(sampling)
2109
2110 self.sampling: Function[Any] = sampling
2111 self.seed = seed
2112 super()._init(selectable, name=name)
2113
2114 def _get_method(self) -> Function[Any]:
2115 return self.sampling

Callers

nothing calls this directly

Calls 1

_initMethod · 0.45

Tested by

no test coverage detected