stubber.codemod.utils¶
Classes¶
MatcherDecoratableTransformer that can be reused with different scopes. |
Functions¶
|
Create a shallow copy of the given function. |
Module Contents¶
- stubber.codemod.utils.shallow_copy_function(func: Any) types.FunctionType¶
Create a shallow copy of the given function.
The returned function is unbound and does not copy attributes defined on the function.
- Parameters:
func (Any)
- Return type:
types.FunctionType
- class stubber.codemod.utils.ScopeableMatcherTransformer¶
Bases:
libcst.matchers.MatcherDecoratableTransformerMatcherDecoratableTransformer that can be reused with different scopes.
- _build_scoped_meth(method_name: str, scope_matcher: libcst.matchers.BaseMatcherNode)¶
Build unbound scoped method from parent class.
- Parameters:
method_name (str)
scope_matcher (libcst.matchers.BaseMatcherNode)
- with_scope(scope_matcher: libcst.matchers.BaseMatcherNode) libcst.matchers.MatcherDecoratableTransformer¶
Construct a copy of this matcher with visitors scoped to scope_matcher.
- Parameters:
scope_matcher (libcst.matchers.BaseMatcherNode)
- Return type:
libcst.matchers.MatcherDecoratableTransformer