index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,600
7d25a8eb61b6fb9069616745c2b68fd3ceeca9fb
# Generated by Django 2.2.2 on 2019-10-19 14:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('account', '0001_initial'), ] operations = [ migrations.AlterField( model_name='account', name='phone_number', ...
[ "# Generated by Django 2.2.2 on 2019-10-19 14:09\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('account', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='account',\n name='ph...
false
6,601
a757bbb9ad2f6f5bf04cdf4091b97841b8e40432
import os import pickle import collections import numpy as np import pandas as pd import matplotlib.pyplot as plt from IPython import embed from optimizers.utils_1 import Model_1, Architecture_1 from optimizers.utils import Model, Architecture colors={ 'BOHB-PC-DARTS': 'darkorange', 'BOHB-DARTS': 'dod...
[ "import os\nimport pickle\nimport collections\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom IPython import embed\n\nfrom optimizers.utils_1 import Model_1, Architecture_1\nfrom optimizers.utils import Model, Architecture\n\ncolors={\n 'BOHB-PC-DARTS': 'darkorange',\n ...
false
6,602
e5e7856d752f14e0671bae8d8b7997207c667ae1
from django.http import HttpResponse, JsonResponse from django.shortcuts import render from django.views.generic.base import View from elasticsearch import Elasticsearch from elasticsearch_dsl import Search # from com_search.get_info import Search as Search_1 # from com_search.models import CompanyType import json # Cr...
[ "from django.http import HttpResponse, JsonResponse\nfrom django.shortcuts import render\nfrom django.views.generic.base import View\nfrom elasticsearch import Elasticsearch\nfrom elasticsearch_dsl import Search\n# from com_search.get_info import Search as Search_1\n# from com_search.models import CompanyType\nimpo...
false
6,603
b52807a15cef8f07f685f8761a470d4a24d9c3dc
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/6/20 下午4:00 # @Author : Huang HUi # @Site : # @File : query_parse.py # @Software: PyCharm from mysqlConnection import mysqlConnection import yaml import copy import time import csv import json from collections import OrderedDict import ast # # GIV...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# @Time : 2017/6/20 下午4:00\n# @Author : Huang HUi\n# @Site : \n# @File : query_parse.py\n# @Software: PyCharm\nfrom mysqlConnection import mysqlConnection\nimport yaml\nimport copy\nimport time\nimport csv\nimport json\nfrom collections import OrderedDict\n...
false
6,604
51ed99a68486bd52499bbc28e68ff2312e02ea1f
from django.db import models from datetime import datetime # Create your models here. class Notifications(models.Model): username= models.CharField(max_length=20) phone_number= models.BigIntegerField(default= 0) email= models.EmailField() firstname= models.CharField(max_length=20) app_name= models...
[ "from django.db import models\nfrom datetime import datetime\n\n\n# Create your models here.\nclass Notifications(models.Model):\n username= models.CharField(max_length=20)\n phone_number= models.BigIntegerField(default= 0)\n email= models.EmailField()\n firstname= models.CharField(max_length=20)\n a...
false
6,605
dd053da45d2577772414b1373ba324b0bfdc0d94
from pyrogram import Client, filters from pyrogram.errors import MessageNotModified from db.models import * @Client.on_callback_query(filters.regex('^change_lg_')) async def on_change_language(_, callback): settings_id = int(callback.data.split('_')[2]) with db_session: settings = SettingsInstance.g...
[ "from pyrogram import Client, filters\nfrom pyrogram.errors import MessageNotModified\n\nfrom db.models import *\n\n\n@Client.on_callback_query(filters.regex('^change_lg_'))\nasync def on_change_language(_, callback):\n settings_id = int(callback.data.split('_')[2])\n\n with db_session:\n settings = Se...
false
6,606
965db2523f60d83bd338bcc62ab8e5705550aa89
import csv import json,os mylist=[] clist=["North Indian","Italian","Continental","Chinese","Mexican","South Indian"] for filename in os.listdir("/home/asket/Desktop/DBMS/menu"): print(filename)
[ "import csv\nimport json,os\nmylist=[]\nclist=[\"North Indian\",\"Italian\",\"Continental\",\"Chinese\",\"Mexican\",\"South Indian\"]\nfor filename in os.listdir(\"/home/asket/Desktop/DBMS/menu\"):\n\tprint(filename)", "import csv\nimport json, os\nmylist = []\nclist = ['North Indian', 'Italian', 'Continental', '...
false
6,607
0b36bf9ac7887101be5503a0edce19e1111e5ca0
# Import other modules from zelda_utilities.constants import * # Helps establish the current frame for sprite animation/image changing class Animation: def __init__(self): # Animation clock self.next_frame = pygame.time.get_ticks() # Starting frame self.frame = 0 # ~12 fr...
[ "# Import other modules\nfrom zelda_utilities.constants import *\n\n\n# Helps establish the current frame for sprite animation/image changing\nclass Animation:\n def __init__(self):\n # Animation clock\n self.next_frame = pygame.time.get_ticks()\n\n # Starting frame\n self.frame = 0\n...
false
6,608
9706b9ba81f41b131c364a16bb17a0c1e31e3a04
import numpy as np import skimage def preprocess_img(img, size): img = np.rollaxis(img, 0, 3) # It becomes (640, 480, 3) img = skimage.transform.resize(img, size) img = skimage.color.rgb2gray(img) return img # data = minerl.data.make("MineRLNavigateDense-v0", data_dir="../dataset/navigate") # # # I...
[ "import numpy as np\nimport skimage\n\n\ndef preprocess_img(img, size):\n img = np.rollaxis(img, 0, 3) # It becomes (640, 480, 3)\n img = skimage.transform.resize(img, size)\n img = skimage.color.rgb2gray(img)\n\n return img\n\n# data = minerl.data.make(\"MineRLNavigateDense-v0\", data_dir=\"../dataset...
false
6,609
46bf5866d5353c58e130b20ffa4d95df8abf986b
import os import pickle import PySimpleGUI as sg from typing import Dict sg.ChangeLookAndFeel('Black') import string from nltk.tokenize import word_tokenize from itertools import chain from glob import glob from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import PorterStemmer fro...
[ "import os\nimport pickle\nimport PySimpleGUI as sg\nfrom typing import Dict\nsg.ChangeLookAndFeel('Black')\nimport string\nfrom nltk.tokenize import word_tokenize\nfrom itertools import chain\nfrom glob import glob\nfrom nltk.corpus import stopwords\nfrom nltk.tokenize import word_tokenize\nfrom nltk.stem import P...
false
6,610
02cd99f0a265fe01835a6adc211e750a58d993fd
import Pyro4 from Pyro4 import Daemon, Proxy from threading import Thread import thread import pickle import socket Pyro4.config.REQUIRE_EXPOSE = False def register(obj): ''' Register an object with daemon ''' daemon = Pyro4.Daemon(host="localhost") uri = daemon.register(obj) # Scheduler serve_daemon(...
[ "import Pyro4\nfrom Pyro4 import Daemon, Proxy\nfrom threading import Thread\nimport thread\nimport pickle\nimport socket\n\nPyro4.config.REQUIRE_EXPOSE = False\n\ndef register(obj):\n ''' Register an object with daemon '''\n daemon = Pyro4.Daemon(host=\"localhost\")\n uri = daemon.register(obj) # Schedule...
true
6,611
8d8df517ca5486e62cc1b5ac23bbcfa65ed9c1ff
from numba import jit @jit def resolve(): N = int(input()) ans = 0 for n in range(1, N+1): for m in range(n, N+1, n): ans += m print(ans) if __name__ == "__main__": resolve()
[ "from numba import jit\n\n@jit\ndef resolve():\n N = int(input())\n\n ans = 0\n for n in range(1, N+1):\n for m in range(n, N+1, n):\n ans += m\n print(ans)\n\nif __name__ == \"__main__\":\n resolve()", "from numba import jit\n\n\n@jit\ndef resolve():\n N = int(input())\n an...
false
6,612
b3a07107ef64bb50f4768954cbb579d8e66bd003
#!/usr/bin/python # The program was written by YU Ho Yung and LEUNG Kin Tung in group 24. # The program is written with stubs for the phase 3 # import pymongo from scrapy.selector import Selector import pandas as pd # import numpy as np import datetime import re import pprint import subprocess import scrapy from pym...
[ "#!/usr/bin/python\n# The program was written by YU Ho Yung and LEUNG Kin Tung in group 24. \n# The program is written with stubs for the phase 3\n#\nimport pymongo\nfrom scrapy.selector import Selector\nimport pandas as pd\n# import numpy as np\nimport datetime\nimport re\nimport pprint\nimport subprocess\nimpor...
false
6,613
c7558486fc50623f6e64b58668153b75bb6149b9
# Generated by Django 2.2.10 on 2020-05-06 14:43 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('planner', '0023_auto_20191226_1330'), ] operations = [ migrations.AddField( model_name='employee'...
[ "# Generated by Django 2.2.10 on 2020-05-06 14:43\n\nimport django.core.validators\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('planner', '0023_auto_20191226_1330'),\n ]\n\n operations = [\n migrations.AddField(\n mo...
false
6,614
d983cb4ae79d8370ed0809b86762c1e2ea125320
import pandas as pd def ranked(country, variety, price, num): data = pd.read_csv("wine_final.csv") if num == 0: return None if country !='': data = data.query("country==\"{}\"".format(country)) if variety !='': data = data.query("variety==\"{}\"".format(variety)) if pric...
[ "import pandas as pd\n\n\n\ndef ranked(country, variety, price, num):\n data = pd.read_csv(\"wine_final.csv\")\n if num == 0:\n return None\n if country !='':\n data = data.query(\"country==\\\"{}\\\"\".format(country))\n\n if variety !='':\n data = data.query(\"variety==\\\"{}\\\"\...
false
6,615
a12fe733e607b1ce4cf0f3f4adc3ea85d082e769
from pyftpdlib.authorizers import DummyAuthorizer # Autorizaciones from pyftpdlib.handlers import FTPHandler # Comandos del usuario from pyftpdlib.servers import FTPServer # Creacion del servidor import logging import os def main(): # Instancia un autorizador dummy para controlar usuarios "virtuales" auth...
[ "from pyftpdlib.authorizers import DummyAuthorizer # Autorizaciones\nfrom pyftpdlib.handlers import FTPHandler # Comandos del usuario\nfrom pyftpdlib.servers import FTPServer # Creacion del servidor\nimport logging\nimport os \n\ndef main():\n # Instancia un autorizador dummy para controlar usuarios \"virtua...
false
6,616
e9fff1fb0a79493d4d7f3417c7d554eb10a978a0
def fun1(fun): return "Hai!!!! "+fun def message(): return "How are you" res = fun1(message()) print(res)
[ "def fun1(fun):\r\n return \"Hai!!!! \"+fun\r\ndef message():\r\n return \"How are you\"\r\n\r\nres = fun1(message())\r\nprint(res)\r\n", "def fun1(fun):\n return 'Hai!!!! ' + fun\n\n\ndef message():\n return 'How are you'\n\n\nres = fun1(message())\nprint(res)\n", "def fun1(fun):\n return 'Hai!!...
false
6,617
056636e2220e529d3f66872a4a48c0984cda1ce4
def sort(L): n = len(L) if n < 2: return L L1, L2 = L[:n // 2], L[n // 2:] return merge(sort(L1), sort(L2)) def merge(L1, L2): if L1 == []: return L2 if L2 == []: return L1 x1, R1 = L1[0], L1[1:] x2, R2 = L2[0], L2[1:] if x1 <= x2: return [x1] + merge...
[ "def sort(L):\n n = len(L)\n if n < 2:\n return L\n L1, L2 = L[:n // 2], L[n // 2:]\n return merge(sort(L1), sort(L2))\n\n\ndef merge(L1, L2):\n if L1 == []:\n return L2\n if L2 == []:\n return L1\n x1, R1 = L1[0], L1[1:]\n x2, R2 = L2[0], L2[1:]\n if x1 <= x2:\n ...
false
6,618
79c7a2f2e5f0301c15efe1b26a7839a12098f793
# coding: utf-8 ''' Precision, Recall, F1で評価する Leave-one-outの結果 K-foldの結果 ''' import sys import os.path import snlocest.util as util import numpy as np import pandas as pd from sklearn.model_selection import KFold from sklearn.metrics import precision_recall_fscore_support, classification_report def precision_re...
[ "# coding: utf-8\n\n'''\nPrecision, Recall, F1で評価する\n\nLeave-one-outの結果\n\nK-foldの結果\n'''\n\nimport sys\nimport os.path\nimport snlocest.util as util\nimport numpy as np\nimport pandas as pd\n\nfrom sklearn.model_selection import KFold\nfrom sklearn.metrics import precision_recall_fscore_support, classification_rep...
false
6,619
3378ce72ae67d09258554048138b7f9023000922
from django.shortcuts import render import datetime from django.http import* from django.core.files.storage import FileSystemStorage import uuid import os import cv2 import numpy as np from pathlib import Path def index(request): print(request.session); today=datetime.datetime.now() return render(request,'index.h...
[ "from django.shortcuts import render\nimport datetime\nfrom django.http import*\nfrom django.core.files.storage import FileSystemStorage\nimport uuid \nimport os\nimport cv2\nimport numpy as np\nfrom pathlib import Path\n\ndef index(request):\n print(request.session);\n today=datetime.datetime.now()\n return rende...
false
6,620
5707e24596dfe2d85e9a7caa93aa3e253a41ae40
# -*- encoding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns('apps.profiles.views', url(r'^$', 'index', name='profiles'), # Show a specific profile. url(r'^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile', name='profiles_view'), url(r'^edit/$', 'edit_profile', name...
[ "# -*- encoding: utf-8 -*-\n\nfrom django.conf.urls import patterns, url\n\nurlpatterns = patterns('apps.profiles.views',\n url(r'^$', 'index', name='profiles'),\n\n # Show a specific profile.\n url(r'^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile', name='profiles_view'),\n\n url(r'^edit/$', 'edit...
false
6,621
24635989ccdb0f35f1e618dd8dc07f2cf84faddb
a = [1, 1, 2, 3, 4, 4, 5, 7, 12, 30, 49] for i in range(0, len(a)): if a[i] < 5: print(str(a[i]) + " ") i += 1 else: i += 1
[ "a = [1, 1, 2, 3, 4, 4, 5, 7, 12, 30, 49]\n\nfor i in range(0, len(a)):\n if a[i] < 5:\n print(str(a[i]) + \" \")\n i += 1\n else:\n i += 1\n", "a = [1, 1, 2, 3, 4, 4, 5, 7, 12, 30, 49]\nfor i in range(0, len(a)):\n if a[i] < 5:\n print(str(a[i]) + ' ')\n i += 1\n el...
false
6,622
5dc17db0aca109720d1ba62d65b86d9b81714063
import os import flask_sqlalchemy as sqlalchemy from flask import Flask, jsonify, request,render_template,redirect,url_for,json,flash from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class from flask_cors import CORS import datetime from flask_bootstrap import Bootstrap from flask_login i...
[ "import os\n\nimport flask_sqlalchemy as sqlalchemy\nfrom flask import Flask, jsonify, request,render_template,redirect,url_for,json,flash\nfrom flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class\nfrom flask_cors import CORS\nimport datetime\nfrom flask_bootstrap import Bootstrap\n\nfrom...
false
6,623
4d7e30714ae209e1d09d895dadf7a19928fe253f
# coding: utf-8 # 02. 「パトカー」+「タクシー」=「パタトクカシーー」 # 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ. s1 = "パトカー" s2 = "タクシー" ans = "" for c1, c2 in zip(s1, s2): ans += c1 + c2 print(ans) #パタトクカシーー
[ "# coding: utf-8\n\n# 02. 「パトカー」+「タクシー」=「パタトクカシーー」\n# 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ.\n\ns1 = \"パトカー\"\ns2 = \"タクシー\"\n\nans = \"\"\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\n\nprint(ans)\n#パタトクカシーー\n", "s1 = 'パトカー'\ns2 = 'タクシー'\nans = ''\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\nprint(...
false
6,624
1e929bc3c97de859a16a4ac8d5ac2ebadefd0516
from __future__ import absolute_import import numpy as np import matplotlib.pyplot as pl import seaborn as sb sb.set_color_codes('muted') import scipy.optimize as op from scipy import stats def errorbar(t, f, s, fp=None, **kwargs): with sb.axes_style('white'): fig, ax = pl.subplots(1, 1, figsize=(10,3)) ...
[ "from __future__ import absolute_import\nimport numpy as np\nimport matplotlib.pyplot as pl\nimport seaborn as sb\nsb.set_color_codes('muted')\nimport scipy.optimize as op\nfrom scipy import stats\n\n\ndef errorbar(t, f, s, fp=None, **kwargs):\n with sb.axes_style('white'):\n fig, ax = pl.subplots(1, 1, f...
false
6,625
23160c2f030b0bd862360e944fbbc283c6cb45b2
from rest_framework import serializers class BillBaseSerializer(serializers.Serializer): vendor = serializers.CharField(required=False) amount = serializers.FloatField() bill_date = serializers.DateField() due_date = serializers.DateField() class BillListSerializer(BillBaseSerializer): id = se...
[ "from rest_framework import serializers\n\n\nclass BillBaseSerializer(serializers.Serializer):\n\n vendor = serializers.CharField(required=False)\n amount = serializers.FloatField()\n bill_date = serializers.DateField()\n due_date = serializers.DateField()\n\n\nclass BillListSerializer(BillBaseSerialize...
false
6,626
8c1718f56a73fdd962154abfaedc7c0c3cb0d9ba
from django.urls import path from . import views app_name = 'adverts' urlpatterns = [ path('', views.AdvertListView.as_view(), name="list"), path('create/', views.AdvertFormView.as_view(), name='adverts-create'), path('<str:category>/', views.AdvertListView.as_view(), name="adverts-list-categories"), ]
[ "from django.urls import path\n\nfrom . import views\n\napp_name = 'adverts'\n\nurlpatterns = [\n path('', views.AdvertListView.as_view(), name=\"list\"),\n path('create/', views.AdvertFormView.as_view(), name='adverts-create'),\n path('<str:category>/', views.AdvertListView.as_view(), name=\"adverts-list-...
false
6,627
d1d293a5d2c394e69d93488605f27b5468220286
import pymongo import time client = pymongo.MongoClient('localhost', 27017); db = client['zhihu']; # 类似dict,若不存在,则新建; # client.drop_database('zhihu') # 删除db collection = db['zhihu']; # 若不存在,则新建; # db.drop_collection('zhihu') # 删除collection document_test = {'name': 'test', 'time': time.strftime('%Y-%m-%d %H:%M:%...
[ "import pymongo\nimport time \n\nclient = pymongo.MongoClient('localhost', 27017);\ndb = client['zhihu']; # 类似dict,若不存在,则新建;\n# client.drop_database('zhihu') # 删除db\n\ncollection = db['zhihu']; # 若不存在,则新建;\n# db.drop_collection('zhihu') # 删除collection\n\ndocument_test = {'name': 'test', 'time': time.strftime('%...
false
6,628
c3c82b9ba198b7818cc8e63710140bbb6e28a9ea
""" クリップボードのamazonのURLから不要な部分を削除する """ # -*- coding: utf-8 -*- import re import pyperclip as clip from urllib.parse import urlparse #print(clip.paste()) def urlShortner(): # text = "https://www.amazon.co.jp/Jupyter-Cookbook-Dan-Toomey/dp/1788839447/ref=sr_1_5?s=books&ie=UTF8&qid=1535164277&sr=1-5&keywords=Jupyte...
[ "\n\"\"\"\nクリップボードのamazonのURLから不要な部分を削除する\n\"\"\"\n# -*- coding: utf-8 -*-\n\nimport re\nimport pyperclip as clip\nfrom urllib.parse import urlparse\n\n#print(clip.paste())\n\ndef urlShortner():\n# text = \"https://www.amazon.co.jp/Jupyter-Cookbook-Dan-Toomey/dp/1788839447/ref=sr_1_5?s=books&ie=UTF8&qid=15351642...
false
6,629
3e305cee2f814698729c008320e326c4bd42640d
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('grid2', '0003_auto_20161231_2329'), ] operations = [ migrations.RemoveField( model_name='grid', name...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('grid2', '0003_auto_20161231_2329'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='grid...
false
6,630
2ca40a53291a62bbdb4386decc5a2dfa84431836
#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/ #https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/
[ "#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/\n#https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/\n", "" ]
false
6,631
70373c74e459efb2a310d94ae906910423e8bfd4
import re from mapa import graficar_lista, graficar_matriz class nodo: def __init__(self, x, y, n, c): self.columna = x self.fila = y self.nombre = n self.color = c pattern_matriz = r"[M|m][A|a][T|t][R|r][I|i][Z|z]\s*\(.*,.*,.*,.*,.*\)\{" pattern_fila = r"[F|f][I|i][L|l][A|a]\s*\(...
[ "import re\nfrom mapa import graficar_lista, graficar_matriz\n\nclass nodo:\n def __init__(self, x, y, n, c):\n self.columna = x\n self.fila = y\n self.nombre = n\n self.color = c\n\n\npattern_matriz = r\"[M|m][A|a][T|t][R|r][I|i][Z|z]\\s*\\(.*,.*,.*,.*,.*\\)\\{\"\npattern_fila = r\"[...
false
6,632
aae280e049c00e70e2214662a07eee8bfa29227e
import sys import pygame import pygame.camera from pygame.locals import * from PIL import Image pygame.init() pygame.camera.init() camlist = pygame.camera.list_cameras() print(camlist) # images = map(Image.open, ['Test1.jpg', 'Test2.jpg', 'Test3.jpg']) # widths, heights = zip(*(i.size for i in images)) # total_wi...
[ "import sys\nimport pygame\nimport pygame.camera\nfrom pygame.locals import *\nfrom PIL import Image\n\n\npygame.init()\npygame.camera.init()\n\ncamlist = pygame.camera.list_cameras()\n\nprint(camlist)\n\n# images = map(Image.open, ['Test1.jpg', 'Test2.jpg', 'Test3.jpg'])\n# widths, heights = zip(*(i.size for i in ...
false
6,633
d0bd08bea65878f5fccfc4affecdf53cc36179df
import cv2 as cv #! THESE ARE IMAGES THAT AREN'T DOWNSIZED #original_image_1 = cv.imread("hamburger_face.JPG") #original_image_2 = cv.imread("hammock_reading.JPG") #original_image_3 = cv.imread("sofa_face.JPG") #original_image_4 = cv.imread("frisbee_team.JPG") original_image_5 = cv.imread("mans_face.JPG") # ...
[ "import cv2 as cv\r\n\r\n#! THESE ARE IMAGES THAT AREN'T DOWNSIZED\r\n#original_image_1 = cv.imread(\"hamburger_face.JPG\")\r\n#original_image_2 = cv.imread(\"hammock_reading.JPG\")\r\n#original_image_3 = cv.imread(\"sofa_face.JPG\")\r\n#original_image_4 = cv.imread(\"frisbee_team.JPG\")\r\noriginal_image_5 = cv.im...
false
6,634
fd04f6f4a03fdbe40e400d04e5759ef9ef30f974
# -*- coding: utf-8 -*- """ Created on Fri Nov 2 16:07:25 2018 @author: Yigao """ import re from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords from wordcloud import WordCloud import matplotlib.pyplot as plt ## create a tokenizer hfilename = "file.txt" linecount=0 hashcount=0 wordcount=0 BagO...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Nov 2 16:07:25 2018\n\n@author: Yigao\n\"\"\"\n\nimport re\nfrom nltk.tokenize import TweetTokenizer\nfrom nltk.corpus import stopwords\nfrom wordcloud import WordCloud\nimport matplotlib.pyplot as plt\n\n## create a tokenizer\nhfilename = \"file.txt\"\nlinecount=0\...
false
6,635
f2c96b3133137019dc6bd462f096f3b4c5f12648
# Generated by Django 3.1.1 on 2020-10-29 13:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registered_user', '0005_auto_20201029_1710'), ] operations = [ migrations.AlterField( model_name='user_details', nam...
[ "# Generated by Django 3.1.1 on 2020-10-29 13:56\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('registered_user', '0005_auto_20201029_1710'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='user_details...
false
6,636
3eca3066a6c6484257ca17164d35654812a87b80
n, imp = list(map(int, input().split())) villagers = {} peoples = [] susList = set() for i in range(n): peeps = set(list(map(int, input().split()))[1:]) # Initialize the set villagers[i+1] = villagers.get(i+1, set()) for p in peeps: if i+1 in peeps: susList.add(i+1) break...
[ "n, imp = list(map(int, input().split()))\nvillagers = {}\npeoples = []\nsusList = set()\nfor i in range(n):\n peeps = set(list(map(int, input().split()))[1:])\n # Initialize the set\n villagers[i+1] = villagers.get(i+1, set())\n for p in peeps:\n if i+1 in peeps:\n susList.add(i+1)\n ...
false
6,637
15134d7e4036c102bc9d2ba4d321fadd0467100f
from django.contrib import admin from django.db import models from tinymce.widgets import TinyMCE from .models import UserInfo # Register your models here. class UserInfoAdmin(admin.ModelAdmin): list_display=[ 'user_name', 'user_profession', 'user_phone', 'user_email', ...
[ "from django.contrib import admin\nfrom django.db import models\nfrom tinymce.widgets import TinyMCE\n\nfrom .models import UserInfo\n\n# Register your models here.\nclass UserInfoAdmin(admin.ModelAdmin):\n list_display=[\n 'user_name', \n 'user_profession', \n 'user_phone', \n 'user_...
false
6,638
70c084dab8469ca34b0e3e5174101111e695f1ca
class TflearnDataSourceExtraTemplate(object): """ Base class for TFLearn's DataSource (if we use wrapping). Parameters: ---------- rewrite_data_aug : bool use wrapper for data augmentation """ def __init__(self, rewrite_data_aug=False): self.rewrite_data_aug = rewrite_data_...
[ "class TflearnDataSourceExtraTemplate(object):\n \"\"\"\n Base class for TFLearn's DataSource (if we use wrapping).\n\n Parameters:\n ----------\n rewrite_data_aug : bool\n use wrapper for data augmentation\n \"\"\"\n\n def __init__(self, rewrite_data_aug=False):\n self.rewrite_da...
false
6,639
d988cfebeec37df700f46bbb027a4980ba624d30
import numpy as np # data I/O data = open('input.txt', 'r').read() # should be simple plain text file chars = list(set(data)) data_size, vocab_size = len(data), len(chars) print("chars: ", chars) #one-hot encoding char_to_ix = { ch:i for i,ch in enumerate(chars) } ix_to_char = { i:ch for i,ch in enumerate(chars) } it...
[ "import numpy as np\n\n# data I/O\ndata = open('input.txt', 'r').read() # should be simple plain text file\nchars = list(set(data))\ndata_size, vocab_size = len(data), len(chars)\nprint(\"chars: \", chars)\n#one-hot encoding\nchar_to_ix = { ch:i for i,ch in enumerate(chars) }\nix_to_char = { i:ch for i,ch in enumer...
false
6,640
b6527a09f346ee1b7dd446a0ff21995a995481a8
import argparse def parse_args(): """ Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit. :return: Populated namespace. """ parser = argparse.ArgumentParser(description='baseline Mask R-CNN') parser.add_argument('--dataset', required=True...
[ "import argparse\n\n\ndef parse_args():\n \"\"\"\n Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit.\n :return: Populated namespace.\n \"\"\"\n parser = argparse.ArgumentParser(description='baseline Mask R-CNN')\n parser.add_argument('--dat...
false
6,641
05144338cc9c0c65010e0b8a3dd6fb50f6343214
def climb_ways(n, k):
[ "def climb_ways(n, k):" ]
true
6,642
1d1f1c9b70ca487b48593c85c3e0b5afc10f0b07
import os import sys import random import pygame import time from pygame import locals SCREEN_WIDTH = 1280 SCREEN_HEIGHT = 1024 class Moto(pygame.sprite.Sprite): def __init__(self, player_num, start_direction): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("motor" + str(pla...
[ "import os\nimport sys\nimport random\nimport pygame\nimport time\nfrom pygame import locals\n\nSCREEN_WIDTH = 1280\nSCREEN_HEIGHT = 1024\n\n\nclass Moto(pygame.sprite.Sprite):\n\n def __init__(self, player_num, start_direction):\n pygame.sprite.Sprite.__init__(self)\n\n self.image = pygame.image.l...
false
6,643
2238345a69c2d7a1958a23a470dcb2be6469caeb
import math3d import math import pygame import random class PBody(object): """ A physics-enabled object. """ def __init__(self, pos, mass=1, rad=10, vel=(0,0), color=(255,255,255)): self.pos = math3d.VectorN(pos) self.vel = math3d.VectorN(vel) self.rad = 10 # in pixe...
[ "import math3d\nimport math\nimport pygame\nimport random\n\n\nclass PBody(object):\n \"\"\" A physics-enabled object. \"\"\"\n def __init__(self, pos, mass=1, rad=10, vel=(0,0), color=(255,255,255)):\n self.pos = math3d.VectorN(pos)\n self.vel = math3d.VectorN(vel)\n self.rad = 10 ...
false
6,644
aad3c104432a1a028d96263236133e495536ee69
from locations.storefinders.storelocatorwidgets import StoreLocatorWidgetsSpider class Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider): name = "pharmacy_4_less_au" item_attributes = {"brand": "Pharmacy 4 Less", "brand_wikidata": "Q63367608"} key = "6c0hBJeL5yk8cmaKJGNjTu0JhWNaMQpX"
[ "from locations.storefinders.storelocatorwidgets import StoreLocatorWidgetsSpider\n\n\nclass Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider):\n name = \"pharmacy_4_less_au\"\n item_attributes = {\"brand\": \"Pharmacy 4 Less\", \"brand_wikidata\": \"Q63367608\"}\n key = \"6c0hBJeL5yk8cmaKJGNjTu0JhWNaMQpX\"...
false
6,645
65b90fccd0ee74b369475aa9fe33f159881c8b82
class cal4: def setdata(self,n1): self.n1 = n1 def display(self): return n1*n1 n1 = int(input("Enter number: ")) c = cal4() print(c.display())
[ "class cal4:\r\n def setdata(self,n1):\r\n self.n1 = n1\r\n def display(self):\r\n return n1*n1\r\nn1 = int(input(\"Enter number: \"))\r\nc = cal4()\r\n\r\nprint(c.display())", "class cal4:\n\n def setdata(self, n1):\n self.n1 = n1\n\n def display(self):\n return n1 * n1\n\n...
false
6,646
36bdd6f7c130914856ddf495c50f928405c345aa
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-11-23 19:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mocbackend', '0034_auto_20181122_1903'), ] operations = [ migrations.AddFi...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.16 on 2018-11-23 19:31\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('mocbackend', '0034_auto_20181122_1903'),\n ]\n\n operations = [\n ...
false
6,647
b1530c664fa236e61ff50bca502bf79730c3386c
#!/usr/bin/python # -*- coding: utf-8 -*- # # All about users. # # author: ze.apollo@gmail.com # from client import ClientHelper from mongodb import MongoDBClient class FixedData: def get_data( self, id ): data = self.get_data_from_mongodb( id ) if ( data ): return data else: ...
[ "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# All about users.\n#\n# author: ze.apollo@gmail.com\n#\n\nfrom client import ClientHelper\nfrom mongodb import MongoDBClient\n\nclass FixedData:\n\n def get_data( self, id ):\n data = self.get_data_from_mongodb( id )\n if ( data ):\n retur...
false
6,648
1dd235ecfe577b508d0777e8c70026114aeb154f
from tdm.lib.device import DddDevice, DeviceAction, DeviceWHQuery, Validity class CallJohnDevice(DddDevice): class MakeCall(DeviceAction): def perform(self, select_contact, select_number): contact = self.device.CONTACTS.get(select_contact) number_type = self.device.CONTACT...
[ "from tdm.lib.device import DddDevice, DeviceAction, DeviceWHQuery, Validity\r\n\r\n\r\nclass CallJohnDevice(DddDevice):\r\n\r\n class MakeCall(DeviceAction):\r\n def perform(self, select_contact, select_number):\r\n contact = self.device.CONTACTS.get(select_contact)\r\n number_type ...
true
6,649
a382edb861a43ac3065a781ea996a8d1dd819954
def game_manager(info_list): dictionary = {} for piece_info in info_list: piece_info = piece_info.split('||') piece_info[2] = int(piece_info[2]) if piece_info[2] not in dictionary: dictionary[piece_info[2]] = {(piece_info[1],piece_info[0])} dictionary[piece_info[2]].a...
[ "def game_manager(info_list):\n dictionary = {}\n for piece_info in info_list:\n piece_info = piece_info.split('||')\n piece_info[2] = int(piece_info[2])\n if piece_info[2] not in dictionary:\n dictionary[piece_info[2]] = {(piece_info[1],piece_info[0])}\n dictionary[piec...
false
6,650
d18c0fa29ccdabdd9e11622e8aaec91ff96117df
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Alonso Vidales" __email__ = "alonso.vidales@tras2.es" __date__ = "2013-11-11" class ConnectedSets: """ This is a classic percolation problem, the algorithms uses an array of integer to represent tees, each tree will be a set of connected element...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*- \n\n__author__ = \"Alonso Vidales\"\n__email__ = \"alonso.vidales@tras2.es\"\n__date__ = \"2013-11-11\"\n\nclass ConnectedSets:\n \"\"\"\n This is a classic percolation problem, the algorithms uses an array\n of integer to represent tees, each tree will be a ...
true
6,651
1947bd280234189ed35277c449cd708a204ea7a4
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
[ "'''\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 WavyCloud\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, ...
false
6,652
87d1c28819d187944a3cf99b35b1d41eab11b139
# 1.Create a list of 10 elements of four different data types like int, string, complex and float. i=[1,2,3,4,5,6,7,8,9,10] f=[10.5,12.2,13.7,14.9,14.9,18.8,19.7,23.6,90.9,25.7] s=['Arpi','world','Hello','Python','Consultadd','job','c++','Concepts','interesting'] c=[1+2j,2+3j,4+5j,5+6j,56+7j,8+9j,7+8j,3+6j,7+9j] print...
[ "# 1.Create a list of 10 elements of four different data types like int, string, complex and float.\n\ni=[1,2,3,4,5,6,7,8,9,10]\nf=[10.5,12.2,13.7,14.9,14.9,18.8,19.7,23.6,90.9,25.7]\ns=['Arpi','world','Hello','Python','Consultadd','job','c++','Concepts','interesting']\nc=[1+2j,2+3j,4+5j,5+6j,56+7j,8+9j,7+8j,3+6j,7...
false
6,653
21172985bf36302f6b0b2101e353d9fbcafb0673
from typing import Dict, List, Sequence, Iterable, Tuple from allennlp.data.dataset_readers.dataset_reader import DatasetReader from allennlp.data.instance import Instance from allennlp.common.file_utils import cached_path import logging from overrides import overrides import itertools from allennlp.data.tokenizers imp...
[ "from typing import Dict, List, Sequence, Iterable, Tuple\nfrom allennlp.data.dataset_readers.dataset_reader import DatasetReader\nfrom allennlp.data.instance import Instance\nfrom allennlp.common.file_utils import cached_path\nimport logging\nfrom overrides import overrides\nimport itertools\nfrom allennlp.data.to...
false
6,654
51ff1181f0ddac3a8f7cbd9f9d2eedae29a6c559
from django.db import models from django.contrib.auth.models import User from django.db.models.deletion import CASCADE class Profile(models.Model): user = models.OneToOneField(User, on_delete=CASCADE) # portfolio = models.ManyToOneRel(User, on_delete=) def __str__(self): return f"{self.user.user...
[ "from django.db import models\nfrom django.contrib.auth.models import User\nfrom django.db.models.deletion import CASCADE\n\n\n\nclass Profile(models.Model):\n user = models.OneToOneField(User, on_delete=CASCADE)\n # portfolio = models.ManyToOneRel(User, on_delete=)\n\n def __str__(self):\n return f...
false
6,655
54c1b294d826deb43978591cad590c5e969bebd7
__author__ = 'Or'
[ "__author__ = 'Or'\n", "<assignment token>\n" ]
false
6,656
2458b8169029b3af501b650d548925770b0da74e
from django.contrib import admin from django.urls import path from petsApp import views urlpatterns = [ path('user/<int:id>/', views.getUser), path('user/addImage/', views.addImage), path('user/getImage/<int:id>/', views.getImage), path('user/signup/', views.signUp), path('user/login/', views.logI...
[ "\nfrom django.contrib import admin\nfrom django.urls import path\nfrom petsApp import views\n\nurlpatterns = [\n path('user/<int:id>/', views.getUser),\n path('user/addImage/', views.addImage),\n path('user/getImage/<int:id>/', views.getImage),\n path('user/signup/', views.signUp),\n path('user/logi...
false
6,657
c0376d94b34ea43e562e68cd65d4e5d2c5b04fb3
for name in ["Madan", "Mohan", "Reddy", "Govindu"]: print("My name includes "+name) # Tables # for i in range(1, 11): # for j in range(1, 11): # print("{0} * {1} = {2}".format(i,j, i*j)) # print("\n") for i in range(1, 3): for j in range(4, 7): if j==5: break print...
[ "for name in [\"Madan\", \"Mohan\", \"Reddy\", \"Govindu\"]:\n print(\"My name includes \"+name)\n\n# Tables\n# for i in range(1, 11):\n# for j in range(1, 11):\n# print(\"{0} * {1} = {2}\".format(i,j, i*j))\n# print(\"\\n\")\n\n\nfor i in range(1, 3):\n for j in range(4, 7):\n if j==5:...
false
6,658
555646a5d57152034b467cbce16b6c183bcfbb37
import copy from basics.binary_tree.binary_tree import TreeNode from basics.binary_tree.traversals import level_order_traversal def max_depth_bottom_up(root): if not root: return 0 max_so_far = 0 def max_depth(node, depth): nonlocal max_so_far if not node.left and not node.right...
[ "import copy\n\nfrom basics.binary_tree.binary_tree import TreeNode\nfrom basics.binary_tree.traversals import level_order_traversal\n\n\ndef max_depth_bottom_up(root):\n if not root:\n return 0\n\n max_so_far = 0\n\n def max_depth(node, depth):\n nonlocal max_so_far\n if not node.left...
false
6,659
fbba928d51ccd08dbac25fcf2098be3a0d494d34
ii = [('CoolWHM.py', 1), ('SoutRD.py', 1), ('BrewDTO.py', 2), ('FitzRNS2.py', 1), ('LyelCPG3.py', 1), ('TaylIF.py', 2)]
[ "ii = [('CoolWHM.py', 1), ('SoutRD.py', 1), ('BrewDTO.py', 2), ('FitzRNS2.py', 1), ('LyelCPG3.py', 1), ('TaylIF.py', 2)]", "ii = [('CoolWHM.py', 1), ('SoutRD.py', 1), ('BrewDTO.py', 2), (\n 'FitzRNS2.py', 1), ('LyelCPG3.py', 1), ('TaylIF.py', 2)]\n", "<assignment token>\n" ]
false
6,660
ad170f67e5b9f54d950ead91dd60cd4f3b753eca
from Config_paar import * from Envelopefkt import * from Kinematik import * def A_m_n(M,N,x_plus,p_el,p_pos,k_photon,k_laser): def f1(p): return -(m*a0)/(pk(p)) * g(phi,sigma,Envelope) *( pe(1,p) * cos(ksi) * cos(phi) + pe(2,p) * sin(ksi) * sin(phi) ) def f2(p): return -(m*a0)**2/(2....
[ "from Config_paar import *\nfrom Envelopefkt import *\nfrom Kinematik import *\n\n\ndef A_m_n(M,N,x_plus,p_el,p_pos,k_photon,k_laser):\n\n def f1(p):\n return -(m*a0)/(pk(p)) * g(phi,sigma,Envelope) *( pe(1,p) * cos(ksi) * cos(phi) + pe(2,p) * sin(ksi) * sin(phi) )\n \n def f2(p):\n retur...
true
6,661
619d2df45d0823930484f030a9a78e71ec718cb7
# -*- coding: utf-8 -*- from django.apps import AppConfig class AcademyConfig(AppConfig): name = 'academy' verbose_name = u"Академия"
[ "# -*- coding: utf-8 -*-\n\nfrom django.apps import AppConfig\n\n\nclass AcademyConfig(AppConfig):\n\tname = 'academy'\n\tverbose_name = u\"Академия\"\n", "from django.apps import AppConfig\n\n\nclass AcademyConfig(AppConfig):\n name = 'academy'\n verbose_name = u'Академия'\n", "<import token>\n\n\nclass ...
false
6,662
23d15c719cd26ea67a032a91a3e73f0d8d3bcfd1
from django.views import generic from .models import Project class IndexView(generic.ListView): template_name = "projects/index.html" context_object_name = "projectz" def get_queryset(self): """Return all projects.""" return Project.objects.all() class DetailView(generic.DetailView): ...
[ "from django.views import generic\n\nfrom .models import Project\n\n\nclass IndexView(generic.ListView):\n template_name = \"projects/index.html\"\n context_object_name = \"projectz\"\n\n def get_queryset(self):\n \"\"\"Return all projects.\"\"\"\n return Project.objects.all()\n\nclass Detail...
false
6,663
a3e655350fb5fe7999bea4a87fb62c7698fb63f1
from typing import List import tensorflow as tf from tensorflow.keras.layers import Dense """Possible agent network structures implemented as Tensorflow Modules""" class QNetwork: """Create the neural network architecture for the DQN agent.""" def __init__( self, state_dim: int, act...
[ "from typing import List\n\nimport tensorflow as tf\nfrom tensorflow.keras.layers import Dense\n\n\"\"\"Possible agent network structures implemented as Tensorflow Modules\"\"\"\n\n\nclass QNetwork:\n \"\"\"Create the neural network architecture for the DQN agent.\"\"\"\n\n def __init__(\n self,\n ...
false
6,664
2e1ad83bcd16f59338032f8ad5ca8ebd74e92200
from typing import Any, List __all__: List[str] record: Any recarray: Any format_parser: Any fromarrays: Any fromrecords: Any fromstring: Any fromfile: Any array: Any
[ "from typing import Any, List\n\n__all__: List[str]\n\nrecord: Any\nrecarray: Any\nformat_parser: Any\nfromarrays: Any\nfromrecords: Any\nfromstring: Any\nfromfile: Any\narray: Any\n", "from typing import Any, List\n__all__: List[str]\nrecord: Any\nrecarray: Any\nformat_parser: Any\nfromarrays: Any\nfromrecords: ...
false
6,665
8c6b7f29b8dca61a5218b51c85149c9642af5649
# -*- coding: utf-8 -*- from __future__ import unicode_literals from dynamic_rest import viewsets from django.shortcuts import render import os from rest_framework import permissions from rest_framework.response import Response from rest_framework.permissions import AllowAny from rest_framework.decorators import api_vi...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom dynamic_rest import viewsets\nfrom django.shortcuts import render\nimport os\nfrom rest_framework import permissions\nfrom rest_framework.response import Response\nfrom rest_framework.permissions import AllowAny\nfrom rest_framework.decorators ...
true
6,666
3d10f8810594303beb0ccabce3497de86149b2e5
from models import Person from models import Skeleton from models import Base_dolni from models import Dolen_vrata st = Person("Stoian") Stoian = Person("Ivanov") dolni = Skeleton(st, 900, 600, 2, 18, 28, 40) dolni_st = Skeleton(Stoian, 900, 590, 2, 18, 28, 40) dol_001 = Base_dolni(dolni_st, 550) dol_001.set_descrip...
[ "from models import Person\nfrom models import Skeleton\nfrom models import Base_dolni\nfrom models import Dolen_vrata\n\nst = Person(\"Stoian\")\nStoian = Person(\"Ivanov\")\n\ndolni = Skeleton(st, 900, 600, 2, 18, 28, 40)\ndolni_st = Skeleton(Stoian, 900, 590, 2, 18, 28, 40)\n\ndol_001 = Base_dolni(dolni_st, 550)...
false
6,667
b3c1843a742a82bca61650ab89ea8afdf3c9010d
from . import UbuntuPackageManager, RedHatPackageManager, SolarisPackageManager, RpmMixin from infi import unittest from infi.run_as_root import RootPermissions from contextlib import contextmanager from infi import pkgmgr from mock import patch import distro # pylint: disable-all class TestOnUbuntu(unittest.TestCa...
[ "from . import UbuntuPackageManager, RedHatPackageManager, SolarisPackageManager, RpmMixin\nfrom infi import unittest\n\nfrom infi.run_as_root import RootPermissions\nfrom contextlib import contextmanager\n\nfrom infi import pkgmgr\nfrom mock import patch\nimport distro\n# pylint: disable-all\n\n\nclass TestOnUbunt...
false
6,668
a0059563b2eed4ca185a8e0971e8e0c80f5fb8f8
import random import copy random.seed(42) import csv import torch import time import statistics import wandb from model import Net, LinearRegression, LogisticRegression def byGuide(data, val=None, test=None): val_guides = val if val == None: val_guides = [ "GGGTGGGGGGAGTTTGCTCCTGG", "GA...
[ "import random\nimport copy\nrandom.seed(42)\nimport csv\nimport torch\nimport time\nimport statistics\nimport wandb\nfrom model import Net, LinearRegression, LogisticRegression\n\ndef byGuide(data, val=None, test=None):\n val_guides = val\n if val == None:\n val_guides = [\n \"GGGTGGGGGGAGTTTGC...
false
6,669
777dc2056443f0404ccb75d570f2ddc3a3aa747b
import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select import Select from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions class TestTa...
[ "import time\n\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver.support.select import Select\nfrom selenium.webdriver.support.wait import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions\n\...
false
6,670
8cd54362680aa3a96babe100b9231f6f16b3f577
import librosa import soundfile import os, glob import numpy as np from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from sklearn.metrics import accuracy_score emotionsRavdessData = { '01': 'neutral', '02': 'calm', '03': 'happy', '04': 'sad', '05'...
[ "import librosa\nimport soundfile\nimport os, glob\nimport numpy as np\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.neural_network import MLPClassifier\nfrom sklearn.metrics import accuracy_score\n\nemotionsRavdessData = {\n '01': 'neutral',\n '02': 'calm',\n '03': 'happy',\n '04'...
false
6,671
db309283137383cd698f235e7326c6e5c50f6cf3
from django.urls import path, include from rest_framework.routers import SimpleRouter from board_api.views import PostViewSet, UpvoteView, CommentViewSet router = SimpleRouter() router.register(r"post", PostViewSet) router.register(r"post_upvote", UpvoteView) router.register(r"comment", CommentViewSet) urlpatterns ...
[ "from django.urls import path, include\nfrom rest_framework.routers import SimpleRouter\n\nfrom board_api.views import PostViewSet, UpvoteView, CommentViewSet\n\nrouter = SimpleRouter()\n\nrouter.register(r\"post\", PostViewSet)\nrouter.register(r\"post_upvote\", UpvoteView)\nrouter.register(r\"comment\", CommentVi...
false
6,672
113572682ca83408b7c22e0e178f29945d741142
from ..lib import read_input, write_output def link_bits(num: str = None, bit_i: str = '0', bit_j: str = '0', write: bool = True) -> int: if num is None: num, bit_i, bit_j = read_input() num = int(num, 2) num_len = num.bit_length() mask = 2 ** num_len - 1 first_i = (num >> (num_len - int(b...
[ "from ..lib import read_input, write_output\n\n\ndef link_bits(num: str = None, bit_i: str = '0', bit_j: str = '0', write: bool = True) -> int:\n if num is None:\n num, bit_i, bit_j = read_input()\n num = int(num, 2)\n num_len = num.bit_length()\n mask = 2 ** num_len - 1\n first_i = (num >> (n...
false
6,673
b8219c21dc2cdd497d3de48c59c146a1fd1509ec
# leetcode 718 最长重复子数组 # 给两个整数数组 A 和 B ,返回两个数组中公共的、长度最长的子数组的长度。 # # 示例 1: # 输入: # A: [1,2,3,2,1] # B: [3,2,1,4,7] # 输出: 3 # 解释: # 长度最长的公共子数组是 [3, 2, 1]。 # # 说明: # 1 <= len(A), len(B) <= 1000 # 0 <= A[i], B[i] < 100 class Solution: def findLength(self, A: [int], B: [int])->int: """ 动态规划, 维护...
[ "# leetcode 718 最长重复子数组\n# 给两个整数数组 A 和 B ,返回两个数组中公共的、长度最长的子数组的长度。\n#\n# 示例 1:\n# 输入:\n# A: [1,2,3,2,1]\n# B: [3,2,1,4,7]\n# 输出: 3\n# 解释:\n# 长度最长的公共子数组是 [3, 2, 1]。\n#\n# 说明:\n# 1 <= len(A), len(B) <= 1000\n# 0 <= A[i], B[i] < 100\n\n\nclass Solution:\n def findLength(self, A: [int], B: [int])->int:\n ...
false
6,674
7864138459caf469a0148420718b2282598141de
#!/usr/bin/env python # coding: utf-8 import sys sys.path.insert(0, "/code/huggingface/transformers-fair-wmt/src") import logging logging.disable(logging.INFO) # disable INFO and DEBUG logger everywhere from transformers.tokenization_fsmt import FSMTTokenizer from transformers.modeling_fsmt import FSMTForConditional...
[ "#!/usr/bin/env python\n# coding: utf-8\n\nimport sys\nsys.path.insert(0, \"/code/huggingface/transformers-fair-wmt/src\")\n\nimport logging\nlogging.disable(logging.INFO) # disable INFO and DEBUG logger everywhere\n\nfrom transformers.tokenization_fsmt import FSMTTokenizer\nfrom transformers.modeling_fsmt import F...
false
6,675
e79e4eb1640d5ad6e360dfb18430fbf261cf9d3b
# encoding=utf-8 ###### # 遗传算法应用于旅行商问题(TSP) # Python 3.6 # https://morvanzhou.github.io/tutorials/machine-learning/evolutionary-algorithm/2-03-genetic-algorithm-travel-sales-problem/ ######
[ "# encoding=utf-8\n\n######\n# 遗传算法应用于旅行商问题(TSP)\n# Python 3.6\n# https://morvanzhou.github.io/tutorials/machine-learning/evolutionary-algorithm/2-03-genetic-algorithm-travel-sales-problem/\n######\n\n", "" ]
false
6,676
287d4c2d490c9dcdd7be7e86fe577139a3d30f54
a=list(input("enter the string or sentence to perform caesar cipher : ")) b=int(input('enter the frequency to perform ceasar cipher ')) e=[] #print(a) #print (a[4]) c=len(a) #print(c) for i in range (0,c): d=ord(a[i]) #print(d) if b> 0: for j in range (1,b+1): if a[i] >='a' ...
[ "a=list(input(\"enter the string or sentence to perform caesar cipher : \"))\r\nb=int(input('enter the frequency to perform ceasar cipher '))\r\ne=[]\r\n#print(a)\r\n#print (a[4])\r\nc=len(a)\r\n#print(c)\r\nfor i in range (0,c):\r\n d=ord(a[i])\r\n #print(d)\r\n if b> 0:\r\n for j in range (1,b+1):...
false
6,677
4744d594c0599f1aa807eefa0cb40a2a2a3c7926
import io import json import sys import time from coord_tools import get_elevation if len(sys.argv) != 3: print('Wrong number of arguments! Exiting.') infile_name = sys.argv[1] outfile_name = sys.argv[2] # Declare dict to hold coordinates node_coords = {} fail_count = 0 nodes_processed = 0 # Read in each node fro...
[ "import io\nimport json\nimport sys\nimport time\n\nfrom coord_tools import get_elevation\n\nif len(sys.argv) != 3:\n\tprint('Wrong number of arguments! Exiting.')\n\ninfile_name = sys.argv[1]\noutfile_name = sys.argv[2]\n\n# Declare dict to hold coordinates\nnode_coords = {}\nfail_count = 0\nnodes_processed = 0\n\...
false
6,678
f4ae34be2be2b47b3394e6da751c53c51a1c3174
#!/usr/local/bin/python3 """ Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain th...
[ "#!/usr/local/bin/python3\n\n\"\"\"\n Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source co...
false
6,679
be5147efda879165107378527ebf44890c03be75
import numpy as np z = np.linspace(2,10,5) #from 2 to 10, with 5 elements # OUT: array( [ 2. , 4. , 6. , 8. , 10. ] ) np.random.seed(0) z1 = np.random.randint(10, size = 6) # OUT: array( [5, 0, 3, 3, 7, 9] ) z = np.array([1,2,3,4,5]) z < 3 # OUT: array([T,T,F,F,F]) z[z<3] # OUT: array([1,2]) a = np.array([1,2,3,4,...
[ "import numpy as np\n\n\nz = np.linspace(2,10,5) #from 2 to 10, with 5 elements\n# OUT: array( [ 2. , 4. , 6. , 8. , 10. ] )\n\nnp.random.seed(0)\nz1 = np.random.randint(10, size = 6)\n# OUT: array( [5, 0, 3, 3, 7, 9] )\n\nz = np.array([1,2,3,4,5])\nz < 3\n# OUT: array([T,T,F,F,F])\nz[z<3]\n# OUT: array([1,2])\n\na...
false
6,680
47f6c4b3c279a065b8f21dab2faa71271db8d6ab
from django.db import models from datetime import datetime # Message model for testing purposes class Message(models.Model): type = models.CharField(max_length=10) body = models.CharField(max_length=50) def __str__(self): return self.type + ":" + self.body # Company model class Co...
[ "from django.db import models\r\nfrom datetime import datetime\r\n\r\n\r\n# Message model for testing purposes\r\nclass Message(models.Model):\r\n type = models.CharField(max_length=10)\r\n body = models.CharField(max_length=50)\r\n\r\n def __str__(self):\r\n return self.type + \":\" + self.body\r\n...
false
6,681
a6617934c5e6527cf59225a5d159d1ce8a33db50
import http.client import json conn = http.client.HTTPSConnection("v3.football.api-sports.io") headers = { 'x-rapidapi-host': "v3.football.api-sports.io", 'x-rapidapi-key': "" } conn.request("GET", "/teams/statistics?season=2016&team=768&league=4", headers=headers) res = conn.getresponse() data = res.re...
[ "import http.client\nimport json\n\nconn = http.client.HTTPSConnection(\"v3.football.api-sports.io\")\n\nheaders = {\n 'x-rapidapi-host': \"v3.football.api-sports.io\",\n 'x-rapidapi-key': \"\"\n }\n\nconn.request(\"GET\", \"/teams/statistics?season=2016&team=768&league=4\", headers=headers)\n\nres = conn....
false
6,682
2f714ed54a19ec26d7ecb1979e79366721b3d0fe
import matplotlib.pyplot as plt import numpy as np # 描画用サンプルデータ #x= np.array([0,1,2,3,4]) y = np.array([2, 2, 3, 4, 5]) print(y) #print(range(y)) plt.figure(figsize=(10,1)) plt.bar(range(len(y)), y) plt.savefig('test.png') plt.clf()
[ "import matplotlib.pyplot as plt\nimport numpy as np\n# 描画用サンプルデータ\n#x= np.array([0,1,2,3,4])\ny = np.array([2, 2, 3, 4, 5])\nprint(y)\n#print(range(y))\n\nplt.figure(figsize=(10,1))\nplt.bar(range(len(y)), y)\nplt.savefig('test.png')\nplt.clf()", "import matplotlib.pyplot as plt\nimport numpy as np\ny = np.array...
false
6,683
9cff227eeeaffda777668aa3b90e3839426da811
import tkinter as tk import classejogo class Tabuleiro(): def __init__(self): self.jogo = classejogo.Jogo() self.window = tk.Tk() self.window.title("Jogo da Velha") self.window.geometry("300x360+100+100") self.window.rowconfigure(0, minsize=30, weight=1) self.window...
[ "import tkinter as tk\nimport classejogo\n\n\nclass Tabuleiro():\n def __init__(self):\n self.jogo = classejogo.Jogo()\n self.window = tk.Tk()\n self.window.title(\"Jogo da Velha\")\n self.window.geometry(\"300x360+100+100\")\n self.window.rowconfigure(0, minsize=30, weight=1)\...
false
6,684
4a118f9081a8b3baf0b074c8dc14eaeef4559c08
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Author', fields=[ ('id', models...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport datetime\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Author',\n fields=[\n ...
false
6,685
cc5b22a0246fcc9feaed6a0663095a6003e6cef1
import json, re, bcrypt, jwt from datetime import datetime, timedelta from django.core.exceptions import ObjectDoesNotExist from django.db.models import Avg from django.http import JsonResponse from django.views import View from room.models import Room, Category, Ro...
[ "import json, re, bcrypt, jwt\n\nfrom datetime import datetime, timedelta\n\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db.models import Avg\nfrom django.http import JsonResponse\nfrom django.views import View\nfrom room.models import Room,...
false
6,686
041f1d7c482fe4f65e8cc5a508da62ee6ccf59ff
from ...routes import Route from .providers import SQSProvider from .message_translators import SQSMessageTranslator, SNSMessageTranslator class SQSRoute(Route): def __init__(self, provider_queue, provider_options=None, *args, **kwargs): provider_options = provider_options or {} provider = SQSProv...
[ "from ...routes import Route\nfrom .providers import SQSProvider\nfrom .message_translators import SQSMessageTranslator, SNSMessageTranslator\n\n\nclass SQSRoute(Route):\n def __init__(self, provider_queue, provider_options=None, *args, **kwargs):\n provider_options = provider_options or {}\n provi...
false
6,687
20e5220ce23aaaedbfafe599b352f5d3a220e82e
from django.db import models class faculdades(models.Model): codigo = models.IntegerField(primary_key = True) nome = models.CharField(max_length=50) cidade = models.CharField(max_length=30) estado = models.CharField(max_length=20) pais = models.CharField(max_length=20) def __str__(self): ...
[ "from django.db import models\n\nclass faculdades(models.Model):\n codigo = models.IntegerField(primary_key = True)\n nome = models.CharField(max_length=50)\n cidade = models.CharField(max_length=30)\n estado = models.CharField(max_length=20)\n pais = models.CharField(max_length=20)\n \n def __...
false
6,688
9f40162348d33d70639692dac87777a2799999e9
#!/usr/bin/env python from ks_auth import sess from ks_auth import trust_auth from ks_auth import ks from ks_auth import utils from novaclient import client import novaclient.exceptions from time import sleep from uuid import uuid4 import sys # RDTIBCC-1042 VERSION = '2' nova = client.Client(VERSION, session=sess) u...
[ "#!/usr/bin/env python\nfrom ks_auth import sess\nfrom ks_auth import trust_auth\nfrom ks_auth import ks\nfrom ks_auth import utils\nfrom novaclient import client\nimport novaclient.exceptions\nfrom time import sleep\nfrom uuid import uuid4\nimport sys\n\n# RDTIBCC-1042\n\nVERSION = '2'\nnova = client.Client(VERSIO...
true
6,689
8e9db58488f6ee8aa0d521a19d9d89504d119076
tp = 1, 2, 3 print(tp + (4,))
[ "tp = 1, 2, 3\r\nprint(tp + (4,))\r\n", "tp = 1, 2, 3\nprint(tp + (4,))\n", "<assignment token>\nprint(tp + (4,))\n", "<assignment token>\n<code token>\n" ]
false
6,690
28cdb59e97f3052dd80f8437574f9ffe09fc1e84
from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.model_selection import StratifiedShuffleSplit from sklearn.metrics import classification_report from BlogTutorials.pyimagesearch.preprocessing.imagetoarraypreprocessor import ImageToArrayPreprocessor from Bl...
[ "from sklearn.preprocessing import LabelEncoder\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.model_selection import StratifiedShuffleSplit\nfrom sklearn.metrics import classification_report\nfrom BlogTutorials.pyimagesearch.preprocessing.imagetoarraypreprocessor import ImageToArrayPreprocesso...
false
6,691
d340ac979f57cf4650131665e4fa5b9923f22a3e
from collections.abc import Iterator import json import click def print_json(obj, err=False): if isinstance(obj, Iterator): obj = list(obj) click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False), err=err) def show_fields(*fields): def show(obj, verbose=False): ...
[ "from collections.abc import Iterator\nimport json\nimport click\n\ndef print_json(obj, err=False):\n if isinstance(obj, Iterator):\n obj = list(obj)\n click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False),\n err=err)\n\ndef show_fields(*fields):\n def show(obj, ve...
false
6,692
792f62c72f1667f651567314b062d862abbc9aa5
# created by Angus Clark 9/2/17 updated 27/2/17 # ToDo impliment traceroute function into this # Perhaps get rid of unnecessary itemediate temp file import socket import os import json import my_traceroute s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = '130.56.253.43' #print host port = 5201 # Change ...
[ "# created by Angus Clark 9/2/17 updated 27/2/17\n# ToDo impliment traceroute function into this \n# Perhaps get rid of unnecessary itemediate temp file\n\nimport socket\nimport os\nimport json\nimport my_traceroute\n\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM) \nhost = '130.56.253.43'\n#print host\nport...
false
6,693
3d16f2da03c067d410bec7bfe96d874322533d30
import numpy d1 = numpy.array([1.,0.,0.]) d2 = numpy.array([0.,1.,0.]) d3 = numpy.array([0.,0.,1.]) s0 = numpy.array([0.,0.,1.]) m2 = numpy.array([1.,0.,0.]) print "x y zeta" for x in xrange(-100, 101): for y in xrange(-100, 101): s = x*d1 + y*d2 + 100*d3 e1 = numpy.cross(s, s0) e1 /= numpy.linalg.norm(...
[ "import numpy\n\nd1 = numpy.array([1.,0.,0.])\nd2 = numpy.array([0.,1.,0.])\nd3 = numpy.array([0.,0.,1.])\ns0 = numpy.array([0.,0.,1.])\nm2 = numpy.array([1.,0.,0.])\n\nprint \"x y zeta\"\nfor x in xrange(-100, 101):\n for y in xrange(-100, 101):\n s = x*d1 + y*d2 + 100*d3\n e1 = numpy.cross(s, s0)\n e1 /...
true
6,694
5fa91a5061a5e87a4a2b8fece0378299e87e5a48
# Interprets the AST class Program: def __init__(self, code): self.code = code def eval(self, binding): return self.code.eval(binding) class Code: def __init__(self, statements): self.statements = statements def eval(self, binding): val = 0 for statement in ...
[ "# Interprets the AST\n\n\nclass Program:\n def __init__(self, code):\n self.code = code\n\n def eval(self, binding):\n return self.code.eval(binding)\n\n\nclass Code:\n def __init__(self, statements):\n self.statements = statements\n\n def eval(self, binding):\n val = 0\n ...
false
6,695
3457a7c080da041ad279239bd6a3d214a3b8e49f
""" Routes and views for the flask application. """ from datetime import datetime from flask import render_template, redirect, url_for, request, jsonify from athena_App import app from athena_App.formClass import QuestionForm import time #attention: #this module include large word vector which need a lot of time to ...
[ "\"\"\"\nRoutes and views for the flask application.\n\"\"\"\n\nfrom datetime import datetime\nfrom flask import render_template, redirect, url_for, request, jsonify\nfrom athena_App import app\nfrom athena_App.formClass import QuestionForm\n\nimport time\n\n#attention:\n#this module include large word vector which...
false
6,696
afecbb46a98fbf6b5c26f5b6c8026aec035fadf1
from typing import List, Tuple from unittest import TestCase from solutions.python.common.timing import decompose, parse_decomposed_duration, format_duration class TestTiming(TestCase): def test_decompose_ns(self): # Given duration: int = 234 # When decomposition: List[Tuple[int...
[ "from typing import List, Tuple\nfrom unittest import TestCase\n\nfrom solutions.python.common.timing import decompose, parse_decomposed_duration, format_duration\n\n\nclass TestTiming(TestCase):\n\n def test_decompose_ns(self):\n # Given\n duration: int = 234\n\n # When\n decompositi...
false
6,697
be69a9981fe6b53c3b9c4d2893913e4f9f7efb26
from google.cloud import vision from google.cloud.vision import types from google.oauth2 import service_account import os # import re import io import pdf2image import tempfile import datetime # Google API credentials = service_account.Credentials.from_service_account_file("APIKey.json") client = vision.ImageAnnot...
[ "from google.cloud import vision\nfrom google.cloud.vision import types\nfrom google.oauth2 import service_account\n\n\nimport os\n# import re\nimport io\n\nimport pdf2image\nimport tempfile\nimport datetime\n\n\n# Google API\ncredentials = service_account.Credentials.from_service_account_file(\"APIKey.json\")\ncli...
false
6,698
ad1ec5dd8fae290ab6cb73b17c5522e062261359
import os import inspect import pytest from ._common import copy_default_profile_collection, patch_first_startup_file from bluesky_queueserver.manager.profile_tools import global_user_namespace, load_devices_from_happi from bluesky_queueserver.manager.profile_ops import load_profile_collection def create_local_impor...
[ "import os\nimport inspect\nimport pytest\n\nfrom ._common import copy_default_profile_collection, patch_first_startup_file\nfrom bluesky_queueserver.manager.profile_tools import global_user_namespace, load_devices_from_happi\nfrom bluesky_queueserver.manager.profile_ops import load_profile_collection\n\n\ndef crea...
false
6,699
835beebe452a252fb744a06d3e6ff221469af6bf
data = [] ##用來裝reviews.txt的留言 count = 0 ##計數目前檔案讀取到第幾筆 with open('reviews.txt', 'r') as f: for line in f: data.append(line) count += 1 if count % 1000 == 0: print(len(data)) total = len(data) print('檔案讀取完了,總共有', len(data), '筆資料') print(len(data)) #印出data串列的--項目數量 print(le...
[ "data = [] ##用來裝reviews.txt的留言\ncount = 0 ##計數目前檔案讀取到第幾筆\n\nwith open('reviews.txt', 'r') as f:\n for line in f:\n data.append(line)\n count += 1\n if count % 1000 == 0:\n print(len(data))\ntotal = len(data)\nprint('檔案讀取完了,總共有', len(data), '筆資料')\n\nprint(len(data)) #印出data串...
true