def get_name(base_path, name, is_directory=False): path = os.path.join(base_path, name) if is_directory: # Create directory test os.makedirs(path) else: # Create file test touch(path) # Run `get_name()` function return importer.get_name(path, 'test', name)
def is_module_directory(base_path, name, init_file=True): path = os.path.join(base_path, name) # Create directory os.mkdir(path) if init_file: # Create "__init__.py" file touch(os.path.join(path, '__init__.py')) # Run `is_module_directory()` function return importer.is_module_directory(path, name)
def is_module(base_path, name, create=None, create_init_file=True): path = os.path.join(base_path, name) if create == 'directory': # Create directory test os.makedirs(path) if create_init_file: touch(os.path.join(path, '__init__.py')) elif create == 'file': # Create file test touch(path) # Run `is_module()` function return importer.is_module(path, name)