Best Python code snippet using dbt-osmosis_python
server.py
Source:server.py  
...73    new_manager = ApplicationManager(connection_string, base_path)74    project_id = project_multiplexer.register_project(new_manager)75    return jsonify(project_id=project_id)76@app.route("/unregister_project", methods=["POST"])77def unregister_project():78    try:79        project_id = int(request.values["project_id"])80        project_multiplexer.unregister_project(project_id)81        return jsonify(status='success', project_id=project_id)82    except Exception:83        project_id = (request.values.get("project_id"))84        current_app.logger.error(85            "An error occurred while unregistering project %r." % project_id, exc_info=True)86# ----------------------------------------87#88# ----------------------------------------89@app.route("/internal/show_cache")90def show_cache():91    print(dict(g.manager.app_data))92    return Response("Printed")93def associate_project_context(project_id):94    g.project_id = project_id...register_projects.py
Source:register_projects.py  
...77        structure_json = get_generic_project_structure_json()78        build_folder_paths(structure_json, current_asset)79        exporter_configs.project_has_settings = True80        return {'FINISHED'}81class BITCAKE_OT_unregister_project(Operator):82    bl_idname = "bitcake.unregister_project"83    bl_label = "Unregister Project"84    bl_description = "Deletes current project from the Projects list"85    @classmethod86    def poll(cls, context):87        return context.mode == 'OBJECT'88    def execute(self, context):89        exporter_configs = context.scene.exporter_configs90        current_project = exporter_configs.registered_projects91        previous_project = get_previous_project(current_project)92        unregister_project(current_project)93        if previous_project is not None:94            exporter_configs.registered_projects = previous_project95        return {'FINISHED'}96def project_definitions(engine, dir_path, assets_path):97    project_name = dir_path.stem98    project = {project_name: {'engine': engine, 'path': str(dir_path), 'assets': assets_path, }}99    return project100def register_project(project):101    """Checks if file exist, if not create it and write details as json"""102    projects_file_path = get_registered_projects_path()103    if projects_file_path.is_file():104        projects_json = json.load(projects_file_path.open())105        projects_json.update(project)106        with open(projects_file_path, 'w') as projects_file:107            json.dump(projects_json, projects_file, indent=4)108    else:109        with open(projects_file_path, 'w') as projects_file:110            json.dump(project, projects_file, indent=4)111    return112def unregister_project(project):113    """Pass a Project string in order to delete it from registered_projects.json"""114    all_projects = Path(get_registered_projects_path())115    all_projects = json.load(all_projects.open())116    all_projects.pop(project)117    file = get_registered_projects_path()118    if not all_projects:119        try:120            file.unlink()121            return122        except FileNotFoundError:123            return124    with open(file, 'w') as projects_file:125        json.dump(all_projects, projects_file, indent=4)126    return...__init__.py
Source:__init__.py  
...79            pass80        else:81            poller.stop_polling()82    @defer.inlineCallbacks83    def unregister_project(self, key):84        redis = yield self._redis()85        yield redis.multi()86        yield redis.delete('project:' + key)87        yield redis.srem('projects', key)88        yield redis.execute()89        self.stop_polling_project(key)90        workdir = self._workdir.child('poller').child(key)91        if workdir.exists():...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!!
