#NEWLINE# def weave_module( module , aspect , methods = NORMAL_METHODS , lazy = False , bag = BrokenBag , **options ) : #NEWLINE# #INDENT# '\n    Low-level weaver for "whole module weaving".\n\n    .. warning:: You should not use this directly.\n\n    :returns: An :obj:`aspectlib.Rollback` object.\n    ' #NEWLINE# if bag . has ( module ) : #NEWLINE# #INDENT# return Nothing #NEWLINE# #UNINDENT# entanglement = Rollback ( ) #NEWLINE# method_matches = make_method_matcher ( methods ) #NEWLINE# logdebug ( 'weave_module (module=%r, aspect=%s, methods=%s, lazy=%s, **options=%s)' , module , aspect , methods , lazy , options ) #NEWLINE# for attr in dir ( module ) : #NEWLINE# #INDENT# func = getattr ( module , attr ) #NEWLINE# if method_matches ( attr ) : #NEWLINE# #INDENT# if isroutine ( func ) : #NEWLINE# #INDENT# entanglement . merge ( patch_module_function ( module , func , module , force_name = attr , ** options ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isclass ( func ) : #NEWLINE# #INDENT# entanglement . merge ( weave_class ( func , aspect , owner = module , name = attr , methods = methods , lazy = lazy , bag = bag , ** options ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return entanglement