index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,800
d7d23b04f6e73db6a0a8730192398941743f32ce
import sqlite3 def connect(): connect = sqlite3.connect("books.db") cursor = connect.cursor() cursor.execute("CREATE TABLE IF NOT EXISTS bookstore (id INTEGER PRIMARY KEY," "title TEXT," "author TEXT," "year INTEGER," "isbn INTEGER...
[ "import sqlite3\n\ndef connect():\n connect = sqlite3.connect(\"books.db\")\n cursor = connect.cursor()\n cursor.execute(\"CREATE TABLE IF NOT EXISTS bookstore (id INTEGER PRIMARY KEY,\"\n \"title TEXT,\"\n \"author TEXT,\"\n \"year INTEGER,\"\n ...
false
6,801
51f7faaad29379daa58875c7b35d9ccf569c8766
from unittest import TestCase from ch4.array_to_btree import to_btree from ch4.is_subtree import is_subtree class IsSubtreeTest(TestCase): def test_should_be_subtree(self): container = to_btree([1, 2, 3, 4, 5, 6]) contained = to_btree([1, 3, 2]) self.assertTrue(is_subtree(contai...
[ "from unittest import TestCase\r\n\r\nfrom ch4.array_to_btree import to_btree\r\nfrom ch4.is_subtree import is_subtree\r\n\r\n\r\nclass IsSubtreeTest(TestCase):\r\n def test_should_be_subtree(self):\r\n container = to_btree([1, 2, 3, 4, 5, 6])\r\n contained = to_btree([1, 3, 2])\r\n self.ass...
false
6,802
39ac4e0d543048ea02123baa39b6c8ce7618d16b
# Generated by Django 3.1.6 on 2021-05-06 10:29 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0028_auto_20210506_1020'), ] operations = [ migrations.AlterField( model_name='user', ...
[ "# Generated by Django 3.1.6 on 2021-05-06 10:29\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0028_auto_20210506_1020'),\n ]\n\n operations = [\n migrations.AlterField(\n m...
false
6,803
bdcbb946dadf168149342c651ad03eaf4b748401
from mx.handlers import MainHandler # handler for changing app language class Locale(MainHandler): """ handles requests to change LOCALE or language for internationalization. """ def get(self): locale = self.request.get('locale') if not locale : locale = LOCALE locale...
[ "\nfrom mx.handlers import MainHandler\n\n# handler for changing app language\nclass Locale(MainHandler):\n \"\"\"\n handles requests to change LOCALE or language for internationalization.\n \"\"\"\n def get(self):\n locale = self.request.get('locale')\n if not locale :\n locale =...
false
6,804
c3e2bd635a7ff558ed56e7fb35e8b10e1c660c88
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 05:29:19 2020 @author: Gaurav """ from tensorflow.keras.models import load_model import cv2 import os from tensorflow.keras.preprocessing.image import img_to_array import numpy as np model=load_model('E:/AI Application Implementation/trained_model/Classifi...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Wed Aug 19 05:29:19 2020\r\n\r\n@author: Gaurav\r\n\"\"\"\r\nfrom tensorflow.keras.models import load_model\r\nimport cv2\r\nimport os\r\nfrom tensorflow.keras.preprocessing.image import img_to_array\r\nimport numpy as np\r\n\r\nmodel=load_model('E:/AI Application Im...
false
6,805
559c665e5544dd864d2f020c967ac8a8665af134
# coding:utf-8 import requests import io from zipfile import ZipFile if __name__ == '__main__': sentence_url = "http://www.manythings.org/anki/deu-eng.zip" r = requests.get(sentence_url) z = ZipFile(io.BytesIO(r.content)) file = z.read('deu.txt') eng_ger_data = file.decode() eng_ger_data = eng_...
[ "# coding:utf-8\nimport requests\nimport io\nfrom zipfile import ZipFile\n\nif __name__ == '__main__':\n sentence_url = \"http://www.manythings.org/anki/deu-eng.zip\"\n r = requests.get(sentence_url)\n z = ZipFile(io.BytesIO(r.content))\n file = z.read('deu.txt')\n eng_ger_data = file.decode()\n e...
false
6,806
d3585e7b761fa7b2eeaacf09f84bb6a4abc1cf02
from django.contrib import admin from .models import User # Register your models here. @admin.register(User) class AuthorizationUserAdmin(admin.ModelAdmin): exclude = ['open_id'] pass
[ "from django.contrib import admin\r\nfrom .models import User\r\n\r\n\r\n# Register your models here.\r\n\r\n@admin.register(User)\r\nclass AuthorizationUserAdmin(admin.ModelAdmin):\r\n exclude = ['open_id']\r\n pass\r\n", "from django.contrib import admin\nfrom .models import User\n\n\n@admin.register(User...
false
6,807
c4a13069b5add538589886b5e282d4fc9f2b72ad
from typing import List import pytest from raiden import waiting from raiden.api.python import RaidenAPI from raiden.raiden_service import RaidenService from raiden.tests.utils.detect_failure import raise_on_failure from raiden.tests.utils.network import CHAIN from raiden.tests.utils.transfer import block_offset_time...
[ "from typing import List\n\nimport pytest\n\nfrom raiden import waiting\nfrom raiden.api.python import RaidenAPI\nfrom raiden.raiden_service import RaidenService\nfrom raiden.tests.utils.detect_failure import raise_on_failure\nfrom raiden.tests.utils.network import CHAIN\nfrom raiden.tests.utils.transfer import blo...
false
6,808
f44ff7488ae8fc64bc1785fb6cbe80c4cc011fbe
from django.conf.urls.defaults import * #from wiki.feeds import * from django.conf import settings from django.conf.urls.defaults import * # feeds for wikiPages and wikiNews """ feeds = { 'latestpages': LatestPages, } sitemaps = { 'wiki': Wiki, } """ urlpatterns = patterns('', # Example: # (r'^goimcommu...
[ "from django.conf.urls.defaults import *\n#from wiki.feeds import *\nfrom django.conf import settings\n\nfrom django.conf.urls.defaults import *\n# feeds for wikiPages and wikiNews\n\"\"\"\nfeeds = {\n 'latestpages': LatestPages,\n}\n\nsitemaps = {\n\t'wiki': Wiki,\n\t}\n\"\"\"\nurlpatterns = patterns('',\n #...
false
6,809
0eca1693caffcd9fe32a8a54ca3a33687763e5ce
__author__ = 'zhaobin022' class Cmd(object): pass
[ "__author__ = 'zhaobin022'\r\n\r\n\r\nclass Cmd(object):\r\n pass", "__author__ = 'zhaobin022'\n\n\nclass Cmd(object):\n pass\n", "<assignment token>\n\n\nclass Cmd(object):\n pass\n", "<assignment token>\n<class token>\n" ]
false
6,810
f6c48731b2a4e0a6f1f93034ee9d11121c2d0427
#coding=utf-8 import pandas as pd # 学生成绩表 df_grade = pd.read_excel("学生成绩表.xlsx") df_grade.head() # 学生信息表 df_sinfo = pd.read_excel("学生信息表.xlsx") df_sinfo.head() # 只筛选第二个表的少量的列 df_sinfo = df_sinfo[["学号", "姓名", "性别"]] df_sinfo.head() # join df_merge = pd.merge(left=df_grade, right=df_sinfo, left_on="学号", right_on="学...
[ "#coding=utf-8\nimport pandas as pd\n\n# 学生成绩表\ndf_grade = pd.read_excel(\"学生成绩表.xlsx\") \ndf_grade.head()\n\n# 学生信息表\ndf_sinfo = pd.read_excel(\"学生信息表.xlsx\") \ndf_sinfo.head()\n\n# 只筛选第二个表的少量的列\ndf_sinfo = df_sinfo[[\"学号\", \"姓名\", \"性别\"]]\ndf_sinfo.head()\n\n# join\ndf_merge = pd.merge(left=df_grade, right=df_s...
false
6,811
ea78f754ffff26bac1e53ed1e842fd79112b8ee7
import hashlib def createMD5(str): # 创建md5对象 hl = hashlib.md5() hl.update(str.encode(encoding='utf-8')) return hl.hexdigest()
[ "import hashlib\ndef createMD5(str):\n # 创建md5对象\n hl = hashlib.md5()\n hl.update(str.encode(encoding='utf-8'))\n return hl.hexdigest()", "import hashlib\n\n\ndef createMD5(str):\n hl = hashlib.md5()\n hl.update(str.encode(encoding='utf-8'))\n return hl.hexdigest()\n", "<import token>\n\n\n...
false
6,812
295d6a66335491b406f47212064da9fd5fca6eb6
from sqlitedict import SqliteDict import sys import socket import urllib import argparse import zlib, pickle, sqlite3 import random from datetime import datetime import time from urllib.parse import urlparse import hashlib import subprocess import requests from multiprocessing import Pool def gz_encode(obj): retur...
[ "from sqlitedict import SqliteDict\nimport sys\nimport socket\nimport urllib\nimport argparse\nimport zlib, pickle, sqlite3\nimport random\nfrom datetime import datetime\nimport time\nfrom urllib.parse import urlparse\nimport hashlib\nimport subprocess\nimport requests\nfrom multiprocessing import Pool\n\ndef gz_en...
false
6,813
e8011e98da342e501070febf421e9f8d0b74d64e
# Generated by Django 3.1.4 on 2020-12-11 17:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0016_auto_20201211_2158'), ] operations = [ migrations.CreateModel( name='Question', ...
[ "# Generated by Django 3.1.4 on 2020-12-11 17:50\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0016_auto_20201211_2158'),\n ]\n\n operations = [\n migrations.CreateModel(\n ...
false
6,814
a732e7141ffb403ca6c5d9c4204cb96c8e831aab
# Classic solution for merging two sorted arrays/list to a new one. # (Based on Merge Sort) class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ m->Size of nums1 list n->Size of nums2 list """ mergedArray = [] i = 0 ...
[ "# Classic solution for merging two sorted arrays/list to a new one.\n# (Based on Merge Sort)\nclass Solution:\n def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:\n \"\"\"\n m->Size of nums1 list\n n->Size of nums2 list\n \"\"\"\n mergedArray = []\n ...
false
6,815
f6b2e66379b483c6a573d34d73ae0d10de7315a3
import numpy as np from feature.features import Features class RealWorldFeatures(Features): def __init__(self): super().__init__('tsagkias/real_world_features') def _extract_features(self, df): # weather from http://www.dwd.de/DE/leistungen/klimadatendeutschland/klimadatendeutschland.html features = ...
[ "import numpy as np\nfrom feature.features import Features\n\nclass RealWorldFeatures(Features):\n def __init__(self):\n super().__init__('tsagkias/real_world_features')\n\n def _extract_features(self, df):\n # weather from http://www.dwd.de/DE/leistungen/klimadatendeutschland/klimadatendeutschland.html\n\n...
false
6,816
4245da12eb7f9dd08c863e368efbd0bcf0b8fa04
from rest_framework.pagination import PageNumberPagination class QuoteListPagination(PageNumberPagination): page_size = 30
[ "from rest_framework.pagination import PageNumberPagination\n\n\nclass QuoteListPagination(PageNumberPagination):\n page_size = 30\n", "<import token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n page_size = 30\n", "<import token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n <assi...
false
6,817
2e4b47b8c3ac4f187b32f1013a34c3bea354b519
c_horas=int(input("Ingrese la cantidad de horas trabajadas:")) v_horas=int(input("Ingrese el valor de cada hora trabajada:")) sueldo=c_horas*v_horas print("Su sueldo mensual sera") print(sueldo)
[ "c_horas=int(input(\"Ingrese la cantidad de horas trabajadas:\"))\r\nv_horas=int(input(\"Ingrese el valor de cada hora trabajada:\"))\r\nsueldo=c_horas*v_horas\r\nprint(\"Su sueldo mensual sera\")\r\nprint(sueldo)\r\n", "c_horas = int(input('Ingrese la cantidad de horas trabajadas:'))\nv_horas = int(input('Ingres...
false
6,818
67b060349e986b06a0ee6d8a1afee82d49989c29
def sqrt(number): low = 1 high = number - 1 while low <= high: mid = (low + high) /2 if mid * mid == number: return mid elif mid * mid > number: high = mid - 1 else: low = mid + 1 return low - 1 print sqrt(15)
[ "\n\n\ndef sqrt(number):\n\n low = 1\n high = number - 1\n\n while low <= high:\n\n mid = (low + high) /2\n\n if mid * mid == number:\n return mid\n\n elif mid * mid > number:\n high = mid - 1\n else:\n low = mid + 1\n\n return low - 1\n\npr...
true
6,819
3af91de0b25f575ec9d981d7711c710a7e9695e4
import datetime now = datetime.datetime.now() print(now.year,now.month,now.day,now.hour,now.minute,now.second)
[ "import datetime\nnow = datetime.datetime.now()\nprint(now.year,now.month,now.day,now.hour,now.minute,now.second)\n", "import datetime\nnow = datetime.datetime.now()\nprint(now.year, now.month, now.day, now.hour, now.minute, now.second)\n", "<import token>\nnow = datetime.datetime.now()\nprint(now.year, now.mon...
false
6,820
c1475209d9c9a98d72d7f703e0516aceaeb13163
import basevcstest class TestVCSBoxfill(basevcstest.VCSBaseTest): def testRobinsonBoxfill(self): # This tests if extending the longitude to more than 360 decrees is handled correctly by # proj4. See https://github.com/UV-CDAT/uvcdat/issues/1728 for more # information. clt3 = self.c...
[ "import basevcstest\n\n\nclass TestVCSBoxfill(basevcstest.VCSBaseTest):\n def testRobinsonBoxfill(self):\n # This tests if extending the longitude to more than 360 decrees is handled correctly by\n # proj4. See https://github.com/UV-CDAT/uvcdat/issues/1728 for more\n # information.\n ...
false
6,821
fe3e104cf213b21c33a4b5c6e1a61315c4770eda
from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound from django.shortcuts import render_to_response from django.template import RequestContext from whydjango.casestudies.forms import SubmitCaseStudyForm def case_study_submission(request, tem...
[ "from django.core.urlresolvers import reverse \nfrom django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext \n\n\nfrom whydjango.casestudies.forms import SubmitCaseStudyForm\n\ndef case_study_submission...
false
6,822
59a8a4cf4b04a191bfb70fd07668141dbfeda790
import xlsxwriter workbook = xlsxwriter.Workbook('商品编码.xlsx') worksheet = workbook.add_worksheet() with open('商品编码.txt', 'rt') as f: data = f.read() data = data.splitlines(True) count = 1 row = 0 for x in data: if count < 3: count+=1 continue x = x.split(',') column = 0 for e in x...
[ "import xlsxwriter\n\nworkbook = xlsxwriter.Workbook('商品编码.xlsx')\nworksheet = workbook.add_worksheet()\n\nwith open('商品编码.txt', 'rt') as f:\n data = f.read()\ndata = data.splitlines(True)\ncount = 1\nrow = 0\n\nfor x in data:\n if count < 3:\n count+=1\n continue\n x = x.split(',')\n colu...
false
6,823
44476a32b8ab68820d73955321e57b7d1b608beb
# -*- coding: utf-8 -*- __author__ = 'jz' from flask.ext import restful from flask.ext.restful import reqparse from scs_app.db_connect import * parser = reqparse.RequestParser() parser.add_argument('count', type=str) class MulActionResource(restful.Resource): def __init__(self): self.db =...
[ "# -*- coding: utf-8 -*-\r\n__author__ = 'jz'\r\n\r\nfrom flask.ext import restful\r\nfrom flask.ext.restful import reqparse\r\n\r\nfrom scs_app.db_connect import *\r\n\r\nparser = reqparse.RequestParser()\r\nparser.add_argument('count', type=str)\r\n\r\n\r\nclass MulActionResource(restful.Resource):\r\n def __i...
false
6,824
ee417c5fff858d26ca60a78dffe4cff503a6f2b5
from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.contrib.admin.views.decorators import staff_member_required from lessons.models import Lesson, Question, Response from usermanage.models import SchoolClass import json...
[ "from django.shortcuts import render, redirect\nfrom django.http import HttpResponse\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.admin.views.decorators import staff_member_required\nfrom lessons.models import Lesson, Question, Response\nfrom usermanage.models import SchoolClass\n...
false
6,825
76d0dd2d6b2d580900283f2623f05dd02a70fcd8
#!/usr/bin/env python import numpy as np import rospy import tf from geometry_msgs.msg import PoseStamped, Twist, TwistStamped, Point from nav_msgs.msg import Odometry from visualization_msgs.msg import Marker from bebop_nmpc_solver import BebopNmpcFormulationParam, bebop_nmpc_casadi_solver # The frame by default is...
[ "#!/usr/bin/env python\n\nimport numpy as np\nimport rospy\nimport tf\nfrom geometry_msgs.msg import PoseStamped, Twist, TwistStamped, Point\nfrom nav_msgs.msg import Odometry\nfrom visualization_msgs.msg import Marker\nfrom bebop_nmpc_solver import BebopNmpcFormulationParam, bebop_nmpc_casadi_solver\n\n\n# The fra...
false
6,826
624212a1d73ff3a3b3092ffa27912a6ae25a2484
from django.contrib import admin from basic_app.models import UserProfileInfo admin.site.register(UserProfileInfo) # we do not need to register User() default form since it comes # with the default admin site in Django itself.
[ "from django.contrib import admin\nfrom basic_app.models import UserProfileInfo\n\nadmin.site.register(UserProfileInfo)\n\n# we do not need to register User() default form since it comes\n# with the default admin site in Django itself.\n", "from django.contrib import admin\nfrom basic_app.models import UserProfil...
false
6,827
e3603d90bd5aa5de40baa27b62acf6f71eff9f6c
# -*- coding: utf-8 -*- serviceType = "server" serviceDesc = _({"en": "Icecream Daemon", "tr": "Icecream Servisi"}) from comar.service import * @synchronized def start(): startService(command="/opt/icecream/sbin/iceccd", args="-d -m 5 > /dev/null", pidfile="/var/...
[ "# -*- coding: utf-8 -*-\nserviceType = \"server\"\nserviceDesc = _({\"en\": \"Icecream Daemon\",\n \"tr\": \"Icecream Servisi\"})\n\nfrom comar.service import *\n\n@synchronized\ndef start():\n startService(command=\"/opt/icecream/sbin/iceccd\",\n args=\"-d -m 5 > /dev/null\",\n ...
false
6,828
20ccdd319bfbbb4f17e8518eb60d125112c05d8e
from django.contrib import admin from xchanger.models import Currency, Rates, UpdateInfo class CurrencyAdmin(admin.ModelAdmin): pass class UpdAdmin(admin.ModelAdmin): pass class RatesAdmin(admin.ModelAdmin): list_filter = ['c_code_id', 'upd_id'] admin.site.register(Currency, CurrencyAdmin) admin.site....
[ "from django.contrib import admin\nfrom xchanger.models import Currency, Rates, UpdateInfo\n\n\nclass CurrencyAdmin(admin.ModelAdmin):\n pass\n\nclass UpdAdmin(admin.ModelAdmin):\n pass\n\n\nclass RatesAdmin(admin.ModelAdmin):\n list_filter = ['c_code_id', 'upd_id']\n\nadmin.site.register(Currency, Currenc...
false
6,829
35e66e5e154f5cd70f187a1cde33cef71102e1a6
import random import cv2 img = cv2.imread('assets/logo.jpg', -1) print(img.shape) #3 channels, bgr #look at the 257. row and pixel 400 --> has bgr values: [41 98 243] print(img[257][400]) ''' # manipulate the first 100 rows, all columns, and randomize the 3 pixel values # (rows, colums, pixels) where pixels: b,g,...
[ "import random\nimport cv2\n\nimg = cv2.imread('assets/logo.jpg', -1)\nprint(img.shape) #3 channels, bgr\n\n#look at the 257. row and pixel 400 --> has bgr values: [41 98 243]\nprint(img[257][400])\n\n'''\n# manipulate the first 100 rows, all columns, and randomize the 3 pixel values\n# (rows, colums, pixels) wh...
false
6,830
b4ce95d754dd0d7c1b91fa0348de0194a4397aca
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "# Copyright 2015 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by appl...
false
6,831
5c001303962315afe2512eb307376f6f7a883cf9
# inserting logical unit ids for splitting texts into logical chunks import re import os splitter = "#META#Header#End#" def logical_units(file): ar_ra = re.compile("^[ذ١٢٣٤٥٦٧٨٩٠ّـضصثقفغعهخحجدًٌَُلإإشسيبلاتنمكطٍِلأأـئءؤرلاىةوزظْلآآ]+$") with open(file, "r", encoding="utf8") as f1: book = f1.read() ...
[ "# inserting logical unit ids for splitting texts into logical chunks\n\nimport re\nimport os\n\nsplitter = \"#META#Header#End#\"\n\n\ndef logical_units(file):\n ar_ra = re.compile(\"^[ذ١٢٣٤٥٦٧٨٩٠ّـضصثقفغعهخحجدًٌَُلإإشسيبلاتنمكطٍِلأأـئءؤرلاىةوزظْلآآ]+$\")\n\n with open(file, \"r\", encoding=\"utf8\") as f1:\n...
false
6,832
3667651697ac1c093d48fe2c4baa4b4dbdf20f8a
""" Unpacks and preprocesses all of the data from the tarball of partial data, which includes the flats and dark frames. """ import tools.unpack import util.files import util.dark import util.flat def main(): tools.unpack.main() util.files.main() util.dark.main() util.flat.main() if __name__ == '__m...
[ "\"\"\"\nUnpacks and preprocesses all of the data from the tarball of partial data,\nwhich includes the flats and dark frames.\n\"\"\"\n\nimport tools.unpack\nimport util.files\nimport util.dark\nimport util.flat\n\ndef main():\n tools.unpack.main()\n util.files.main()\n util.dark.main()\n util.flat.mai...
false
6,833
3838df627318b25767738da912f44e494cef40f3
#!/bin/python3 import sys def fibonacciModified(t1, t2, n): ti = t1 ti_1 = t2 for i in range (2, n): ti_2 = ti + ti_1**2 ti = ti_1 ti_1 = ti_2 return ti_2 if __name__ == "__main__": t1, t2, n = input().strip().split(' ') t1, t2, n = [int(t1), int(t2), int(n)] resul...
[ "#!/bin/python3\n\nimport sys\n\ndef fibonacciModified(t1, t2, n):\n ti = t1\n ti_1 = t2\n for i in range (2, n):\n ti_2 = ti + ti_1**2\n ti = ti_1\n ti_1 = ti_2\n return ti_2\n\nif __name__ == \"__main__\":\n t1, t2, n = input().strip().split(' ')\n t1, t2, n = [int(t1), int(...
false
6,834
472c8b0649e29c31b144607080938793e5f1293e
"""Module to convert a lanelet UTM representation to OSM.""" __author__ = "Benjamin Orthen" __copyright__ = "TUM Cyber-Physical Systems Group" __credits__ = ["Priority Program SPP 1835 Cooperative Interacting Automobiles"] __version__ = "1.1.2" __maintainer__ = "Benjamin Orthen" __email__ = "commonroad-i06@in.tum.de" ...
[ "\"\"\"Module to convert a lanelet UTM representation to OSM.\"\"\"\n\n__author__ = \"Benjamin Orthen\"\n__copyright__ = \"TUM Cyber-Physical Systems Group\"\n__credits__ = [\"Priority Program SPP 1835 Cooperative Interacting Automobiles\"]\n__version__ = \"1.1.2\"\n__maintainer__ = \"Benjamin Orthen\"\n__email__ =...
false
6,835
f29637cd670524baebac6549962a1c50fc1b91c6
import math # 1 long_phrase = 'Насколько проще было бы писать программы, если бы не заказчики' short_phrase = '640Кб должно хватить для любых задач. Билл Гейтс (по легенде)' def compare (long, short): print(len(long)>len(short)) compare(long_phrase, short_phrase) # 2.1 text = 'Если программист в 9-00 утра на работе...
[ "import math\n\n# 1\nlong_phrase = 'Насколько проще было бы писать программы, если бы не заказчики'\nshort_phrase = '640Кб должно хватить для любых задач. Билл Гейтс (по легенде)'\ndef compare (long, short):\n\tprint(len(long)>len(short))\n\ncompare(long_phrase, short_phrase)\n\n# 2.1\ntext = 'Если программист в 9-...
false
6,836
11a0c3307994a90d1d4de67d442ffa355e11e13b
from .compat import reverse, action from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from rest_framework import pagination from rest_framework import renderers from . import registry from .serializers import RunSerializer, RecordSerializer from .models import Run from .setti...
[ "from .compat import reverse, action\nfrom rest_framework.response import Response\nfrom rest_framework.viewsets import ModelViewSet\nfrom rest_framework import pagination\nfrom rest_framework import renderers\nfrom . import registry\nfrom .serializers import RunSerializer, RecordSerializer\nfrom .models import Run...
false
6,837
131caf50cc8682cf180168a1b136b1dcdd70fa76
#-*- coding: UTF-8 -*- #Author Motuii ''' * ┏┓   ┏┓ * ┏┛┻━━━┛┻┓ * ┃       ┃   * ┃   ━   ┃ * ┃ ┳┛ ┗┳ ┃ * ┃       ┃ * ┃   ┻   ┃ * ┃       ┃ * ┗━┓   ┏━┛ * ┃   ┃ 神兽保佑          * ┃   ┃ 代码无BUG! * ┃   ┗━━━┓ * ┃       ┣┓ * ┃       ┏┛ * ┗┓┓┏━┳┓┏┛ * ┃┫┫ ┃┫┫ * ┗┻┛ ┗┻┛ * ''' n...
[ "#-*- coding: UTF-8 -*-\n#Author Motuii\n'''\n * ┏┓   ┏┓ \n * ┏┛┻━━━┛┻┓ \n * ┃       ┃   \n * ┃   ━   ┃ \n * ┃ ┳┛ ┗┳ ┃ \n * ┃       ┃ \n * ┃   ┻   ┃ \n * ┃       ┃ \n * ┗━┓   ┏━┛ \n * ┃   ┃ 神兽保佑          \n * ┃   ┃ 代码无BUG! \n * ┃   ┗━━━┓ \n * ┃       ┣┓ \n * ┃       ┏┛ \n * ┗┓┓┏━┳┓┏┛ \n * ┃┫┫ ┃┫┫ \n * ...
true
6,838
caac877bf6c42217ea41f51717f6a704a3a9774b
''' 简述:这里有四个数字,分别是:1、2、3、4 提问:能组成多少个互不相同且无重复数字的三位数?各是多少? ''' for x in range(1,5): for y in range(1,5): for z in range(1,5): if (x != y) & (x != z) & (y != z): print(x,y,z)
[ "''' 简述:这里有四个数字,分别是:1、2、3、4\n提问:能组成多少个互不相同且无重复数字的三位数?各是多少? '''\n\nfor x in range(1,5):\n for y in range(1,5):\n for z in range(1,5):\n if (x != y) & (x != z) & (y != z):\n print(x,y,z)\n", "<docstring token>\nfor x in range(1, 5):\n for y in range(1, 5):\n for z in ra...
false
6,839
002ef36bd132f1ac258b3f8baf8098accbd8a8f2
''' mock_proto.py ''' from heron.common.src.python import constants import heron.proto.execution_state_pb2 as protoEState import heron.proto.physical_plan_pb2 as protoPPlan import heron.proto.tmaster_pb2 as protoTmaster import heron.proto.topology_pb2 as protoTopology # pylint: disable=no-self-use, missing-docstring c...
[ "''' mock_proto.py '''\nfrom heron.common.src.python import constants\nimport heron.proto.execution_state_pb2 as protoEState\nimport heron.proto.physical_plan_pb2 as protoPPlan\nimport heron.proto.tmaster_pb2 as protoTmaster\nimport heron.proto.topology_pb2 as protoTopology\n\n# pylint: disable=no-self-use, missing...
false
6,840
d250cc0aafdd48cb0eb56108d9c7148153cde002
from ctypes import * import os import sys import time import datetime import subprocess import RPi.GPIO as GPIO from PIL import Image from PIL import ImageDraw from PIL import ImageFont #import Adafruit_GPIO as GPIO import Adafruit_GPIO.SPI as SPI import ST7735 as TFT import pigpio # use BCM pin define pin_meas = 24 ...
[ "from ctypes import *\nimport os\nimport sys\nimport time\nimport datetime\nimport subprocess\nimport RPi.GPIO as GPIO\nfrom PIL import Image\nfrom PIL import ImageDraw\nfrom PIL import ImageFont\n#import Adafruit_GPIO as GPIO\nimport Adafruit_GPIO.SPI as SPI\nimport ST7735 as TFT\nimport pigpio\n\n# use BCM pin de...
false
6,841
349581774cded59ece6a5e8178d116c166a4a6b3
from typing import List from uuid import uuid4 from fastapi import APIRouter, Depends, FastAPI, File, UploadFile from sqlalchemy.orm import Session from starlette.requests import Request from Scripts.fastapp.common.consts import UPLOAD_DIRECTORY from Scripts.fastapp.database.conn import db # from Scripts.fastapp.data...
[ "from typing import List\nfrom uuid import uuid4\n\nfrom fastapi import APIRouter, Depends, FastAPI, File, UploadFile\nfrom sqlalchemy.orm import Session\nfrom starlette.requests import Request\n\nfrom Scripts.fastapp.common.consts import UPLOAD_DIRECTORY\nfrom Scripts.fastapp.database.conn import db\n# from Script...
false
6,842
ce626afa7c0fd2e190afd92b57a0ebebf19f9e9b
from django.contrib import admin from django.contrib.staticfiles.urls import static # 本Ch11.1 from django.urls import path, include from . import settings_common, settings_dev # 本Ch11.1 import debug_toolbar urlpatterns = [ path('admin/', admin.site.urls), path('', include('login_test_app.urls')), path('...
[ "from django.contrib import admin\nfrom django.contrib.staticfiles.urls import static # 本Ch11.1\nfrom django.urls import path, include\n\nfrom . import settings_common, settings_dev # 本Ch11.1\nimport debug_toolbar\n\nurlpatterns = [\n path('admin/', admin.site.urls),\n path('', include('login_test_app.urls'...
false
6,843
c1c79e5adc620690e4e386f7f1cd9f781eeec0ce
import sys max = sys.maxsize print(" sys.maxsize -> ", max)
[ "import sys\n\nmax = sys.maxsize\nprint(\" sys.maxsize -> \", max)\n\n\n\n", "import sys\nmax = sys.maxsize\nprint(' sys.maxsize -> ', max)\n", "<import token>\nmax = sys.maxsize\nprint(' sys.maxsize -> ', max)\n", "<import token>\n<assignment token>\nprint(' sys.maxsize -> ', max)\n", "<import token>\n<ass...
false
6,844
cfb49d78dc14e6f4b6d2357d292fd6275edec711
import csv import datetime with open('/Users/wangshibao/SummerProjects/analytics-dashboard/myapp/CrimeHistory.csv','rU') as f: reader = csv.reader(f) header = reader.next() date_time = "20140501 00:00" date_time = datetime.datetime.strptime(date_time, "%Y%m%d %H:%M") print date_t...
[ "import csv\nimport datetime\nwith open('/Users/wangshibao/SummerProjects/analytics-dashboard/myapp/CrimeHistory.csv','rU') as f:\n reader = csv.reader(f)\n header = reader.next()\n date_time = \"20140501 00:00\"\n date_time = datetime.datetime.strptime(date_time, \"%Y%m%d %H:%M\")\n ...
true
6,845
be0afa5184f753ed5f9a483379a4d81cd7af4886
#!/usr/bin/python2.7 import sys import datetime import psycopg2 import json import collections from pprint import pprint from pyral import Rally, rallyWorkset import copy import os import argparse from ConfigParser import SafeConfigParser import traceback global rally global server_name """ WARNING: This was hacked...
[ "#!/usr/bin/python2.7\nimport sys\nimport datetime\nimport psycopg2\nimport json\nimport collections\nfrom pprint import pprint\nfrom pyral import Rally, rallyWorkset\nimport copy\nimport os\nimport argparse\nfrom ConfigParser import SafeConfigParser\nimport traceback\nglobal rally\nglobal server_name\n\n\"\"\"\n\n...
true
6,846
afd72ce2d9598f92937f3038eb0ef49b740b9977
from guet.commands.strategies.strategy import CommandStrategy class TooManyArgsStrategy(CommandStrategy): def apply(self): print('Too many arguments.')
[ "from guet.commands.strategies.strategy import CommandStrategy\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n def apply(self):\n print('Too many arguments.')\n", "from guet.commands.strategies.strategy import CommandStrategy\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n\n def apply(self):\n ...
false
6,847
37d817436ce977339594867ef917177e7371a212
import pycmc # open project, get Crag, CragVolumes, and intensity images crag = ... cragVolumes = ... raw = ... membrane = ... nodeFeatures = ... edgeFeatures = ... statisticsFeatureProvider = pycmc.StatisticsFeatureProvider(cragVolumes, raw, "raw") shapeFeatureProvider = pycmc.ShapeFeatureProvider(cragVolumes) ...
[ "import pycmc\n\n# open project, get Crag, CragVolumes, and intensity images\ncrag = ...\ncragVolumes = ...\nraw = ...\nmembrane = ...\nnodeFeatures = ...\nedgeFeatures = ...\n\nstatisticsFeatureProvider = pycmc.StatisticsFeatureProvider(cragVolumes, raw, \"raw\")\nshapeFeatureProvider = pycmc.ShapeFeatureProv...
false
6,848
fc4fafe4e29a7f116c38be265fce8e4fb6638330
from .fieldmatrix import *
[ "from .fieldmatrix import *\n", "<import token>\n" ]
false
6,849
22dccf6bb76dab735f373089d0772f475b2d5a5d
#!/bin/env python # coding: utf-8 """ Dakara Online protocol generator, by Alejandro Santos """ from genpackets import * from gendefs_js import * BUILDERS = [] HANDLERS = [] DECODE_DISPATCH = [] ARGS_HANDLER = [] def write_packets_from(f, fph, base_name, namespace, P): # Enum with IDs if base_name != "Serv...
[ "#!/bin/env python\n# coding: utf-8\n\n\"\"\"\nDakara Online protocol generator, by Alejandro Santos\n\"\"\"\n\nfrom genpackets import *\nfrom gendefs_js import *\n\nBUILDERS = []\nHANDLERS = []\nDECODE_DISPATCH = []\nARGS_HANDLER = []\ndef write_packets_from(f, fph, base_name, namespace, P):\n\n\n # Enum with I...
false
6,850
7180dc0d622fd449fcee32f2c50000d05ae2d8bb
from load_blender_data import pose_spherical from misc import mse, mse2psnr, to8b import os import imageio import json import torch import torch.nn as nn import numpy as np import cv2 from torch.utils.data.dataset import Dataset from torch.utils.data.dataloader import DataLoader device = torch.device('cuda') if tor...
[ "from load_blender_data import pose_spherical\nfrom misc import mse, mse2psnr, to8b\n\nimport os\nimport imageio\nimport json\nimport torch\nimport torch.nn as nn\nimport numpy as np\nimport cv2\n\n\nfrom torch.utils.data.dataset import Dataset\nfrom torch.utils.data.dataloader import DataLoader\n\ndevice = torch.d...
false
6,851
a012055d11202c68d9eddf5cf2a17043f9bbaf0a
#!/usr/bin/env python ''' Script for analysis of wavefunctions on GaSb/InAs/GaSb simmetric quantum wells. This piece code is part of the project "phd_gasb_inas", which comprises the work related to the Phd. Dissertation named: "Quantum transport of charge and spin in topological insulators 2D". Author: Marcos Medeiro...
[ "#!/usr/bin/env python\n'''\nScript for analysis of wavefunctions on GaSb/InAs/GaSb simmetric quantum wells.\n\nThis piece code is part of the project \"phd_gasb_inas\", which comprises the work\nrelated to the Phd. Dissertation named: \"Quantum transport of charge and spin in\ntopological insulators 2D\".\n\nAutho...
false
6,852
d5c7b8966e73c607d1d1c5da9814ef507dc53b59
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-03-09 14:28 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('proposal', '0016_project_callobjectives'), ] operations = [ migrations.Alte...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.3 on 2017-03-09 14:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('proposal', '0016_project_callobjectives'),\n ]\n\n operations = [\n ...
false
6,853
e754a24fc9c965c50f7fa12036c884a1a54cc29d
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause # # Meta-class for creating regression tests. # import reframe.core.namespaces as namespaces import reframe.core.parameters ...
[ "# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)\n# ReFrame Project Developers. See the top-level LICENSE file for details.\n#\n# SPDX-License-Identifier: BSD-3-Clause\n\n#\n# Meta-class for creating regression tests.\n#\n\n\nimport reframe.core.namespaces as namespaces\nimport reframe....
false
6,854
7106a8ddbec60ce4b7d9e8e5ce8d7df02e5f7222
from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() for name, hexcode in zip(cs.colornames, cs.colors): print('%s: %s' % (hexcode, name)) fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')
[ "from ScientificColorschemez import Colorschemez\nimport matplotlib.pyplot as plt\n\ncs = Colorschemez.latest()\n\nfor name, hexcode in zip(cs.colornames, cs.colors):\n print('%s: %s' % (hexcode, name))\n\nfig, ax = plt.subplots()\ncs.example_plot(ax)\nfig.savefig('latest.png', dpi=200, bbox_inches='tight')\n", ...
false
6,855
bde3975f5b614a4b00ad392d9f0b4c1bd8c55dc0
# Neural network model(s) for the pygym 'CartPoleEnv' # # author: John Welsh import torch.nn as nn import torch.nn.functional as F class CartPoleModel(nn.Module): def __init__(self): super(CartPoleModel, self).__init__() self.fc1 = nn.Linear(4, 60) self.fc2 = nn.Linear(60, 120) s...
[ "# Neural network model(s) for the pygym 'CartPoleEnv'\n#\n# author: John Welsh\n\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\nclass CartPoleModel(nn.Module):\n\n def __init__(self):\n super(CartPoleModel, self).__init__()\n self.fc1 = nn.Linear(4, 60)\n self.fc2 = nn.Linear(...
false
6,856
a159f9f9cc06bb9d22f84781fb2fc664ea204b64
import time if __name__ == '__main__': for i in range(10): print('here %s' % i) time.sleep(1) print('TEST SUCEEDED')
[ "import time\nif __name__ == '__main__':\n for i in range(10):\n print('here %s' % i)\n time.sleep(1)\n \n print('TEST SUCEEDED')\n \n", "import time\nif __name__ == '__main__':\n for i in range(10):\n print('here %s' % i)\n time.sleep(1)\n print('TEST SUCEEDED')\...
false
6,857
981cfecdb50b5f3ae326bf3103163f6e814ccc95
import numpy as np import torch import torch.nn as nn from utils import * from collections import OrderedDict from torchsummary import summary class Model(nn.Module): """Example usage: model = Model() outputs = model(pov_tensor, feat_tensor) """ def __init__(self): super(Model, self).__in...
[ "import numpy as np\nimport torch\nimport torch.nn as nn\nfrom utils import *\nfrom collections import OrderedDict\nfrom torchsummary import summary\n\n\nclass Model(nn.Module):\n \"\"\"Example usage:\n\n model = Model()\n outputs = model(pov_tensor, feat_tensor)\n \"\"\"\n def __init__(self):\n ...
false
6,858
e4767d8a4991a1180cc185c4c2d77104d63f9c7a
import json import argparse import sys import os if __name__ == '__main__': ap = argparse.ArgumentParser() ap.add_argument("-sd","--startdate", help="Date to start scheduling trials, format is MM/DD.", required=True) ap.add_argument("-r", "--round",help="A number.", required=True) ap.add_argument("-hs...
[ "import json\nimport argparse\nimport sys\nimport os\n\nif __name__ == '__main__':\n\n ap = argparse.ArgumentParser()\n ap.add_argument(\"-sd\",\"--startdate\", help=\"Date to start scheduling trials, format is MM/DD.\", required=True)\n ap.add_argument(\"-r\", \"--round\",help=\"A number.\", required=True...
false
6,859
1fe7d5db1b47ba082301d07d010c6796fbd7edb7
import random def Fun_hiraganas(): hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'ho'] print("escriba el hiragana", hiraganas[random.randint(0, len(hiraganas)-1)]) print("Hell...
[ "import random\n\ndef Fun_hiraganas():\n\thiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', \n\t'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'ho']\n\tprint(\"escriba el hiragana\", hiraganas[random.randint(0, len(hiraganas)-1)...
false
6,860
1a5c189b9a2bed35fbbb7df40ec80a1d02402d7f
import fnmatch import tempfile from contextlib import contextmanager from os import ( makedirs, unlink, ) from os.path import ( abspath, basename, dirname, exists, join, sep, ) from re import ( compile, escape, ) from typing import ( Any, Dict, List, Type, ) from ...
[ "import fnmatch\nimport tempfile\nfrom contextlib import contextmanager\nfrom os import (\n makedirs,\n unlink,\n)\nfrom os.path import (\n abspath,\n basename,\n dirname,\n exists,\n join,\n sep,\n)\nfrom re import (\n compile,\n escape,\n)\nfrom typing import (\n Any,\n Dict,\n...
false
6,861
86d3e90493ed04bbe23792716f46a68948911dc3
import cv2 import numpy as np import time import itertools from unionfind import UnionFind R = 512 C = 512 # Setup window cv2.namedWindow('main') #img_i = np.zeros((R, C), np.uint8) img_i = cv2.imread("window1.png", cv2.IMREAD_GRAYSCALE) #img_i = cv2.threshold(img_i, 127, 255, cv2.THRESH_BINARY)[1] do...
[ "import cv2\r\nimport numpy as np\r\nimport time\r\nimport itertools\r\nfrom unionfind import UnionFind\r\n\r\nR = 512\r\nC = 512\r\n\r\n# Setup window\r\ncv2.namedWindow('main')\r\n#img_i = np.zeros((R, C), np.uint8)\r\nimg_i = cv2.imread(\"window1.png\", cv2.IMREAD_GRAYSCALE)\r\n#img_i = cv2.threshold(img_i, 127,...
false
6,862
cb40141eddce9ce11fbd8475fc7c3d37438208a6
"""! @brief Example 04 @details pyAudioAnalysis spectrogram calculation and visualization example @author Theodoros Giannakopoulos {tyiannak@gmail.com} """ import numpy as np import scipy.io.wavfile as wavfile import plotly import plotly.graph_objs as go from pyAudioAnalysis import ShortTermFeatures as aF layout = go....
[ "\"\"\"! \n@brief Example 04\n@details pyAudioAnalysis spectrogram calculation and visualization example\n@author Theodoros Giannakopoulos {tyiannak@gmail.com}\n\"\"\"\nimport numpy as np\nimport scipy.io.wavfile as wavfile\nimport plotly\nimport plotly.graph_objs as go\nfrom pyAudioAnalysis import ShortTermFeature...
false
6,863
eb4271aa5abe3ddc05048858205e6ef807a4f8ac
import logging from typing import Sequence from django.core.exceptions import ValidationError from django.db import IntegrityError from django.db.models import F, Q from django.utils import timezone from sentry_sdk import capture_exception from sentry.models import ( Environment, Project, Release, Rel...
[ "import logging\nfrom typing import Sequence\n\nfrom django.core.exceptions import ValidationError\nfrom django.db import IntegrityError\nfrom django.db.models import F, Q\nfrom django.utils import timezone\nfrom sentry_sdk import capture_exception\n\nfrom sentry.models import (\n Environment,\n Project,\n ...
false
6,864
cbfccffce2884e1cbebe21daf7792eebc1f88571
# # Copyright (c) 2011-2014 The developers of Aqualid project - http://aqualid.googlecode.com # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and # associated documentation files (the "Software"), to deal in the Software without restriction, # including without limitati...
[ "#\n# Copyright (c) 2011-2014 The developers of Aqualid project - http://aqualid.googlecode.com\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and\n# associated documentation files (the \"Software\"), to deal in the Software without restriction,\n# including with...
false
6,865
8ed14bb9af23055f4689e06df872a1d36185cd09
# model class for a sale record from app.models.product import Product class Sale(Product): def __init__(self,product_name,quantity,unit_price,attendant,date): super(Sale, self).__init__(product_name, quantity, unit_price) self.attendant = attendant self.date = date
[ "# model class for a sale record\nfrom app.models.product import Product\nclass Sale(Product):\n def __init__(self,product_name,quantity,unit_price,attendant,date):\n super(Sale, self).__init__(product_name, quantity, unit_price)\n self.attendant = attendant\n self.date = date", "from app....
false
6,866
5195dcf262c0be08f83cf66e79d48e51811a67a0
from speaker_verification import * import numpy as np region = 'westus' api_key = load_json('./real_secrets.json')['api_key'] wav_path = './enrollment.wav' temp_path = './temp.wav' # If you want to list users by profile_id print('All users are: ', list_users(api_key, region)) # This is handled by the development / p...
[ "from speaker_verification import *\nimport numpy as np\n\nregion = 'westus'\napi_key = load_json('./real_secrets.json')['api_key']\nwav_path = './enrollment.wav'\ntemp_path = './temp.wav'\n\n# If you want to list users by profile_id\nprint('All users are: ', list_users(api_key, region))\n\n# This is handled by the...
false
6,867
766098753ec579e2d63893fcbd94e8819b46bc0b
import pytest from dymopy.client import Dymo from dymopy.client import make_xml, make_params def test_url(): dymo = Dymo() assert dymo.uri == "https://127.0.0.1:41951/DYMO/DLS/Printing" def test_status(): dymo = Dymo() status = dymo.get_status() assert isinstance(status, dict) assert statu...
[ "import pytest \nfrom dymopy.client import Dymo\nfrom dymopy.client import make_xml, make_params \n\ndef test_url(): \n dymo = Dymo()\n assert dymo.uri == \"https://127.0.0.1:41951/DYMO/DLS/Printing\"\n\ndef test_status(): \n dymo = Dymo()\n status = dymo.get_status()\n assert isinstance(status, dict...
false
6,868
e870900249b121f2416d7be543752ebf6392b6be
import scraperwiki, lxml.html, urllib2, re from datetime import datetime #html = scraperwiki.scrape("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm") doc = lxml.html.parse(urllib2.urlopen("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm")) ro...
[ "import scraperwiki, lxml.html, urllib2, re\nfrom datetime import datetime\n\n#html = scraperwiki.scrape(\"http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm\")\ndoc = lxml.html.parse(urllib2.urlopen(\"http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_l...
false
6,869
aa51c8f736461f147704c1ec0669c265348fcb80
from lib.appData import driver_queue from lib.pyapp import Pyapp import threading from appium.webdriver.common.touch_action import TouchAction from lib.logger import logger import time local = threading.local() class BasePage(object): def __init__(self, driver=None): if driver is None: local.d...
[ "from lib.appData import driver_queue\nfrom lib.pyapp import Pyapp\nimport threading\nfrom appium.webdriver.common.touch_action import TouchAction\nfrom lib.logger import logger\nimport time\nlocal = threading.local()\n\n\nclass BasePage(object):\n def __init__(self, driver=None):\n if driver is None:\n ...
false
6,870
c500ecaa66672ac960dc548c3f3882e4bc196745
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Rec1(object): def setupUi(self, Rec1): Rec1.setObjectName("Rec1") Rec1.setFixedSize(450, 200) ico = QtGui.QIcon("mylogo.png") Rec1.setWindowIcon(ico) font = QtGui.QFont() font.setFamily("Times New Roman") f...
[ "from PyQt5 import QtCore, QtGui, QtWidgets\n\n\nclass Ui_Rec1(object):\n def setupUi(self, Rec1):\n Rec1.setObjectName(\"Rec1\")\n Rec1.setFixedSize(450, 200)\n ico = QtGui.QIcon(\"mylogo.png\")\n Rec1.setWindowIcon(ico)\n font = QtGui.QFont()\n font.setFamily(\"Times N...
false
6,871
b0cc2efda4d6586b66e04b41dfe1bbce8d009e2e
def increment(number: int) -> int: """Increment a number. Args: number (int): The number to increment. Returns: int: The incremented number. """ return number + 1
[ "def increment(number: int) -> int:\n \"\"\"Increment a number.\n\n Args:\n number (int): The number to increment.\n\n Returns:\n int: The incremented number.\n \"\"\"\n return number + 1\n", "def increment(number: int) ->int:\n \"\"\"Increment a number.\n\n Args:\n numbe...
false
6,872
cb03fcf9c9cb61b3546865fe40cc411745e1fc94
''' Created on Jul 10, 2018 @author: daniel ''' #from multiprocessing import Process, Manager #from keras.utils import np_utils import sys import os from keras.utils import np_utils from _codecs import decode sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from DataHandlers.SegNetDataHandler import Seg...
[ "'''\nCreated on Jul 10, 2018\n\n@author: daniel\n'''\n\n#from multiprocessing import Process, Manager\n#from keras.utils import np_utils\nimport sys\nimport os\nfrom keras.utils import np_utils\nfrom _codecs import decode\nsys.path.append(os.path.join(os.path.dirname(__file__), '..'))\nfrom DataHandlers.SegNetData...
false
6,873
45a85ff765833fd62fc1670404d8994818788707
def cubarea(l2,b2,h2): print("Area of cuboid =",2*(l2+b2+h2)) def cubperimeter(l2,b2,h2): print("Perimeter of cuboid =",4*(l2+b2+h2))
[ "def cubarea(l2,b2,h2):\n print(\"Area of cuboid =\",2*(l2+b2+h2))\ndef cubperimeter(l2,b2,h2):\n print(\"Perimeter of cuboid =\",4*(l2+b2+h2)) \n", "def cubarea(l2, b2, h2):\n print('Area of cuboid =', 2 * (l2 + b2 + h2))\n\n\ndef cubperimeter(l2, b2, h2):\n print('Perimeter of cuboid =', 4 * (l2 + b...
false
6,874
d4e3751b2d4796c72be497007fe4c7d8ca67e18e
from compas.geometry import Frame
[ "from compas.geometry import Frame\n", "<import token>\n" ]
false
6,875
99eeb039e1a369e450247d10ba22a1aa0b35dae9
from world.enums import * from world.content.species import SPECIES from world.content.chargen import * from evennia.utils.evmenu import get_input from evennia.utils.utils import list_to_string import re def start(caller): if not caller: return caller.ndb._menutree.points = { "attributes": 20, ...
[ "from world.enums import *\nfrom world.content.species import SPECIES\nfrom world.content.chargen import *\nfrom evennia.utils.evmenu import get_input\nfrom evennia.utils.utils import list_to_string\nimport re\n\ndef start(caller):\n if not caller:\n return\n caller.ndb._menutree.points = {\n \"...
false
6,876
4d1157b307d753abea721b93779ccc989c77d8e3
import erequests from pyarc.base import RestException class ResultWrapper(object): def __init__(self, client, method, url): self.client = client self.method = method self.url = url self.response = None def get(self): if self.response is None: self.client.wa...
[ "import erequests\nfrom pyarc.base import RestException\n\n\nclass ResultWrapper(object):\n def __init__(self, client, method, url):\n self.client = client\n self.method = method\n self.url = url\n self.response = None\n\n def get(self):\n if self.response is None:\n ...
true
6,877
b112ca3dc603035f340444fa74a7941b1b95f5e5
import time import serial ser = serial.Serial( port='/dev/ttyUSB0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=None ) ser.close() ser.open() if ser.isOpen(): print "Serial is open" ser.flushInput() ser.flushOutput() while True: mimic = '' byt...
[ "import time\nimport serial\n\nser = serial.Serial(\n\tport='/dev/ttyUSB0',\n\tbaudrate=9600,\n\tparity=serial.PARITY_NONE,\n\tstopbits=serial.STOPBITS_ONE,\n\tbytesize=serial.EIGHTBITS,\n\ttimeout=None\n)\nser.close()\nser.open()\nif ser.isOpen():\n\tprint \"Serial is open\"\n\tser.flushInput()\n\tser.flushOutput(...
true
6,878
28a3763715f5405f8abe2de17ed5f9df1019278b
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv('mgdata.dat.csv') training_set = dataset.iloc[:1100, 1:2].values X_train=[] y_train=[] for i in range(20,1090): X_train.append(training_set[i-20:i,0]) y_train.append(training_set[i,0]) X_train=np.asarray...
[ "\r\n\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport pandas as pd\r\ndataset = pd.read_csv('mgdata.dat.csv')\r\ntraining_set = dataset.iloc[:1100, 1:2].values\r\n\r\nX_train=[]\r\ny_train=[]\r\nfor i in range(20,1090):\r\n X_train.append(training_set[i-20:i,0])\r\n y_train.append(training_...
false
6,879
cd6e15daa2360ead47f0bac95843b1c030164996
from .start_node import StartNode from .character_appearance import CharacterAppearance from .character_disappearance import CharacterDisappearance from .replica import Replica from .end_node import EndNode from .choice import Choice from .set_landscape import SetLandscape from .add_item import AddItem from .switch_by_...
[ "from .start_node import StartNode\nfrom .character_appearance import CharacterAppearance\nfrom .character_disappearance import CharacterDisappearance\nfrom .replica import Replica\nfrom .end_node import EndNode\nfrom .choice import Choice\nfrom .set_landscape import SetLandscape\nfrom .add_item import AddItem\nfro...
false
6,880
d18bfdb606e4ba8a67acbb07cd9a3a6d2a0855e3
""" Class template Ipea's Python for agent-based modeling course """ import random # class name typically Capital letter class Pessoa: # Usually has an __init__ method called at the moment of instance creation def __init__(self, name, distancia): # Armazena os parâmetros de início dentro daqu...
[ "\"\"\" Class template\n Ipea's Python for agent-based modeling course\n \"\"\"\n\nimport random\n\n\n# class name typically Capital letter\nclass Pessoa:\n # Usually has an __init__ method called at the moment of instance creation\n def __init__(self, name, distancia):\n # Armazena os parâmetros...
false
6,881
c1a83c9551e83e395a365210a99330fee7877dff
from django.urls import path,include from . import views urlpatterns = [ path('register_curier/',views.curier_register,name="register_curier"), path('private_сurier/',views.private_сurier,name="private_сurier"), path('private_сurier2/',views.private_сurier2,name="private_сurier2"), path('private_curier...
[ "from django.urls import path,include\nfrom . import views\n\nurlpatterns = [\n path('register_curier/',views.curier_register,name=\"register_curier\"),\n path('private_сurier/',views.private_сurier,name=\"private_сurier\"),\n path('private_сurier2/',views.private_сurier2,name=\"private_сurier2\"),\n pa...
false
6,882
8834548f6180fc864d73a71194125b22d230a393
#!/usr/bin/python # encoding=utf-8 """ @Author : Don @Date : 9/16/2020 1:40 PM @Desc : """ import os import yaml config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.yaml") with open(config_path, "r", encoding="utf-8") as f: conf = yaml.load(f.read(), Loader=yaml.FullLoader)...
[ "#!/usr/bin/python\n# encoding=utf-8\n\n\"\"\"\n@Author : Don\n@Date : 9/16/2020 1:40 PM\n@Desc : \n\"\"\"\nimport os\n\nimport yaml\n\nconfig_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), \"config.yaml\")\n\nwith open(config_path, \"r\", encoding=\"utf-8\") as f:\n conf = yaml.load(f...
false
6,883
d3f52d4713ba4b7b4cd736b26809968e259be63c
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging from django.db import transaction from ralph_scrooge.models import ProfitCenter from ralph_scrooge.plugins import plugin_runner ...
[ "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport logging\n\nfrom django.db import transaction\n\nfrom ralph_scrooge.models import ProfitCenter\nfrom ralph_scrooge.plugins impo...
false
6,884
8fb5ef7244a8ca057f11cbcdf42d383665dade5e
# Packages import PySimpleGUI as sg import mysql.connector import secrets # TODO Add a view all button # TODO Catch errors (specifically for TimeDate mismatches) # TODO Add a downtime graph # TODO Add a system feedback window instead of putting this in the out id textbox error_sel_flag = False # Flag to check whether...
[ "# Packages\nimport PySimpleGUI as sg\nimport mysql.connector\nimport secrets\n\n# TODO Add a view all button\n# TODO Catch errors (specifically for TimeDate mismatches)\n# TODO Add a downtime graph\n# TODO Add a system feedback window instead of putting this in the out id textbox\n\nerror_sel_flag = False\t# Flag ...
true
6,885
6f877dccab8d62e34b105bbd06027cbff936e3aa
mlt = 1 mlt_sum = 0 num_sum = 0 for i in range(1,101): mlt = (i ** 2) mlt_sum += mlt num_sum += i print((num_sum ** 2) - mlt_sum)
[ "mlt = 1\nmlt_sum = 0\nnum_sum = 0\nfor i in range(1,101):\n mlt = (i ** 2)\n mlt_sum += mlt\n num_sum += i\nprint((num_sum ** 2) - mlt_sum)\n", "mlt = 1\nmlt_sum = 0\nnum_sum = 0\nfor i in range(1, 101):\n mlt = i ** 2\n mlt_sum += mlt\n num_sum += i\nprint(num_sum ** 2 - mlt_sum)\n", "<assig...
false
6,886
a5646a5d42dbf6e70e9d18f28513ee2df68a28b1
# (1) Obtain your values here (https://core.telegram.org/api/obtaining_api_id) api_id = 000000 api_hash = '00000000000000000000000' phone = '+000000000000' username = 'theone' project_id = 000000000
[ "# (1) Obtain your values here (https://core.telegram.org/api/obtaining_api_id)\napi_id = 000000\napi_hash = '00000000000000000000000'\n\nphone = '+000000000000'\nusername = 'theone'\n\nproject_id = 000000000\n", "api_id = 0\napi_hash = '00000000000000000000000'\nphone = '+000000000000'\nusername = 'theone'\nproj...
false
6,887
991260c268d53fbe73e9bff9990ac536ed802d7a
''' Author: ulysses Date: 1970-01-01 08:00:00 LastEditTime: 2020-08-03 15:44:57 LastEditors: Please set LastEditors Description: ''' from pyspark.sql import SparkSession from pyspark.sql.functions import split, explode if __name__ == "__main__": spark = SparkSession\ .builder\ .appName('StructedS...
[ "'''\nAuthor: ulysses\nDate: 1970-01-01 08:00:00\nLastEditTime: 2020-08-03 15:44:57\nLastEditors: Please set LastEditors\nDescription: \n'''\nfrom pyspark.sql import SparkSession\nfrom pyspark.sql.functions import split, explode\n\n\nif __name__ == \"__main__\":\n spark = SparkSession\\\n .builder\\\n ...
false
6,888
ab36b3d418be67080e2efaba15edc1354386e191
import requests response = requests.get('https://any-api.com:8443/https://rbaskets.in/api/version') print(response.text)
[ "import requests\nresponse = requests.get('https://any-api.com:8443/https://rbaskets.in/api/version')\nprint(response.text)", "import requests\nresponse = requests.get(\n 'https://any-api.com:8443/https://rbaskets.in/api/version')\nprint(response.text)\n", "<import token>\nresponse = requests.get(\n 'http...
false
6,889
38906a31ab96e05a9e55a51260632538872ed463
#!/usr/bin/env python3 # coding: utf-8 """ Blaise de Vigenère (1523–1596) mathematician, developed encryption scheme, VigenereCipher algorithm is implemented based on his work, with a utility of relative strength index for encryption and decryption. VERSION : 1.0 LICENSE : GNU GPLv3 ...
[ "#!/usr/bin/env python3\r\n# coding: utf-8\r\n\r\n\r\n\"\"\"\r\n Blaise de Vigenère (1523–1596) mathematician, developed encryption scheme,\r\n VigenereCipher algorithm is implemented based on his work, with a utility\r\n of relative strength index for encryption and decryption.\r\n\r\n VERSION : 1.0\r...
false
6,890
7c19b9521dc874a1ff4bed87dae0452cc329224a
import Environment.spot_environment_model """This is basically the control center. All actions here are being condensed and brought in from spot_market_model...... the BRAIN of the simulator""" class SpotEnvironmentController(): def __init__(self, debug=False): # debug builds an error trap self.debug = ...
[ "import Environment.spot_environment_model\n\n\"\"\"This is basically the control center. All actions here are being condensed and brought in from\n spot_market_model...... the BRAIN of the simulator\"\"\"\n\nclass SpotEnvironmentController():\n def __init__(self, debug=False): # debug builds an error trap\n ...
false
6,891
59d543ed443c156ac65f9c806ba5bada6bcd0c21
import unittest def is_multiple(value, base): return 0 == (value % base) def fizz_buzz(value): if is_multiple(value, 5) and is_multiple(value, 3): return "FizzBuzz" if is_multiple(value, 3): return "Fizz" if is_multiple(value, 5): return "Buzz" return str(value) class F...
[ "import unittest\n\n\ndef is_multiple(value, base):\n return 0 == (value % base)\n\n\ndef fizz_buzz(value):\n if is_multiple(value, 5) and is_multiple(value, 3):\n return \"FizzBuzz\"\n if is_multiple(value, 3):\n return \"Fizz\"\n if is_multiple(value, 5):\n return \"Buzz\"\n re...
false
6,892
502e92d3e5d059d73016702ce0b2591a123810d3
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2017, 2018 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration for REANA-Workflow-Controller.""" from __future__ import absolu...
[ "# -*- coding: utf-8 -*-\n#\n# This file is part of REANA.\n# Copyright (C) 2017, 2018 CERN.\n#\n# REANA is free software; you can redistribute it and/or modify it\n# under the terms of the MIT License; see LICENSE file for more details.\n\n\"\"\"Pytest configuration for REANA-Workflow-Controller.\"\"\"\n\nfrom __f...
false
6,893
6194079dd506553b4e5b66f1fb92bb8642704b59
# -*- coding: utf-8 -*- from copy import copy from openprocurement.api.utils import ( json_view, context_unpack, APIResource, get_now, ) from openprocurement.tender.core.utils import save_tender, apply_patch from openprocurement.tender.core.validation import ( validate_requirement_data, validat...
[ "# -*- coding: utf-8 -*-\nfrom copy import copy\n\nfrom openprocurement.api.utils import (\n json_view,\n context_unpack,\n APIResource,\n get_now,\n)\nfrom openprocurement.tender.core.utils import save_tender, apply_patch\nfrom openprocurement.tender.core.validation import (\n validate_requirement_d...
false
6,894
25641b3a9919db1f172fca22acf413062505de1b
#Simple Pig Latin def pig_it(text): return " ".join( letter if letter == "!" or letter == "?" else (letter[1:] + letter[0] + "ay") for letter in text.split(" "))
[ "#Simple Pig Latin\ndef pig_it(text):\n return \" \".join( letter if letter == \"!\" or letter == \"?\" else (letter[1:] + letter[0] + \"ay\") for letter in text.split(\" \"))\n", "def pig_it(text):\n return ' '.join(letter if letter == '!' or letter == '?' else letter[1:\n ] + letter[0] + 'ay' for...
false
6,895
31a0c9a143a06ac86c8e8616fb273a0af844a352
__author__ = "Yong Peng" __version__ = "1.0" import time import re import getpass from netmiko import ( ConnectHandler, NetmikoTimeoutException, NetmikoAuthenticationException, ) with open('./device_list.txt','r') as f: device_list = [i.strip() for i in f.readlines() if len(i.strip()) != 0] # rea...
[ "\n__author__ = \"Yong Peng\"\n__version__ = \"1.0\"\n\n\nimport time\nimport re\nimport getpass\nfrom netmiko import (\n ConnectHandler,\n NetmikoTimeoutException,\n NetmikoAuthenticationException,\n)\n\nwith open('./device_list.txt','r') as f:\n device_list = [i.strip() for i in f.readlines() if len(i...
false
6,896
ac99c19294661657d383b036c9ab83e7b610cb7d
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011-Today Serpent Consulting Services Pvt.Ltd. (<http://www.serpentcs.com>). # Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>) # # Thi...
[ "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenERP, Open Source Management Solution\n# Copyright (C) 2011-Today Serpent Consulting Services Pvt.Ltd. (<http://www.serpentcs.com>).\n# Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>)\...
false
6,897
6a8cab1fceffa0d70441cc600137417a8b81d7b1
string=input(); string=string.replace("(",""); string=string.replace(")",""); string=list(map(int,string.split(","))); if(1 in string): string.remove(1); mid=[string[0]]; string.remove(string[0]); result=0; tar=0; while(string!=[]): tar=0; length=len(string); i=0 while(i<len(string)): cout=0...
[ "string=input();\nstring=string.replace(\"(\",\"\");\nstring=string.replace(\")\",\"\");\nstring=list(map(int,string.split(\",\")));\nif(1 in string):\n string.remove(1);\nmid=[string[0]];\nstring.remove(string[0]);\nresult=0;\ntar=0;\nwhile(string!=[]):\n tar=0;\n length=len(string);\n i=0\n while(i...
false
6,898
cc7a44754dc1371733420fd3a1e51ab6b5e7c4d8
__author__ = 'xcbtrader' # -*- coding: utf-8 -*- from bitcoin import * def crear_addr_word(word): priv = sha256(word) pub = privtopub(priv) addr = pubtoaddr(pub) wif = encode_privkey(priv, 'wif') return addr, priv, wif word = input('Entra la palabra para crear direccion bitcoin:? ') addr, priv, wif = crear_addr...
[ "__author__ = 'xcbtrader'\n# -*- coding: utf-8 -*-\n\nfrom bitcoin import *\n\ndef crear_addr_word(word):\n\tpriv = sha256(word)\n\tpub = privtopub(priv)\n\taddr = pubtoaddr(pub)\n\twif = encode_privkey(priv, 'wif')\n\treturn addr, priv, wif\n\nword = input('Entra la palabra para crear direccion bitcoin:? ')\naddr,...
false
6,899
682b3e1d6d40f4b279052ac27df19268d227fef8
'''引入数据,并对数据进行预处理''' # step 1 引入数据 import pandas as pd with open('D:\\Desktop\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj: df = pd.read_csv(data_obj) # Step 2 对数据进行预处理 # 对离散属性进行独热编码,定性转为定量,使每一个特征的取值作为一个新的特征 # 增加特征量 Catagorical Variable -> Dummy Variable # 两种方法:Dummy Encoding VS One Hot Encoding # 相同点:将Cat...
[ "'''引入数据,并对数据进行预处理'''\n\n# step 1 引入数据\nimport pandas as pd\nwith open('D:\\\\Desktop\\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj:\n df = pd.read_csv(data_obj)\n\n# Step 2 对数据进行预处理\n# 对离散属性进行独热编码,定性转为定量,使每一个特征的取值作为一个新的特征\n# 增加特征量 Catagorical Variable -> Dummy Variable\n# 两种方法:Dummy Encoding VS One Hot E...
false