上海品茶

您的当前位置:上海品茶 > 报告分类 > PPTX报告下载

珍惜想法 尊重规范-陈泊涵.pptx

编号:154995 PPTX 13页 1.88MB 下载积分:VIP专享
下载报告请您先登录!

珍惜想法 尊重规范-陈泊涵.pptx

1、IDEA FIRST AND BE PYTHONIC IN NEWBORN PYTHON PROJECT.主讲人:西南大学 2023级软件工程 陈泊涵Python is a programming language that lets you work quickly and integrate systems more effectively.www.python.orgcontextlib.asynccontextmanagerasync def db_session()-AsyncContextManagerAsyncSession:async with async_session_ma

2、ker()as session:yield session await mit()进入:session.begin()transaction._aenter_()yield session离开:transaction._aexit_()session._aexit_()await mit()#define the object without orm session#this kind of object can only invoke methods end with rawclass Raw(GenericT):def _init_(self,obj:T):self.object:T=ob

3、j def _getattribute_(self,name):attribute=super()._getattribute_(name)if inspect.ismethod(attribute):if not name.endwith(_raw):log(fORM object type(self.object)invoke a sql-related function(name)without database session.method invoke has been canceled)return#cancel the method invoked return attribut

4、e def _getattr_(self,name):return getattr(self.object,name)class Score(Base):staticmethod async def from_base(info:ScoreBase)-RawScore:pass async def submit_raw(self)-OptionalScore:passasync def require_score(score_id:int,user:User=Depends(require_user):async with database_session()as session:score=

5、await Score.from_id(session,score_id)if score is None:raise APIExceptions.score_not_exist if score.user_id!=user.id:raise APIExceptions.score_not_belongings return scorerouter.patch(/score_id,response_model=ScoreRead)async def patch_score(info:ScoreUpdate,score:Score=Depends(require_score):async wit

6、h database_session()as session:patched_score=await database.partial_update(session,score,info)return patched_scoreutil.create_proxy_methods(Session,:class:_orm.Session,:class:_asyncio.AsyncSession,classmethods=object_session,identity_key,methods=_contains_,_iter_,add,add_all,expire,expire_all,attrib

7、utes=dirty,deleted,new,identity_map,is_active,autoflush,no_autoflush,info,)class AsyncSession(ReversibleProxySession):def add(self,instance:object,_warn:bool=True)-None:return self._proxied.add(instance,_warn=_warn)def add_all(self,instances:Iterableobject)-None:return self._proxied.add_all(instances)

友情提示

1、下载报告失败解决办法
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站报告下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。

本文(珍惜想法 尊重规范-陈泊涵.pptx)为本站 (2200) 主动上传,三个皮匠报告文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三个皮匠报告文库(点击联系客服),我们立即给予删除!

温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。
会员购买
客服

专属顾问

商务合作

机构入驻、侵权投诉、商务合作

服务号

三个皮匠报告官方公众号

回到顶部