uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
0e6363df3773445c89ca3f6e
train
function
def is_site_admin_user(request): """ Determines if the requesting user has access to site admin data ## What this function does 1. Get the current site (matching the request) 2. Get the orgs for the site 3. Get the user org mappings for the orgs and user in the request 4. Check the UserOrg...
def is_site_admin_user(request):
""" Determines if the requesting user has access to site admin data ## What this function does 1. Get the current site (matching the request) 2. Get the orgs for the site 3. Get the user org mappings for the orgs and user in the request 4. Check the UserOrganizationMapping record if user i...
Exist when the site isn't found. :raise Organization.DoesNotExist when the organization isn't found. :raise Organization.MultipleObjectsReturned when more than one organization is returned. :return Organization. """ current_site = sites_shortcuts.get_current_site(request) return Organization.obj...
75
75
251
7
68
appsembler/course-access-groups
course_access_groups/permissions.py
Python
is_site_admin_user
is_site_admin_user
66
100
66
66
b3d669120268192498d7c51f88bb883df98d1749
bigcode/the-stack
train
9dc64d86e591b4deeefee96a
train
function
def is_course_with_public_access(course): """ Check PublicCourse access within the user's organization(s). :param user: User model object. :param course: CourseOverview model object. :return: bool. """ return PublicCourse.objects.filter(course_id=course.id).exists()
def is_course_with_public_access(course):
""" Check PublicCourse access within the user's organization(s). :param user: User model object. :param course: CourseOverview model object. :return: bool. """ return PublicCourse.objects.filter(course_id=course.id).exists()
relationship between organizations and sites. ' 'This exception should not happen.' ) return False return UserOrganizationMapping.objects.filter( organization=current_organization, user=request.user, is_active=True, is_amc_admin=True, ).exists() def ...
64
64
62
8
56
appsembler/course-access-groups
course_access_groups/permissions.py
Python
is_course_with_public_access
is_course_with_public_access
103
111
103
103
90d7b73d48f5269e04e03becf5af64a151556b40
bigcode/the-stack
train
2069a6617a78b4e55b99ad41
train
function
def user_has_access_to_course(user, course): """ Main function to check if user has access. :param user: User to check access against. :param course: CourseDescriptorWithMixins or CourseOverview object to check access for. :return: bool: whether the user is granted access or no. """ if is_c...
def user_has_access_to_course(user, course):
""" Main function to check if user has access. :param user: User to check access against. :param course: CourseDescriptorWithMixins or CourseOverview object to check access for. :return: bool: whether the user is granted access or no. """ if is_course_with_public_access(course=course): ...
IsAuthenticated, IsSiteAdminUser, ) def is_active_staff_or_superuser(user): """ Checks if user is active staff or superuser. """ return user and user.is_active and (user.is_staff or user.is_superuser) def user_has_access_to_course(user, course):
64
64
188
10
54
appsembler/course-access-groups
course_access_groups/permissions.py
Python
user_has_access_to_course
user_has_access_to_course
148
178
148
148
c8271d564c9ea1ce26052a99acae068b52440726
bigcode/the-stack
train
cc725ae08351b69c0ad5f40d
train
function
def get_csv_handler(bank: str): bank = bank.lower() if bank == "ally": return AllyCSVHandler elif bank == "chase": return ChaseCSVHandler elif bank in ("amex", "american express"): return AmexCSVHandler elif bank == "target": return TargetCSVHandler else: ...
def get_csv_handler(bank: str):
bank = bank.lower() if bank == "ally": return AllyCSVHandler elif bank == "chase": return ChaseCSVHandler elif bank in ("amex", "american express"): return AmexCSVHandler elif bank == "target": return TargetCSVHandler else: raise RuntimeError( ...
from spendy.csv.handlers import ( AllyCSVHandler, ChaseCSVHandler, AmexCSVHandler, TargetCSVHandler ) from spendy import SPENDY_HOME SPENDY_DATA = os.path.join(SPENDY_HOME, "data") def get_csv_handler(bank: str):
64
64
97
8
56
timhealz/spendy
src/spendy/db/load.py
Python
get_csv_handler
get_csv_handler
24
37
24
24
72676d4ca241c6ed4906fb59a3463ef3baebeaea
bigcode/the-stack
train
e2672ca85a7abb66a1da9af3
train
class
class Migration(migrations.Migration): dependencies = [ ('fornecedores', '0004_auto_20210501_1649'), ] operations = [ migrations.AlterField( model_name='local', name='cep', field=models.CharField(blank=True, max_length=15, null=True, verbose_name='CEP'),...
class Migration(migrations.Migration):
dependencies = [ ('fornecedores', '0004_auto_20210501_1649'), ] operations = [ migrations.AlterField( model_name='local', name='cep', field=models.CharField(blank=True, max_length=15, null=True, verbose_name='CEP'), ), ]
# Generated by Django 3.1.5 on 2021-05-01 22:35 from django.db import migrations, models class Migration(migrations.Migration):
38
64
76
7
30
h-zanetti/jewelry-manager
webdev/fornecedores/migrations/0005_auto_20210501_1935.py
Python
Migration
Migration
6
18
6
7
07eb3a2efc94b68240b8db4ccc17c6b176a5cd18
bigcode/the-stack
train
bb7bde602064d043bd1c60b1
train
class
class ContactMessageForm(forms.ModelForm): class Meta: model = ContactMessage fields = ( 'message_to', 'your_name', 'your_email', 'message_subject', 'your_message', 'our_message', 'parent', 'primary_cont...
class ContactMessageForm(forms.ModelForm):
class Meta: model = ContactMessage fields = ( 'message_to', 'your_name', 'your_email', 'message_subject', 'your_message', 'our_message', 'parent', 'primary_contact', ) def __init__(self, *arg...
from django import forms from .models import ContactMessage class ContactMessageForm(forms.ModelForm):
20
64
156
8
11
iamjdcollins/districtwebsite
apps/contactmessages/forms.py
Python
ContactMessageForm
ContactMessageForm
5
25
5
6
d6949caca25d6d6679327a8a84427b3f14ccc5e3
bigcode/the-stack
train
29737daad2fc1fc62e13acba
train
function
def solve_linear_differential_system(a, b, c, alpha): r""" Solves a system of linear differential equations: `af' + bf = c` and `f'(0) = \alpha` where `a`, `b`, and `c` are power series in one variable and `\alpha` is a constant in the coefficient ring. ALGORITHM: due to Brent and Kung '78. E...
def solve_linear_differential_system(a, b, c, alpha):
r""" Solves a system of linear differential equations: `af' + bf = c` and `f'(0) = \alpha` where `a`, `b`, and `c` are power series in one variable and `\alpha` is a constant in the coefficient ring. ALGORITHM: due to Brent and Kung '78. EXAMPLES:: sage: from sage.schemes.elliptic_cu...
# but we loose only a factor 2 f2 = solve_linear_differential_system(a, b, c, 0) # sometimes we get to 0 quicker than s reaches n if f2 == 0: break f1 = f1 + f2 s = next_s R = f1 Q = R**2 pe = 1/Q return pe def solve_linear_differential_system(a, b,...
109
109
366
15
93
fchapoton/sage
src/sage/schemes/elliptic_curves/ell_wp.py
Python
solve_linear_differential_system
solve_linear_differential_system
315
349
315
315
15026382e45fa7244441766f683899d7a20b0c79
bigcode/the-stack
train
4f83620a5337c72d52fc7a60
train
function
def compute_wp_quadratic(k, A, B, prec): r""" Compute the truncated Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. Uses an algorithm that is of complexity `O(prec^2)`. Let p be the characteristic of the underlying field. Then we must have eit...
def compute_wp_quadratic(k, A, B, prec):
r""" Compute the truncated Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. Uses an algorithm that is of complexity `O(prec^2)`. Let p be the characteristic of the underlying field. Then we must have either p = 0, or p > prec + 2. INPUT: ...
/637*z^10 - 1/84721*z^16 + O(z^20) sage: compute_wp_pari(E, prec=30) z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^16 + 3/38548055*z^22 - 4/8364927935*z^28 + O(z^30) """ ep = E.__pari__() wpp = ep.ellwp(n=prec) k = E.base_ring() R = LaurentSeriesRing(k,'z') z = R.gen() wp = z**(-2)...
190
190
634
14
175
fchapoton/sage
src/sage/schemes/elliptic_curves/ell_wp.py
Python
compute_wp_quadratic
compute_wp_quadratic
192
249
192
192
b2a9cfe1d7be24bd2edf277cb36c99f779bc5689
bigcode/the-stack
train
cec30602245953073ce0ae29
train
function
def compute_wp_fast(k, A, B, m): r""" Computes the Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. It does this with as fast as polynomial of degree `m` can be multiplied together in the base ring, i.e. `O(M(n))` in the notation of [BMSS2006]_. Let `p` be...
def compute_wp_fast(k, A, B, m):
r""" Computes the Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. It does this with as fast as polynomial of degree `m` can be multiplied together in the base ring, i.e. `O(M(n))` in the notation of [BMSS2006]_. Let `p` be the characteristic of the underl...
+ 1)//2 c = [0 for j in range(m)] c[0] = -A/5 c[1] = -B/7 # first Z represent z^2 R = LaurentSeriesRing(k,'z') Z = R.gen() pe = Z**-1 + c[0]*Z + c[1]*Z**2 for i in range(3, m): t = 0 for j in range(1, i - 1): t += c[j-1]*c[i-2-j] ci = (3*t)/((i-2)*(...
189
189
631
12
177
fchapoton/sage
src/sage/schemes/elliptic_curves/ell_wp.py
Python
compute_wp_fast
compute_wp_fast
251
312
251
251
628335b673319bbdb10e86467386b4ee120fd5fc
bigcode/the-stack
train
de83a07e7c5b839c43378f98
train
function
def weierstrass_p(E, prec=20, algorithm=None): r""" Computes the Weierstrass `\wp`-function on an elliptic curve. INPUT: - ``E`` -- an elliptic curve - ``prec`` -- precision - ``algorithm`` -- string (default:``None``) an algorithm identifier indicating the ``pari``, ``fast`` or ``quad...
def weierstrass_p(E, prec=20, algorithm=None):
r""" Computes the Weierstrass `\wp`-function on an elliptic curve. INPUT: - ``E`` -- an elliptic curve - ``prec`` -- precision - ``algorithm`` -- string (default:``None``) an algorithm identifier indicating the ``pari``, ``fast`` or ``quadratic`` algorithm. If the algorithm is ``...
]) sage: E.weierstrass_p() z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^16 + O(z^20) REFERENCES: - [BMSS2006]_ AUTHORS: - Dan Shumov 04/09: original implementation - Chris Wuthrich 11/09: major restructuring - Jeroen Demeyer (2014-03-06): code clean up, fix characteristic bound for quadratic algorithm (see :...
256
256
1,404
15
240
fchapoton/sage
src/sage/schemes/elliptic_curves/ell_wp.py
Python
weierstrass_p
weierstrass_p
57
164
57
57
79da43e2d9642a7e61426df7905f5248a7e64713
bigcode/the-stack
train
0e6cf5c37b6c345d47c74766
train
function
def compute_wp_pari(E,prec): r""" Computes the Weierstrass `\wp`-function with the ``ellwp`` function from PARI. EXAMPLES:: sage: E = EllipticCurve([0,1]) sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_pari sage: compute_wp_pari(E, prec=20) z^-2 - 1/7*...
def compute_wp_pari(E,prec):
r""" Computes the Weierstrass `\wp`-function with the ``ellwp`` function from PARI. EXAMPLES:: sage: E = EllipticCurve([0,1]) sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_pari sage: compute_wp_pari(E, prec=20) z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^...
,prec+4)) wp = compute_wp_fast(k, A, B, prec) else: raise ValueError("unknown algorithm for computing the Weierstrass p-function") R = wp.parent() z = R.gen() u = E.isomorphism_to(Esh).u return wp(z*u) * u**2 def compute_wp_pari(E,prec):
84
84
283
9
74
fchapoton/sage
src/sage/schemes/elliptic_curves/ell_wp.py
Python
compute_wp_pari
compute_wp_pari
166
189
166
166
3b7b97e2712726acb2514b362bceb35d40dcbf2d
bigcode/the-stack
train
b9569f42b416242c5e2472f7
train
function
def show(request): return render(request,"test.html")
def show(request):
return render(request,"test.html")
from djangoapp.form import UserForm, RegForm from django.contrib.auth import authenticate,login,logout from django.contrib.auth.decorators import login_required from djangoapp.functions import handle_uploaded_file # Create your views here. def index(request): return HttpResponse("Welcome to django!") def show(requ...
64
64
12
4
60
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
show
show
17
18
17
17
a75af457b33cc1f9d1b49717b8911ef86e6387cb
bigcode/the-stack
train
e4949803ab86c2bec424f89a
train
function
def getcsv(request): response=HttpResponse(content_type="text/csv") response['Content-Disposition']='attachment;filename="student.csv"' writer=csv.writer(response) writer.writerow(['Id','Name','Marks']) writer.writerow(['100','Priya','90']) writer.writerow(['101','Puja','92']) return respons...
def getcsv(request):
response=HttpResponse(content_type="text/csv") response['Content-Disposition']='attachment;filename="student.csv"' writer=csv.writer(response) writer.writerow(['Id','Name','Marks']) writer.writerow(['100','Priya','90']) writer.writerow(['101','Puja','92']) return response
if request.method=="POST": form=StudentForm(request.POST,instance=student) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'editstudent.html',{'student':student}) def getcsv(request):
64
64
74
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
getcsv
getcsv
59
66
59
59
05db6fbb68c897af516e0e08caccdf50c25b1a71
bigcode/the-stack
train
fc4dbeceeafbb28e1b9b92ea
train
function
def getpdf(request): response=HttpResponse(content_type='application/pdf') response['Content-Disposition']='attachment;filename="sample.pdf"' c=canvas.Canvas(response) c.setFont("Times-Roman",42) c.drawString(100,700,"Hello Saurav Kumar !") c.showPage() c.save return response
def getpdf(request):
response=HttpResponse(content_type='application/pdf') response['Content-Disposition']='attachment;filename="sample.pdf"' c=canvas.Canvas(response) c.setFont("Times-Roman",42) c.drawString(100,700,"Hello Saurav Kumar !") c.showPage() c.save return response
sv") response['Content-Disposition']='attachment;filename="student.csv"' writer=csv.writer(response) writer.writerow(['Id','Name','Marks']) writer.writerow(['100','Priya','90']) writer.writerow(['101','Puja','92']) return response def getpdf(request):
64
64
77
5
58
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
getpdf
getpdf
68
76
68
68
def976bbf495b3398c6b1b6e2f50b4d6e27ca05b
bigcode/the-stack
train
44cfee48ed1e08c4fb118e3a
train
function
def uploader(request): if request.method=="POST": form=CustomerForm(request.POST,request.FILES) if form.is_valid(): for f in request.FILES.getlist('file'): handle_uploaded_file(f) return HttpResponse('File uploaded successfully!') else: c=Custo...
def uploader(request):
if request.method=="POST": form=CustomerForm(request.POST,request.FILES) if form.is_valid(): for f in request.FILES.getlist('file'): handle_uploaded_file(f) return HttpResponse('File uploaded successfully!') else: c=CustomerForm() retur...
def logoutview(request): logout(request) #It logsout the current user return redirect("/login") def sample1(request): return render(request,"index.html",{'title':'home'}) def about(request): return render(request,"about.html",{'title':'about'}) def uploader(request):
63
64
80
4
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
uploader
uploader
160
169
160
160
d27bdb2d86266b5a395d79328269c92e42048c47
bigcode/the-stack
train
79c3db05aa1b3833971fb940
train
function
def delete(request,id): student=Student.objects.get(id=id) student.delete() return redirect("/createstudent")
def delete(request,id):
student=Student.objects.get(id=id) student.delete() return redirect("/createstudent")
): if request.method=="POST": form=StudentForm(request.POST) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'createstudent1.html',{'form':form}) def delete(request,id):
64
64
26
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
delete
delete
43
46
43
43
67d3251321fc5b83f019fb8a93448f8b74f8ea44
bigcode/the-stack
train
0e6237d4ed338b2a415b11db
train
function
def display(request): name="Saurav Kumar" return render(request,'disp.html',{"uname":name})
def display(request):
name="Saurav Kumar" return render(request,'disp.html',{"uname":name})
from django.contrib.auth import authenticate,login,logout from django.contrib.auth.decorators import login_required from djangoapp.functions import handle_uploaded_file # Create your views here. def index(request): return HttpResponse("Welcome to django!") def show(request): return render(request,"test.html") ...
64
64
25
4
60
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
display
display
20
22
20
20
4e9627161846131c5e30cc601bc9b48b4d73a0e7
bigcode/the-stack
train
47b356e2bfb77826a8287978
train
function
def check(request): username=request.POST['username'] password=request.POST['password'] user=authenticate(request,username=username,password=password) if user is not None: login(request,user)#logs in the user return redirect("/home") else: return redirect("/login")
def check(request):
username=request.POST['username'] password=request.POST['password'] user=authenticate(request,username=username,password=password) if user is not None: login(request,user)#logs in the user return redirect("/home") else: return redirect("/login")
(commit=False) profile.user = request.user user.save() profile.save() return redirect("/login/") else: user=UserForm() form=RegForm() return render(request,"registration/customreg.html",{'form':form,'user':user}) def check(request):
62
64
61
4
58
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
check
check
134
142
134
134
8faa40ea044c588dda8c365ba850c4e65c2fcc8e
bigcode/the-stack
train
82406ec87d8f5b8345e2cbbc
train
function
def firstpage(request): return render(request,'firstpage.html')
def firstpage(request):
return render(request,'firstpage.html')
ILES) if form.is_valid(): for f in request.FILES.getlist('file'): handle_uploaded_file(f) return HttpResponse('File uploaded successfully!') else: c=CustomerForm() return render(request,'customer.html',{'form':c}) def firstpage(request):
64
64
14
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
firstpage
firstpage
171
172
171
171
0019a6b919be62b875c756d21784e201312a15c2
bigcode/the-stack
train
c6eb4b75c7c5cbfa99617579
train
function
def logoutview(request): logout(request) #It logsout the current user return redirect("/login")
def logoutview(request):
logout(request) #It logsout the current user return redirect("/login")
) if user is not None: login(request,user)#logs in the user return redirect("/home") else: return redirect("/login") @login_required def home(request): username=request.user.username return render(request,"home.html",{'username':username}) def logoutview(request):
64
64
23
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
logoutview
logoutview
150
152
150
150
1b1f6ef5e06abe3ea596e85d774893645322fb17
bigcode/the-stack
train
30c3f664da3d8b57e28fed16
train
function
def setsession(request): if request.method=='POST': form=TestForm(request.POST) if form.is_valid(): name=request.POST['name'] email=request.POST['email'] request.session['name']=name #stores name in session request.session['email']=email #stores email...
def setsession(request):
if request.method=='POST': form=TestForm(request.POST) if form.is_valid(): name=request.POST['name'] email=request.POST['email'] request.session['name']=name #stores name in session request.session['email']=email #stores email in session r...
['Content-Disposition']='attachment;filename="sample.pdf"' c=canvas.Canvas(response) c.setFont("Times-Roman",42) c.drawString(100,700,"Hello Saurav Kumar !") c.showPage() c.save return response def setsession(request):
64
64
95
5
58
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
setsession
setsession
78
90
78
78
f8d484c0832b5c3a55908e34dd91d3075b367436
bigcode/the-stack
train
02fab9bcd16568e29baf4c83
train
function
def createStudent1(request): if request.method=="POST": form=StudentForm(request.POST) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'createstudent1.html',{'form':form})
def createStudent1(request):
if request.method=="POST": form=StudentForm(request.POST) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'createstudent1.html',{'form':form})
): name="Saurav Kumar" dept="CSE" return render(request,'sample.html',{'name':name, 'dept':dept}) def createStudent(request): students = Student.objects.all() return render(request,"students.html",{'students':students}) def createStudent1(request):
64
64
64
6
58
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
createStudent1
createStudent1
33
41
33
33
f5e0292d2def9fc43da5e341f3dfd95e937620f2
bigcode/the-stack
train
24dd133982805c0e853ba066
train
function
def index(request): return HttpResponse("Welcome to django!")
def index(request):
return HttpResponse("Welcome to django!")
.core.mail import send_mail from djangop import settings from djangoapp.form import UserForm, RegForm from django.contrib.auth import authenticate,login,logout from django.contrib.auth.decorators import login_required from djangoapp.functions import handle_uploaded_file # Create your views here. def index(request):
64
64
13
4
60
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
index
index
14
15
14
14
0fd6eb1c2a5cdddec28fe475524635993af854b4
bigcode/the-stack
train
53e55ff5289083183fc4fb8c
train
function
def sample(request): name="Saurav Kumar" dept="CSE" return render(request,'sample.html',{'name':name, 'dept':dept})
def sample(request):
name="Saurav Kumar" dept="CSE" return render(request,'sample.html',{'name':name, 'dept':dept})
handle_uploaded_file # Create your views here. def index(request): return HttpResponse("Welcome to django!") def show(request): return render(request,"test.html") def display(request): name="Saurav Kumar" return render(request,'disp.html',{"uname":name}) def sample(request):
64
64
36
4
60
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
sample
sample
24
27
24
24
3af406a40b8f5abad963db52b6097092c654ab40
bigcode/the-stack
train
4717a872e7e55881d1f463df
train
function
def createStudent(request): students = Student.objects.all() return render(request,"students.html",{'students':students})
def createStudent(request):
students = Student.objects.all() return render(request,"students.html",{'students':students})
(request): name="Saurav Kumar" return render(request,'disp.html',{"uname":name}) def sample(request): name="Saurav Kumar" dept="CSE" return render(request,'sample.html',{'name':name, 'dept':dept}) def createStudent(request):
64
64
25
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
createStudent
createStudent
29
31
29
29
1be04ad95a2500c9d968ab08f5b4874cf713a370
bigcode/the-stack
train
745aaafe40512ff3e1010281
train
function
def getsession(request): name=request.session['name'] #fetches session vslue email=request.session['email'] #fetches session vslue return render(request,'result.html',{'name':name, 'email':email})
def getsession(request):
name=request.session['name'] #fetches session vslue email=request.session['email'] #fetches session vslue return render(request,'result.html',{'name':name, 'email':email})
.POST['email'] request.session['name']=name #stores name in session request.session['email']=email #stores email in session return redirect('/getsession') else: form=TestForm() return render(request,'sess.html',{'form':form}) def getsession(request):
64
64
53
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
getsession
getsession
93
96
93
93
9aca2bdc472189cea9b1b169b5e4a89e78d5e29f
bigcode/the-stack
train
fd8fcd884abb05cfc4f2e98d
train
function
def sample1(request): return render(request,"index.html",{'title':'home'})
def sample1(request):
return render(request,"index.html",{'title':'home'})
") else: return redirect("/login") @login_required def home(request): username=request.user.username return render(request,"home.html",{'username':username}) def logoutview(request): logout(request) #It logsout the current user return redirect("/login") def sample1(request):
64
64
18
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
sample1
sample1
154
155
154
154
db630048f668e0bb94d4956ee3886491351d24d7
bigcode/the-stack
train
291deb841b51772a0880d41f
train
function
def about(request): return render(request,"about.html",{'title':'about'})
def about(request):
return render(request,"about.html",{'title':'about'})
username=request.user.username return render(request,"home.html",{'username':username}) def logoutview(request): logout(request) #It logsout the current user return redirect("/login") def sample1(request): return render(request,"index.html",{'title':'home'}) def about(request):
63
64
17
4
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
about
about
157
158
157
157
a711fc9bb714b0a8c97e78e98ad34e7085227d88
bigcode/the-stack
train
0ff2edbbf44cfc5e745536e0
train
function
@login_required def home(request): username=request.user.username return render(request,"home.html",{'username':username})
@login_required def home(request):
username=request.user.username return render(request,"home.html",{'username':username})
username=request.POST['username'] password=request.POST['password'] user=authenticate(request,username=username,password=password) if user is not None: login(request,user)#logs in the user return redirect("/home") else: return redirect("/login") @login_required def home(reque...
64
64
26
7
57
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
home
home
145
148
145
146
6daced50a847b7c2c16ca60847880a2ef21ea004
bigcode/the-stack
train
b895454ad4309a81e29b67d3
train
function
def customreg(request): if request.method=="POST": user=UserForm(request.POST) form=RegForm(request.POST) if user.is_valid() and form.is_valid(): profile = form.save(commit=False) profile.user = request.user user.save() profile.save() ...
def customreg(request):
if request.method=="POST": user=UserForm(request.POST) form=RegForm(request.POST) if user.is_valid() and form.is_valid(): profile = form.save(commit=False) profile.user = request.user user.save() profile.save() return redirect("/log...
saurav001books@rediffmail.com" res=send_mail(subject,msg,settings.EMAIL_HOST_USER, [to]) if(res==1): msg="Mail sent succesfully!" else: msg="Mail could not be sent!" return HttpResponse(msg) def customreg(request):
64
64
103
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
customreg
customreg
119
132
119
119
8f012fd3f0ea13d2063125956568a6a4516e93d0
bigcode/the-stack
train
1725f6e22b1827a272a9907b
train
function
def sendmail(request): subject = "Greetings" msg="Congratulations for your Success!" to="saurav001books@rediffmail.com" res=send_mail(subject,msg,settings.EMAIL_HOST_USER, [to]) if(res==1): msg="Mail sent succesfully!" else: msg="Mail could not be sent!" return HttpResponse(m...
def sendmail(request):
subject = "Greetings" msg="Congratulations for your Success!" to="saurav001books@rediffmail.com" res=send_mail(subject,msg,settings.EMAIL_HOST_USER, [to]) if(res==1): msg="Mail sent succesfully!" else: msg="Mail could not be sent!" return HttpResponse(msg)
response.set_cookie("mycookie","abcd") #my cookie is the name of the cookie return response def getcookie(request): cookievalue=request.COOKIES["mycookie"] #fatches cookie value return HttpResponse("Cookie value is "+cookievalue) def sendmail(request):
64
64
81
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
sendmail
sendmail
108
117
108
108
87ac59c196d925412b85babaabfdd1d5a58aeedf
bigcode/the-stack
train
7646d5b81360b7f4a9b4be0d
train
function
def edit(request,id): student=Student.objects.get(id=id) if request.method=="POST": form=StudentForm(request.POST,instance=student) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'editst...
def edit(request,id):
student=Student.objects.get(id=id) if request.method=="POST": form=StudentForm(request.POST,instance=student) if form.is_valid(): form.save() return redirect("/createstudent") else: form=StudentForm() return render(request,'editstudent.html',{'student'...
return redirect("/createstudent") else: form=StudentForm() return render(request,'createstudent1.html',{'form':form}) def delete(request,id): student=Student.objects.get(id=id) student.delete() return redirect("/createstudent") def edit(request,id):
64
64
74
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
edit
edit
48
57
48
48
5f7704ea5a80529bbf4533b54117c106ba9d63de
bigcode/the-stack
train
2424e2525555d78a73fda8e0
train
function
def setcookie(request): response=HttpResponse("Cookie Set!") response.set_cookie("mycookie","abcd") #my cookie is the name of the cookie return response
def setcookie(request):
response=HttpResponse("Cookie Set!") response.set_cookie("mycookie","abcd") #my cookie is the name of the cookie return response
',{'form':form}) def getsession(request): name=request.session['name'] #fetches session vslue email=request.session['email'] #fetches session vslue return render(request,'result.html',{'name':name, 'email':email}) def setcookie(request):
64
64
39
5
59
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
setcookie
setcookie
98
102
98
98
927604277e13c195089b5f2889ca392622eaa040
bigcode/the-stack
train
e351e24cdbfb56fb30f52392
train
function
def getcookie(request): cookievalue=request.COOKIES["mycookie"] #fatches cookie value return HttpResponse("Cookie value is "+cookievalue)
def getcookie(request):
cookievalue=request.COOKIES["mycookie"] #fatches cookie value return HttpResponse("Cookie value is "+cookievalue)
ue return render(request,'result.html',{'name':name, 'email':email}) def setcookie(request): response=HttpResponse("Cookie Set!") response.set_cookie("mycookie","abcd") #my cookie is the name of the cookie return response def getcookie(request):
64
64
34
5
58
saurav0001kumar/Django-Tutorial
djangop/djangoapp/views.py
Python
getcookie
getcookie
104
106
104
104
f777660a6b63359bd89ee9c83a917faaa0291b93
bigcode/the-stack
train
cff281b8889244972f1cb916
train
function
def hints(env: PysmtEnv) -> FrozenSet[Hint]: assert isinstance(env, PysmtEnv) mgr = env.formula_manager delta = mgr.Symbol(delta_name, types.REAL) r2s = mgr.Symbol("r2s", types.INT) s2r = mgr.Symbol("r2s", types.INT) s_l = mgr.Symbol("s_l", types.BOOL) s_evt = mgr.Symbol("s_evt", types.BOOL...
def hints(env: PysmtEnv) -> FrozenSet[Hint]:
assert isinstance(env, PysmtEnv) mgr = env.formula_manager delta = mgr.Symbol(delta_name, types.REAL) r2s = mgr.Symbol("r2s", types.INT) s2r = mgr.Symbol("r2s", types.INT) s_l = mgr.Symbol("s_l", types.BOOL) s_evt = mgr.Symbol("s_evt", types.BOOL) s_msg_id = mgr.Symbol("s_msg_id", types...
(wait & wait') -> (out_c' = out_c) lhs = msat_make_and(menv, disc_t, msat_make_and(menv, self.wait, self.x_wait)) rhs = msat_make_equal(menv, x_out_c, out_c) self.trans = msat_make_and(menv, self.trans, msat_make_impl(menv, lhs, rhs...
256
256
1,705
15
241
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
hints
hints
342
506
342
342
858520a8115042c45c8e1cf0343d89c602dc14ac
bigcode/the-stack
train
849df7683e1e993ecf06df11
train
function
def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term): m_one = msat_make_number(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1)
def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term):
m_one = msat_make_number(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1)
(pred) x_vals.append(x_pred) assert len(vals) == enum_size assert len(x_vals) == enum_size return b_vars, vals, x_vals def msat_make_minus(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
72
26
37
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
msat_make_minus
msat_make_minus
60
63
60
60
c38225f1e9673b3cae169f25af1413608ccd44e7
bigcode/the-stack
train
fa8b4529ebc79d0a77c0b695
train
function
def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term): geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq)
def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term):
geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq)
(menv, "-1") arg1 = msat_make_times(menv, arg1, m_one) return msat_make_plus(menv, arg0, arg1) def msat_make_lt(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
56
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
msat_make_lt
msat_make_lt
66
68
66
66
f682ff02b643620fb47f1bac9d203fab49c9977a
bigcode/the-stack
train
af59ebc9635c0102a12bbd4c
train
function
def make_enum(menv, v_name: str, enum_size: int): bool_type = msat_get_bool_type(menv) num_bits = ceil(log(enum_size, 2)) b_vars = [] for idx in range(num_bits): c_name = "{}{}".format(v_name, idx) b_vars.append(tuple(decl_consts(menv, c_name, bool_type))) vals = [] x_vals = [] ...
def make_enum(menv, v_name: str, enum_size: int):
bool_type = msat_get_bool_type(menv) num_bits = ceil(log(enum_size, 2)) b_vars = [] for idx in range(num_bits): c_name = "{}{}".format(v_name, idx) b_vars.append(tuple(decl_consts(menv, c_name, bool_type))) vals = [] x_vals = [] for enum_val in range(enum_size): bit_v...
not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s def make_enum(menv, v_name: str, enum_size: int):
91
91
304
16
74
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
make_enum
make_enum
31
57
31
31
6f40058273179024dd97843c5848eacb9296b965
bigcode/the-stack
train
100c1f80f0005ee963526672
train
class
class Receiver(Module): def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) loc, x_loc = self._symb("l", bool_type) self.wait = loc self....
class Receiver(Module):
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) loc, x_loc = self._symb("l", bool_type) self.wait = loc self.work = msat_make_not(men...
_make_and(menv, disc_t, self.wait_ack) rhs = msat_make_iff(menv, self.x_send, msat_make_and(menv, msat_make_equal(menv, in_c, msg_id), msat_make_lt(menv, c, timeout))) self.trans = msat_make_a...
178
178
594
4
174
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
Receiver
Receiver
290
339
290
290
a6252a2abab9f9e2231191273b9dd082b68e6e47
bigcode/the-stack
train
46f06c2b5974be1790879da0
train
function
def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term): return msat_make_leq(menv, arg1, arg0)
def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term):
return msat_make_leq(menv, arg1, arg0)
arg1: msat_term): geq = msat_make_geq(menv, arg0, arg1) return msat_make_not(menv, geq) def msat_make_geq(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
43
27
37
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
msat_make_geq
msat_make_geq
71
72
71
71
b508b807d803a8843eb678982d7c937a8b671e86
bigcode/the-stack
train
325d15c655b57f7054bf0aa0
train
class
class Module: def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, *args, **kwargs): self.name = name self.menv = menv self.enc = enc self.symb2next = {} true = msat_make_true(menv) self.init = true self.trans = true def _symb(s...
class Module:
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, *args, **kwargs): self.name = name self.menv = menv self.enc = enc self.symb2next = {} true = msat_make_true(menv) self.init = true self.trans = true def _symb(self, v_name, v...
(menv, sender.stutter))) rhs = enc.make_G(msat_make_impl(menv, sender.wait_ack, enc.make_F(sender.send))) ltl = msat_make_impl(menv, lhs, rhs) return TermMap(curr2next), init, trans, ltl class Module:
64
64
168
3
60
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
Module
Module
137
154
137
137
1df951df4e384526ae7251d61c59eee88edafeeb
bigcode/the-stack
train
a28fb0d789aa0dd6dc65ee35
train
function
def diverging_symbs(menv: msat_env) -> frozenset: real_type = msat_get_rational_type(menv) delta = msat_declare_function(menv, delta_name, real_type) delta = msat_make_constant(menv, delta) return frozenset([delta])
def diverging_symbs(menv: msat_env) -> frozenset:
real_type = msat_get_rational_type(menv) delta = msat_declare_function(menv, delta_name, real_type) delta = msat_make_constant(menv, delta) return frozenset([delta])
_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1) def diverging_symbs(menv: msat_env) -> frozenset:
64
64
67
17
47
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
diverging_symbs
diverging_symbs
85
89
85
85
52aee152609891824a5119dca9434b688ce1f7d3
bigcode/the-stack
train
55238b323ae3f1b3ee73b745
train
class
class Sender(Module): def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_typ...
class Sender(Module):
def __init__(self, name: str, menv: msat_env, enc: LTLEncoder, in_c, x_in_c, out_c, x_out_c, delta): super().__init__(name, menv, enc) bool_type = msat_get_bool_type(menv) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_type(menv) loc, x...
G (s.wait_ack -> F s.send) lhs = enc.make_G(enc.make_F(msat_make_not(menv, sender.stutter))) rhs = enc.make_G(msat_make_impl(menv, sender.wait_ack, enc.make_F(sender.send))) ltl = msat_make_impl(menv, lhs, rhs) return TermMap(curr2next), init, trans, ltl class Modu...
256
256
1,581
4
252
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
Sender
Sender
157
287
157
157
433aae4a3982373c712889177fa3b8c3bb2c06fd
bigcode/the-stack
train
b19f54fca45316b8e1bdf8ca
train
function
def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term): leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq)
def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term):
leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq)
q(menv: msat_env, arg0: msat_term, arg1: msat_term): return msat_make_leq(menv, arg1, arg0) def msat_make_gt(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
56
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
msat_make_gt
msat_make_gt
75
77
75
75
6ebfbc8ba8c3ffb3ba712af6009f476ff9bc91f6
bigcode/the-stack
train
9e98460feb3108563727c653
train
function
def check_ltl(menv: msat_env, enc: LTLEncoder) -> (Iterable, msat_term, msat_term, msat_term): assert menv assert isinstance(menv, msat_env) assert enc assert isinstance(enc, LTLEncoder) int_type = msat_get_integer_type(menv) real_type = msat_ge...
def check_ltl(menv: msat_env, enc: LTLEncoder) -> (Iterable, msat_term, msat_term, msat_term):
assert menv assert isinstance(menv, msat_env) assert enc assert isinstance(enc, LTLEncoder) int_type = msat_get_integer_type(menv) real_type = msat_get_rational_type(menv) r2s, x_r2s = decl_consts(menv, "r2s", int_type) s2r, x_s2r = decl_consts(menv, "s2r", int_type) delta, x_delta =...
0, arg1) return msat_make_not(menv, leq) def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1) def diverging_symbs(menv: msat_env) -> frozenset: real_type = msat_get_rational_type(menv) delta = msat_declar...
174
174
582
33
141
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
check_ltl
check_ltl
92
134
92
93
c5b5ab0268bf90901fb127d8beeeb6d18e40ef34
bigcode/the-stack
train
33d557c67ddfb7a9033aa475
train
function
def decl_consts(menv: msat_env, name: str, c_type) -> tuple: assert not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s
def decl_consts(menv: msat_env, name: str, c_type) -> tuple:
assert not name.startswith("_"), name s = msat_declare_function(menv, name, c_type) s = msat_make_constant(menv, s) x_s = msat_declare_function(menv, name_next(name), c_type) x_s = msat_make_constant(menv, x_s) return s, x_s
import pysmt.typing as types from ltl.ltl import TermMap, LTLEncoder from utils import name_next, symb_to_next from hint import Hint, Location delta_name = "delta" def decl_consts(menv: msat_env, name: str, c_type) -> tuple:
64
64
97
20
44
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
decl_consts
decl_consts
22
28
22
22
c4ecf1f5e126ec75d8eb9ef6e31b305b569d35be
bigcode/the-stack
train
e21d3c6bd5ef1ec5b3a9861f
train
function
def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term): n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1)
def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term):
n_arg0 = msat_make_not(menv, arg0) return msat_make_or(menv, n_arg0, arg1)
, arg1: msat_term): leq = msat_make_leq(menv, arg0, arg1) return msat_make_not(menv, leq) def msat_make_impl(menv: msat_env, arg0: msat_term, arg1: msat_term):
64
64
57
26
38
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/18-sender_receiver_34.py
Python
msat_make_impl
msat_make_impl
80
82
80
80
6517b33753958b928ace2c9a49a92b8749eb6875
bigcode/the-stack
train
fbb654eb6b49881d855c56a3
train
function
def get_logger(verbosity, log_file): # create logger and formatter logger = logging.getLogger("prosody labeller") formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # Verbose level => logging level log_level = verbosity if (log_level >= len(LEVEL)): l...
def get_logger(verbosity, log_file): # create logger and formatter
logger = logging.getLogger("prosody labeller") formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # Verbose level => logging level log_level = verbosity if (log_level >= len(LEVEL)): log_level = len(LEVEL) - 1 logger.setLevel(log_level) log...
wavelet_prosody_toolkit.prosody_tools import cwt_utils, loma, lab ############################################################################### # global constants ############################################################################### LEVEL = [logging.WARNING, logging.INFO, logging.DEBUG] #################...
64
64
194
16
48
DanAnastasyev/wavelet_prosody_toolkit
wavelet_prosody_toolkit/prosody_labeller.py
Python
get_logger
get_logger
61
86
61
63
620bba75e9f7305543b2d9eb3963e97007de4e96
bigcode/the-stack
train
8231ce0332d58062ef8b497c
train
function
def analysis_batch_wrap(input_file, cfg, annotation_dir=None, output_dir=None, plot=0, logger=None): # Encapsulate running try: print(".") analysis(input_file, cfg, logger, annotation_dir, output_dir, plot) except Exception as ex: logging.error(str(ex)) traceback.print_exc(fi...
def analysis_batch_wrap(input_file, cfg, annotation_dir=None, output_dir=None, plot=0, logger=None): # Encapsulate running
try: print(".") analysis(input_file, cfg, logger, annotation_dir, output_dir, plot) except Exception as ex: logging.error(str(ex)) traceback.print_exc(file=sys.stderr)
%s" % output_filename) fig.savefig(output_filename, bbox_inches='tight', dpi=400) elif plot > 0: plt.show() def analysis_batch_wrap(input_file, cfg, annotation_dir=None, output_dir=None, plot=0, logger=None): # Encapsulate running
64
64
75
31
33
DanAnastasyev/wavelet_prosody_toolkit
wavelet_prosody_toolkit/prosody_labeller.py
Python
analysis_batch_wrap
analysis_batch_wrap
343
350
343
344
1796dc74bbfcee35ffffc6ba148eaa77c8006819
bigcode/the-stack
train
bd11d7beccf6fc8d86c94023
train
function
def main(): """Main entry function """ global args, logger # Load configuration configuration = defaultdict() with open(os.path.dirname(os.path.realpath(__file__)) + "/configs/default.yaml", 'r') as f: configuration = apply_configuration(configuration, defaultdict(lambda: False, yaml.lo...
def main():
"""Main entry function """ global args, logger # Load configuration configuration = defaultdict() with open(os.path.dirname(os.path.realpath(__file__)) + "/configs/default.yaml", 'r') as f: configuration = apply_configuration(configuration, defaultdict(lambda: False, yaml.load(f, Loader...
', dpi=400) elif plot > 0: plt.show() def analysis_batch_wrap(input_file, cfg, annotation_dir=None, output_dir=None, plot=0, logger=None): # Encapsulate running try: print(".") analysis(input_file, cfg, logger, annotation_dir, output_dir, plot) except Exception as ex: ...
102
102
341
3
99
DanAnastasyev/wavelet_prosody_toolkit
wavelet_prosody_toolkit/prosody_labeller.py
Python
main
main
356
397
356
356
6ba20dfd59d9efac920210ae9a325f6e2d0b33c7
bigcode/the-stack
train
40cf1a8fe8e05fdcd5011d74
train
function
def apply_configuration(current_configuration, updating_part): """Utils to update the current configuration using the updating part Parameters ---------- current_configuration: dict The current state of the configuration updating_part: dict The information to add to the current con...
def apply_configuration(current_configuration, updating_part):
"""Utils to update the current configuration using the updating part Parameters ---------- current_configuration: dict The current state of the configuration updating_part: dict The information to add to the current configuration Returns ------- dict the updated...
ch = logging.StreamHandler() ch.setFormatter(formatter) logger.addHandler(ch) # create file handler if log_file is not None: fh = logging.FileHandler(log_file) logger.addHandler(fh) return logger def apply_configuration(current_configuration, updating_part):
64
64
159
9
54
DanAnastasyev/wavelet_prosody_toolkit
wavelet_prosody_toolkit/prosody_labeller.py
Python
apply_configuration
apply_configuration
89
120
89
89
ae136d6b88b22ce453fdbc8e64765da206e5a2c9
bigcode/the-stack
train
d6d17b263b5b5edc44b377cf
train
function
def analysis(input_file, cfg, logger, annotation_dir=None, output_dir=None, plot=False): # Load the wave file print("Analyzing %s starting..." % input_file) orig_sr, sig = misc.read_wav(input_file) # extract energy energy = energy_processing.extract_energy(sig, orig_sr, ...
def analysis(input_file, cfg, logger, annotation_dir=None, output_dir=None, plot=False): # Load the wave file
print("Analyzing %s starting..." % input_file) orig_sr, sig = misc.read_wav(input_file) # extract energy energy = energy_processing.extract_energy(sig, orig_sr, cfg["energy"]["band_min"], cfg["energy"]["band_max...
logger.setLevel(LEVEL[log_level]) # create console handler ch = logging.StreamHandler() ch.setFormatter(formatter) logger.addHandler(ch) # create file handler if log_file is not None: fh = logging.FileHandler(log_file) logger.addHandler(fh) return logger def appl...
256
256
2,365
27
228
DanAnastasyev/wavelet_prosody_toolkit
wavelet_prosody_toolkit/prosody_labeller.py
Python
analysis
analysis
124
341
124
126
80e55ec02a292648a009d62976483ccf81af0849
bigcode/the-stack
train
cd71aaa7b5eb3e6bb7af74c7
train
class
class Solution: def asteroidCollision(self, asteroids: List[int]) -> List[int]: stack = [] for curr in asteroids: while stack and curr < 0 < stack[-1]: if -curr > stack[-1]: stack.pop() continue elif -curr == stack[-...
class Solution:
def asteroidCollision(self, asteroids: List[int]) -> List[int]: stack = [] for curr in asteroids: while stack and curr < 0 < stack[-1]: if -curr > stack[-1]: stack.pop() continue elif -curr == stack[-1]: ...
# Medium # https://leetcode.com/problems/asteroid-collision/ # TC:O(N) # SC:O(N) class Solution:
30
64
86
3
27
Rage-ops/Leetcode-Solutions
stacks/735. Asteroids Collision.py
Python
Solution
Solution
5
18
5
5
e56f9bec5881448559b787eef1c0f2d0a8c0ab0b
bigcode/the-stack
train
601567597174cb339ed1eb9d
train
function
def generate_secret(): """ python 3 is nice with from binary .hex() and from hex to bytes .fromhex() """ secret = os.urandom(MULTIPLE_OF_SIXTEEN).hex() with open("secret_hex_"+datetime.now().strftime('%Y-%m-%d-%H-%M-%S')+'.secret', "w") as file: # We don't need write in binary mode anymore ...
def generate_secret():
""" python 3 is nice with from binary .hex() and from hex to bytes .fromhex() """ secret = os.urandom(MULTIPLE_OF_SIXTEEN).hex() with open("secret_hex_"+datetime.now().strftime('%Y-%m-%d-%H-%M-%S')+'.secret', "w") as file: # We don't need write in binary mode anymore file.write(secr...
IPLE_OF_SIXTEEN = 16 # shouldn't need to change this -- it can be 16, 24, or 32 https://www.dlitz.net/software/pycrypto/api/current/Crypto.Cipher.AES-module.html # currently no IV or salt is used def generate_secret():
64
64
100
4
59
bennywij/junk-drawer
secret_pandas.py
Python
generate_secret
generate_secret
34
44
34
34
ce9661be6e3431ea9081cb38a30f3771a372671f
bigcode/the-stack
train
324f7e68fbe15ec56a5f43dc
train
function
def get_secret(secret_file_name_str): """ We expect a hex encoded secret """ with open(secret_file_name_str,"r") as file: # we don't need to read in binary mode here secret = file.read() return secret
def get_secret(secret_file_name_str):
""" We expect a hex encoded secret """ with open(secret_file_name_str,"r") as file: # we don't need to read in binary mode here secret = file.read() return secret
).hex() with open("secret_hex_"+datetime.now().strftime('%Y-%m-%d-%H-%M-%S')+'.secret', "w") as file: # We don't need write in binary mode anymore file.write(secret) return secret def get_secret(secret_file_name_str):
64
64
55
8
55
bennywij/junk-drawer
secret_pandas.py
Python
get_secret
get_secret
46
53
46
46
c8e66242466d79db7fa4d4bbb8fe7151a0cf137f
bigcode/the-stack
train
82b009f78b8975a3a31fc914
train
function
def hash_df_columns(df, list_of_columns): for col in list_of_columns: df[col]= df[col].apply(lambda x: hash(str(x))) return df
def hash_df_columns(df, list_of_columns):
for col in list_of_columns: df[col]= df[col].apply(lambda x: hash(str(x))) return df
_str) # make the encryption object obj = AES.new(bytes.fromhex(secret)) for col in list_of_columns: df[col]= df[col].apply(lambda x: obj.decrypt(bytes.fromhex(x)).decode().strip()) return df def hash_df_columns(df, list_of_columns):
64
64
37
10
53
bennywij/junk-drawer
secret_pandas.py
Python
hash_df_columns
hash_df_columns
95
100
95
96
1c3f99102b89fae0e641d6b5d5dd28b453ed9025
bigcode/the-stack
train
c31ed69f3426976baf4fb03c
train
function
def decrypt_df_columns(df, list_of_columns, secret_file_name_str): if secret_file_name_str == None: raise ValueError('Aborting -- we need a secret file to continue decrypt') else: secret = get_secret(secret_file_name_str) # make the encryption object obj = AES.new(bytes.fromhex(secret)...
def decrypt_df_columns(df, list_of_columns, secret_file_name_str):
if secret_file_name_str == None: raise ValueError('Aborting -- we need a secret file to continue decrypt') else: secret = get_secret(secret_file_name_str) # make the encryption object obj = AES.new(bytes.fromhex(secret)) for col in list_of_columns: df[col]= df[col].appl...
obj.encrypt(str(x).ljust(get_closest_larger_multiple_of_sixteen(len(x)))).hex()) # above tries to do "smart padding" by expanding to a multiple of 16 only if needed return df def decrypt_df_columns(df, list_of_columns, secret_file_name_str):
64
64
106
15
48
bennywij/junk-drawer
secret_pandas.py
Python
decrypt_df_columns
decrypt_df_columns
80
93
80
81
bde64c54b059a19d51d7698e9d0a96c55ad03248
bigcode/the-stack
train
683522b404f9e297f1c44ec0
train
function
def encrypt_df_columns(df, list_of_columns, secret_file_name_str=None): if secret_file_name_str == None: secret = generate_secret() else: secret = get_secret(secret_file_name_str) # make the encryption object obj = AES.new(bytes.fromhex(secret)) for col in list_of_columns: ...
def encrypt_df_columns(df, list_of_columns, secret_file_name_str=None):
if secret_file_name_str == None: secret = generate_secret() else: secret = get_secret(secret_file_name_str) # make the encryption object obj = AES.new(bytes.fromhex(secret)) for col in list_of_columns: df[col]= df[col].apply(lambda x: obj.encrypt(str(x).ljust(get_closes...
return secret def get_closest_larger_multiple_of_sixteen(n): remainder = n % 16 if remainder == 0: return n else: return n+(16-remainder) def encrypt_df_columns(df, list_of_columns, secret_file_name_str=None):
64
64
130
16
48
bennywij/junk-drawer
secret_pandas.py
Python
encrypt_df_columns
encrypt_df_columns
64
78
64
65
4f6058b2e15b0c7d6b86d13b8358c3fbf0ae36a8
bigcode/the-stack
train
3cb4edf4205539acf04c64f0
train
function
def get_closest_larger_multiple_of_sixteen(n): remainder = n % 16 if remainder == 0: return n else: return n+(16-remainder)
def get_closest_larger_multiple_of_sixteen(n):
remainder = n % 16 if remainder == 0: return n else: return n+(16-remainder)
_name_str): """ We expect a hex encoded secret """ with open(secret_file_name_str,"r") as file: # we don't need to read in binary mode here secret = file.read() return secret def get_closest_larger_multiple_of_sixteen(n):
63
64
43
13
49
bennywij/junk-drawer
secret_pandas.py
Python
get_closest_larger_multiple_of_sixteen
get_closest_larger_multiple_of_sixteen
56
61
56
56
7a1ade2720a635df869c85821826a710fb8ed903
bigcode/the-stack
train
a438f04e9daee3c86296a563
train
class
class SensorViewSetTestCase(TestCase): def setUp(self): now = datetime.now() self.uri = '/api/sensors/' self.value = { "title": str(uuid.uuid4())[:8], "description": str(uuid.uuid4())[:8], "author": 1 ...
class SensorViewSetTestCase(TestCase):
def setUp(self): now = datetime.now() self.uri = '/api/sensors/' self.value = { "title": str(uuid.uuid4())[:8], "description": str(uuid.uuid4())[:8], "author": 1 } def test_post_sensor(self): ...
), content_type='text/csv' ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) def test_get_gases(self): response = client.get(self.uri) self.assertEqual(response.status_code, status.HTTP_200_OK) class SensorViewSetTestCase(TestCase):
64
64
145
9
55
EltonARodrigues/NOIRr-Server
apps/dashboard/tests/test_view.py
Python
SensorViewSetTestCase
SensorViewSetTestCase
41
62
41
42
d3f5bb9bb657b4cb401fcf76f2ffdc27e2c34063
bigcode/the-stack
train
75d4e8000c49f092371628ed
train
class
class GasesCollectedTestCase(TestCase): def setUp(self): self.uri = '/api/gases/' now = datetime.now() self.value = { "id": "789ed3a4-85a8-476e-bff5-fb6899e74f16", "created_at": now.strftime("%Y-%m-%dT%H:%MZ"), "tempera...
class GasesCollectedTestCase(TestCase):
def setUp(self): self.uri = '/api/gases/' now = datetime.now() self.value = { "id": "789ed3a4-85a8-476e-bff5-fb6899e74f16", "created_at": now.strftime("%Y-%m-%dT%H:%MZ"), "temperature": 55.0, "hum...
from django.test import TestCase from rest_framework.test import APIRequestFactory from rest_framework.test import APITestCase, APIClient from django.urls import reverse, resolve from rest_framework import status from datetime import datetime import json import uuid client = APIClient() class GasesCollectedTestCase(Te...
67
70
236
9
58
EltonARodrigues/NOIRr-Server
apps/dashboard/tests/test_view.py
Python
GasesCollectedTestCase
GasesCollectedTestCase
13
38
13
14
2288252000d5045905d69e75a0247ea69e1895c5
bigcode/the-stack
train
c27aab58d701236004caee60
train
function
def _strip_unnecessary_zeros(number_as_string): return number_as_string.rstrip('0').rstrip('.') if '.' in number_as_string else number_as_string
def _strip_unnecessary_zeros(number_as_string):
return number_as_string.rstrip('0').rstrip('.') if '.' in number_as_string else number_as_string
pow(10, decimal_places) print( f'quantity: {quantity}, decimal_places: {decimal_places}, numerator: {int(numerator)}, denominator: {int(denominator)}') return (int(numerator), int(denominator)) def _strip_unnecessary_zeros(number_as_string):
64
64
33
11
53
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_strip_unnecessary_zeros
_strip_unnecessary_zeros
101
102
101
101
a78c7d2382edb07584ef99f381f3490bf55f9626
bigcode/the-stack
train
74525f05189aa3a0b1334a5c
train
function
def _get_evm_parameters(order, instrument_id, decimals): abi_types = [] evm_parameters = [] # account abi_types.append('address') evm_parameters.append(to_checksum_address(order['accountId'])) # originatorTimestamp abi_types.append('uint64') evm_parameters.append(to_int(int(order['times...
def _get_evm_parameters(order, instrument_id, decimals):
abi_types = [] evm_parameters = [] # account abi_types.append('address') evm_parameters.append(to_checksum_address(order['accountId'])) # originatorTimestamp abi_types.append('uint64') evm_parameters.append(to_int(int(order['timestamp']))) # orderType abi_types.append('uint8') ...
from web3.auto import w3 from decimal import * def sign_order(order, instrument_id, decimals, secret): (abi_types, evm_parameters) = _get_evm_parameters( order, instrument_id, decimals) # solidity pack into bytes keccak_hash = _get_hash(abi_types, evm_parameters) signature = sign(keccak_hash, ...
99
99
330
13
85
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_get_evm_parameters
_get_evm_parameters
18
59
18
18
426f27401352769ac90adf287e1329bd2dd93952
bigcode/the-stack
train
681f8995f35ffb8343f352c1
train
function
def sign_order(order, instrument_id, decimals, secret): (abi_types, evm_parameters) = _get_evm_parameters( order, instrument_id, decimals) # solidity pack into bytes keccak_hash = _get_hash(abi_types, evm_parameters) signature = sign(keccak_hash, secret) return signature
def sign_order(order, instrument_id, decimals, secret):
(abi_types, evm_parameters) = _get_evm_parameters( order, instrument_id, decimals) # solidity pack into bytes keccak_hash = _get_hash(abi_types, evm_parameters) signature = sign(keccak_hash, secret) return signature
from eth_utils import to_checksum_address from eth_utils.conversions import to_int from eth_utils import to_wei from web3 import Web3 from web3.auto import w3 from decimal import * def sign_order(order, instrument_id, decimals, secret):
56
64
74
12
44
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
sign_order
sign_order
9
15
9
9
2c7ee7b76ae8271011d94be933da9a3e2ba6f0f4
bigcode/the-stack
train
df181d8c930c3618a2b07fa7
train
function
def _get_hash(abi_types, evm_parameters): # return keccak_hash return Web3.soliditySha3(abi_types, evm_parameters)
def _get_hash(abi_types, evm_parameters): # return keccak_hash
return Web3.soliditySha3(abi_types, evm_parameters)
str(x) s = s.rstrip('0').rstrip('.') if '.' in s else s if not '.' in s: return 0 return len(s) - s.index('.') - 1 def _get_hash(abi_types, evm_parameters): # return keccak_hash
64
64
35
19
44
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_get_hash
_get_hash
113
115
113
114
036522c6a10075c1ce62a7e4bd513f2b1e313f68
bigcode/the-stack
train
279562844269cbffc279d00b
train
function
def convert_to_unit_lowest_denomination(number, decimals): return _convert_to_unit_lowest_denomination(number, decimals)
def convert_to_unit_lowest_denomination(number, decimals):
return _convert_to_unit_lowest_denomination(number, decimals)
STM': 4 } return order_dict[order_type] def _get_side_as_int(side): side_dict = { 'buy': 1, 'sell': 2 } return side_dict[side] def convert_to_unit_lowest_denomination(number, decimals):
64
64
28
13
51
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
convert_to_unit_lowest_denomination
convert_to_unit_lowest_denomination
80
81
80
80
a7b065710b9c538dc96c7b5151738c636beb5280
bigcode/the-stack
train
7ff86eebc6ec8dbf411ec941
train
function
def get_quantity_numerator_and_denominator(quantity): decimal_places = _numbers_after_decimal_point(quantity) str_quantity = str(quantity) numerator = _strip_unnecessary_zeros(str_quantity).replace('.', '') denominator = pow(10, decimal_places) print( f'quantity: {quantity}, decimal_places: ...
def get_quantity_numerator_and_denominator(quantity):
decimal_places = _numbers_after_decimal_point(quantity) str_quantity = str(quantity) numerator = _strip_unnecessary_zeros(str_quantity).replace('.', '') denominator = pow(10, decimal_places) print( f'quantity: {quantity}, decimal_places: {decimal_places}, numerator: {int(numerator)}, denomin...
ination(number, decimals): number_in_wei = w3.toWei(number, 'ether') str_number = str(number_in_wei) final_value = str_number[:(len(str_number) - (18-decimals))] return int(final_value) def get_quantity_numerator_and_denominator(quantity):
64
64
99
10
54
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
get_quantity_numerator_and_denominator
get_quantity_numerator_and_denominator
91
98
91
91
6592b2e1011ca64803c45980eb1c6eaab2c5fe14
bigcode/the-stack
train
db32ef03779e25483d8208c9
train
function
def _get_side_as_int(side): side_dict = { 'buy': 1, 'sell': 2 } return side_dict[side]
def _get_side_as_int(side):
side_dict = { 'buy': 1, 'sell': 2 } return side_dict[side]
def _get_order_type_as_int(order_type): order_dict = { 'LMT': 1, 'MKT': 2, 'SLM': 3, 'STM': 4 } return order_dict[order_type] def _get_side_as_int(side):
64
64
36
8
56
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_get_side_as_int
_get_side_as_int
72
77
72
72
0ecebb6e341f02f084659728e8ebee14cbb42e59
bigcode/the-stack
train
d57ca19418a862584752e7cf
train
function
def _convert_to_unit_lowest_denomination(number, decimals): number_in_wei = w3.toWei(number, 'ether') str_number = str(number_in_wei) final_value = str_number[:(len(str_number) - (18-decimals))] return int(final_value)
def _convert_to_unit_lowest_denomination(number, decimals):
number_in_wei = w3.toWei(number, 'ether') str_number = str(number_in_wei) final_value = str_number[:(len(str_number) - (18-decimals))] return int(final_value)
'buy': 1, 'sell': 2 } return side_dict[side] def convert_to_unit_lowest_denomination(number, decimals): return _convert_to_unit_lowest_denomination(number, decimals) def _convert_to_unit_lowest_denomination(number, decimals):
64
64
63
14
50
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_convert_to_unit_lowest_denomination
_convert_to_unit_lowest_denomination
84
88
84
84
07b39a63e7d6b2f82c68d2851547da4636c28322
bigcode/the-stack
train
46785cd750197e869691fc94
train
function
def _numbers_after_decimal_point(x): s = str(x) s = s.rstrip('0').rstrip('.') if '.' in s else s if not '.' in s: return 0 return len(s) - s.index('.') - 1
def _numbers_after_decimal_point(x):
s = str(x) s = s.rstrip('0').rstrip('.') if '.' in s else s if not '.' in s: return 0 return len(s) - s.index('.') - 1
umerator)}, denominator: {int(denominator)}') return (int(numerator), int(denominator)) def _strip_unnecessary_zeros(number_as_string): return number_as_string.rstrip('0').rstrip('.') if '.' in number_as_string else number_as_string def _numbers_after_decimal_point(x):
64
64
56
8
55
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_numbers_after_decimal_point
_numbers_after_decimal_point
105
110
105
105
ff956bd6d65a19951a75601c61726e3aec8c6bda
bigcode/the-stack
train
b3c69004541cc889686f08af
train
function
def sign(hash, secret): signed_message = w3.eth.account.signHash(hash, secret) return signed_message.signature.hex()
def sign(hash, secret):
signed_message = w3.eth.account.signHash(hash, secret) return signed_message.signature.hex()
not '.' in s: return 0 return len(s) - s.index('.') - 1 def _get_hash(abi_types, evm_parameters): # return keccak_hash return Web3.soliditySha3(abi_types, evm_parameters) def sign(hash, secret):
64
64
27
6
58
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
sign
sign
118
120
118
118
2d4c1a13b0b316ad47061709108352daf87b6ae6
bigcode/the-stack
train
28f807931161b89348f1e7ac
train
function
def _get_order_type_as_int(order_type): order_dict = { 'LMT': 1, 'MKT': 2, 'SLM': 3, 'STM': 4 } return order_dict[order_type]
def _get_order_type_as_int(order_type):
order_dict = { 'LMT': 1, 'MKT': 2, 'SLM': 3, 'STM': 4 } return order_dict[order_type]
ominator( order['quantity']) abi_types.append('uint64') evm_parameters.append(to_int(numerator)) abi_types.append('uint64') evm_parameters.append(to_int(denominator)) return (abi_types, evm_parameters) def _get_order_type_as_int(order_type):
64
64
56
10
54
linq-network/hummingbot-leverj
hummingbot/connector/derivative/leverj_perpetual/leverj_perpetual_order_signer.py
Python
_get_order_type_as_int
_get_order_type_as_int
62
69
62
62
7534c7ecfe6a46e83baeb832f36ef57a06be396c
bigcode/the-stack
train
03e9aef50c190fc4148b61e4
train
class
class Game: def __init__(self, canvas:tkinter.Canvas, nextCanvas, app = None) -> None: self.app = app self.stepNum = 0 self.dao = BaseDao() self.gameRunningStatus = 0 self.canvas = canvas self.nextCanvas = nextCanvas for _ in range(4): nextCanvasBl...
class Game:
def __init__(self, canvas:tkinter.Canvas, nextCanvas, app = None) -> None: self.app = app self.stepNum = 0 self.dao = BaseDao() self.gameRunningStatus = 0 self.canvas = canvas self.nextCanvas = nextCanvas for _ in range(4): nextCanvasBlocks.append(...
# -*- coding: UTF-8 -*- from math import fabs import tkinter from tkinter.constants import ALL from tetris.config import * from tetris.tetris import Tetris from tetris.nexTetris import NexTetris from tetris.nextBlock import NextBlock import random from threading import Timer import threading import time from tetris.db...
87
256
3,278
3
83
zhoutk/ptetris
tetris/game.py
Python
Game
Game
17
389
17
17
716591c9f1d5724be4632b6310e81f4171b0e76b
bigcode/the-stack
train
2daa2047b872c44ad4b4e5d6
train
class
class TestSearch(unittest.TestCase): def test_search(self): # prepare logger logfile = logging.get_log_file('search_test') logging.set_logfile(logfile) logging.info('Starting test of TensorFlowSearcher') parser = get_args_parser(n_steps=4, confidence=0.9) args = parser.parse_args([]) search(args) # f...
class TestSearch(unittest.TestCase):
def test_search(self): # prepare logger logfile = logging.get_log_file('search_test') logging.set_logfile(logfile) logging.info('Starting test of TensorFlowSearcher') parser = get_args_parser(n_steps=4, confidence=0.9) args = parser.parse_args([]) search(args) # finish logging logging.info('Finishe...
OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # ==END LICENSE== import unittest from dpfinder.searcher import search, get_args_parser from dpfinder import logging class TestSearch(unittest.TestCase):
64
64
102
7
56
barryZZJ/dp-finder
dpfinder/searcher/test_search.py
Python
TestSearch
TestSearch
34
47
34
34
8aa8a42dde22e091b0cc2f03ab5144704798b511
bigcode/the-stack
train
207d25df402bb06d005acd38
train
function
@app.get("/") def homepage(request: Request): return templates.TemplateResponse("homepage.html", context={ "request": request })
@app.get("/") def homepage(request: Request):
return templates.TemplateResponse("homepage.html", context={ "request": request })
BaseModel # NLU. from backend.intent_classifier import classify_user_input from backend.agent import response_handler app = FastAPI() templates = Jinja2Templates(directory="frontend/templates") app.mount("/static", StaticFiles(directory="frontend/static"), name="static") @app.get("/") def homepage(request: Request...
64
64
28
9
55
devanshud13/chatbot
main.py
Python
homepage
homepage
17
21
17
18
abc4bb3acb7a91603e844718a2a6833502be9f10
bigcode/the-stack
train
c801b0f4677d1305f5c4b52a
train
function
@app.get("/about") def about(request: Request): """ Displays About page. """ return templates.TemplateResponse("about.html", { "request": request })
@app.get("/about") def about(request: Request):
""" Displays About page. """ return templates.TemplateResponse("about.html", { "request": request })
classify_user_input(user_input=user_input) response = response_handler(intent_detected=intent_detected, user_input_tokens=user_input_tokens, confidence=confidence, unk_percent=unk_percent) return { "bot_res...
64
64
38
11
53
devanshud13/chatbot
main.py
Python
about
about
48
55
48
49
4a5b109ed5760d424926716dd5120ce36f4aaf1f
bigcode/the-stack
train
e5907473944a1cf8ba9044c0
train
class
class Chat(BaseModel): """ Validating the POST sent from client. """ user_input: str
class Chat(BaseModel):
""" Validating the POST sent from client. """ user_input: str
= FastAPI() templates = Jinja2Templates(directory="frontend/templates") app.mount("/static", StaticFiles(directory="frontend/static"), name="static") @app.get("/") def homepage(request: Request): return templates.TemplateResponse("homepage.html", context={ "request": request }) class Chat(BaseModel)...
64
64
24
5
59
devanshud13/chatbot
main.py
Python
Chat
Chat
24
28
24
24
79e438e591c9bbab17b8fe7948958723dc1d7e40
bigcode/the-stack
train
7fa5484c787244528d3eebb1
train
function
@app.post("/chat") def chat_with_bot(chat: Chat): """ Generates Bot Responses. """ user_input = chat.user_input user_input_tokens, intent_detected, confidence, unk_percent = classify_user_input(user_input=user_input) response = response_handler(intent_detected=intent_detected, ...
@app.post("/chat") def chat_with_bot(chat: Chat):
""" Generates Bot Responses. """ user_input = chat.user_input user_input_tokens, intent_detected, confidence, unk_percent = classify_user_input(user_input=user_input) response = response_handler(intent_detected=intent_detected, user_input_tokens=user_input_tokens...
.get("/") def homepage(request: Request): return templates.TemplateResponse("homepage.html", context={ "request": request }) class Chat(BaseModel): """ Validating the POST sent from client. """ user_input: str @app.post("/chat") def chat_with_bot(chat: Chat):
64
64
97
13
50
devanshud13/chatbot
main.py
Python
chat_with_bot
chat_with_bot
31
45
31
32
cbc48a3b61572e5160566123d455634bd2f5cd4d
bigcode/the-stack
train
10c5b9ec44e32b2b8599cb95
train
class
class TestTokuMXCollector(CollectorTestCase): def setUp(self): config = get_collector_config('TokuMXCollector', { 'host': 'localhost:27017', 'databases': '^db', }) self.collector = TokuMXCollector(config, None) self.connection = MagicMock() def test_impor...
class TestTokuMXCollector(CollectorTestCase):
def setUp(self): config = get_collector_config('TokuMXCollector', { 'host': 'localhost:27017', 'databases': '^db', }) self.collector = TokuMXCollector(config, None) self.connection = MagicMock() def test_import(self): self.assertTrue(TokuMXCollect...
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from test import run_only from mock import MagicMock from mock import patch from mock import call from di...
147
256
967
11
136
kevinrobinson/Diamond-1
src/collectors/tokumx/test/testtokumx.py
Python
TestTokuMXCollector
TestTokuMXCollector
29
143
29
29
a0fff191ccbffbbd8e3576b7ea7d07d2538b10b6
bigcode/the-stack
train
9d30b911e822fa714c3358df
train
function
def run_only_if_pymongo_is_available(func): try: import pymongo pymongo # workaround for pyflakes issue #13 except ImportError: pymongo = None pred = lambda: pymongo is not None return run_only(func, pred)
def run_only_if_pymongo_is_available(func):
try: import pymongo pymongo # workaround for pyflakes issue #13 except ImportError: pymongo = None pred = lambda: pymongo is not None return run_only(func, pred)
test import get_collector_config from test import unittest from test import run_only from mock import MagicMock from mock import patch from mock import call from diamond.collector import Collector from tokumx import TokuMXCollector ################################################################################ def ...
64
64
62
11
52
kevinrobinson/Diamond-1
src/collectors/tokumx/test/testtokumx.py
Python
run_only_if_pymongo_is_available
run_only_if_pymongo_is_available
19
26
19
19
4acd3d5d17299284108a3e9845e1364a0d5583a4
bigcode/the-stack
train
48396e99090f0c8ba04b4650
train
class
class TestMongoMultiHostDBCollector(CollectorTestCase): def setUp(self): config = get_collector_config('TokuMXCollector', { 'hosts': ['localhost:27017', 'localhost:27057'], 'databases': '^db', }) self.collector = TokuMXCollector(config, None) self.connection =...
class TestMongoMultiHostDBCollector(CollectorTestCase):
def setUp(self): config = get_collector_config('TokuMXCollector', { 'hosts': ['localhost:27017', 'localhost:27057'], 'databases': '^db', }) self.collector = TokuMXCollector(config, None) self.connection = MagicMock() def test_import(self): self.as...
ector_mock, data) self.connection['db1'].collection_names.return_value = ['collection1', 'tmp.mr.tmp1'] self.connection['db1'].command.return_value = {'key': 2, 'string': 'str'} ...
256
256
1,065
12
244
kevinrobinson/Diamond-1
src/collectors/tokumx/test/testtokumx.py
Python
TestMongoMultiHostDBCollector
TestMongoMultiHostDBCollector
146
265
146
146
dd2a7f8dff0a8d3c3de357639345c08fea17840c
bigcode/the-stack
train
ffbaaf7583ee2de6a8daef06
train
function
def admin_token_required(f): @wraps(f) def decorated(*args, **kwargs): data, status = get_logged_in_user(request) token = data.get('data') if not token: return data, status admin = token.get('admin') if not admin: response_object = { ...
def admin_token_required(f): @wraps(f)
def decorated(*args, **kwargs): data, status = get_logged_in_user(request) token = data.get('data') if not token: return data, status admin = token.get('admin') if not admin: response_object = { 'status': 'fail', 'mes...
def decorated(*args, **kwargs): data, status = get_logged_in_user(request) token = data.get('data') if not token: return data, status return f(*args, **kwargs) return decorated def admin_token_required(f): @wraps(f)
64
64
108
12
51
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
admin_token_required
admin_token_required
129
149
129
130
1e9a1b2e5fe35708ba1f6ef1f4598418d513f2a1
bigcode/the-stack
train
82e4effcebb8c320d625f0ae
train
function
def invalidate_token(token): invalid_token = InvalidToken(token=token) try: db.session.add(invalid_token) db.session.commit() response_object = { 'status': 'success', 'message': 'Successfully logged out.' } return response_object, 200 except Ex...
def invalidate_token(token):
invalid_token = InvalidToken(token=token) try: db.session.add(invalid_token) db.session.commit() response_object = { 'status': 'success', 'message': 'Successfully logged out.' } return response_object, 200 except Exception as e: respons...
'status': 'fail', 'message': resp } return response_object, 401 else: response_object = { 'status': 'fail', 'message': 'Provide a valid auth token.' } return response_object, 401 def inval...
64
64
96
5
58
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
invalidate_token
invalidate_token
94
109
94
94
a53166df2091c7afc4d4f955b40f1a4934624877
bigcode/the-stack
train
54da08a2be2593398e07208f
train
function
def get_logged_in_user(new_request): authorization = new_request.headers.get('Authorization') if authorization is None: auth_token = None else: _, auth_token = authorization.split(' ') if auth_token: resp = User.decode_auth_token(auth_token) ...
def get_logged_in_user(new_request):
authorization = new_request.headers.get('Authorization') if authorization is None: auth_token = None else: _, auth_token = authorization.split(' ') if auth_token: resp = User.decode_auth_token(auth_token) if not isinstance(resp, str): ...
': 'fail', 'message': resp } return response_object, 401 else: response_object = { 'status': 'fail', 'message': 'Provide a valid auth token.' } return response_object, 403 def get_logged_in_user(new_request):
64
64
205
8
55
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
get_logged_in_user
get_logged_in_user
60
91
60
60
9097dc52fb1c691c530d22890732b6df55b63335
bigcode/the-stack
train
2948293c75439a5138884854
train
function
def logout_user(data): if data: auth_token = data.split(" ")[1] else: auth_token = '' if auth_token: resp = User.decode_auth_token(auth_token) if not isinstance(resp, str): return invalidate_token(token=auth_token) else: response_object = { ...
def logout_user(data):
if data: auth_token = data.split(" ")[1] else: auth_token = '' if auth_token: resp = User.decode_auth_token(auth_token) if not isinstance(resp, str): return invalidate_token(token=auth_token) else: response_object = { 'status': ...
': 'email or password does not match.' } return response_object, 401 except Exception as e: print(e) response_object = { 'status': 'fail', 'message': 'Try again' } return response_object, 500 def logout_user(data):
64
64
126
5
58
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
logout_user
logout_user
37
57
37
37
21e36df72622cdcb59f6a15155bff856aa5e860b
bigcode/the-stack
train
0012e06a9ad901cf75f7863c
train
function
def token_required(f): @wraps(f) def decorated(*args, **kwargs): data, status = get_logged_in_user(request) token = data.get('data') if not token: return data, status return f(*args, **kwargs) return decorated
def token_required(f): @wraps(f)
def decorated(*args, **kwargs): data, status = get_logged_in_user(request) token = data.get('data') if not token: return data, status return f(*args, **kwargs) return decorated
'message': 'Successfully logged out.' } return response_object, 200 except Exception as e: response_object = { 'status': 'fail', 'message': e } return response_object, 200 def token_required(f): @wraps(f)
64
64
63
11
52
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
token_required
token_required
113
125
113
114
95263add44184db946c4f988983c216ea7f2401a
bigcode/the-stack
train
03858ca0a8114ee76fa34e9b
train
function
def login_user(data): try: user = User.query.filter_by(email=data.get('email')).first() if user and user.check_password(data.get('password')): auth_token = user.encode_auth_token(user.id) if auth_token: response_object = { 'status': 'succes...
def login_user(data):
try: user = User.query.filter_by(email=data.get('email')).first() if user and user.check_password(data.get('password')): auth_token = user.encode_auth_token(user.id) if auth_token: response_object = { 'status': 'success', ...
from functools import wraps from flask import request from ..models import User, InvalidToken from ..application import db def login_user(data):
30
64
171
5
24
aicioara-old/flask_tutorial4
src/backend/managers/auth_manager.py
Python
login_user
login_user
9
34
9
9
20c8dac706d7a0228cde38789669595598247b92
bigcode/the-stack
train
d155aceb4c1642c052a71016
train
class
class TestCommentView: def test_retrieve_comment(self, api_client): comment_1 = f.CommentFactory.create() response = api_client.get(f'/comments/{comment_1.id}/') assert response.status_code == 200 assert response.data == CommentResponseSerializer(comment_1).data def test_update...
class TestCommentView:
def test_retrieve_comment(self, api_client): comment_1 = f.CommentFactory.create() response = api_client.get(f'/comments/{comment_1.id}/') assert response.status_code == 200 assert response.data == CommentResponseSerializer(comment_1).data def test_update_comment(self, api_clie...
response.status_code == 201 assert response.data['text'] == text def test_list_comments(self, api_client): comment_1 = f.CommentFactory.create() response = api_client.get(f'/comments/') assert response.status_code == 200 assert len(response.data) == 1 assert respon...
88
88
296
5
82
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
TestCommentView
TestCommentView
152
185
152
152
ac16c61d936df1222bd6f0c33507c5e3881529f3
bigcode/the-stack
train
85435926b38d1bd7d82e89fe
train
class
class ArticleView(RetrieveUpdateDestroyAPIView): queryset = Article.objects.all() request_serializer_class = ArticleRequestSerializer destroy_request_serializer_class = ArticleDeleteSerializer response_serializer_class = ArticleResponseSerializer def perform_destroy(self, instance, serializer=None)...
class ArticleView(RetrieveUpdateDestroyAPIView):
queryset = Article.objects.all() request_serializer_class = ArticleRequestSerializer destroy_request_serializer_class = ArticleDeleteSerializer response_serializer_class = ArticleResponseSerializer def perform_destroy(self, instance, serializer=None): instance.is_deleted = True inst...
Serializer, ArticleRequestSerializer, ArticleResponseSerializer, CommentRequestSerializer, CommentResponseSerializer, ) class ArticlesView(ListCreateAPIView): queryset = Article.objects.all() request_serializer_class = ArticleRequestSerializer response_serializer_class = ArticleResponseSer...
64
64
94
9
54
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
ArticleView
ArticleView
22
33
22
22
028bc57012c6d57210ea2e4dfb8b5b86486fceec
bigcode/the-stack
train
dc123789f59398d2dec80031
train
class
class TestCommentsView: def test_create_comment(self, api_client): article_1 = f.ArticleFactory.create() text = 'test-comment-text' response = api_client.post( f'/comments/', {'article_id': article_1.id, 'text': text} ) assert response.status_code == 201 ...
class TestCommentsView:
def test_create_comment(self, api_client): article_1 = f.ArticleFactory.create() text = 'test-comment-text' response = api_client.post( f'/comments/', {'article_id': article_1.id, 'text': text} ) assert response.status_code == 201 assert response.data['te...
article_1.id}/', {'with_comments': True} ) assert response.status_code == 204 assert Article.objects.get(id=article_1.id).is_deleted is True assert Article.objects.get(id=article_1.id).comments.count() == 0 class TestCommentsView:
64
64
146
5
58
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
TestCommentsView
TestCommentsView
132
149
132
132
0798da017d4b1488d211642fd7b28f85f4aa238c
bigcode/the-stack
train
f543eb13d893142966c79b9f
train
function
@pytest.fixture(autouse=True) def root_urlconf(settings): settings.ROOT_URLCONF = __name__
@pytest.fixture(autouse=True) def root_urlconf(settings):
settings.ROOT_URLCONF = __name__
path('articles/', ArticlesView.as_view()), path('articles/<int:pk>/', ArticleView.as_view()), path('comments/', CommentsView.as_view()), path('comments/<int:pk>/', CommentView.as_view()), ] @pytest.fixture(autouse=True) def root_urlconf(settings):
64
64
23
13
51
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
root_urlconf
root_urlconf
56
58
56
57
2b8e78f8c838c335773f7988193ae92d00897ec0
bigcode/the-stack
train
6de49a9fe0c6f8e898b85262
train
class
class TestArticleView: def test_retrieve_article(self, api_client): article_1 = f.ArticleFactory.create() response = api_client.get(f'/articles/{article_1.id}/') assert response.status_code == 200 assert response.data == ArticleResponseSerializer(article_1).data def test_update...
class TestArticleView:
def test_retrieve_article(self, api_client): article_1 = f.ArticleFactory.create() response = api_client.get(f'/articles/{article_1.id}/') assert response.status_code == 200 assert response.data == ArticleResponseSerializer(article_1).data def test_update_article(self, api_clie...
(self, api_client): title = 'test-article-title' text = 'test-article-text' response = api_client.post(f'/articles/', {'title': title, 'text': text}) assert response.status_code == 201 assert response.data['title'] == title assert response.data['text'] == text def te...
143
143
478
5
137
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
TestArticleView
TestArticleView
79
129
79
79
9a830f4c11b4162c16b437557bc936e556e6d705
bigcode/the-stack
train
6dea2f6baea94e1ed1099a48
train
class
class CommentsView(ListCreateAPIView): queryset = Comment.objects.all() request_serializer_class = CommentRequestSerializer response_serializer_class = CommentResponseSerializer
class CommentsView(ListCreateAPIView):
queryset = Comment.objects.all() request_serializer_class = CommentRequestSerializer response_serializer_class = CommentResponseSerializer
_serializer_class = ArticleResponseSerializer def perform_destroy(self, instance, serializer=None): instance.is_deleted = True instance.save(update_fields=['is_deleted']) if serializer is not None and serializer.validated_data.get('with_comments'): instance.comments.all().delet...
64
64
32
7
57
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
CommentsView
CommentsView
36
39
36
36
c9d089fbad65766a5c1dcccc5694b9e68247f298
bigcode/the-stack
train
c7c48a18eed87f7850c0aead
train
class
class TestArticlesView: def test_create_article(self, api_client): title = 'test-article-title' text = 'test-article-text' response = api_client.post(f'/articles/', {'title': title, 'text': text}) assert response.status_code == 201 assert response.data['title'] == title ...
class TestArticlesView:
def test_create_article(self, api_client): title = 'test-article-title' text = 'test-article-text' response = api_client.post(f'/articles/', {'title': title, 'text': text}) assert response.status_code == 201 assert response.data['title'] == title assert response.data[...
:pk>/', ArticleView.as_view()), path('comments/', CommentsView.as_view()), path('comments/<int:pk>/', CommentView.as_view()), ] @pytest.fixture(autouse=True) def root_urlconf(settings): settings.ROOT_URLCONF = __name__ class TestArticlesView:
63
64
148
5
58
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
TestArticlesView
TestArticlesView
61
76
61
61
9041cfb341665ca113e050403218bbecf629b8df
bigcode/the-stack
train
cbdf9299cc6995a95a848b7c
train
class
class CommentView(RetrieveUpdateDestroyAPIView): queryset = Comment.objects.all() request_serializer_class = CommentRequestSerializer response_serializer_class = CommentResponseSerializer
class CommentView(RetrieveUpdateDestroyAPIView):
queryset = Comment.objects.all() request_serializer_class = CommentRequestSerializer response_serializer_class = CommentResponseSerializer
if serializer is not None and serializer.validated_data.get('with_comments'): instance.comments.all().delete() class CommentsView(ListCreateAPIView): queryset = Comment.objects.all() request_serializer_class = CommentRequestSerializer response_serializer_class = CommentResponseSerializ...
64
64
34
9
54
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
CommentView
CommentView
42
45
42
42
b5f710f334aca5c1bdf0e0acf5258af6dfe7f010
bigcode/the-stack
train
d25addde98d672fe82c11b36
train
class
class ArticlesView(ListCreateAPIView): queryset = Article.objects.all() request_serializer_class = ArticleRequestSerializer response_serializer_class = ArticleResponseSerializer
class ArticlesView(ListCreateAPIView):
queryset = Article.objects.all() request_serializer_class = ArticleRequestSerializer response_serializer_class = ArticleResponseSerializer
import ListCreateAPIView, RetrieveUpdateDestroyAPIView from . import factories as f from .models import Article, Comment from .serializers import ( ArticleDeleteSerializer, ArticleRequestSerializer, ArticleResponseSerializer, CommentRequestSerializer, CommentResponseSerializer, ) class ArticlesVie...
64
64
32
7
57
defineimpossible/django-rest-batteries
tests/test_generics.py
Python
ArticlesView
ArticlesView
16
19
16
16
002c66035fda2eb5a4594d6ac316be6a555a5973
bigcode/the-stack
train
095e843ca71e97483758380b
train
class
class TestAppCache(object): @pytest.mark.xfail_chrome @pytest.mark.xfail_marionette(raises=WebDriverException) @pytest.mark.xfail_phantomjs(raises=WebDriverException) def testWeCanGetTheStatusOfTheAppCache(self, driver, pages): pages.load('html5Page') driver.implicitly_wait(2) a...
class TestAppCache(object): @pytest.mark.xfail_chrome @pytest.mark.xfail_marionette(raises=WebDriverException) @pytest.mark.xfail_phantomjs(raises=WebDriverException)
def testWeCanGetTheStatusOfTheAppCache(self, driver, pages): pages.load('html5Page') driver.implicitly_wait(2) app_cache = driver.application_cache status = app_cache.status while status == ApplicationCache.DOWNLOADING: status = app_cache.status assert A...
import WebDriverException from selenium.webdriver.common.html5.application_cache import ApplicationCache class TestAppCache(object): @pytest.mark.xfail_chrome @pytest.mark.xfail_marionette(raises=WebDriverException) @pytest.mark.xfail_phantomjs(raises=WebDriverException)
64
64
125
47
16
davidgonzalezbarbe/Selenium
py/test/selenium/webdriver/common/appcache_tests.py
Python
TestAppCache
TestAppCache
24
38
24
28
32247224a947cd8819e3d97117965d895afd4c8e
bigcode/the-stack
train
210d45ba4094a19473be0510
train
class
class OutputParam(Parameter): def __init__(self, name, default, optional=True, readonly=False): assert optional # None has meaning (passthrough node) super(OutputParam, self).__init__(name, default, optional, readonly) def check_ndarray(self, node, output): if len(output.shape) > 1: ...
class OutputParam(Parameter):
def __init__(self, name, default, optional=True, readonly=False): assert optional # None has meaning (passthrough node) super(OutputParam, self).__init__(name, default, optional, readonly) def check_ndarray(self, node, output): if len(output.shape) > 1: raise ValidationErro...
import warnings import numpy as np import nengo.utils.numpy as npext from nengo.base import NengoObject, ObjView from nengo.exceptions import ValidationError from nengo.params import Default, IntParam, Parameter from nengo.processes import Process from nengo.utils.compat import is_array_like from nengo.utils.stdlib i...
82
222
740
5
76
HugoChateauLaurent/nengo
nengo/node.py
Python
OutputParam
OutputParam
14
89
14
14
7b9ba1820b722f0b8d3426f245881dada78f3423
bigcode/the-stack
train
7f91dbe701d7586241b48b2f
train
class
class Node(NengoObject): """Provide non-neural inputs to Nengo objects and process outputs. Nodes can accept input, and perform arbitrary computations for the purpose of controlling a Nengo simulation. Nodes are typically not part of a brain model per se, but serve to summarize the assumptions bein...
class Node(NengoObject):
"""Provide non-neural inputs to Nengo objects and process outputs. Nodes can accept input, and perform arbitrary computations for the purpose of controlling a Nengo simulation. Nodes are typically not part of a brain model per se, but serve to summarize the assumptions being made about sensory ...
, x) if node.size_in > 0 else (t,) result, invoked = checked_call(output, *args) if not invoked: msg = ("output function '%s' is expected to accept exactly " "%d argument" % (output, len(args))) msg += (' (time, as a float)' if len(args) == 1 else ...
176
176
588
6
169
HugoChateauLaurent/nengo
nengo/node.py
Python
Node
Node
92
157
92
92
8579d2bd73767c5ed0ecabb46c3052f74478a278
bigcode/the-stack
train
667aeb36731ccb88627bbe04
train
function
def get_version(): """Return package version as listed in `__version__` in `init.py`.""" init_py = open(os.path.join(PACKAGE_NAME, '__init__.py')).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
def get_version():
"""Return package version as listed in `__version__` in `init.py`.""" init_py = open(os.path.join(PACKAGE_NAME, '__init__.py')).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
### base_path = os.path.abspath(os.path.dirname(__file__)) if LICENCE is None or LICENCE == '': raise RuntimeError("Licence must be provided !") if os.path.exists(os.path.join(base_path, 'LICENCE')): raise RuntimeError("Licence must be provided !") def get_version():
64
64
67
4
60
titu1994/PyCTakesParser
setup.py
Python
get_version
get_version
36
39
36
36
c957e41b3d785ad22b5e923331b159354bc5cfc4
bigcode/the-stack
train