index
int64
0
10k
blob_id
stringlengths
40
40
code
stringlengths
13
1.2M
steps
listlengths
1
578
error
bool
2 classes
0
aff1a9263e183610f403a4d6a7f27b45eacb7ff2
name='valentina ' print(name*1000)
[ "name='valentina '\nprint(name*1000)\n", "name = 'valentina '\nprint(name * 1000)\n", "<assignment token>\nprint(name * 1000)\n", "<assignment token>\n<code token>\n" ]
false
1
eabf06481509962652812af67ad59da5cfe30fae
""" mupub module. """ __all__ = ( '__title__', '__summary__', '__version__', '__author__', '__license__', '__copyright__', ) __title__ = 'mupub' __summary__ = 'Musical score publishing utility for the Mutopia Project' """Versioning: This utility follows a MAJOR . MINOR . EDIT format. Upon a major release, t...
[ "\"\"\" mupub module.\n\"\"\"\n\n__all__ = (\n '__title__', '__summary__', '__version__',\n '__author__', '__license__', '__copyright__',\n)\n\n\n__title__ = 'mupub'\n__summary__ = 'Musical score publishing utility for the Mutopia Project'\n\n\"\"\"Versioning:\nThis utility follows a MAJOR . MINOR . EDIT form...
false
2
54f0ed5f705d5ada28721301f297b2b0058773ad
"""Module for the bot""" from copy import deepcopy from time import sleep import mcpi.minecraft as minecraft from mcpi.vec3 import Vec3 import mcpi.block as block from search import SearchProblem, astar, bfs from singleton import singleton _AIR = block.AIR.id _WATER = block.WATER.id _LAVA = block.LAVA.id _BEDROCK =...
[ "\"\"\"Module for the bot\"\"\"\n\nfrom copy import deepcopy\nfrom time import sleep\n\nimport mcpi.minecraft as minecraft\nfrom mcpi.vec3 import Vec3\nimport mcpi.block as block\n\nfrom search import SearchProblem, astar, bfs\nfrom singleton import singleton\n\n_AIR = block.AIR.id\n_WATER = block.WATER.id\n_LAVA =...
false
3
45969b346d6d5cbdef2f5d2f74270cf12024072d
# Generated by Django 4.1.9 on 2023-06-29 16:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("search", "0003_auto_20230209_1441"), ] operations = [ migrations.CreateModel( name="SearchSettings", fields=[ ...
[ "# Generated by Django 4.1.9 on 2023-06-29 16:11\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n dependencies = [\n (\"search\", \"0003_auto_20230209_1441\"),\n ]\n\n operations = [\n migrations.CreateModel(\n name=\"SearchSettings\",\n ...
false
4
3fbf1768a2fe78df591c49490dfce5fb374e7fc2
from functools import wraps import os def restoring_chdir(fn): #XXX:dc: This would be better off in a neutral module @wraps(fn) def decorator(*args, **kw): try: path = os.getcwd() return fn(*args, **kw) finally: os.chdir(path) return decorator clas...
[ "from functools import wraps\nimport os\n\n\ndef restoring_chdir(fn):\n #XXX:dc: This would be better off in a neutral module\n @wraps(fn)\n def decorator(*args, **kw):\n try:\n path = os.getcwd()\n return fn(*args, **kw)\n finally:\n os.chdir(path)\n retur...
true
5
67b967b688aeac1270eee836e0f6e6b3555b933e
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This program is run at regular intervals to check the battery charge status of the uninterruptible power supply. In our case, it is a LiPo battery with a nominal voltage of 3.7 volts. By setting the voltage for the Raspberry PI shutdown procedure at 3.7 V,we ensure th...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThis program is run at regular intervals to check the battery charge status of the uninterruptible power supply.\nIn our case, it is a LiPo battery with a nominal voltage of 3.7 volts. By setting the voltage for the\nRaspberry PI shutdown procedure at 3.7 ...
false
6
c59707ba07c1659d94684c54cdd7bb2658cba935
from __future__ import division, print_function, absolute_import import numbers import warnings from abc import ABCMeta, abstractmethod import numpy as np from .base import check_frame from skutil.base import overrides from sklearn.externals import six from sklearn.base import _pprint from sklearn.utils.fixes import si...
[ "from __future__ import division, print_function, absolute_import\nimport numbers\nimport warnings\nfrom abc import ABCMeta, abstractmethod\nimport numpy as np\nfrom .base import check_frame\nfrom skutil.base import overrides\nfrom sklearn.externals import six\nfrom sklearn.base import _pprint\nfrom sklearn.utils.f...
false
7
41cfd558824b6561114a48a694b1e6e6a7cb8c05
import streamlit as st from streamlit.components.v1 import components from streamlit.report_thread import get_report_ctx from util.session import * from multipage import MultiPage from pages import register def app(page): if not login_status(): title_container = st.empty() remail_input_container = ...
[ "import streamlit as st\nfrom streamlit.components.v1 import components\nfrom streamlit.report_thread import get_report_ctx\nfrom util.session import *\nfrom multipage import MultiPage\nfrom pages import register\n\ndef app(page):\n if not login_status():\n title_container = st.empty()\n remail_inp...
false
8
f2bb44600f011a205c71985ad94c18f7e058634f
import os import requests from PIL import Image from io import BytesIO import csv from typing import Iterable, List, Tuple, Dict, Callable, Union, Collection # pull the image from the api endpoint and save it if we don't have it, else load it from disk def get_img_from_file_or_url(img_format: str = 'JPEG') -> Callabl...
[ "import os\nimport requests\nfrom PIL import Image\nfrom io import BytesIO\nimport csv\nfrom typing import Iterable, List, Tuple, Dict, Callable, Union, Collection\n\n\n# pull the image from the api endpoint and save it if we don't have it, else load it from disk\ndef get_img_from_file_or_url(img_format: str = 'JPE...
false
9
302605d8bb45b1529742bf9441d476f0276085b9
import sys from PyQt5.QtWidgets import (QMainWindow, QWidget, QHBoxLayout, QVBoxLayout, QFrame, QSplitter, QStyleFactory, QApplication, QPushButton, QTextEdit, QLabel, QFileDialog, QMessageBox) from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QColor import myLoadData from UIPack import setLossParameterDia...
[ "import sys\nfrom PyQt5.QtWidgets import (QMainWindow, QWidget, QHBoxLayout, QVBoxLayout, QFrame,\n QSplitter, QStyleFactory, QApplication, QPushButton, QTextEdit, QLabel, QFileDialog, QMessageBox)\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtGui import QFont, QColor\nimport myLoadData\nfrom UIPack import setLossP...
false
10
5d9c8e235385ff53c7510994826ff3a04e4a5888
""" @file : 001-rnn+lstm+crf.py @author: xiaolu @time : 2019-09-06 """ import re import numpy as np import tensorflow as tf from sklearn.metrics import classification_report class Model: def __init__(self, dim_word, dim_char, dropout, learning_rate, hidden_size_char, hidden_size_word, num_l...
[ "\"\"\"\n\n@file : 001-rnn+lstm+crf.py\n\n@author: xiaolu\n\n@time : 2019-09-06\n\n\"\"\"\nimport re\nimport numpy as np\nimport tensorflow as tf\nfrom sklearn.metrics import classification_report\n\n\nclass Model:\n def __init__(self, dim_word, dim_char, dropout, learning_rate,\n hidden_size_c...
false
11
54e04d740ef46fca04cf4169d2e7c05083414bd8
import random import math import time import pygame pygame.init() scr = pygame.display.set_mode((700,700)) enemies = [] #music = pygame.mixer.music.load('ENERGETIC CHIPTUNE Thermal - Evan King.mp3') #pygame.mixer.music.play(-1) hit = [] class Player: def __init__(self): self.x = 275 sel...
[ "import random\r\nimport math\r\nimport time\r\nimport pygame\r\npygame.init()\r\nscr = pygame.display.set_mode((700,700))\r\nenemies = []\r\n#music = pygame.mixer.music.load('ENERGETIC CHIPTUNE Thermal - Evan King.mp3')\r\n#pygame.mixer.music.play(-1)\r\nhit = []\r\nclass Player:\r\n def __init__(self):\r\n ...
false
12
0a7ffc027511d5fbec0076f6b25a6e3bc3dfdd9b
''' Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Here are few examples. [1,3,5,6], 5 -> 2 [1,3,5,6], 2 -> 1 [1,3,5,6], 7 -> 4 [1,3,5,6], 0 -> 0 ''' class Solution(o...
[ "'''\nGiven a sorted array and a target value, return the index if the target is found.\nIf not, return the index where it would be if it were inserted in order.\n\nYou may assume no duplicates in the array.\n\nHere are few examples.\n[1,3,5,6], 5 -> 2\n[1,3,5,6], 2 -> 1\n[1,3,5,6], 7 -> 4\n[1,3,5,6], 0 -> 0\n'''\n...
true
13
2cbce618d1ec617d1c7dc0e9792b6a49361ec5a4
def mais_populoso(dic): p=0 sp=0 for t,i in dic.items(): for m in dic[t].values(): p+=m if p>sp: sp=p x=t return x
[ "def mais_populoso(dic):\n p=0\n sp=0\n for t,i in dic.items():\n for m in dic[t].values():\n p+=m\n if p>sp:\n sp=p\n x=t\n return x", "def mais_populoso(dic):\n p = 0\n sp = 0\n for t, i in dic.items():\n for m in dic[t].values():\n ...
false
14
2092ead8b8f268a22711b8af8052241c1ac00c15
wage=5 print("%d시간에 %d%s 벌었습니다." %(1, wage*1, "달러")) print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달러")) print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원")) print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))
[ "\nwage=5\n\nprint(\"%d시간에 %d%s 벌었습니다.\" %(1, wage*1, \"달러\"))\nprint(\"%d시간에 %d%s 벌었습니다.\" %(5, wage*5, \"달러\"))\n\nprint(\"%d시간에 %.1f%s 벌었습니다\" %(1,5710.8,\"원\"))\nprint(\"%d시간에 %.1f%s 벌었습니다\" %(5, 28554.0, \"원\"))\n\n", "wage = 5\nprint('%d시간에 %d%s 벌었습니다.' % (1, wage * 1, '달러'))\nprint('%d시간에 %d%s 벌었습니다.' % (5...
false
15
b5cbb73c152dd60e9063d5a19f6182e2264fec6d
#!/usr/bin/python # coding=UTF-8 import sys import subprocess import os def printReportTail(reportHtmlFile): reportHtmlFile.write(""" </body> </html> """) def printReportHead(reportHtmlFile): reportHtmlFile.write("""<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" ...
[ "#!/usr/bin/python\n# coding=UTF-8\n\nimport sys\nimport subprocess\nimport os\n\ndef printReportTail(reportHtmlFile):\n reportHtmlFile.write(\"\"\"\n</body>\n</html>\n\"\"\")\n\ndef printReportHead(reportHtmlFile):\n reportHtmlFile.write(\"\"\"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"...
true
16
805fc9a26650f85227d14da972311ffbd9dbd555
class Date: def __init__(self, strDate): strDate = strDate.split('.') self.day = strDate[0] self.month = strDate[1] self.year = strDate[2]
[ "class Date:\n def __init__(self, strDate):\n strDate = strDate.split('.')\n self.day = strDate[0]\n self.month = strDate[1]\n self.year = strDate[2]\n", "class Date:\n\n def __init__(self, strDate):\n strDate = strDate.split('.')\n self.day = strDate[0]\n se...
false
17
a7218971b831e2cfda9a035eddb350ecf1cdf938
#!/usr/bin/python # encoding: utf-8 # # In case of reuse of this source code please do not remove this copyright. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
[ "#!/usr/bin/python\n# encoding: utf-8\n#\n# In case of reuse of this source code please do not remove this copyright.\n#\n#\tThis program is free software: you can redistribute it and/or modify\n#\tit under the terms of the GNU General Public License as published by\n#\tthe Free Software Foundation, either version...
true
18
038ccba05113fb7f2f589eaa7345df53cb59a5af
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import torch from torch import nn, autograd import config import time import copy import progressbar as pb from dataset import TrainDataSet from model import BiAffineSrlModel from fscore import FScore config.add_option('-m', '--mode', dest='mode', default='train...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\nimport torch\nfrom torch import nn, autograd\nimport config\nimport time\nimport copy\nimport progressbar as pb\nfrom dataset import TrainDataSet\nfrom model import BiAffineSrlModel\nfrom fscore import FScore\n\nconfig.add_option('-m', '--mode', dest='mod...
false
19
b5180a2dbe1f12e1bbc92874c67ea99c9a84a9ed
# print all cards with even numbers. cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"] for card in cards: try: number = int(card) if number % 2 == 0: # modulo operator print(card, "is an even card.") except ValueError: print (card, "can not be divi...
[ "\n# print all cards with even numbers.\n\ncards = [\"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"J\", \"Q\", \"K\", \"A\"]\n\nfor card in cards:\n try:\n number = int(card)\n if number % 2 == 0: # modulo operator\n print(card, \"is an even card.\")\n except ValueE...
false
20
a045423edd94d985dfc9660bcfe4a88c61bf4574
#Script start print"This is the two number subtraction python program." a = 9 b = 2 c = a - b print c # Scrip close
[ "#Script start\nprint\"This is the two number subtraction python program.\"\na = 9\nb = 2\nc = a - b\nprint c\n\n# Scrip close\n" ]
true
21
13c9f0f58ec6da317c3802f594bb0db7c275dee9
''' !pip install wget from zipfile import ZipFile import wget print('Beginning file downlaod with wget module') url = 'https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip' wget.download(url, 'sample_data/') print('2. Extract all files in ZIP to different dir...
[ "'''\n!pip install wget\nfrom zipfile import ZipFile\nimport wget\nprint('Beginning file downlaod with wget module')\n\nurl = 'https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip'\nwget.download(url, 'sample_data/')\n\n\nprint('2. Extract all files in ZIP t...
false
22
95c5971a102fb2ed84ab0de0471278d0167d8359
#!/usr/bin/python3 """1. Divide a matrix """ def matrix_divided(matrix, div): """Divides a Matrix Args: matrix: A list of lists of ints or floats div: a non zero int or float Exceptions: TypeError: if the matrix and/or div is not as stated or the matrix elements are not of the...
[ "#!/usr/bin/python3\n\"\"\"1. Divide a matrix \"\"\"\n\n\ndef matrix_divided(matrix, div):\n \"\"\"Divides a Matrix\n\n Args:\n matrix: A list of lists of ints or floats\n div: a non zero int or float\n\n Exceptions:\n TypeError: if the matrix and/or div is not as stated or the matrix elements\n ...
false
23
5fb998fa761b989c6dd423634824197bade4f8a5
""" You can perform the following operations on the string, : Capitalize zero or more of 's lowercase letters. Delete all of the remaining lowercase letters in . Given two strings, and , determine if it's possible to make equal to as described. If so, print YES on a new line. Otherwise, print NO. For example, give...
[ "\"\"\"\nYou can perform the following operations on the string, :\n\nCapitalize zero or more of 's lowercase letters.\nDelete all of the remaining lowercase letters in .\nGiven two strings, and , determine if it's possible to make equal to as described. If so, print YES on a new line. Otherwise, print NO.\n\nFo...
false
24
5ed439a2a7cfb9c941c40ea0c5eba2851a0f2855
#!/bin/python3 # Implement a stack with push, pop, inc(e, k) operations # inc (e,k) - Add k to each of bottom e elements import sys class Stack(object): def __init__(self): self.arr = [] def push(self, val): self.arr.append(val) def pop(self): if len(self.arr): return...
[ "#!/bin/python3\n\n# Implement a stack with push, pop, inc(e, k) operations\n# inc (e,k) - Add k to each of bottom e elements\nimport sys\n\nclass Stack(object):\n def __init__(self):\n self.arr = []\n\n def push(self, val):\n self.arr.append(val)\n\n def pop(self):\n if len(self.arr):...
false
25
39f9341313e29a22ec5e05ce9371bf65e89c91bd
""" 리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라. [12, 17, 19, 17, 23] = 17 [26, 37, 26, 37, 91] = 26, 37 [28, 30, 32, 34, 144] = 없다 최빈값 : 자료의 값 중에서 가장 많이 나타난 값 ① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다. ② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다. """ n_list = [[12, 17, 19, 17, 23], [26, 37, 26, 37, 91], [28,...
[ "\"\"\"\n리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라.\n\n[12, 17, 19, 17, 23] = 17\n[26, 37, 26, 37, 91] = 26, 37\n[28, 30, 32, 34, 144] = 없다\n\n최빈값 : 자료의 값 중에서 가장 많이 나타난 값 \n① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다.\n② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다.\n\"\"\"\n\nn_list = [[12, 17, 19, 17, 23],\n [26, 37, 26...
false
26
312cc666c88fcd22882c49598db8c5e18bd3dae1
from setuptools import setup, find_packages from setuptools.extension import Extension from sys import platform cython = True try: from Cython.Build import cythonize cython = True except ImportError: cython = False # Define the C++ extension if platform == "darwin": extra_compile_args = ['-O3', '-pthread',...
[ "from setuptools import setup, find_packages\nfrom setuptools.extension import Extension\nfrom sys import platform\n\ncython = True\n\ntry:\n from Cython.Build import cythonize\n cython = True\nexcept ImportError:\n cython = False\n\n# Define the C++ extension\nif platform == \"darwin\":\n extra_compile_args ...
false
27
2aec0581413d4fb0ffb4090231fde0fed974bf18
import numpy as np import random with open("./roc.txt", "r") as fin: with open("./roc_shuffle.txt", "w") as fout: tmp = [] for k, line in enumerate(fin): i = k + 1 if i % 6 == 0: idx = [0] + np.random.permutation(range(1,5)).tolist() for sen i...
[ "import numpy as np\nimport random\n\nwith open(\"./roc.txt\", \"r\") as fin:\n with open(\"./roc_shuffle.txt\", \"w\") as fout:\n tmp = []\n for k, line in enumerate(fin):\n i = k + 1\n if i % 6 == 0:\n idx = [0] + np.random.permutation(range(1,5)).tolist()\n ...
false
28
4f13e2858d9cf469f14026808142886e5c3fcc85
class Solution: def merge(self, nums1, m, nums2, n): """ Do not return anything, modify nums1 in-place instead. """ if n == 0: nums1 = nums1 if nums1[m-1] <= nums2[0]: for i in range(n): nums1[m+i] = nums2[i] ...
[ "class Solution:\n def merge(self, nums1, m, nums2, n):\n \"\"\"\n Do not return anything, modify nums1 in-place instead.\n \"\"\"\n \n if n == 0:\n nums1 = nums1\n if nums1[m-1] <= nums2[0]:\n \n for i in range(n):\n nums1...
false
29
57967f36a45bb3ea62708bbbb5b2f4ddb0f4bb16
# -*- coding:ascii -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 10 _modified_time = 1428612037.145222 _enable_loop = True _template_filename = 'C:\\Users\\Cody\\Desktop\\Heritage\\chf\\templates/account.rentalcart.html' _t...
[ "# -*- coding:ascii -*-\nfrom mako import runtime, filters, cache\nUNDEFINED = runtime.UNDEFINED\n__M_dict_builtin = dict\n__M_locals_builtin = locals\n_magic_number = 10\n_modified_time = 1428612037.145222\n_enable_loop = True\n_template_filename = 'C:\\\\Users\\\\Cody\\\\Desktop\\\\Heritage\\\\chf\\\\templates/ac...
false
30
5771f49ad5254588f1683a8d45aa81ce472bb562
def prime_sieve(n): if n==2: return [2] elif n<2: return [] s=range(3,n+1,2) mroot = n ** 0.5 half=(n+1)/2-1 i=0 m=3 while m <= mroot: if s[i]: j=(m*m-3)/2 s[j]=0 while j<half: s[j]=0 j+=m i=i+1 m=2*i+3 return [2]+[x for x in s if x] ps = prime_sieve(1000000) def get_primes_upto(n): ...
[ "\ndef prime_sieve(n): \n\tif n==2: return [2]\n\telif n<2: return []\n\ts=range(3,n+1,2)\n\tmroot = n ** 0.5\n\thalf=(n+1)/2-1\n\ti=0\n\tm=3\n\twhile m <= mroot:\n\t\tif s[i]:\n\t\t\tj=(m*m-3)/2\n\t\t\ts[j]=0\n\t\t\twhile j<half:\n\t\t\t\ts[j]=0\n\t\t\t\tj+=m\n\t\ti=i+1\n\t\tm=2*i+3\n\treturn [2]+[x for x in s if ...
true
31
44d87f112ab60a202e4c8d64d7aec6f4f0d10578
# coding: utf-8 import os import factory import datetime from journalmanager import models from django.contrib.auth.models import Group from django.core.files.base import File _HERE = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(_HERE, 'xml_samples', '0034-8910-rsp-48-2-0216.xml')) as xml_fil...
[ "# coding: utf-8\nimport os\n\nimport factory\nimport datetime\n\nfrom journalmanager import models\nfrom django.contrib.auth.models import Group\nfrom django.core.files.base import File\n\n\n_HERE = os.path.dirname(os.path.abspath(__file__))\n\n\nwith open(os.path.join(_HERE, 'xml_samples', '0034-8910-rsp-48-2-021...
false
32
81dfdf0479fc1f136fa5153840d8c7015f9db676
# required !!! # pip install selenium # pip install webdriver-manager from theMachine import loops # fill the number and message # you can fill the number with array phoneNumber = "fill the number" message = "fill with ur message" loop = 1 # this how many u want to loop loops(loop, phoneNumber, message)...
[ "# required !!!\r\n# pip install selenium\r\n# pip install webdriver-manager\r\n\r\nfrom theMachine import loops\r\n\r\n# fill the number and message\r\n# you can fill the number with array\r\nphoneNumber = \"fill the number\"\r\nmessage = \"fill with ur message\"\r\nloop = 1 # this how many u want to loop\r\n\r\n...
false
33
24de4f486d4e976850e94a003f8d9cbe3e518402
a= input("Enter number") a= a.split() b=[] for x in a: b.append(int(x)) print(b) l=len(b) c=0 s=0 for i in range(l): s=len(b[:i]) for j in range(s): if b[s]<b[j]: c=b[s] b.pop(s) b.insert(b.index(b[j]),c) print(b,b[:i],b[s])
[ "a= input(\"Enter number\")\r\na= a.split()\r\nb=[]\r\nfor x in a:\r\n b.append(int(x)) \r\n\r\nprint(b)\r\nl=len(b)\r\nc=0\r\ns=0\r\nfor i in range(l):\r\n s=len(b[:i])\r\n for j in range(s):\r\n \r\n if b[s]<b[j]:\r\n c=b[s]\r\n b.pop(s)\r\n b.insert(b.index(...
false
34
0ecd2a298203365b20b2369a99c3c1d7c0646f19
# coding: utf-8 #ack program with the ackermann_function """ ackermann_function """ def ack(m,n): #n+1 if m = 0 if m is 0: return n + 1 #A(m−1, 1) if m > 0 and n = 0 if m > 0 and n is 0: return ack(m-1, 1) #A(m−1, A(m, n−1)) if m > 0 and n > 0 if m > 0 and n > 0: re...
[ "# coding: utf-8\n#ack program with the ackermann_function\n\n\"\"\" ackermann_function \"\"\"\ndef ack(m,n):\n #n+1 if m = 0\n if m is 0:\n \treturn n + 1\n #A(m−1, 1) if m > 0 and n = 0 \n if m > 0 and n is 0:\n \treturn ack(m-1, 1)\n #A(m−1, A(m, n−1)) if m > 0 and n > 0\n if...
true
35
a98be930058269a6adbc9a28d1c0ad5d9abba136
import sys import time import pymorphy2 import pyglet import pyttsx3 import threading import warnings import pytils warnings.filterwarnings("ignore") """ Количество раундов, вдохов в раунде, задержка дыхания на вдохе""" rounds, breaths, hold = 4, 30, 13 def play_wav(src): wav = pyglet.media.load(sys.path[0] + '...
[ "import sys\nimport time\nimport pymorphy2\nimport pyglet\nimport pyttsx3\nimport threading\nimport warnings\nimport pytils\n\nwarnings.filterwarnings(\"ignore\")\n\n\"\"\" Количество раундов, вдохов в раунде, задержка дыхания на вдохе\"\"\"\nrounds, breaths, hold = 4, 30, 13\n\n\ndef play_wav(src):\n wav = pygl...
false
36
4f0933c58aa1d41faf4f949d9684c04f9e01b473
from os.path import exists from_file = input('form_file') to_file = input('to_file') print(f"copying from {from_file} to {to_file}") indata = open(from_file).read()#这种方式读取文件后无需close print(f"the input file is {len(indata)} bytes long") print(f"does the output file exist? {exists(to_file)}") print("return to continue,...
[ "from os.path import exists\n\nfrom_file = input('form_file')\nto_file = input('to_file')\n\nprint(f\"copying from {from_file} to {to_file}\")\nindata = open(from_file).read()#这种方式读取文件后无需close\nprint(f\"the input file is {len(indata)} bytes long\")\n\nprint(f\"does the output file exist? {exists(to_file)}\")\nprint...
false
37
5c81ddbc8f5a162949a100dbef1c69551d9e267a
# -*- coding: utf-8 -*- from django.test import TestCase from django.contrib.auth.models import User from ..models import Todo class MyTestCase(TestCase): def test_mark_done(self): user = User.objects.create_user(email='user@…', username='user', password='somepasswd') todo = Todo(title='SomeTitl...
[ "# -*- coding: utf-8 -*-\n\nfrom django.test import TestCase\nfrom django.contrib.auth.models import User\nfrom ..models import Todo\n\n\nclass MyTestCase(TestCase):\n\n def test_mark_done(self):\n user = User.objects.create_user(email='user@…', username='user', password='somepasswd')\n todo = Todo...
false
38
509129052f97bb32b4ba0e71ecd7b1061d5f8da2
print (180 / 4)
[ "print (180 / 4)", "print(180 / 4)\n", "<code token>\n" ]
false
39
2c90c4e0b42a75d6d387b9b2d0118d8e991b5a08
import math import decimal from typing import Union, List, Set from sqlalchemy import text from .model import BaseMixin from ..core.db import db Orders = List[Set(str, Union(str, int, decimal.Decimal))] class BaseDBMgr: def get_page(self, cls_:BaseMixin, filters:set, orders:Orders=list(), field:tuple=(), pag...
[ "import math\nimport decimal\nfrom typing import Union, List, Set\n\nfrom sqlalchemy import text\n\nfrom .model import BaseMixin\nfrom ..core.db import db\n\n\nOrders = List[Set(str, Union(str, int, decimal.Decimal))]\n\n\nclass BaseDBMgr:\n\n def get_page(self, cls_:BaseMixin, filters:set, orders:Orders=list(),...
false
40
cb2e800cc2802031847b170a462778e5c0b3c6f9
from math import * from numpy import * from random import * import numpy as np import matplotlib.pyplot as plt from colorama import Fore, Back, Style from gridworld import q_to_arrow N_ROWS = 6 N_COLUMNS = 10 class State(object): def __init__(self, i, j, is_cliff=False, is_goal=False): self.i = i ...
[ "from math import *\nfrom numpy import *\nfrom random import *\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom colorama import Fore, Back, Style\nfrom gridworld import q_to_arrow\n\n\nN_ROWS = 6\nN_COLUMNS = 10\n\nclass State(object):\n def __init__(self, i, j, is_cliff=False, is_goal=False):\n ...
false
41
52da8608e43b2d8dfe00f0956a1187fcf2e7b1ff
# Generated by Django 2.2.6 on 2020-05-21 09:44 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('DHOPD', '0015_auto_20200515_0126'), ] operations = [ migrations.CreateModel( name='Patient_c', field...
[ "# Generated by Django 2.2.6 on 2020-05-21 09:44\n\nimport datetime\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('DHOPD', '0015_auto_20200515_0126'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='Patient_c'...
false
42
1084478226777b9259274e053984ac34d461198d
from .ast import * # noinspection PyPep8Naming def addToClass(cls): def decorator(func): setattr(cls, func.__name__, func) return func return decorator def print_intended(to_print, intend): print(intend * "| " + to_print) # noinspection PyPep8Naming,PyUnresolvedReferences class TreeP...
[ "from .ast import *\n\n\n# noinspection PyPep8Naming\ndef addToClass(cls):\n def decorator(func):\n setattr(cls, func.__name__, func)\n return func\n\n return decorator\n\n\ndef print_intended(to_print, intend):\n print(intend * \"| \" + to_print)\n\n\n# noinspection PyPep8Naming,PyUnresolve...
false
43
999de0965efa3c1fe021142a105dcf28184cd5ba
import dnf_converter def parse(query): print("parsing the query...") query = dnf_converter.convert(query) cp_clause_list = [] clause_list = [] for cp in query["$or"]: clauses = [] if "$and" in cp: for clause in cp["$and"]: clauses.append(clause) clause_list.append(clause) else: clause = cp ...
[ "import dnf_converter\n\ndef parse(query):\n\tprint(\"parsing the query...\")\n\tquery = dnf_converter.convert(query)\n\tcp_clause_list = []\n\tclause_list = []\n\tfor cp in query[\"$or\"]:\n\t\tclauses = []\n\t\tif \"$and\" in cp:\n\t\t\tfor clause in cp[\"$and\"]:\n\t\t\t\tclauses.append(clause)\n\t\t\t\tclause_l...
false
44
cb08f64d1ad7e53f1041684d4ca4ef65036c138d
import json import re from bs4 import BeautifulSoup from bs4.element import NavigableString, Tag from common import dir_path def is_element(el, tag): return isinstance(el, Tag) and el.name == tag class ElemIterator(): def __init__(self, els): self.els = els self.i = 0 def peek(self): try: ...
[ "import json\nimport re\nfrom bs4 import BeautifulSoup\nfrom bs4.element import NavigableString, Tag\n\nfrom common import dir_path\n\n\ndef is_element(el, tag):\n return isinstance(el, Tag) and el.name == tag\n\n\nclass ElemIterator():\n def __init__(self, els):\n self.els = els\n self.i = 0\n\n def peek(...
false
45
5082182af5a08970568dc1ab7a53ee5337260687
# # romaO # www.fabiocrameri.ch/colourmaps from matplotlib.colors import LinearSegmentedColormap cm_data = [[0.45137, 0.22346, 0.34187], [0.45418, 0.22244, 0.3361], [0.45696, 0.22158, 0.33043], [0.45975, 0.2209, 0.32483], ...
[ "# \n# romaO\n# www.fabiocrameri.ch/colourmaps\nfrom matplotlib.colors import LinearSegmentedColormap \n \ncm_data = [[0.45137, 0.22346, 0.34187], \n [0.45418, 0.22244, 0.3361], \n [0.45696, 0.22158, 0.33043], \n [0.45975, 0.2209, 0.32...
false
46
3dd4b4d4241e588cf44230891f496bafb30c6153
import requests import json import pandas as pd n1 = 'ADS' api_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1 df = pd.read_csv(api_url) df = df.head(100) print(df.head()) #print(list(data))
[ "\n\nimport requests\nimport json\nimport pandas as pd\nn1 = 'ADS'\napi_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1\ndf = pd.read_csv(api_url)\ndf = df.head(100)\nprint(df.head())\n#print(list(data))\n", "import requests\nimport json\nimport pandas as pd\nn1 = 'ADS'\napi_url = 'https://www.qua...
false
47
a558b42106b036719fe38ee6efd1c5b933290f52
#!/usr/local/bin/python # -*- coding: utf-8 -*- from sqlalchemy import select, update from sqlalchemy import Table, Column, String, Integer, Float, Boolean, Date, BigInteger from sqlalchemy import create_engine, MetaData import API_and_Database_function as func import pandas as pd import re connection, Twitter_Senti...
[ "#!/usr/local/bin/python\n# -*- coding: utf-8 -*-\n\nfrom sqlalchemy import select, update\nfrom sqlalchemy import Table, Column, String, Integer, Float, Boolean, Date, BigInteger\nfrom sqlalchemy import create_engine, MetaData\nimport API_and_Database_function as func\nimport pandas as pd\nimport re\n\n\nconnectio...
false
48
10d35ba3c04d9cd09e152c575e74b0382ff60572
from pydispatch import dispatcher import time import serial import threading from queue import Queue PORT='/dev/ttys005' #PORT='/dev/tty.usbmodem1461' SPEED=4800.0 class GcodeSender(object): PEN_LIFT_PULSE = 1500 PEN_DROP_PULSE = 800 def __init__(self, **kwargs): super(GcodeSender, self).__init_...
[ "from pydispatch import dispatcher\nimport time\nimport serial\nimport threading\nfrom queue import Queue\n\nPORT='/dev/ttys005'\n#PORT='/dev/tty.usbmodem1461'\nSPEED=4800.0\n\nclass GcodeSender(object):\n\n PEN_LIFT_PULSE = 1500\n PEN_DROP_PULSE = 800\n\n def __init__(self, **kwargs):\n super(Gcode...
false
49
c105f06e302740e9b7be100df905852bb5610a2c
import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import numpy as np import struct import wave scale = 0.01 wav = wave.open('output.wav', 'r') print 'channels %d'%wav.getnchannels() print 'smpl width %d'%wav.getsampwidth() print 'frame rate %f'%wav.getframerate() nframes = wav.getnframes() pri...
[ "import matplotlib\nmatplotlib.use('TkAgg')\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport struct\nimport wave\n\nscale = 0.01\nwav = wave.open('output.wav', 'r')\n\nprint 'channels %d'%wav.getnchannels()\nprint 'smpl width %d'%wav.getsampwidth()\nprint 'frame rate %f'%wav.getframerate()\nnframes = wa...
true
50
e1d0648825695584d3ea518db961a9178ea0c66a
import requests import sxtwl import datetime from datetime import date import lxml from lxml import etree # 日历中文索引 ymc = [u"十一", u"十二", u"正", u"二", u"三", u"四", u"五", u"六", u"七", u"八", u"九", u"十"] rmc = [u"初一", u"初二", u"初三", u"初四", u"初五", u"初六", u"初七", u"初八", u"初九", u"初十", \ u"十一", u"十二", u"十三", u"十四", u"十五", u"十...
[ "import requests\nimport sxtwl\nimport datetime\nfrom datetime import date\nimport lxml\nfrom lxml import etree\n# 日历中文索引\nymc = [u\"十一\", u\"十二\", u\"正\", u\"二\", u\"三\", u\"四\", u\"五\", u\"六\", u\"七\", u\"八\", u\"九\", u\"十\"]\nrmc = [u\"初一\", u\"初二\", u\"初三\", u\"初四\", u\"初五\", u\"初六\", u\"初七\", u\"初八\", u\"初九\",...
false
51
2c39660da8fe839c4634cd73ce069acc7b1b29b4
import time # Decorator def measure_time_of_func(func): def wrapper_func(n): start_time = time.time() fib_seq = func(n) end_time = time.time() return (fib_seq, end_time - start_time) return wrapper_func # Returns a list with first n numbers of fibonacci sequence. @measure_ti...
[ "import time\n\n\n# Decorator\ndef measure_time_of_func(func):\n def wrapper_func(n):\n start_time = time.time()\n fib_seq = func(n)\n end_time = time.time()\n return (fib_seq, end_time - start_time)\n\n return wrapper_func\n\n\n# Returns a list with first n numbers of fibonacci se...
false
52
c87e6f8780bf8d9097f200c7f2f0faf55beb480c
# 1 def transform_data(fn): print(fn(10)) # 2 transform_data(lambda data: data / 5) # 3 def transform_data2(fn, *args): for arg in args: print(fn(arg)) transform_data2(lambda data: data / 5, 10, 15, 22, 30) # 4 def transform_data2(fn, *args): for arg in args: print('Resu...
[ "# 1\r\ndef transform_data(fn):\r\n print(fn(10))\r\n\r\n# 2\r\ntransform_data(lambda data: data / 5)\r\n\r\n# 3\r\ndef transform_data2(fn, *args):\r\n for arg in args:\r\n print(fn(arg))\r\n\r\ntransform_data2(lambda data: data / 5, 10, 15, 22, 30)\r\n\r\n# 4\r\ndef transform_data2(fn, *args):\r\n ...
false
53
f4f08015b7638f4d6ea793350d5d19a3485978cd
"""Plot the output data. """ # Standard library import os import json import math import matplotlib as maplot import matplotlib.pyplot as pyplot from datetime import datetime # User library from sub.inputprocess import CONSTANTS as CONS # **json.loads(json_data) def get_data(): """Read output file to get data."...
[ "\"\"\"Plot the output data.\n\"\"\"\n\n# Standard library\nimport os\nimport json\nimport math\nimport matplotlib as maplot\nimport matplotlib.pyplot as pyplot\nfrom datetime import datetime\n\n# User library\nfrom sub.inputprocess import CONSTANTS as CONS\n\n\n# **json.loads(json_data)\ndef get_data():\n \"\"\...
false
54
d2a153fffccd4b681eebce823e641e195197cde7
""" Created on 02.09.2013 @author: Paul Schweizer @email: paulschweizer@gmx.net @brief: Holds all the namingconventions for pandora's box """ import os import json class NamingConvention(): """Imports naming conventions from the respective .json file and puts them into class variables. """ def __init...
[ "\"\"\"\nCreated on 02.09.2013\n@author: Paul Schweizer\n@email: paulschweizer@gmx.net\n@brief: Holds all the namingconventions for pandora's box\n\"\"\"\n\nimport os\nimport json\n\n\nclass NamingConvention():\n \"\"\"Imports naming conventions from the respective .json file and puts them\n into class variab...
false
55
aff1d702e591efcfc0fc93150a3fbec532408137
from rest_framework import serializers, viewsets, routers from lamp_control.models import Lamp class LampSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Lamp fields = '__all__' class LampViewSet(viewsets.ModelViewSet): serializer_class = LampSerializer queryset ...
[ "from rest_framework import serializers, viewsets, routers\n\nfrom lamp_control.models import Lamp\n\n\nclass LampSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Lamp\n fields = '__all__'\n\n\nclass LampViewSet(viewsets.ModelViewSet):\n serializer_class = LampSeriali...
false
56
c6502ea2b32ad90c76b6dfaf3ee3218d029eba15
class NlpUtility(): """ Utility methods to get particular parts of speech from a token set """ def get_nouns(self, tokens): nouns = [] for word, pos in tokens: if pos == "NN": nouns.push(word) def get_verbs(self, tokens): verbs = [] for word, pos in tokens: if pos == "VB": nouns.push(word) ...
[ "class NlpUtility():\n\t\"\"\"\n\t\tUtility methods to get particular parts of speech from a token set\n\t\"\"\"\n\tdef get_nouns(self, tokens):\n\t\tnouns = []\n\t\tfor word, pos in tokens:\n\t\t\tif pos == \"NN\":\n\t\t\t\tnouns.push(word)\n\n\tdef get_verbs(self, tokens):\n\t\tverbs = []\n\t\tfor word, pos in to...
false
57
675fbdfd519d00ab10bf613e8abb7338e484fe65
import logging formatter = logging.Formatter("%(asctime)s [%(levelname)s] : %(message)s") log = logging.getLogger("othello") log.setLevel(logging.DEBUG) stream_hander = logging.StreamHandler() stream_hander.setFormatter(formatter) log.addHandler(stream_hander)
[ "import logging\n\n\nformatter = logging.Formatter(\"%(asctime)s [%(levelname)s] : %(message)s\")\n\nlog = logging.getLogger(\"othello\")\nlog.setLevel(logging.DEBUG)\n\nstream_hander = logging.StreamHandler()\nstream_hander.setFormatter(formatter)\nlog.addHandler(stream_hander)\n\n", "import logging\nformatter ...
false
58
d7b45e76f150107cd62be160e8938f17dad90623
import pandas as pd from sqlalchemy import create_engine # file = 'testfile.csv' # print(pd.read_csv(file, nrows=5)) with open('testfile_short1.csv', 'r') as original: data = original.read() for i in range(2): with open('testfile_short3.csv', 'a') as modified: modified.write(data)
[ "import pandas as pd\nfrom sqlalchemy import create_engine\n# file = 'testfile.csv'\n\n# print(pd.read_csv(file, nrows=5))\n\nwith open('testfile_short1.csv', 'r') as original: data = original.read()\nfor i in range(2):\n with open('testfile_short3.csv', 'a') as modified: modified.write(data)", "import pandas ...
false
59
61454a3d6b5b17bff871ededc6ddfe8384043884
from pythongame.core.buff_effects import get_buff_effect, register_buff_effect, StatModifyingBuffEffect from pythongame.core.common import ItemType, Sprite, BuffType, Millis, HeroStat from pythongame.core.game_data import UiIconSprite, register_buff_text from pythongame.core.game_state import Event, PlayerDamagedEnemy,...
[ "from pythongame.core.buff_effects import get_buff_effect, register_buff_effect, StatModifyingBuffEffect\nfrom pythongame.core.common import ItemType, Sprite, BuffType, Millis, HeroStat\nfrom pythongame.core.game_data import UiIconSprite, register_buff_text\nfrom pythongame.core.game_state import Event, PlayerDamag...
false
60
4c60fd123f591bf2a88ca0affe14a3c3ec0d3cf6
from pyspark import SparkContext from pyspark.sql import SQLContext from pyspark.sql.types import * sc = SparkContext("local", "weblog app") effective_care = sc.textFile('file:///data/exercise1/effective_care').map(lambda l:l.encode().split(',')).map(lambda x: (x[0], x[1:])) procedure_care = effective_care.map(lambda ...
[ "from pyspark import SparkContext\nfrom pyspark.sql import SQLContext\nfrom pyspark.sql.types import *\nsc = SparkContext(\"local\", \"weblog app\")\n\neffective_care = sc.textFile('file:///data/exercise1/effective_care').map(lambda l:l.encode().split(',')).map(lambda x: (x[0], x[1:]))\nprocedure_care = effective_c...
false
61
4264cba9a6c39219d21bd21d4b21009bacd1db38
#!/usr/bin/python import operator import cgi, sys, LINK_HEADERS import simplejson as json from datetime import datetime from dateutil import tz from decimal import * sys.path.insert(0, str(LINK_HEADERS.DAO_LINK)) from transaction_dao import Transaction_dao from user_portfolio_dao import User_portfolio_dao from user_st...
[ "#!/usr/bin/python\n\nimport operator\nimport cgi, sys, LINK_HEADERS\nimport simplejson as json\nfrom datetime import datetime\nfrom dateutil import tz\nfrom decimal import *\nsys.path.insert(0, str(LINK_HEADERS.DAO_LINK))\nfrom transaction_dao import Transaction_dao\nfrom user_portfolio_dao import User_portfolio_d...
true
62
5c30b0e952ddf2e05a7ad5f8d9bbd4f5e22f887d
# strspn(str1,str2) str1 = '12345678' str2 = '456' # str1 and chars both in str1 and str2 print(str1 and str2) str1 = 'cekjgdklab' str2 = 'gka' nPos = -1 for c in str1: if c in str2: nPos = str1.index(c) break print(nPos)
[ "# strspn(str1,str2)\nstr1 = '12345678'\nstr2 = '456'\n# str1 and chars both in str1 and str2\nprint(str1 and str2)\n\nstr1 = 'cekjgdklab'\nstr2 = 'gka'\nnPos = -1\nfor c in str1:\n if c in str2:\n nPos = str1.index(c)\n break\nprint(nPos)\n", "str1 = '12345678'\nstr2 = '456'\nprint(str1 and str2...
false
63
a86b64ccd0dab4ab70ca9c2b7625fb34afec3794
from django.contrib import admin from django_summernote.admin import SummernoteModelAdmin from .models import ArticlePost # Register your models here. class SomeModelAdmin(SummernoteModelAdmin): # instead of ModelAdmin summernote_fields = '__all__' admin.site.register(ArticlePost, SummernoteModelAdmin)
[ "from django.contrib import admin\nfrom django_summernote.admin import SummernoteModelAdmin\nfrom .models import ArticlePost\n# Register your models here.\n\nclass SomeModelAdmin(SummernoteModelAdmin): # instead of ModelAdmin\n summernote_fields = '__all__'\n\nadmin.site.register(ArticlePost, SummernoteMode...
false
64
f17d33f1d035da42dc9a2b4c0c60beefc6a48dea
import functools import shutil import tempfile import unittest import unittest.mock from pathlib import Path import numpy as np import pandas as pd import one.alf.io as alfio from ibllib.io.extractors import training_trials, biased_trials, camera from ibllib.io import raw_data_loaders as raw from ibllib.io.extractors...
[ "import functools\nimport shutil\nimport tempfile\nimport unittest\nimport unittest.mock\nfrom pathlib import Path\n\nimport numpy as np\nimport pandas as pd\n\nimport one.alf.io as alfio\nfrom ibllib.io.extractors import training_trials, biased_trials, camera\nfrom ibllib.io import raw_data_loaders as raw\nfrom ib...
false
65
767c0e6d956701fcedddb153b6c47f404dec535a
import boto3 class NetworkLookup: def __init__(self): self.loaded = 0 self.subnets = {} self.vpcs = {} def load(self): if self.loaded: return client = boto3.client('ec2') # load subnets subnets_r = client.describe_subnets() subnets_...
[ "import boto3\n\nclass NetworkLookup:\n\n def __init__(self):\n self.loaded = 0\n self.subnets = {}\n self.vpcs = {}\n\n def load(self):\n if self.loaded:\n return\n\n client = boto3.client('ec2')\n # load subnets\n subnets_r = client.describe_subnet...
false
66
efcbe296ea72a94be967124a8ba8c84a524e2eb1
__author__ = 'AChen' from rec_linked_list import * def filter_pos_rec(lst): """ @type lst: LinkedListRec >>> lst = LinkedListRec([3, -10, 4, 0]) >>> pos = filter_pos_rec(lst) >>> str(pos) '3 -> 4' """ if lst.is_empty(): return lst else: pos_rec = LinkedListRec([]) ...
[ "__author__ = 'AChen'\n\nfrom rec_linked_list import *\n\ndef filter_pos_rec(lst):\n \"\"\"\n @type lst: LinkedListRec\n >>> lst = LinkedListRec([3, -10, 4, 0])\n >>> pos = filter_pos_rec(lst)\n >>> str(pos)\n '3 -> 4'\n\n \"\"\"\n if lst.is_empty():\n return lst\n else:\n p...
false
67
4789546128263bd298f8f5827734f8402747b9ac
from enum import Enum from roll.input import Input from roll.network import Server, Client from assets.game_projects.fighter.src.game_properties import GameProperties from assets.game_projects.fighter.src.network_message import NetworkMessage class InputBuffer: """ Responsible for collecting game input from...
[ "from enum import Enum\n\nfrom roll.input import Input\nfrom roll.network import Server, Client\n\nfrom assets.game_projects.fighter.src.game_properties import GameProperties\nfrom assets.game_projects.fighter.src.network_message import NetworkMessage\n\n\nclass InputBuffer:\n \"\"\"\n Responsible for collect...
false
68
b693cc63e2ee4c994ef7b5e44faea99f15a021f6
import torch import torch.multiprocessing as mp import random class QManeger(object): def __init__(self, opt, q_trace, q_batch): self.traces_s = [] self.traces_a = [] self.traces_r = [] self.lock = mp.Lock() self.q_trace = q_trace self.q_batch = q_batch sel...
[ "import torch\nimport torch.multiprocessing as mp\nimport random\n\nclass QManeger(object):\n\n def __init__(self, opt, q_trace, q_batch):\n self.traces_s = []\n self.traces_a = []\n self.traces_r = []\n self.lock = mp.Lock()\n\n self.q_trace = q_trace\n self.q_batch = q...
false
69
3c0beb7be29953ca2d7b390627305f4541b56efa
import sys sys.path.append("../circos_report/cnv_anno2conf") from cnv_anno2conf import main_cnv tarfile = {"yaml": "data/test_app.yaml"} def test_main_cnv(): main_cnv(tarfile) if __name__ == "__main__": test_main_cnv()
[ "import sys\nsys.path.append(\"../circos_report/cnv_anno2conf\")\nfrom cnv_anno2conf import main_cnv\n\n\ntarfile = {\"yaml\": \"data/test_app.yaml\"}\n\ndef test_main_cnv():\n main_cnv(tarfile)\n\nif __name__ == \"__main__\":\n test_main_cnv()\n\n", "import sys\nsys.path.append('../circos_report/cnv_anno2c...
false
70
8d0fcf0bf5effec9aa04e7cd56b4b7098c6713cb
for i in range(-10,0): print(i,end=" ")
[ "for i in range(-10,0):\n print(i,end=\" \")", "for i in range(-10, 0):\n print(i, end=' ')\n", "<code token>\n" ]
false
71
a14114f9bb677601e6d75a72b84ec128fc9bbe61
from django.contrib import admin from django.urls import path, include, re_path from django.conf.urls import include # from rest_framework import routers from rest_framework.authtoken import views # from adventure.api import PlayerViewSet, RoomViewSet # from adventure.api import move # router = routers.DefaultRoute...
[ "from django.contrib import admin\nfrom django.urls import path, include, re_path\nfrom django.conf.urls import include\n# from rest_framework import routers\nfrom rest_framework.authtoken import views\n# from adventure.api import PlayerViewSet, RoomViewSet\n\n\n\n# from adventure.api import move\n\n# router = rout...
false
72
edb206a8cd5bc48e831142d5632fd7eb90abd209
import tensorflow as tf optimizer = tf.train.GradientDescentOptimizer(0.001).minimize(loss) _, l = sess.run([optimizer, loss], feed_dict={X:x, Y:y}) Session looks at all trainable variables that loss depends on and update them tf.Variable(initializer=None, trainable=True, collections=None, validate_shape=True, caching...
[ "import tensorflow as tf\noptimizer = tf.train.GradientDescentOptimizer(0.001).minimize(loss)\n_, l = sess.run([optimizer, loss], feed_dict={X:x, Y:y})\n\nSession looks at all trainable variables that loss depends on and update them\ntf.Variable(initializer=None, trainable=True, collections=None, validate_shape=Tru...
true
73
36991c3191ba48b1b9dbd843e279f8fe124f1339
__author__ = 'Jager' from char import Character class Rouge (Character): def special_attack1(self, opponent, hitdamage_callback, specatt_callback): pass # hook method def special_attack2(self, opponent, hitdamage_callback, specatt_callback): pass # hook method def heal(self, target...
[ "__author__ = 'Jager'\nfrom char import Character\n\nclass Rouge (Character):\n\n def special_attack1(self, opponent, hitdamage_callback, specatt_callback):\n pass # hook method\n\n def special_attack2(self, opponent, hitdamage_callback, specatt_callback):\n pass # hook method\n\n def h...
false
74
0de657ee173b606ad61d614a6168c00fcd571a70
import os from .common import cached_outputs, data_files, test_outputs import nappy.nc_interface.na_to_nc import nappy.nc_interface.nc_to_na def test_convert_nc_2010_to_na_2310(): ffi_in, ffi_out = (2010, 2310) infile = os.path.join(cached_outputs, f"{ffi_in}.nc") outfile = os.path.join(test_outputs, f...
[ "import os\n\nfrom .common import cached_outputs, data_files, test_outputs\n\nimport nappy.nc_interface.na_to_nc\nimport nappy.nc_interface.nc_to_na\n\n\ndef test_convert_nc_2010_to_na_2310():\n ffi_in, ffi_out = (2010, 2310)\n\n infile = os.path.join(cached_outputs, f\"{ffi_in}.nc\")\n outfile = os.path.j...
false
75
06638b361c1cbe92660d242969590dfa45b63a4d
#!/usr/bin/env python3 from utils import mathfont import fontforge v1 = 5 * mathfont.em v2 = 1 * mathfont.em f = mathfont.create("stack-bottomdisplaystyleshiftdown%d-axisheight%d" % (v1, v2), "Copyright (c) 2016 MathML Association") f.math.AxisHeight = v2 f.math.StackBottomDisplayStyleShiftDown = ...
[ "#!/usr/bin/env python3\n\nfrom utils import mathfont\nimport fontforge\n\nv1 = 5 * mathfont.em\nv2 = 1 * mathfont.em\nf = mathfont.create(\"stack-bottomdisplaystyleshiftdown%d-axisheight%d\" % (v1, v2),\n \"Copyright (c) 2016 MathML Association\")\nf.math.AxisHeight = v2\nf.math.StackBottomDispl...
false
76
2dd59681a0dcb5d3f1143385100c09c7783babf4
#!/usr/bin/env python # script :: creating a datamodel that fits mahout from ratings.dat ratings_dat = open('../data/movielens-1m/users.dat', 'r') ratings_csv = open('../data/movielens-1m/users.txt', 'w') for line in ratings_dat: arr = line.split('::') new_line = '\t'.join(arr) ratings_csv.write(new_line) rati...
[ "#!/usr/bin/env python\n# script :: creating a datamodel that fits mahout from ratings.dat\n\n\n\nratings_dat = open('../data/movielens-1m/users.dat', 'r')\nratings_csv = open('../data/movielens-1m/users.txt', 'w')\n\nfor line in ratings_dat:\n\tarr = line.split('::')\n\tnew_line = '\\t'.join(arr)\n\n\tratings_csv....
false
77
5ce98ae241c0982eeb1027ffcff5b770f94ff1a3
import csv import os events = {} eventTypes = set() eventIndices = {} i = 0 with open('Civ VI Modding Companion - Events.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',', quotechar='|') for row in reader: if i < 4: i += 1 continue eventName = row[3] eventType = "GameEvents" if...
[ "import csv\nimport os\n\nevents = {}\neventTypes = set()\neventIndices = {}\n\ni = 0\n\nwith open('Civ VI Modding Companion - Events.csv', newline='') as csvfile:\n\treader = csv.reader(csvfile, delimiter=',', quotechar='|')\n\tfor row in reader:\n\n\t\tif i < 4:\n\t\t\ti += 1\n\t\t\tcontinue\n\n\t\teventName = ro...
false
78
79c043fc862e77bea5adc3f1c6bb9a6272f19c75
#!/usr/bin/env python import socket name = socket.gethostname()
[ "#!/usr/bin/env python\n\nimport socket\n\nname = socket.gethostname()\n", "import socket\nname = socket.gethostname()\n", "<import token>\nname = socket.gethostname()\n", "<import token>\n<assignment token>\n" ]
false
79
22c498d84f40455d89ed32ccf3bf8778cb159579
import os import pandas as pd from tabulate import tabulate if __name__ == '__main__': bestPrecision = [0,0,0,0,0,0] bestPrecisionFile = ['','','','','',''] bestRecall = [0,0,0,0,0,0] bestRecallFile = ['','','','','',''] bestSupport = [0,0,0,0,0,0] bestSupportFile = ['','','','','',''] bes...
[ "import os\nimport pandas as pd\nfrom tabulate import tabulate\n\nif __name__ == '__main__':\n\n bestPrecision = [0,0,0,0,0,0]\n bestPrecisionFile = ['','','','','','']\n bestRecall = [0,0,0,0,0,0]\n bestRecallFile = ['','','','','','']\n bestSupport = [0,0,0,0,0,0]\n bestSupportFile = ['','','','...
false
80
5b8c95354f8b27eff8226ace52ab9e97f98ae217
from dai_imports import* from obj_utils import* import utils class my_image_csv_dataset(Dataset): def __init__(self, data_dir, data, transforms_ = None, obj = False, minorities = None, diffs = None, bal_tfms = None): self.data_dir = data_dir self.data = data ...
[ "from dai_imports import*\nfrom obj_utils import*\nimport utils\n\nclass my_image_csv_dataset(Dataset):\n \n def __init__(self, data_dir, data, transforms_ = None, obj = False,\n minorities = None, diffs = None, bal_tfms = None):\n \n self.data_dir = data_dir\n self.dat...
false
81
64c32b3ada7fff51a7c4b07872b7688e100897d8
class Node(object): def __init__(self,data): self.data = data self.left = None self.right = None self.parent = None class tree(object): def __init__(self): self.root = None def insert(self,root,value): if self.root == None: self.root = No...
[ "class Node(object):\n def __init__(self,data):\n self.data = data\n self.left = None\n self.right = None\n self.parent = None\n\nclass tree(object):\n def __init__(self):\n self.root = None\n \n def insert(self,root,value):\n if self.root == None:\n ...
false
82
88ec9484e934ce27b13734ca26f79df71b7677e6
import requests from bs4 import BeautifulSoup import sys import re if len(sys.argv)<2: print("Syntax : python %s <port>")%(str(sys.argv[0])) else: print('-'*55) print("HTB WEB-CHALLENGE coded by ZyperX [Freelance]") print('-'*55) r=requests.session() port=str(sys.argv[1]) url="http://docker.hackthebox.eu:" url=...
[ "import requests\nfrom bs4 import BeautifulSoup\nimport sys\nimport re\nif len(sys.argv)<2:\n print(\"Syntax : python %s <port>\")%(str(sys.argv[0]))\nelse:\n print('-'*55)\n print(\"HTB WEB-CHALLENGE coded by ZyperX [Freelance]\")\n print('-'*55)\n r=requests.session()\n port=str(sys.argv[1])\n url=\"http://docker...
false
83
cd2e03666a890d6e9ea0fcb45fe28510d684916d
import requests def squeezed (client_name): return client_name.replace('Индивидуальный предприниматель', 'ИП') def get_kkm_filled_fn(max_fill=80): ## возвращает список ККМ с заполнением ФН больше max_fill в % LOGIN_URL = 'https://pk.platformaofd.ru/auth/login' API_URL = 'https://pk.platformaofd.ru/api/mon...
[ "import requests\n\ndef squeezed (client_name):\n return client_name.replace('Индивидуальный предприниматель', 'ИП')\n\ndef get_kkm_filled_fn(max_fill=80):\n## возвращает список ККМ с заполнением ФН больше max_fill в %\n LOGIN_URL = 'https://pk.platformaofd.ru/auth/login'\n API_URL = 'https://pk.platformao...
false
84
709f2425bc6e0b0b650fd6c657df6d85cfbd05fe
from django.shortcuts import render # Create your views here. def test_petite_vue(request): return render(request, 'petite_vue_app/test-form.html')
[ "from django.shortcuts import render\n\n# Create your views here.\ndef test_petite_vue(request):\n return render(request, 'petite_vue_app/test-form.html')\n", "from django.shortcuts import render\n\n\ndef test_petite_vue(request):\n return render(request, 'petite_vue_app/test-form.html')\n", "<import toke...
false
85
a4deb67d277538e61c32381da0fe4886016dae33
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import cv2 import imageio import pandas as pd import glob, os import numpy as np fileDir = os.getcwd() # os.chdir("./train-jpg") # there are 40480 training examples # we will allocate 39000 for training # and the remaining ...
[ "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\nimport cv2\nimport imageio\nimport pandas as pd\nimport glob, os\nimport numpy as np\n\nfileDir = os.getcwd()\n# os.chdir(\"./train-jpg\")\n\n# there are 40480 training examples\n# we will allocate 39000 for training...
false
86
914f477518918619e0e42184bd03c2a7ed16bb01
from django.db import models class Location(models.Model): id_location = models.AutoField(primary_key=True) city = models.CharField(max_length=100, null=True) street_name = models.CharField(max_length=100, null=True) street_number = models.IntegerField(null=True) zip = models.IntegerField(null=Tru...
[ "from django.db import models\n\n\nclass Location(models.Model):\n id_location = models.AutoField(primary_key=True)\n city = models.CharField(max_length=100, null=True)\n street_name = models.CharField(max_length=100, null=True)\n street_number = models.IntegerField(null=True)\n zip = models.IntegerF...
false
87
cdbf9427d48f0a5c53b6efe0de7dfea65a8afd83
# -*- coding: utf-8 -*- # Copyright (c) 2018-2020 Christiaan Frans Rademan <chris@fwiw.co.za>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
[ "# -*- coding: utf-8 -*-\n# Copyright (c) 2018-2020 Christiaan Frans Rademan <chris@fwiw.co.za>.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must...
false
88
c4624425f57211e583b5fbaec3943539ce6fea6f
from django import forms from . models import BlogPost class BlogPostForm(forms.ModelForm): class Meta: model = BlogPost fields = '__all__'
[ "from django import forms\nfrom . models import BlogPost\n\nclass BlogPostForm(forms.ModelForm):\n\tclass Meta:\n\t\tmodel = BlogPost\n\t\tfields = '__all__'", "from django import forms\nfrom .models import BlogPost\n\n\nclass BlogPostForm(forms.ModelForm):\n\n\n class Meta:\n model = BlogPost\n ...
false
89
a42f36fca2f65d0c5c9b65055af1814d8b4b3d42
#!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2023 Beartype authors. # See "LICENSE" for further details. ''' Project-wide **standard Python module globals** (i.e., global constants describing modules and packages bundled with CPython's sta...
[ "#!/usr/bin/env python3\n# --------------------( LICENSE )--------------------\n# Copyright (c) 2014-2023 Beartype authors.\n# See \"LICENSE\" for further details.\n\n'''\nProject-wide **standard Python module globals** (i.e., global constants\ndescribing modules and packages bundled with...
false
90
c23125018a77508dad6fd2cb86ec6d556fbd1019
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 21 11:40:26 2020 @author: jlee """ import time start_time = time.time() import numpy as np import glob, os from astropy.io import fits import init_cfg as ic # ----- Making scripts for PSFEx ----- # os.system("psfex -dd > config.psfex") if ic....
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu May 21 11:40:26 2020\n\n@author: jlee\n\"\"\"\n\n\nimport time\nstart_time = time.time()\n\nimport numpy as np\nimport glob, os\nfrom astropy.io import fits\n\nimport init_cfg as ic\n\n\n# ----- Making scripts for PSFEx ----- #\nos.system(\"ps...
false
91
81688d51696156905736b5de7a4929387fd385ab
import argparse import datetime import importlib import pprint import time import random import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from utils import get_git_state, time_print, AverageMeter, ProgressMeter, save_checkpoint def train(cfg, epoch, data_loader, model): data_tim...
[ "import argparse\nimport datetime\nimport importlib\nimport pprint\nimport time\nimport random\n\nimport numpy as np\nimport torch\nfrom torch.utils.tensorboard import SummaryWriter\n\nfrom utils import get_git_state, time_print, AverageMeter, ProgressMeter, save_checkpoint\n\n\ndef train(cfg, epoch, data_loader, m...
false
92
d90942f22cbbd9cfc3a431b7857cd909a7690966
OK = 200 CREATED = 201 NOT_MODIFIED = 304 UNAUTHORIZED = 401 FORBIDDEN = 403 BAD_REQUEST = 400 NOT_FOUND = 404 CONFLICT = 409 UNPROCESSABLE = 422 INTERNAL_SERVER_ERROR = 500 NOT_IMPLEMENTED = 501 SERVICE_UNAVAILABLE = 503 ADMIN = 'admin' ELITE = 'elite' NOOB = 'noob' WITHDRAW = 'withdraw' FUND = 'fund'
[ "OK = 200\nCREATED = 201\nNOT_MODIFIED = 304\nUNAUTHORIZED = 401\nFORBIDDEN = 403\nBAD_REQUEST = 400\nNOT_FOUND = 404\nCONFLICT = 409\nUNPROCESSABLE = 422\nINTERNAL_SERVER_ERROR = 500\nNOT_IMPLEMENTED = 501\nSERVICE_UNAVAILABLE = 503\n\nADMIN = 'admin'\nELITE = 'elite'\nNOOB = 'noob'\nWITHDRAW = 'withdraw'\nFUND = ...
false
93
54ec1961f4835f575e7129bd0b2fcdeb97be2f03
import configparser import sqlite3 import time import uuid from duoquest.tsq import TableSketchQuery def input_db_name(conn): while True: db_name = input('Database name (default: concert_singer) > ') if not db_name: db_name = 'concert_singer' cur = conn.cursor() cur.ex...
[ "import configparser\nimport sqlite3\nimport time\nimport uuid\n\nfrom duoquest.tsq import TableSketchQuery\n\ndef input_db_name(conn):\n while True:\n db_name = input('Database name (default: concert_singer) > ')\n if not db_name:\n db_name = 'concert_singer'\n cur = conn.cursor(...
false
94
2fe20f28fc7bba6b8188f5068e2b3c8b87c15edc
from util import AutomataError from automata import NFA from base import Node from copy import copy, deepcopy from os.path import commonprefix DEBUG = False LAMBDA = u'\u03bb' PHI = u'\u00d8' def copyDeltas(src): out = dict() for k in src: out[k] = dict() for k2 in src[k]: out[k]...
[ "from util import AutomataError\nfrom automata import NFA\nfrom base import Node\nfrom copy import copy, deepcopy\nfrom os.path import commonprefix\n\nDEBUG = False\n\nLAMBDA = u'\\u03bb'\nPHI = u'\\u00d8'\n\n\ndef copyDeltas(src):\n out = dict()\n for k in src:\n out[k] = dict()\n for k2 in src...
false
95
aa579025cacd11486a101b2dc51b5ba4997bf84a
class UrlPath: @staticmethod def combine(*args): result = '' for path in args: result += path if path.endswith('/') else '{}/'.format(path) #result = result[:-1] return result
[ "class UrlPath:\n @staticmethod\n def combine(*args):\n result = ''\n for path in args:\n result += path if path.endswith('/') else '{}/'.format(path)\n #result = result[:-1]\n return result", "class UrlPath:\n\n @staticmethod\n def combine(*args):\n resul...
false
96
a1304f290e0346e7aa2e22d9c2d3e7f735b1e8e7
# We don't need no stinking models but django likes this file to be there if you are an app
[ "\n# We don't need no stinking models but django likes this file to be there if you are an app\n", "" ]
false
97
368e209f83cc0cade81791c8357e01e7e3f940c8
#!/usr/bin/python3 import requests import urllib3 urllib3.disable_warnings() response = requests.get('https://freeaeskey.xyz', verify=False) data = response.text.encode('utf-8') key = data[data.index(b'<b>')+3:data.index(b'</b>')] print(key.decode('ascii'))
[ "#!/usr/bin/python3\n\nimport requests\nimport urllib3\nurllib3.disable_warnings()\nresponse = requests.get('https://freeaeskey.xyz', verify=False)\ndata = response.text.encode('utf-8')\nkey = data[data.index(b'<b>')+3:data.index(b'</b>')]\nprint(key.decode('ascii'))\n\n", "import requests\nimport urllib3\nurllib...
false
98
57516a17c1f3ee208076852369999d74dbb2b3ba
def helloWorld(): print "We are in DEMO land!" for i in range(10): helloWorld() print listBuilder() def listBuilder(): b = [] for x in range(5): b.append(10 * x) return b print "[done, for real]"
[ "def helloWorld():\n print \"We are in DEMO land!\"\n\nfor i in range(10):\n helloWorld()\nprint listBuilder()\n\ndef listBuilder():\n b = []\n for x in range(5):\n b.append(10 * x)\n return b\n\nprint \"[done, for real]\"\n" ]
true
99
174f744b641ee20272713fa2fe1991cb2c76830a
from django.db import models class Brokerage(models.Model): BrokerageName = models.CharField(max_length=500) #To-Do Fix additional settings for ImagesFields/FileFields #BrokerageLogo = ImageField ReviewLink = models.CharField(max_length=1000) ContactLink = models.CharField(max_length=1000) TotalAgents = models.I...
[ "from django.db import models\n\nclass Brokerage(models.Model):\n\tBrokerageName = models.CharField(max_length=500)\n\t#To-Do Fix additional settings for ImagesFields/FileFields\n\t#BrokerageLogo = ImageField\n\tReviewLink = models.CharField(max_length=1000)\n\tContactLink = models.CharField(max_length=1000)\n\tTot...
false