def visit_module(self, file_path, overrides, platform,
                     module_name):
        dir_name, file_name = os.path.split(file_path)
        if (     not file_name.endswith('.js')
             and file_name.split('.')[0] != module_name.split('.')[-1]
           ):
            if file_name == "__init__.py":
                if os.path.basename(dir_name) != module_name.split('.')[-1]:
                    return
            else:
                return
        self.merge_resources(dir_name)
        if platform and overrides:
            plat_suffix = '.__%s__' % platform
        else:
            plat_suffix = ''
        if self.compile_inplace:
            mod_part, extension = os.path.splitext(file_path)
            out_file = mod_part + plat_suffix + pyjs.MOD_SUFFIX
        else:
            out_file = os.path.join(self.output, 'lib',
                                    module_name + plat_suffix + pyjs.MOD_SUFFIX)
        if out_file in self.done.get(platform, []):
            return
        
        # translate if
        #  -    no platform
        #  - or if we have an override
        #  - or the module is used in an override only
        if (   platform is None
            or (platform and overrides)
            or (out_file not in self.done.get(None,[]))
           ):
            if file_name.endswith('.js'):
                if not self.list_imports:
                    fp = open(out_file, 'w')
                    fp.write("/* start javascript include: %s */\n" % file_name)
                    fp.write(open(file_path, 'r').read())
                    fp.write("$pyjs.loaded_modules['%s'] = " % file_name)
                    fp.write("function ( ) {return null;};\n")
                    fp.write("/* end %s */\n" % file_name)
                deps = []
                self.dependencies[out_file] = deps
            else:
                logging.info('Translating module:%s platform:%s out:%r' % (
                    module_name, platform or '-', out_file))
                deps, js_libs = self.translator_func(platform,
                                                     [file_path] +  overrides,
                                                     out_file,
                                                     module_name,
                                                     self.translator_arguments,
                                                     self.keep_lib_files)
                #deps, js_libs = translator.translate(self.compiler,
                #                            [file_path] +  overrides,
                #                            out_file,
                #                            module_name=module_name,
                #                            **self.translator_arguments)
                self.dependencies[out_file] = deps
                for path, mode, location in js_libs:
                    if mode == 'default':
                        if self.multi_file:
                            mode = 'dynamic'
                        else:
                            mode = 'static'
                    if mode == 'dynamic':
                        self.dynamic_js_libs.append(path)
                    elif mode == 'static':
                        if location == 'early':
                            self.early_static_js_libs.append(path)
                        elif location == 'middle':
                            self.static_js_libs.append(path)
                        elif location == 'late':
                            self.late_static_js_libs.append(path)
                        else:
                            raise RuntimeError, "Unknown js lib location: %r" % location
                    else:
                        raise RuntimeError, "Unknown js lib mode: %r" % mode

                if '.' in module_name:
                    for i, dep in enumerate(deps):
                        if module_path(dep, path=[dir_name]):
                            deps[i] = '.'.join(module_name.split('.')[:-1] + [dep])
        else:
            deps = self.dependencies[out_file]
        if out_file not in self.done.setdefault(platform, []):
            self.done[platform].append(out_file)
        if module_name not in self.visited_modules.setdefault(platform, []):
            self.visited_modules[platform].append(module_name)
        if deps:
            self.visit_modules(deps, platform, file_path)
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/linker.py/BaseLinker.visit_module/original