index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
7,900
3b61d389eda85ddb4c96f93c977a33b91da579ce
import numpy as np import pandas as pd INPUT_FILE = 'data_full.csv' data = pd.read_csv(INPUT_FILE) data['date'] = pd.to_datetime(data['date'], format='%d-%m-%Y %H:%M:%S') # Wyodrębnienie użytkowników i stron na jakie wchodzili do postaci <USER> [<SITES>] data = data[['ip', 'address']] data['sites'] = data.groupby(['i...
[ "import numpy as np\nimport pandas as pd\n\nINPUT_FILE = 'data_full.csv'\ndata = pd.read_csv(INPUT_FILE)\ndata['date'] = pd.to_datetime(data['date'], format='%d-%m-%Y %H:%M:%S')\n\n# Wyodrębnienie użytkowników i stron na jakie wchodzili do postaci <USER> [<SITES>]\ndata = data[['ip', 'address']]\ndata['sites'] = da...
false
7,901
7112348631bc60767bfb79c7f6966fc9189c522b
aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='
[ "aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='\n", "<assignment token>\n" ]
false
7,902
b6470ffda9040223951a99abc600ce1e99fe146b
from functions2 import * import numpy as np #from functions import TermStructure,load_data import numpy as np import math from scipy import optimize import pylab as pl from IPython import display as dp class Vasicek(): def __init__(self,rs,vol): self.t = rs.columns self.ps= rs[-1:] self....
[ "from functions2 import *\nimport numpy as np\n#from functions import TermStructure,load_data\nimport numpy as np\nimport math\nfrom scipy import optimize\nimport pylab as pl\nfrom IPython import display as dp\n\n\n\n\nclass Vasicek():\n def __init__(self,rs,vol):\n self.t = rs.columns\n self.ps= r...
false
7,903
ab79e2f9584dbbb526c62bde882a1bc9874b56f9
from threading import Thread, Lock from utils import reloj import random class Imprimidor(Thread): def __init__(self, nombre, berlin, bolsa_dinero): super().__init__() pass def run(self): ''' Funcionalidad de iMPRIMIDOR que imprime dinero cada 5 minutos, cada iteracio...
[ "from threading import Thread, Lock\nfrom utils import reloj\nimport random\n\n\nclass Imprimidor(Thread):\n\n def __init__(self, nombre, berlin, bolsa_dinero):\n super().__init__()\n pass\n\n def run(self):\n '''\n Funcionalidad de iMPRIMIDOR que imprime dinero cada 5 minutos, cad...
false
7,904
023dc23a5e649c2fbbb45ff577dffa3b5d2aac64
import weakref from Qt import QtCore from Qt import QtGui from Qt.QtWidgets import QDoubleSpinBox from Qt.QtWidgets import QSpinBox from Qt.QtWidgets import QWidget from Qt.QtWidgets import QSpacerItem from Qt.QtWidgets import QPushButton from Qt.QtWidgets import QComboBox from Qt.QtWidgets import QLineEdit from Qt.QtW...
[ "import weakref\nfrom Qt import QtCore\nfrom Qt import QtGui\nfrom Qt.QtWidgets import QDoubleSpinBox\nfrom Qt.QtWidgets import QSpinBox\nfrom Qt.QtWidgets import QWidget\nfrom Qt.QtWidgets import QSpacerItem\nfrom Qt.QtWidgets import QPushButton\nfrom Qt.QtWidgets import QComboBox\nfrom Qt.QtWidgets import QLineEd...
false
7,905
9fdcaf65f070b7081afd327442dd20e3284c71eb
#!/usr/bin/env python """This script draws a boxplot of each atom contribution to the cavity.""" import sys if sys.version < "2.7": print >> sys.stderr, "ERROR: This script requires Python 2.7.x. "\ "Please install it and try again." exit(1) try: import matplotlib.pyplot as pyp...
[ "#!/usr/bin/env python\n\n\"\"\"This script draws a boxplot of each atom contribution to the cavity.\"\"\"\n\n\nimport sys\n\nif sys.version < \"2.7\":\n print >> sys.stderr, \"ERROR: This script requires Python 2.7.x. \"\\\n \"Please install it and try again.\"\n exit(1)\n\ntry:\n ...
false
7,906
67452f31a49f50cdb2555406287b31e53a994224
#!/usr/local/bin/python3 def printGrid(grid): for row in grid: print(row) print("") def validFormatting(grid): if (type(grid) is not list): return False elif (len(grid) != 9): return False else: for row in grid: if (type(row) is not list): ...
[ "#!/usr/local/bin/python3\n\ndef printGrid(grid):\n for row in grid:\n print(row)\n print(\"\")\n\ndef validFormatting(grid):\n if (type(grid) is not list):\n return False\n elif (len(grid) != 9):\n return False\n else:\n for row in grid:\n if (type(row) is not ...
false
7,907
13c0af340c4fff815919d7cbb1cfd3116be13771
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
[ "##############################################################################\n#\n# Copyright (c) 2003 Zope Foundation and Contributors.\n# All Rights Reserved.\n#\n# This software is subject to the provisions of the Zope Public License,\n# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution....
false
7,908
84fb0e364ee3cd846148abfc9326f404f008c510
# 내 풀이 with open("sequence.protein.2.fasta", "w") as fw: with open("sequence.protein.fasta", "r") as fr: for line in fr: fw.write(line) # 강사님 풀이 # fr = open('sequence.protein.fasta','r'): # lines=fr.readlines() # seq_list=list() # for line in lines:
[ "# 내 풀이\nwith open(\"sequence.protein.2.fasta\", \"w\") as fw:\n with open(\"sequence.protein.fasta\", \"r\") as fr:\n for line in fr:\n fw.write(line)\n\n# 강사님 풀이\n# fr = open('sequence.protein.fasta','r'):\n# lines=fr.readlines()\n# seq_list=list()\n# for line in lines:\n", "with open('sequ...
false
7,909
1292b894b75676abec3f97a8854fe406787baf1d
# -*- coding: utf-8 -*- """ Created on Fri Dec 30 22:01:06 2016 @author: George """ # -*- coding: utf-8 -*- """ Created on Sat Dec 24 23:22:16 2016 @author: George """ import os import clr import numpy as np clr.AddReference(os.getcwd() + "\\libs\\MyMediaLite\\MyMediaLite.dll") from MyMediaLite import IO, RatingP...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Dec 30 22:01:06 2016\n\n@author: George\n\"\"\"\n\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Dec 24 23:22:16 2016\n\n@author: George\n\"\"\"\n\nimport os\nimport clr\nimport numpy as np\n\nclr.AddReference(os.getcwd() + \"\\\\libs\\\\MyMediaLite\\\\MyMediaLite....
true
7,910
efa94f8442c9f43234d56a781d2412c9f7ab1bb3
# -*- coding: utf-8 -*- """ Created on Fri Nov 15 10:39:55 2019 @author: PC """ import pandas as pd dictionary={"Name":["Ali","Buse","Selma","Hakan","Bülent","Yağmur","Ahmet"], "Age":[18,45,12,36,40,18,63], "Maas":[100,200,400,500,740,963,123]} dataFrame1=pd.DataFrame(dictionary) ...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Fri Nov 15 10:39:55 2019\r\n\r\n@author: PC\r\n\"\"\"\r\n\r\nimport pandas as pd\r\ndictionary={\"Name\":[\"Ali\",\"Buse\",\"Selma\",\"Hakan\",\"Bülent\",\"Yağmur\",\"Ahmet\"],\r\n \"Age\":[18,45,12,36,40,18,63],\r\n \"Maas\":[100,200,400,500,74...
false
7,911
196147d7b2b0cf7176b5baa50d7e7618f88df493
import tensorflow as tf import csv from tensorflow.keras import layers from tensorflow.keras.layers.experimental import preprocessing import pandas as pd import numpy as np import random import matplotlib.pyplot as plt import math def plot_loss(history): plt.plot(history.history['loss'], label='loss') plt.plot(his...
[ "import tensorflow as tf\nimport csv\nfrom tensorflow.keras import layers\nfrom tensorflow.keras.layers.experimental import preprocessing\nimport pandas as pd\nimport numpy as np\nimport random\nimport matplotlib.pyplot as plt\nimport math\n\ndef plot_loss(history):\n plt.plot(history.history['loss'], label='loss'...
false
7,912
c01ea897cd64b3910531babe9fce8c61b750185d
import os path = r'D:\python\风变编程\python基础-山顶班\fb_16' path1 = 'test_01' path2 = 'fb_csv-01-获取网页内容.py' print(os.getcwd()) # 返回当前工作目录 print(os.listdir(path)) # 返回path指定的文件夹包含的文件或文件夹的名字的列表 #print(os.mkdir(path1)) # 创建文件夹 print(os.path.abspath(path)) # 返回绝对路径 print(os.path.basename(path)) # 返回文件名 print(os.path.isfi...
[ "import os\npath = r'D:\\python\\风变编程\\python基础-山顶班\\fb_16'\npath1 = 'test_01'\npath2 = 'fb_csv-01-获取网页内容.py'\nprint(os.getcwd()) # 返回当前工作目录\nprint(os.listdir(path)) # 返回path指定的文件夹包含的文件或文件夹的名字的列表\n#print(os.mkdir(path1)) # 创建文件夹\nprint(os.path.abspath(path)) # 返回绝对路径\nprint(os.path.basename(path)) # 返回文件名\n...
false
7,913
65752c8ac50205df0fea105123935110e4a30aba
from math import pi width = float(input("Enter the width of the tire in mm (ex 205): ")) aspectRatio = float(input("Enter the aspect ratio of the tire (ex 60): ")) diameter = float(input("Enter the diameter of the wheel in inches (ex 15): ")) approxVolume = (pi * (width ** 2) * aspectRatio * ((width * aspectRatio) + ...
[ "from math import pi\n\nwidth = float(input(\"Enter the width of the tire in mm (ex 205): \"))\naspectRatio = float(input(\"Enter the aspect ratio of the tire (ex 60): \"))\ndiameter = float(input(\"Enter the diameter of the wheel in inches (ex 15): \"))\n\napproxVolume = (pi * (width ** 2) * aspectRatio * ((width ...
false
7,914
c589ce4ba2ae60d14787a8939146f6140fff1f01
import pygame import random from pygame.locals import * import pygame from pygame.locals import * class GameObject(pygame.sprite.Sprite): SIZE = 8 def __init__(self, x, y, surface): super(GameObject, self).__init__() self.x = x self.y = y self.surface = surface ...
[ "import pygame\nimport random\n \nfrom pygame.locals import *\nimport pygame\n \nfrom pygame.locals import *\n \nclass GameObject(pygame.sprite.Sprite):\n SIZE = 8\n def __init__(self, x, y, surface):\n super(GameObject, self).__init__()\n self.x = x\n self.y = y\n self.surface ...
false
7,915
fe406f40b48bf4982e7a48737b6b30514ae1fa71
#Checks if all declared prefixes are used in the RDF File import glob import logging import sys import Utility as utility import re # set log level logging.basicConfig(level=logging.INFO) root_path = "../" rdf_file_extension = {".ttl":"turtle", ".nt":"nt", ".rdf":"application/rdf+xml"} regex_prefix = {".ttl": r'@pr...
[ "#Checks if all declared prefixes are used in the RDF File\n\nimport glob\nimport logging\nimport sys\nimport Utility as utility\nimport re\n\n# set log level\nlogging.basicConfig(level=logging.INFO)\n\nroot_path = \"../\"\n\nrdf_file_extension = {\".ttl\":\"turtle\", \".nt\":\"nt\", \".rdf\":\"application/rdf+xml\...
false
7,916
98dac1ea372f16ecdb818fbe3287ab7e51a0d67c
from sqlalchemy import literal, Column, String, Integer, ForeignKey from sqlalchemy.orm import relationship from common.db import Base class Airplane(Base): __tablename__ = 'airplanes' id = Column(Integer, primary_key=True) icao_code = Column(String(6), unique=True, nullable=False) # ICAO 24-bit identifi...
[ "from sqlalchemy import literal, Column, String, Integer, ForeignKey\nfrom sqlalchemy.orm import relationship\nfrom common.db import Base\n\n\nclass Airplane(Base):\n __tablename__ = 'airplanes'\n\n id = Column(Integer, primary_key=True)\n icao_code = Column(String(6), unique=True, nullable=False) # ICAO 2...
false
7,917
0df20722fba6223c9d4fc9f72bfb399b479db6ac
o = input() v = [] s = 0 for i in range(12): col = [] for j in range(12): col.append(float(input())) v.append(col) a = 1 for i in range(1, 12): for j in range(a): s += v[i][j] a+=1 if o == 'S': print("%.1f"%s) if o == 'M': print("%.1f"%(s/66))
[ "o = input()\nv = []\ns = 0\nfor i in range(12):\n col = []\n for j in range(12):\n col.append(float(input()))\n v.append(col)\na = 1\nfor i in range(1, 12):\n for j in range(a):\n s += v[i][j]\n a+=1\nif o == 'S':\n print(\"%.1f\"%s)\nif o == 'M':\n print(\"%.1f\"%(s/66))\n", "...
false
7,918
dd96b7f73c07bf0c74e6ce4dbff1a9cc09729b72
from hicity.graphics.graphics import HiCityGUI def GUI(): app = HiCityGUI() app.mainloop() if __name__ == '__main__': GUI()
[ "from hicity.graphics.graphics import HiCityGUI\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\nif __name__ == '__main__':\n GUI()\n", "<import token>\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\nif __name__ == '__main__':\n GUI()\n", "<import token>\n\n\ndef GUI():\n ...
false
7,919
ead843f1edcfe798613effb049e3ca79dcd03b71
# Generated by Django 3.2.4 on 2021-07-18 02:05 from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): initial = True dependencies = [ ('tracker', '0003_auto_20210626_0735'), ] operations = [ migrations.CreateMod...
[ "# Generated by Django 3.2.4 on 2021-07-18 02:05\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport uuid\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ('tracker', '0003_auto_20210626_0735'),\n ]\n\n operations = [\n ...
false
7,920
ee8bf681adcb07c4f79245c8f118131bbcabd2fa
num1 = input("첫 번째 실수 : ") num2 = input("두 번째 실수 : ") print(float(num1) + float(num2)) num1 = float(input("첫 번째 실수 : ")) num2 = float(input("두 번째 실수 : ")) print(num1 + num2)
[ "num1 = input(\"첫 번째 실수 : \")\r\nnum2 = input(\"두 번째 실수 : \")\r\n\r\nprint(float(num1) + float(num2))\r\n\r\nnum1 = float(input(\"첫 번째 실수 : \"))\r\nnum2 = float(input(\"두 번째 실수 : \"))\r\n\r\nprint(num1 + num2)\r\n", "num1 = input('첫 번째 실수 : ')\nnum2 = input('두 번째 실수 : ')\nprint(float(num1) + float(num2))\nnum1 = ...
false
7,921
786bc5d44115b46bd246e85e85c8f8c1f20737b9
"""config URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based ...
[ "\"\"\"config URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/2.2/topics/http/urls/\nExamples:\nFunction views\n 1. Add an import: from my_app import views\n 2. Add a URL to urlpatterns: path('', views.home, name='home...
false
7,922
f900e08c06ae736f5e32ac748e282700f9d0a969
import datetime import logging from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional from dagster import check from dagster.core.utils import coerce_valid_log_level, make_new_run_id if TYPE_CHECKING: from dagster.core.events import DagsterEvent DAGSTER_META_KEY = "dagster_meta" class DagsterM...
[ "import datetime\nimport logging\nfrom typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional\n\nfrom dagster import check\nfrom dagster.core.utils import coerce_valid_log_level, make_new_run_id\n\nif TYPE_CHECKING:\n from dagster.core.events import DagsterEvent\n\nDAGSTER_META_KEY = \"dagster_meta\"...
false
7,923
a9b895e4d0830320276359944ca6fdc475fd144e
""" 函数对象有一个__defaults__属性,是保存定位参数和关键字参数默认值的元组, 仅限关键字参数默认值在__kwdefaults__属性中,参数的名称在__code__属性中(__code__本身是对象引用,有很多属性) 使用inspect模块提取函数签名更加方便,很多框架和IDE都是以此来验证代码的 """ def tag(name, *content, cls=None, **attrs): """ 生成一个或多个HTML标签 """ if cls is not None: attrs['class'] = cls if attrs: attrs_str = ''.join(' %s="%s"' ...
[ "\"\"\"\n函数对象有一个__defaults__属性,是保存定位参数和关键字参数默认值的元组,\n仅限关键字参数默认值在__kwdefaults__属性中,参数的名称在__code__属性中(__code__本身是对象引用,有很多属性)\n\n使用inspect模块提取函数签名更加方便,很多框架和IDE都是以此来验证代码的\n\"\"\"\n\n\ndef tag(name, *content, cls=None, **attrs):\n\t\"\"\" 生成一个或多个HTML标签 \"\"\"\n\tif cls is not None:\n\t\tattrs['class'] = cls\n\tif attrs:...
false
7,924
670a23aa910a6709735281b7e64e5254a19277c6
import datetime import logging import os import requests from bs4 import BeautifulSoup import telebot from azure.storage.blob import BlobClient import hashlib import azure.functions as func def hash_string(input_string: str) -> str: return hashlib.sha256(input_string.encode("utf-8")).hexdigest() ...
[ "import datetime\r\nimport logging\r\nimport os\r\nimport requests\r\nfrom bs4 import BeautifulSoup\r\nimport telebot\r\nfrom azure.storage.blob import BlobClient\r\nimport hashlib\r\n\r\nimport azure.functions as func\r\n\r\n\r\ndef hash_string(input_string: str) -> str:\r\n return hashlib.sha256(input_string.e...
false
7,925
d514413c303dd174d8f56685158780a1681e1aba
# -*- coding: utf-8 -*- """ Created on Sat Nov 2 08:04:11 2019 @author: yocoy """ import serial, time arduino = serial.Serial('COM7', 9600) time.sleep(4) lectura = [] for i in range(100): lectura.append(arduino.readline()) arduino.close() print(lectura)
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Nov 2 08:04:11 2019\n\n@author: yocoy\n\"\"\"\n\nimport serial, time\n\narduino = serial.Serial('COM7', 9600)\ntime.sleep(4)\n\nlectura = []\n\nfor i in range(100):\n lectura.append(arduino.readline())\narduino.close()\n\nprint(lectura)", "<docstring token>\nim...
false
7,926
f9d1013fa278b9078e603b012abbdde0be2e0962
def del_ops3(str1, str2): # find all common letters in both strings common1 = [x for x in str1 if x in str2] common2 = [x for x in str2 if x in str1] if len(common2) < len(common1): common1, common2 = common2, common1 # find total of strings with 0, 1, or 2 characters, (2 chars - only if c...
[ "def del_ops3(str1, str2):\n\n # find all common letters in both strings\n common1 = [x for x in str1 if x in str2]\n common2 = [x for x in str2 if x in str1]\n if len(common2) < len(common1):\n common1, common2 = common2, common1\n\n # find total of strings with 0, 1, or 2 characters, (2 char...
false
7,927
f819d1b1f2f6f3052247cda592007eac40aca37a
#!/usr/bin/env python3 # -*- coding: ascii -*- """ A script removing animations from SVG graphics. """ import sys, os, re # etree fails utterly at producing nice-looking XML from xml.dom import minidom def process(inpt, outp): def traverse(node): for child in node.childNodes: if child.nodeTy...
[ "#!/usr/bin/env python3\n# -*- coding: ascii -*-\n\n\"\"\"\nA script removing animations from SVG graphics.\n\"\"\"\n\nimport sys, os, re\n\n# etree fails utterly at producing nice-looking XML\nfrom xml.dom import minidom\n\ndef process(inpt, outp):\n def traverse(node):\n for child in node.childNodes:\n ...
false
7,928
86a15bb2e4d59fb5c8763fa2de31164beb327685
import re from xml.etree import ElementTree def get_namespace(xml_path): with open(xml_path) as f: namespaces = re.findall(r"xmlns:(.*?)=\"(.*?)\"", f.read()) return dict(namespaces) def get_comic_data(item, ns): return { "title": item.find("title").text, "post_date": item.find("...
[ "import re\nfrom xml.etree import ElementTree\n\n\ndef get_namespace(xml_path):\n with open(xml_path) as f:\n namespaces = re.findall(r\"xmlns:(.*?)=\\\"(.*?)\\\"\", f.read())\n return dict(namespaces)\n\n\ndef get_comic_data(item, ns):\n return {\n \"title\": item.find(\"title\").text,\n ...
false
7,929
f7e2fc7b5420b90f733a9520b75555bd869cea98
class TreeNode(object): """ Implementation of a TreeNode A TreeNode is a Node with a value and a list of children. Each child is also a TreeNode Class invariants: - self.value: The value for this TreeNode : Any - self.children: The list of children for this Node : TreeNode List """ def __...
[ "class TreeNode(object):\n \"\"\"\n Implementation of a TreeNode \n\n A TreeNode is a Node with a value and a list of children. Each child is also \n a TreeNode\n\n Class invariants:\n - self.value: The value for this TreeNode : Any\n - self.children: The list of children for this Node : TreeNode Li...
false
7,930
61a58b934c6663e87824e4f9f9ffd92c3236947c
from django.db import models class Link(models.Model): text = models.CharField(max_length=100) link = models.URLField() def __str__(self): return self.text
[ "from django.db import models\n\n\nclass Link(models.Model):\n text = models.CharField(max_length=100)\n link = models.URLField()\n\n def __str__(self):\n return self.text\n", "<import token>\n\n\nclass Link(models.Model):\n text = models.CharField(max_length=100)\n link = models.URLField()\...
false
7,931
bcb028bd25732e17ed1478e122ac3b2d1abf2520
from __future__ import division from pyoperators import pcg from pysimulators import profile from qubic import ( create_random_pointings, equ2gal, QubicAcquisition, PlanckAcquisition, QubicPlanckAcquisition, QubicInstrument) from qubic.data import PATH from qubic.io import read_map import healpy as hp import ma...
[ "from __future__ import division\nfrom pyoperators import pcg\nfrom pysimulators import profile\nfrom qubic import (\n create_random_pointings, equ2gal, QubicAcquisition, PlanckAcquisition,\n QubicPlanckAcquisition, QubicInstrument)\nfrom qubic.data import PATH\nfrom qubic.io import read_map\nimport healpy as...
false
7,932
7a359d4b31bd1fd35cd1a9a1de4cbf4635e23def
""" Write a program that prompts for the user’s favorite number. Use json.dump() to store this number in a file. Write a separate program that reads in this value and prints the message, “I know your favorite number! It’s _____.” """ import json file_name = 'supporting_files/favourite_number.json' favourite_number = ...
[ "\"\"\"\nWrite a program that prompts for the user’s favorite number.\nUse json.dump() to store this number in a file. Write a separate program that reads in this value and\nprints the message, “I know your favorite number! It’s _____.”\n\"\"\"\n\nimport json\n\nfile_name = 'supporting_files/favourite_number.json'\...
false
7,933
1e853d58c2066f3fbd381d0d603cd2fcece0cf15
# Generated by Django 3.1.7 on 2021-05-05 23:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('travels', '0011_auto_20210505_2230'), ] operations = [ migrations.RenameField( model_name='trip', old_name='hotel_de...
[ "# Generated by Django 3.1.7 on 2021-05-05 23:28\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('travels', '0011_auto_20210505_2230'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='trip',\n ...
false
7,934
16446c2c5612a14d4364cbefb949da0b473f7454
import contextlib import datetime import fnmatch import os import os.path import re import subprocess import sys import click import dataset def get_cmd_output(cmd): """Run a command in shell, and return the Unicode output.""" try: data = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDO...
[ "import contextlib\nimport datetime\nimport fnmatch\nimport os\nimport os.path\nimport re\nimport subprocess\nimport sys\n\nimport click\nimport dataset\n\ndef get_cmd_output(cmd):\n \"\"\"Run a command in shell, and return the Unicode output.\"\"\"\n try:\n data = subprocess.check_output(cmd, shell=Tr...
false
7,935
4758d6efde21e3b5d91f107188f24b6ddf7cbbe4
import numpy as np import tensorflow as tf import math from .. import util def debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood): dummy = tf.Print(dummy, [entropy], 'entropy: ') dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ') dummy = tf.Print(dummy, [expected_log...
[ "import numpy as np\nimport tensorflow as tf\nimport math\nfrom .. import util\n\ndef debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood):\n dummy = tf.Print(dummy, [entropy], 'entropy: ')\n dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ')\n dummy = tf.Print(dummy, ...
false
7,936
27e685750e5caa2f80c5a6399b07435ee9aa9fb9
""" Created on Feb 10, 2013 @author: jens Deprecated module for crystallogrphy related geometry operations. And a lot of other stuff that I put here. """ import numpy as np atomtable = {'H': 1, 'He': 2, 'Li': 3, 'Be': 4, 'B': 5, 'C': 6, 'N': 7, 'O': 8, 'F': 9, 'Ne': 10, 'Na': 11, 'Mg': 12, 'Al': 13, '...
[ "\"\"\"\nCreated on Feb 10, 2013\n\n@author: jens\n\nDeprecated module for crystallogrphy related geometry operations. And a lot\nof other stuff that I put here.\n\"\"\"\n\nimport numpy as np\n\n\natomtable = {'H': 1, 'He': 2, 'Li': 3, 'Be': 4, 'B': 5, 'C': 6, 'N': 7, 'O': 8,\n 'F': 9, 'Ne': 10, 'Na': 1...
false
7,937
703ed320e7c06856a0798d9c0de9aafe24458767
from entities.GpsFix import GpsFix class Visit(object): """ A Visit, which represents an arrival-departure to a stay point Attributes: id_visit: the id of the visit itself id_stay_point: the id of the stay point pivot_arrival_fix: the GpsFix that corresponds to real wo...
[ "from entities.GpsFix import GpsFix\n\n\nclass Visit(object):\n \"\"\"\n A Visit, which represents an arrival-departure to a stay point\n\n Attributes:\n id_visit: the id of the visit itself\n id_stay_point: the id of the stay point\n pivot_arrival_fix: the GpsFix that corr...
false
7,938
eed3ec2897d4da20b576cb4e2ce95331ae223f76
######### # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
[ "#########\n# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-...
false
7,939
66cc9ca3d8cbe9690da841e43cef217f3518122c
#!/usr/bin/env python # -*- coding: utf-8 -*- import functools import os import platform import sys import webbrowser import config from pushbullet import Pushbullet class Zui: def __init__(self): self.pb = Pushbullet(self.api_key()) self.target = self.make_devices() self.dayone = confi...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport functools\nimport os\nimport platform\nimport sys\nimport webbrowser\n\nimport config\nfrom pushbullet import Pushbullet\n\n\nclass Zui:\n\n def __init__(self):\n self.pb = Pushbullet(self.api_key())\n self.target = self.make_devices()\n ...
false
7,940
06aa2d261e31dfe2f0ef66dca01c1fe3db1ca94e
import os, sys top=sys.argv[1] max=int(sys.argv[2]) cnts={} for d, dirs, files in os.walk(top): for f in files: i=f.find(".") if i ==-1: i=0 suf=f[i:] rec=cnts.setdefault(suf, [0,0]) fn=d+'/'+f if os.path.islink(fn): sz=0 else: sz=o...
[ "\nimport os, sys\n\ntop=sys.argv[1]\nmax=int(sys.argv[2])\n\ncnts={}\n\nfor d, dirs, files in os.walk(top):\n for f in files:\n i=f.find(\".\")\n if i ==-1: i=0\n suf=f[i:]\n rec=cnts.setdefault(suf, [0,0])\n fn=d+'/'+f\n if os.path.islink(fn):\n sz=0\n ...
false
7,941
9c7ecd3c878d43633606439aa63f840176f20dee
# Library for Stalker project #Libraries import pandas as pd import seaborn as sns from IPython.display import Image, display import matplotlib.pyplot as plt # Google search from googlesearch import search # Tldextract to get domain of url import tldextract as tld # BeautifulSoup from bs4 import BeautifulSoup as bs f...
[ "# Library for Stalker project\n\n#Libraries \nimport pandas as pd\nimport seaborn as sns\nfrom IPython.display import Image, display\nimport matplotlib.pyplot as plt\n# Google search\nfrom googlesearch import search\n# Tldextract to get domain of url\nimport tldextract as tld\n# BeautifulSoup\nfrom bs4 import Beau...
false
7,942
c3970ad8bddb1ca136724f589ff9088024157662
import logging from common.loghdl import getLogHandler from datastore.dbutil import DBSQLLite, getDSConnStr #from utils.generator import random_password #from datastore.dbadmin import DBAdmin #from datastore.initevaldb import * ############################ TESTING TO BE REMOVED # md = cfg #def test_spetest(c...
[ "\nimport logging\n\nfrom common.loghdl import getLogHandler\nfrom datastore.dbutil import DBSQLLite, getDSConnStr\n\n\n#from utils.generator import random_password\n#from datastore.dbadmin import DBAdmin\n#from datastore.initevaldb import * \n\n############################ TESTING TO BE REMOVED \n# md = cfg\n#...
true
7,943
17326597d0597d16717c87c9bdf8733fb3acb77b
#! /usr/bin/python import glo print glo.x a = "hello world" print id(a) a = "ni hao" print id(a) for y in range(0, 5, 2): print y for y in 1, 2, 3: print y if (glo.x == 2): print("a==2") else: print("a!=2") tuple_name = ("name", "age", "school") #can't modify, only-read list_name = ["boy", "girl...
[ "#! /usr/bin/python\n\nimport glo\nprint glo.x\n\na = \"hello world\"\nprint id(a)\n\na = \"ni hao\"\nprint id(a)\n\nfor y in range(0, 5, 2):\n print y\n\nfor y in 1, 2, 3:\n print y\n\nif (glo.x == 2):\n print(\"a==2\")\nelse:\n print(\"a!=2\")\n\ntuple_name = (\"name\", \"age\", \"school\") #can't mo...
true
7,944
8502ebdb13c68a9a56a1a4ba51370d8458ca81dc
#!/usr/bin/python # -*- coding:utf-8 -*- import importlib def import_string(path): """ 根据字符串的形式去导入路径中的对象 :param path: 'src.engine.agent.AgentHandler' :return: """ module_path,cls_name = path.rsplit('.',maxsplit=1) module = importlib.import_module(module_path) return getattr(module,cls...
[ "#!/usr/bin/python\n# -*- coding:utf-8 -*-\nimport importlib\n\ndef import_string(path):\n \"\"\"\n 根据字符串的形式去导入路径中的对象\n :param path: 'src.engine.agent.AgentHandler'\n :return:\n \"\"\"\n\n module_path,cls_name = path.rsplit('.',maxsplit=1)\n module = importlib.import_module(module_path)\n r...
false
7,945
24a538dcc885b37eb0147a1ee089189f11b20f8a
# import necessary modules import cv2 import xlsxwriter import statistics from matplotlib import pyplot as plt import math import tqdm import numpy as np import datetime def getDepths(imgs, img_names, intersectionCoords, stakeValidity, templateIntersections, upperBorder, tensors, actualTensors, intersectionDist, b...
[ "# import necessary modules\nimport cv2\nimport xlsxwriter\nimport statistics\nfrom matplotlib import pyplot as plt\nimport math\nimport tqdm\nimport numpy as np\nimport datetime\n\ndef getDepths(imgs, img_names, intersectionCoords, stakeValidity, templateIntersections,\n upperBorder, tensors, actualTensors, int...
false
7,946
c355be4e05d1df7f5d6f2e32bbb5a8086babe95b
#5.8-5.9 users = ['user1', 'user2', 'user3', 'user4', 'admin'] #users = [] if users: for user in users: if user == 'admin': print(f"Hello, {user}, would you like to see a status report?") else: print(f"Hello, {user}, thank you for logging in again") else: print("We need t...
[ "#5.8-5.9\nusers = ['user1', 'user2', 'user3', 'user4', 'admin']\n#users = []\nif users:\n for user in users:\n if user == 'admin':\n print(f\"Hello, {user}, would you like to see a status report?\")\n else:\n print(f\"Hello, {user}, thank you for logging in again\")\nelse:\n ...
false
7,947
ececcf40005054e26e21152bcb5e68a1bce33e88
' a test module ' __author__ = 'Aaron Jiang' import sys def test(): args = sys.argv if len(args) == 1: print('Hello World') elif len(args) == 2: print('Hello, %s!' % args[1]) else: print('TOO MANY ARGUMENTS!') if __name__ == '__main__': test() class Test(): count =...
[ "' a test module '\n\n__author__ = 'Aaron Jiang'\n\nimport sys\n\ndef test():\n args = sys.argv\n if len(args) == 1:\n print('Hello World')\n elif len(args) == 2:\n print('Hello, %s!' % args[1])\n else:\n print('TOO MANY ARGUMENTS!')\n\n\nif __name__ == '__main__':\n test()\n\n\n...
false
7,948
f1eaba91e27dc063f3decd7b6a4fe4e40f7ed721
#! /usr/bin python3 # -*- coding: utf-8 -*- from scrapy import Request from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor from scrapy.spiders import CrawlSpider from scrapy.spiders import Rule from xici_bbs.spiders.author import get_author_item from xici_bbs.spiders.comment import get_comment_list, get_comme...
[ "#! /usr/bin python3\n# -*- coding: utf-8 -*-\nfrom scrapy import Request\nfrom scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor\nfrom scrapy.spiders import CrawlSpider\nfrom scrapy.spiders import Rule\n\nfrom xici_bbs.spiders.author import get_author_item\nfrom xici_bbs.spiders.comment import get_comment_li...
false
7,949
cd9cc656a62728b3649b00c03ca8d05106015007
from rest_framework import serializers #from rest_framework.response import Response from .models import Category, Product class RecursiveSerializer(serializers.Serializer): def to_representation(self, value): serializer = self.parent.parent.__class__(value, context=self.context) return ...
[ "from rest_framework import serializers\n#from rest_framework.response import Response\nfrom .models import Category, Product\n \nclass RecursiveSerializer(serializers.Serializer):\n def to_representation(self, value):\n serializer = self.parent.parent.__class__(value, context=self.context)\n ...
false
7,950
2f76bcfde11597f87bb9e058f7617e95c78ed383
# app/__init__.py import json from flask_api import FlaskAPI, status import graphene from graphene import relay from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType from flask_sqlalchemy import SQLAlchemy from sqlalchemy import func from flask import request, jsonify, abort, make_response fr...
[ "# app/__init__.py\nimport json\nfrom flask_api import FlaskAPI, status\nimport graphene\nfrom graphene import relay\nfrom graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType\nfrom flask_sqlalchemy import SQLAlchemy\nfrom sqlalchemy import func\nfrom flask import request, jsonify, abort, make...
false
7,951
8279c6d5f33d5580bef20e497e2948461a1de62c
# Authors: Robert Luke <mail@robertluke.net> # # License: BSD (3-clause) import numpy as np from mne.io.pick import _picks_to_idx def run_GLM(raw, design_matrix, noise_model='ar1', bins=100, n_jobs=1, verbose=0): """ Run GLM on data using supplied design matrix. This is a wrapper function fo...
[ "# Authors: Robert Luke <mail@robertluke.net>\n#\n# License: BSD (3-clause)\n\nimport numpy as np\nfrom mne.io.pick import _picks_to_idx\n\n\ndef run_GLM(raw, design_matrix, noise_model='ar1', bins=100,\n n_jobs=1, verbose=0):\n \"\"\"\n Run GLM on data using supplied design matrix.\n\n This is ...
false
7,952
e492680efe57bd36b58c00977ecd79196501997a
threehome = 25 * 3 twotonnel = 40 * 2 alldude = threehome + twotonnel print('%s Заварушку устроили' % alldude)
[ "threehome = 25 * 3\ntwotonnel = 40 * 2\nalldude = threehome + twotonnel\nprint('%s Заварушку устроили' % alldude)\n", "<assignment token>\nprint('%s Заварушку устроили' % alldude)\n", "<assignment token>\n<code token>\n" ]
false
7,953
2bc0d76e17f2f52fce9cc1925a3a0e0f53f5b81d
from fractions import Fraction import itertools # With MOD MOD = 10**9+7 def ncomb(n, r): return reduce(lambda a, b: (a*b)%MOD, (Fraction(n-i, i+1) for i in range(r)), 1) # No MOD def ncomb(n, r): return reduce(lambda a, b: (a*b), (Fraction(n-i, i+1) for i in range(r)), 1) def comb(a, l): return [subset ...
[ "from fractions import Fraction\nimport itertools\n\n# With MOD\nMOD = 10**9+7\ndef ncomb(n, r):\n return reduce(lambda a, b: (a*b)%MOD, (Fraction(n-i, i+1) for i in range(r)), 1)\n\n# No MOD\ndef ncomb(n, r):\n return reduce(lambda a, b: (a*b), (Fraction(n-i, i+1) for i in range(r)), 1)\n\ndef comb(a, l):\n ...
false
7,954
6c91114e0c32628b64734000c82354105032b2fd
zi=["L","Ma","Mi","J","Vi","S","D"] V=[] for i in range(0,len(zi)): x=input("dati salariul de: {} ".format(zi[i])) V.append(int(x)) print("Salariul in fiecare zi: {}".format(V)) print(sum(V)) print(round(sum(V)/7,2)) print(max(V)) vMax=[] vMin=[] for i in range(0,len(zi)): if V[i]==max(V): ...
[ "zi=[\"L\",\"Ma\",\"Mi\",\"J\",\"Vi\",\"S\",\"D\"]\r\nV=[]\r\nfor i in range(0,len(zi)):\r\n x=input(\"dati salariul de: {} \".format(zi[i]))\r\n V.append(int(x))\r\nprint(\"Salariul in fiecare zi: {}\".format(V))\r\nprint(sum(V))\r\nprint(round(sum(V)/7,2))\r\nprint(max(V))\r\nvMax=[]\r\nvMin=[]\r\nfor i in ...
false
7,955
89db4431a252d024381713eb7ad86346814fcbe4
from sklearn.svm import SVC from helper_functions import * from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.utils import shuffle from sklearn.preprocessing import StandardScaler import matplotlib.image as mpimg import matplotlib.pyplot as plt import glob impor...
[ "from sklearn.svm import SVC\nfrom helper_functions import *\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.utils import shuffle\nfrom sklearn.preprocessing import StandardScaler\nimport matplotlib.image as mpimg\nimport matplotlib.pyplot as plt\nimpo...
false
7,956
53b6d30bf52c43daaebe8158002db1072e34f127
from setuptools import setup, find_packages setup( name='spt_compute', version='2.0.1', description='Computational framework for the Streamflow Prediciton Tool', long_description='Computational framework to ingest ECMWF ensemble runoff forcasts ' ' or otherLand Surface Model foreca...
[ "from setuptools import setup, find_packages\n\nsetup(\n name='spt_compute',\n version='2.0.1',\n description='Computational framework for the Streamflow Prediciton Tool',\n long_description='Computational framework to ingest ECMWF ensemble runoff forcasts '\n ' or otherLand Surface ...
false
7,957
ca75e23d91eef8a5c5b78c0ea7c903b80640af25
def fibonacci(n): '''returns the nth number of the Fibonacci sequence. where the first position is indexed at 0. n must be an iteger greater than or equal to 0''' #these are the first two numbers in the sequence. fib = [0,1] #If the users enters a number less than 2 then just get that number fr...
[ "def fibonacci(n):\n '''returns the nth number of the Fibonacci\n sequence. where the first position is indexed at 0.\n n must be an iteger greater than or equal to 0'''\n #these are the first two numbers in the sequence.\n fib = [0,1]\n #If the users enters a number less than 2 then just get tha...
false
7,958
c65e14de297cc785b804e68f29bd5766ca7a8cf7
# _*_ coding:utf-8 _*_ import csv c=open(r"e:/test.csv","r+") #read=csv.reader(c) #for line in read: # print line read=c.readlines() print read c.close()
[ "# _*_ coding:utf-8 _*_\nimport csv\n\nc=open(r\"e:/test.csv\",\"r+\")\n#read=csv.reader(c)\n#for line in read:\n# print line\nread=c.readlines()\nprint read\nc.close()" ]
true
7,959
c62647b0b226d97926d1f53975a7aac7c39949d8
'''This class contains a custom made format for printing complex numbers''' class ComplexCustom(complex): ''' This class contains function for a custom made printing format for complex numbers ''' def __format__(self, fmt): '''This function creates a custom made format for printing complex n...
[ "'''This class contains a custom made format for printing complex numbers'''\nclass ComplexCustom(complex):\n '''\n This class contains function for\n a custom made printing format for complex numbers\n '''\n def __format__(self, fmt):\n '''This function creates a custom made format for printi...
false
7,960
710bb0e0efc2c4a3ba9b1ae85e1c22e81f8ca68e
from timemachines.skatertools.testing.allregressiontests import REGRESSION_TESTS import time import random TIMEOUT = 60*5 # Regression tests run occasionally to check various parts of hyper-param spaces, etc. if __name__=='__main__': start_time = time.time() elapsed = time.time()-start_time while elapsed ...
[ "from timemachines.skatertools.testing.allregressiontests import REGRESSION_TESTS\nimport time\nimport random\nTIMEOUT = 60*5\n\n# Regression tests run occasionally to check various parts of hyper-param spaces, etc.\n\nif __name__=='__main__':\n start_time = time.time()\n elapsed = time.time()-start_time\n ...
false
7,961
d0287b057530883a50ad9c1e5e74dce10cd825b6
""" Python Package Support """ # Not applicable """ Django Package Support """ # Not applicable """ Internal Package Support """ from Data_Base.models import School, Person, Child """ Data_Base/Data/Imports/child_import.py Author: Matthew J Swann; Yong Kin; Bradon Atkins; and ...
[ "\"\"\" Python Package Support \"\"\"\n# Not applicable\n\n\"\"\" Django Package Support \"\"\"\n# Not applicable\n\n\"\"\" Internal Package Support \"\"\"\nfrom Data_Base.models import School, Person, Child\n\n\"\"\"\n Data_Base/Data/Imports/child_import.py\n \n Author: Matthew J Swann; \n Yong K...
false
7,962
13a4fb5ce9ab0a3ef9ce503698615eae4157a637
#!/usr/bin/env python from cos_correct_v2 import * from angle_to_position import * import pandas as pd import datetime as dt def get_position_from_angle(razon, data, start, end): # Obtain cos factors and corrected data dni_df, altitude_angles, azimuth_angles = data cos_correct_df = razon.get_cos_factors(...
[ "#!/usr/bin/env python \n\nfrom cos_correct_v2 import *\nfrom angle_to_position import *\nimport pandas as pd\nimport datetime as dt\n\ndef get_position_from_angle(razon, data, start, end):\n # Obtain cos factors and corrected data\n dni_df, altitude_angles, azimuth_angles = data\n cos_correct_df = razon.g...
false
7,963
4453b8176cda60a3a8f4800860b87bddfdb6cafa
# -*- coding: utf-8 -*- """ ORIGINAL PROGRAM SOURCE CODE: 1: from __future__ import division, print_function, absolute_import 2: 3: import os 4: from os.path import join 5: 6: from scipy._build_utils import numpy_nodepr_api 7: 8: 9: def configuration(parent_package='',top_path=None): 10: from numpy.distutils....
[ "\n# -*- coding: utf-8 -*-\n\n\"\"\"\nORIGINAL PROGRAM SOURCE CODE:\n1: from __future__ import division, print_function, absolute_import\n2: \n3: import os\n4: from os.path import join\n5: \n6: from scipy._build_utils import numpy_nodepr_api\n7: \n8: \n9: def configuration(parent_package='',top_path=None):\n10: ...
false
7,964
fb16009985ee7fe4a467a94160f593723b5aaf03
# -*- coding: utf-8 -*- from django.http import Http404 from django.shortcuts import render,render_to_response, get_object_or_404, redirect, HttpResponse from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_protect, csrf_exempt from django.template import RequestContext,Context...
[ "# -*- coding: utf-8 -*- \nfrom django.http import Http404\nfrom django.shortcuts import render,render_to_response, get_object_or_404, redirect, HttpResponse\nfrom django.core.context_processors import csrf\nfrom django.views.decorators.csrf import csrf_protect, csrf_exempt\nfrom django.template import RequestConte...
true
7,965
3ee20391d56d8c429ab1bd2f6b0e5b261721e401
from django.urls import path from jobscrapper.views import * urlpatterns = [ path('', home_vacancies_view, name="vacancy-home"), path('list/', vacancies_view, name="vacancy"), ]
[ "from django.urls import path\nfrom jobscrapper.views import *\n\nurlpatterns = [\n path('', home_vacancies_view, name=\"vacancy-home\"),\n path('list/', vacancies_view, name=\"vacancy\"),\n\n]", "from django.urls import path\nfrom jobscrapper.views import *\nurlpatterns = [path('', home_vacancies_view, nam...
false
7,966
ba73562cd8ffa52a1fede35c3325e7e76a6dad54
#!/usr/bin/env python from __future__ import print_function from types_ import SimpleObject, SimpleObjectImmutable, NamedTuple, SimpleTuple, c_struct import timeit import random TYPES = [ SimpleObjectImmutable, SimpleObject, NamedTuple, SimpleTuple, c_struct, ] a = 1035 b = b'\x54 - fo!' c =...
[ "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nfrom types_ import SimpleObject, SimpleObjectImmutable, NamedTuple, SimpleTuple, c_struct\nimport timeit\nimport random\n\nTYPES = [\n SimpleObjectImmutable,\n SimpleObject,\n NamedTuple,\n SimpleTuple,\n c_struct,\n ]\n\na = 1035\...
false
7,967
6c7162a9bd81d618abda204c24031c5a5acc61b4
''' @Description: @Version: 1.0 @Autor: Henggao @Date: 2020-02-20 16:17:05 @LastEditors: Henggao @LastEditTime: 2020-02-20 16:32:45 ''' name = "henggao" def change(): name = "Brill" print(name) print(locals()) print(globals()) change() print(name)
[ "'''\n@Description: \n@Version: 1.0\n@Autor: Henggao\n@Date: 2020-02-20 16:17:05\n@LastEditors: Henggao\n@LastEditTime: 2020-02-20 16:32:45\n'''\nname = \"henggao\"\ndef change():\n name = \"Brill\"\n print(name)\n print(locals())\n print(globals())\n \nchange() \n\nprint(name)", "<docstring token>...
false
7,968
05a80a904548e90bea635469b94264f219062560
def best_rank_selection(generation): max_selected = len(generation) // 10 sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse=True) return sorted_by_fitness[:max_selected]
[ "def best_rank_selection(generation):\n max_selected = len(generation) // 10\n sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse=True)\n return sorted_by_fitness[:max_selected]\n", "def best_rank_selection(generation):\n max_selected = len(generation) // 10\n sorted_by_fitness...
false
7,969
931e73ffce6d24dbfb92501670245e20fc403a7a
# -*- coding:utf-8 -*- from spider.driver.spider.base.spider import * class LvmamaHotelSpider(Spider): def get_comment_info2(self,shop_data): params_list_comment1 = self.params_dict.get(ParamType.COMMENT_INFO_1) comment_len = shop_data.get(FieldName.SHOP_COMMENT_NUM) while(True): ...
[ "# -*- coding:utf-8 -*-\nfrom spider.driver.spider.base.spider import *\n\nclass LvmamaHotelSpider(Spider):\n def get_comment_info2(self,shop_data):\n params_list_comment1 = self.params_dict.get(ParamType.COMMENT_INFO_1)\n comment_len = shop_data.get(FieldName.SHOP_COMMENT_NUM)\n while(True)...
false
7,970
04867e8911f7cb30af6cefb7ba7ff34d02a07891
#coding: utf8 import sqlite3 from random import shuffle import argparse def wordCount(db): words = {} for sent, labels in iterReviews(db): for word in sent: if word not in words: words[word] = 1 else: words[word] += 1 return words def filt...
[ "#coding: utf8\n\nimport sqlite3\nfrom random import shuffle\nimport argparse\n\n\ndef wordCount(db):\n words = {}\n for sent, labels in iterReviews(db):\n for word in sent:\n if word not in words:\n words[word] = 1\n else:\n words[word] += 1\n ret...
false
7,971
b297a09ee19bb8069eb65eb085903b3219c6fe5a
import math import datetime import numpy as np import matplotlib.pyplot as plt def draw_chat( id, smooth_id, main_mode, my_name, chat_day_data, main_plot, pie_plot, list_chats_plot): min_in_day = 1440 possible_smooth = [1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, ...
[ "import math\nimport datetime\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndef draw_chat(\n id, smooth_id, main_mode, \n my_name, chat_day_data, \n main_plot, pie_plot, list_chats_plot):\n\n min_in_day = 1440\n possible_smooth = [1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 30, 32, ...
false
7,972
ac32fb5fcd71790f9dbf0794992a9dc92a202c9b
t = eval(input()) while t: t -= 1 y = [] z = [] x = str(input()) for i in range(len(x)): if (not int(i)%2): y.append(x[i]) else: z.append(x[i]) print("".join(y) + " " + "".join(z))
[ "t = eval(input())\nwhile t:\n t -= 1\n y = []\n z = []\n x = str(input())\n for i in range(len(x)):\n if (not int(i)%2):\n y.append(x[i])\n else:\n z.append(x[i])\n print(\"\".join(y) + \" \" + \"\".join(z))\n", "t = eval(input())\nwhile t:\n t -= 1\n y...
false
7,973
8d5e652fda3fb172e6faab4153bca8f78c114cd1
from datareader import * import matplotlib.pyplot as plt from plotting import * from misc import * import leastSquares as lsModel import masim as mAvgSim import numpy as np import pandas as pd import statistics as stat from datetime import datetime as dt from time import mktime def main(): # scrape_data(pd.read_csv('...
[ "from datareader import *\nimport matplotlib.pyplot as plt\nfrom plotting import *\nfrom misc import *\nimport leastSquares as lsModel\nimport masim as mAvgSim\nimport numpy as np\nimport pandas as pd\nimport statistics as stat\nfrom datetime import datetime as dt\nfrom time import mktime\n\ndef main():\n\t# scrape...
false
7,974
054d7e4bd51110e752a18a5c0af4432a818ef3b8
__all__ = ["AddonsRepository", "Addon", "Addons", "Utils"]
[ "__all__ = [\"AddonsRepository\", \"Addon\", \"Addons\", \"Utils\"]", "__all__ = ['AddonsRepository', 'Addon', 'Addons', 'Utils']\n", "<assignment token>\n" ]
false
7,975
3c79c528cc19380af8f2883b9e35855e29b151a3
#CartPoleStarter import gym ## Defining the simulation related constants NUM_EPISODES = 1000 def simulate(): ## Initialize the "Cart-Pole" environment env = gym.make('CartPole-v0') for episode in range(NUM_EPISODES): done = False # Reset the environment obv = env.reset() ...
[ "#CartPoleStarter\n\nimport gym\n\n## Defining the simulation related constants\nNUM_EPISODES = 1000\n\ndef simulate():\n ## Initialize the \"Cart-Pole\" environment\n env = gym.make('CartPole-v0')\n\n for episode in range(NUM_EPISODES):\n\n done = False\n # Reset the environment\n obv...
false
7,976
a6f03340c2f60c061977fed6807703cdaeb1b7fd
#!/usr/bin/python3 #start up curses import curses HEIGHT = 24 WIDTH = 80 TESTING = True curses.initscr() stdscr = curses.newwin(HEIGHT, WIDTH, 0, 0) curses.noecho() #don't echo keys stdscr.keypad(1) #function for displaying other players decision #statement is the number of the other player's death funciton returne...
[ "#!/usr/bin/python3\n\n#start up curses\nimport curses\n\nHEIGHT = 24\nWIDTH = 80\nTESTING = True\n\ncurses.initscr()\nstdscr = curses.newwin(HEIGHT, WIDTH, 0, 0)\ncurses.noecho() #don't echo keys\nstdscr.keypad(1)\n\n#function for displaying other players decision\n#statement is the number of the other player's de...
false
7,977
a801ca6ae90556d41fd278032af4e58a63709cec
# -*- coding: utf-8 -*- import sys import getopt import datetime import gettext import math import datetime import json import gettext from datetime import datetime FIELD_INDEX_DATE = 0 FIELD_INDEX_DATA = 1 def getPercentile(arr, percentile): percentile = min(100, max(0, percentile)) index = (percentile / 10...
[ "# -*- coding: utf-8 -*-\nimport sys\nimport getopt\nimport datetime\nimport gettext\nimport math\nimport datetime\nimport json\nimport gettext\nfrom datetime import datetime\n\nFIELD_INDEX_DATE = 0\nFIELD_INDEX_DATA = 1\n\n\ndef getPercentile(arr, percentile):\n percentile = min(100, max(0, percentile))\n in...
false
7,978
a2e00af84f743e949b53840ae6d5509e08935486
from mcpi.minecraft import Minecraft import random,time while True: x,y,z = mc.player.getTilePos() color = random.randrange(0,9) mc.setBlock(x,y,z-1,38,color) time.sleep(0.01)
[ "from mcpi.minecraft import Minecraft\r\n\r\n\r\nimport random,time\r\nwhile True:\r\n x,y,z = mc.player.getTilePos()\r\n \r\n color = random.randrange(0,9)\r\n mc.setBlock(x,y,z-1,38,color)\r\n time.sleep(0.01) \r\n\r\n", "from mcpi.minecraft import Minecraft\nimport random, time\nwhile ...
false
7,979
94286fc36e06598b9faa65d9e5759f9518e436c6
import argparse import requests from ba_bypass_bruteforce import bruteforce, stop_brute, success_queue, dict_queue, success_username from random import choice from time import sleep MAX_ROUND = 3 # 爆破的轮数 curr_round = 0 # 当前的轮数 sleep_time = 2 # 每一轮休眠的秒数 def login_limit_user(): """ 登录函数 """ try: ...
[ "import argparse\nimport requests\n\nfrom ba_bypass_bruteforce import bruteforce, stop_brute, success_queue, dict_queue, success_username\n\nfrom random import choice\nfrom time import sleep\n\n\nMAX_ROUND = 3 # 爆破的轮数\ncurr_round = 0 # 当前的轮数\nsleep_time = 2 # 每一轮休眠的秒数\n\n\ndef login_limit_user():\n \"\"\"\n ...
false
7,980
fcccbc8d582b709aa27500ef28d86103e98eee4c
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # # This code is sample only. Not for use in production. # # Author: Babu Srinivasan # Contact: babusri@amazon.com, babu.b.srinivasan@gmail.com # # Spark Streaming ETL script # Input: # 1/ Kinesis Data Strea...
[ "# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n# SPDX-License-Identifier: MIT-0\n#\n# This code is sample only. Not for use in production.\n#\n# Author: Babu Srinivasan\n# Contact: babusri@amazon.com, babu.b.srinivasan@gmail.com\n#\n# Spark Streaming ETL script \n# Input: \n# 1/ Kin...
false
7,981
ce7b7980d1e93f23e7e3ef048ddadc0c779ef9ce
import os import telebot bot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN'))
[ "import os\nimport telebot\n\nbot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN',\n 'TOKEN'))\n", "import os\nimport telebot\nbot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN'))\n", "<import token>\nbot = telebot.TeleBot(os.environ.get('TELEGRA...
false
7,982
19ff064f8c27b9796eb435c7d2b9ebf87ee90ad6
from time import strftime from Stats.SQL.Compteur import compteurSQL from Stats.SQL.Rapports import rapportsSQL from Stats.SQL.Daily import dailySQL from Stats.SQL.CompteurP4 import compteurJeuxSQL from Stats.SQL.Historique import histoSQL, histoSQLJeux from Stats.SQL.ConnectSQL import connectSQL tableauMois={"01":"ja...
[ "from time import strftime\nfrom Stats.SQL.Compteur import compteurSQL\nfrom Stats.SQL.Rapports import rapportsSQL\nfrom Stats.SQL.Daily import dailySQL\nfrom Stats.SQL.CompteurP4 import compteurJeuxSQL\nfrom Stats.SQL.Historique import histoSQL, histoSQLJeux\nfrom Stats.SQL.ConnectSQL import connectSQL\n\ntableauM...
false
7,983
160f272edd8283ea561552f22c71967db4a1660a
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND BREAK CHAR COLON COMA CTE_F CTE_I CTE_STRING DETERMINANT DIFFERENT DIVIDE DO DOUBLEEQUAL ELSE EQUAL FLOAT FROM FUNCTION ID IF INPUT INT INVERSA LBRACE LCORCH LOWERE...
[ "\n# parsetab.py\n# This file is automatically generated. Do not edit.\n# pylint: disable=W,C,R\n_tabversion = '3.10'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'AND BREAK CHAR COLON COMA CTE_F CTE_I CTE_STRING DETERMINANT DIFFERENT DIVIDE DO DOUBLEEQUAL ELSE EQUAL FLOAT FROM FUNCTION ID IF INPUT INT INVERSA LBRACE ...
false
7,984
19949b07c866d66b3ef00b6a386bf89f03e06294
############################## Import Modules ################################## import pandas as pd import numpy as np import re from scipy import stats import matplotlib.pyplot as plt ############################## Define Functions ################################ # generate list containing data of standard curve de...
[ "############################## Import Modules ##################################\nimport pandas as pd\nimport numpy as np\nimport re\nfrom scipy import stats\nimport matplotlib.pyplot as plt\n\n############################## Define Functions ################################\n# generate list containing data of stan...
false
7,985
a5eb1f559972519dbe0f3702e03af77e61fbfb4e
#!/usr/bin/env python3 import sys import re from collections import namedtuple def isnum(name): return name.startswith('-') or name.isdigit() class WireValues: def __init__(self): self.wires = {} def __getitem__(self, name): return int(name) if isnum(name) else self.wires[name] def _...
[ "#!/usr/bin/env python3\n\nimport sys\nimport re\n\nfrom collections import namedtuple\n\ndef isnum(name):\n return name.startswith('-') or name.isdigit()\n\nclass WireValues:\n def __init__(self):\n self.wires = {}\n def __getitem__(self, name):\n return int(name) if isnum(name) else self.wi...
false
7,986
5bdc08b66916959d462314b8a6e5794e5fa12b55
import os import pathlib import enum import warnings import colorama import requests with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) import invoke class MoleculeDriver(enum.Enum): docker = 1 lxd = 2 vagrant = 3 class TestPlatform(enum.Enum): linux...
[ "import os\nimport pathlib\nimport enum\nimport warnings\nimport colorama\nimport requests\nwith warnings.catch_warnings():\n warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n import invoke\n\nclass MoleculeDriver(enum.Enum):\n docker = 1\n lxd = 2\n vagrant = 3\n\nclass TestPlatform...
false
7,987
f8635c815b375dc77e971d4ea0f86547215ab2f9
__author__ = 'GazouillisTeam' import numpy as np import os import sys import time from keras.callbacks import Callback def save_architecture(model, path_out): """ Based on the keras utils 'model.summary()' """ # Redirect the print output the a textfile orig_stdout = sys.stdout # and store the...
[ "__author__ = 'GazouillisTeam'\n\nimport numpy as np\nimport os\nimport sys\nimport time\n\nfrom keras.callbacks import Callback\n\ndef save_architecture(model, path_out):\n \"\"\"\n Based on the keras utils 'model.summary()'\n \"\"\"\n # Redirect the print output the a textfile\n orig_stdout = sys.s...
false
7,988
192e789129a51aa646a925fc4f8c3f8f4e14d478
import datetime from random import SystemRandom import re import string import time from django.db import models from django.utils import timezone from app.translit import translit # Each model extends models.Model class alumni(models.Model): alumnus_id = models.AutoField(primary_key=True) full_name = model...
[ "import datetime\nfrom random import SystemRandom\nimport re\nimport string\nimport time\n\nfrom django.db import models\nfrom django.utils import timezone\n\nfrom app.translit import translit\n\n\n# Each model extends models.Model\nclass alumni(models.Model):\n alumnus_id = models.AutoField(primary_key=True)\n ...
false
7,989
e35dbcdef8779ffabc34b5e5c543e35b29523971
#!/usr/bin/env python3 import pandas from matplotlib import pyplot as plt from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import AdaBoostRegressor import numpy as np from sklearn.metrics import mean_absolute_error, mean_squared_error from math import sqrt def main(): df = pandas.read_csv("201...
[ "#!/usr/bin/env python3\n\nimport pandas\nfrom matplotlib import pyplot as plt\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.ensemble import AdaBoostRegressor\nimport numpy as np\nfrom sklearn.metrics import mean_absolute_error, mean_squared_error\nfrom math import sqrt\n\ndef main():\n df = pand...
false
7,990
b883e63c70f3dfeac3294989fab93c1331b6329c
import zipfile, re f = zipfile.ZipFile("channel.zip") num = '90052' comments = [] while True: content = f.read(num + ".txt").decode("utf-8") print(content) comments.append(f.getinfo(num + ".txt").comment.decode("utf-8")) match = re.search("Next nothing is (\d+)", content) if match == None: ...
[ "import zipfile, re\n\nf = zipfile.ZipFile(\"channel.zip\")\nnum = '90052'\ncomments = []\n\nwhile True:\n content = f.read(num + \".txt\").decode(\"utf-8\")\n print(content)\n comments.append(f.getinfo(num + \".txt\").comment.decode(\"utf-8\"))\n match = re.search(\"Next nothing is (\\d+)\", content)\n...
false
7,991
6e3de57f7c65e9f6195dabc3326b05744249cefe
# -*- coding: utf-8 -*- """Form content type.""" from briefy.plone.content.interfaces import IBriefyContent from plone.dexterity.content import Container from zope.interface import implementer class IForm(IBriefyContent): """Interface for a Composite Page.""" @implementer(IForm) class Form(Container): """A ...
[ "# -*- coding: utf-8 -*-\n\"\"\"Form content type.\"\"\"\nfrom briefy.plone.content.interfaces import IBriefyContent\nfrom plone.dexterity.content import Container\nfrom zope.interface import implementer\n\n\nclass IForm(IBriefyContent):\n \"\"\"Interface for a Composite Page.\"\"\"\n\n\n@implementer(IForm)\ncla...
false
7,992
b7be9fd366d03068a5d6c3cee703d579b9866fd3
DEFAULT_SERVER_LISTEN_PORT = 2011 DEFAULT_CLIENT_LISTEN_PORT = 2012 import pickle import socket from player import Player from averageddata import * import zlib import g import pygame from collections import defaultdict from periodic import Periodic import random from projectile import Projectile TICKTIME = 0.05 cla...
[ "DEFAULT_SERVER_LISTEN_PORT = 2011\nDEFAULT_CLIENT_LISTEN_PORT = 2012\n\nimport pickle\nimport socket\nfrom player import Player\nfrom averageddata import *\nimport zlib\nimport g\nimport pygame\nfrom collections import defaultdict\nfrom periodic import Periodic\nimport random\nfrom projectile import Projectile\n\n...
true
7,993
c7881c0d06600a43bdc01f5e464127c596db6713
import unittest from datetime import datetime from models import * class Test_PlaceModel(unittest.TestCase): """ Test the place model class """ def setUp(self): self.model = Place() self.model.save() def test_var_initialization(self): self.assertTrue(hasattr(self.model, "...
[ "import unittest\nfrom datetime import datetime\nfrom models import *\n\n\nclass Test_PlaceModel(unittest.TestCase):\n \"\"\"\n Test the place model class\n \"\"\"\n\n def setUp(self):\n self.model = Place()\n self.model.save()\n\n def test_var_initialization(self):\n self.assert...
false
7,994
dffa5e2f34788c6f5a5ccc7d8375317a830288b5
from microbit import * import radio radio.on() # receiver will show the distance to the beacon # the number of receivers should be easily adjustable while True: message=radio.receive_full() # the stronger the signal the higher the number if message: strength = message[1]+100 displaystrength...
[ "from microbit import *\nimport radio\nradio.on()\n\n# receiver will show the distance to the beacon\n# the number of receivers should be easily adjustable\nwhile True:\n message=radio.receive_full()\n # the stronger the signal the higher the number\n if message:\n strength = message[1]+100\n ...
false
7,995
96425986305171a9d23231f60b35dcbcbbd12d2d
from selenium import webdriver import time import xlwt from JD_PhoneNo import get_phone_no book = xlwt.Workbook(encoding="utf-8") sheet1=book.add_sheet("Sheet 1") browser = webdriver.Firefox() browser.get("https://www.zomato.com/bhopal/dinner") z_hotel_list = [] z_address_list = [] z_phone_list = [] z_rating...
[ "from selenium import webdriver\r\nimport time\r\nimport xlwt\r\nfrom JD_PhoneNo import get_phone_no\r\nbook = xlwt.Workbook(encoding=\"utf-8\")\r\nsheet1=book.add_sheet(\"Sheet 1\")\r\nbrowser = webdriver.Firefox()\r\nbrowser.get(\"https://www.zomato.com/bhopal/dinner\")\r\nz_hotel_list = []\r\nz_address_list = []...
false
7,996
a8e67ddbb741af6a9ff7540fef8c21468321ede0
import argparse import sys import subprocess import getpass # Process arguments parser = argparse.ArgumentParser(description='Setup a new apache virtual host on an Ubuntu system. Only tested on versions 18.04 and 20.04') parser.add_argument('domain_name', metavar='D', type=str, nargs='+', help='domain name to give to ...
[ "import argparse\nimport sys\nimport subprocess\nimport getpass\n\n# Process arguments\nparser = argparse.ArgumentParser(description='Setup a new apache virtual host on an Ubuntu system. Only tested on versions 18.04 and 20.04')\nparser.add_argument('domain_name', metavar='D', type=str, nargs='+', help='domain name...
false
7,997
8adda42dfebd3f394a1026720465824a836c1dd1
import random from turtle import Turtle colors = ["red", "blue", 'green', 'peru', 'purple', 'pink', 'chocolate', 'grey', 'cyan', 'brown'] class Food(Turtle): def __init__(self): super().__init__() self.shape("circle") self.penup() self.color("red") self.speed("fastest") ...
[ "import random\nfrom turtle import Turtle\n\ncolors = [\"red\", \"blue\", 'green', 'peru', 'purple', 'pink', 'chocolate', 'grey', 'cyan', 'brown']\n\n\nclass Food(Turtle):\n\n def __init__(self):\n super().__init__()\n\n self.shape(\"circle\")\n self.penup()\n self.color(\"red\")\n ...
false
7,998
f275085a2e4e3efc8eb841b5322d9d71f2e43846
from graphics.rectangle import * from graphics.circle import * from graphics.DGraphics.cuboid import * from graphics.DGraphics.sphere import * print ("------rectangle-------") l=int(input("enter length : ")) b=int(input("enter breadth : ")) print("area of rectangle : ",RectArea(1,b)) print("perimeter of rectang...
[ "from graphics.rectangle import *\r\nfrom graphics.circle import *\r\nfrom graphics.DGraphics.cuboid import *\r\nfrom graphics.DGraphics.sphere import *\r\nprint (\"------rectangle-------\")\r\nl=int(input(\"enter length : \"))\r\nb=int(input(\"enter breadth : \"))\r\nprint(\"area of rectangle : \",RectArea(1,b))\r...
false
7,999
f3d34379cc7fbfe211eeebec424112f3da0ab724
# -*- coding: utf-8 -*- import tensorflow as tf from yolov3 import * from predict import predict from load import Weight_loader class Yolo(Yolov3): sess = tf.Session() def __init__(self, input=None, weight_path=None, is_training=False): self.is_training = is_training try: self...
[ "# -*- coding: utf-8 -*-\nimport tensorflow as tf\nfrom yolov3 import *\nfrom predict import predict\nfrom load import Weight_loader\n\nclass Yolo(Yolov3):\n\n sess = tf.Session()\n \n def __init__(self, input=None, weight_path=None, is_training=False):\n self.is_training = is_training\n try:...
false