MCPcopy Create free account
hub / github.com/celery/celery / find_distribution_modules

Function find_distribution_modules

t/unit/conftest.py:335–348  ·  view source on GitHub ↗
(name=__name__, file=__file__)

Source from the content-addressed store, hash-verified

333
334
335def find_distribution_modules(name=__name__, file=__file__):
336 current_dist_depth = len(name.split('.')) - 1
337 current_dist = os.path.join(os.path.dirname(file),
338 *([os.pardir] * current_dist_depth))
339 abs = os.path.abspath(current_dist)
340 dist_name = os.path.basename(abs)
341
342 for dirpath, dirnames, filenames in os.walk(abs):
343 package = (dist_name + dirpath[len(abs):]).replace('/', '.')
344 if '__init__.py' in filenames:
345 yield package
346 for filename in filenames:
347 if filename.endswith('.py') and filename != '__init__.py':
348 yield '.'.join([package, filename])[:-3]
349
350
351def import_all_modules(name=__name__, file=__file__,

Callers 1

import_all_modulesFunction · 0.85

Calls 2

joinMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected