text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> operations = [ migrations.AddField( model_name='eab_request', name='rw_or_ro', field=models.CharField(choices=[('RW', 'Read/Write'), ('RO', 'Read Only')], default='RO', max_length=2, verbose_name='Write Permissions'), ), ]<|fim_prefix|># repo: di...
code_fim
medium
{ "lang": "python", "repo": "diarmuidclarke/cetus", "path": "/cetusSite/cetus3pur/migrations/0009_eab_request_rw_or_ro.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Blog render_template = "blog.htm" cache = False<|fim_prefix|># repo: dhirajberi/django-cms path: /myproject/cms_plugins.py from myproject.models import Blog from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin f...
code_fim
medium
{ "lang": "python", "repo": "dhirajberi/django-cms", "path": "/myproject/cms_plugins.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhirajberi/django-cms path: /myproject/cms_plugins.py from myproject.models import Blog from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from django.utils.translation import gettext_lazy as _ from .models import Blog <...
code_fim
medium
{ "lang": "python", "repo": "dhirajberi/django-cms", "path": "/myproject/cms_plugins.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahmoud-elzorkany/Room-Presence-detection path: /detection/migrations/0003_auto_20181109_1222.py # Generated by Django 2.1.3 on 2018-11-09 12:22 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('detection', '0002_auto_20181109_1209'), ] operations =...
code_fim
medium
{ "lang": "python", "repo": "mahmoud-elzorkany/Room-Presence-detection", "path": "/detection/migrations/0003_auto_20181109_1222.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('detection', '0002_auto_20181109_1209'), ] operations = [ migrations.RemoveField( model_name='record', name='room', ), migrations.AlterField( model_name='room', name='name', field=mod...
code_fim
medium
{ "lang": "python", "repo": "mahmoud-elzorkany/Room-Presence-detection", "path": "/detection/migrations/0003_auto_20181109_1222.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('title', 'description', 'completed') # add this # Register your models here. admin.site.register(AlertCoin, AlertCoinAdmin) # add this<|fim_prefix|># repo: nattaphonBu/nat_alert_coin path: /backend/alert_coin/admin.py from django.contrib import admin from .models import AlertCoin # add...
code_fim
easy
{ "lang": "python", "repo": "nattaphonBu/nat_alert_coin", "path": "/backend/alert_coin/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nattaphonBu/nat_alert_coin path: /backend/alert_coin/admin.py from django.contrib import admin from .models import AlertCoin # add this <|fim_suffix|># Register your models here. admin.site.register(AlertCoin, AlertCoinAdmin) # add this<|fim_middle|>class AlertCoinAdmin(admin.ModelAdmin): # add...
code_fim
medium
{ "lang": "python", "repo": "nattaphonBu/nat_alert_coin", "path": "/backend/alert_coin/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e_duplicates(names): for duplicates in names: if duplicates not in new_names: new_names.append(duplicates) return new_names print(remove_duplicates(names))<|fim_prefix|># repo: angelocesar1/htx-immersive-08-2019 path: /02-week/4-friday/labs/angelo/coding-challenge-1.py # Usin...
code_fim
medium
{ "lang": "python", "repo": "angelocesar1/htx-immersive-08-2019", "path": "/02-week/4-friday/labs/angelo/coding-challenge-1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: angelocesar1/htx-immersive-08-2019 path: /02-week/4-friday/labs/angelo/coding-challenge-1.py # Using a function check the list for duplicate names. Create a new list by removing the duplicates. names = ['Alex', 'John', 'Mary', 'Steve', 'John', 'Steve'] new_names = [] def remov<|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "angelocesar1/htx-immersive-08-2019", "path": "/02-week/4-friday/labs/angelo/coding-challenge-1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def create_ssl_site(site_name = 'example'): ssl_dir = '/etc/nginx/ssl' with settings(warn_only=True): if run("test -d %s" % ssl_dir).failed: sudo('mkdir %s' % ssl_dir) with cd(ssl_dir): sudo ('openssl genrsa -des3 -out '+site_name+'.key 1024') sudo ('sudo ...
code_fim
hard
{ "lang": "python", "repo": "rzaytsev/server-setup", "path": "/centos-fabfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def secure_nginx(): print('done') def install_mail(email_address): sudo ('yum install -y postfix') sudo ('chkconfig --levels 235 postfix on') sudo ('yum install -y mailx') sudo ('ln -s /bin/mailx /bin/email') sudo ('echo "Your message" | mail -s "Message Subject" ' + email_addr...
code_fim
hard
{ "lang": "python", "repo": "rzaytsev/server-setup", "path": "/centos-fabfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x: x = x - 1 y = y + x # print x, y print y<|fim_prefix|># repo: jmgc/pyston path: /test/tests/30.py # run_args: -n # statcheck: ("-L" in EXTRA_JIT_ARGS) or (1 <= stats["num_osr_exits"] <= 2) # statcheck: noninit<|fim_middle|>_count('slowpath_binop') <= 10 x = 100000 y = 0 while
code_fim
easy
{ "lang": "python", "repo": "jmgc/pyston", "path": "/test/tests/30.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmgc/pyston path: /test/tests/30.py # run_args: -n # statcheck: ("-L" in EXTRA_JIT_ARGS) or<|fim_suffix|>x: x = x - 1 y = y + x # print x, y print y<|fim_middle|> (1 <= stats["num_osr_exits"] <= 2) # statcheck: noninit_count('slowpath_binop') <= 10 x = 100000 y = 0 while
code_fim
medium
{ "lang": "python", "repo": "jmgc/pyston", "path": "/test/tests/30.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MageCraft/pyfreecell path: /psp-russia/russia/rs_ctrl.py #!/usr/bin/env python # -*- coding: utf-8 -*- from unit_world import UnitWorld from block import create_block, destroy_block, BLOCK_KINDS import random from util import log BLOCK_COLOR_KINDS = 6 <|fim_suffix|> return block.down() ...
code_fim
hard
{ "lang": "python", "repo": "MageCraft/pyfreecell", "path": "/psp-russia/russia/rs_ctrl.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _clear(self): self.units.clear() def _new_block(self): if not block is None: destroy_block(block) block_type = self.rand.choice(range(BLOCK_KINDS)) block_clr = self.rand.choice(range(BLOCK_COLOR_KINDS)) log('block_type: %d, block_color: %d',...
code_fim
medium
{ "lang": "python", "repo": "MageCraft/pyfreecell", "path": "/psp-russia/russia/rs_ctrl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test(self): test_forward(self.model, self.tree, 8)<|fim_prefix|># repo: avena554/listops_sandbox path: /models/test_christophs_tree_lstm.py from unittest import TestCase from test_ressources.tree_lstm_testing_utilities import global_set_up, test_forward from models.christophs_tree_lstm im...
code_fim
hard
{ "lang": "python", "repo": "avena554/listops_sandbox", "path": "/models/test_christophs_tree_lstm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: avena554/listops_sandbox path: /models/test_christophs_tree_lstm.py from unittest import TestCase from test_ressources.tree_lstm_testing_utilities import global_set_up, test_forward from models.christophs_tree_lstm import TreeLSTM <|fim_suffix|> def test(self): test_forward(self.mode...
code_fim
hard
{ "lang": "python", "repo": "avena554/listops_sandbox", "path": "/models/test_christophs_tree_lstm.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test(self): test_forward(self.model, self.tree, 8)<|fim_prefix|># repo: avena554/listops_sandbox path: /models/test_christophs_tree_lstm.py from unittest import TestCase from test_ressources.tree_lstm_testing_utilities import global_set_up, test_forward from models.christophs_tree_lstm i...
code_fim
hard
{ "lang": "python", "repo": "avena554/listops_sandbox", "path": "/models/test_christophs_tree_lstm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lhfu2244/Cornell-CS5670-2018 path: /Project4_Stereo/student.py # Please place imports here. # BEGIN IMPORTS import time from math import floor import numpy as np import cv2 from scipy.sparse import csr_matrix # import util_sweep # END IMPORTS def compute_photometric_stereo_impl(lights, images):...
code_fim
hard
{ "lang": "python", "repo": "lhfu2244/Cornell-CS5670-2018", "path": "/Project4_Stereo/student.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> channel1 channel2 +------+------+ +------+------+ height | x111 | x121 | | x112 | x122 | | +------+------+ +------+------+ | | x211 | x221 | | x212 | x222 | | +------+------+ +------+------+ v width -------> v = [ x111, x121, x211, x112, x112, x122, x212, ...
code_fim
hard
{ "lang": "python", "repo": "lhfu2244/Cornell-CS5670-2018", "path": "/Project4_Stereo/student.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: makotoooooooo/amazon path: /amazon/models.py from django.db import models from django import forms from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.models import PermissionsMixin from django.core.mail import send_mail from django.utils.translat...
code_fim
hard
{ "lang": "python", "repo": "makotoooooooo/amazon", "path": "/amazon/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class ShoppingCartItem(models.Model): cart = models.ForeignKey( ShoppingCart, related_name = 'cart_items', verbose_name = 'ショッピングカート', on_delete = models.CASCADE ) product = models.ForeignKey( Product, verbose_name = '商品', on_delete = mo...
code_fim
hard
{ "lang": "python", "repo": "makotoooooooo/amazon", "path": "/amazon/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhavesh-09/addskilleetcode path: /WEEK5/Diameter of Binary Tree.py # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def diameterOfBina...
code_fim
hard
{ "lang": "python", "repo": "bhavesh-09/addskilleetcode", "path": "/WEEK5/Diameter of Binary Tree.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if root is None: return 0 else: return 1 + max(self.height(root.left),self.height(root.right))<|fim_prefix|># repo: bhavesh-09/addskilleetcode path: /WEEK5/Diameter of Binary Tree.py # Definition for a binary tree node. # class TreeNode: # def __init__(self, v...
code_fim
hard
{ "lang": "python", "repo": "bhavesh-09/addskilleetcode", "path": "/WEEK5/Diameter of Binary Tree.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tobitherobot/adventofcode path: /y19/d05.py from intcode import Intcode <|fim_suffix|># star 1 ic = Intcode(opcode[:]) ic.input = 1 ic.run()<|fim_middle|>with open("y19/r05.txt") as f: opcode = [int(x.strip()) for x in f.readline().split(',')]
code_fim
medium
{ "lang": "python", "repo": "tobitherobot/adventofcode", "path": "/y19/d05.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># star 1 ic = Intcode(opcode[:]) ic.input = 1 ic.run()<|fim_prefix|># repo: tobitherobot/adventofcode path: /y19/d05.py from intcode import Intcode <|fim_middle|>with open("y19/r05.txt") as f: opcode = [int(x.strip()) for x in f.readline().split(',')]
code_fim
medium
{ "lang": "python", "repo": "tobitherobot/adventofcode", "path": "/y19/d05.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> s = self.height * self.length return s a = int(input()) b = int(input()) print(Triangle(a,b).area()) print(Rectangle(a,b).area())<|fim_prefix|># repo: felix-echarti/python_dev path: /5seminar/5seminar_Task2.1.py class Shape: def __init__(self, height, length): self.height = ...
code_fim
medium
{ "lang": "python", "repo": "felix-echarti/python_dev", "path": "/5seminar/5seminar_Task2.1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Rectangle(Shape): def area(self): s = self.height * self.length return s a = int(input()) b = int(input()) print(Triangle(a,b).area()) print(Rectangle(a,b).area())<|fim_prefix|># repo: felix-echarti/python_dev path: /5seminar/5seminar_Task2.1.py class Shape: def __init__(s...
code_fim
medium
{ "lang": "python", "repo": "felix-echarti/python_dev", "path": "/5seminar/5seminar_Task2.1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: felix-echarti/python_dev path: /5seminar/5seminar_Task2.1.py class Shape: def __init__(self, height, length): self.height = height self.length = length class Triangle(Shape): def area(self): <|fim_suffix|>class Rectangle(Shape): def area(self): s = self.heigh...
code_fim
medium
{ "lang": "python", "repo": "felix-echarti/python_dev", "path": "/5seminar/5seminar_Task2.1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CGNAT/shuffler path: /shuffler/files.py from toolshed import reader, nopen import os.path as op import sys def stream_file(f, pad_info=None): if pad_info is None: pad_info = parse_file_pad(f) f = pad_info.get('file', f) assert op.exists(f) if pad_info['upstream'] == pad_i...
code_fim
hard
{ "lang": "python", "repo": "CGNAT/shuffler", "path": "/shuffler/files.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if len(toks) > 2: downstream, downstrand = parse_dist(toks[2]) downstream = -downstream if downstrand == "-" else downstream return dict(file=f, upstream=upstream, downstream=downstream) if __name__ == "__main__": import doctest doctest.testmod() ...
code_fim
hard
{ "lang": "python", "repo": "CGNAT/shuffler", "path": "/shuffler/files.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> voltage = multi[0] current = multi[1] power = multi[2] print(voltage) print(current) print(power) time.sleep(1)<|fim_prefix|># repo: au634825/Team2-Projekt4 path: /MainCode/src/INA260Multimeter/INATest.py import time import ast import board import busio import adafruit_ina260...
code_fim
hard
{ "lang": "python", "repo": "au634825/Team2-Projekt4", "path": "/MainCode/src/INA260Multimeter/INATest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: au634825/Team2-Projekt4 path: /MainCode/src/INA260Multimeter/INATest.py import time import ast import board import busio import adafruit_ina260 i2c = busio.I2C(board.SCL, board.SDA) ina260 = adafruit_ina260.INA260(i2c) while True: print("i2c detected") print("Current:", ina260.current) ...
code_fim
medium
{ "lang": "python", "repo": "au634825/Team2-Projekt4", "path": "/MainCode/src/INA260Multimeter/INATest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> multi = [ina260.current, ina260.voltage, ina260.power] print(multi) multi = str(multi) print(type(multi)) multi = eval(multi) print(multi) print(type(multi)) voltage = multi[0] current = multi[1] power = multi[2] print(voltage) print(current) ...
code_fim
medium
{ "lang": "python", "repo": "au634825/Team2-Projekt4", "path": "/MainCode/src/INA260Multimeter/INATest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> conn.commit() conn.close() if __name__ == '__main__': main()<|fim_prefix|># repo: kawai-yusuke/sql_practice path: /sample03.py import sqlite3 def main(): conn = sqlite3.connect("users.sqlite") cursor = conn.cursor() sql = "SELECT * FROM users WHERE age < 20" <|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "kawai-yusuke/sql_practice", "path": "/sample03.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kawai-yusuke/sql_practice path: /sample03.py import sqlite3 def main(): conn = sqlite3.connect("users.sqlite") cursor = conn.cursor() sql = "SELECT * FROM users WHERE age < 20" results = cursor.execute(sql) users = results.fetchall() print(users) for user in users...
code_fim
easy
{ "lang": "python", "repo": "kawai-yusuke/sql_practice", "path": "/sample03.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmarnat/aml-practicals path: /PS2-OR/part-2/bandit-UCB.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 13 15:47:52 2017 @author: jmarnat """ import numpy as np import matplotlib.pyplot as plt from math import sqrt, log # =================================================...
code_fim
hard
{ "lang": "python", "repo": "jmarnat/aml-practicals", "path": "/PS2-OR/part-2/bandit-UCB.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return(best_arm) n=1 rewards = [0.2,0.3,0.8] ucb(rewards, eps = 0.1, steps = 100, trials = 20, explore = 10, error_graph=True, verbose=False) ucb(rewards, eps = 0.1, steps = 100, trials = 100, explore = 10, error_graph=True, verbose=False) ucb(rewards, eps = 0.1, steps = 2000, trials = ...
code_fim
hard
{ "lang": "python", "repo": "jmarnat/aml-practicals", "path": "/PS2-OR/part-2/bandit-UCB.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return unicode(self.title) def get_absolute_url(self): return '{url}{slug}/'.format(url=reverse('blog', args=(self.id,)), slug=self.title.replace(' ','-'))<|fim_prefix|># repo: suhailvs/suhailvs.com path: /blog/models.py from django.db import models from django.core.urlresolvers import reverse # Cr...
code_fim
hard
{ "lang": "python", "repo": "suhailvs/suhailvs.com", "path": "/blog/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: suhailvs/suhailvs.com path: /blog/models.py from django.db import models from django.core.urlresolvers import reverse # Create your models here. class Tag(models.Model): name=models.CharField(max_length=100) created = models.DateTimeField(auto_now_add=True) def __unicode__(self): <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "suhailvs/suhailvs.com", "path": "/blog/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Blog(models.Model): title=models.CharField(max_length=200) tags=models.ManyToManyField(Tag) content=models.TextField(blank=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) def __unicode__(self): return unicode(self.title) def get_absolut...
code_fim
medium
{ "lang": "python", "repo": "suhailvs/suhailvs.com", "path": "/blog/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: David92p/Python-workbook path: /introduction_to_programming/Exercise09.py #Compound Interest count = int(input('Enter the amount deposited ')) count = round(count,2) <|fim_suffix|>print('The total amount including interest in the first year is ', round(year1,2),'\n' 'The total amount including ...
code_fim
medium
{ "lang": "python", "repo": "David92p/Python-workbook", "path": "/introduction_to_programming/Exercise09.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print('The total amount including interest in the first year is ', round(year1,2),'\n' 'The total amount including interest in the second year is ', round(year2,2),'\n' 'The total amount including interest in the third year is ', round(year3,2))<|fim_prefix|># repo: David92p/Python-workbook path: /introd...
code_fim
medium
{ "lang": "python", "repo": "David92p/Python-workbook", "path": "/introduction_to_programming/Exercise09.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for y in df.flagsfromint(x): print(y) else: print("Invalid flag value passed.")<|fim_prefix|># repo: ncdulo/DiscordFlags.py path: /example.py import discordflags as df if __name__ == '__main__': print('Press Control-C to exit.') while True: t...
code_fim
hard
{ "lang": "python", "repo": "ncdulo/DiscordFlags.py", "path": "/example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ncdulo/DiscordFlags.py path: /example.py import discordflags as df if __name__ == '__main__': print('Press Control-C to exit.') while True: try: <|fim_suffix|> for y in df.flagsfromint(x): print(y) else: print("Invalid flag value pass...
code_fim
hard
{ "lang": "python", "repo": "ncdulo/DiscordFlags.py", "path": "/example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #constraints constraints += "a"+i+j+" = x"+i+" +x"+j+"-2b"+i+j+";\nb"+i+j+" < x"+i+";\nb"+i+j+" < x"+j+";\nb"+i+j+"> x"+i+"+ x"+j+" - 1;\nb"+i+j+">0;\n" variables+="a"+i+j+", b"+i+j+", " for n in range(len(g.nodes)): constraints += "x"+str(n+1)+">0;\n" constraints+="x"+str(n+1)+"<1;\n" ...
code_fim
hard
{ "lang": "python", "repo": "remyrd/DiscreteModelsProject", "path": "/Second/SpinGlass.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) != 2: print("Usage: python SpinGlass.py <instance>") else: g = Graph(filename=sys.argv[1]) obj_func = "min: " constraints = "" variables = "free " for n in range(len(g.nodes)): variables += "n"+str(n+1)+", " variables = variables[:-2] variables += ";\nint " for n i...
code_fim
medium
{ "lang": "python", "repo": "remyrd/DiscreteModelsProject", "path": "/Second/SpinGlass.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: remyrd/DiscreteModelsProject path: /Second/SpinGlass.py # coding: utf-8 # T-79.4101 Discrete Models and Search # Aalto University from __future__ import print_function from graph import Graph import sys if __name__ == "__main__": <|fim_suffix|> obj_func +=" +2a"+i+j+" -1" #constrain...
code_fim
hard
{ "lang": "python", "repo": "remyrd/DiscreteModelsProject", "path": "/Second/SpinGlass.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # INSERT ML MODEL EXISTENCE AND CONNECTION IF APPLICABLE # Run the YOLO/Darknet software on the model # ml_ops.run_model_YOLO(model_name, filename) # OR # Run the model on an image stream using OpenCV # ml_ops.run_model_cam(filename, camera) # endregion sys.exi...
code_fim
hard
{ "lang": "python", "repo": "KentuckySolarCar/CS499", "path": "/app_driver.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KentuckySolarCar/CS499 path: /app_driver.py import sys import camera_ops as c_ops import file_ops as f_ops import ml_model_ops as ml_ops def main(): #model_name = "SVHN_model_multi.h5" filename = f_ops.generate_filename() for i in range(0, len(sys.argv)): # change ...
code_fim
hard
{ "lang": "python", "repo": "KentuckySolarCar/CS499", "path": "/app_driver.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Run the YOLO/Darknet software on the model # ml_ops.run_model_YOLO(model_name, filename) # OR # Run the model on an image stream using OpenCV # ml_ops.run_model_cam(filename, camera) # endregion sys.exit(0) if __name__ == "__main__": main()<|fim_prefix|># re...
code_fim
hard
{ "lang": "python", "repo": "KentuckySolarCar/CS499", "path": "/app_driver.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HakobBeg/Python_example path: /excp.py fruits = {"banana": 15, "apple": 65, "pear": 0} while True: try: key = input("Enter fruit name: ") <|fim_suffix|> if fruits[key] <= 0: raise Exception(f"There's no {key} left in the box.") except KeyError: print(f...
code_fim
easy
{ "lang": "python", "repo": "HakobBeg/Python_example", "path": "/excp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HakobBeg/Python_example path: /excp.py fruits = {"banana": 15, "apple": 65, "pear": 0} <|fim_suffix|> print(fruits[key]) if fruits[key] <= 0: raise Exception(f"There's no {key} left in the box.") except KeyError: print(f"There's no such fruit as {key}, sor...
code_fim
medium
{ "lang": "python", "repo": "HakobBeg/Python_example", "path": "/excp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if fruits[key] <= 0: raise Exception(f"There's no {key} left in the box.") except KeyError: print(f"There's no such fruit as {key}, sorry.") except Exception as ex: print(ex) except KeyboardInterrupt: print("Goodbye") exit() print("qwer")<|f...
code_fim
easy
{ "lang": "python", "repo": "HakobBeg/Python_example", "path": "/excp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (i and not j) or a < b: next_node = i i = i.next else: next_node = j j = j.next if not node: merged_head = next_node else: node.next = next_node ...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/leetcode", "path": "/0000-0999/021_merge_sorted_lists.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinlondon/leetcode path: /0000-0999/021_merge_sorted_lists.py # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: <|fim_suffix|> if not node: merged_head...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/leetcode", "path": "/0000-0999/021_merge_sorted_lists.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i, j = list1, list2 while i or j: a = i.val if i else float('inf') b = j.val if j else float('inf') if (i and not j) or a < b: next_node = i i = i.next else: next_node = j j = j...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/leetcode", "path": "/0000-0999/021_merge_sorted_lists.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MGB-Niger/hyfaa-scheduler path: /src/hyfaa_python_scheduler/hyfaa/common/test/common_test_functions.py #!/usr/bin/env python # -*- coding: utf-8 -*- ####################################################################### # This code has been developped by Magellium SAS # # Licensing: # # Thi...
code_fim
hard
{ "lang": "python", "repo": "MGB-Niger/hyfaa-scheduler", "path": "/src/hyfaa_python_scheduler/hyfaa/common/test/common_test_functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(bcolors.FAIL + bcolors.BOLD + ' -> Failed' + bcolors.ENDC + bcolors.ENDC) raise def make_hydrostate(output_file, static_assimilation_params=None): dico_main = get_scheduler_basic_main_parameters_dict() dico_assim = get_scheduler_standard_assimilation_dict() shutil.copy(dic...
code_fim
hard
{ "lang": "python", "repo": "MGB-Niger/hyfaa-scheduler", "path": "/src/hyfaa_python_scheduler/hyfaa/common/test/common_test_functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(bcolors.OKGREEN + bcolors.BOLD + ' -> Succeeded' + bcolors.ENDC + bcolors.ENDC) def fail_message_utest(): print(bcolors.FAIL + bcolors.BOLD + ' -> Failed' + bcolors.ENDC + bcolors.ENDC) raise def make_hydrostate(output_file, static_assimilation_params=None): dico_mai...
code_fim
hard
{ "lang": "python", "repo": "MGB-Niger/hyfaa-scheduler", "path": "/src/hyfaa_python_scheduler/hyfaa/common/test/common_test_functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamyedidia/little_programs path: /dad_net_with_nonlinearity.py from scipy.special import softmax from math import log import numpy as np import matplotlib.pyplot as p import time t = time.time() n = 50 numExamples = int(n) def relu(x): return x*(x>=0) #T = np.array([[1]]) #T = np.random.ex...
code_fim
hard
{ "lang": "python", "repo": "adamyedidia/little_programs", "path": "/dad_net_with_nonlinearity.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>f, fPrime = relu, reluPrime #f, fPrime = softPlus, softPlusPrime percent = 0 biasAugmentedX = np.concatenate([X, np.ones((1, numExamples))], axis=0) #biasAugmentedX = X for i in range(numIter): if i/numIter > percent/100 and (i-1)/numIter <= percent/100: # print(i, "/", numIter) percent += 1 pr...
code_fim
hard
{ "lang": "python", "repo": "adamyedidia/little_programs", "path": "/dad_net_with_nonlinearity.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Recursively return the closing tags that match the tail of the stack of opening tags.""" if not stack: return (stack, matching) last = stack[-1] if self.source_tags.closing_tags.get(offset,{}).get(last.begin,{}).get(last.name,False): stack...
code_fim
hard
{ "lang": "python", "repo": "tarsqi/ttk", "path": "/deprecated/various_xml.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> xml_string = u'' # TODO: use a string buffer offset = 0 stack = [] for char in self.text: # any tags on the stack that can be closed? (stack, matching) = self._matching_closing_tags(offset, stack, []) for t in matching: ...
code_fim
hard
{ "lang": "python", "repo": "tarsqi/ttk", "path": "/deprecated/various_xml.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tarsqi/ttk path: /deprecated/various_xml.py class SourceDoc: """Some code removed from SourceDoc.""" def print_tags(self, filename): """Print all the tags to a file. Each tag is printed on a tab-separated line with opening offset, closing offset, tag name, and attribute...
code_fim
hard
{ "lang": "python", "repo": "tarsqi/ttk", "path": "/deprecated/various_xml.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dist = self.dist m = dist.shape[0] if m < dims: print("Too few samples") return None dist_i = [] dist_j = [] dist_ij = np.sum(dist) / (m * m) for i in range(m): dist_i.append(np.sum(dist[i, :]) / m) for...
code_fim
hard
{ "lang": "python", "repo": "KryptonRefugee/Course_Assignment", "path": "/Isomap/MDS.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KryptonRefugee/Course_Assignment path: /Isomap/MDS.py import numpy as np class MDS(): def __init__(self, data): self.data = data m = self.data.shape[1] dist = np.zeros((m, m)) self.B = np.zeros((m, m)) for i in range(m): for j in range(i, ...
code_fim
hard
{ "lang": "python", "repo": "KryptonRefugee/Course_Assignment", "path": "/Isomap/MDS.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # A query may consist of multiple expressions. We execute each of # the expressions in order and output the results from the final # expression. The primary scenario is: # # "USE {keyspace}; SELECT * FROM .." # # However, arbitrary query expressions may be combined in this ...
code_fim
hard
{ "lang": "python", "repo": "polyvore/splunk-cassandra", "path": "/bin/dbcql.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: polyvore/splunk-cassandra path: /bin/dbcql.py #!/usr/bin/env python # # Copyright 2011 Splunk, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"): you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.a...
code_fim
hard
{ "lang": "python", "repo": "polyvore/splunk-cassandra", "path": "/bin/dbcql.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in xrange(len(words)): for j in xrange(i, len(words)): count, inter = diff(words[i], words[j]) pairs[count] = inter print pairs[len(words[0])-1] exit(0)<|fim_prefix|># repo: rui-teixeira/coding path: /AoC/2018/2/b.py def diff(w1, w2): counter = ...
code_fim
medium
{ "lang": "python", "repo": "rui-teixeira/coding", "path": "/AoC/2018/2/b.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>while True: fin = open('input', 'r') words = [line.strip() for line in fin] pairs = {} for i in xrange(len(words)): for j in xrange(i, len(words)): count, inter = diff(words[i], words[j]) pairs[count] = inter print pairs[len(words[0])-1] ex...
code_fim
medium
{ "lang": "python", "repo": "rui-teixeira/coding", "path": "/AoC/2018/2/b.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rui-teixeira/coding path: /AoC/2018/2/b.py def diff(w1, w2): counter = 0 common = "" for i in xrange(len(w1)): if w1[i] == w2[i]: counter += 1 common += w1[i] return counter, common <|fim_suffix|> for i in xrange(len(words)): for j in...
code_fim
medium
{ "lang": "python", "repo": "rui-teixeira/coding", "path": "/AoC/2018/2/b.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amaurirg/controle-de-estoque path: /api/serializers.py from controle_estoque.models import Produto from controle_pedidos.models import PedidoCompra, CarrinhoPedido from controle_vendas.models import Venda, CarrinhoVenda from rest_framework import serializers class ProdutoSerializer(serializers....
code_fim
medium
{ "lang": "python", "repo": "amaurirg/controle-de-estoque", "path": "/api/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class VendaSerializer(serializers.ModelSerializer): class Meta: model = Venda fields = '__all__' class CarrinhoVendaSerializer(serializers.ModelSerializer): class Meta: model = CarrinhoVenda fields = '__all__'<|fim_prefix|># repo: amaurirg/controle-de-estoque pat...
code_fim
hard
{ "lang": "python", "repo": "amaurirg/controle-de-estoque", "path": "/api/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Venda fields = '__all__' class CarrinhoVendaSerializer(serializers.ModelSerializer): class Meta: model = CarrinhoVenda fields = '__all__'<|fim_prefix|># repo: amaurirg/controle-de-estoque path: /api/serializers.py from controle_estoque.models import Produto f...
code_fim
medium
{ "lang": "python", "repo": "amaurirg/controle-de-estoque", "path": "/api/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> :param path: to the json file :returns: param needed for the experiment :rtype: dictionary """ try: with open(path, "rb") as f: params = yaml.full_load(f) return params except Exception as e: print(e) with open(path, "r") as f: ...
code_fim
hard
{ "lang": "python", "repo": "cvejoski/recurrent-point-review-models", "path": "/Tyche/src/tyche/utils/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cvejoski/recurrent-point-review-models path: /Tyche/src/tyche/utils/helper.py # coding: utf-8 from __future__ import division, absolute_import from __future__ import print_function, unicode_literals import copy import itertools import numpy as np import torch as to import torch as torch import ...
code_fim
hard
{ "lang": "python", "repo": "cvejoski/recurrent-point-review-models", "path": "/Tyche/src/tyche/utils/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def gumbel_softmax(pi, tau, device): """ Gumbel-Softmax distribution. Implementation from https://github.com/ericjang/gumbel-softmax. pi: [B, ..., n_classes] class probs of categorical z tau: temperature Returns [B, ..., n_classes] as a one-hot vector """ y = gumbel_softma...
code_fim
hard
{ "lang": "python", "repo": "cvejoski/recurrent-point-review-models", "path": "/Tyche/src/tyche/utils/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saljavLTU/salehajaved-IOT path: /WMProvider_server.py from flask import Flask, jsonify from http.server import CGIHTTPRequestHandler, HTTPServer #from flask_restful import Api, Resource, reqparse import random import csv import xlrd import xlsxwriter import os import numpy as np import requests ...
code_fim
hard
{ "lang": "python", "repo": "saljavLTU/salehajaved-IOT", "path": "/WMProvider_server.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #Inputs #Input files should be located in the same folder dfile = 'T1_traineddict.mat' #File name containing the trained dictionary raw_data = './Turbine1.csv' #File name containing the raw data #Output destFile = 'Testing' #File name that will contain the output #Functions idictm = scdl.l...
code_fim
hard
{ "lang": "python", "repo": "saljavLTU/salehajaved-IOT", "path": "/WMProvider_server.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: brusayannick/tuv-termin-suche path: /main.py import time import telegram_send from plyer import notification from selenium import webdriver from selenium.webdriver.common.keys import Keys def termin(gebiet): option=webdriver.ChromeOptions() option.add_argument('headless') option.add_...
code_fim
hard
{ "lang": "python", "repo": "brusayannick/tuv-termin-suche", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> wait() frei = driver.find_elements_by_xpath("//table[@class='ui-datepicker-calendar']//td[@class='ui-datepicker-unselectable ui-state-disabled']") o=0 for i in frei: o+=1 return o driver.close() def main(): cntnach1 = 0 cntnach2 = 0 while True: cntvor...
code_fim
hard
{ "lang": "python", "repo": "brusayannick/tuv-termin-suche", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(): cntnach1 = 0 cntnach2 = 0 while True: cntvor1 = termin("Düsseldorf") if cntvor1>cntnach1: notification.notify(title = "Neue Theoriestunden!", message = "Neue Theoriestunden in Düsseldorf") telegram_send.send(messages=["Neue Theoriestunden in ...
code_fim
hard
{ "lang": "python", "repo": "brusayannick/tuv-termin-suche", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.winner = None self.contestants = {1: Contestant("Rob"), 2: Contestant("Rob S"), 3: Contestant("Nevin")} def get_winner(self): self.winner = self.contestants[random.randint(1, 3)] print(self.winner)<|fim_prefix|># repo: RobS-Blairstown/datas...
code_fim
easy
{ "lang": "python", "repo": "RobS-Blairstown/datastructures", "path": "/sweepstakes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RobS-Blairstown/datastructures path: /sweepstakes.py import random from contestants import Contestant class SweepstakesWinner: <|fim_suffix|> self.winner = self.contestants[random.randint(1, 3)] print(self.winner)<|fim_middle|> def __init__(self): self.winner = None ...
code_fim
medium
{ "lang": "python", "repo": "RobS-Blairstown/datastructures", "path": "/sweepstakes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: teddy-owen/Bluetooth_Controller path: /BT_input_stream.py """ Bluetooth Input Stream stream_input() is a generator that start up the bluetooth serial server via PyBluez and yields events sent from a device Ex: # print data send from bluetooth device for event in stream_input(): ...
code_fim
hard
{ "lang": "python", "repo": "teddy-owen/Bluetooth_Controller", "path": "/BT_input_stream.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _close_connection(client_sock,server_sock): print("disconnected") client_sock.close() server_sock.close() print("all done") return if __name__ == "__main__": for event in stream_input(): print(event)<|fim_prefix|># repo: teddy-owen/Bluetooth_Controller path: /BT_inpu...
code_fim
hard
{ "lang": "python", "repo": "teddy-owen/Bluetooth_Controller", "path": "/BT_input_stream.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client_sock, client_info = server_sock.accept() print("Accepted connection from ", client_info) return client_sock, server_sock def _close_connection(client_sock,server_sock): print("disconnected") client_sock.close() server_sock.close() print("all done") return if __nam...
code_fim
hard
{ "lang": "python", "repo": "teddy-owen/Bluetooth_Controller", "path": "/BT_input_stream.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>..") elif select == 3: while 2: os.system("clear") print "===========================" print "1 - lap&butt" print "2 - zizag bolt" print "3 - menue" print "" selectt = input("select :- ") if selectt == 1: design2.sanj() san = raw_input("Press enter to continue ..") el...
code_fim
hard
{ "lang": "python", "repo": "sachin175638/sub", "path": "/steel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sachin175638/sub path: /steel.py #/bin/env python2 import os import dss import dessign import design2 import zig while 1: try: os.system("clear") print "\033[1;31m -------------------------------------------" os.system("figlet =+DSS+=") print "\033[1;31m ------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "sachin175638/sub", "path": "/steel.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 2. get GENERALIZED TUPLES (its index) #train_tuples, test_tuples = tuples[train_idx], tuples[test_idx] idx_gen_tuples = [i for i, x in enumerate(test_tuples) if x not in train_tuples]#IMPORTANT!!! This index (idx_gen_tuples) is over the instances of the TEST SET! # 3.get GENARALIZED WOR...
code_fim
hard
{ "lang": "python", "repo": "gcollell/spatial-commonsense", "path": "/code/data_tools.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gcollell/spatial-commonsense path: /code/data_tools.py pred'].append(pred_list.index(TRAIN_relevant['rel'][i])) X_enf_gen['obj'].append(obj_list.index(TRAIN_relevant['obj'][i])) elif (enforce_gen['eval'] == 'words') and any(word in enforce_gen['words'] for word in triplet): ...
code_fim
hard
{ "lang": "python", "repo": "gcollell/spatial-commonsense", "path": "/code/data_tools.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|></body> </html> """ @app.route("/<name>") def hello(name): return "hello " + name if __name__ == "__main__": app.run(debug=True)<|fim_prefix|># repo: JaeGyu/PythonEx_1 path: /flaskEx.py from flask import Flask app = Flask(__name__) <|fim_middle|> html = """ <html> <body> <ul> <li...
code_fim
medium
{ "lang": "python", "repo": "JaeGyu/PythonEx_1", "path": "/flaskEx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": app.run(debug=True)<|fim_prefix|># repo: JaeGyu/PythonEx_1 path: /flaskEx.py from flask import Flask app = Flask(__name__) html = """ <html> <body> <ul> <li>asdfa</li> <li>asdfas</li> <li>asdfas</li> <li>asdfas</li> </ul> </body> ...
code_fim
medium
{ "lang": "python", "repo": "JaeGyu/PythonEx_1", "path": "/flaskEx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JaeGyu/PythonEx_1 path: /flaskEx.py from flask import Flask app = Flask(__name__) html = """ <html> <body> <ul> <li>asdfa</li> <li>asdfas</li> <li>asdfas</li> <li>asdfas</li> </ul> </body> </html> <|fim_suffix|>if __name__ == "__main__": app.run(de...
code_fim
medium
{ "lang": "python", "repo": "JaeGyu/PythonEx_1", "path": "/flaskEx.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lxngoddess5321/mlearning path: /logistic_regression/logic_regression.py import numpy as np def sigmoid(x): return 1/(1+np.exp(-x)) def weights(x, y): m, n = x.shape theta = np.random.rand(n) alpha = 0.001 cnt = 0 max_iter = 50000 threshold = 0.01 while ...
code_fim
medium
{ "lang": "python", "repo": "lxngoddess5321/mlearning", "path": "/logistic_regression/logic_regression.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x_train = np.array([ [1, 2.697, 6.254], [1, 1.872, 2.014], [1, 2.312, 0.812], [1, 1.983, 4.990], [1, 2.321, 0.812], [1, 2.215, 1.561], [1, 1.659, 2.932], [1, 0.865, 7.362], [1, 1.685, 4.763], [1, 1.786, 2.523] ...
code_fim
medium
{ "lang": "python", "repo": "lxngoddess5321/mlearning", "path": "/logistic_regression/logic_regression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sum=sum+(a[i]) i=i+1 print(count) print(sum) print(sum//i)<|fim_prefix|># repo: pihu480/list path: /count.py a = [23, 14, 56, 12, 19, 9, 15, 25, 31, 42, 43] i=0 count=0 sum=0<|fim_middle|> while i<len(a): if a[i]%2==0: print("even") elif a[i]%2!=0: print("odd") coun...
code_fim
medium
{ "lang": "python", "repo": "pihu480/list", "path": "/count.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pihu480/list path: /count.py a = [23, 14, 56, 12, 19, 9, 15, 25, 31, 42, 43] i=0 count=0 sum=0<|fim_suffix|> sum=sum+(a[i]) i=i+1 print(count) print(sum) print(sum//i)<|fim_middle|> while i<len(a): if a[i]%2==0: print("even") elif a[i]%2!=0: print("odd") coun...
code_fim
medium
{ "lang": "python", "repo": "pihu480/list", "path": "/count.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> :return: None """ #--- data preparation self.data_preparation(use_data_for_ml_dump=use_data_for_ml_dump, save_data_for_ml_dump=save_data_for_ml_dump, print_log=print_log) #--- features loading if use_ens_ftrs_arr_dum...
code_fim
hard
{ "lang": "python", "repo": "SergejGorev/FML_lib", "path": "/ensemble.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }