index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
3,300
11072601e31ceba13f8adf6c070f84ca5add35e9
# 5/1/2020 # Import median function from numpy import numpy as np from numpy import median # Plot the median number of absences instead of the mean sns.catplot(x="romantic", y="absences", data=student_data, kind="point", hue="school", ci=None, estimator = median) # S...
[ "# 5/1/2020\n# Import median function from numpy\nimport numpy as np\nfrom numpy import median\n\n# Plot the median number of absences instead of the mean\nsns.catplot(x=\"romantic\", y=\"absences\",\n\t\t\tdata=student_data,\n kind=\"point\",\n hue=\"school\",\n ci=None,\n ...
false
3,301
6ca7b896cc20220f790c06d4ba08fef7bda8400f
# test CurlypivSetup """ Notes about program """ # 1.0 import modules import numpy as np from skimage import io import glob from os.path import join import matplotlib.pyplot as plt from curlypiv.utils.calibrateCamera import measureIlluminationDistributionXY, calculate_depth_of_correlation, calculate_darkfield, plot_fi...
[ "# test CurlypivSetup\n\"\"\"\nNotes about program\n\"\"\"\n\n# 1.0 import modules\nimport numpy as np\nfrom skimage import io\nimport glob\nfrom os.path import join\nimport matplotlib.pyplot as plt\nfrom curlypiv.utils.calibrateCamera import measureIlluminationDistributionXY, calculate_depth_of_correlation, calcul...
false
3,302
3ea123aceb72e4731afe98cf4c5beced2d424035
from django.conf.urls import url from tipz import views urlpatterns = [ # /tipz/ url(r'^$', views.IndexView.as_view(), name='index'), # /tipz/login url(r'^login/$', views.LoginFormView.as_view(), name='login'), # /tipz/logout url(r'^logout/$', views.LogoutFormView.as_view(), name='logout'), ...
[ "from django.conf.urls import url\nfrom tipz import views\n\nurlpatterns = [\n # /tipz/\n url(r'^$', views.IndexView.as_view(), name='index'),\n # /tipz/login\n url(r'^login/$', views.LoginFormView.as_view(), name='login'),\n\n # /tipz/logout\n url(r'^logout/$', views.LogoutFormView.as_view(), nam...
false
3,303
0d32fe36f71ffb3df56738664c5dbd0b8ae585e3
# -*- coding: utf-8 -*- """ Created on Sun Sep 19 17:15:58 2021 @author: Professional """ #son = int(input("Biror son kiriting: ") ) #print(son, "ning kvadrati", son*son, "ga teng") #print (son, "ning kubi", son*son*son, "ga teng") #yosh = int(input("Yoshingiz nechida: ")) #print("Siz", 2021 - yosh, "yil...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Sun Sep 19 17:15:58 2021\r\n\r\n@author: Professional\r\n\"\"\"\r\n\r\n#son = int(input(\"Biror son kiriting: \") )\r\n#print(son, \"ning kvadrati\", son*son, \"ga teng\")\r\n#print (son, \"ning kubi\", son*son*son, \"ga teng\")\r\n\r\n#yosh = int(input(\"Yoshingiz n...
false
3,304
442c6c4894fc01d0f8142f3dcedfd51ba57aedd1
from enum import Enum from typing import List, Optional from pydantic import BaseModel class Sizes(str, Enum): one_gram = "1g" two_and_half_gram = "2.5g" one_ounce = "1oz" five_ounce = "5oz" ten_ounce = "10oz" class PriceSort(str, Enum): gte = "gte" lte = "lte" class Metals(str, Enum):...
[ "from enum import Enum\nfrom typing import List, Optional\nfrom pydantic import BaseModel\n\n\nclass Sizes(str, Enum):\n one_gram = \"1g\"\n two_and_half_gram = \"2.5g\"\n one_ounce = \"1oz\"\n five_ounce = \"5oz\"\n ten_ounce = \"10oz\"\n\n\nclass PriceSort(str, Enum):\n gte = \"gte\"\n lte = ...
false
3,305
ec625bf57388281b3cbd464459fc3ad1c60b7db9
''' 多线程更新UI数据(在两个线程中传递数据) ''' from PyQt5.QtCore import QThread , pyqtSignal, QDateTime from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit import time import sys class BackendThread(QThread): update_date = pyqtSignal(str) def run(self): while True: data = QDateTime.current...
[ "'''\n\n多线程更新UI数据(在两个线程中传递数据)\n\n'''\n\nfrom PyQt5.QtCore import QThread , pyqtSignal, QDateTime\nfrom PyQt5.QtWidgets import QApplication, QDialog, QLineEdit\nimport time\nimport sys\n\n\nclass BackendThread(QThread):\n update_date = pyqtSignal(str)\n\n def run(self):\n while True:\n da...
false
3,306
3657d02271a27c150f4c67d67a2a25886b00c593
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 1 11:06:35 2020 @author: fitec """ # version 1 print(" Début du projet covid-19 !! ") print(" test repository distant")
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Nov 1 11:06:35 2020\n\n@author: fitec\n\"\"\"\n\n# version 1 \n\nprint(\" Début du projet covid-19 !! \")\nprint(\" test repository distant\")\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "<docstring token>\nprint(' Début du projet covid-19 !! ')\nprint...
false
3,307
acf69cd714f04aeceb4be39b8a7b2bc5d77cd69f
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE from sqlalchemy.orm import relationship from database import Base class User(Base): __tablename__ = "users" username = Column(String, primary_key=True, index=True) email = Column(String, unique=True, index=True) name = Column(...
[ "from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE\nfrom sqlalchemy.orm import relationship\n\nfrom database import Base\n\n\nclass User(Base):\n __tablename__ = \"users\"\n\n username = Column(String, primary_key=True, index=True)\n email = Column(String, unique=True, index=True)\n...
false
3,308
63830a3c09a2d0a267b030a336062d5e95b9a71a
from django.urls import path from . import views app_name = 'restuarant' urlpatterns = [ path('orderplaced/',views.orderplaced), path('restaurant/',views.restuarent,name='restuarant'), path('login/restaurant/',views.restLogin,name='rlogin'), path('register/restaurant/',views.restRegister,name='rregister...
[ "from django.urls import path\nfrom . import views\napp_name = 'restuarant'\nurlpatterns = [\n path('orderplaced/',views.orderplaced),\n path('restaurant/',views.restuarent,name='restuarant'),\n path('login/restaurant/',views.restLogin,name='rlogin'),\n path('register/restaurant/',views.restRegister,nam...
false
3,309
1cc8695aa694359314b6d478fe6abed29fdc6c91
def DFS(x): # 전위순회 if x > 7: return else: DFS((x * 2)) print(x) DFS((x*2)+1) if __name__ == "__main__": DFS(1)
[ "\ndef DFS(x):\n # 전위순회\n if x > 7:\n return\n else:\n \n DFS((x * 2))\n print(x)\n DFS((x*2)+1)\n\n \nif __name__ == \"__main__\":\n DFS(1)", "def DFS(x):\n if x > 7:\n return\n else:\n DFS(x * 2)\n print(x)\n DFS(x * 2 + 1)\n\n\...
false
3,310
67eb9985fc0ae9a00ce84a2460b69b00df1c9096
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client account_sid = 'AC76d9b17b2c23170b7019924f709f366b' auth_token = '8fba7a54c6e3dc3754043b3865fa9d82' client = Client(account_sid, auth_token) user_sample = [ { "_id": "5e804c501c9d440000986adc", "name"...
[ "# Download the helper library from https://www.twilio.com/docs/python/install\nfrom twilio.rest import Client\n\naccount_sid = 'AC76d9b17b2c23170b7019924f709f366b'\nauth_token = '8fba7a54c6e3dc3754043b3865fa9d82'\nclient = Client(account_sid, auth_token)\n\nuser_sample = [\n {\n \"_id\": \"5e804c501c9d44000098...
false
3,311
abb2cfd2113e8de6c7bba42c357f0ec140b224a9
from scrapy import cmdline cmdline.execute("scrapy crawl ariz".split())
[ "from scrapy import cmdline\ncmdline.execute(\"scrapy crawl ariz\".split())", "from scrapy import cmdline\ncmdline.execute('scrapy crawl ariz'.split())\n", "<import token>\ncmdline.execute('scrapy crawl ariz'.split())\n", "<import token>\n<code token>\n" ]
false
3,312
e5979aeb7cff0e2a75966924382bae87aebcfcb2
from random import random def random_numbers(): print('start generator') while True: val = random() print(f'will yield {val}') yield val def run_random_numbers(): print(f'{random_numbers=}') rnd_gen = random_numbers() print(f'{rnd_gen=}') print(f'{next(rnd_gen)=}') ...
[ "from random import random\n\n\ndef random_numbers():\n print('start generator')\n while True:\n val = random()\n print(f'will yield {val}')\n yield val\n\n\ndef run_random_numbers():\n print(f'{random_numbers=}')\n rnd_gen = random_numbers()\n print(f'{rnd_gen=}')\n print(f'{...
false
3,313
63822d60ef9dcc1e123a3d20874e9f492b439c6d
#! /usr/bin/env python3 # -*- coding:utf-8 -*- """ 企查查-行政许可[工商局] """ import json import time import random import requests from lxml import etree from support.use_mysql import QccMysql as db from support.others import DealKey as dk from support.others import TimeInfo as tm from support.headers import GeneralHeaders a...
[ "#! /usr/bin/env python3\n# -*- coding:utf-8 -*-\n\"\"\"\n企查查-行政许可[工商局]\n\"\"\"\nimport json\nimport time\nimport random\nimport requests\n\nfrom lxml import etree\n\nfrom support.use_mysql import QccMysql as db\nfrom support.others import DealKey as dk\nfrom support.others import TimeInfo as tm\nfrom support.heade...
false
3,314
ae71cbd17ec04125354d5aac1cf800f2dffa3e04
# new libraries import ConfigParser import logging from time import time from os import path # imports from nike.py below import smass import helperFunctions import clusterSMass_orig import numpy as np from joblib import Parallel, delayed def getConfig(section, item, boolean=False, userConfigFile="BMA_StellarMass_C...
[ "# new libraries\nimport ConfigParser\nimport logging\nfrom time import time\nfrom os import path\n# imports from nike.py below\nimport smass\nimport helperFunctions\nimport clusterSMass_orig\nimport numpy as np\nfrom joblib import Parallel, delayed\n\n\ndef getConfig(section, item, boolean=False,\n\t\tuserConfigFi...
true
3,315
3d0fe0c11e62a03b4701efb19e1c15272ccc985e
""" Batch viewset Viewset to batch serializer """ # Django Rest Framework from rest_framework import viewsets # Inventory models from apps.inventory.models import Batch # Inventory serializers from apps.inventory.serializers import BatchSerializer class BatchViewSet(viewsets.ModelViewSet): """ Batch views...
[ "\"\"\"\nBatch viewset\n\nViewset to batch serializer\n\"\"\"\n\n# Django Rest Framework\nfrom rest_framework import viewsets\n\n# Inventory models\nfrom apps.inventory.models import Batch\n\n# Inventory serializers\nfrom apps.inventory.serializers import BatchSerializer\n\n\nclass BatchViewSet(viewsets.ModelViewSe...
false
3,316
5485fe4f612ededc11e3a96dfd546e97a56cbe2a
# Generated by Django 2.2.5 on 2019-10-09 12:06 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import mptt.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MOD...
[ "# Generated by Django 2.2.5 on 2019-10-09 12:06\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport mptt.fields\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n migrations.swappable_dependency(sett...
false
3,317
fa045ccd4e54332f6c05bf64e3318e05b8123a10
# Generated by Django 2.2.13 on 2021-08-11 15:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("notifications", "0011_auto_20171229_1747"), ] operations = [ migrations.AlterField( model_name="notification", name...
[ "# Generated by Django 2.2.13 on 2021-08-11 15:38\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n (\"notifications\", \"0011_auto_20171229_1747\"),\n ]\n\n operations = [\n migrations.AlterField(\n model_name=\"notifica...
false
3,318
7a2b33d1763e66335c6a72a35082e20725cab03d
# -*- coding:utf-8 -*- # from django.core.paginator import Paginator def pagination(request, queryset, display_amount=15, after_range_num=5, bevor_range_num=4): # 按参数分页 paginator = Paginator(queryset, display_amount) try: # 得到request中的page参数 page = int(request.GET['page']) except: ...
[ "# -*- coding:utf-8 -*-\n#\nfrom django.core.paginator import Paginator\n\ndef pagination(request, queryset, display_amount=15, after_range_num=5, bevor_range_num=4):\n # 按参数分页\n paginator = Paginator(queryset, display_amount)\n try:\n # 得到request中的page参数\n page = int(request.GET['page'])\n ...
false
3,319
07aafcb3db9c57ad09a29a827d72744ef0d22247
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals from eight import * from whoosh.fields import TEXT, ID, Schema bw2_schema = Schema( name=TEXT(stored=True, sortable=True), comment=TEXT(stored=True), product=TEXT(stored=True, sortable=True), categories=TEXT(stored=True), ...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, unicode_literals\nfrom eight import *\n\nfrom whoosh.fields import TEXT, ID, Schema\n\nbw2_schema = Schema(\n name=TEXT(stored=True, sortable=True),\n comment=TEXT(stored=True),\n product=TEXT(stored=True, sortable=True),\n categories=TEXT...
false
3,320
33c241747062ab0d374082d2a8179335503fa212
""" Problem statement: https://leetcode.com/problems/contains-duplicate-ii/description/ Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k. """ class Solution: def c...
[ "\"\"\" Problem statement:\nhttps://leetcode.com/problems/contains-duplicate-ii/description/\n\nGiven an array of integers and an integer k, find out whether\nthere are two distinct indices i and j in the array such that nums[i] = nums[j]\nand the absolute difference between i and j is at most k.\n\"\"\"\n\n\nclass...
false
3,321
05454cc6c9961aa5e0de6979bb546342f5bd7b79
# The following code causes an infinite loop. Can you figure out what’s missing and how to fix it? # def print_range(start, end): # # Loop through the numbers from start to end # n = start # while n <= end: # print(n) # print_range(1, 5) # Should print 1 2 3 4 5 (each number on its own line) # Solution # Vari...
[ "# The following code causes an infinite loop. Can you figure out what’s missing and how to fix it?\n\n# def print_range(start, end):\n# \t# Loop through the numbers from start to end\n# \tn = start\n# \twhile n <= end:\n# \t\tprint(n)\n\n# print_range(1, 5) # Should print 1 2 3 4 5 (each number on its own line) \...
true
3,322
8ee26d181f06a2caf2b2b5a71a6113c245a89c03
#!/usr/bin/python # -*- coding : utf-8 -*- """ @author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com> """ # Director class Director(object): def __init__(self): self.builder = None def construct_building(self): self.builder.new_building() self.builder.build_floor...
[ "#!/usr/bin/python\n# -*- coding : utf-8 -*-\n\"\"\"\n @author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com>\n\"\"\"\n\n# Director\nclass Director(object):\n def __init__(self):\n self.builder = None\n \n def construct_building(self):\n self.builder.new_building()\n ...
true
3,323
d1402469232b5e3c3b09339849f6899e009fd74b
# -*- coding: utf-8 -*- scheme = 'http' hostname = 'localhost' port = 9000 routes = [ '/available/2', '/available/4' ]
[ "# -*- coding: utf-8 -*-\n\n\nscheme = 'http'\n\nhostname = 'localhost'\n\nport = 9000\n\nroutes = [\n '/available/2',\n '/available/4'\n]\n", "scheme = 'http'\nhostname = 'localhost'\nport = 9000\nroutes = ['/available/2', '/available/4']\n", "<assignment token>\n" ]
false
3,324
b8c749052af0061373808addea3ad419c35e1a29
v1=int(input("Introdu virsta primei persoane")) v2=int(input("Introdu virsta persoanei a doua")) v3=int(input("Introdu virsta persoanei a treia")) if ((v1>18)and(v1<60)): print(v1) elif((v2>18)and(v2<60)): print(v2) elif((v3>18)and(v3<60)): print(v3)
[ "v1=int(input(\"Introdu virsta primei persoane\"))\r\nv2=int(input(\"Introdu virsta persoanei a doua\"))\r\nv3=int(input(\"Introdu virsta persoanei a treia\"))\r\nif ((v1>18)and(v1<60)):\r\n print(v1)\r\nelif((v2>18)and(v2<60)):\r\n print(v2)\r\nelif((v3>18)and(v3<60)):\r\n print(v3)", "v1 = int(input('I...
false
3,325
e12c411814efd7cc7417174b51f0f756589ca40b
was=input() print(was)
[ "was=input()\nprint(was)\n", "was = input()\nprint(was)\n", "<assignment token>\nprint(was)\n", "<assignment token>\n<code token>\n" ]
false
3,326
4ba0f7e947830018695c8c9e68a96426f49b4b5b
from ddt import ddt, data, unpack import sys sys.path.append("..") from pages.homepage import HomePage from base.basetestcase import BaseTestCase from helpers.filedatahelper import get_data @ddt class QuickSearchTest(BaseTestCase): testingdata = get_data('testdata/QuickSearchTestData.xlsx') @data(*testingdata...
[ "from ddt import ddt, data, unpack\nimport sys\nsys.path.append(\"..\")\nfrom pages.homepage import HomePage\nfrom base.basetestcase import BaseTestCase\nfrom helpers.filedatahelper import get_data\n\n\n@ddt\nclass QuickSearchTest(BaseTestCase):\n testingdata = get_data('testdata/QuickSearchTestData.xlsx')\n ...
false
3,327
896329a8b14d79f849e4a8c31c697f3981395790
# 문제 풀이 진행중..(나중에 재도전) import collections class Solution(object): def removeStones(self, stones): """ :type stones: List[List[int]] :rtype: int """ # 전체 연결점 개수 확인한다. # 개수가 적은 것 부터 처리한다 # # 연결된 게 0개인 애들은 제외 # # data init stones_share_li...
[ "# 문제 풀이 진행중..(나중에 재도전)\nimport collections\nclass Solution(object):\n def removeStones(self, stones):\n \"\"\"\n :type stones: List[List[int]]\n :rtype: int\n \"\"\"\n # 전체 연결점 개수 확인한다.\n # 개수가 적은 것 부터 처리한다\n # # 연결된 게 0개인 애들은 제외\n #\n\n # data init...
false
3,328
7db31940aea27c10057e2ce1e02410994bd2039b
from ROOT import * import math import os,sys,time,glob,fnmatch import argparse import ROOT import sys sys.path.append("utils") from moments import * from dirhandle import * from plothandle import * from AnalysisGeneratorMT import * def doAnalysis( blabla): return blabla.DoThreatdAnalysis() if __name__ =...
[ "from ROOT import *\nimport math\nimport os,sys,time,glob,fnmatch\nimport argparse\nimport ROOT\nimport sys\nsys.path.append(\"utils\")\nfrom moments import *\nfrom dirhandle import *\nfrom plothandle import *\nfrom AnalysisGeneratorMT import *\n\ndef doAnalysis( blabla):\n return blabla.DoThreatdAnalys...
true
3,329
60617ff6eda880e5467b3b79d3df13a7147f5990
import math def sieve(n): sieve = [1] * (n+1) sieve[1] = 0 sieve[0] = 0 for i in range(2, int(math.sqrt(n) + 1)): if sieve[i] == 1: for j in range(i*i, n + 1, i): sieve[j] = 0 return sieve def odd_prime(a): while a != 0: y = a % 10 if y == 3 ...
[ "import math\n\n\ndef sieve(n):\n sieve = [1] * (n+1)\n sieve[1] = 0\n sieve[0] = 0\n for i in range(2, int(math.sqrt(n) + 1)):\n if sieve[i] == 1:\n for j in range(i*i, n + 1, i):\n sieve[j] = 0\n return sieve\ndef odd_prime(a):\n while a != 0:\n y = a % 10...
false
3,330
c925bed2f4d8120e156caebbe8e6bf9d6a51ee37
import csv import glob import random import sys from math import ceil, floor from os.path import basename, exists, dirname, isfile import numpy as np import keras from keras import Model, Input, regularizers from keras.layers import TimeDistributed, LSTMCell, Reshape, Dense, Lambda, Dropout, Concatenate from keras.cal...
[ "import csv\nimport glob\nimport random\nimport sys\nfrom math import ceil, floor\nfrom os.path import basename, exists, dirname, isfile\n\nimport numpy as np\nimport keras\nfrom keras import Model, Input, regularizers\nfrom keras.layers import TimeDistributed, LSTMCell, Reshape, Dense, Lambda, Dropout, Concatenate...
false
3,331
10990282c8aa0b9b26a69e451132ff37257acbc6
from django.views.generic import ListView class ExperimentList(ListView): pass
[ "from django.views.generic import ListView\n\nclass ExperimentList(ListView):\n pass\n", "from django.views.generic import ListView\n\n\nclass ExperimentList(ListView):\n pass\n", "<import token>\n\n\nclass ExperimentList(ListView):\n pass\n", "<import token>\n<class token>\n" ]
false
3,332
09698649510348f92ea3b83f89ffa1c844929b8f
import numpy def CALCB1(NVAC,KGAS,LGAS,ELECEN,ISHELL,L1): # IMPLICIT #real*8(A-H,O-Z) # IMPLICIT #integer*8(I-N) #CHARACTER*6 # SCR=""#(17) # SCR1=""#(17) #COMMON/GENCAS/ global ELEV#[17,79] global NSDEG#(17) global AA#[17] global BB#[17] global SCR,SCR1 #COMMON/MIXC/ global PRSH#(6,3,17,17) global ESH#(6...
[ "import numpy\ndef CALCB1(NVAC,KGAS,LGAS,ELECEN,ISHELL,L1):\n\t# IMPLICIT #real*8(A-H,O-Z)\n\t# IMPLICIT #integer*8(I-N)\n\t#CHARACTER*6\n\t# SCR=\"\"#(17)\n\t# SCR1=\"\"#(17)\n\t#COMMON/GENCAS/\n\tglobal ELEV#[17,79]\n\tglobal NSDEG#(17)\n\tglobal AA#[17]\n\tglobal BB#[17]\n\tglobal SCR,SCR1\n\t#COMMON/MIXC/\n\tgl...
false
3,333
9c85252b4048b5412978b3ac05cd6dde4479e3bf
from ctypes import CDLL svg2pdf = CDLL("./libsvg2pdf.so") svg2pdf.svg2pdf("report.svg", "teste2.pdf") svg2pdf.svg2pdf2("report.svg", "teste3.pdf")
[ "from ctypes import CDLL\nsvg2pdf = CDLL(\"./libsvg2pdf.so\")\nsvg2pdf.svg2pdf(\"report.svg\", \"teste2.pdf\")\nsvg2pdf.svg2pdf2(\"report.svg\", \"teste3.pdf\")\n", "from ctypes import CDLL\nsvg2pdf = CDLL('./libsvg2pdf.so')\nsvg2pdf.svg2pdf('report.svg', 'teste2.pdf')\nsvg2pdf.svg2pdf2('report.svg', 'teste3.pdf'...
false
3,334
61b28088e4344d8a94006e5c04c189a44bbb6ff3
#!c:\Python\python.exe # Fig 35.16: fig35_16.py # Program to display CGI environment variables import os import cgi print "Content-type: text/html" print print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">""" print """ <html xmlns = "http://www...
[ "#!c:\\Python\\python.exe\r\n# Fig 35.16: fig35_16.py\r\n# Program to display CGI environment variables\r\n\r\nimport os\r\nimport cgi\r\n\r\nprint \"Content-type: text/html\"\r\nprint\r\n\r\nprint \"\"\"<!DOCTYPE html PUBLIC\r\n \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\r\n \"DTD/xhtml1-transitional.dtd\">\"\...
true
3,335
8de82d09c8a9a1c1db59b0cac9cf8dda04f35847
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import copy import json import os import convlab from convlab.modules.dst.multiwoz.dst_util import init_state from convlab.modules.dst.multiwoz.dst_util import normalize_value from convlab.modules.dst.state_tracker import Tracker from convlab.mo...
[ "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n\nimport copy\nimport json\nimport os\n\nimport convlab\nfrom convlab.modules.dst.multiwoz.dst_util import init_state\nfrom convlab.modules.dst.multiwoz.dst_util import normalize_value\nfrom convlab.modules.dst.state_tracker import Tracker\...
false
3,336
6e6c6c5795e8723a86ae5dfc8f40df57d3dd10f7
#!/usr/bin/env python import argparse import csv import glob import os import sys def run_main(): """ Main function to process user input and then generate the description files for each run :return: exit code -- 0 on success, 1 otherwise """ parser = argparse.ArgumentParser(description="Scan a...
[ "#!/usr/bin/env python\n\nimport argparse\nimport csv\nimport glob\nimport os\nimport sys\n\n\ndef run_main():\n \"\"\"\n Main function to process user input and then generate the description files for each run\n\n :return: exit code -- 0 on success, 1 otherwise\n \"\"\"\n\n parser = argparse.Argumen...
false
3,337
00587de133ee68415f31649f147fbff7e9bf65d5
# Print name and marks f = open("marks.txt", "rt") for line in f: line = line.strip() if len(line) == 0: # Blank line continue name, *marks = line.split(",") if len(marks) == 0: continue marks = filter(str.isdigit, marks) # Take only numbers total = sum(map(int, marks)) ...
[ "# Print name and marks\nf = open(\"marks.txt\", \"rt\")\nfor line in f:\n line = line.strip()\n if len(line) == 0: # Blank line\n continue\n\n name, *marks = line.split(\",\")\n if len(marks) == 0:\n continue\n\n marks = filter(str.isdigit, marks) # Take only numbers\n total = sum...
false
3,338
0dd17d8872b251fbc59a322bf3c695bd8079aba4
#-*- coding: utf-8 -*- """ Django settings for HyperKitty + Postorius Pay attention to settings ALLOWED_HOSTS and DATABASES! """ from os.path import abspath, dirname, join as joinpath from ConfigParser import SafeConfigParser def read_cfg(path, section=None, option=None): config = SafeConfigParser() config.r...
[ "#-*- coding: utf-8 -*-\n\"\"\"\nDjango settings for HyperKitty + Postorius\n\nPay attention to settings ALLOWED_HOSTS and DATABASES!\n\"\"\"\nfrom os.path import abspath, dirname, join as joinpath\nfrom ConfigParser import SafeConfigParser\n\n\ndef read_cfg(path, section=None, option=None):\n config = SafeConfi...
false
3,339
894fa01e16d200add20f614fd4a5ee9071777db9
# -*- coding: utf-8 -*- from scrapy import Request from ..items import ZhilianSpiderItem from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor from scrapy_redis.spiders import RedisCrawlSpider class ZhilianSpider(RedisCrawlSpider): name = 'zhilianspider' headers = { 'User-Ag...
[ "# -*- coding: utf-8 -*-\nfrom scrapy import Request\nfrom ..items import ZhilianSpiderItem\nfrom scrapy.spiders import Rule\nfrom scrapy.linkextractors import LinkExtractor\nfrom scrapy_redis.spiders import RedisCrawlSpider\n\n\nclass ZhilianSpider(RedisCrawlSpider):\n name = 'zhilianspider'\n\n headers = {\...
false
3,340
8435a69ee9793435c7483df9bb15f01ef8051479
movies = ["Abraham Lincoln", "Blue Steel", "Behind Office Doors", "Bowery at Midnight", "Captain Kidd", "Debbie Does Dallas", "The Emperor Jones", "Rain"] movies_tuple = [("Abraham Lincoln", 1993), ("Blue Steel", 1938), ("Behind Office Doors", 1999), ("Bowery at Midnight", 2000), ("Captain Kidd",2010), ("Debbie Does D...
[ "movies = [\"Abraham Lincoln\", \"Blue Steel\", \"Behind Office Doors\", \"Bowery at Midnight\", \"Captain Kidd\", \"Debbie Does Dallas\", \"The Emperor Jones\", \"Rain\"]\n\nmovies_tuple = [(\"Abraham Lincoln\", 1993), (\"Blue Steel\", 1938), (\"Behind Office Doors\", 1999), (\"Bowery at Midnight\", 2000), (\"Capt...
false
3,341
97bbbbe6a3a89b9acc22ebdff0b96625d6267178
import numpy as np import itertools as itt from random import random from sys import float_info DIGITS = 3 ACCURACY = 0.001 UP_MAX = 30 class AngleInfo(object): def __init__(self, information): # 0 <= spin <= 360 # 0 <= up <= UP_MAX # -1 <= sin, cos <= 1 if len(information) == 2: ...
[ "import numpy as np\nimport itertools as itt\nfrom random import random\nfrom sys import float_info\n\nDIGITS = 3\nACCURACY = 0.001\nUP_MAX = 30\n\nclass AngleInfo(object):\n\n def __init__(self, information):\n # 0 <= spin <= 360\n # 0 <= up <= UP_MAX\n # -1 <= sin, cos <= 1\n if len...
true
3,342
6d244b719200ae2a9c1a738e746e8c401f8ba4e2
from django.conf.urls.defaults import * ## reports view urlpatterns = patterns('commtrack_reports.views', (r'^commtrackreports$', 'reports'), (r'^sampling_points$', 'sampling_points'), (r'^commtrack_testers$', 'testers'), (r'^date_range$', 'date_range'), (r'^create_report$', 'create_report'), (...
[ "from django.conf.urls.defaults import *\n\n## reports view\nurlpatterns = patterns('commtrack_reports.views',\n (r'^commtrackreports$', 'reports'),\n (r'^sampling_points$', 'sampling_points'),\n (r'^commtrack_testers$', 'testers'),\n (r'^date_range$', 'date_range'),\n (r'^create_report$', 'create_re...
false
3,343
d7daf9b26f0b9f66b15b8533df032d17719e548b
""" This is a post login API and hence would have APIDetails and SessionDetails in the request object ------------------------------------------------------------------------------------------------- Step 1: find if user's ip address is provided in the request object, if yes then got to step 2 else goto step 4 Step 2: ...
[ "\"\"\"\nThis is a post login API and hence would have APIDetails and SessionDetails in the request object\n-------------------------------------------------------------------------------------------------\nStep 1: find if user's ip address is provided in the request object, if yes then got to step 2 else goto step...
false
3,344
9cb3d8bc7af0061047136d57abfe68cbb5ae0cd7
'''给定一个只包含小写字母的有序数组letters 和一个目标字母 target,寻找有序数组里面比目标字母大的最小字母。 数组里字母的顺序是循环的。举个例子,如果目标字母target = 'z' 并且有序数组为 letters = ['a', 'b'],则答案返回 'a'。输入: 示例: letters = ["c", "f", "j"] target = "a" 输出: "c" ''' class Solution(object): def nextGreatestLetter(self, letters, target): """ :type letters: List[str] ...
[ "'''给定一个只包含小写字母的有序数组letters 和一个目标字母 target,寻找有序数组里面比目标字母大的最小字母。\n\n数组里字母的顺序是循环的。举个例子,如果目标字母target = 'z' 并且有序数组为 letters = ['a', 'b'],则答案返回 'a'。输入:\n\n示例:\nletters = [\"c\", \"f\", \"j\"]\ntarget = \"a\"\n输出: \"c\"\n'''\nclass Solution(object):\n def nextGreatestLetter(self, letters, target):\n \"\"\"\n ...
false
3,345
00f95733505b3e853a76bbdd65439bcb230fa262
import subprocess import glob import os import time import sys import xml.etree.ElementTree as ET import getpass import psutil if len(sys.argv)==1: photoscanname = r"C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe" scriptname = r"C:\Users\slocumr\github\SimUAS\batchphotoscan\agiproc.py" #xmlnames ...
[ "import subprocess\nimport glob\nimport os\nimport time\nimport sys\nimport xml.etree.ElementTree as ET\nimport getpass\nimport psutil\n\nif len(sys.argv)==1:\n photoscanname = r\"C:\\Program Files\\Agisoft\\PhotoScan Pro\\photoscan.exe\"\n scriptname = r\"C:\\Users\\slocumr\\github\\SimUAS\\batchphotoscan...
false
3,346
1c6077d965f5bc8c03344b53d11851f5cd50bca8
from Task2.src.EmailInterpreter import EmailInterpreter import os # Part B: # ------- # Write a child-class of the previously written base class, which # implements the 'split_file' function, simply by treating each line as a # unit (it returns the list of lines). class LineBreaker(EmailInterpreter): def split_file...
[ "from Task2.src.EmailInterpreter import EmailInterpreter\nimport os\n# Part B:\n# -------\n# Write a child-class of the previously written base class, which\n# implements the 'split_file' function, simply by treating each line as a\n# unit (it returns the list of lines).\nclass LineBreaker(EmailInterpreter):\n d...
false
3,347
b091d00f5b5e997de87b36adbe9ce603a36ca49c
from django.apps import AppConfig class ScambioConfig(AppConfig): name = 'scambio'
[ "from django.apps import AppConfig\n\n\nclass ScambioConfig(AppConfig):\n name = 'scambio'\n", "<import token>\n\n\nclass ScambioConfig(AppConfig):\n name = 'scambio'\n", "<import token>\n\n\nclass ScambioConfig(AppConfig):\n <assignment token>\n", "<import token>\n<class token>\n" ]
false
3,348
2a6b373c443a1bbafe644cb770bc163536dd5573
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
[ "###############################################################################\n##\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah. \n## All rights reserved.\n## Contact: contact@vistrails.org\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source...
false
3,349
73a4b3497952f90029ba24b73b835de53fc687ec
import constants from auth.storage import Storage from utils import create_error_with_status from flask import jsonify, request, current_app def register_user(): try: email = request.json["email"] password = request.json["password"] except KeyError: status = constants.statuses["user"...
[ "import constants\nfrom auth.storage import Storage\n\nfrom utils import create_error_with_status\n\nfrom flask import jsonify, request, current_app\n\n\ndef register_user():\n try:\n email = request.json[\"email\"]\n password = request.json[\"password\"]\n except KeyError:\n status = con...
false
3,350
6bd47fb71a32b8383a75e72111d802008bc6bc68
# coding: utf-8 # In[2]: from HSTLens_base_classifier_resnet17_s import BaseKerasClassifier from keras.layers import Activation, AveragePooling2D, MaxPooling2D from keras.layers import Conv2D, ELU, Dropout, LeakyReLU from keras.layers.normalization import BatchNormalization class deeplens_classifier(BaseKerasCl...
[ "\n# coding: utf-8\n\n# In[2]:\n\n\n\nfrom HSTLens_base_classifier_resnet17_s import BaseKerasClassifier\n\nfrom keras.layers import Activation, AveragePooling2D, MaxPooling2D\nfrom keras.layers import Conv2D, ELU, Dropout, LeakyReLU\n\nfrom keras.layers.normalization import BatchNormalization\n\nclass deeplens_cla...
false
3,351
f3da38f2c4fda0a1d54e79c2c21070f98002b88d
# -*- coding=utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
[ "# -*- coding=utf-8 -*-\n\n# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the MIT License.\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; withou...
false
3,352
85fff1f6e1f69dd0e2e9b5acc90db31d27329c7c
from django import forms class PasswordChangeForm(forms.Form): password = forms.CharField(min_length=8, label="New Password*", strip=False, widget=forms.PasswordInput( attrs={'autocomple...
[ "from django import forms\n\n\nclass PasswordChangeForm(forms.Form):\n password = forms.CharField(min_length=8,\n label=\"New Password*\",\n strip=False,\n widget=forms.PasswordInput(\n att...
false
3,353
70fcf25cd7d70972e8042dc882f6ecb12d36461a
from django.shortcuts import render,redirect,get_object_or_404 from .models import Blog,UseCase,Comment from courses.models import offerings from django.contrib.auth.models import User from django.contrib import auth from django.contrib.auth.decorators import login_required from django.utils import timezone from django...
[ "from django.shortcuts import render,redirect,get_object_or_404\nfrom .models import Blog,UseCase,Comment\nfrom courses.models import offerings\nfrom django.contrib.auth.models import User\nfrom django.contrib import auth\nfrom django.contrib.auth.decorators import login_required\nfrom django.utils import timezone\...
false
3,354
8205541dcdd4627a535b14c6775f04b80e7c0d15
''' Created on Dec 23, 2011 @author: boatkrap ''' import kombu from kombu.common import maybe_declare from . import queues import logging logger = logging.getLogger(__name__) import threading cc = threading.Condition() class Publisher: def __init__(self, exchange_name, channel, routing_key=None): s...
[ "'''\nCreated on Dec 23, 2011\n\n@author: boatkrap\n'''\n\nimport kombu\nfrom kombu.common import maybe_declare\n\nfrom . import queues\n\nimport logging\nlogger = logging.getLogger(__name__)\n\nimport threading\ncc = threading.Condition()\n\n\nclass Publisher:\n\n def __init__(self, exchange_name, channel, rout...
false
3,355
e2e34db52e17c188cab63a870f0bc77cbc9ef922
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import random import helper as hp def insertion_sort(items, start, end): """ Arguments: - `items`: """ n = end - start + 1 for i in range(start+1, end+1): for j in range(i, start, -1): if items[j] < items[j-1]: ...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\nimport random\n\nimport helper as hp\n\ndef insertion_sort(items, start, end):\n \"\"\"\n\n Arguments:\n - `items`:\n \"\"\"\n n = end - start + 1\n for i in range(start+1, end+1):\n for j in range(i, start, -1):\n if i...
true
3,356
96910e9b6861fc9af0db3a3130d898fd1ee3daad
#!/usr/bin/python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2018 foree <foree@foree-pc> # # Distributed under terms of the MIT license. """ 配置logging的基本配置 """ import logging import sys import os from common.common import get_root_path FILE_LEVEL = logging.DEBUG STREAM_LEVEL = logging.WARN LOG_DIR = ...
[ "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n# vim:fenc=utf-8\n#\n# Copyright © 2018 foree <foree@foree-pc>\n#\n# Distributed under terms of the MIT license.\n\n\"\"\"\n配置logging的基本配置\n\"\"\"\nimport logging\nimport sys\nimport os\nfrom common.common import get_root_path\n\n\nFILE_LEVEL = logging.DEBUG\nSTREAM_LEV...
false
3,357
e533b7aadd1cd7137301af8862dd2987622e499e
#!/bin/env python from boincvm_common.stomp.StompProtocol import StompProtocolFactory from stomp.HostStompEngine import HostStompEngine from boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService from twisted.internet import reactor from ConfigParser import SafeConfigParser import coilmq.start import loggi...
[ "#!/bin/env python\n\nfrom boincvm_common.stomp.StompProtocol import StompProtocolFactory\nfrom stomp.HostStompEngine import HostStompEngine\n\nfrom boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService\n\nfrom twisted.internet import reactor\nfrom ConfigParser import SafeConfigParser\n\nimport coilmq.star...
true
3,358
fcfec521e071aa586febc74efb2deb0e9d0a331e
from sys import stdin def IsPrime(x): for i in range(2, int(x ** 0.5) + 1): if not x % i: return False return True for x in stdin: x = x[:-1] y = x[::-1] a = IsPrime(int(x)) b = IsPrime(int(y)) if not a: print("%s is not prime." %x) elif (a and not ...
[ "from sys import stdin\n\ndef IsPrime(x):\n for i in range(2, int(x ** 0.5) + 1):\n if not x % i:\n return False\n \n return True\n\nfor x in stdin:\n x = x[:-1]\n y = x[::-1]\n a = IsPrime(int(x))\n b = IsPrime(int(y))\n if not a:\n print(\"%s is not prime.\" %x...
false
3,359
0065a493767a2080a20f8b55f76ddeae92dc27f1
/home/mitchellwoodbine/Documents/github/getargs/GetArgs.py
[ "/home/mitchellwoodbine/Documents/github/getargs/GetArgs.py" ]
true
3,360
1ab5c6a56ac229c5a9892a9848c62a9a19a0dda7
print('\n----------------概率与统计--------------------') import numpy as np import scipy import sympy as sym import matplotlib.pyplot as plt import sklearn.datasets as sd iris = sd.load_iris() x1 = np.random.random([10000]) # 均匀分布 x2 = np.random.normal(2, 1, [10000]) # 正态分布 x3 = np.random.normal(5, 1, [10000]) # 正态分布 #...
[ "print('\\n----------------概率与统计--------------------')\nimport numpy as np\nimport scipy\nimport sympy as sym\nimport matplotlib.pyplot as plt\nimport sklearn.datasets as sd\n\niris = sd.load_iris()\nx1 = np.random.random([10000]) # 均匀分布\nx2 = np.random.normal(2, 1, [10000]) # 正态分布\nx3 = np.random.normal(5, 1, [1...
false
3,361
7b9bf791d52fdc801e24d0c8541d77d91a488e12
from typing import Any, Sequence, Callable, Union, Optional import pandas as pd import numpy as np from .taglov import TagLoV def which_lov(series: pd.Series, patterns: Sequence[Sequence[Any]], method: Optional[Union[Callable, str]] = None, **kwargs) -> np.ndarray: """Whi...
[ "from typing import Any, Sequence, Callable, Union, Optional\nimport pandas as pd\nimport numpy as np\nfrom .taglov import TagLoV\n\n\ndef which_lov(series: pd.Series,\n patterns: Sequence[Sequence[Any]],\n method: Optional[Union[Callable, str]] = None,\n **kwargs) -> np.ndarr...
false
3,362
85c51f155439ff0cb570faafc48ac8da094515bf
# the age of some survivors survived_age = [48.0, 15.0, 40.0, 36.0, 47.0, \ 32.0, 60.0, 31.0, 17.0, 36.0, 39.0, 36.0, 32.5, \ 39.0, 38.0, 36.0, 52.0, 29.0, 35.0, 35.0, 49.0, \ 16.0, 27.0, 22.0, 27.0, 35.0, 3.0, 11.0, 36.0, \ 1.0, 19.0, 24.0, 33.0, 43.0, 24.0, 32.0, 49.0, \ 30.0, 49.0, 60.0, 23.0, 26.0, 24.0, 40.0, 25.0...
[ "# the age of some survivors\nsurvived_age = [48.0, 15.0, 40.0, 36.0, 47.0, \\\n32.0, 60.0, 31.0, 17.0, 36.0, 39.0, 36.0, 32.5, \\\n39.0, 38.0, 36.0, 52.0, 29.0, 35.0, 35.0, 49.0, \\\n16.0, 27.0, 22.0, 27.0, 35.0, 3.0, 11.0, 36.0, \\\n1.0, 19.0, 24.0, 33.0, 43.0, 24.0, 32.0, 49.0, \\\n30.0, 49.0, 60.0, 23.0, 26.0, ...
false
3,363
49703775da87e8cbbe78a69c91a68128c3fd78e1
from django.shortcuts import render, redirect from .models import League, Team, Player from django.db.models import Count from . import team_maker def index(request): baseball = League.objects.filter(name__contains='Baseball') women_league = League.objects.filter(name__contains='women') hockey_league = ...
[ "from django.shortcuts import render, redirect\nfrom .models import League, Team, Player\nfrom django.db.models import Count\n\nfrom . import team_maker\n\n\ndef index(request):\n\n baseball = League.objects.filter(name__contains='Baseball')\n women_league = League.objects.filter(name__contains='women')\n ...
false
3,364
68fa47e528e5c7c553c3c49ee5b7372b8a956302
import socket import struct from fsuipc_airspaces.position import Position # Adapted from tools/faker.js in github.com/foucdeg/airspaces _START_BUFFER = bytes([68, 65, 84, 65, 60, 20, 0, 0, 0]) _END_BUFFER = bytes([0] * 20) _START_TRANSPONDER = bytes([104, 0, 0, 0, 0, 0, 0, 0]) _END_TRANSPONDER = bytes([0] * 24) d...
[ "import socket\nimport struct\n\nfrom fsuipc_airspaces.position import Position\n\n\n# Adapted from tools/faker.js in github.com/foucdeg/airspaces\n_START_BUFFER = bytes([68, 65, 84, 65, 60, 20, 0, 0, 0])\n_END_BUFFER = bytes([0] * 20)\n_START_TRANSPONDER = bytes([104, 0, 0, 0, 0, 0, 0, 0])\n_END_TRANSPONDER = byte...
false
3,365
362bfc5a35b09817ce071e71a72e574a28ea287d
from itertools import groupby def solve(tribes): attacks = [] for t in tribes: D, N, W, E, S, DD, DP, DS = t for i in range(N): d = D + DD * i w = W + DP * i e = E + DP * i s = S + DS * i attacks.append((d, w, e, s)) attacks = sort...
[ "from itertools import groupby\n\ndef solve(tribes):\n attacks = []\n for t in tribes:\n D, N, W, E, S, DD, DP, DS = t\n for i in range(N):\n d = D + DD * i\n w = W + DP * i\n e = E + DP * i\n s = S + DS * i\n attacks.append((d, w, e, s))\n ...
false
3,366
958f6e539f9f68892d77b6becc387581c6adfa16
""" Tests for the Transformer RNNCell. """ import pytest import numpy as np import tensorflow as tf from .transformer import positional_encoding, transformer_layer from .cell import (LimitedTransformerCell, UnlimitedTransformerCell, inject_at_timestep, sequence_masks) def test_inject_at_timestep...
[ "\"\"\"\nTests for the Transformer RNNCell.\n\"\"\"\n\nimport pytest\n\nimport numpy as np\nimport tensorflow as tf\n\nfrom .transformer import positional_encoding, transformer_layer\nfrom .cell import (LimitedTransformerCell, UnlimitedTransformerCell,\n inject_at_timestep, sequence_masks)\n\n\nde...
false
3,367
c6b80a7dfce501bfe91f818ac7ab45238a0a126b
#!/usr/bin/env python # -*- coding: utf-8 -*- import enhancedyaml import vector def roots_of_n_poly_eq(n, x, var_upper_bounds=tuple()): '''find the all possible non-negative interger roots of a `n`-term polynomial equals `x`.''' countdown = lambda: xrange(x if not var_upper_bounds else var_upper_bounds[0], -...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport enhancedyaml\nimport vector\n\ndef roots_of_n_poly_eq(n, x, var_upper_bounds=tuple()):\n '''find the all possible non-negative interger roots of a `n`-term polynomial equals `x`.'''\n\n countdown = lambda: xrange(x if not var_upper_bounds else var_uppe...
true
3,368
1f40c0ed8e449354a5a87ef18bb07978a9fb8a1c
#!/usr/bin/env python import utils def revcomp(s): comp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'} return ''.join([comp[c] for c in reversed(s)]) def reverse_palindromes(s): results = [] l = len(s) for i in range(l): for j in range(4, 13): if i + j > l: continue ...
[ "#!/usr/bin/env python\n\nimport utils\n\ndef revcomp(s):\n comp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}\n return ''.join([comp[c] for c in reversed(s)])\n\ndef reverse_palindromes(s):\n results = []\n l = len(s)\n for i in range(l):\n for j in range(4, 13):\n if i + j > l:\n ...
true
3,369
a3fc624d6d101667ab11842eac96ed1b34d4317e
from django.apps import AppConfig class AccountsnConfig(AppConfig): name = 'accounts'
[ "from django.apps import AppConfig\n\n\nclass AccountsnConfig(AppConfig):\n name = 'accounts'\n", "<import token>\n\n\nclass AccountsnConfig(AppConfig):\n name = 'accounts'\n", "<import token>\n\n\nclass AccountsnConfig(AppConfig):\n <assignment token>\n", "<import token>\n<class token>\n" ]
false
3,370
1c8b843174521f1056e2bac472c87d0b5ec9603e
#!/usr/bin/python import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D import numpy as np occl_frac = 0.445188 result = [1-occl_frac, occl_frac, 0] #Reading res_data.txt mnfa = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] #min NN factor array nna = [2,3,4,5,6,7,8,9,10,11,12,1...
[ "#!/usr/bin/python\nimport matplotlib.pyplot as plt\nfrom matplotlib import cm\nfrom mpl_toolkits.mplot3d import Axes3D\nimport numpy as np\n\noccl_frac = 0.445188\nresult = [1-occl_frac, occl_frac, 0]\n\n#Reading res_data.txt\nmnfa = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] #min NN factor array\nnna = [2,3,4,5,6,...
true
3,371
c0bf146ebfdb54cce80ef85c4c7f4a61632e67d4
# Generated by Django 3.0.2 on 2020-02-18 05:52 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('myapp', '0003_admin'), ] operations = [ migrations.DeleteModel( name='admin', ), migrations.RemoveField( mod...
[ "# Generated by Django 3.0.2 on 2020-02-18 05:52\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('myapp', '0003_admin'),\n ]\n\n operations = [\n migrations.DeleteModel(\n name='admin',\n ),\n migrations.RemoveFi...
false
3,372
f26b127b4d968c1a168a57825a5acfffbf027bef
# -*- coding: utf-8 -*- from odoo import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' purchase_type = fields.Many2one('purchase.order.type', string='Purchase Order Type')
[ "# -*- coding: utf-8 -*-\n\nfrom odoo import models, fields, api\n\n\nclass ResPartner(models.Model):\n _inherit = 'res.partner'\n\n purchase_type = fields.Many2one('purchase.order.type', string='Purchase Order Type')\n", "from odoo import models, fields, api\n\n\nclass ResPartner(models.Model):\n _inher...
false
3,373
f9a0c3b643c2ee6bb6778477bf8fc21564812081
# -*- coding: utf-8 -*- # @Time : 2019/9/17 17:48 # @Author : ZhangYang # @Email : ian.zhang.88@outlook.com from functools import wraps def create_new_sequence_node(zk_client, base_path, prefix, is_ephemeral=False): if not zk_client.exists(base_path): zk_client.ensure_path(base_path) new_node =...
[ "# -*- coding: utf-8 -*-\n# @Time : 2019/9/17 17:48\n# @Author : ZhangYang\n# @Email : ian.zhang.88@outlook.com\nfrom functools import wraps\n\n\ndef create_new_sequence_node(zk_client, base_path, prefix, is_ephemeral=False):\n if not zk_client.exists(base_path):\n zk_client.ensure_path(base_path)\n...
false
3,374
ad5a9e353d065eee477381aa6b1f233f975ea0ed
""" Auteur:Fayçal Chena Date : 07 avril 2020 Consignes : Écrire une fonction alea_dice(s) qui génère trois nombres (pseudo) aléatoires à l’aide de la fonction randint du module random, représentant trois dés (à six faces avec les valeurs de 1 à 6), et qui renvoie la valeur booléenne True si les dés forment un 421, et l...
[ "\"\"\"\nAuteur:Fayçal Chena\nDate : 07 avril 2020\nConsignes :\nÉcrire une fonction alea_dice(s) qui génère trois nombres (pseudo) aléatoires à l’aide\nde la fonction randint du module random, représentant trois dés (à six faces avec\nles valeurs de 1 à 6), et qui renvoie la valeur booléenne True si les dés formen...
false
3,375
bf683f8e7fb5ad5f7cd915a8a01d9adf7d13e739
def first_repeat(chars): for x in chars: if chars.count(x) > 1: return x return '-1'
[ "\ndef first_repeat(chars):\n for x in chars:\n if chars.count(x) > 1:\n return x\n return '-1'\n\n", "def first_repeat(chars):\n for x in chars:\n if chars.count(x) > 1:\n return x\n return '-1'\n", "<function token>\n" ]
false
3,376
bea1a5bc9c92d095a2f187a4c06d18d0a939f233
source = open("input.txt", "r") total = 0 def calculateWeight( weight ): fuel = calculateFuel(weight) if fuel > 0: sum = fuel + calculateWeight(fuel) return sum else: return max(0, fuel) def calculateFuel ( weight ): return weight // 3 -2 for line in source.readlines(): t...
[ "source = open(\"input.txt\", \"r\")\ntotal = 0\n\ndef calculateWeight( weight ):\n fuel = calculateFuel(weight)\n if fuel > 0:\n sum = fuel + calculateWeight(fuel)\n return sum\n else:\n return max(0, fuel)\n\n\ndef calculateFuel ( weight ):\n return weight // 3 -2\n\nfor line in s...
false
3,377
6018f35afc6646d0302ca32de649ffe7d544a765
""" Make html galleries from media directories. Organize by dates, by subdirs or by the content of a diary file. The diary file is a markdown file organized by dates, each day described by a text and some medias (photos and movies). The diary file can be exported to: * an html file with the text and subset of medias a...
[ "\"\"\"\nMake html galleries from media directories. Organize by dates, by subdirs or by\nthe content of a diary file. The diary file is a markdown file organized by\ndates, each day described by a text and some medias (photos and movies).\n\nThe diary file can be exported to:\n* an html file with the text and subs...
false
3,378
b865c37623f405f67592d1eabc620d11ff87827e
class subset: def __init__(self, weight, itemSet, size, setNum): self.weight = weight self.itemSet = itemSet self.size = size self.setNum = setNum def findCover(base, arr): uniq = [] #array that can be union uni = [] #array has been unionized w/ base if len(base.itemSet) == rangeOfVal: # print("COVER:"...
[ "class subset:\n\tdef __init__(self, weight, itemSet, size, setNum):\n\t\tself.weight = weight\n\t\tself.itemSet = itemSet\n\t\tself.size = size\n\t\tself.setNum = setNum\n\n\ndef findCover(base, arr):\n\tuniq = [] #array that can be union\n\tuni = [] #array has been unionized w/ base\n\tif len(base.itemSet) == ra...
false
3,379
bb1a6815649eb9e79e2ab1e110ea8acd8adce5aa
def primeiras_ocorrencias (str): dic={} for i,letra in enumerate(str): if letra not in dic: dic [letra]=i return dic
[ "def primeiras_ocorrencias (str):\n dic={}\n for i,letra in enumerate(str):\n if letra not in dic:\n dic [letra]=i\n return dic", "def primeiras_ocorrencias(str):\n dic = {}\n for i, letra in enumerate(str):\n if letra not in dic:\n dic[letra] = i\n return dic...
false
3,380
848394e1e23d568f64df8a98527a8e177b937767
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration import os import shutil class LibpopplerConan(ConanFile): name = "poppler" version = "0.73.0" description = "Poppler is a PDF rendering library based on the xpdf-3....
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom conans import ConanFile, CMake, tools\nfrom conans.errors import ConanInvalidConfiguration\nimport os\nimport shutil\n\n\nclass LibpopplerConan(ConanFile):\n name = \"poppler\"\n version = \"0.73.0\"\n description = \"Poppler is a PDF rendering librar...
false
3,381
36d596c1019dbaaf8dc394633ca464421517dc21
""" This module takes care of starting the API Server, Loading the DB and Adding the endpoints """ import os from flask import Flask, request, jsonify, url_for from flask_migrate import Migrate from flask_swagger import swagger from flask_cors import CORS from flask_jwt_extended import ( JWTManager, jwt_required, c...
[ "\"\"\"\nThis module takes care of starting the API Server, Loading the DB and Adding the endpoints\n\"\"\"\nimport os\nfrom flask import Flask, request, jsonify, url_for\nfrom flask_migrate import Migrate\nfrom flask_swagger import swagger\nfrom flask_cors import CORS\nfrom flask_jwt_extended import (\n JWTMana...
true
3,382
07332e2da5458fda2112de2507037a759d3c62db
def main(): num = int(input('dia: ')) dia(num) def dia(a): if a == 1: print('Domingo !') elif a == 2: print('Segunda !') else: print('valor invalido !') main()
[ "def main():\n num = int(input('dia: '))\n dia(num)\n\n\ndef dia(a):\n if a == 1:\n print('Domingo !')\n elif a == 2:\n print('Segunda !')\n else:\n print('valor invalido !')\n\n\nmain()\n", "def main():\n num = int(input('dia: '))\n dia(num)\n\n\ndef dia(a):\n if a ==...
false
3,383
60c849d213f6266aeb0660fde06254dfa635f10f
import optparse from camera import apogee_U2000 if __name__ == "__main__": parser = optparse.OptionParser() group1 = optparse.OptionGroup(parser, "General") group1.add_option('--s', action='store', default=1, dest='mode', help='set cooler on/off') args = parser.parse_args() options, args = parser.par...
[ "import optparse\n\nfrom camera import apogee_U2000\t\t\t\n\nif __name__ == \"__main__\":\n parser = optparse.OptionParser()\n group1 = optparse.OptionGroup(parser, \"General\") \n group1.add_option('--s', action='store', default=1, dest='mode', help='set cooler on/off')\n\n args = parser.parse_args()\n opti...
true
3,384
68371acc58da6d986d94d746abb4fea541d65fdd
#!/usr/bin/env python import argparse import subprocess def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: return True def quote(items): return ["'" + item + "'" for item in items] if module_exists('urllib.parse'): from url...
[ "#!/usr/bin/env python\n\nimport argparse\nimport subprocess\n\ndef module_exists(module_name):\n try:\n __import__(module_name)\n except ImportError:\n return False\n else:\n return True\n\ndef quote(items):\n return [\"'\" + item + \"'\" for item in items]\n\nif module_exists('url...
false
3,385
12cd3dbf211b202d25dc6f940156536c9fe3f76f
from aws_cdk import core as cdk # For consistency with other languages, `cdk` is the preferred import name for # the CDK's core module. The following line also imports it as `core` for use # with examples from the CDK Developer's Guide, which are in the process of # being updated to use `cdk`. You may delete this im...
[ "from aws_cdk import core as cdk\n\n# For consistency with other languages, `cdk` is the preferred import name for\n# the CDK's core module. The following line also imports it as `core` for use\n# with examples from the CDK Developer's Guide, which are in the process of\n# being updated to use `cdk`. You may dele...
false
3,386
c27ca6a8c38f2b96011e3a09da073ccc0e5a1467
from django.apps import AppConfig class Iapp1Config(AppConfig): name = 'iapp1'
[ "from django.apps import AppConfig\n\n\nclass Iapp1Config(AppConfig):\n name = 'iapp1'\n", "<import token>\n\n\nclass Iapp1Config(AppConfig):\n name = 'iapp1'\n", "<import token>\n\n\nclass Iapp1Config(AppConfig):\n <assignment token>\n", "<import token>\n<class token>\n" ]
false
3,387
4b83887e8d8e5c5dc7065354d24044d3c3a48714
#!/bin/env python import sys import os import collections import re import json import urllib import urllib.request import uuid import time PROCESSOR_VERSION = "0.1" def process(trace_dir, out_dir): #order files trace_files = os.listdir(trace_dir) trace_files = sorted(trace_files) if trace_files[0] ==...
[ "#!/bin/env python\n\nimport sys\nimport os\nimport collections\nimport re\nimport json\nimport urllib\nimport urllib.request\nimport uuid\nimport time\nPROCESSOR_VERSION = \"0.1\"\n\ndef process(trace_dir, out_dir):\n #order files\n trace_files = os.listdir(trace_dir)\n trace_files = sorted(trace_files)\n...
false
3,388
5b3514af839c132fda9a2e6e178ae62f780f291e
from matplotlib import cm from datascience.visu.util import plt, save_fig, get_figure from sklearn.metrics import roc_curve, auc, confusion_matrix import numpy as np y = np.array([ [0.8869, 1.], [1.-0.578, 0.], [0.7959, 1.], [0.8618, 1.], [1.-0.2278, 0.], [0.6607, 1.], [0.7006, 1.], ...
[ "from matplotlib import cm\n\nfrom datascience.visu.util import plt, save_fig, get_figure\n\nfrom sklearn.metrics import roc_curve, auc, confusion_matrix\n\nimport numpy as np\n\ny = np.array([\n [0.8869, 1.],\n [1.-0.578, 0.],\n [0.7959, 1.],\n [0.8618, 1.],\n [1.-0.2278, 0.],\n [0.6607, 1.],\n ...
false
3,389
2465a73d958d88dcd27cfac75a4e7b1fcd6a884e
# -*- coding:utf-8 -*- import datetime import json import os import urllib import requests from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import properties from time import sleep from appium import we...
[ "# -*- coding:utf-8 -*-\nimport datetime\nimport json\nimport os\nimport urllib\nimport requests\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.wait import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\nimport properties\nfrom time import sleep\nfrom ...
false
3,390
c7258d77db2fe6e1470c972ddd94b2ed02f48003
from multiprocessing import Process, Queue def f(q): for i in range(0,100): print("come on baby") q.put([42, None, 'hello']) if __name__ == '__main__': q = Queue() p = Process(target=f, args=(q,)) p.start() for j in range(0, 2000): if j == 1800: print(q.get()) ...
[ "from multiprocessing import Process, Queue\n\ndef f(q):\n for i in range(0,100):\n print(\"come on baby\")\n q.put([42, None, 'hello'])\n\n\nif __name__ == '__main__':\n q = Queue()\n p = Process(target=f, args=(q,))\n p.start()\n for j in range(0, 2000):\n if j == 1800:\n ...
false
3,391
5029f3e2000c25d6044f93201c698773e310d452
### # This Python module contains commented out classifiers that I will no longer # be using ### from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import BaggingClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier # Using Decision trees...
[ "###\n# This Python module contains commented out classifiers that I will no longer\n# be using\n###\n\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.ensemble import BaggingClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\n\n\n# Usin...
false
3,392
d2acc789224d66de36b319ae457165c1438454a3
from django import template from django.conf import settings from django.utils.html import escape from django.utils.translation import get_language from cms.models import Page from cms.conf.global_settings import LANGUAGE_NAME_OVERRIDE register = template.Library() # TODO: There's some redundancy here # TODO: {% cms...
[ "from django import template\nfrom django.conf import settings\nfrom django.utils.html import escape\nfrom django.utils.translation import get_language\n\nfrom cms.models import Page\nfrom cms.conf.global_settings import LANGUAGE_NAME_OVERRIDE\n\nregister = template.Library()\n\n# TODO: There's some redundancy here...
true
3,393
42d9f40dd50056b1c258508a6cb3f9875680276a
"""empty message Revision ID: 42cf7f6532dd Revises: e6d4ac8564fb Create Date: 2019-04-01 16:13:37.207305 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '42cf7f6532dd' down_revision = 'e6d4ac8564fb' branch_labels = None depends_on = None def upgrade(): # ...
[ "\"\"\"empty message\n\nRevision ID: 42cf7f6532dd\nRevises: e6d4ac8564fb\nCreate Date: 2019-04-01 16:13:37.207305\n\n\"\"\"\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n# revision identifiers, used by Alembic.\nrevision = '42cf7f6532dd'\ndown_revision = 'e6d4ac8564fb'\nbranch_labels = None\ndepends_on = No...
false
3,394
153c02585e5d536616ec4b69757328803ac2fb71
#coding=utf-8 ''' Created on 2013-3-28 @author: jemmy ''' import telnetlib import getpass import sys import os import time import xlrd from pyExcelerator import * import #define Host = "192.168.0.1" Port = "70001" #Host = raw_iput("IP",) username = "admin" password = "admin" filename = str(time.strftime('%Y%m%d%H%M%S...
[ "#coding=utf-8\n'''\nCreated on 2013-3-28\n\n@author: jemmy\n'''\nimport telnetlib\nimport getpass\nimport sys\nimport os\nimport time\nimport xlrd\nfrom pyExcelerator import *\nimport\n#define\nHost = \"192.168.0.1\"\nPort = \"70001\"\n#Host = raw_iput(\"IP\",)\nusername = \"admin\"\npassword = \"admin\"\n\nfilena...
true
3,395
2866ecf69969b445fb15740a507ddecb1dd1762d
# C8-06 p.146 Write city_country() function that takes name city and country # Print city name then the country the city is in. call 3 times with differet pairs. def city_country(city, country): """Name a city and the country it resides in seperated by a comma.""" print(f'"{city.title()}, {country.title()}"\n'...
[ "# C8-06 p.146 Write city_country() function that takes name city and country\n# Print city name then the country the city is in. call 3 times with differet pairs.\n\ndef city_country(city, country):\n \"\"\"Name a city and the country it resides in seperated by a comma.\"\"\"\n print(f'\"{city.title()}, {cou...
false
3,396
464fc2c193769eee86a639f73b933d5413be2b87
from keyboards import * from DB import cur, conn from bot_token import bot from limit_text import limit_text def send_answer(question_id, answer_owner, receiver_tel_id, short): answer = cur.execute('''SELECT answer FROM Answers WHERE question_id = (%s) AND tel_id = (%s)''', (question_id, answer_owner)).fetchone()...
[ "from keyboards import *\nfrom DB import cur, conn\nfrom bot_token import bot\nfrom limit_text import limit_text\n\ndef send_answer(question_id, answer_owner, receiver_tel_id, short):\n\n answer = cur.execute('''SELECT answer FROM Answers WHERE question_id = (%s) AND tel_id = (%s)''', (question_id, answer_owner)...
false
3,397
66e93295d2797ca9e08100a0a1f28619acb72aa4
from asgiref.sync import async_to_sync from channels.layers import get_channel_layer from django.dispatch import Signal from djangochannelsrestframework.observer.base_observer import BaseObserver class Observer(BaseObserver): def __init__(self, func, signal: Signal = None, kwargs=None): super().__init__(...
[ "from asgiref.sync import async_to_sync\nfrom channels.layers import get_channel_layer\nfrom django.dispatch import Signal\n\nfrom djangochannelsrestframework.observer.base_observer import BaseObserver\n\n\nclass Observer(BaseObserver):\n def __init__(self, func, signal: Signal = None, kwargs=None):\n sup...
false
3,398
2345d1f72fb695ccec5af0ed157c0606f197009c
import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_configuration(host): sshd = host.file('/etc/ssh/sshd_config') assert sshd.contains(r'^PermitRootLogin no$') assert sshd.co...
[ "import os\n\nimport testinfra.utils.ansible_runner\n\n\ntestinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(\n os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')\n\n\ndef test_configuration(host):\n sshd = host.file('/etc/ssh/sshd_config')\n assert sshd.contains(r'^PermitRootLogin no$')\n ...
false
3,399
c2467e94a2ad474f0413e7ee3863aa134bf9c51f
""" TestRail API Categories """ from . import _category from ._session import Session class TestRailAPI(Session): """Categories""" @property def attachments(self) -> _category.Attachments: """ https://www.gurock.com/testrail/docs/api/reference/attachments Use the following API me...
[ "\"\"\"\nTestRail API Categories\n\"\"\"\n\nfrom . import _category\nfrom ._session import Session\n\n\nclass TestRailAPI(Session):\n \"\"\"Categories\"\"\"\n\n @property\n def attachments(self) -> _category.Attachments:\n \"\"\"\n https://www.gurock.com/testrail/docs/api/reference/attachment...
false