index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
3,900
6f107d0d0328c2445c0e1d0dd10e51227da58129
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanyin...
[ "# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You may\n# not use this file except in compliance with the License. A copy of the\n# License is located at\n#\n# \t http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\...
false
3,901
135401ea495b80fc1d09d6919ccec8640cb328ce
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from django.utils import timezone from core import models class ChildTestCase(TestCase): def setUp(self): call_command('migrate', verbosity=0) def test...
[ "# -*- coding: utf-8 -*-\nfrom django.contrib.auth.models import User\nfrom django.core.management import call_command\nfrom django.test import TestCase\nfrom django.utils import timezone\n\nfrom core import models\n\n\nclass ChildTestCase(TestCase):\n def setUp(self):\n call_command('migrate', verbosity=...
false
3,902
1cc77ed1c5da025d1b539df202bbd3310a174eac
# import gmplot package import gmplot import numpy as np # generate 700 random lats and lons latitude = (np.random.random_sample(size = 700) - 0.5) * 180 longitude = (np.random.random_sample(size = 700) - 0.5) * 360 # declare the center of the map, and how much we want the map zoomed in gmap = gmplot.GoogleMapPlotter(0...
[ "# import gmplot package\nimport gmplot\nimport numpy as np\n# generate 700 random lats and lons\nlatitude = (np.random.random_sample(size = 700) - 0.5) * 180\nlongitude = (np.random.random_sample(size = 700) - 0.5) * 360\n# declare the center of the map, and how much we want the map zoomed in\ngmap = gmplot.Google...
false
3,903
57e9c1a4ac57f68e0e73c2c67c6828de8efb1b16
import uuid import json import pytest import requests import httpx from spinta.testing.manifest import bootstrap_manifest from spinta.utils.data import take from spinta.testing.utils import error from spinta.testing.utils import get_error_codes, RowIds from spinta.testing.context import create_test_context from spint...
[ "import uuid\nimport json\n\nimport pytest\nimport requests\nimport httpx\nfrom spinta.testing.manifest import bootstrap_manifest\n\nfrom spinta.utils.data import take\nfrom spinta.testing.utils import error\nfrom spinta.testing.utils import get_error_codes, RowIds\nfrom spinta.testing.context import create_test_co...
false
3,904
f2b978b9a4c00469cdd2f5e1e9275df73c7379b8
import numpy as np from math import ceil, log2 def avg(list): return np.mean(list) def dispersion(list): res = 0 for i in list: res += (i - np.mean(list)) ** 2 return res / len(list) def variation_coefficient(list): return (dispersion(list) ** (1/2) / np.mean(list)) * 100 def chi_squ...
[ "import numpy as np\nfrom math import ceil, log2\n\n\ndef avg(list):\n return np.mean(list)\n\n\ndef dispersion(list):\n res = 0\n for i in list:\n res += (i - np.mean(list)) ** 2\n return res / len(list)\n\n\ndef variation_coefficient(list):\n return (dispersion(list) ** (1/2) / np.mean(list)...
false
3,905
03bc377bef1de7d512b7982a09c255af1d82fb7d
"""4. Начните работу над проектом «Склад оргтехники». Создайте класс, описывающий склад. А также класс «Оргтехника», который будет базовым для классов-наследников. Эти классы — конкретные типы оргтехники (принтер, сканер, ксерокс). В базовом классе определить параметры, общие для приведенных типов. В классах-наследника...
[ "\"\"\"4. Начните работу над проектом «Склад оргтехники». Создайте класс, описывающий склад. А также класс «Оргтехника»,\nкоторый будет базовым для классов-наследников. Эти классы — конкретные типы оргтехники (принтер, сканер, ксерокс).\nВ базовом классе определить параметры, общие для приведенных типов. В классах-...
false
3,906
3bfa9d42e3fd61cf6b7ffaac687f66c2f4bc073e
# -*- coding: utf-8 -*- """ Created on Mon Nov 9 20:06:32 2020 @author: Supriyo """ import networkx as nx import matplotlib.pyplot as plt g=nx.Graph() #l=[1,2,3] # g.add_node(1) # g.add_node(2) # g.add_node(3) # g.add_nodes_from(l) # g.add_edge(1,2) # g.add_edge(2,3) #...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Mon Nov 9 20:06:32 2020\r\n\r\n@author: Supriyo\r\n\"\"\"\r\n\r\nimport networkx as nx\r\nimport matplotlib.pyplot as plt \r\n\r\ng=nx.Graph()\r\n\r\n\r\n#l=[1,2,3]\r\n\r\n# g.add_node(1)\r\n# g.add_node(2)\r\n# g.add_node(3)\r\n # g.add_nodes_from(l)\r\n \r\n...
false
3,907
cf7aeacedec211e76f2bfcb7f6e3cb06dbfdc36e
import hashlib import math import random from set5.ch_4 import get_num_byte_len class Server: def __init__(self): self.private_key = random.randint(0, 2**100) self.salt = random.randint(0, 2**100) self.salt_bytes = self.salt.to_bytes( byteorder="big", length=get_n...
[ "import hashlib\nimport math\nimport random \n\nfrom set5.ch_4 import get_num_byte_len\n\nclass Server:\n def __init__(self):\n self.private_key = random.randint(0, 2**100)\n self.salt = random.randint(0, 2**100)\n self.salt_bytes = self.salt.to_bytes(\n byteorder=\"big\", \n ...
false
3,908
72d1a0689d4cc4f78007c0cfa01611e95de76176
#! /usr/bin/env python3 import arg_parser import colors import logging import sys def parse_args(argv): parser = arg_parser.RemoteRunArgParser() return parser.parse(argv[1:]) def main(argv): logging.basicConfig( format='%(levelname)s: %(message)s', level='INFO', handlers=[colors...
[ "#! /usr/bin/env python3\n\nimport arg_parser\nimport colors\n\nimport logging\nimport sys\n\ndef parse_args(argv):\n parser = arg_parser.RemoteRunArgParser()\n return parser.parse(argv[1:])\n\n\ndef main(argv):\n logging.basicConfig(\n format='%(levelname)s: %(message)s',\n level='INFO',\n ...
false
3,909
c651d49c98a4cf457c8252c94c6785dea8e9af60
import datetime import logging import random import transform import timelapse # merge two iterators producing sorted values def merge(s1, s2): try: x1 = next(s1) except StopIteration: yield from s2 return try: x2 = next(s2) except StopIteration: yield from s1 ...
[ "import datetime\nimport logging\nimport random\nimport transform\nimport timelapse\n\n# merge two iterators producing sorted values\ndef merge(s1, s2):\n try:\n x1 = next(s1)\n except StopIteration:\n yield from s2\n return\n\n try:\n x2 = next(s2)\n except StopIteration:\n ...
false
3,910
4ee47435bff1b0b4a7877c06fb13d13cf53b7fce
import sys,argparse import os,glob import numpy as np import pandas as pd import re,bisect from scipy import stats import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt matplotlib.rcParams['font.size']=11 import seaborn as sns sns.set(font_scale=1.1) sns.set_style("whitegrid", {'axes.grid' : False})...
[ "import sys,argparse\nimport os,glob\nimport numpy as np\nimport pandas as pd\nimport re,bisect\nfrom scipy import stats\nimport matplotlib\n# matplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nmatplotlib.rcParams['font.size']=11\nimport seaborn as sns\nsns.set(font_scale=1.1)\nsns.set_style(\"whitegrid\", {'a...
false
3,911
4a620957b2cd1e5945d98e49a5eae5d5592ef5a2
import tests.functions as functions if __name__ == "__main__": # functions.validate_all_redirects("linked.data.gov.au-vocabularies.json") conf = open("../conf/linked.data.gov.au-vocabularies.conf") new = [ "anzsrc-for", "anzsrc-seo", "ausplots-cv", "australian-phone-area...
[ "import tests.functions as functions\n\nif __name__ == \"__main__\":\n # functions.validate_all_redirects(\"linked.data.gov.au-vocabularies.json\")\n\n conf = open(\"../conf/linked.data.gov.au-vocabularies.conf\")\n new = [\n \"anzsrc-for\",\n \"anzsrc-seo\",\n \"ausplots-cv\",\n ...
false
3,912
3e7d80fdd1adb570934e4b252bc25d5746b4c68e
from py.test import raises from ..lazymap import LazyMap def test_lazymap(): data = list(range(10)) lm = LazyMap(data, lambda x: 2 * x) assert len(lm) == 10 assert lm[1] == 2 assert isinstance(lm[1:4], LazyMap) assert lm.append == data.append assert repr(lm) == '<LazyMap [0, 1, 2, 3, 4, 5...
[ "from py.test import raises\n\nfrom ..lazymap import LazyMap\n\n\ndef test_lazymap():\n data = list(range(10))\n lm = LazyMap(data, lambda x: 2 * x)\n assert len(lm) == 10\n assert lm[1] == 2\n assert isinstance(lm[1:4], LazyMap)\n assert lm.append == data.append\n assert repr(lm) == '<LazyMap ...
false
3,913
227e78312b5bad85df562b6ba360de352c305e7b
import sys word = input() if word[0].islower(): print('{}{}'.format(word[0].upper(), word[1:])) sys.exit() else: print(word) sys.exit()
[ "import sys\nword = input()\n\nif word[0].islower():\n print('{}{}'.format(word[0].upper(), word[1:]))\n sys.exit()\nelse:\n print(word)\n sys.exit()\n", "import sys\nword = input()\nif word[0].islower():\n print('{}{}'.format(word[0].upper(), word[1:]))\n sys.exit()\nelse:\n print(word)\n ...
false
3,914
adae1d7cc2a866c9bc3cd21cb54a0191389f8083
import sys, os def carp(): sys.stderr = sys.stdin print "content-type: text/plain" print #carp() import sesspool import cornerhost.config ## set up session pool = sesspool.SessPool("sess/sessions.db") SESS = sesspool.Sess(pool, REQ, RES) SESS.start() ENG.do_on_exit(SESS.stop) CLERK = cornerhost.config...
[ "import sys, os\ndef carp():\n sys.stderr = sys.stdin\n print \"content-type: text/plain\"\n print \n#carp()\n\nimport sesspool\nimport cornerhost.config\n\n\n## set up session\npool = sesspool.SessPool(\"sess/sessions.db\")\nSESS = sesspool.Sess(pool, REQ, RES)\nSESS.start()\nENG.do_on_exit(SESS.stop)\n\n...
true
3,915
e9de42bb8ed24b95e5196f305fe658d67279c078
import types from robot.libraries.BuiltIn import BuiltIn def GetAllVariableBySuffix (endswith): all_vars = BuiltIn().get_variables() result = {} for var_name, var in all_vars.items(): #print var_name if var_name.endswith(endswith+"}"): print var_name #print var def ...
[ "import types\nfrom robot.libraries.BuiltIn import BuiltIn\n\ndef GetAllVariableBySuffix (endswith):\n all_vars = BuiltIn().get_variables()\n result = {}\n for var_name, var in all_vars.items():\n #print var_name\n if var_name.endswith(endswith+\"}\"):\n print var_name\n ...
true
3,916
dd79ffe3922494bcc345aec3cf76ed9efeb5185c
#!/usr/bin/env python3 """ 02-allelefreq.py <vcf file> """ import sys import matplotlib.pyplot as plt import pandas as pd vcf = open(sys.argv[1]) maf = [] for line in vcf: if "CHR" in line: continue cols = line.rstrip("\n").split() values = float(cols[4]) maf.append(values) fig, ax = pl...
[ "#!/usr/bin/env python3\n\n\"\"\"\n02-allelefreq.py <vcf file>\n\"\"\"\n\nimport sys \nimport matplotlib.pyplot as plt \nimport pandas as pd\n\nvcf = open(sys.argv[1])\n\nmaf = []\n\nfor line in vcf: \n if \"CHR\" in line:\n continue\n cols = line.rstrip(\"\\n\").split()\n values = float(cols[4])\n ...
false
3,917
c0f9a1c39ff5d7cc99a16cf00cddcc14705937ba
from datetime import datetime from random import seed from pandas import date_range, DataFrame import matplotlib.pyplot as plt from matplotlib import style from numpy import asarray import strategy_learner as sl from util import get_data style.use('ggplot') seed(0) def run_algo(sym, investment, start_date, end_date...
[ "from datetime import datetime\nfrom random import seed\n\nfrom pandas import date_range, DataFrame\nimport matplotlib.pyplot as plt\nfrom matplotlib import style\nfrom numpy import asarray\n\nimport strategy_learner as sl\nfrom util import get_data\n\nstyle.use('ggplot')\nseed(0)\n\ndef run_algo(sym, investment, s...
false
3,918
ff1346060141ee3504aa5ee9de3a6ec196bcc216
from skimage.measure import structural_similarity as ssim import matplotlib.pyplot as plt import numpy as np import cv2 import os import pathlib import warnings from PIL import Image from numpy import array source_path = "/home/justin/Desktop/FeatureClustering/" feature_length = len(os.listdir(source_path)) vector_da...
[ "from skimage.measure import structural_similarity as ssim\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport cv2\nimport os\nimport pathlib\nimport warnings\nfrom PIL import Image\nfrom numpy import array\n\nsource_path = \"/home/justin/Desktop/FeatureClustering/\"\n\nfeature_length = len(os.listdir(sour...
false
3,919
9e01ba8c489791ec35b86dffe12d0cedb5f09004
import pandas as pd from scipy.stats import shapiro import scipy.stats as stats df_test = pd.read_excel("datasets/ab_testing_data.xlsx", sheet_name="Test Group") df_control = pd.read_excel("datasets/ab_testing_data.xlsx", sheet_name="Control Group") df_test.head() df_control.head() df_control.info() df_te...
[ "import pandas as pd\r\nfrom scipy.stats import shapiro\r\nimport scipy.stats as stats\r\n\r\ndf_test = pd.read_excel(\"datasets/ab_testing_data.xlsx\", sheet_name=\"Test Group\")\r\ndf_control = pd.read_excel(\"datasets/ab_testing_data.xlsx\", sheet_name=\"Control Group\")\r\n\r\ndf_test.head()\r\ndf_control.head(...
false
3,920
9852d2a15047b110c7f374fd75e531c60c954724
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # (c) Simen Sommerfeldt, @sisomm, simen.sommerfeldt@gmail.com Licensed as CC-BY-SA import os import argparse,time import pygame import paho.mqtt.client as paho parser = argparse.ArgumentParser() parser.add_argument("-s","--server", default="127.0.0.1", help="The I...
[ "# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4\n# (c) Simen Sommerfeldt, @sisomm, simen.sommerfeldt@gmail.com Licensed as CC-BY-SA\n\nimport os\nimport argparse,time\nimport pygame\nimport paho.mqtt.client as paho\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"-s\",\"--server\", default=\"127....
false
3,921
bc25338612f525f616fb26c64d8b36667d297d40
from django.shortcuts import render,get_object_or_404, redirect from django.contrib import admin #어드민 쓸꺼면 써야됨 from .models import Blog #앱을 가지고 오겠다는거 from django.utils import timezone admin.site.register(Blog) #블로그 형식을 가져와 등록하겠다. # Create your views here. def home(request): blogs = Blog.objects return render(reque...
[ "from django.shortcuts import render,get_object_or_404, redirect\nfrom django.contrib import admin #어드민 쓸꺼면 써야됨\nfrom .models import Blog #앱을 가지고 오겠다는거\nfrom django.utils import timezone\n\nadmin.site.register(Blog) #블로그 형식을 가져와 등록하겠다.\n# Create your views here.\ndef home(request):\n blogs = Blog.objects\n retur...
false
3,922
2542998c3a7decd6329856a31d8e9de56f82bae1
from collections import namedtuple from weakref import ref l = list() _l = list() # Point = namedtuple('Point', ['x', 'y']) class Point: def __init__(self,x,y): self.x = x self.y = y def callback(ref): print ('__del__', ref) for x in range(10): p = Point(x,x**2) t = ref(p,callback)...
[ "from collections import namedtuple\nfrom weakref import ref\n\nl = list()\n_l = list()\n\n# Point = namedtuple('Point', ['x', 'y'])\nclass Point:\n def __init__(self,x,y):\n self.x = x\n self.y = y\n\n\ndef callback(ref):\n print ('__del__', ref)\n\n\nfor x in range(10):\n p = Point(x,x**2)\...
false
3,923
4692b2d19f64b3b4bd10c5eadd22a4b5a2f2ef37
from custom_layers import custom_word_embedding from custom_layers import Attention from utils import load_emb_weights import torch from torch import nn class classifier(nn.Module): #define all the layers used in model def __init__(self, embedding_dim, hidden_dim, output_dim, n_layers, embed_weights, ...
[ "from custom_layers import custom_word_embedding\nfrom custom_layers import Attention\nfrom utils import load_emb_weights\nimport torch\nfrom torch import nn\n\nclass classifier(nn.Module):\n\n #define all the layers used in model\n def __init__(self, embedding_dim, hidden_dim, output_dim, n_layers, embed_wei...
false
3,924
ce97da4aab2b9de40267730168690475c899526d
import os,sys,glob sys.path.append("../../../../libs/VASNet/") from VASNet_frame_scoring_lib import * sys.path.append("../../../config") from config import * if __name__ == '__main__': #************************************************************************ # Purpose: frame scoring (Summarizing Videos with A...
[ "import os,sys,glob\nsys.path.append(\"../../../../libs/VASNet/\")\nfrom VASNet_frame_scoring_lib import *\nsys.path.append(\"../../../config\")\nfrom config import *\n\n\nif __name__ == '__main__':\n #************************************************************************\n # Purpose: frame scoring (Summari...
false
3,925
fcf19c49bb161305eaa5ba8bc26e276a8e8db8ea
import unittest from textwrap import dedent from simplesat import InstallRequirement, Repository from simplesat.test_utils import packages_from_definition from ..compute_dependencies import (compute_dependencies, compute_leaf_packages, compute_re...
[ "import unittest\nfrom textwrap import dedent\n\nfrom simplesat import InstallRequirement, Repository\nfrom simplesat.test_utils import packages_from_definition\n\nfrom ..compute_dependencies import (compute_dependencies,\n compute_leaf_packages,\n ...
false
3,926
4f4af4caf81397542e9cd94c50b54303e2f81881
import datetime import time import boto3 from botocore.config import Config # FinSpace class with Spark bindings class SparkFinSpace(FinSpace): import pyspark def __init__( self, spark: pyspark.sql.session.SparkSession = None, config = Config(retries = {'max_attempts': 0, 'mode': 'sta...
[ "import datetime\nimport time\nimport boto3\nfrom botocore.config import Config\n\n# FinSpace class with Spark bindings\n\nclass SparkFinSpace(FinSpace):\n import pyspark\n def __init__(\n self, \n spark: pyspark.sql.session.SparkSession = None,\n config = Config(retries = {'max_attempts'...
false
3,927
a8ea91797942616779ae0acc884db1e521c7ad28
from utils import * name = 'topological' def topological(above): "Topologically sort a DAG by removing a layer of sources until empty." result = [] while above: sources = set(above) - set(flatten(above.values())) result.extend(sources) for node in sources: del above[nod...
[ "from utils import *\n\nname = 'topological'\n\ndef topological(above):\n \"Topologically sort a DAG by removing a layer of sources until empty.\"\n result = []\n while above:\n sources = set(above) - set(flatten(above.values()))\n result.extend(sources)\n for node in sources:\n ...
false
3,928
a4f2418e746cc43bd407b6a212de9802044351e1
# -*- coding: utf-8 -*- """ plastiqpublicapi This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). """ import json import dateutil.parser from tests.controllers.controller_test_base import ControllerTestBase from tests.test_helper import TestHelper from tests.http_respon...
[ "# -*- coding: utf-8 -*-\r\n\r\n\"\"\"\r\nplastiqpublicapi\r\n\r\nThis file was automatically generated by APIMATIC v3.0 (\r\n https://www.apimatic.io ).\r\n\"\"\"\r\n\r\nimport json\r\nimport dateutil.parser\r\n\r\nfrom tests.controllers.controller_test_base import ControllerTestBase\r\nfrom tests.test_helper impo...
false
3,929
a84920821982f04b9835391eb267707971f8f7c1
import hashlib from ast import literal_eval # import requests # from rest_framework import generics from rest_framework.views import APIView from rest_framework.response import Response from django.shortcuts import render, redirect, HttpResponse,get_object_or_404 from django.views.decorators.csrf import csrf_exempt fro...
[ "import hashlib\nfrom ast import literal_eval\n# import requests\n# from rest_framework import generics\nfrom rest_framework.views import APIView\nfrom rest_framework.response import Response\nfrom django.shortcuts import render, redirect, HttpResponse,get_object_or_404\nfrom django.views.decorators.csrf import csr...
true
3,930
c034fba0b9204545b00ba972a17e63cf9c20854e
import pandas as pd def _get_site_name(f,i): data_file = f +"\\"+"new_desc_sele_data.csv" site_name=pd.read_csv(data_file)["SITE_ID"][i] return site_name def _get_site_DD_dataset_csv(f,i): '''获取经过全部数据集(经过全部的特征选择)''' site_path=_get_site_folder(f,i) data_path=site_path+"\\data_confirm.csv" ...
[ "import pandas as pd\n\n\ndef _get_site_name(f,i):\n data_file = f +\"\\\\\"+\"new_desc_sele_data.csv\"\n site_name=pd.read_csv(data_file)[\"SITE_ID\"][i]\n return site_name\n\ndef _get_site_DD_dataset_csv(f,i):\n '''获取经过全部数据集(经过全部的特征选择)'''\n site_path=_get_site_folder(f,i)\n data_path=site_path+\...
false
3,931
6b0d1de4c77841f20670331db3332cf87be7ad84
from django.apps import AppConfig class PersianConfig(AppConfig): name = 'persian'
[ "from django.apps import AppConfig\r\n\r\n\r\nclass PersianConfig(AppConfig):\r\n name = 'persian'\r\n", "from django.apps import AppConfig\n\n\nclass PersianConfig(AppConfig):\n name = 'persian'\n", "<import token>\n\n\nclass PersianConfig(AppConfig):\n name = 'persian'\n", "<import token>\n\n\nclas...
false
3,932
99c2bd56deccc327faf659e91fc1fd0f6ff7a219
from mf_app import db from mf_app.models import User db.create_all() #test input data admin = User('admin', 'admin@admin.com', 'admin') guest = User('guest', 'guest@guest.com', 'guest') db.session.add(admin) db.session.add(guest) db.session.commit() users = User.query.all() print(users)
[ "from mf_app import db\nfrom mf_app.models import User\n\ndb.create_all()\n\n#test input data\nadmin = User('admin', 'admin@admin.com', 'admin')\nguest = User('guest', 'guest@guest.com', 'guest')\n\ndb.session.add(admin)\ndb.session.add(guest)\n\ndb.session.commit()\n\nusers = User.query.all()\nprint(users)", "fr...
false
3,933
95c0ba757b7561ef6cc0ad312034e2695f8420c3
#!/usr/bin/env python3 x = "Programming is like building a multilingual puzzle\n" print (x)
[ "#!/usr/bin/env python3\n\nx = \"Programming is like building a multilingual puzzle\\n\"\n\n\nprint (x)\n", "x = 'Programming is like building a multilingual puzzle\\n'\nprint(x)\n", "<assignment token>\nprint(x)\n", "<assignment token>\n<code token>\n" ]
false
3,934
736861f18936c7a87ecf3deb134f589b9d7eed92
import matplotlib matplotlib.use('Agg') import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable def plot_overscan(overscan, img, TITLE, OUT_DIR): """ plot overscan in 9x2 plots with 16 channels """ fig = plt.figure(figs...
[ "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.gridspec as gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\n\n\ndef plot_overscan(overscan, img, TITLE, OUT_DIR):\n \"\"\" plot overscan in 9x2 plots with 16 channels \"\"\"\n ...
true
3,935
e1eb86480fa4eadabf05f10cc54ff9daa790438c
class Node(): def __init__(self, value): self.value = value self.next = None def linked_list_from_array(arr): head = Node(arr[0]) cur = head for i in range(1, len(arr)): cur.next = Node(arr[i]) cur = cur.next return head def array_from_linked_list(head): arr = [] cur = head whil...
[ "class Node():\n def __init__(self, value):\n self.value = value\n self.next = None\n\ndef linked_list_from_array(arr):\n head = Node(arr[0])\n cur = head\n \n for i in range(1, len(arr)):\n cur.next = Node(arr[i])\n cur = cur.next\n \n return head\n\ndef array_from_linked_list(head):\n arr = []...
false
3,936
bcdf1c03d996520f3d4d8d12ec4ef34ea63ef3cf
#!/usr/bin/python3 ################################################### ### Euler project ### zdrassvouitie @ 10/2016 ################################################### file_name = '013_largeSum_data' tot = 0 with open(file_name, "r") as f: stop = 1 while stop != 0: line = f.readline() if len(...
[ "#!/usr/bin/python3\n\n###################################################\n### Euler project\n### zdrassvouitie @ 10/2016\n###################################################\n\nfile_name = '013_largeSum_data'\ntot = 0\nwith open(file_name, \"r\") as f:\n stop = 1\n while stop != 0:\n line = f.readlin...
false
3,937
19ffac718008c7c9279fb8cbc7608597d2d3e708
print('-'*60) print('Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...') print() age = input('What is your age today? ') age = int(age) if age >= 21: print('Cool, come on in.') else: print('Your gonna need to back up. This club is 21+ only so find som...
[ "print('-'*60)\nprint('Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...')\nprint()\nage = input('What is your age today? ')\nage = int(age)\nif age >= 21:\n\tprint('Cool, come on in.')\nelse:\n\tprint('Your gonna need to back up. This club is 21+ o...
false
3,938
5e4a334b373d912ba37b18f95e4866450bda5570
# Generated by Django 2.2.2 on 2019-07-30 01:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('usuarios', '0001_initial'), ] operations = [ migrations.AlterField( model_name='usuario', name='inicio', ...
[ "# Generated by Django 2.2.2 on 2019-07-30 01:25\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('usuarios', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='usuario',\n name='i...
false
3,939
4328d526da14db756fad8d05457724a23e3e3ef6
from datetime import datetime import warnings import numpy as np import xarray as xr from .common import HDF4, expects_file_info pyhdf_is_installed = False try: from pyhdf import HDF, VS, V from pyhdf.SD import SD, SDC pyhdf_is_installed = True except ImportError: pass __all__ = [ 'CloudSat', ] ...
[ "from datetime import datetime\nimport warnings\n\nimport numpy as np\nimport xarray as xr\n\nfrom .common import HDF4, expects_file_info\n\npyhdf_is_installed = False\ntry:\n from pyhdf import HDF, VS, V\n from pyhdf.SD import SD, SDC\n pyhdf_is_installed = True\nexcept ImportError:\n pass\n\n__all__ =...
false
3,940
805bc144a4945b46b398853e79ded17370ada380
import glob import os import partition import pickle import matplotlib.pyplot as plt import numpy as np from Cluster import fishermans_algorithm import argparse parser = argparse.ArgumentParser() plt.ion() parser.add_argument("--fish", help="flag for using fisherman's algorithm") parser.add_argument("--heat", help="...
[ "import glob\nimport os\nimport partition\nimport pickle\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom Cluster import fishermans_algorithm\nimport argparse\n\nparser = argparse.ArgumentParser()\n\nplt.ion()\n\nparser.add_argument(\"--fish\", help=\"flag for using fisherman's algorithm\")\nparser.add_ar...
false
3,941
8280f321b102cace462761f9ece2aebf9e28a432
#!/usr/bin/python3 """display your id from github. """ from sys import argv import requests if __name__ == "__main__": get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2])).json().get('id') print(get)
[ "#!/usr/bin/python3\n\"\"\"display your id from github.\n\"\"\"\nfrom sys import argv\nimport requests\n\n\nif __name__ == \"__main__\":\n get = requests.get('https://api.github.com/user',\n auth=(argv[1], argv[2])).json().get('id')\n print(get)\n", "<docstring token>\nfrom sys import ...
false
3,942
1daecce86769e36a17fe2935f89b9266a0197cf0
from django.db import models class TamLicense(models.Model): license = models.TextField("Inserisci qui il tuo codice licenza.")
[ "from django.db import models\n\n\nclass TamLicense(models.Model):\n license = models.TextField(\"Inserisci qui il tuo codice licenza.\")\n", "from django.db import models\n\n\nclass TamLicense(models.Model):\n license = models.TextField('Inserisci qui il tuo codice licenza.')\n", "<import token>\n\n\ncla...
false
3,943
7a793c2081032745ae58f92a4572954333742dfd
import os # __file__: 当前文件 # os.path.dirname(): 所在目录 # os.path.abspath(): 当前文件/目录的绝对路径 # os.path.join(): 路径连接 # 项目路径 BASEDIR = os.path.abspath( os.path.dirname( os.path.dirname( __file__))) # 数据文件目录 DATA_DIR = os.path.join(BASEDIR, "data") DATA_FILE = os.path.join(DATA_DIR, 'data.yaml')
[ "import os\n\n# __file__: 当前文件\n# os.path.dirname(): 所在目录\n# os.path.abspath(): 当前文件/目录的绝对路径\n# os.path.join(): 路径连接\n\n# 项目路径\nBASEDIR = os.path.abspath(\n os.path.dirname(\n os.path.dirname(\n __file__)))\n\n# 数据文件目录\nDATA_DIR = os.path.join(BASEDIR, \"data\")\nDATA_FILE = os.path.join(DATA_D...
false
3,944
ece80a7765674f9d2991029bb86486b616a90f58
class Solution(object): def moveZeroes(self, nums): """ 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 --- 输入: [0,1,0,3,12] 输出: [1,3,12,0,0] --- 思路; :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ num = nums.count(0) while 0 in nums: nums.remove...
[ "class Solution(object):\n\tdef moveZeroes(self, nums):\n\t\t\"\"\"\n\t\t给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。\n\t\t---\n\t\t输入: [0,1,0,3,12]\n\t\t输出: [1,3,12,0,0]\n\t\t---\n\t\t思路;\n\n\t\t:type nums: List[int]\n\t\t:rtype: void Do not return anything, modify nums in-place instead.\n\t\t\"\"\"\n\t\tnum = ...
false
3,945
83d35c413af0cefb71964671b43df1e815aa2115
# coding: utf-8 """ Provides test-related code that can be used by all tests. """ import os DATA_DIR = 'tests/data' def get_data_path(file_name): return os.path.join(DATA_DIR, file_name) def assert_strings(test_case, actual, expected): # Show both friendly and literal versions. message = """\ ...
[ "# coding: utf-8\n\n\"\"\"\nProvides test-related code that can be used by all tests.\n\n\"\"\"\n\nimport os\n\n\nDATA_DIR = 'tests/data'\n\ndef get_data_path(file_name):\n return os.path.join(DATA_DIR, file_name)\n\n\ndef assert_strings(test_case, actual, expected):\n # Show both friendly and literal version...
false
3,946
d7aa85c2458ee12a8de0f75419945fbe2acdf95d
#! /usr/bin/python3 class Animal: def eat(self): print("吃") def bark(self): print("喝") def run(seft): print("跑") def sleep(self): print("睡") class Dog(Animal): # 子类拥有父类的所有属性和方法 def bark(self): print("汪汪叫") class XiaoTianQuan(Dog): # 3. 增加其...
[ "#! /usr/bin/python3\nclass Animal:\n \n def eat(self):\n print(\"吃\")\n def bark(self):\n print(\"喝\")\n\n def run(seft):\n print(\"跑\")\n\n def sleep(self):\n print(\"睡\")\n\n\nclass Dog(Animal):\n # 子类拥有父类的所有属性和方法\n def bark(self):\n print(\"汪汪叫\")\n\nclass...
false
3,947
5a3431b79b8f42b3042bb27d787d0d92891a7415
# -*- coding:utf-8 -*- ''' Created on 2016��4��8�� @author: liping ''' import sys from PyQt4 import QtGui,QtCore class QuitButton(QtGui.QWidget): def __init__(self,parent = None): QtGui.QWidget.__init__(self,parent) self.setGeometry(300,300,250,150) self.setWindowTitle('quitButto...
[ "# -*- coding:utf-8 -*-\n'''\nCreated on 2016��4��8��\n\n@author: liping\n'''\n\nimport sys\nfrom PyQt4 import QtGui,QtCore\n\nclass QuitButton(QtGui.QWidget):\n def __init__(self,parent = None):\n QtGui.QWidget.__init__(self,parent)\n \n self.setGeometry(300,300,250,150)\n self.setWi...
false
3,948
dff454cbde985a08b34377b80dd8e3b22f1cc13a
from django.http import response from django.shortcuts import render from rest_framework.views import APIView from rest_framework.response import Response from .models import User from .serializers import UserSerializer,UserCreationSerialier,UserEditionSerializer from rest_framework import status from rest_framework.pe...
[ "from django.http import response\nfrom django.shortcuts import render\nfrom rest_framework.views import APIView\nfrom rest_framework.response import Response\nfrom .models import User\nfrom .serializers import UserSerializer,UserCreationSerialier,UserEditionSerializer\nfrom rest_framework import status\nfrom rest_...
false
3,949
d8cfd9de95e1f47fc41a5389f5137b4af90dc0f1
from datetime import datetime import pytz from pytz import timezone ##PDXtime = datetime.now() ##print(PDXtime.hour) ## ##NYCtime = PDXtime.hour + 3 ##print(NYCtime) ## ##Londontime = PDXtime.hour + 8 ##print(Londontime) Londontz = timezone('Europe/London') Londonlocaltime = datetime.now(Londontz) print(Londo...
[ "from datetime import datetime\nimport pytz\nfrom pytz import timezone \n\n\n\n##PDXtime = datetime.now()\n##print(PDXtime.hour)\n##\n##NYCtime = PDXtime.hour + 3\n##print(NYCtime)\n##\n##Londontime = PDXtime.hour + 8\n##print(Londontime)\n\n\n\nLondontz = timezone('Europe/London')\nLondonlocaltime = datetime.no...
false
3,950
b9bc6a9dbb3dbe51fbae45078bd499fb97fa003f
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from c7n_azure.provider import resources from c7n_azure.resources.arm import ArmResourceManager from c7n.utils import type_schema from c7n.filters.core import ValueFilter @resources.register('mysql-flexibleserver') class MySQLFlexibleServ...
[ "# Copyright The Cloud Custodian Authors.\n# SPDX-License-Identifier: Apache-2.0\n\nfrom c7n_azure.provider import resources\nfrom c7n_azure.resources.arm import ArmResourceManager\nfrom c7n.utils import type_schema\nfrom c7n.filters.core import ValueFilter\n\n\n@resources.register('mysql-flexibleserver')\nclass My...
false
3,951
1049a7d2cdc54c489af6246ec014deb63a98f96d
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('levantamiento', '0001_initial'), ] operations = [ migrations.CreateModel( name='FichaTecnica', field...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('levantamiento', '0001_initial'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='FichaTecnica'...
false
3,952
384588e1a767081191228db2afa4a489f967a220
""" AlbumInfo-related frames for the Album view. """ from __future__ import annotations import logging from typing import TYPE_CHECKING, Iterator, Collection, Any from ds_tools.caching.decorators import cached_property from tk_gui.elements import Element, HorizontalSeparator, Multiline, Text, Input, Image, Spacer fr...
[ "\"\"\"\nAlbumInfo-related frames for the Album view.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport logging\nfrom typing import TYPE_CHECKING, Iterator, Collection, Any\n\nfrom ds_tools.caching.decorators import cached_property\nfrom tk_gui.elements import Element, HorizontalSeparator, Multiline, Text, In...
true
3,953
e008f9b11a9b7480e9fb53391870809d6dea5497
import numpy as np from global_module.implementation_module import Autoencoder from global_module.implementation_module import Reader import tensorflow as tf from global_module.settings_module import ParamsClass, Directory, Dictionary import random import sys import time class Test: def __init__(self): se...
[ "import numpy as np\nfrom global_module.implementation_module import Autoencoder\nfrom global_module.implementation_module import Reader\nimport tensorflow as tf\nfrom global_module.settings_module import ParamsClass, Directory, Dictionary\nimport random\nimport sys\nimport time\n\n\nclass Test:\n def __init__(s...
false
3,954
44bf409d627a6029ab4c4f1fff99f102b8d57279
# cook your dish here t=int(input()) while t: n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) s=0 for i in range(n): k=a[i]-i if k>=0: s+=k print(s%1000000007) t-=1
[ "# cook your dish here\nt=int(input())\nwhile t:\n n=int(input())\n a=list(map(int,input().split()))\n a.sort(reverse=True)\n s=0\n for i in range(n):\n k=a[i]-i\n if k>=0:\n s+=k\n print(s%1000000007)\n t-=1\n", "t = int(input())\nwhile t:\n n = int(input())\n ...
false
3,955
6db0adf25a7cc38c8965c07cc80bde0d82c75d56
import os from sqlalchemy import Column, ForeignKey, Integer, String, Float, Boolean, DateTime from sqlalchemy import and_, or_ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine, func from sqlalchemy.orm import sessionmaker, scoped_sess...
[ "import os\n\nfrom sqlalchemy import Column, ForeignKey, Integer, String, Float, Boolean, DateTime\nfrom sqlalchemy import and_, or_\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import relationship\nfrom sqlalchemy import create_engine, func\nfrom sqlalchemy.orm import sessionmaker,...
false
3,956
26744d51dbce835d31d572a053294c9d280e1a8b
#SEE /etc/rc.local FOR BOOTUP COMMANDS from Measure_and_File import * from WebServer import * from multiprocessing import * web = WebServer() board_boy = Measurer_and_Filer() #try: proc1 = Process( target=board_boy.measure_and_file, args=() ) proc1.start() proc2 = Process( target=web.serve, args=() ) proc2.start() #...
[ "#SEE /etc/rc.local FOR BOOTUP COMMANDS\n\nfrom Measure_and_File import *\nfrom WebServer import *\nfrom multiprocessing import *\n\nweb = WebServer()\nboard_boy = Measurer_and_Filer()\n\n#try:\nproc1 = Process( target=board_boy.measure_and_file, args=() )\nproc1.start()\nproc2 = Process( target=web.serve, args=() ...
false
3,957
f3d61a9aa4205e91811f17c4e9520811445cc6a9
import sys import random #coming into existence, all does not begin and end at this moment; #not yet fully conscious, you pick up only snippets of your environment for line in sys.stdin: line = line.strip() randLow = random.randint(0, 10) randHigh = random.randint(11, 20) print line[randLow:randHigh]
[ "import sys\nimport random\n\n#coming into existence, all does not begin and end at this moment; \n#not yet fully conscious, you pick up only snippets of your environment\nfor line in sys.stdin:\n\tline = line.strip()\n\n\trandLow = random.randint(0, 10)\n\trandHigh = random.randint(11, 20)\n\n\tprint line[randLow:...
true
3,958
a5f3af6fc890f61eecb35bd157fc51bb65b4c586
# Standard Library imports: import argparse import os from pathlib import Path from typing import Dict, List # 3rd Party imports: import keras.backend as K from keras.layers import * from keras.models import Model import tensorflow as tf from tensorflow.python.framework import graph_io, graph_util from tensorflow.pyth...
[ "# Standard Library imports:\nimport argparse\nimport os\nfrom pathlib import Path\nfrom typing import Dict, List\n\n# 3rd Party imports:\nimport keras.backend as K\nfrom keras.layers import *\nfrom keras.models import Model\nimport tensorflow as tf\nfrom tensorflow.python.framework import graph_io, graph_util\nfro...
false
3,959
79390f3ae5dc4cc9105a672d4838a8b1ba53a248
from flask import Flask, render_template, request, redirect #from gevent.pywsgi import WSGIServer import model as db import sys import time, calendar import jsonify def get_date(date): date = date.split("/") time = str(date[0]) day_str = calendar.day_name[calendar.weekday(int(date[3]), int(date[2]), int(da...
[ "from flask import Flask, render_template, request, redirect\n#from gevent.pywsgi import WSGIServer\nimport model as db\nimport sys\nimport time, calendar\nimport jsonify\n\ndef get_date(date):\n date = date.split(\"/\")\n time = str(date[0])\n day_str = calendar.day_name[calendar.weekday(int(date[3]), int...
false
3,960
9fa5f4b4aeb7fe42d313a0ec4e57ce15acbfcf46
from keras.models import Sequential from keras.layers import Convolution2D # for 2d images from keras.layers import MaxPool2D from keras.layers import Flatten from keras.layers import Dense import tensorflow as tf from keras_preprocessing.image import ImageDataGenerator cnn = Sequential() rgb = 64 # step 1: convolu...
[ "from keras.models import Sequential\nfrom keras.layers import Convolution2D # for 2d images\nfrom keras.layers import MaxPool2D\nfrom keras.layers import Flatten\nfrom keras.layers import Dense\nimport tensorflow as tf\nfrom keras_preprocessing.image import ImageDataGenerator\n\ncnn = Sequential()\n\nrgb = 64\n\n...
false
3,961
201279c0cba2d52b6863204bfadb6291a0065f60
from django.conf import settings from django.contrib.sites.models import RequestSite from django.contrib.sites.models import Site from fish.labinterface.models import * from registration import signals from registration.forms import RegistrationForm from registration.models import RegistrationProfile from labinterfac...
[ "from django.conf import settings\nfrom django.contrib.sites.models import RequestSite\nfrom django.contrib.sites.models import Site\n\nfrom fish.labinterface.models import *\n\nfrom registration import signals\nfrom registration.forms import RegistrationForm\nfrom registration.models import RegistrationProfile\nfr...
false
3,962
ab4145ccc0b360dcca9b9aa6ebe919bdddac65a2
from django.urls import path from photo.api.views import api_photo_detail_view, api_photos_view urlpatterns = [ path('<int:id>', api_photo_detail_view, name='user_detail'), path('', api_photos_view, name='users') ]
[ "from django.urls import path\nfrom photo.api.views import api_photo_detail_view, api_photos_view\n\nurlpatterns = [\n path('<int:id>', api_photo_detail_view, name='user_detail'),\n path('', api_photos_view, name='users')\n]", "from django.urls import path\nfrom photo.api.views import api_photo_detail_view,...
false
3,963
2194fb4f0b0618f1c8db39f659a4890457f45b1d
from django.conf.urls import patterns, url urlpatterns = patterns( '', url( r'^create_new/$', 'hx_lti_assignment.views.create_new_assignment', name="create_new_assignment", ), url( r'^(?P<id>[0-9]+)/edit/', 'hx_lti_assignment.views.edit_assignment', name=...
[ "from django.conf.urls import patterns, url\n\nurlpatterns = patterns(\n '',\n url(\n r'^create_new/$',\n 'hx_lti_assignment.views.create_new_assignment',\n name=\"create_new_assignment\",\n ),\n url(\n r'^(?P<id>[0-9]+)/edit/',\n 'hx_lti_assignment.views.edit_assignme...
false
3,964
721f23d2b6109194b8bca54b1cd04263e30cdf24
# -*- coding: utf-8 -*- """ Created on Wed Oct 3 16:04:19 2018 @author: khanhle """ # Create first network with Keras from keras.models import Sequential from keras.layers import Dense from keras.layers import Activation from keras.utils import np_utils from keras.layers.convolutional import Convolut...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Wed Oct 3 16:04:19 2018\r\n\r\n@author: khanhle\r\n\"\"\"\r\n\r\n\r\n\r\n# Create first network with Keras\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Dense\r\nfrom keras.layers import Activation\r\nfrom keras.utils import np_utils\r\nfrom ker...
false
3,965
b16e64edd0ff55a424ce3d4589321ee4576e930c
# # PySNMP MIB module AN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AN-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:22:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) ...
[ "#\n# PySNMP MIB module AN-MIB (http://snmplabs.com/pysmi)\n# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AN-MIB\n# Produced by pysmi-0.3.4 at Wed May 1 11:22:33 2019\n# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4\n# Using Python version 3.7.3 (default, Mar 27 2019, 0...
false
3,966
e90e4d2c777554999ab72d725d7e57bdfd508d3a
#!/usr/bin/env python import rospy from mark1.srv import WordCount, WordCountResponse s= set('',) def count_words(request): s.update(set( request.words.split() )) print s return WordCountResponse( len( request.words.split())) rospy.init_node('mark_service_server') service = rospy.Service('Word_count', W...
[ "#!/usr/bin/env python\nimport rospy\nfrom mark1.srv import WordCount, WordCountResponse\n\ns= set('',)\n\ndef count_words(request):\n s.update(set( request.words.split() ))\n print s\n return WordCountResponse( len( request.words.split()))\n\nrospy.init_node('mark_service_server')\n\nservice = rospy.Servi...
true
3,967
1d004ec0f4f5c50f49834f169812737d16f22b96
w=int(input()) lst=[i+1 for i in range(100)] for i in range(2,100): lst.append(i*100) lst.append(i*10000) lst.append(10000) print(297) print(*lst)
[ "w=int(input())\nlst=[i+1 for i in range(100)]\n\nfor i in range(2,100):\n lst.append(i*100)\n lst.append(i*10000)\nlst.append(10000) \nprint(297)\nprint(*lst)\n", "w = int(input())\nlst = [(i + 1) for i in range(100)]\nfor i in range(2, 100):\n lst.append(i * 100)\n lst.append(i * 10000)\nlst.append(...
false
3,968
5607d4fea315fa7bf87337453fbef90a93a66516
import random firstNames = ("Thomas", "Daniel", "James", "Aaron", "Tommy", "Terrell", "Jack", "Joseph", "Samuel", "Quinn", "Hunter", "Vince", "Young", "Ian", "Erving", "Leo") lastNames = ("Smith", "Johnson", "Williams", "Kline","Brown", "Garcia", "Jones", "Miller", "Davis","Williams", "Alves", "Sobronsky", "Hall"...
[ "import random\r\n\r\n\r\nfirstNames = (\"Thomas\", \"Daniel\", \"James\", \"Aaron\", \"Tommy\", \"Terrell\", \"Jack\", \"Joseph\", \"Samuel\", \"Quinn\", \"Hunter\", \"Vince\", \"Young\", \"Ian\", \"Erving\", \"Leo\")\r\nlastNames = (\"Smith\", \"Johnson\", \"Williams\", \"Kline\",\"Brown\", \"Garcia\", \"Jones\",...
false
3,969
246ec0d6833c9292487cb4d381d2ae82b220677e
import sys def show_data(data): for line in data: print(''.join(line)) print("") def check_seat(data, i, j): if data[i][j] == '#': occupied = 1 found = True elif data[i][j] == 'L': occupied = 0 found = True else: occupied = 0 found = False ...
[ "import sys\n\n\ndef show_data(data):\n for line in data:\n print(''.join(line))\n print(\"\")\n\n\ndef check_seat(data, i, j):\n if data[i][j] == '#':\n occupied = 1\n found = True\n elif data[i][j] == 'L':\n occupied = 0\n found = True\n else:\n occupied = ...
false
3,970
78db25586f742b0a20bc3fad382b0d4f1a271841
#!/usr/bin/python3 experiment_name = "nodes10" wall = "wall2" wall_image = "irati_110" mr_dif_policy = True spn_dif_policy = True destination_ip = "2001:40b0:7500:286:84:88:81:57"
[ "#!/usr/bin/python3\n\nexperiment_name = \"nodes10\"\nwall = \"wall2\"\nwall_image = \"irati_110\"\nmr_dif_policy = True\nspn_dif_policy = True\ndestination_ip = \"2001:40b0:7500:286:84:88:81:57\"\n", "experiment_name = 'nodes10'\nwall = 'wall2'\nwall_image = 'irati_110'\nmr_dif_policy = True\nspn_dif_policy = Tr...
false
3,971
e0c10dfa4074b0de4d78fc78a6f373074ef4dadd
letters = ['a', 'b', 'c'] def delete_head(letters): del letters[0] print letters print delete_head(letters)
[ "letters = ['a', 'b', 'c']\ndef delete_head(letters):\n\tdel letters[0]\n\tprint letters\nprint delete_head(letters)\n\n" ]
true
3,972
e007e2d32fa799e7658813f36911616f7bf58b48
from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf tf.__version__ import glob import imageio import matplotlib.pyplot as plt import numpy as np import os import PIL from tensorflow.keras import layers import time import pathlib from IPython import display ###---...
[ "from __future__ import absolute_import, division, print_function, unicode_literals\nimport tensorflow as tf\ntf.__version__\nimport glob\nimport imageio\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport os\nimport PIL\nfrom tensorflow.keras import layers\nimport time\nimport pathlib\nfrom IPython import...
false
3,973
c007dc2416d3f7c883c44dea5471927ea6f816d6
# Uses python3 import sys from operator import attrgetter from collections import namedtuple Segment = namedtuple('Segment', 'start end') def optimal_points(segments): segments = sorted(segments, key=attrgetter('end'), reverse=True) points = [] #write your code here while len(segments) > 0: ...
[ "# Uses python3\nimport sys\nfrom operator import attrgetter\nfrom collections import namedtuple\n\nSegment = namedtuple('Segment', 'start end')\n\n\ndef optimal_points(segments):\n segments = sorted(segments, key=attrgetter('end'), reverse=True)\n points = []\n\n #write your code here\n while len(segme...
false
3,974
395ff2e7c052b57548151fc71fad971c94ebceea
#@@---------------------------@@ # Author: Chamil Jayasundara # Date: 5/18/17 # Description: Extract SFLOW data from slow logs #@@---------------------------@@ import itertools from collections import defaultdict """Flow Sample and Datagram Objects""" class Container(object): def __init__(self, id): ...
[ "#@@---------------------------@@\n# Author: Chamil Jayasundara\n# Date: 5/18/17\n# Description: Extract SFLOW data from slow logs\n#@@---------------------------@@\n\nimport itertools\nfrom collections import defaultdict\n\n\"\"\"Flow Sample and Datagram Objects\"\"\"\n\n\nclass Container(object):\n\n def __...
false
3,975
6aa7114db66a76cfa9659f5537b1056f40f47bd2
import requests import json ROOT_URL = "http://localhost:5000" def get_all_countries(): response = requests.get("{}/countries".format(ROOT_URL)) return response.json()["countries"] def get_country_probability(countryIds): body = {"countryIds": countryIds} response = requests.get("{}/countries/probability".format...
[ "import requests\nimport json\n\nROOT_URL = \"http://localhost:5000\"\n\ndef get_all_countries():\n\tresponse = requests.get(\"{}/countries\".format(ROOT_URL))\n\treturn response.json()[\"countries\"]\n\ndef get_country_probability(countryIds):\n\tbody = {\"countryIds\": countryIds}\n\tresponse = requests.get(\"{}/...
false
3,976
325708d5e8b71bad4806b59f3f86a737c1baef8d
"""game""" def get_word_score(word_1, n_1): """string""" # import string # key = list(string.ascii_lowercase) # value = [] # x=1 sum_1 = 0 # for i in range(0, 26): # value.append(x) # x+=1 # dictionary_ = dict(zip(key, value)) # print(dictionary_) dictionary_ = {'...
[ "\"\"\"game\"\"\"\ndef get_word_score(word_1, n_1):\n \"\"\"string\"\"\"\n # import string\n # key = list(string.ascii_lowercase)\n # value = []\n # x=1\n sum_1 = 0\n # for i in range(0, 26):\n # value.append(x)\n # x+=1\n # dictionary_ = dict(zip(key, value))\n # print(dict...
false
3,977
7d54d5fd855c7c03d2d4739e8ad4f9ab8772ca2b
def longest(s1, s2): # your code s=s1+s2 st="".join(sorted(set(s))) return st longest("xyaabbbccccdefww","xxxxyyyyabklmopq")
[ "def longest(s1, s2):\n # your code\n s=s1+s2\n st=\"\".join(sorted(set(s))) \n return st\n \n \nlongest(\"xyaabbbccccdefww\",\"xxxxyyyyabklmopq\")\n", "def longest(s1, s2):\n s = s1 + s2\n st = ''.join(sorted(set(s)))\n return st\n\n\nlongest('xyaabbbccccdefww', 'xxxxyyyyabklmopq')\...
false
3,978
e72962b644fab148741eb1c528d48ada45a43e51
# Generated by Django 3.2.2 on 2021-05-07 08:01 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='teams', fields=[ ('id', models.AutoField(pr...
[ "# Generated by Django 3.2.2 on 2021-05-07 08:01\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='teams',\n fields=[\n ('id'...
false
3,979
ed6eda4b6dbf3e94d8efb53004b19cd9c49e927e
import sqlite3 import sys import threading from time import sleep sq = None def get_queue(category, parser): if sq == None: return liteQueue(category, parser) return sq """ SqLite Job Handler class for Links """ class liteQueue: _create = "CREATE TABLE IF NOT EXISTS link ( 'url' TEXT,'cat...
[ "import sqlite3\nimport sys\nimport threading\nfrom time import sleep\n\nsq = None\n\ndef get_queue(category, parser):\n if sq == None:\n return liteQueue(category, parser)\n return sq\n\n\"\"\"\nSqLite Job Handler class for Links\n\"\"\"\nclass liteQueue:\n _create = \"CREATE TABLE IF NOT E...
false
3,980
fa925d0ef4f9df3fdf9a51c7fcc88933609bc9e3
import turtle pen = turtle.Turtle() def curve(): for i in range(200): pen.right(1) pen.forward(1) def heart(): pen.fillcolor('yellow') pen.begin_fill() pen.left(140) pen.forward(113) curve() pen.left(120) curve() pen.forward(112) pen.end_fill() heart()
[ "import turtle\npen = turtle.Turtle()\ndef curve():\n for i in range(200):\n pen.right(1)\n pen.forward(1)\n\ndef heart():\n pen.fillcolor('yellow')\n pen.begin_fill()\n pen.left(140)\n pen.forward(113)\n curve()\n pen.left(120)\n curve()\n pen.forward(112)\n pen.end_fill...
false
3,981
78a6202f501bc116e21e98a3e83c9e3f8d6402b4
#!/usr/bin/env python import requests import re def get_content(url): paste_info = { 'site': 'pomf', 'url': url } m = re.match('^.*/([0-9a-zA-Z]+)\.([a-zA-Z0-9]+)$',url) response = requests.get(url) if response.status_code != 200: return paste_info['ext'] = m.group(2) ...
[ "#!/usr/bin/env python\nimport requests\nimport re\ndef get_content(url):\n paste_info = {\n 'site': 'pomf',\n 'url': url\n }\n m = re.match('^.*/([0-9a-zA-Z]+)\\.([a-zA-Z0-9]+)$',url)\n response = requests.get(url)\n if response.status_code != 200:\n return\n paste_info['ext'...
false
3,982
1bb82a24faed6079ec161d95eff22aa122295c13
# -*- coding: utf-8 -*- """ :copyright: (c) 2014-2016 by Mike Taylor :license: MIT, see LICENSE for more details. Micropub Tools """ import requests from bs4 import BeautifulSoup, SoupStrainer try: # Python v3 from urllib.parse import urlparse, urljoin except ImportError: from urlparse import urlparse, urlj...
[ "# -*- coding: utf-8 -*-\n\"\"\"\n:copyright: (c) 2014-2016 by Mike Taylor\n:license: MIT, see LICENSE for more details.\n\nMicropub Tools\n\"\"\"\n\nimport requests\nfrom bs4 import BeautifulSoup, SoupStrainer\n\ntry: # Python v3\n from urllib.parse import urlparse, urljoin\nexcept ImportError:\n from urlpa...
false
3,983
13e3337cf9e573b8906fe914a830a8e895af20ba
import re class Markdown: __formattedFile = [] __analyzing = [] def __processSingleLine(self, line): if(self.__isHeading(line)): self.__process("p") self.__analyzing.append(re.sub("(#{1,6})", "", line).strip()) self.__process("h" + str(len(re.split("\s", line)[0]))) elif(self.__isH...
[ "import re\n\nclass Markdown:\n\n __formattedFile = []\n __analyzing = []\n\n \n def __processSingleLine(self, line):\n if(self.__isHeading(line)):\n self.__process(\"p\")\n self.__analyzing.append(re.sub(\"(#{1,6})\", \"\", line).strip())\n self.__process(\"h\" + str(len(re.split(\"\\s\", lin...
false
3,984
9178d39a44cfb69e74b4d6cd29cbe56aea20f582
#!/usr/bin/env python #coding:gbk """ Author: pengtao --<pengtao@baidu.com> Purpose: 1. 管理和交互式调用hadoop Job的框架 History: 1. 2013/12/11 created """ import sys import inspect import cmd import readline #import argparse #from optparse import (OptionParser, BadOptionError, AmbiguousOptionError) from job i...
[ "#!/usr/bin/env python\n#coding:gbk\n\n\"\"\"\n Author: pengtao --<pengtao@baidu.com>\n Purpose: \n 1. 管理和交互式调用hadoop Job的框架\n History:\n 1. 2013/12/11 created\n\"\"\"\n\n\n\nimport sys\nimport inspect\nimport cmd\nimport readline\n#import argparse\n#from optparse import (OptionParser, BadOptionError, Ambi...
true
3,985
b16691429d83f6909a08b10cc0b310bb62cd550d
import json from gamestate.gamestate_module import Gamestate from time import time from gamestate import action_getter as action_getter def test_action_getter(): path = "./../Version_1.0/Tests/General/Action_1.json" document = json.loads(open(path).read()) gamestate = Gamestate.from_document(document["gam...
[ "import json\nfrom gamestate.gamestate_module import Gamestate\nfrom time import time\nfrom gamestate import action_getter as action_getter\n\n\ndef test_action_getter():\n path = \"./../Version_1.0/Tests/General/Action_1.json\"\n document = json.loads(open(path).read())\n gamestate = Gamestate.from_docume...
false
3,986
5c8628e41c0dd544ade330fdd37841beca6c0c91
#!/usr/bin/env python # -*- coding: utf-8 -*- # Triangle Project Code. # Triangle analyzes the lengths of the sides of a triangle # (represented by a, b and c) and returns the type of triangle. # # It returns: # 'equilateral' if all sides are equal # 'isosceles' if exactly 2 sides are equal # 'scalene' ...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Triangle Project Code.\n\n# Triangle analyzes the lengths of the sides of a triangle\n# (represented by a, b and c) and returns the type of triangle.\n#\n# It returns:\n# 'equilateral' if all sides are equal\n# 'isosceles' if exactly 2 sides are equal\n# ...
false
3,987
e9908e32204da8973f06d98430fc660c90b5e303
#14681 #점의 좌표를 입력받아 그 점이 어느 사분면에 속하는지 알아내는 프로그램을 작성하시오. 단, x좌표와 y좌표는 모두 양수나 음수라고 가정한다. x = int(input()) y = int(input()) if(x>0 and y>0): print("1") elif(x>0 and y<0): print("4") elif(x<0 and y>0): print("2") else: print("3")
[ "#14681\n#점의 좌표를 입력받아 그 점이 어느 사분면에 속하는지 알아내는 프로그램을 작성하시오. 단, x좌표와 y좌표는 모두 양수나 음수라고 가정한다.\n\nx = int(input())\ny = int(input())\n\nif(x>0 and y>0):\n print(\"1\")\nelif(x>0 and y<0):\n print(\"4\")\nelif(x<0 and y>0):\n print(\"2\")\nelse:\n print(\"3\")\n", "x = int(input())\ny = int(input())\nif x > ...
false
3,988
25d4fa44cb17048301076391d5d67ae0b0812ac7
# coding: utf-8 """ SevOne API Documentation Supported endpoints by the new RESTful API # noqa: E501 OpenAPI spec version: 2.1.18, Hash: db562e6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from swagger_client.models.d...
[ "# coding: utf-8\n\n\"\"\"\n SevOne API Documentation\n\n Supported endpoints by the new RESTful API # noqa: E501\n\n OpenAPI spec version: 2.1.18, Hash: db562e6\n \n Generated by: https://github.com/swagger-api/swagger-codegen.git\n\"\"\"\n\n\nimport pprint\nimport re # noqa: F401\n\nimport six\n\...
false
3,989
59eb705d6d388de9afbcc0df3003f4d4f45f1fbd
import Tkinter import random secret = random.randint(1, 100) ### TKINTER ELEMENTS ### window = Tkinter.Tk() # greeting text greeting = Tkinter.Label(window, text="Guess the secret number!") greeting.pack() # guess entry field guess = Tkinter.Entry(window) guess.pack() # submit button submit = Tkinter.Button(windo...
[ "import Tkinter\nimport random\n\nsecret = random.randint(1, 100)\n\n### TKINTER ELEMENTS ###\n\nwindow = Tkinter.Tk()\n\n# greeting text\ngreeting = Tkinter.Label(window, text=\"Guess the secret number!\")\ngreeting.pack()\n\n# guess entry field\nguess = Tkinter.Entry(window)\nguess.pack()\n\n# submit button\nsubm...
false
3,990
8e9aec7d3653137a05f94e4041d28f3423122751
from os.path import basename from .FileInfo import FileInfo class mrk_file(FileInfo): """ .mrk specific file container. """ def __init__(self, id_=None, file=None, parent=None): super(mrk_file, self).__init__(id_, file, parent) self._type = '.mrk' #region class methods def __get...
[ "from os.path import basename\n\nfrom .FileInfo import FileInfo\n\n\nclass mrk_file(FileInfo):\n \"\"\"\n .mrk specific file container.\n \"\"\"\n def __init__(self, id_=None, file=None, parent=None):\n super(mrk_file, self).__init__(id_, file, parent)\n self._type = '.mrk'\n\n#region clas...
false
3,991
5447bd3b08c22913ae50ee66ee81554d2357ef3e
import os from typing import Union, Tuple, List import pandas as pd from flags import FLAGS from helpers import load_from_pickle, decode_class, sort_results_by_metric ROOT = FLAGS.ROOT RESULTS_FOLDER = FLAGS.RESULTS_FOLDER FULL_PATH_TO_CHECKPOINTS = os.path.join(ROOT, RESULTS_FOLDER, "checkpoints") def eval_resul...
[ "import os\nfrom typing import Union, Tuple, List\n\nimport pandas as pd\n\nfrom flags import FLAGS\nfrom helpers import load_from_pickle, decode_class, sort_results_by_metric\n\nROOT = FLAGS.ROOT\nRESULTS_FOLDER = FLAGS.RESULTS_FOLDER\n\nFULL_PATH_TO_CHECKPOINTS = os.path.join(ROOT, RESULTS_FOLDER, \"checkpoints\"...
false
3,992
31761b9469cc579c209e070fbe7b71943404a1ff
import requests import json def display_response(rsp): try: print("Printing a response.") print("HTTP status code: ", rsp.status_code) h = dict(rsp.headers) print("Response headers: \n", json.dumps(h, indent=2, default=str)) try: body = rsp.json() p...
[ "import requests\nimport json\n\ndef display_response(rsp):\n\n try:\n print(\"Printing a response.\")\n print(\"HTTP status code: \", rsp.status_code)\n h = dict(rsp.headers)\n print(\"Response headers: \\n\", json.dumps(h, indent=2, default=str))\n\n try:\n body = ...
false
3,993
35d99713df754052a006f76bb6f3cfe9cf875c0b
#!/usr/local/autopkg/python """ JamfScriptUploader processor for uploading items to Jamf Pro using AutoPkg by G Pugh """ import os.path import sys from time import sleep from autopkglib import ProcessorError # pylint: disable=import-error # to use a base module in AutoPkg we need to add this path to the sys.pa...
[ "#!/usr/local/autopkg/python\n\n\"\"\"\nJamfScriptUploader processor for uploading items to Jamf Pro using AutoPkg\n by G Pugh\n\"\"\"\n\nimport os.path\nimport sys\n\nfrom time import sleep\nfrom autopkglib import ProcessorError # pylint: disable=import-error\n\n# to use a base module in AutoPkg we need to add...
false
3,994
473c653da54ebdb7fe8a9eefc166cab167f43357
"""Config for a linear regression model evaluated on a diabetes dataset.""" from dbispipeline.evaluators import GridEvaluator import dbispipeline.result_handlers as result_handlers from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from nlp4musa2020.dataloaders.alf200k import ALF200...
[ "\"\"\"Config for a linear regression model evaluated on a diabetes dataset.\"\"\"\nfrom dbispipeline.evaluators import GridEvaluator\nimport dbispipeline.result_handlers as result_handlers\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.preprocessing import StandardScaler\n\nfrom nlp4musa2020.dataloaders.alf2...
false
3,995
1c1f1dab1ae2e8f18536784a5dec9de37c8a8582
def test_{{ project_name }}(): assert True
[ "def test_{{ project_name }}():\n assert True\n" ]
true
3,996
2e66a31638eb4e619f14a29d5d3847482d207003
from django.db import connection from .models import Order from .models import Package from .models import DeliveryStatus from .models import CalcParameters class DataService: def __init__(self): pass @staticmethod def get_all_orders(): orders = Order.objects.order_by('-order_date') ...
[ "from django.db import connection\n\nfrom .models import Order\nfrom .models import Package\nfrom .models import DeliveryStatus\nfrom .models import CalcParameters\n\n\nclass DataService:\n def __init__(self):\n pass\n\n @staticmethod\n def get_all_orders():\n orders = Order.objects.order_by(...
false
3,997
4acdde648b5ec32c078579e725e6ae035298f25a
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-01-15 17:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Person...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.9 on 2018-01-15 17:27\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n ...
false
3,998
cbcbc0d01c32693ebbdbcf285efdc8e521c447ee
import pygame from evolution import Darwin from Sensor import Robot, obstacleArray # Game Settings pygame.init() background_colour = (0, 0, 0) (width, height) = (1000, 600) target_location = (800, 300) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Omar's Simulation") screen.fill(backgr...
[ "import pygame\nfrom evolution import Darwin\nfrom Sensor import Robot, obstacleArray\n\n\n# Game Settings\npygame.init()\nbackground_colour = (0, 0, 0)\n(width, height) = (1000, 600)\ntarget_location = (800, 300)\nscreen = pygame.display.set_mode((width, height))\npygame.display.set_caption(\"Omar's Simulation\")\...
false
3,999
fc5b9117ecf56401a888e2b6a5e244f9ab115e41
# Copyright 2018 New Vector Ltd # # 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 agreed to in writin...
[ "# Copyright 2018 New Vector Ltd\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 applicable law or agre...
false