text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: raven-97/glucose-prediction path: /linear_regr_prediction.py import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import linear_model from sklearn.metrics import mean_squared_error #%% LOAD DATA # Read the data files. ys1 = np.genfromtxt(fname='data/ys.csv', delimi...
code_fim
medium
{ "lang": "python", "repo": "raven-97/glucose-prediction", "path": "/linear_regr_prediction.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: naweel1496/PersonalBlog path: /blog/views.py from django.shortcuts import render from django.utils import timezone from .models import Post from django.views.generic import TemplateView <|fim_suffix|> def get(self, request, *args, **kwargs): return render(request, 'blog/post_list.h...
code_fim
easy
{ "lang": "python", "repo": "naweel1496/PersonalBlog", "path": "/blog/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get(self, request, *args, **kwargs): return render(request, 'blog/post_list.html', context=None) class Aboutme(TemplateView): template_name = "blog/about.html" class MyBlog(TemplateView): template_name = "blog/blog.html"<|fim_prefix|># repo: naweel1496/PersonalBlog path: /blog/v...
code_fim
easy
{ "lang": "python", "repo": "naweel1496/PersonalBlog", "path": "/blog/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def allow_relation(self, obj1, obj2, **hints): """ Allow relations if a model in the auth app is involved. """ return True def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the auth app only appears in the 'auth_db' ...
code_fim
medium
{ "lang": "python", "repo": "sterenczak-marek/awesomegame-common", "path": "/awesome_db_router/router.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Allow relations if a model in the auth app is involved. """ return True def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the auth app only appears in the 'auth_db' database. """ if app_label in ...
code_fim
medium
{ "lang": "python", "repo": "sterenczak-marek/awesomegame-common", "path": "/awesome_db_router/router.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sterenczak-marek/awesomegame-common path: /awesome_db_router/router.py class AwesomeGameRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label in ['awesome_users', 'awesome_rooms']: return 'common' return 'default' def db_for_write(sel...
code_fim
medium
{ "lang": "python", "repo": "sterenczak-marek/awesomegame-common", "path": "/awesome_db_router/router.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(df[['item_name', 'item_price']][df.quantity==1]) def create(df): mx = int(df['item_price'].max()) l = list(df['item_price']) t = [] r = [] for y in range(0, mx, 3): r.append(y) cur = 0 for x in range(len(l)): if l[x] >= float(y) and l[x] ...
code_fim
medium
{ "lang": "python", "repo": "uran001/Small_Projects", "path": "/Pandas_Analysis/chipotle.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: uran001/Small_Projects path: /Pandas_Analysis/chipotle.py import pandas as pd import matplotlib.pyplot as plt import numpy as np import time def imprt(in_file): df = pd.read_csv(in_file, sep='\t') print(df) return df def price_to_foat(l): for x in range(len(l)): l[x] ...
code_fim
medium
{ "lang": "python", "repo": "uran001/Small_Projects", "path": "/Pandas_Analysis/chipotle.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for x in range(len(l)): l[x] = float(l[x][1:]) return l def filt(df, price): print(df[df.item_price > price]) def filt_name(df): print(df[['item_name', 'item_price']][df.quantity==1]) def create(df): mx = int(df['item_price'].max()) l = list(df['item_price']) t = []...
code_fim
medium
{ "lang": "python", "repo": "uran001/Small_Projects", "path": "/Pandas_Analysis/chipotle.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rintln("Hello your name") println("Hello git")<|fim_prefix|># repo: na0sung/command_hello path: /hello.py // comment in local // comment add // add comment in github >>>>>>> origin/master println("<|fim_middle|>Hello World") println("Hellp Na Young sung") p
code_fim
easy
{ "lang": "python", "repo": "na0sung/command_hello", "path": "/hello.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: na0sung/command_hello path: /hello.py // comment in local // comment add // add comm<|fim_suffix|>Hello World") println("Hellp Na Young sung") println("Hello your name") println("Hello git")<|fim_middle|>ent in github >>>>>>> origin/master println("
code_fim
easy
{ "lang": "python", "repo": "na0sung/command_hello", "path": "/hello.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: daphnevandijk/masterthesis path: /models/LR occupation (subset data).py #!/usr/bin/env python # coding: utf-8 # In[1]: # Import the required libraries import pandas as pd import numpy as np from scipy import stats from sklearn.metrics import accuracy_score, classification_report, confusion_mat...
code_fim
hard
{ "lang": "python", "repo": "daphnevandijk/masterthesis", "path": "/models/LR occupation (subset data).py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # In[10]: # Implementing GridSearchCV GS = GridSearchCV(lr, parameters, cv = cv, verbose = 1, n_jobs = -1) GS.fit(X_train, y_train) # Fitting on training data # In[11]: print(GS.best_estimator_) # Estimator that was chosen by the search (which gave highest score) print(GS.best_score_) # Mean cross...
code_fim
hard
{ "lang": "python", "repo": "daphnevandijk/masterthesis", "path": "/models/LR occupation (subset data).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DaleEMoore/Kivy-Datagrid-plugin path: /kivy-fade-in-example.py #!/usr/bin/env python2 # From: http://codegist.net/search/kivy-datagrid/2 ''' Under WTFPL - http://www.wtfpl.net ''' import kivy kivy.require('1.0.7') from kivy.app import App from kivy.uix.button import Button from kivy.uix.label...
code_fim
hard
{ "lang": "python", "repo": "DaleEMoore/Kivy-Datagrid-plugin", "path": "/kivy-fade-in-example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.main_grid = GridLayout(rows=2, cols=1, padding=50) print("Needs ./Aliquam.ttf") self.main_label = lightLabel(text='Text example test', color=[1, 1, 1, 0.0], font_name='./Aliquam.ttf', font_size='30px') self.main_button = lightButton...
code_fim
hard
{ "lang": "python", "repo": "DaleEMoore/Kivy-Datagrid-plugin", "path": "/kivy-fade-in-example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fendouai/ikdb path: /ikdbtest_gl.py #Python 2/3 compatibility from __future__ import print_function,division,absolute_import from builtins import input,range from six import iteritems from ikdb import * from ikdb import functionfactory from klampt import * import pkg_resources if pkg_resources.g...
code_fim
hard
{ "lang": "python", "repo": "fendouai/ikdb", "path": "/ikdbtest_gl.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def click_world(self,x,y): """Helper: returns (obj,pt) where obj is the closest world object clicked, and pt is the associated clicked point (in world coordinates). If no point is clicked, returns None.""" #get the viewport ray if NEW_KLAMPT: (s,d) ...
code_fim
hard
{ "lang": "python", "repo": "fendouai/ikdb", "path": "/ikdbtest_gl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dragging = False if NEW_KLAMPT: retval = GLWidgetProgram.motionfunc(self,x,y,dx,dy) dragging = self.widgetPlugin.klamptwidgetdragging else: retval = GLWidgetProgram.motionfunc(self,x,y) dragging = self.draggingWidget if draggi...
code_fim
hard
{ "lang": "python", "repo": "fendouai/ikdb", "path": "/ikdbtest_gl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: domfarradj/project-1-domfarradj-main path: /project-1-domfarradj-main/skater.py #Project 1 # #Name: Dominic Farradj #Instructor: Workman #Section: 03 from funcs import * def main(): pounds=int(input('How much do you weigh (pounds)? ')) distance=float(input('How far away is your profes...
code_fim
hard
{ "lang": "python", "repo": "domfarradj/project-1-domfarradj-main", "path": "/project-1-domfarradj-main/skater.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if veloSkater >= 0.2 and veloSkater < 1.0: return veloSkater if veloSkater>= 1.0: print("Look out for that railing!!!") if __name__ == '__main__': main()<|fim_prefix|># repo: domfarradj/project-1-domfarradj-main path: /project-1-domfarradj-main/skater.py #Project 1 # ...
code_fim
hard
{ "lang": "python", "repo": "domfarradj/project-1-domfarradj-main", "path": "/project-1-domfarradj-main/skater.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> velObject=getVelocityObject(distance) veloSkater = getVelocitySkater(weight,mass,velObject) veloSkater=round(veloSkater, 3) print('Velocity of skater:', veloSkater, 'm/s') if veloSkater < 0.2: print("My grandmother skates faster than you!") if veloSkater >= 0.2 and veloSkater < 1.0:...
code_fim
hard
{ "lang": "python", "repo": "domfarradj/project-1-domfarradj-main", "path": "/project-1-domfarradj-main/skater.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class UserAssets(MethodView): def get(self): pass def post(self): pass class AssetRequest(MethodView): def get(self): pass def post(self): pass class Asset(MethodView): def get(self): pass def post(self): pass class Engag...
code_fim
hard
{ "lang": "python", "repo": "MetisProtocol/Metis-MVP", "path": "/metis/API/view.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MetisProtocol/Metis-MVP path: /metis/API/view.py # _*_ coding: utf-8 _*_ """ @author: E.T @file: api.py @time: 2020/5/27 2:47 下午 @desc: """ from . import impl from flask import request, Blueprint from flask.views import MethodView from metis.utils.helpers import api_stand_response, register_view...
code_fim
hard
{ "lang": "python", "repo": "MetisProtocol/Metis-MVP", "path": "/metis/API/view.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pass class StakeTerminate(MethodView): def get(self): pass def post(self): pass class StakeWithdraw(MethodView): def get(self): pass def post(self): pass class StakeDispute(MethodView): def get(self): pass def post(self): ...
code_fim
hard
{ "lang": "python", "repo": "MetisProtocol/Metis-MVP", "path": "/metis/API/view.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nerd911/University path: /Sztuczna_Inteligencja/Lista3/zad5.py import sys def V(i,j): return 'V%d_%d' % (i,j) def domains(Vs): return [ q + ' in 1..9' for q in Vs ] def all_different(Qs): return 'all_distinct([' + ', '.join(Qs) + '])' def get_column(j): return [V(i,j) for i i...
code_fim
medium
{ "lang": "python", "repo": "Nerd911/University", "path": "/Sztuczna_Inteligencja/Lista3/zad5.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cs = domains(variables) + vertical() + horizontal() + area() for i,j,val in assigments: cs.append( '%s #= %d' % (V(i,j), val) ) print_constraints(cs, 4, 70), print print ' labeling([ff], [' + ', '.join(variables) + ']).' print print ":- tell('prolog_result.txt'), ...
code_fim
medium
{ "lang": "python", "repo": "Nerd911/University", "path": "/Sztuczna_Inteligencja/Lista3/zad5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: idmakers/YOLOV3_MOT15 path: /video_result.py # coding: utf-8 from __future__ import division, print_function import tensorflow as tf import numpy as np import argparse import cv2 import time import os from utils.misc_utils import parse_anchors, read_class_names from utils.nms_utils...
code_fim
hard
{ "lang": "python", "repo": "idmakers/YOLOV3_MOT15", "path": "/video_result.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> saver = tf.train.Saver() saver.restore(sess, args.restore_path) #fp = open("filename.txt", "w") for frame in range((video_frame_cnt)): ret, img_ori = vid.read() if args.letterbox_resize: img, resize_r...
code_fim
hard
{ "lang": "python", "repo": "idmakers/YOLOV3_MOT15", "path": "/video_result.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PanTomRastr/103_PANKRATOV path: /hw5/task1/klava.py from klava_logic import simulator your_bag = 11 time_one = 17 time = 90 simuls = 1000 resu<|fim_suffix|> = simulator(time_one, time, your_bag) result += result_s if result_s == "S": chance_K += 1 print(result + '\n',...
code_fim
medium
{ "lang": "python", "repo": "PanTomRastr/103_PANKRATOV", "path": "/hw5/task1/klava.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ance_K += 1 print(result + '\n', 'Вероятность встретить Константина: ', (chance_K / simuls))<|fim_prefix|># repo: PanTomRastr/103_PANKRATOV path: /hw5/task1/klava.py from klava_logic import simulator your_bag = 11 time_one = 17 time = 90 simuls = 1000 result = '' chance_K = 0 result_s ...
code_fim
medium
{ "lang": "python", "repo": "PanTomRastr/103_PANKRATOV", "path": "/hw5/task1/klava.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>conn3= mysql.connector.connect(host='localhost',username='Your Username',password='Your Password',database='new_database') myc2=conn3.cursor() query3='SELECT * FROM Students' myc2.execute(query3) print(myc2.fetchall()) # for i in myc2: # print(i) conn3.commit() conn3.close()<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "akshat12000/Python-Run-And-Learn-Series", "path": "/Codes/188) database_connectivity.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: akshat12000/Python-Run-And-Learn-Series path: /Codes/188) database_connectivity.py import mysql.connector conn= mysql.connector.connect(host='localhost',username='Your Username',password='Your Password') print(conn) # this is the object of the connector my_cursor=conn.cursor() # this wil...
code_fim
hard
{ "lang": "python", "repo": "akshat12000/Python-Run-And-Learn-Series", "path": "/Codes/188) database_connectivity.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: parthth/helpMe path: /helpMe/admin.py from django.contrib import admin from hel<|fim_suffix|>er(User) admin.site.register(User_profile)<|fim_middle|>pMe.models import User,User_profile # Register your models here. admin.site.regist
code_fim
medium
{ "lang": "python", "repo": "parthth/helpMe", "path": "/helpMe/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ister your models here. admin.site.register(User) admin.site.register(User_profile)<|fim_prefix|># repo: parthth/helpMe path: /helpMe/admin.py from django.contrib import admin from hel<|fim_middle|>pMe.models import User,User_profile # Reg
code_fim
easy
{ "lang": "python", "repo": "parthth/helpMe", "path": "/helpMe/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ provides for the inclusion of setting variables within a template. """ return getattr(settings, name, "")<|fim_prefix|># repo: MiddleFork/django_backstage path: /backstage/templatetags/settings_tags.py """ settings_tags.py This file provides a simple Django Templatetag to expose the app's set...
code_fim
medium
{ "lang": "python", "repo": "MiddleFork/django_backstage", "path": "/backstage/templatetags/settings_tags.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MiddleFork/django_backstage path: /backstage/templatetags/settings_tags.py """ settings_tags.py This file provides a simple Django Templatetag to expose the app's settings values in the HTML template environment. Settings are stored as 'csettings' to avoid a name conflict and accesses as {{ cse...
code_fim
medium
{ "lang": "python", "repo": "MiddleFork/django_backstage", "path": "/backstage/templatetags/settings_tags.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JohnArneOye/it3708-subsym3 path: /izhikevich_neuron.py from Individual import Individual import random import data_loader class Izzy(Individual): nr_of_bits = 66 t = 10.0 I = 10.0 threshold = 35 def __init__(self, genotype=None): if genotype is None: ...
code_fim
hard
{ "lang": "python", "repo": "JohnArneOye/it3708-subsym3", "path": "/izhikevich_neuron.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> genotypes = (self.num_to_bitstring(self.genotype), self.num_to_bitstring(other.genotype)) new_genotype = [] index = 0 for individual, n_genes in splits: to_index = min(index+n_genes, self.nr_of_bits) new_genotype....
code_fim
hard
{ "lang": "python", "repo": "JohnArneOye/it3708-subsym3", "path": "/izhikevich_neuron.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nuke.execute(ct, frame, frame) gen = nukescripts.snap3d.selectedPoints() points = [point for point in gen] avgLen = int(len(points)/2) x = 0; y = 0; z = 0 for i in range(avgLen): x += points[i][0] y += points[i][1] z += points[i][2] x /= avgL...
code_fim
hard
{ "lang": "python", "repo": "zeemzoet/nuke", "path": "/s_PointsToCornerPin/dev/get_Anim_OnePoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zeemzoet/nuke path: /s_PointsToCornerPin/dev/get_Anim_OnePoint.py import nukescripts axis = 1 nuke.thisNode()['code'].execute() _input = checkInput() if _input['cam'] and _input['geo']: ### checks how many vertices are selected i = 0 for vertex in nukescripts.snap3d.selectedPoints(): ...
code_fim
hard
{ "lang": "python", "repo": "zeemzoet/nuke", "path": "/s_PointsToCornerPin/dev/get_Anim_OnePoint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> nuke.toNode('xPt%d' %axis)['translate'].setAnimated() nuke.toNode('xPt%d' %axis)['translate'].setValueAt(x, frame,0) nuke.toNode('xPt%d' %axis)['translate'].setValueAt(y, frame,1) nuke.toNode('xPt%d' %axis)['translate'].setValueAt(z, frame,2) pB.setProgress(int((frame-first)*100/l...
code_fim
medium
{ "lang": "python", "repo": "zeemzoet/nuke", "path": "/s_PointsToCornerPin/dev/get_Anim_OnePoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Singh-Rishabh/crypto_pals path: /set2/q12.py from hashlib import md5 from base64 import b64decode from base64 import b64encode from Crypto.Cipher import AES from copy import deepcopy from os import urandom from random import randint def padding(block_size,s): tmp = len(s)%block_size if (tmp ==...
code_fim
hard
{ "lang": "python", "repo": "Singh-Rishabh/crypto_pals", "path": "/set2/q12.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> postfix = '''Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK''' postfix = postfix.decode('base64') blocksize = detect_block_size() dict_1_block_cipher = create_dict(bl...
code_fim
hard
{ "lang": "python", "repo": "Singh-Rishabh/crypto_pals", "path": "/set2/q12.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def rand_AES_KEY(block_size): return urandom(block_size) def encrypt_ecb(key,m): tmp = len(key) m = padding(tmp,m) cipher_text = "" ecb_obj = AES.new(key, AES.MODE_ECB) for i in range(0,len(m),tmp): substr = m[i:i+tmp] cipher_text = cipher_text + ecb_obj.encrypt(substr) return cipher_text d...
code_fim
hard
{ "lang": "python", "repo": "Singh-Rishabh/crypto_pals", "path": "/set2/q12.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dgarg3/spar1 path: /delta-test.py from pyspark.sql import SparkSession from pyspark.sql import functions as func from delta.tables import * #Added config so we can post spark packages spark = SparkSession.builder\ .master('local')\ .appName('delta-test')\ .conf...
code_fim
hard
{ "lang": "python", "repo": "dgarg3/spar1", "path": "/delta-test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#df2.show() ##Load data frame in to delta table delta_df2 = DeltaTable.forPath(spark,"/mac/python/spar1/tp") print(delta_df2.toDF())<|fim_prefix|># repo: dgarg3/spar1 path: /delta-test.py from pyspark.sql import SparkSession from pyspark.sql import functions as func from delta.tables import * #Added conf...
code_fim
hard
{ "lang": "python", "repo": "dgarg3/spar1", "path": "/delta-test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: qingqingxu2020/gameanalysis path: /test/test_matgame.py """Test matrix game""" import itertools import json import random import numpy as np import numpy.random as rand import pytest from gameanalysis import gamegen from gameanalysis import matgame from gameanalysis import paygame from gameanal...
code_fim
hard
{ "lang": "python", "repo": "qingqingxu2020/gameanalysis", "path": "/test/test_matgame.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Test repr""" matg = matgame.matgame(rand.random((2, 1))) assert repr(matg) == "MatrixGame([2])" matg = matgame.matgame(rand.random((2, 3, 2))) assert repr(matg) == "MatrixGame([2 3])" @pytest.mark.parametrize( "players,strats", [ (1, [2, 2]), (2, 2), ...
code_fim
hard
{ "lang": "python", "repo": "qingqingxu2020/gameanalysis", "path": "/test/test_matgame.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("_", range(20)) def test_random_serialize_copy_role_lengths(_): """Test serialization copy""" num_roles = random.randint(2, 3) roles = random_names(num_roles) strats = tuple(random_names(random.randint(2, 3)) for _ in range(num_roles)) players = [random.randin...
code_fim
hard
{ "lang": "python", "repo": "qingqingxu2020/gameanalysis", "path": "/test/test_matgame.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Astrosysman/lessons_of_python path: /4_script_romb_2.py #!/usr/bin/env python3 <|fim_suffix|>my_range = list(range(limit, 1, -1)) + list(range(1, limit + 1)) for i in my_range: print (' ' * i + '*' * ( limit - i ) * 2 + ' ' * i )<|fim_middle|>limit = 10
code_fim
easy
{ "lang": "python", "repo": "Astrosysman/lessons_of_python", "path": "/4_script_romb_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>my_range = list(range(limit, 1, -1)) + list(range(1, limit + 1)) for i in my_range: print (' ' * i + '*' * ( limit - i ) * 2 + ' ' * i )<|fim_prefix|># repo: Astrosysman/lessons_of_python path: /4_script_romb_2.py #!/usr/bin/env python3 <|fim_middle|>limit = 10
code_fim
easy
{ "lang": "python", "repo": "Astrosysman/lessons_of_python", "path": "/4_script_romb_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(Efficientnet_b0, self).__init__() self.efficientnet_b0 = EfficientNet.from_name("efficientnet-b7", in_channels=1, num_classes=2) def forward(self, x): return self.efficientnet_b0(x)<|fim_prefix|># repo: MLAndDP/pytorchStudy path: /models/EfficientNet.py from efficientne...
code_fim
medium
{ "lang": "python", "repo": "MLAndDP/pytorchStudy", "path": "/models/EfficientNet.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MLAndDP/pytorchStudy path: /models/EfficientNet.py from efficientnet_pytorch import EfficientNet from models.BasicModule import BasicModule efficientnet_b1 = EfficientNet.from_name("efficientnet-b1") efficientnet_b2 = EfficientNet.from_name("efficientnet-b2") efficientnet_b3 = EfficientNet.from...
code_fim
medium
{ "lang": "python", "repo": "MLAndDP/pytorchStudy", "path": "/models/EfficientNet.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super(Efficientnet_b0, self).__init__() self.efficientnet_b0 = EfficientNet.from_name("efficientnet-b7", in_channels=1, num_classes=2) def forward(self, x): return self.efficientnet_b0(x)<|fim_prefix|># repo: MLAndDP/pytorchStudy path: /models/Efficien...
code_fim
medium
{ "lang": "python", "repo": "MLAndDP/pytorchStudy", "path": "/models/EfficientNet.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: syzhang092218-source/panda-grasp path: /panda_grasp/env.py space is the end-effector's normalized velocity self.action_space = spaces.Box( low=np.array([-1., -1., -1.]), high=np.array([1., 1., 1.]), dtype=np.float64 ) # observation spa...
code_fim
hard
{ "lang": "python", "repo": "syzhang092218-source/panda-grasp", "path": "/panda_grasp/env.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def return_state(self): return_state = np.concatenate( [self.panda.state['ee_position'], self.panda.state['joint_position'][0:7], self.panda.state['joint_velocity'][0:7], self.panda.state['joint_torque'][0:7], self.obj.get_positio...
code_fim
hard
{ "lang": "python", "repo": "syzhang092218-source/panda-grasp", "path": "/panda_grasp/env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> reward, done = self.calculate_reward(next_state, action_real) return return_state, reward, done, info def teleop_step(self): """ use keyboard to control the robot :return: state, action, reward, next_state, done, info """ # get current state ...
code_fim
hard
{ "lang": "python", "repo": "syzhang092218-source/panda-grasp", "path": "/panda_grasp/env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Old-style classes do no inherit from the Python 'object', therefore the attributes of 'object' won't be found""" obj = OldClass(11) print(dir(obj)) # ['__doc__', '__init__', '__module__', 'number'] # Why isn't __class__ seen by dir()? I don't know but it exists print(obj.__class__) ...
code_fim
hard
{ "lang": "python", "repo": "tpt5cu/python-tutorial", "path": "/language/python_27/built_in_functions/dir_py.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def say_hello(self): print("Hello my name is " + self.name) def inspect_oldclass_instance(): """Old-style classes do no inherit from the Python 'object', therefore the attributes of 'object' won't be found""" obj = OldClass(11) print(dir(obj)) # ['__doc__', '__init__', '__module_...
code_fim
hard
{ "lang": "python", "repo": "tpt5cu/python-tutorial", "path": "/language/python_27/built_in_functions/dir_py.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tpt5cu/python-tutorial path: /language/python_27/built_in_functions/dir_py.py # https://docs.python.org/2.7/library/functions.html#dir """ dir() is more of a convenience function than a rigorously defined object inspector function. It does slightly different things depending on the type of the ...
code_fim
hard
{ "lang": "python", "repo": "tpt5cu/python-tutorial", "path": "/language/python_27/built_in_functions/dir_py.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> g.addEdge("V1", "V2", "E1"); g.addEdge("V1", "V3", "E2"); g.addEdge("V1", "V4", "E3"); g.addEdge("V2", "V5", "E4"); g.addEdge("V5", "V6", "E5"); g.addEdge("V3", "V6", "E6"); g.addEdge("V4", "V6", "E7"); g.addEdge("V6", "V7", "E8"); # obj.topologicalSortUsi...
code_fim
hard
{ "lang": "python", "repo": "dushyantsapra/Algorithms", "path": "/org/ds/graph/TopologicalSort.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dushyantsapra/Algorithms path: /org/ds/graph/TopologicalSort.py ''' Created on Sep 27, 2016 @author: Dushyant sapra ''' from org.ds.graph.DirectedGraph import DirectedGraph from org.ds.graph.common.DFSApplicationUtil import DFSApplicationUtil from org.ds.stack.Stack import StackUsingLinkedList ...
code_fim
hard
{ "lang": "python", "repo": "dushyantsapra/Algorithms", "path": "/org/ds/graph/TopologicalSort.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tadasant/strand-api path: /tests/func/users/test_create_user_with_teams.py import pytest from django.core import mail from tests.resources.MutationGenerator import MutationGenerator class TestCreateUserWithTeams: # TODO: Break out creating users as superuser vs anonymous user after v0.3 ...
code_fim
hard
{ "lang": "python", "repo": "tadasant/strand-api", "path": "/tests/func/users/test_create_user_with_teams.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert not mail.outbox team = team_factory() user = user_factory.build() mutation = MutationGenerator.create_user_with_teams(email=user.email, username=user.username, team_ids=[team.id]) response = superus...
code_fim
hard
{ "lang": "python", "repo": "tadasant/strand-api", "path": "/tests/func/users/test_create_user_with_teams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert response.status_code == 200, response.content assert response.json()['data']['createUserWithTeams']['user']['email'] assert response.json()['data']['createUserWithTeams']['user']['teams'][0]['name'] == team.name assert mail.outbox[0].subject == 'Welcome to Strand' ...
code_fim
hard
{ "lang": "python", "repo": "tadasant/strand-api", "path": "/tests/func/users/test_create_user_with_teams.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i = 1 while i < len(l) and l[i] > l[i-1]: i += 1 if i == len(l): return True else: return False l = [1,1, 4, 10, 12, 17] print(je_li_rastuca(l)) print(je_li_rastuca2(l))<|fim_prefix|># repo: AzraHa/Python-assignments path: /Lists/Laboratory exercises/Z2.py def j...
code_fim
easy
{ "lang": "python", "repo": "AzraHa/Python-assignments", "path": "/Lists/Laboratory exercises/Z2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>l = [1,1, 4, 10, 12, 17] print(je_li_rastuca(l)) print(je_li_rastuca2(l))<|fim_prefix|># repo: AzraHa/Python-assignments path: /Lists/Laboratory exercises/Z2.py def je_li_rastuca2(l): for i in range(len(l)-1): if l[i] >= l[i+1]: return False return True <|fim_middle|> def je...
code_fim
medium
{ "lang": "python", "repo": "AzraHa/Python-assignments", "path": "/Lists/Laboratory exercises/Z2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AzraHa/Python-assignments path: /Lists/Laboratory exercises/Z2.py def je_li_rastuca2(l): for i in range(len(l)-1): if l[i] >= l[i+1]: return False return True <|fim_suffix|> i = 1 while i < len(l) and l[i] > l[i-1]: i += 1 if i == len(l): r...
code_fim
easy
{ "lang": "python", "repo": "AzraHa/Python-assignments", "path": "/Lists/Laboratory exercises/Z2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> async def test_acquire(self): proxies = {str(p) for p in self.proxy_collection.proxies} res = await self.brokerage.acquire(REQUEST_URL_A, [], 10.0) self.assertEqual(res['broker'], "www.google.com") self.assertIn(res['proxy'], proxies) del res['proxy'] ...
code_fim
hard
{ "lang": "python", "repo": "jbn/mimic", "path": "/test/test_brokerage.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbn/mimic path: /test/test_brokerage.py import asyncio import asynctest from mimic.brokerage import * from mimic.proxy_collection import * REQUEST_URL_A = 'http://www.google.com/search' <|fim_suffix|> res = await self.brokerage.acquire(REQUEST_URL_A, [], 10.0) self.assertEqual(...
code_fim
hard
{ "lang": "python", "repo": "jbn/mimic", "path": "/test/test_brokerage.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> res = await self.brokerage.acquire(REQUEST_URL_A, [], 10.0) self.assertEqual(res['broker'], "www.google.com") del res['proxy']<|fim_prefix|># repo: jbn/mimic path: /test/test_brokerage.py import asyncio import asynctest from mimic.brokerage import * from mimic.proxy_collection imp...
code_fim
hard
{ "lang": "python", "repo": "jbn/mimic", "path": "/test/test_brokerage.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>", img) cv2.imshow("Me gray", gray) cv2.waitKey(0) cv2.destroyAllWindows()<|fim_prefix|># repo: samp42/opencv_learning path: /gray.py import cv2 print("OpenCV version: ", cv2.__version__) img = cv2.imread("i<|fim_middle|>mg/me.jpg") img = cv2.resize(img, (int(img.shape[1]/2),int(img.shape[0]/2))) gray =...
code_fim
medium
{ "lang": "python", "repo": "samp42/opencv_learning", "path": "/gray.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: samp42/opencv_learning path: /gray.py import cv2 print("OpenCV version: ", cv2.__version__) img = cv2.imread("img/me.jpg") img = cv2.resize(img, (int(img.shape[1]/2),int(img.shape[0]/2)<|fim_suffix|>", img) cv2.imshow("Me gray", gray) cv2.waitKey(0) cv2.destroyAllWindows()<|fim_middle|>)) gray =...
code_fim
medium
{ "lang": "python", "repo": "samp42/opencv_learning", "path": "/gray.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Krishnamurtyp/Learning-Management-System-1 path: /accounts/models.py from django.db import models from django.conf import settings from django.contrib.auth.models import AbstractUser from django.core.urlresolvers import reverse # Create your models here. class User(AbstractUser): <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "Krishnamurtyp/Learning-Management-System-1", "path": "/accounts/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> permissions = ( ('create_lms_admin', 'Create LMS Admin'), ('create_instructor', 'Create Instructor'), ('create_teaching_assistant', 'Create Teaching Assistant'), ('create_student', 'Create Student'), )<|fim_prefix|># repo: Krishnamurtyp/Learn...
code_fim
medium
{ "lang": "python", "repo": "Krishnamurtyp/Learning-Management-System-1", "path": "/accounts/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = router.urls<|fim_prefix|># repo: Teddybear45/BetaCoursePlatform path: /CoursePlatformProject/Instructors/urls.py from rest_framework import routers from .api import InstructorViewSet <|fim_middle|>router = routers.DefaultRouter() router.register('api/Instructors', InstructorViewSet, 'Instr...
code_fim
medium
{ "lang": "python", "repo": "Teddybear45/BetaCoursePlatform", "path": "/CoursePlatformProject/Instructors/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Teddybear45/BetaCoursePlatform path: /CoursePlatformProject/Instructors/urls.py from rest_framework import routers from .api import InstructorViewSet <|fim_suffix|>urlpatterns = router.urls<|fim_middle|>router = routers.DefaultRouter() router.register('api/Instructors', InstructorViewSet, 'Instr...
code_fim
medium
{ "lang": "python", "repo": "Teddybear45/BetaCoursePlatform", "path": "/CoursePlatformProject/Instructors/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(): print(edit_distance("HelloWorld", "Halloworld")) print(edit_distance("AGCCT", "ATCT")) if __name__=="__main__": main()<|fim_prefix|># repo: Lorne0/ADLxMLDS2017 path: /hw1/RNN/edit_distance.py import numpy as np def edit_distance(a, b): m, n = len(a), len(b) D = np.zeros(...
code_fim
medium
{ "lang": "python", "repo": "Lorne0/ADLxMLDS2017", "path": "/hw1/RNN/edit_distance.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lorne0/ADLxMLDS2017 path: /hw1/RNN/edit_distance.py import numpy as np def edit_distance(a, b): m, n = len(a), len(b) D = np.zeros((m+1,n+1), dtype=np.int32) for i in range(m+1): D[i][0]=i for j in range(n+1): D[0][j]=j for i in range(1, m+1): for j ...
code_fim
medium
{ "lang": "python", "repo": "Lorne0/ADLxMLDS2017", "path": "/hw1/RNN/edit_distance.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(edit_distance("HelloWorld", "Halloworld")) print(edit_distance("AGCCT", "ATCT")) if __name__=="__main__": main()<|fim_prefix|># repo: Lorne0/ADLxMLDS2017 path: /hw1/RNN/edit_distance.py import numpy as np def edit_distance(a, b): m, n = len(a), len(b) D = np.zeros((m+1,n+1), d...
code_fim
medium
{ "lang": "python", "repo": "Lorne0/ADLxMLDS2017", "path": "/hw1/RNN/edit_distance.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Create a homogenous maps for the two domains domains = [mesh.gridCC[actv, 0] < 0, mesh.gridCC[actv, 0] >= 0] homogMap = maps.SurjectUnits(domains) # Create a wire map for a second model space, voxel based wires = maps.Wires(("homo", len(domains)), ("hetero", nC)) # Create Sum m...
code_fim
hard
{ "lang": "python", "repo": "simpeg/simpeg", "path": "/examples/01-maps/plot_sumMap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (user.name, user.discriminator) == (member_name, member_discriminator): await ctx.guild.unban(user) await ctx.send(f'Bani acildi {user.mention}') return<|fim_prefix|># repo: baranertemir/discord.py-hazir-kodlar path: /yasak_kaldir.py @client.command() @comma...
code_fim
medium
{ "lang": "python", "repo": "baranertemir/discord.py-hazir-kodlar", "path": "/yasak_kaldir.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: baranertemir/discord.py-hazir-kodlar path: /yasak_kaldir.py @client.command() @commands.has_permissions(administrator = True) async def bankaldir(ctx, *, member): banned_users = await ctx.guild.bans() member_name, member_discriminator = member.split("#") <|fim_suffix|> if (user.na...
code_fim
medium
{ "lang": "python", "repo": "baranertemir/discord.py-hazir-kodlar", "path": "/yasak_kaldir.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rukisama/arcturus_2019 path: /camera.py from typing import Tuple, Union class Camera: def __init__(self, x: int, y: int, width: int, height: int) -> None: self.x = x self.y = y self.width = width self.height = height self.x2 = self.x + self.width ...
code_fim
hard
{ "lang": "python", "repo": "rukisama/arcturus_2019", "path": "/camera.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x, y = x - self.x, y - self.y if x < 0 or y < 0 or x >= self.width or y >= self.height: return None, None return x, y<|fim_prefix|># repo: rukisama/arcturus_2019 path: /camera.py from typing import Tuple, Union class Camera: def __init__(self, x: int, y: int, w...
code_fim
hard
{ "lang": "python", "repo": "rukisama/arcturus_2019", "path": "/camera.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sw-Saturn/WelICing path: /course_admin/distance_admin.py #! Python 3.7.1 # 2018/12/29 # 開発担当者 川本孝太朗 # WelIcingの距離の管理 import sqlite3 from contextlib import closing import requests import re # ------------------------------------------------------------------------------------- # この形式だとデータベースはすっ...
code_fim
hard
{ "lang": "python", "repo": "Sw-Saturn/WelICing", "path": "/course_admin/distance_admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def delete_data(dbname, table_name, idnum): with closing(sqlite3.connect(dbname)) as connection: cursor = connection.cursor() sql = 'delete from ? where idnum = ? ' data = (table_name, idnum) cursor.execute(sql, data) connection.commit() connection.clos...
code_fim
hard
{ "lang": "python", "repo": "Sw-Saturn/WelICing", "path": "/course_admin/distance_admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eureka-me/git path: /ch2/p38.py #! env python # -*- coding: utf-8 -*- # Date: 2017/09/16 # Filename: p38 <|fim_suffix|>import pymc as pm lambda_1 = pm.Exponential("lambda_1", 1) lambda_2 = pm.Exponential("lambda_2", 1) tau = pm.DiscreteUniform("tau", lower=0, upper=10) print(type(lambda_1)) ...
code_fim
medium
{ "lang": "python", "repo": "eureka-me/git", "path": "/ch2/p38.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>lambda_1 = pm.Exponential("lambda_1", 1) lambda_2 = pm.Exponential("lambda_2", 1) tau = pm.DiscreteUniform("tau", lower=0, upper=10) print(type(lambda_1)) # <class 'pymc.distributions.Exponential'> print(type(lambda_2)) # <class 'pymc.distributions.Exponential'> print(type(lambda_1+lambda_2)) # <class...
code_fim
medium
{ "lang": "python", "repo": "eureka-me/git", "path": "/ch2/p38.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vuamitom/Code-Exercises path: /aichallenge/question_answer/preprocess.py = q['title'] # while len(tokenizer.tokenize(chosen + ' . ' + sentences[idx][1])) < MAX_SEQ_LENGTH: # chosen = chosen + ' . ' + sentences[idx][1] # idx += ...
code_fim
hard
{ "lang": "python", "repo": "vuamitom/Code-Exercises", "path": "/aichallenge/question_answer/preprocess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def get_mask_names(): m = dict() with open('./data/names.csv', 'r') as f: reader = csv.reader(f, delimiter='\t') for r in reader: # print(r) name, a = r # if a.strip() is not None: if a is not None and not a.strip() == '': ...
code_fim
hard
{ "lang": "python", "repo": "vuamitom/Code-Exercises", "path": "/aichallenge/question_answer/preprocess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vuamitom/Code-Exercises path: /aichallenge/question_answer/preprocess.py relcount = sum([1 if v[0] > 0 else 0 for v in sentences]) delta = sentences[0][0] - sentences[1][0] if relcount == 1: ...
code_fim
hard
{ "lang": "python", "repo": "vuamitom/Code-Exercises", "path": "/aichallenge/question_answer/preprocess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': import random list = [4, 1, 8, 5, 3, 7] nums = [random.randint(0, 1000) for i in range(10)] print(cocktail_list(nums))<|fim_prefix|># repo: kazuhiko1979/algo path: /7_cocktail_sort/main.py # cock_tail sort from typing import List def cocktail_list(numbers: Li...
code_fim
hard
{ "lang": "python", "repo": "kazuhiko1979/algo", "path": "/7_cocktail_sort/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kazuhiko1979/algo path: /7_cocktail_sort/main.py # cock_tail sort from typing import List def cocktail_list(numbers: List[int]) -> List[int]: len_numbers = len(numbers) swapped = True start = 0 end = len_numbers - 1 while swapped: swapped = False for i in ra...
code_fim
hard
{ "lang": "python", "repo": "kazuhiko1979/algo", "path": "/7_cocktail_sort/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> price_total = 0.0 for d in self.lines: price_total += d.subtotal self.price_total = price_total class OrderLine(models.Model): u'''销售订单明细''' _name = 'sales.order.line' sales_order = fields.Many2one('sales.order', u'订单', index=True, required=True, ond...
code_fim
hard
{ "lang": "python", "repo": "oldrev/odoodev-demo-2014", "path": "/sales/sales.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = fields.Char(u'单号', required=True) customer = fields.Many2one('sales.customer', u'客户', required=True) order_time = fields.Datetime(u'下单时间', required=True, default=fields.Datetime.now()) lines = fields.One2many('sales.order.line', 'sales_order', u'订单明细') price_total = fields.Float...
code_fim
medium
{ "lang": "python", "repo": "oldrev/odoodev-demo-2014", "path": "/sales/sales.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oldrev/odoodev-demo-2014 path: /sales/sales.py # encoding: utf-8 from datetime import timedelta from datetime import date, datetime from openerp import models, fields, api, _ from openerp.tools import cache from openerp.exceptions import Warning from openerp.tools import DEFAULT_SERVER_DATE_FOR...
code_fim
hard
{ "lang": "python", "repo": "oldrev/odoodev-demo-2014", "path": "/sales/sales.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># def valuesGreaterThanSecond(list): # i = 0 # count = 0 # arr = [] # while i < len(list): # if(list[i] > list[1]): # count = count + 1 # arr.append(list[i]) # i = i + 1 # print(count) # return arr # print(valuesGreaterThanSecond([5,2,3,2,1,4])) # def thisLengthThatValue(l...
code_fim
hard
{ "lang": "python", "repo": "troubleshoot/python_stack", "path": "/Python/Python_Fundamentals/Functions_Basic_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: troubleshoot/python_stack path: /Python/Python_Fundamentals/Functions_Basic_2.py # def countdown(x): # while x >= 0: # print(x) # x = x - 1 # countdown(5) <|fim_suffix|># def valuesGreaterThanSecond(list): # i = 0 # count = 0 # arr = [] # while i < len(list): # if(list[i] >...
code_fim
hard
{ "lang": "python", "repo": "troubleshoot/python_stack", "path": "/Python/Python_Fundamentals/Functions_Basic_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>coinnum += n // coin n %= coin print(coinnum)<|fim_prefix|># repo: dev-saem/algorism path: /algorism/4day/01.py # 01. 세금징수(그리디) t = int(input()) for i in range(t): n = int(input()) coins = [50000, 10000, 5000, 1000, <|fim_middle|>500, 100] coinnum = 0 for coin in coins: ...
code_fim
easy
{ "lang": "python", "repo": "dev-saem/algorism", "path": "/algorism/4day/01.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }