Best Python code snippet using molecule_python
cocos_project.py
Source:cocos_project.py  
...165        if current is not None:166            current_lower = current.lower()167            if current_lower in self._available_platforms.keys():168                self._current = current_lower169    def _filter_platforms(self, platforms):170        ret = []171        for p in platforms:172            if cocos.os_is_linux():173                if p == Platforms.WEB or p == Platforms.LINUX or p == Platforms.ANDROID:174                    ret.append(p)175            if cocos.os_is_mac():176                if p == Platforms.WEB or p == Platforms.IOS or p == Platforms.MAC or p == Platforms.ANDROID:177                    ret.append(p)178            if cocos.os_is_win32():179                if p == Platforms.WEB or p == Platforms.WIN32 or p == Platforms.ANDROID:180                    ret.append(p)181        return ret182    def _gen_available_platforms(self, proj_info):183        # generate the platform list for different projects184        if self._project._is_lua_project():185            if self._project._is_native_support():186                platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX ]187            else:188                if self._project.has_android_libs():189                    platform_list = [ Platforms.ANDROID ]190                else:191                    platform_list = []192        elif self._project._is_js_project():193            if self._project._is_native_support():194                platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.WEB, Platforms.LINUX]195            else:196                if self._project.has_android_libs():197                    platform_list = [ Platforms.ANDROID, Platforms.WEB ]198                else:199                    platform_list = [ Platforms.WEB ]200        elif self._project._is_cpp_project():201            platform_list = [ Platforms.ANDROID, Platforms.WIN32, Platforms.IOS, Platforms.MAC, Platforms.LINUX ]202        # filter the available platform list203        platform_list = self._filter_platforms(platform_list)204        # check the real available platforms205        self._available_platforms = {}206        root_path = self._project.get_project_dir()207        for p in platform_list:208            cfg_class = cocos.get_class(Platforms.CFG_CLASS_MAP[p])209            if cfg_class is None:210                continue211            cfg_key = "%s_cfg" % p212            if proj_info.has_key(cfg_key):213                cfg_obj = cfg_class(root_path, self._project._is_script_project(), proj_info[cfg_key])214            else:215                cfg_obj = cfg_class(root_path, self._project._is_script_project())216            if cfg_obj._is_available():217                self._available_platforms[p] = cfg_obj...platforms.py
Source:platforms.py  
...59        :param platform_name: One platform to target only, defaults to None.60        :return: None61        """62        if platform_name:63            config.config["platforms"] = util._filter_platforms(64                config.config, platform_name65            )66        if parallelize_platforms:67            config.config["platforms"] = util._parallelize_platforms(68                config.config, config._run_uuid69            )70        self._config = config71    @property72    def instances(self):...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
