How to use fuser method in fMBT

Best Python code snippet using fMBT_python

views.py

Source:views.py Github

copy

Full Screen

1from json import decoder2from django.shortcuts import render3from account_user.models import Fuser4from allauth.socialaccount.models import SocialToken5from allauth.socialaccount.models import SocialAccount6from .get_social_info import *7#파이썬 함수식으로 만들면 됨8def main(request):9 data = {}10 user_pk = request.session.get('user') #login 함수에서 추가해준 request.session['user'] = fuser.id11 try:12 social_account = SocialAccount.objects.all()[0]13 print('소셜 로그인 이름--> ',social_account.extra_data['name'])14 social_user_name = social_account.extra_data['name']15 except:16 social_account = None17 if social_account or user_pk :18 print('ㅇㅇ 소셜로 로그인 또는 아이디로 로그인했어 ')19 else:20 print('소셜로그인도 안했고 사이트 로그인도 안함')21 if user_pk: #세션에 user_pk 정보가 존재하면22 fuser = Fuser.objects.get(pk = user_pk)23 data['user'] = fuser24 elif social_account:25 request.session['social_user']= social_user_name #섹션에 소셜 유저의 이름만 저장하기. -->(다른 함수에서 get 하기 위해서.)26 #기존에 사용자27 data['user'] = social_user_name28 else:29 data['temp'] = 130 return render(request, "main.html",data)31def mypage(request):32 data={}33 print('실행')34 data['user'] = None #처음에 base.html을 상속하기 때문에35 #data['user'] 의 값을 None으로 변경안하면 처음 main페이지의 user 값이랑 겹친다.36 user_pk = request.session.get('user')37 print( 'user_pk =', user_pk)38 social_name = request.session.get('social_user')39 try:40 fuser = Fuser.objects.get(pk=user_pk)41 data['user']=fuser42 except:43 data['social_user'] = social_name44 print(data)45 return render(request, "mypage.html", data)46 47def profile_modify(request):48 temp=049 data={}50 user_pk = request.session.get('user')51 if request.method == 'GET':52 fuser = Fuser.objects.get(pk=user_pk)53 data['user']=fuser54 return render(request, "profile_modify.html", data)55 elif request.method == 'POST':56 fuser = Fuser.objects.get(pk=user_pk)57 fuser.useremail =request.POST.get('useremail') 58 fuser.school = request.POST.get('school')59 fuser.major = request.POST.get('major')60 fuser.grade = request.POST.get('grade')61 fuser.phone = request.POST.get('phone')62 if not (fuser.useremail and fuser.school and fuser.major and fuser.grade and fuser.phone):63 data['error']="⚠모든 칸을 입력해주세요⚠" 64 return render (request,"profile_modify.html",data) 65 else:66 fuser.save()67 data['user']=fuser68 return render (request,"mypage.html",data)69 70 #이 함수는 welcome이라는 이름 다른곳에서 welcome으로 불러올 수 있다. ...

Full Screen

Full Screen

jit.py

Source:jit.py Github

copy

Full Screen

...13 torch._C._jit_set_profiling_executor(False)14 torch._C._jit_set_profiling_mode(False)15 torch._C._jit_override_can_fuse_on_gpu(True)16 #torch._C._jit_set_texpr_fuser_enabled(True)17def set_jit_fuser(fuser):18 if fuser == "te":19 # default fuser should be == 'te'20 torch._C._jit_set_profiling_executor(True)21 torch._C._jit_set_profiling_mode(True)22 torch._C._jit_override_can_fuse_on_cpu(False)23 torch._C._jit_override_can_fuse_on_gpu(True)24 torch._C._jit_set_texpr_fuser_enabled(True)25 elif fuser == "old" or fuser == "legacy":26 torch._C._jit_set_profiling_executor(False)27 torch._C._jit_set_profiling_mode(False)28 torch._C._jit_override_can_fuse_on_gpu(True)29 torch._C._jit_set_texpr_fuser_enabled(False)30 elif fuser == "nvfuser" or fuser == "nvf":31 os.environ['PYTORCH_CUDA_FUSER_DISABLE_FALLBACK'] = '1'...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful