index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
5,300
39f1595374147c71bc2d4c945a0f1149891f1883
import cx_Oracle import datetime SDATE = '01.01.2014' FDATE = '01.01.2020' #p.PRESZAB, #GDR_RATE.RFLUID, #p.NRES #join GDR_RATE on GDR_RATE.IDWELL = p.IDWELL and GDR_RATE.DTBGN = p.DTBGN and GDR_RATE.NRES = p.NRES) pbu_query_raw = f""" select WELLNAME, DTBGN, DPDEVICE, (TVDSS-(MD - DPDEVICE)*...
[ "import cx_Oracle\nimport datetime\n\nSDATE = '01.01.2014'\nFDATE = '01.01.2020'\n\n#p.PRESZAB, \n#GDR_RATE.RFLUID, \n#p.NRES \n#join GDR_RATE on GDR_RATE.IDWELL = p.IDWELL and GDR_RATE.DTBGN = p.DTBGN and GDR_RATE.NRES = p.NRES)\n\npbu_query_raw = f\"\"\"\nselect \n WELLNAME,\n DTBGN,\n DPDEVICE,\n ...
false
5,301
97afa67cbe20900e2388994481abebe772e22818
import pandas as pd triples = pd.read_csv("SollTripel.csv", sep=",", skip_blank_lines=True, skipinitialspace=True) triples.columns = ["triple", "found"] triples = triples["#" not in triples.triple] print(triples)
[ "import pandas as pd\n\ntriples = pd.read_csv(\"SollTripel.csv\", sep=\",\", skip_blank_lines=True, skipinitialspace=True)\ntriples.columns = [\"triple\", \"found\"]\ntriples = triples[\"#\" not in triples.triple]\n\nprint(triples)", "import pandas as pd\ntriples = pd.read_csv('SollTripel.csv', sep=',', skip_blan...
false
5,302
f52bac3e658a34b82721746364fab11d25d470c4
from .VimaptException import VimaptException class VimaptAbortOperationException(VimaptException): pass
[ "from .VimaptException import VimaptException\n\n\nclass VimaptAbortOperationException(VimaptException):\n pass\n", "<import token>\n\n\nclass VimaptAbortOperationException(VimaptException):\n pass\n", "<import token>\n<class token>\n" ]
false
5,303
251d589a5815d77d2bc375d8d4a7d41e79a2a5cd
# Mostra entre as 7 pessoas, quantas pessoas são maiores de idade. num1 = 0 for c in range(0,7): pe1 = int(input('Digite o ano de nascimento: ')) pe1 = 2019 - pe1 if pe1 >= 21: num1 = num1 + 1 print(f'Entre as 7 pessoas, {num1} pessoas são maiores de idade.')
[ "# Mostra entre as 7 pessoas, quantas pessoas são maiores de idade.\r\n\r\n\r\nnum1 = 0\r\nfor c in range(0,7):\r\n pe1 = int(input('Digite o ano de nascimento: '))\r\n pe1 = 2019 - pe1\r\n if pe1 >= 21:\r\n num1 = num1 + 1\r\nprint(f'Entre as 7 pessoas, {num1} pessoas são maiores de idade.')", "n...
false
5,304
941dac77fe60081ffa113c437a356d59837f5883
from collections import OrderedDict as odict from vent.gui import styles MONITOR = odict({ 'oxygen': { 'name': 'O2 Concentration', 'units': '%', 'abs_range': (0, 100), 'safe_range': (60, 100), 'decimals' : 1 }, 'temperature': { ...
[ "from collections import OrderedDict as odict\n\nfrom vent.gui import styles\n\nMONITOR = odict({\n 'oxygen': {\n 'name': 'O2 Concentration',\n 'units': '%',\n 'abs_range': (0, 100),\n 'safe_range': (60, 100),\n 'decimals' : 1\n },\n 'tempe...
false
5,305
8247b045a5aed4d0f3db6bc2c0edd985f2c4ba30
import os def get_os_env_value(key): return os.getenv(key) def get_mysql_uri(user, password, host, database): return f'mysql+pymysql://{user}:{password}@{host}/{database}' MASTER_MYSQL_DATABASE_USER = get_os_env_value('MASTER_MYSQL_DATABASE_USER') MASTER_MYSQL_DATABASE_PASSWORD = get_os_env_value('MASTER_...
[ "import os\n\n\ndef get_os_env_value(key):\n return os.getenv(key)\n\n\ndef get_mysql_uri(user, password, host, database):\n return f'mysql+pymysql://{user}:{password}@{host}/{database}'\n\n\nMASTER_MYSQL_DATABASE_USER = get_os_env_value('MASTER_MYSQL_DATABASE_USER')\nMASTER_MYSQL_DATABASE_PASSWORD = get_os_e...
false
5,306
59de17ea4e714e17e3a7dd966bd0d93ba73f4503
#!/usr/bin/env python from pymongo import GEO2D from GlobalConfigs import eateries eateries.create_index([("eatery_coordinates", GEO2D)]) eateries.ensure_index([("eatery_coordinates", pymongo.GEOSPHERE)]) for e in eateries.find({"eatery_coordinates": {"$near": [latitude, longitude]}}).limit(5): print e.get...
[ "#!/usr/bin/env python\n\nfrom pymongo import GEO2D\nfrom GlobalConfigs import eateries\n\neateries.create_index([(\"eatery_coordinates\", GEO2D)]) \neateries.ensure_index([(\"eatery_coordinates\", pymongo.GEOSPHERE)])\n\nfor e in eateries.find({\"eatery_coordinates\": {\"$near\": [latitude, longitude]}}).limit(5)...
true
5,307
4dea0967a0ee3e9eb3b46145739dfeb233f3a120
''' Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for...
[ "'''\nTrolls are attacking your comment section!\n\nA common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat.\n\nYour task is to write a function that takes a string and return a new string with all vowels removed.\n\nFor example, the string \"This w...
false
5,308
5ab20c1cd2dc0d0ad881ee52008d00c2317084f9
from django.db import models # Create your models here. class Position(models.Model): title = models.CharField(max_length=50) def __str__(self): return self.title class Employee(models.Model): nom = models.CharField(max_length=100) prenom = models.CharField(max_length=100) age= models.Cha...
[ "from django.db import models\n\n# Create your models here.\nclass Position(models.Model):\n title = models.CharField(max_length=50)\n\n def __str__(self):\n return self.title\n\nclass Employee(models.Model):\n nom = models.CharField(max_length=100)\n prenom = models.CharField(max_length=100)\n ...
false
5,309
d5acda0d5d066d381a7f6310eb4fe6280d7e84de
import unittest from collections import Counter class Solution(object): def findOriginalArray(self, changed): """ :type changed: List[int] :rtype: List[int] """ n = len(changed) if n % 2 != 0: return [] freq = Counter(changed) changed.s...
[ "import unittest\nfrom collections import Counter\n\n\nclass Solution(object):\n def findOriginalArray(self, changed):\n \"\"\"\n :type changed: List[int]\n :rtype: List[int]\n \"\"\"\n n = len(changed)\n\n if n % 2 != 0:\n return []\n\n freq = Counter(...
false
5,310
0b3d6339faf9d66d4e1338599e4784fac0f63d3f
def solution(citations): # 사이테이션을 정렬 citations.sort() # for i in range(len(citations)): if citations[i] >= len(citations) - i: return len(citations)-i print(solution([3,0,6,1,5]))
[ "def solution(citations):\n # 사이테이션을 정렬\n citations.sort()\n # \n for i in range(len(citations)):\n if citations[i] >= len(citations) - i: \n return len(citations)-i \n\n\nprint(solution([3,0,6,1,5]))", "def solution(citations):\n citations.sort()\n for i in range(len(citations)):\n if ci...
false
5,311
12f035962925c5380c782e8fad23f16fe9fb9435
#cerner_2^5_2019 #Mason Seeger submission 1 from random import randint as r import operator as o #Only works with valid integers. A function for quick math brain training. def randomMath(): correct = 0 while(correct<10): str_ops = ['+', '-', '*', '/', '%'] ops = {'+': o.add, '-': o.sub, '*': o...
[ "#cerner_2^5_2019\n#Mason Seeger submission 1\n\nfrom random import randint as r\nimport operator as o\n\n#Only works with valid integers. A function for quick math brain training.\ndef randomMath():\n correct = 0\n while(correct<10):\n str_ops = ['+', '-', '*', '/', '%']\n ops = {'+': o.add, '-...
false
5,312
dc13ca17bff8e2a5254c7758bd7274926bafd454
from dataclasses import dataclass from datetime import date @dataclass class Book: id: int title: str author: str genre: str published: date status: str = 'Available' def __str__(self): return f'{self.id}: {self.title} by {self.author}' def get_more_information(self): ...
[ "from dataclasses import dataclass\nfrom datetime import date\n\n\n@dataclass\nclass Book:\n id: int\n title: str\n author: str\n genre: str\n published: date\n status: str = 'Available'\n\n def __str__(self):\n return f'{self.id}: {self.title} by {self.author}'\n\n def get_more_infor...
false
5,313
bc53af24bb46d2be3122e290c4732b312f4ebdf5
from get_info import parse_matches as pm def all_match_data(year): """ Searches through the parse_matches data for all games in a specific season prints them out with a game ID and returns the data in a list to the main program :param year: Specific format YYYY between 2008 - 2017 :return: year_ma...
[ "from get_info import parse_matches as pm\n\n\ndef all_match_data(year):\n \"\"\"\n Searches through the parse_matches data for all games in a specific season prints them out with a game ID and\n returns the data in a list to the main program\n :param year: Specific format YYYY between 2008 - 2017\n ...
false
5,314
422873f89468b1faabed96f72f463b6294b85276
# Generated by Django 3.0.5 on 2020-05-12 13:26 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='idcard', fields=[ ('id', models.AutoField(a...
[ "# Generated by Django 3.0.5 on 2020-05-12 13:26\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='idcard',\n fields=[\n ('id...
false
5,315
97e7ca02d85267492a0dcbbda9d8754a0a3735a5
from core.detector import Detector from utils.augmentations import * from torchvision.transforms.transforms import Compose from config.mask_config import * from config.train_config import model_info np.random.seed(3) colors = np.random.randint(128, 256, (100, 3)) def to_image(det): size = 512 val_trans = [...
[ "from core.detector import Detector\nfrom utils.augmentations import *\nfrom torchvision.transforms.transforms import Compose\nfrom config.mask_config import *\nfrom config.train_config import model_info\n\n\nnp.random.seed(3)\ncolors = np.random.randint(128, 256, (100, 3))\n\n\ndef to_image(det):\n size = 512\n...
false
5,316
084579152a2cc7feb2c31e0209ce1e32f4905d81
import chars2vec import sklearn.decomposition import matplotlib.pyplot as plt import csv # Load Inutition Engineering pretrained model # Models names: 'eng_50', 'eng_100', 'eng_150' 'eng_200', 'eng_300' from sklearn.cluster import KMeans c2v_model = chars2vec.load_model('eng_50') words=[] etichette=[] with open('da...
[ "import chars2vec\nimport sklearn.decomposition\nimport matplotlib.pyplot as plt\nimport csv\n\n# Load Inutition Engineering pretrained model\n# Models names: 'eng_50', 'eng_100', 'eng_150' 'eng_200', 'eng_300'\nfrom sklearn.cluster import KMeans\n\nc2v_model = chars2vec.load_model('eng_50')\n\nwords=[]\netichette=...
false
5,317
f225fbf363f1b170704418ed339f2e57ca790975
from django import forms from django.utils.translation import gettext_lazy as _ import django_filters from elasticsearch_dsl.query import Q class BaseSearchFilterSet(django_filters.FilterSet): query_fields = ["content"] q = django_filters.CharFilter( method="auto_query", widget=forms.TextInp...
[ "from django import forms\nfrom django.utils.translation import gettext_lazy as _\n\nimport django_filters\nfrom elasticsearch_dsl.query import Q\n\n\nclass BaseSearchFilterSet(django_filters.FilterSet):\n query_fields = [\"content\"]\n\n q = django_filters.CharFilter(\n method=\"auto_query\",\n ...
false
5,318
e3b8bec0cc7df217052a3182f9a862f0e3622afd
#!python import pdb import argparse import os import re import sys import string from utilpack import path from subprocess import Popen from subprocess import PIPE def popen(cmd): spl = cmd.split() return Popen(spl, stdout=PIPE).communicate()[0] def debug (s): s dists = 0 def get_setup_ini (setup_in...
[ "#!python\nimport pdb\nimport argparse\nimport os\nimport re\nimport sys\nimport string\nfrom utilpack import path\nfrom subprocess import Popen\nfrom subprocess import PIPE\n\n\ndef popen(cmd):\n spl = cmd.split()\n return Popen(spl, stdout=PIPE).communicate()[0]\n \ndef debug (s):\n s\n\ndists = 0\nde...
true
5,319
833053a5a75636267feaad5ddaa21dce1de34038
#!/usr/bin/env python """ maskAOI.py Dan Fitch 20150618 """ from __future__ import print_function import sys, os, glob, shutil, fnmatch, math, re, numpy, csv from PIL import Image, ImageFile, ImageDraw, ImageColor, ImageOps, ImageStat ImageFile.MAXBLOCK = 1048576 DEBUG = False AOI_DIR='/study/reference/public/IAP...
[ "#!/usr/bin/env python\n\n\"\"\"\nmaskAOI.py\n\nDan Fitch 20150618\n\"\"\"\n\nfrom __future__ import print_function\n\nimport sys, os, glob, shutil, fnmatch, math, re, numpy, csv\nfrom PIL import Image, ImageFile, ImageDraw, ImageColor, ImageOps, ImageStat\nImageFile.MAXBLOCK = 1048576\n\nDEBUG = False\n\nAOI_DIR='...
false
5,320
faa53db9dd581b6508fb9e4042ec86ebaf850e60
from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score print(accuracy_score(true_labels, guesses)) print(recall_score(true_labels, guesses)) print(precision_score(true_labels, guesses)) print(f1_score(true_labels, guesses)) from sklearn.metrics import confusion_matrix print(confusion_mat...
[ "from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score\n\nprint(accuracy_score(true_labels, guesses))\nprint(recall_score(true_labels, guesses))\nprint(precision_score(true_labels, guesses))\nprint(f1_score(true_labels, guesses))\n\nfrom sklearn.metrics import confusion_matrix\n\nprint...
false
5,321
d5a31e53444e2efa2eb972f1152b6d3e37d5ab79
aminotable = [ ['Ile' , 'AUU','AUC','AUA'], #0 ['Leu' , 'CUU','CUC','CUA','CUG','UUA','UUG'], #1 ['Val' , 'GUU','GUC','GUA','GUG'], #2 ['Phe' , 'UUU','UUC'], #3 ['Met' , 'AUG'], ...
[ "aminotable = [\r\n ['Ile' , 'AUU','AUC','AUA'], #0\r\n ['Leu' , 'CUU','CUC','CUA','CUG','UUA','UUG'], #1\r\n ['Val' , 'GUU','GUC','GUA','GUG'], #2\r\n ['Phe' , 'UUU','UUC'], #3\r\n ['Met' , 'AUG'], ...
false
5,322
436b89b91aed14525f847e6488b452b7ca0e1b70
from enum import Enum class AggregationTypes(Enum): NO_AGG = 'NO-AGG' STATIC = 'STATIC' SUB_HOUR = 'SUB-HOUR' DYNAMIC = 'DYNAMIC'
[ "from enum import Enum\n\n\nclass AggregationTypes(Enum):\n NO_AGG = 'NO-AGG'\n STATIC = 'STATIC'\n SUB_HOUR = 'SUB-HOUR'\n DYNAMIC = 'DYNAMIC'\n", "<import token>\n\n\nclass AggregationTypes(Enum):\n NO_AGG = 'NO-AGG'\n STATIC = 'STATIC'\n SUB_HOUR = 'SUB-HOUR'\n DYNAMIC = 'DYNAMIC'\n", ...
false
5,323
e2840eb1b0d731d6b0356835ba371d05ba351ff6
"""APP Cloud Connect errors""" class CCEError(Exception): pass class ConfigException(CCEError): """Config exception""" pass class FuncException(CCEError): """Ext function call exception""" pass class HTTPError(CCEError): """ HTTPError raised when HTTP request returned a error.""" de...
[ "\"\"\"APP Cloud Connect errors\"\"\"\n\n\nclass CCEError(Exception):\n pass\n\n\nclass ConfigException(CCEError):\n \"\"\"Config exception\"\"\"\n pass\n\n\nclass FuncException(CCEError):\n \"\"\"Ext function call exception\"\"\"\n pass\n\n\nclass HTTPError(CCEError):\n \"\"\" HTTPError raised wh...
false
5,324
ddf074e400551d2c147d898fe876a31d13a72699
class Fail(Exception): def __init__(self, message): super().__init__(message) class Student: def __init__(self, rollNo, name, marks): self.rollNo = rollNo self.name = name self.marks = marks def displayDetails(self): print('{} \t {} \t {}'.format(self.name, self.ro...
[ "class Fail(Exception):\n def __init__(self, message):\n super().__init__(message)\n\n\nclass Student:\n def __init__(self, rollNo, name, marks):\n self.rollNo = rollNo\n self.name = name\n self.marks = marks\n\n def displayDetails(self):\n print('{} \\t {} \\t {}'.format...
false
5,325
92f4f1c8a4e04b07ed7c05d5bb733c0b9c28bd05
# i change it for change1 # change 1.py in master i = 1 # fix bug for boss
[ "# i change it for change1\n# change 1.py in master\ni = 1\n# fix bug for boss\n", "i = 1\n", "<assignment token>\n" ]
false
5,326
fc2afc99dc754b58c36bc76c723727337851cc3e
from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login, logout from django.http import HttpResponse # Create your views here. def check(request): if not request.user.is_authenticated: return redirect('/auth/login/') else: return redirect('/worker/') ...
[ "from django.shortcuts import render, redirect\nfrom django.contrib.auth import authenticate, login, logout\nfrom django.http import HttpResponse\n\n# Create your views here.\n\ndef check(request):\n if not request.user.is_authenticated:\n return redirect('/auth/login/')\n else:\n return redirec...
false
5,327
a721adaaa69bf09c2ea259f12bea05515c818679
# TrackwayDirectionStage.py # (C)2014-2015 # Scott Ernst from __future__ import print_function, absolute_import, unicode_literals, division from collections import namedtuple import math from pyaid.number.NumericUtils import NumericUtils from cadence.analysis.CurveOrderedAnalysisStage import CurveOrderedAnalysisSta...
[ "# TrackwayDirectionStage.py\n# (C)2014-2015\n# Scott Ernst\n\nfrom __future__ import print_function, absolute_import, unicode_literals, division\n\nfrom collections import namedtuple\nimport math\n\nfrom pyaid.number.NumericUtils import NumericUtils\n\nfrom cadence.analysis.CurveOrderedAnalysisStage import CurveOr...
false
5,328
4a5185fac7d6c09daa76b5d0d5aee863028a6bce
from functools import partial import torch from torch import nn from src.backbone.layers.conv_block import ConvBNAct, MBConvConfig, MBConvSE, mobilenet_v2_init from src.backbone.mobilenet_v2 import MobileNetV2 from src.backbone.utils import load_from_zoo class MobileNetV3(MobileNetV2): def __init__(self, residu...
[ "from functools import partial\n\nimport torch\nfrom torch import nn\n\nfrom src.backbone.layers.conv_block import ConvBNAct, MBConvConfig, MBConvSE, mobilenet_v2_init\nfrom src.backbone.mobilenet_v2 import MobileNetV2\nfrom src.backbone.utils import load_from_zoo\n\n\nclass MobileNetV3(MobileNetV2):\n def __ini...
false
5,329
c02af2ecd980da4ceff133c13072ad7c6b724041
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hilma import Mesh, loadPly, savePly mesh = Mesh() loadPly("head.ply", mesh) verts = [] faces = [] edges = [] uvs = ...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom hilma import Mesh, loadPly, savePly\n\nmesh = Mesh()\nloadPly(\"head.ply\", mesh)\n\nverts = []\nfaces =...
false
5,330
666e839b4d66dc4eede4e7325bfd4f4b801fd47d
from django.urls import path, re_path from app.views import UploaderAPIView, TeacherListAPIView, TeacherDetailAPIView app_name = "directory" urlpatterns = [ re_path(r"^directory/uploader/?$", UploaderAPIView.as_view(), name="teacher_uploader"), re_path(r"^directory/teachers/?$", TeacherListAPIView.as_view(), ...
[ "from django.urls import path, re_path\n\nfrom app.views import UploaderAPIView, TeacherListAPIView, TeacherDetailAPIView\n\napp_name = \"directory\"\nurlpatterns = [\n re_path(r\"^directory/uploader/?$\", UploaderAPIView.as_view(), name=\"teacher_uploader\"),\n re_path(r\"^directory/teachers/?$\", TeacherLis...
false
5,331
94264e121bb31a08cbd9766be1ff16173d2838ed
import pandas class _RegressionModelTable(object): def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None): if not isinstance(regression_models, list): regression_models = [regression_models] self._check_model_inputs(regression_models, fu...
[ "import pandas\n\n\nclass _RegressionModelTable(object):\n def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None):\n\n if not isinstance(regression_models, list):\n regression_models = [regression_models]\n\n self._check_model_inputs(regress...
false
5,332
7f58179efecd5a0d691a5c6d83b808f2cd2fcba3
from RestClient4py.client import RestClient from API_Wrap import util import os import json kakao_native_app_key, kakao_rest_api_key, kakao_javascript_key, kakao_admin_key = util.kakao_auth() client = RestClient() client.set_header("Authorization", "KakaoAK {}".format(kakao_rest_api_key)) client.set_header("Accept", ...
[ "from RestClient4py.client import RestClient\nfrom API_Wrap import util\nimport os\nimport json\n\n\nkakao_native_app_key, kakao_rest_api_key, kakao_javascript_key, kakao_admin_key = util.kakao_auth()\nclient = RestClient()\nclient.set_header(\"Authorization\", \"KakaoAK {}\".format(kakao_rest_api_key))\nclient.set...
false
5,333
f494dc99febfad99b371d72f542556a9024bc27d
# # Copyright (c) 2018-2020 by Kristoffer Paulsson <kristoffer.paulsson@talenten.se>. # # This software is available under the terms of the MIT license. Parts are licensed under # different terms if stated. The legal terms are attached to the LICENSE file and are # made available on: # # https://opensource.org/lice...
[ "#\n# Copyright (c) 2018-2020 by Kristoffer Paulsson <kristoffer.paulsson@talenten.se>.\n#\n# This software is available under the terms of the MIT license. Parts are licensed under\n# different terms if stated. The legal terms are attached to the LICENSE file and are\n# made available on:\n#\n# https://opensou...
false
5,334
fc4cf800c663abf20bfba7fcc1032e09a992641b
__author__ = 'asistente' #from __future__ import absolute_import from unittest import TestCase from selenium import webdriver from selenium.webdriver.common.by import By class FunctionalTest(TestCase): def setUp(self): self.browser = webdriver.Chrome("C:\\chromedriver\\chromedriver.exe") self.b...
[ "__author__ = 'asistente'\n\n#from __future__ import absolute_import\n\nfrom unittest import TestCase\nfrom selenium import webdriver\n\nfrom selenium.webdriver.common.by import By\n\nclass FunctionalTest(TestCase):\n\n def setUp(self):\n self.browser = webdriver.Chrome(\"C:\\\\chromedriver\\\\chromedrive...
false
5,335
34a523b31e5567d2a8aec95c5820792d1ae80892
from django.db import models # Create your models here. from user.models import User class Post(models.Model): class Meta: db_table = 'bl_post' id = models.AutoField(primary_key=True) title = models.CharField(max_length=200, null=False) pubdate = models.DateTimeField(null=False) # 作者 ...
[ "from django.db import models\n\n# Create your models here.\nfrom user.models import User\n\n\nclass Post(models.Model):\n class Meta:\n db_table = 'bl_post'\n\n id = models.AutoField(primary_key=True)\n title = models.CharField(max_length=200, null=False)\n pubdate = models.DateTimeField(null=Fa...
false
5,336
548eebb9628374df320021c714454e05d2c606c0
from __future__ import absolute_import, print_function, division, unicode_literals import tensorflow as tf def get_encoder(conf): if conf.encoder == 'linear': model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2), tf.keras.layers.ReLU(), ...
[ "from __future__ import absolute_import, print_function, division, unicode_literals\nimport tensorflow as tf\n\n\ndef get_encoder(conf):\n if conf.encoder == 'linear':\n model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2),\n tf.keras.layers.ReLU(),\n ...
false
5,337
ed5ba72443b70c84941af3d112e0246cb3ae97d9
#################################### ## Readable code versus less code ## #################################### import threading from web_server.general_api import general_api as api logger = api.__get_logger('ConnTimeout.run') class ConnTimeout(object): def __init__(self, timeout, function, servers=5, args=[], ...
[ "####################################\n## Readable code versus less code ##\n####################################\n\nimport threading\nfrom web_server.general_api import general_api as api\n\nlogger = api.__get_logger('ConnTimeout.run')\n\n\nclass ConnTimeout(object):\n def __init__(self, timeout, function, serv...
false
5,338
f23b002ec0eefa376890e255b1ac0137e3a1c989
from django.urls import path from player.views import ( MusicListView, MusicPlayView, MusicPauseView, MusicUnPauseView, NextSongView, PreviousSongView ) urlpatterns = [ path('list/', MusicListView, name="music_list"), path('play/<str:name>/', MusicPlayView, name="play_music"), path('pause/', Music...
[ "from django.urls import path\n\nfrom player.views import (\n MusicListView, MusicPlayView, MusicPauseView, MusicUnPauseView,\n NextSongView, PreviousSongView\n)\n\nurlpatterns = [\n path('list/', MusicListView, name=\"music_list\"),\n path('play/<str:name>/', MusicPlayView, name=\"play_music\"),\n p...
false
5,339
b4a96d5df56acd545e9919e202c462ee710a0339
#print pathToConnectionsList(['A','C','B','D','E']) #['EA','CB','AC','BD', 'DE'] #print independantPathPieces() #print pathToConnectionsList(pathGenerator()) #print geneFormatToPathSegmentsMini(['CD', 'AB', 'BE', 'EC']) #DA #print independantPathPieces(['EAC', 'CBD', 'ACB', 'BDE', 'DEA']) #print greedyCrossover(['EC', ...
[ "#print pathToConnectionsList(['A','C','B','D','E'])\n#['EA','CB','AC','BD', 'DE']\n#print independantPathPieces()\n#print pathToConnectionsList(pathGenerator())\n#print geneFormatToPathSegmentsMini(['CD', 'AB', 'BE', 'EC']) #DA\n#print independantPathPieces(['EAC', 'CBD', 'ACB', 'BDE', 'DEA'])\n#print greedyCrosso...
true
5,340
59b2c9d279168a806e59fb7529ab12d7b86107bc
# 213. 打家劫舍 II # 你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都 围成一圈 ,这意味着第一个房屋和最后一个房屋是紧挨着的。 # 同时,相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警 。 # 给定一个代表每个房屋存放金额的非负整数数组,计算你 在不触动警报装置的情况下 ,能够偷窃到的最高金额。 class Solution: # 86.24%, 15.46% def rob(self, nums) -> int: n = len(nums) if n == 0: ...
[ "# 213. 打家劫舍 II\r\n# 你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都 围成一圈 ,这意味着第一个房屋和最后一个房屋是紧挨着的。\r\n# 同时,相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警 。\r\n# 给定一个代表每个房屋存放金额的非负整数数组,计算你 在不触动警报装置的情况下 ,能够偷窃到的最高金额。\r\n\r\nclass Solution:\r\n # 86.24%, 15.46%\r\n def rob(self, nums) -> int:\r\n n = len(nums)\r\n...
false
5,341
a521befba58aa85c2fcfe6006db4b161123585f1
# Copyright 2018-present Kensho Technologies, LLC. from .utils import create_vertex_statement, get_random_date, get_uuid EVENT_NAMES_LIST = ( "Birthday", "Bar Mitzvah", "Coronation", "Re-awakening", ) def _create_event_statement(event_name): """Return a SQL statement to create a Event vertex."""...
[ "# Copyright 2018-present Kensho Technologies, LLC.\nfrom .utils import create_vertex_statement, get_random_date, get_uuid\n\n\nEVENT_NAMES_LIST = (\n \"Birthday\",\n \"Bar Mitzvah\",\n \"Coronation\",\n \"Re-awakening\",\n)\n\n\ndef _create_event_statement(event_name):\n \"\"\"Return a SQL statement...
false
5,342
b0ab97f5c05cdeee4c01460109a76cef75ac72ce
print("Convertidor de pies y pulgadas a centímetros") pies = float(input("Escriba una cantidad de pies: ")) pulgadas = float(input("Escriba una cantidad de pulgadas: ")) cm = (pies * 12 + pulgadas) * 2.54; print("{} pies y {} pulgadas son {} cm".format(pies, pulgadas, cm))
[ "print(\"Convertidor de pies y pulgadas a centímetros\")\npies = float(input(\"Escriba una cantidad de pies: \"))\npulgadas = float(input(\"Escriba una cantidad de pulgadas: \"))\ncm = (pies * 12 + pulgadas) * 2.54;\nprint(\"{} pies y {} pulgadas son {} cm\".format(pies, pulgadas, cm))\n", "print('Convertidor de ...
false
5,343
df1486afcc99e03510512ed6ed3e8b3471459d50
import pkgutil import mimetypes import time from datetime import datetime from pywb.utils.wbexception import NotFoundException from pywb.utils.loaders import BlockLoader from pywb.utils.statusandheaders import StatusAndHeaders from pywb.framework.basehandlers import BaseHandler, WbUrlHandler from pywb.framework.wbre...
[ "import pkgutil\nimport mimetypes\nimport time\n\nfrom datetime import datetime\n\nfrom pywb.utils.wbexception import NotFoundException\nfrom pywb.utils.loaders import BlockLoader\nfrom pywb.utils.statusandheaders import StatusAndHeaders\n\nfrom pywb.framework.basehandlers import BaseHandler, WbUrlHandler\nfrom pyw...
false
5,344
a179d3d2f04a101eaa60b5964c2b1cd77071633f
from envs import DATASET_FOLDER from os.path import join import json import collections from tqdm import tqdm def add_space(context_list): space_context = [] for idx, context in enumerate(context_list): space_sent_list = [] sent_list = context[1] if idx == 0: for sent_idx, s...
[ "from envs import DATASET_FOLDER\nfrom os.path import join\nimport json\nimport collections\nfrom tqdm import tqdm\n\ndef add_space(context_list):\n space_context = []\n for idx, context in enumerate(context_list):\n space_sent_list = []\n sent_list = context[1]\n if idx == 0:\n ...
false
5,345
55c00ce4c1657dc5ce78e5eeccd8e9625c0590dc
import requests import json import logging import time from alto.server.components.datasource import DBInfo, DataSourceAgent class CRICAgent(DataSourceAgent): def __init__(self, dbinfo: DBInfo, name: str, namespace='default', **cfg): super().__init__(dbinfo, name, namespace) self.uri = self.ensu...
[ "import requests\nimport json\nimport logging\nimport time\n\nfrom alto.server.components.datasource import DBInfo, DataSourceAgent\n\nclass CRICAgent(DataSourceAgent):\n\n def __init__(self, dbinfo: DBInfo, name: str, namespace='default', **cfg):\n super().__init__(dbinfo, name, namespace)\n\n sel...
false
5,346
10c9566503c43e806ca89e03955312c510092859
import datetime import json import re import time import discord from utils.ext import standards as std, checks, context, logs DISCORD_INVITE = '(discord(app\.com\/invite|\.com(\/invite)?|\.gg)\/?[a-zA-Z0-9-]{2,32})' EXTERNAL_LINK = '((https?:\/\/(www\.)?|www\.)[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6})' EVE...
[ "import datetime\nimport json\nimport re\nimport time\n\nimport discord\n\nfrom utils.ext import standards as std, checks, context, logs\n\nDISCORD_INVITE = '(discord(app\\.com\\/invite|\\.com(\\/invite)?|\\.gg)\\/?[a-zA-Z0-9-]{2,32})'\nEXTERNAL_LINK = '((https?:\\/\\/(www\\.)?|www\\.)[-a-zA-Z0-9@:%._\\+~#=]{1,256}...
false
5,347
0ad2e6d7e3fd61943fc1dfe6662110a6f48c1bd5
from .parse_categories import extract_categories from .parse_sections import extract_sections from .utils import remove_xml_comments def parse_page(page): if 'redirect' in page.keys(): return page_text = page['revision']['text']['#text'] page_text = remove_xml_comments(page_text) title = pag...
[ "from .parse_categories import extract_categories\nfrom .parse_sections import extract_sections\nfrom .utils import remove_xml_comments\n\n\ndef parse_page(page):\n if 'redirect' in page.keys():\n return\n\n page_text = page['revision']['text']['#text']\n page_text = remove_xml_comments(page_text)\n...
false
5,348
4d07795543989fe481e1141756f988d276f82c02
""" 7-4. Pizza Toppings: Write a loop that prompts the user to enter a series of pizza toppings until they enter a 'quit' value. As they enter each topping, print a message saying you’ll add that topping to their pizza. """ if __name__ == '__main__': topping = None while topping != "quit": if topping: ...
[ "\"\"\"\n7-4. Pizza Toppings: Write a loop that prompts the user to enter a series of\npizza toppings until they enter a 'quit' value. As they enter each topping,\nprint a message saying you’ll add that topping to their pizza.\n\"\"\"\nif __name__ == '__main__':\n topping = None\n while topping != \"quit\":\n...
false
5,349
51bdbec732bebd73a84b52c6d1d39eead047d29e
from __future__ import absolute_import import unittest import yaml import os from bok_choy.web_app_test import WebAppTest from .pages.job_config_history_subpage import JobConfigHistorySubPage class TestJobConfigHistory(WebAppTest): def setUp(self): super(TestJobConfigHistory, self).setUp() config_...
[ "from __future__ import absolute_import\nimport unittest\nimport yaml\nimport os\nfrom bok_choy.web_app_test import WebAppTest\nfrom .pages.job_config_history_subpage import JobConfigHistorySubPage\n\nclass TestJobConfigHistory(WebAppTest):\n\n def setUp(self):\n super(TestJobConfigHistory, self).setUp()\...
false
5,350
2ad1b44027b72499c1961f2d2b1c12c356c63d2b
import numpy,math,random from scipy.io.wavfile import write notes=[('c',32.7),('c#',34.65),('d',36.71),('d#',38.89),('e',41.2),('f',43.65), ('f#',46.25),('g',49),('g#',51.91),('a',55),('a#',58.27),('b',61.47)] #notes={'c':32.7,'c#':34.65,'d':36.71,'d#':38.89,'e':41.2,'f':43.65,'f#':46.25, # 'g':49,'g#':51.91,'a...
[ "import numpy,math,random\nfrom scipy.io.wavfile import write\n\nnotes=[('c',32.7),('c#',34.65),('d',36.71),('d#',38.89),('e',41.2),('f',43.65),\n ('f#',46.25),('g',49),('g#',51.91),('a',55),('a#',58.27),('b',61.47)]\n#notes={'c':32.7,'c#':34.65,'d':36.71,'d#':38.89,'e':41.2,'f':43.65,'f#':46.25,\n # 'g':49,'g...
false
5,351
ec39dae7217ddc48b1ab5163d234542cb36c1d48
# Generated by Django 3.1.1 on 2020-10-14 16:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Store', '0004_remove_product_mcat'), ] operations = [ migrations.RemoveField( model_name='categ...
[ "# Generated by Django 3.1.1 on 2020-10-14 16:26\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('Store', '0004_remove_product_mcat'),\n ]\n\n operations = [\n migrations.RemoveField(\n ...
false
5,352
f4ca7f31000a1f649876b19ef937ece9958dd60f
def maior(a,b): if a > b: return a else: return b a = int(input("Digite o 1 valor: ")) b = int(input("Digite o 2 valor: ")) print(maior(a,b))
[ "def maior(a,b):\n if a > b:\n return a\n else:\n return b\na = int(input(\"Digite o 1 valor: \"))\nb = int(input(\"Digite o 2 valor: \"))\nprint(maior(a,b))\n", "def maior(a, b):\n if a > b:\n return a\n else:\n return b\n\n\na = int(input('Digite o 1 valor: '))\nb = int(i...
false
5,353
5c06229f8e80a7225620f25941cc5276a9021e53
#=============================================================================== # @author: Daniel V. Stankevich # @organization: RMIT, School of Computer Science, 2012 # # # This package contains representations of the following models: # 'Particle' - an atomic element # 'Swarm' - a set of p...
[ "#===============================================================================\n# @author: Daniel V. Stankevich\n# @organization: RMIT, School of Computer Science, 2012\n#\n#\n# This package contains representations of the following models:\n# 'Particle' - an atomic element\n# 'Swarm' ...
false
5,354
fd7961d3a94b53ae791da696bb2024165db8b8fc
import pandas as pd import csv import numpy as np import matplotlib.pyplot as plt #import csv file with recorded left, right servo angles and their corresponding roll and pitch values df = pd.read_csv('C:/Users/yuyan.shi/Desktop/work/head-neck/kinematics/tabblepeggy reference tables/mid_servo_angle_2deg_3.csv') ...
[ "import pandas as pd\r\nimport csv\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\n#import csv file with recorded left, right servo angles and their corresponding roll and pitch values\r\ndf = pd.read_csv('C:/Users/yuyan.shi/Desktop/work/head-neck/kinematics/tabblepeggy reference tables/mid_servo_an...
false
5,355
8e05b2723d8c50354e785b4bc7c5de8860aa706d
import torch import torchvision from torch import nn def get_resnet18(pre_imgnet = False, num_classes = 64): model = torchvision.models.resnet18(pretrained = pre_imgnet) model.fc = nn.Linear(512, 64) return model
[ "import torch\nimport torchvision\nfrom torch import nn\n\ndef get_resnet18(pre_imgnet = False, num_classes = 64):\n \n model = torchvision.models.resnet18(pretrained = pre_imgnet)\n model.fc = nn.Linear(512, 64)\n return model\n", "import torch\nimport torchvision\nfrom torch import nn\n\n\ndef get_r...
false
5,356
4a13a0d7aa2371d7c8963a01b7cc1b93f4110d5e
# 백준 문제(2021.5.22) # 10039번) 상현이가 가르치는 아이폰 앱 개발 수업의 수강생은 원섭, 세희, 상근, 숭, 강수이다. # 어제 이 수업의 기말고사가 있었고, 상현이는 지금 학생들의 기말고사 시험지를 채점하고 있다. # 기말고사 점수가 40점 이상인 학생들은 그 점수 그대로 자신의 성적이 된다. # 하지만, 40점 미만인 학생들은 보충학습을 듣는 조건을 수락하면 40점을 받게 된다. # 보충학습은 거부할 수 없기 때문에, 40점 미만인 학생들은 항상 40점을 받게 된다. # 학생 5명의 점수가 주어졌을 때, 평균 점수를 구하는 프로그램을 작성...
[ "# 백준 문제(2021.5.22)\n# 10039번) 상현이가 가르치는 아이폰 앱 개발 수업의 수강생은 원섭, 세희, 상근, 숭, 강수이다.\n# 어제 이 수업의 기말고사가 있었고, 상현이는 지금 학생들의 기말고사 시험지를 채점하고 있다. \n# 기말고사 점수가 40점 이상인 학생들은 그 점수 그대로 자신의 성적이 된다. \n# 하지만, 40점 미만인 학생들은 보충학습을 듣는 조건을 수락하면 40점을 받게 된다. \n# 보충학습은 거부할 수 없기 때문에, 40점 미만인 학생들은 항상 40점을 받게 된다.\n# 학생 5명의 점수가 주어졌을 때, 평균 점수를 구...
false
5,357
d6c06a465c36430e4f2d355450dc495061913d77
import os import sys import glob import argparse import shutil import subprocess import numpy as np from PIL import Image import torch import torch.backends.cudnn as cudnn import torch.nn.functional as F from torch.autograd import Variable from torchvision.utils import save_image sys.path.append(os.pardir) from model...
[ "import os\nimport sys\nimport glob\nimport argparse\nimport shutil\nimport subprocess\n\nimport numpy as np\nfrom PIL import Image\nimport torch\nimport torch.backends.cudnn as cudnn\nimport torch.nn.functional as F\nfrom torch.autograd import Variable\nfrom torchvision.utils import save_image\n\nsys.path.append(o...
false
5,358
bc0846397a5ad73b1c4b85e12864b27ef4fd08d7
import ctypes import win32con import request_spider from selenium_tickets_spider import * from threading import Thread from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import Qt, QThread, pyqtSignal import sys, time, re import datetime SESSION_DATA = False SHOW_S_P = False class Wor...
[ "import ctypes\nimport win32con\nimport request_spider\nfrom selenium_tickets_spider import *\nfrom threading import Thread\nfrom PyQt5.QtWidgets import *\nfrom PyQt5 import QtCore, QtWidgets\nfrom PyQt5.QtCore import Qt, QThread, pyqtSignal\nimport sys, time, re\nimport datetime\n\nSESSION_DATA = False\nSHOW_S_P =...
false
5,359
849343561dd9bdcfc1da66c604e1bfa4aa10ddf3
# bot.py import os import sqlite3 import json import datetime from dotenv import load_dotenv import discord from discord.ext import commands from discord.ext.commands import Bot from cogs.utils import helper as h intents = discord.Intents.default() intents.members = True load_dotenv() TOKEN = os.getenv('DISCORD_T...
[ "# bot.py\nimport os\nimport sqlite3\nimport json\n\nimport datetime\n\nfrom dotenv import load_dotenv\n\nimport discord\nfrom discord.ext import commands\nfrom discord.ext.commands import Bot\n\nfrom cogs.utils import helper as h\n\nintents = discord.Intents.default()\nintents.members = True\n\nload_dotenv()\nTOKE...
false
5,360
df4c03d9faedf2d347593825c7221937a75a9c10
from api import * version_api = api(0) def is_bad_version(v): return version_api.is_bad(v) def first_bad_version(n): # -- DO NOT CHANGE THIS SECTION version_api.n = n # -- api_calls_count = 0 left, right = 1, n while left < right: mid = (left + right) // 2 is_bad = is_bad_versio...
[ "from api import *\n\nversion_api = api(0)\n\ndef is_bad_version(v):\n return version_api.is_bad(v)\n\ndef first_bad_version(n):\n# -- DO NOT CHANGE THIS SECTION\n version_api.n = n\n# --\n api_calls_count = 0\n\n left, right = 1, n\n while left < right:\n mid = (left + right) // 2\n\n ...
false
5,361
c0218acadb9e03359ac898cf3bb4898f516400e5
from setuptools import setup setup(name='google-drive-helpers', version='0.1', description='Helper functions for google drive', url='https://github.com/jdoepfert/google-drive-helpers', license='MIT', packages=['gdrive_helpers'], install_requires=[ 'google-api-python-client...
[ "from setuptools import setup\n\nsetup(name='google-drive-helpers',\n version='0.1',\n description='Helper functions for google drive',\n url='https://github.com/jdoepfert/google-drive-helpers',\n license='MIT',\n packages=['gdrive_helpers'],\n install_requires=[\n 'google-api...
false
5,362
8af3bb1b33a01353cd7f26c9496485e36d954edb
import json import webapp2 import requests import requests_toolbelt.adapters.appengine from . import mongodb import datetime from bson.json_util import dumps class RestHandler(webapp2.RequestHandler): def dispatch(self): # time.sleep(1) super(RestHandler, self).dispatch() def send_json(self, conten...
[ "import json\n\nimport webapp2\n\nimport requests\n\nimport requests_toolbelt.adapters.appengine\n\nfrom . import mongodb\n\nimport datetime\n\nfrom bson.json_util import dumps\n\nclass RestHandler(webapp2.RequestHandler):\n\n def dispatch(self):\n # time.sleep(1)\n super(RestHandler, self).dispatch()\n\n d...
true
5,363
1cccb37a7195b1555513a32ef33b35b0edcd5eb1
import requests import datetime import collections import csv import sys import os import os.path History = collections.namedtuple('History', ['open', 'high', 'low', 'close', 'volume', 'adjustment']) def history(symbol, since, until): response = requests.get('http://ichart.finance.yahoo.com/table.csv?s=%s&d=%d&e...
[ "import requests\nimport datetime\nimport collections\nimport csv\nimport sys\nimport os\nimport os.path\n\n\nHistory = collections.namedtuple('History', ['open', 'high', 'low', 'close', 'volume', 'adjustment'])\n\ndef history(symbol, since, until):\n response = requests.get('http://ichart.finance.yahoo.com/tabl...
true
5,364
1ee5139cb1613977f1c85619404b3dcc6e996382
def adder(x, y): return x + y adder('one', 'two') adder([3, 4], [9, 0, 33]) adder(4.3, 3.5)
[ "def adder(x, y):\n return x + y\n\nadder('one', 'two')\nadder([3, 4], [9, 0, 33])\nadder(4.3, 3.5)", "def adder(x, y):\n return x + y\n\n\nadder('one', 'two')\nadder([3, 4], [9, 0, 33])\nadder(4.3, 3.5)\n", "def adder(x, y):\n return x + y\n\n\n<code token>\n", "<function token>\n<code token>\n" ]
false
5,365
b35686f7feec2c4a905007f3c105b6fa05b87297
''' swea 2806 N-Queen ''' def nqueen(depth, n, history): global cnt if depth == n: cnt += 1 else: for i in range(n): if i not in history: for index, value in enumerate(history): if abs(depth - index) == abs(i - value): b...
[ "'''\nswea 2806 N-Queen\n'''\ndef nqueen(depth, n, history):\n global cnt\n if depth == n:\n cnt += 1\n else:\n for i in range(n):\n if i not in history:\n for index, value in enumerate(history):\n if abs(depth - index) == abs(i - value):\n ...
false
5,366
31ed798118f20005b5a26bc1fc0053b7d0a95657
# Demo - train the decoders & use them to stylize image from __future__ import print_function from train import train from infer import stylize from utils import list_images IS_TRAINING = True # for training TRAINING_IMGS_PATH = 'MS_COCO' ENCODER_WEIGHTS_PATH = 'vgg19_normalised.npz' MODEL_SAVE_PATH = 'models/auto...
[ "# Demo - train the decoders & use them to stylize image\n\nfrom __future__ import print_function\n\nfrom train import train\nfrom infer import stylize\nfrom utils import list_images\n\n\nIS_TRAINING = True\n\n# for training\nTRAINING_IMGS_PATH = 'MS_COCO'\nENCODER_WEIGHTS_PATH = 'vgg19_normalised.npz'\nMODEL_SAVE_...
false
5,367
f12bdfc054e62dc244a95daad9682790c880f20d
from unittest.case import TestCase from datetime import datetime from src.main.domain.Cohort import Cohort from src.main.domain.Group import Group from src.main.util.TimeFormatter import TimeFormatter __author__ = 'continueing' class CohortTest(TestCase): def testAnalyzeNewGroups(self): cohort = Cohort(...
[ "from unittest.case import TestCase\nfrom datetime import datetime\nfrom src.main.domain.Cohort import Cohort\nfrom src.main.domain.Group import Group\nfrom src.main.util.TimeFormatter import TimeFormatter\n\n__author__ = 'continueing'\n\n\nclass CohortTest(TestCase):\n\n def testAnalyzeNewGroups(self):\n ...
false
5,368
1d8e48aab59869831defcccdd8902230b0f3daa7
import random import pygame pygame.init() # 큐브의 크기 cubeSize = 2 # GUI 관련 변수 BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 204, 0) ORANGE = (255, 102, 0) WHITE = (255, 255, 255) GREY = (128, 128, 128) pieceSize = 50 gridSize = pieceSize * cubeSize screen = pygame.display.se...
[ "import random\nimport pygame\npygame.init()\n\n# 큐브의 크기\ncubeSize = 2\n\n# GUI 관련 변수\nBLACK = (0, 0, 0)\nRED = (255, 0, 0)\nGREEN = (0, 255, 0)\nBLUE = (0, 0, 255)\nYELLOW = (255, 204, 0)\nORANGE = (255, 102, 0)\nWHITE = (255, 255, 255)\nGREY = (128, 128, 128)\n\npieceSize = 50\ngridSize = pieceSize * cubeSize\nsc...
false
5,369
dd792c502317288644d4bf5d247999bb08d5f401
from collections import deque warp = dict() u, v = map(int, input().split()) for _ in range(u + v): s, e = map(int, input().split()) warp[s] = e q = deque() q.append(1) check = [-1] * 101 check[1] = 0 while q: now = q.popleft() for k in range(1, 7): if now + k <= 100 and check[now + k] == -1: check[now + k] = ...
[ "from collections import deque\nwarp = dict()\nu, v = map(int, input().split())\nfor _ in range(u + v):\n\ts, e = map(int, input().split())\n\twarp[s] = e\nq = deque()\nq.append(1)\ncheck = [-1] * 101\ncheck[1] = 0\nwhile q:\n\tnow = q.popleft()\n\tfor k in range(1, 7):\n\t\tif now + k <= 100 and check[now + k] == ...
false
5,370
82a3fca0261b4bde43f7bf258bb22e5b2ea8c28d
import pickle import time start = time.time() f = open('my_classifier.pickle', 'rb') cl = pickle.load(f) f.close() print(cl.classify("Where to travel in bangalore ?")) print(cl.classify("Name a golf course in Myrtle beach .")) print(cl.classify("What body of water does the Danube River flow into ?")) #print("Accuracy...
[ "import pickle\nimport time\n\nstart = time.time()\nf = open('my_classifier.pickle', 'rb')\ncl = pickle.load(f)\nf.close()\n\nprint(cl.classify(\"Where to travel in bangalore ?\"))\nprint(cl.classify(\"Name a golf course in Myrtle beach .\"))\nprint(cl.classify(\"What body of water does the Danube River flow into ?...
false
5,371
693f2a56578dfb1e4f9c73a0d33c5585070e9f9e
import cv2 import numpy as np """ # Create a black image image = np.zeros((512,512,3), np.uint8) # Can we make this in black and white? image_bw = np.zeros((512,512), np.uint8) cv2.imshow("Black Rectangle (Color)", image) cv2.imshow("Black Rectangle (B&W)", image_bw) cv2.waitKey(0) cv2.destroyAllWindows() image = ...
[ "import cv2\nimport numpy as np\n\"\"\"\n# Create a black image\nimage = np.zeros((512,512,3), np.uint8)\n\n# Can we make this in black and white?\nimage_bw = np.zeros((512,512), np.uint8)\n\ncv2.imshow(\"Black Rectangle (Color)\", image)\ncv2.imshow(\"Black Rectangle (B&W)\", image_bw)\n\ncv2.waitKey(0)\ncv2.destr...
false
5,372
9843f957435b74e63a6fe4827cc17c824f11c7d6
import time t0 = time.time() # ------------------------------ days_in_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def count_days(start_date, end_date, ref_date, target_day): # ref_date must be exactly 1 year before start_date month = start_date[0] day = start_date[1] year = start_date...
[ "import time\n\nt0 = time.time()\n# ------------------------------\n\ndays_in_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\ndef count_days(start_date, end_date, ref_date, target_day):\n # ref_date must be exactly 1 year before start_date\n month = start_date[0]\n day = start_date[1]\n y...
false
5,373
20671470c087719fa9ea8ffa25be55e9ade67681
# p.85 (문자 갯수 카운팅) message = \ 'It was a bright cold day in April, and the clocks were striking thirteen.' print(message, type(message)) msg_dict = dict() #빈 dict() 생성 for msg in message: print(msg, message.count(msg)) msg_dict[msg] = message.count(msg) print(msg_dict)
[ "# p.85 (문자 갯수 카운팅)\nmessage = \\\n 'It was a bright cold day in April, and the clocks were striking thirteen.'\nprint(message, type(message))\n\nmsg_dict = dict() #빈 dict() 생성\nfor msg in message:\n print(msg, message.count(msg))\n msg_dict[msg] = message.count(msg)\n\nprint(msg_dict)\n", "message = (\n...
false
5,374
ba336094d38a47457198919ce60969144a8fdedb
# Generated by Django 3.1.6 on 2021-02-27 23:29 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('RMS', '0001_initial'), ] operations = [ migrations.RenameField( model_name='inventorytable', old_name='Restaurant_ID', ...
[ "# Generated by Django 3.1.6 on 2021-02-27 23:29\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('RMS', '0001_initial'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='inventorytable',\n old_name='Re...
false
5,375
1673214215043644e1a878ed7c30b69064f1a022
import datetime class assignmentObject: def __init__(self,name,day): self.name = name self.day = day
[ "import datetime\r\n\r\nclass assignmentObject:\r\n def __init__(self,name,day):\r\n self.name = name\r\n self.day = day", "import datetime\n\n\nclass assignmentObject:\n\n def __init__(self, name, day):\n self.name = name\n self.day = day\n", "<import token>\n\n\nclass assignm...
false
5,376
88731049227629ed84ff56922d7ac11d4a137984
from core.models import Atom from core.models.vector3d import cVector3D from fractions import Fraction class SpaceGroup(object): def __init__(self, index=None, name=None, lattice_system=None, lattice_centering=None, inversion=Non...
[ "from core.models import Atom\nfrom core.models.vector3d import cVector3D\nfrom fractions import Fraction\n\n\nclass SpaceGroup(object):\n def __init__(self,\n index=None,\n name=None,\n lattice_system=None,\n lattice_centering=None,\n ...
false
5,377
a777c6d76ef2ae15544a91bcfba0dbeabce0470a
from practice.demo4 import paixu if __name__ == '__main__': n=int(input("请输入最大的数字范围:")) paixu(n)
[ "from practice.demo4 import paixu\nif __name__ == '__main__':\n n=int(input(\"请输入最大的数字范围:\"))\n paixu(n)", "from practice.demo4 import paixu\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:'))\n paixu(n)\n", "<import token>\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:'))\n ...
false
5,378
0271c45a21047b948946dd76f147692bb16b8bcf
import requests url='https://item.jd.com/100008348550.html' try: r=requests.get(url) r.raise_for_status() print(r.encoding) r.encoding=r.apparent_encoding print(r.text[:1000]) print(r.apparent_encoding) except: print('error')
[ "import requests\nurl='https://item.jd.com/100008348550.html'\ntry:\n r=requests.get(url)\n r.raise_for_status()\n print(r.encoding)\n r.encoding=r.apparent_encoding\n print(r.text[:1000])\n print(r.apparent_encoding)\nexcept:\n print('error')\n", "import requests\nurl = 'https://item.jd.com/...
false
5,379
9ba5af7d2b6d4f61bb64a055efb15efa8e08d35c
from selenium import webdriver from urllib.request import urlopen, Request from subprocess import check_output import json #from flask import Flask # https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=-32.27,-34.08,-73.15,-70.29 def get_json_aviones(north, south, west, east): #driver = webdriver.Chrom...
[ "from selenium import webdriver\nfrom urllib.request import urlopen, Request\nfrom subprocess import check_output\nimport json\n#from flask import Flask\n\n\n# https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=-32.27,-34.08,-73.15,-70.29\ndef get_json_aviones(north, south, west, east):\n\n #driver = ...
false
5,380
bcc3d4e9be0de575c97bb3bf11eeb379ab5be458
# -*- coding: utf-8 -*- """ Created on Thu Jan 2 22:49:00 2020 @author: Drew ____________________________________________________________________ basic_github_auto_uploader.py - A Basic Automated GitHub Uploader ____________________________________________________________________ 1. Requirements: Version: ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jan 2 22:49:00 2020\n@author: Drew\n\n____________________________________________________________________\n\nbasic_github_auto_uploader.py - A Basic Automated GitHub Uploader\n____________________________________________________________________\n\n1. Requirements:\...
false
5,381
e4ce10f5db56e4e2e1988da3cee542a4a09785a8
from . import mongo col = mongo.cli['Cupidbot']['timer'] async def add_time(chat, time): return col.insert_one({'chat': chat, 'time': time}) async def get_time(chat): return col.find_one({'chat': chat}) async def update_time(chat, time): return col.update_one({'chat': chat}, {'$set': {'chat': chat, 'tim...
[ "from . import mongo\n\ncol = mongo.cli['Cupidbot']['timer']\n\nasync def add_time(chat, time):\n return col.insert_one({'chat': chat, 'time': time})\n\nasync def get_time(chat):\n return col.find_one({'chat': chat})\n\nasync def update_time(chat, time):\n return col.update_one({'chat': chat}, {'$set': {'c...
false
5,382
1ce5b97148885950983e39b7e99d0cdfafe4bc16
from turtle import * def drawSquare(): for i in range(4): forward(100) left(90) if __name__ == '__main__': drawSquare() up() forward(200) down() drawSquare() mainloop()
[ "from turtle import *\n\ndef drawSquare():\n for i in range(4):\n\n forward(100)\n left(90)\nif __name__ == '__main__':\n drawSquare()\n\nup()\nforward(200)\ndown()\n\ndrawSquare()\n\nmainloop()\n", "from turtle import *\n\n\ndef drawSquare():\n for i in range(4):\n forward(100)\n ...
false
5,383
6267c999d3cec051c33cbcde225ff7acaa6bff74
import sys from random import randint if len(sys.argv) != 2: print "Usage: generate.py <number of orders>" sys.exit(1) n = int(sys.argv[1]) for i in range(0, n): action = 'A' orderid = i + 1 side = 'S' if (randint(0,1) == 0) else 'B' quantity = randint(1,100) price = randint(100,200) ...
[ "import sys\nfrom random import randint\n\nif len(sys.argv) != 2:\n print \"Usage: generate.py <number of orders>\"\n sys.exit(1)\n\nn = int(sys.argv[1])\n\nfor i in range(0, n):\n action = 'A'\n orderid = i + 1\n side = 'S' if (randint(0,1) == 0) else 'B'\n quantity = randint(1,100)\n price = ...
true
5,384
39ecbf914b0b2b25ce4290eac4198199b90f95e0
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging lgr = logging.getLogger(__name__) lgr.log("hello") import database import csv import codecs class Stop(object): """docstring for Stop""" def __init__(self, arg): self.fields = [ 'stop_id', 'stop_name', 'stop...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport logging\nlgr = logging.getLogger(__name__)\nlgr.log(\"hello\")\nimport database\nimport csv\nimport codecs\nclass Stop(object):\n \"\"\"docstring for Stop\"\"\"\n def __init__(self, arg):\n self.fields = [\n 'stop_id',\n 'sto...
false
5,385
5dd79f8ebd74099871d4367cafd83359c4f24e26
#!/usr/bin/python3 import os import sys import subprocess path = sys.argv[1] name, ext = os.path.splitext(path) options = ['g++', '-O3', 'src/' + path, '-o', f'./bin/{name}', '-std=c++11', '-lgmp'] subprocess.call(options) subprocess.call([f'./bin/{name}'])
[ "#!/usr/bin/python3\n\nimport os\nimport sys\nimport subprocess\n\npath = sys.argv[1]\nname, ext = os.path.splitext(path)\noptions = ['g++',\n '-O3',\n 'src/' + path,\n '-o', f'./bin/{name}',\n '-std=c++11',\n '-lgmp']\nsubprocess.call(options)\nsubprocess.call([f'....
false
5,386
55d184a9342b40fe027913e46933325bb00e33a6
from django.contrib import admin from .models import User, UserProfile, Lead, Agent, Category admin.site.register(User) admin.site.register(UserProfile) admin.site.register(Lead) admin.site.register(Agent) admin.site.register(Category)
[ "from django.contrib import admin\n\nfrom .models import User, UserProfile, Lead, Agent, Category\n\n\nadmin.site.register(User)\nadmin.site.register(UserProfile)\nadmin.site.register(Lead)\nadmin.site.register(Agent)\nadmin.site.register(Category)\n", "from django.contrib import admin\nfrom .models import User, ...
false
5,387
44097da54a0bb03ac14196712111a1489a956689
#proper clarification for requirement is required import boto3 s3_resource = boto3.resource('s3') s3_resource.create_bucket(Bucket=YOUR_BUCKET_NAME, CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}) s3_resource.Bucket(first_bucket_name).upload_file(Filename=first_file_name, Key=first_file_name) s3_resource...
[ "#proper clarification for requirement is required\nimport boto3\ns3_resource = boto3.resource('s3')\ns3_resource.create_bucket(Bucket=YOUR_BUCKET_NAME, CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'})\ns3_resource.Bucket(first_bucket_name).upload_file(Filename=first_file_name, Key=first_file_name)\ns...
false
5,388
cf2c57dbb2c1160321bcd6de98691db48634d5d6
# Generated by Django 2.2.2 on 2019-07-17 10:02 from django.db import migrations, models import django.db.models.deletion import modelcluster.fields class Migration(migrations.Migration): dependencies = [ ('users', '0003_delete_userprofile'), ] operations = [ migrations.CreateModel( ...
[ "# Generated by Django 2.2.2 on 2019-07-17 10:02\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport modelcluster.fields\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('users', '0003_delete_userprofile'),\n ]\n\n operations = [\n migratio...
false
5,389
0f4fa9f8835ae22032af9faa6c7cb10af3facd79
def parse_detail_for_one_course(page, course, no_info_course): print(f'{course["name"]} is processing**: {course["url"]}') map = {"Locatie": "location", "Location": "location", "Startdatum": "effective_start_date", "Start date": "effective_start_date", "Duur": "durati...
[ "def parse_detail_for_one_course(page, course, no_info_course):\n print(f'{course[\"name\"]} is processing**: {course[\"url\"]}')\n map = {\"Locatie\": \"location\",\n \"Location\": \"location\",\n \"Startdatum\": \"effective_start_date\",\n \"Start date\": \"effective_start_date...
false
5,390
0b8cb522c531ac84d363b569a3ea4bfe47f61993
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """Module for mimic explainer and explainable surrogate models.""" from .mimic_explainer import MimicExplainer __all__ = ["MimicExplainer"...
[ "# ---------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# ---------------------------------------------------------\n\n\"\"\"Module for mimic explainer and explainable surrogate models.\"\"\"\nfrom .mimic_explainer import MimicExplainer\n\n__all__ =...
false
5,391
bd1fbdf70bae7d5853bac8fae83343dfa188ca19
from django import http from django.utils import simplejson as json import urllib2 import logging from google.appengine.api import urlfetch import cmath import math from ams.forthsquare import ForthSquare from ams.twitter import Twitter OAUTH_TOKEN='3NX4ATMVS35LKIP25ZOKIVBRGAHFREKGNHTAKQ5NPGMCWOE0' DEFAULT_RADIUS = ...
[ "from django import http\nfrom django.utils import simplejson as json\nimport urllib2\nimport logging\nfrom google.appengine.api import urlfetch\nimport cmath\nimport math\nfrom ams.forthsquare import ForthSquare\nfrom ams.twitter import Twitter\n\n\nOAUTH_TOKEN='3NX4ATMVS35LKIP25ZOKIVBRGAHFREKGNHTAKQ5NPGMCWOE0'\n\...
true
5,392
e598091fc6c05b1d7f9f35f2ae58494fed53f9af
# Write a Python program to print alphabet pattern 'G'. result = '' for row in range(0,7): for col in range(0,7): if ((col ==0) and (row !=0 and row !=6) or ((row ==0 or row == 6) and (col>0 and col<6))or ((row ==1 or row == 5 or row == 4)and (col ==6))or ((row ==3)and ((col!=2)and col!=1))): r...
[ "# Write a Python program to print alphabet pattern 'G'.\n\nresult = ''\nfor row in range(0,7):\n for col in range(0,7):\n if ((col ==0) and (row !=0 and row !=6) or ((row ==0 or row == 6) and (col>0 and col<6))or ((row ==1 or row == 5 or row == 4)and (col ==6))or ((row ==3)and ((col!=2)and col!=1))):\n ...
false
5,393
7819e41d567daabe64bd6eba62461d9e553566b3
from socketserver import StreamRequestHandler, TCPServer from functools import partial class EchoHandler(StreamRequestHandler): def __init__(self, *args, ack, **kwargs): self.ack = ack super.__init__(*args, **kwargs) def handle(self): for line in self.rfile: self.wfile.wri...
[ "from socketserver import StreamRequestHandler, TCPServer\nfrom functools import partial\n\n\nclass EchoHandler(StreamRequestHandler):\n def __init__(self, *args, ack, **kwargs):\n self.ack = ack\n super.__init__(*args, **kwargs)\n\n def handle(self):\n for line in self.rfile:\n ...
false
5,394
e0b28fdcbc3160bcccbb032949317a91a32eeb1b
# -*- coding: utf-8 -*- """ Created on Thu Apr 4 12:47:30 2019 Title: MP4-Medical Image Processing @author: MP4 Team """ # Validate window controller class ValidateWindowCtr(object): # Initialization def __init__(self, fig, im_trans, im_truth, im_segmen, vol_trans, vol_truth, vol_segmen, ax_trans,...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Thu Apr 4 12:47:30 2019\r\nTitle: MP4-Medical Image Processing\r\n@author: MP4 Team\r\n\r\n\"\"\"\r\n\r\n# Validate window controller\r\nclass ValidateWindowCtr(object):\r\n # Initialization\r\n def __init__(self, fig, im_trans, im_truth, im_segmen, vol_trans,...
false
5,395
5b6241907cc97f82d6c6e0a461f4f71a9a567204
#Program to create and store Employee Salary Records in a file import os def appendEmployee(eno,name,basic): fh=open("Employee.txt","a") hra=basic*0.10 da=basic*0.73 gross=basic+hra+da tax=gross*0.3 net=gross-tax line=str(eno)+","+name+","+str(basic)+","+str(hra)+","+str(da)+","+str(gross)+","+str(tax)+","+str...
[ "#Program to create and store Employee Salary Records in a file\n\nimport os\n\ndef appendEmployee(eno,name,basic):\n\tfh=open(\"Employee.txt\",\"a\")\n\thra=basic*0.10\n\tda=basic*0.73\n\tgross=basic+hra+da\n\ttax=gross*0.3\n\tnet=gross-tax\n\tline=str(eno)+\",\"+name+\",\"+str(basic)+\",\"+str(hra)+\",\"+str(da)+...
false
5,396
6eec95932ef445ba588f200233495f59c4d77aac
from sklearn.datasets import fetch_mldata from sklearn.preprocessing import OneHotEncoder from sklearn.model_selection import train_test_split import numpy as np import os import tarfile import pickle import subprocess import sys if sys.version_info.major == 2: # Backward compatibility with python 2. from six....
[ "from sklearn.datasets import fetch_mldata\nfrom sklearn.preprocessing import OneHotEncoder\nfrom sklearn.model_selection import train_test_split\n\nimport numpy as np\nimport os\nimport tarfile\nimport pickle\nimport subprocess\nimport sys\nif sys.version_info.major == 2:\n # Backward compatibility with python ...
false
5,397
8a7904881d936a3cb421ed5550856b600894fcee
#!/bin/python import sys import notify2 import subprocess from time import sleep def notification(message: str): """ Display notification to the desktop Task: 1. show() -> it will generate a complete new pop 2. update() -> it will update the payload part of same notification pop-up, not is...
[ "#!/bin/python\nimport sys\nimport notify2\nimport subprocess\nfrom time import sleep\n\n\ndef notification(message: str):\n \"\"\"\n Display notification to the desktop\n Task:\n 1. show() -> it will generate a complete new pop\n 2. update() -> it will update the payload part of same notific...
false
5,398
b750673829873c136826ae539900451559c042c8
#Alexis Langlois ''' Fichier de test pour l'algorithme Adaboost avec arbres de décision (@nbTrees). ''' import numpy as np from sklearn.utils import shuffle from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score from adaboost_trees import AdaboostTrees #Trees nbTrees = 20 #Tr...
[ "#Alexis Langlois\n'''\nFichier de test pour l'algorithme Adaboost avec arbres de décision (@nbTrees).\n'''\n\nimport numpy as np\n\nfrom sklearn.utils import shuffle\nfrom sklearn.metrics import classification_report\nfrom sklearn.metrics import accuracy_score\nfrom adaboost_trees import AdaboostTrees\n\n\n#Trees\...
true
5,399
8ef20a7a93d6affabe88dad4e5d19613fe47dd0f
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path import re import sys import tarfile import numpy as np from six.moves import urllib import tensorflow as tf from sklearn.model_selection import train_test_split from sklearn import datasets fro...
[ "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os.path\nimport re\nimport sys\nimport tarfile\n\nimport numpy as np\nfrom six.moves import urllib\nimport tensorflow as tf\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn ...
false