~cjwatson/lazr.restful/test-fixes

« back to all changes in this revision

Viewing changes to src/lazr/restful/metazcml.py

[r=wgrant] Restrict find_exported_interfaces to names that would ordinarily be considered to be exported from a module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
 
246
246
    :return: iterator of interfaces.
247
247
    """
 
248
    try:
 
249
        module_all = set(module.__all__)
 
250
        is_exported_name = lambda name: name in module_all
 
251
    except AttributeError:
 
252
        is_exported_name = lambda name: not name.startswith('_')
248
253
    return (interface for name, interface
249
 
            in inspect.getmembers(module, _is_exported_interface))
 
254
            in inspect.getmembers(module, _is_exported_interface)
 
255
            if is_exported_name(name))
250
256
 
251
257
 
252
258
class ConflictInContributingInterfaces(Exception):