index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
5,200 | ee7c63f36b4720566389826680b90c6f68de85b2 | #! /usr/bin/env python3
"""Publishes joint trajectory to move robot to given pose"""
import rospy
from trajectory_msgs.msg import JointTrajectory
from trajectory_msgs.msg import JointTrajectoryPoint
from std_srvs.srv import Empty
import argparse
import time
def argumentParser(argument):
""" Argument parser """
pa... | [
"#! /usr/bin/env python3\n\"\"\"Publishes joint trajectory to move robot to given pose\"\"\"\n\nimport rospy\nfrom trajectory_msgs.msg import JointTrajectory\nfrom trajectory_msgs.msg import JointTrajectoryPoint\nfrom std_srvs.srv import Empty\nimport argparse\nimport time\n\ndef argumentParser(argument):\n \"\"\"... | false |
5,201 | 8bf0141cee2832134d61e49652330c7d21583dcd | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABCMeta, abstractmethod
import numpy as np
from deeprl.trainers import BaseTrainer
from deeprl.callbacks import EGreedyDecay
from deeprl.policy import EGreedyPolicy
class BaseDQNTrainer(BaseT... | [
"from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom abc import ABCMeta, abstractmethod\nimport numpy as np\n\nfrom deeprl.trainers import BaseTrainer\nfrom deeprl.callbacks import EGreedyDecay\nfrom deeprl.policy import EGreedyPolicy\n\n\nclass Bas... | false |
5,202 | 898ff6e38e80419d61ec4bbde827e8ca729eb19a | from cache_replacement.double_linked_list import DoubleLinkedList
from cache_replacement.node import Node
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.size = 0
self.cache_map = {}
self.cache_list = DoubleLinkedList(capacity=capacity)
def get(self... | [
"from cache_replacement.double_linked_list import DoubleLinkedList\nfrom cache_replacement.node import Node\n\n\nclass LRUCache:\n def __init__(self, capacity):\n self.capacity = capacity\n self.size = 0\n self.cache_map = {}\n self.cache_list = DoubleLinkedList(capacity=capacity)\n\n... | false |
5,203 | f96a7bef48e7df2899343029a2fae9697125a5b2 | # Generated by Django 2.2.6 on 2020-06-18 14:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gestionadmin', '0133_auto_20200618_1339'),
]
operations = [
migrations.RemoveField(
model_name='comprasenc',
name='empleado'... | [
"# Generated by Django 2.2.6 on 2020-06-18 14:16\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('gestionadmin', '0133_auto_20200618_1339'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='comprasenc',\n ... | false |
5,204 | d9f08e770dacaa86a03d553afd78fdcd725efb62 | """"""
import random
import nbformat
from textwrap import dedent
from pybryt.preprocessors import IntermediateVariablePreprocessor
def test_preprocessor():
"""
"""
nb = nbformat.v4.new_notebook()
nb.cells.append(nbformat.v4.new_code_cell(dedent("""\
a = True
b = False
f = la... | [
"\"\"\"\"\"\"\n\nimport random\nimport nbformat\n\nfrom textwrap import dedent\n\nfrom pybryt.preprocessors import IntermediateVariablePreprocessor\n\n\ndef test_preprocessor():\n \"\"\"\n \"\"\"\n nb = nbformat.v4.new_notebook()\n nb.cells.append(nbformat.v4.new_code_cell(dedent(\"\"\"\\\n a = T... | false |
5,205 | 6d543e9e24debaff7640006a3836c59ec0096255 | #H##############################################################
# FILENAME : rec.py
#
# DESCRIPTION :
# Classifies text using defined regular expressions
#
# PUBLIC FUNCTIONS :
# int processToken( string )
#
# NOTES :
# This function uses specific critera to classify
# Criteria desc... | [
"#H##############################################################\n# FILENAME : rec.py\n#\n# DESCRIPTION :\n# Classifies text using defined regular expressions \n#\n# PUBLIC FUNCTIONS :\n# int processToken( string )\n#\n# NOTES :\n# This function uses specific critera to classify\n# ... | false |
5,206 | 7346992d69250240207a0fc981d0adc245e69f87 | def calcula_norma(x):
lista=[]
for e in x:
lista.append(e**2)
v=(sum(lista)**(1/2))
return v | [
"def calcula_norma(x):\n lista=[]\n for e in x:\n lista.append(e**2)\n v=(sum(lista)**(1/2))\n return v ",
"def calcula_norma(x):\n lista = []\n for e in x:\n lista.append(e ** 2)\n v = sum(lista) ** (1 / 2)\n return v\n",
"<function token>\n"
] | false |
5,207 | 00d2a29774a4278b1b022571b3f16c88224f08fc | import requests
from lxml import html
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'}
mail_ru_link = "http://mail.ru"
lenta_link = "https://lenta.ru/"
req = requests.get(mail_ru_link, headers=headers).text
root = html.... | [
"import requests\nfrom lxml import html\n\nheaders = {\n 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'}\nmail_ru_link = \"http://mail.ru\"\nlenta_link = \"https://lenta.ru/\"\n\nreq = requests.get(mail_ru_link, headers=headers).... | false |
5,208 | 3596ef12ce407a8d84319daa38a27a99ed0de763 | '''
Author: Dustin Spicuzza
Date: 3/22/2012
Description:
This mode only feeds another robot, does not move or anything
'''
class FeedOnlyAutonomousMode(object):
# this name should be descriptive and unique. This will be shown to the user
# on the SmartDashboard
MODE_NAME = ... | [
"'''\n Author: Dustin Spicuzza\n Date: 3/22/2012\n \n Description:\n \n This mode only feeds another robot, does not move or anything\n'''\n\nclass FeedOnlyAutonomousMode(object):\n\n # this name should be descriptive and unique. This will be shown to the user\n # on the SmartDashboard... | false |
5,209 | 496d52a984bb8c0e72948ab0c8db5e6035427a68 | #returns true if given date is a leap year, false otherwise
def is_leap_year(date):
#if divisible by 400, definitely a leap year
if date % 400 == 0: return True
#if divisible by 100 (and not 400), not a leap year
elif date % 100 == 0: return False
#divisible by 4 and not by 100? leap year
elif date % 4 == 0: r... | [
"#returns true if given date is a leap year, false otherwise\n\ndef is_leap_year(date):\n\t#if divisible by 400, definitely a leap year\n\tif date % 400 == 0: return True \n\t#if divisible by 100 (and not 400), not a leap year\n\telif date % 100 == 0: return False \n\t#divisible by 4 and not by 100? leap year\n\tel... | false |
5,210 | 7fdddf98fc7b588e9b8816ffa22bc24f715d7efe | class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
n1 = len(s)
n2 = len(t)
if n1 != n2:
return False
else:
map1 = {}
map2 = {}
for i in range(n1):... | [
"class Solution(object):\n def isIsomorphic(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: bool\n \"\"\"\n n1 = len(s)\n n2 = len(t)\n if n1 != n2:\n return False\n else:\n map1 = {}\n map2 = {}\n ... | false |
5,211 | 03aa33861def30a46de85c5b309878a1180a760f | contador_pares = 0
contador_impares = 0
for i in range(100):
numero = int(input('Digite um valor:'))
if numero % 2 == 0:
contador_pares += 1
else:
contador_impares += 1
print('A quantidade de números pares é igual a:',contador_pares)
print('A quantidade de números ímpares é ig... | [
"contador_pares = 0\r\ncontador_impares = 0\r\n\r\nfor i in range(100):\r\n numero = int(input('Digite um valor:'))\r\n\r\n if numero % 2 == 0:\r\n contador_pares += 1\r\n else:\r\n contador_impares += 1\r\n\r\nprint('A quantidade de números pares é igual a:',contador_pares)\r\nprint('A quant... | false |
5,212 | e70c25ce1d61437aacfe7fad0a51e096e1ce4f5d |
__all__ = ['language']
from StringTemplate import *
| [
"\n__all__ = ['language']\n\nfrom StringTemplate import *\n",
"__all__ = ['language']\nfrom StringTemplate import *\n",
"__all__ = ['language']\n<import token>\n",
"<assignment token>\n<import token>\n"
] | false |
5,213 | c52ad4040c14471319939605c400ff4d4ad982a7 | # Stanley H.I. Lio
# hlio@hawaii.edu
# All Rights Reserved. 2018
import logging, time, sys
from serial import Serial
from . import aanderaa_3835
from . import aanderaa_4330f
from . import aanderaa_4531d
from . import aanderaa_4319a
logger = logging.getLogger(__name__)
# works with 3835 (DO), 4330F (DO), 4531D (DO),... | [
"# Stanley H.I. Lio\n# hlio@hawaii.edu\n# All Rights Reserved. 2018\nimport logging, time, sys\nfrom serial import Serial\nfrom . import aanderaa_3835\nfrom . import aanderaa_4330f\nfrom . import aanderaa_4531d\nfrom . import aanderaa_4319a\n\n\nlogger = logging.getLogger(__name__)\n\n\n# works with 3835 (DO), 4330... | false |
5,214 | ab6c3d3c6faa2d1fe5e064dbdebd8904b9434f15 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 09:54:28 2020
@author: rushirajsinhparmar
"""
import matplotlib.pyplot as plt
from skimage import io
import numpy as np
from skimage.filters import threshold_otsu
import cv2
img = io.imread("texture.png", as_gray=True)
#######################... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 14 09:54:28 2020\n\n@author: rushirajsinhparmar\n\"\"\"\n\nimport matplotlib.pyplot as plt\nfrom skimage import io\n\nimport numpy as np\nfrom skimage.filters import threshold_otsu\nimport cv2\n\nimg = io.imread(\"texture.png\", as_gray=Tr... | false |
5,215 | a53d7b4c93fa49fb0162138d4a262fe7a5546148 | import requests
import os
from bs4 import BeautifulSoup
from urllib.parse import urljoin
CURRENT_DIR = os.getcwd()
DOWNLOAD_DIR = os.path.join(CURRENT_DIR, 'malware_album')
os.makedirs(DOWNLOAD_DIR, exist_ok=True)
url = 'http://old.vision.ece.ucsb.edu/~lakshman/malware_images/album/'
class Extractor(object):
"... | [
"import requests\nimport os\nfrom bs4 import BeautifulSoup\nfrom urllib.parse import urljoin\n\nCURRENT_DIR = os.getcwd()\nDOWNLOAD_DIR = os.path.join(CURRENT_DIR, 'malware_album')\n\nos.makedirs(DOWNLOAD_DIR, exist_ok=True)\n\nurl = 'http://old.vision.ece.ucsb.edu/~lakshman/malware_images/album/'\n\n\nclass Extrac... | false |
5,216 | f3b466dc5b6149be82b096791ca8445faf169380 | # Generated by Django 3.2 on 2021-05-03 17:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0005_alter_orderitem_price'),
]
operations = [
migrations.AddField(
model_name='order',
name='being_delivere... | [
"# Generated by Django 3.2 on 2021-05-03 17:13\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('orders', '0005_alter_orderitem_price'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='order',\n n... | false |
5,217 | 7e1dd242c60ee12dfc4130e379fa35ae626a4d63 | #!/usr/bin/env python3
data = None
with open('./01-data.txt') as f:
data = f.read().splitlines()
ss = {}
s = 0
ss[s] = True
def check(data):
global ss
global s
for line in data:
s += int(line)
if ss.get(s, False):
return s
ss[s] = True
return None
v = chec... | [
"#!/usr/bin/env python3\n\ndata = None\n\nwith open('./01-data.txt') as f:\n data = f.read().splitlines()\n\nss = {}\ns = 0\nss[s] = True\n\ndef check(data):\n global ss\n global s\n for line in data:\n s += int(line)\n\n if ss.get(s, False):\n return s\n\n ss[s] = True\n... | false |
5,218 | 73d056d4ab0d268841156b21dfc2c54b5fb2f5f1 | """Support for binary sensor using I2C abelectronicsiopi chip."""
from custom_components.abelectronicsiopi.IOPi import IOPi
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.help... | [
"\"\"\"Support for binary sensor using I2C abelectronicsiopi chip.\"\"\"\r\nfrom custom_components.abelectronicsiopi.IOPi import IOPi\r\nimport voluptuous as vol\r\n\r\nfrom homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity\r\nfrom homeassistant.const import DEVICE_DEFAULT_NAME\r\nim... | false |
5,219 | b83310c18294def950cef6710c7644c7e8a3208f | # #Create a function that takes a text file and returns the number of words
# ___ count_words filepath
# w.. o.. ? ? __ file # read
# strng = ?.r..
# strng_list = ?.s.. " "
# r.. l.. ?
#
# print ? "words1.txt"
| [
"# #Create a function that takes a text file and returns the number of words\n# ___ count_words filepath\n# w.. o.. ? ? __ file # read\n# strng = ?.r..\n# strng_list = ?.s.. \" \"\n# r.. l.. ?\n#\n# print ? \"words1.txt\"\n",
""
] | false |
5,220 | b9cce77d4d2b9ff5563d17927e21166f9c870e3d | from os.path import abspath, dirname, join, basename
import numpy as np
import cv2
import xiuminglib as xm
logger, thisfile = xm.config.create_logger(abspath(__file__))
class EXR():
"""Reads EXR files.
EXR files can be generic or physically meaningful, such as depth, normal, etc.
When data loaded are p... | [
"from os.path import abspath, dirname, join, basename\nimport numpy as np\nimport cv2\n\nimport xiuminglib as xm\n\nlogger, thisfile = xm.config.create_logger(abspath(__file__))\n\n\nclass EXR():\n \"\"\"Reads EXR files.\n\n EXR files can be generic or physically meaningful, such as depth, normal, etc.\n W... | false |
5,221 | c1374a048187807deac5d28dda4fbc7beeccf8f5 | import pygame as pg
screen = pg.display.set_mode((640, 380))
| [
"import pygame as pg\r\nscreen = pg.display.set_mode((640, 380))\r\n\r\n",
"import pygame as pg\nscreen = pg.display.set_mode((640, 380))\n",
"<import token>\nscreen = pg.display.set_mode((640, 380))\n",
"<import token>\n<assignment token>\n"
] | false |
5,222 | eedd909e777a4127b5fd55108805314b3b196dd1 | import sys
import memo
from StringIO import StringIO
import inspect
alternate_dict = {}
alternate_dict['cartesian_to_polar'] = ['cartesian_to_polar','cartesianToPolar','cartesion_to_polar','Polar_Coordinates']
alternate_dict['mercator'] = ['mercator','mercator_projection','mecartor','Mercator','Mercator_projection']
... | [
"import sys\nimport memo \nfrom StringIO import StringIO\nimport inspect\n\nalternate_dict = {}\nalternate_dict['cartesian_to_polar'] = ['cartesian_to_polar','cartesianToPolar','cartesion_to_polar','Polar_Coordinates']\nalternate_dict['mercator'] = ['mercator','mercator_projection','mecartor','Mercator','Mercator_p... | true |
5,223 | 86c03fa85ac405a148be13325efeaaf691d9ec26 | #!/usr/bin/env python
def get_attachment_station_coords(station):
if (station == "gripper1"):
coords = [0.48, 0.05, 0.161]
elif (station == "gripper2"):
coords = [0.28, 0.05, 0.13]
elif (station == "syringe"):
coords = [0.405, 0.745, 0.213]
else:
coords = [0.0, 0.0, 0.0]... | [
"#!/usr/bin/env python\n\ndef get_attachment_station_coords(station):\n if (station == \"gripper1\"):\n coords = [0.48, 0.05, 0.161]\n elif (station == \"gripper2\"):\n coords = [0.28, 0.05, 0.13]\n elif (station == \"syringe\"):\n coords = [0.405, 0.745, 0.213]\n else:\n coo... | false |
5,224 | 8640de519ebf7f95588ac40b55662da85ffc926e | import urllib
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.utils.translation import gettext as _
from .forms import CountryForm
from .models import Countries
from django.utils.timezone import datetime
from django.contrib.auth.decorators import login_re... | [
"import urllib\nfrom django.shortcuts import render, redirect, get_object_or_404\nfrom django.contrib import messages\nfrom django.utils.translation import gettext as _\nfrom .forms import CountryForm\nfrom .models import Countries\nfrom django.utils.timezone import datetime\nfrom django.contrib.auth.decorators imp... | false |
5,225 | bda28e5a0cb8a3dddea58c9c59a165b31274ac03 | """AOC Day 13"""
import pathlib
import time
TEST_INPUT = """6,10
0,14
9,10
0,3
10,4
4,11
6,0
6,12
4,1
0,13
10,12
3,4
3,0
8,4
1,10
2,14
8,10
9,0
fold along y=7
fold along x=5"""
def read_input(input_path: str) -> str:
"""take input file path and return a str with the file's content"""
with open(input_path, '... | [
"\"\"\"AOC Day 13\"\"\"\n\nimport pathlib\nimport time\n\nTEST_INPUT = \"\"\"6,10\n0,14\n9,10\n0,3\n10,4\n4,11\n6,0\n6,12\n4,1\n0,13\n10,12\n3,4\n3,0\n8,4\n1,10\n2,14\n8,10\n9,0\n\nfold along y=7\nfold along x=5\"\"\"\n\ndef read_input(input_path: str) -> str:\n \"\"\"take input file path and return a str with t... | false |
5,226 | b80b997f802c7ed4f0a838030703a314f2383c9d | import pygame
from clobber.constants import GREY, ROWS, WHITE, SQUARE_SIZE, COLS, YELLOW, BLACK
from clobber.piece import Piece
class Board:
def __init__(self):
self.board = []
self.selected_piece = None
self.create_board()
def draw_squares(self, win):
win.fill(GREY)
... | [
"import pygame\n\nfrom clobber.constants import GREY, ROWS, WHITE, SQUARE_SIZE, COLS, YELLOW, BLACK\nfrom clobber.piece import Piece\n\n\nclass Board:\n def __init__(self):\n self.board = []\n self.selected_piece = None\n self.create_board()\n\n def draw_squares(self, win):\n win.f... | false |
5,227 | bd6c72c3215265a349c5f47573063a9288f64198 | from django.shortcuts import render
from rest_framework import status
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer
from rest_framework.response import Response
from feedback.models import Feedback
from feedback.serializers impor... | [
"from django.shortcuts import render\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view, renderer_classes\nfrom rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer\nfrom rest_framework.response import Response\nfrom feedback.models import Feedback\nfrom feedback.serial... | false |
5,228 | ea323a8398ceff8496e7f8d0f365d50f3115e954 | from django.contrib import admin
# from .models import Product, Client
from .models import Board
admin.site.register(Board)
# admin.site.register(Product)
# # admin.site.register(Price)
# admin.site.register(Client)
# # Register your models here.
| [
"from django.contrib import admin\n# from .models import Product, Client\nfrom .models import Board\n\nadmin.site.register(Board)\n\n# admin.site.register(Product)\n# # admin.site.register(Price)\n# admin.site.register(Client)\n# # Register your models here.\n",
"from django.contrib import admin\nfrom .models im... | false |
5,229 | d2632461fcdc39509610b96d43dd1ec42dae362f | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
__author__ = 'alexglenday'
def group(list_df: list, df_col_index: int=0, seaborn_context: str='poster'):
sns.set_context(seaborn_context)
df_labels = []
for df in list_df:
df_labels.append(df.columns[df_col_index])
df_al... | [
"import pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n__author__ = 'alexglenday'\n\n\ndef group(list_df: list, df_col_index: int=0, seaborn_context: str='poster'):\n sns.set_context(seaborn_context)\n df_labels = []\n for df in list_df:\n df_labels.append(df.columns[df_col_in... | false |
5,230 | a0a6bd5de39a7599f7872639cdf3a59b8cda5498 | from processing.DLDataEngineering import DLDataEngineering
from sklearn.preprocessing import OneHotEncoder
import pandas as pd
import numpy as np
import h5py
import os
from scipy.ndimage import gaussian_filter
#Deep learning packages
import tensorflow as tf
#from tensorflow import keras
from tensorflow.keras... | [
"from processing.DLDataEngineering import DLDataEngineering\nfrom sklearn.preprocessing import OneHotEncoder\nimport pandas as pd\nimport numpy as np\nimport h5py\nimport os\n\nfrom scipy.ndimage import gaussian_filter\n \n#Deep learning packages\nimport tensorflow as tf\n#from tensorflow import keras\nfrom... | false |
5,231 | 56ed5bb22d77f4d8c061f97d832a60ed9a106549 | from trac.db import DatabaseManager
def do_upgrade(env, ver, cursor):
"""Change schema name from taskboard_schema to agiletools_version
"""
cursor.execute('UPDATE system SET name=%s WHERE name=%s',
("agiletools_version", "taskboard_schema"))
| [
"from trac.db import DatabaseManager\n\ndef do_upgrade(env, ver, cursor):\n \"\"\"Change schema name from taskboard_schema to agiletools_version\n \"\"\"\n cursor.execute('UPDATE system SET name=%s WHERE name=%s',\n (\"agiletools_version\", \"taskboard_schema\"))\n",
"from trac.db import... | false |
5,232 | 0cec92bbfad87020baf5ef1bd005e64bc9a6ed01 | # @Author: Chen yunsheng(Leo YS CHen)
# @Location: Taiwan
# @E-mail:leoyenschen@gmail.com
# @Date: 2017-02-14 00:11:27
# @Last Modified by: Chen yunsheng
import click
from qstrader import settings
from qstrader.compat import queue
from qstrader.price_parser import PriceParser
from qstrader.price_handler.yahoo_dai... | [
"# @Author: Chen yunsheng(Leo YS CHen)\n# @Location: Taiwan\n# @E-mail:leoyenschen@gmail.com\n# @Date: 2017-02-14 00:11:27\n# @Last Modified by: Chen yunsheng\n\nimport click\n\nfrom qstrader import settings\nfrom qstrader.compat import queue\nfrom qstrader.price_parser import PriceParser\nfrom qstrader.price_h... | false |
5,233 | dad78d7948fb1038f9cf66732f39c18a18f2a3c8 | from microbit import *
import speech
while True:
speech.say("I am a DALEK - EXTERMINATE", speed=120, pitch=100, throat=100, mouth=200) #kokeile muuttaa parametrejä
| [
"from microbit import *\n\nimport speech\n\n\nwhile True:\n speech.say(\"I am a DALEK - EXTERMINATE\", speed=120, pitch=100, throat=100, mouth=200) #kokeile muuttaa parametrejä\n",
"from microbit import *\nimport speech\nwhile True:\n speech.say('I am a DALEK - EXTERMINATE', speed=120, pitch=100, throat=\n ... | false |
5,234 | 0926606a222e1277935a48ba7f0ea886fb4e298a | from faker import Faker
from generators.uniform_distribution_gen import UniformDistributionGen
from generators.random_relation_gen import RandomRelationGen
from base.field_base import FieldBase
from generators.normal_distribution_gen import NormalDistributionGen
from generators.first_name_generator import FirstNameGene... | [
"from faker import Faker\nfrom generators.uniform_distribution_gen import UniformDistributionGen\nfrom generators.random_relation_gen import RandomRelationGen\nfrom base.field_base import FieldBase\nfrom generators.normal_distribution_gen import NormalDistributionGen\nfrom generators.first_name_generator import Fir... | false |
5,235 | cdc32e7c767097a0eb0def71e55f0276982d6a96 | #!/usr/bin/env python
# coding: utf-8
# In[19]:
import numpy as np
import pandas as pd
class simple_nn():
'''
This is simple nn class with 3 layers NN. In this class additional layer was added to the original layers
from notebook given by Julian Stier and Sahib Julka.
Moreover those functions were... | [
"#!/usr/bin/env python\n# coding: utf-8\n\n# In[19]:\n\n\nimport numpy as np\nimport pandas as pd\n\nclass simple_nn():\n '''\n This is simple nn class with 3 layers NN. In this class additional layer was added to the original layers\n from notebook given by Julian Stier and Sahib Julka.\n Moreover th... | true |
5,236 | 8ae64c65d6d5dc9f2a99aeceff31657deff06c15 | import sys
import os
sys.path.append(os.pardir)
from ch03.softmax import softmax
from ch04.cross_entropy_error_batch import cross_entropy_error
import numpy as np
class SoftmaxWithLossLayer:
"""
x -> [Softmax] -> y -> [CrossEntropyError with t] -> out
In the textbook, this class has `loss` field.
"""... | [
"import sys\nimport os\nsys.path.append(os.pardir)\nfrom ch03.softmax import softmax\nfrom ch04.cross_entropy_error_batch import cross_entropy_error\nimport numpy as np\n\n\nclass SoftmaxWithLossLayer:\n \"\"\"\n x -> [Softmax] -> y -> [CrossEntropyError with t] -> out\n\n In the textbook, this class has `... | false |
5,237 | aa2e24d80789f2a6ebd63ec42a17499f1e79ca49 | def guguPrint(n):
print('*' * 30)
for i in range(1, 10):
print('{} X {} = {}'.format(n, i, n * i))
if __name__ =="__main__":
print('Main으로 실행되었음') | [
"def guguPrint(n):\n print('*' * 30)\n for i in range(1, 10):\n print('{} X {} = {}'.format(n, i, n * i))\n \nif __name__ ==\"__main__\":\n print('Main으로 실행되었음')",
"def guguPrint(n):\n print('*' * 30)\n for i in range(1, 10):\n print('{} X {} = {}'.format(n, i, n * i))\n\n\nif... | false |
5,238 | 7127df5515e93e27b431c57bec1709475fec8388 | #!/usr/bin/env python
# set up parameters that we care about
PACKAGE = 'jsk_pcl_ros'
from dynamic_reconfigure.parameter_generator_catkin import *;
from math import pi
gen = ParameterGenerator ()
gen.add("segment_connect_normal_threshold", double_t, 0,
"threshold of normal to connect clusters", 0.9, 0.0, 1.0... | [
"#!/usr/bin/env python\n\n# set up parameters that we care about\nPACKAGE = 'jsk_pcl_ros'\n\nfrom dynamic_reconfigure.parameter_generator_catkin import *;\n\nfrom math import pi\n\ngen = ParameterGenerator ()\ngen.add(\"segment_connect_normal_threshold\", double_t, 0,\n \"threshold of normal to connect clust... | false |
5,239 | 358a4948ac1f60e0966328cebf401777042c3d0e | from app.routes import home
from .home import bp as home
from .dashboard import bp as dashboard | [
"from app.routes import home\nfrom .home import bp as home\nfrom .dashboard import bp as dashboard",
"from app.routes import home\nfrom .home import bp as home\nfrom .dashboard import bp as dashboard\n",
"<import token>\n"
] | false |
5,240 | 9e6fd6620b4ec6a574d7948fb0d14b0a2ad0d24e | # -*- coding: utf-8 -*-
u"""Hellweg execution template.
:copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcollections
from pykern import pkio
from pyker... | [
"# -*- coding: utf-8 -*-\nu\"\"\"Hellweg execution template.\n\n:copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved.\n:license: http://www.apache.org/licenses/LICENSE-2.0.html\n\"\"\"\n\nfrom __future__ import absolute_import, division, print_function\nfrom pykern import pkcollections\nfrom pykern im... | false |
5,241 | b0064a5cd494d5ad232f27c63a4df2c56a4c6a66 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-10-28 17:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-10-28 17:50\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ... | false |
5,242 | 07cce6802ab3259dbc78ab86a8dd6d6a4a617c7e | from django.db import models
# Create your models here.
class Remedio(models.Model):
nome = models.CharField(max_length=100, unique=True, help_text='Nome')
valor = models.FloatField(null=False, help_text='Valor')
detalhe = models.CharField(max_length=500, null=True)
foto = models.ImageField(upload_to='... | [
"from django.db import models\n\n# Create your models here.\nclass Remedio(models.Model):\n nome = models.CharField(max_length=100, unique=True, help_text='Nome')\n valor = models.FloatField(null=False, help_text='Valor')\n detalhe = models.CharField(max_length=500, null=True)\n foto = models.ImageField... | false |
5,243 | e976f7e423d75f7fc8a3d5cd597bdd9358ae317e | from flask import logging
from flask_sqlalchemy import SQLAlchemy
from passlib.apps import custom_app_context as pwd_context
logger = logging.getLogger(__name__)
db = SQLAlchemy() # flask-sqlalchemy
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db... | [
"from flask import logging\nfrom flask_sqlalchemy import SQLAlchemy\nfrom passlib.apps import custom_app_context as pwd_context\n\nlogger = logging.getLogger(__name__)\n\ndb = SQLAlchemy() # flask-sqlalchemy\n\n\nclass User(db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True)\n... | false |
5,244 | 87c200796e1fac508a43e899c0ed53878b8c1d88 | from Smooth import smoothing
def n_grams(unigramsFile, bigramsFile, parameterization, sentences):
words = []
param = []
unigrams = []
bigrams = []
with open(parameterization) as p: #Parametrization file
data = p.read().split()
word = data[0]
param.append(data[1])
pa... | [
"from Smooth import smoothing\n\ndef n_grams(unigramsFile, bigramsFile, parameterization, sentences):\n words = []\n param = []\n unigrams = []\n bigrams = []\n\n with open(parameterization) as p: #Parametrization file\n data = p.read().split()\n word = data[0]\n param.append(dat... | false |
5,245 | 2c4eb07a32c6903ae31006f42c13c55e6cc42eb5 | __version__ = "alph 1.0"
| [
"__version__ = \"alph 1.0\"\n",
"__version__ = 'alph 1.0'\n",
"<assignment token>\n"
] | false |
5,246 | 5810739300067e8f207d09bf971484a278372a9a | """asks the user for english words to latinize"""
def latinize_word(word):
"""performs bee latin on a word"""
if word[0].lower() in 'bcdfghjklmnpqrstvwxyz':
word = word[1:] + word[0] + 'uzz'
else:
word += 'buzz'
return word.lower()
def latinize_sentence(sentence):
"""performs bee... | [
"\"\"\"asks the user for english words to latinize\"\"\"\n\n\ndef latinize_word(word):\n \"\"\"performs bee latin on a word\"\"\"\n if word[0].lower() in 'bcdfghjklmnpqrstvwxyz':\n word = word[1:] + word[0] + 'uzz'\n else:\n word += 'buzz'\n return word.lower()\n\n\ndef latinize_sentence(s... | false |
5,247 | 1a4132358fa9bd4cd74970286ec8bb212b1857cd | from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db.models import (
Model,
BaseManager,
UUIDField,
sane_repr,
)
class MonitorLocation(Model):
__core__ = True
guid = UUIDField(unique=True, auto_add=True)
nam... | [
"from __future__ import absolute_import, print_function\n\nfrom django.db import models\nfrom django.utils import timezone\n\nfrom sentry.db.models import (\n Model,\n BaseManager,\n UUIDField,\n sane_repr,\n)\n\n\nclass MonitorLocation(Model):\n __core__ = True\n\n guid = UUIDField(unique=True, a... | false |
5,248 | 74dd9151195fef41862c2793621172518f1f486d | from django.shortcuts import render,redirect
from .forms import UserRegisterForm, IsEmri ,TestForm,PDF_Rapor
from django.contrib import messages
from django.contrib.auth import authenticate, login ,logout
from django.http import HttpResponseRedirect, HttpResponse ,JsonResponse
from django.urls import reverse
from djang... | [
"from django.shortcuts import render,redirect\nfrom .forms import UserRegisterForm, IsEmri ,TestForm,PDF_Rapor\nfrom django.contrib import messages\nfrom django.contrib.auth import authenticate, login ,logout\nfrom django.http import HttpResponseRedirect, HttpResponse ,JsonResponse\nfrom django.urls import reverse\... | false |
5,249 | 3e8860c22ff3092304df57aa7f5dbcb6ccda7dd8 | from pymongo import MongoClient
from modules.linkedinSearch import SearchClass
from config import Config
class LinkedinSearch:
def __init__(self):
self.client = MongoClient(Config.MONGO_URI)
db = self.client.linkedin_db
self.collection = db.search
self.dict = {}
self.obj ... | [
"from pymongo import MongoClient\nfrom modules.linkedinSearch import SearchClass\nfrom config import Config\n\n\nclass LinkedinSearch:\n\n def __init__(self):\n\n self.client = MongoClient(Config.MONGO_URI)\n db = self.client.linkedin_db\n self.collection = db.search\n self.dict = {}\... | false |
5,250 | 9bd55a2f224acfa2cb34d0ca14a25e8864d644b3 | import os, subprocess
def greet(name):
hostname = subprocess.check_output("hostname").decode("utf-8")[:-1]
return "Hello, {}! I'm {}#{}.".format(name, hostname, os.getppid())
| [
"import os, subprocess\n\ndef greet(name):\n hostname = subprocess.check_output(\"hostname\").decode(\"utf-8\")[:-1]\n return \"Hello, {}! I'm {}#{}.\".format(name, hostname, os.getppid())\n",
"import os, subprocess\n\n\ndef greet(name):\n hostname = subprocess.check_output('hostname').decode('utf-8')[:-... | false |
5,251 | 3d01910ae1c163067f4a23b3cca109a7d9e193d5 | # -*- encoding: utf-8 -*-
class BaseException(object):
""" Common base class for all exceptions """
def with_traceback(self, tb): # real signature unknown; restored from __doc__
"""
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
"""
p... | [
"# -*- encoding: utf-8 -*-\n\n\n\nclass BaseException(object):\n \"\"\" Common base class for all exceptions \"\"\"\n def with_traceback(self, tb): # real signature unknown; restored from __doc__\n \"\"\"\n Exception.with_traceback(tb) --\n set self.__traceback__ to tb and return self... | false |
5,252 | 4a09096abf073294afcf21b1eff9350329d4db33 | import json
import pika
import urllib.request
def validate_urls():
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='urlValidationQueue')
channel.basic_consume(validate_url,
queue='urlValid... | [
"import json\nimport pika\nimport urllib.request\n\n\ndef validate_urls():\n connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))\n channel = connection.channel()\n channel.queue_declare(queue='urlValidationQueue')\n channel.basic_consume(validate_url,\n ... | false |
5,253 | d40e1cfa2ef43f698e846c25ac9f5471d69e71a0 | # Generated by Django 2.2.5 on 2020-01-05 04:05
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='News',
fields=[
('id', models.AutoField(aut... | [
"# Generated by Django 2.2.5 on 2020-01-05 04:05\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='News',\n fields=[\n ('id',... | false |
5,254 | 45b56103db0a72ebbc7de340c4293e1f70552414 | #Проверяем, является ли введенная пользователем строка полиндромом
list_1 = input('Enter something: ')
list_1_rev = list_1[::-1]
if list_1 == list_1_rev:
print('You entered a polindrom!')
else: print('Your string is not a polindrom')
| [
"#Проверяем, является ли введенная пользователем строка полиндромом\r\n\r\nlist_1 = input('Enter something: ')\r\nlist_1_rev = list_1[::-1]\r\n\r\nif list_1 == list_1_rev:\r\n print('You entered a polindrom!')\r\nelse: print('Your string is not a polindrom')\r\n\r\n\r\n\r\n\r\n",
"list_1 = input('Enter somethi... | false |
5,255 | 4eb3d94a5fd22fc29000ec32475de9cbae1c183a | # OpenWeatherMap API Key
api_key = "078c8443640961d5ce547c8269db5fd7"
| [
"# OpenWeatherMap API Key\napi_key = \"078c8443640961d5ce547c8269db5fd7\"\n",
"api_key = '078c8443640961d5ce547c8269db5fd7'\n",
"<assignment token>\n"
] | false |
5,256 | 2ffd0de2888872cfa664919fcfc54b8e60b03280 | #! /usr/local/env python
#coding:utf-8
import urllib.request
import urllib.error
try:
urllib.request.urlopen("http://blog.csdn.net/jo_andy")
except urllib.error.URLError as e:
if hasattr(e,"code"):
print(e.code)
if hasattr(e,'reason'):
print(e.reason) | [
"#! /usr/local/env python\n#coding:utf-8\nimport urllib.request\nimport urllib.error\ntry:\n urllib.request.urlopen(\"http://blog.csdn.net/jo_andy\")\nexcept urllib.error.URLError as e:\n if hasattr(e,\"code\"):\n print(e.code)\n if hasattr(e,'reason'):\n print(e.reason)",
"import urllib.re... | false |
5,257 | 7b4c2689ad1d4601a108dd8aa6e3c4d1e9730dc5 |
#Merge Sort
#O(nlogn)
#Merge Part
from __future__ import division #use for python2
def merge(A, B): #Merge A[0:m], B[0,n]
(C, m, n) = ([], len(A), len(B))
(i, j) = (0, 0) #Current positions in A, B
while (i + j) < (m + n): #i+j is no. of elements merged so far
... | [
"\n#Merge Sort\n#O(nlogn)\n\n#Merge Part\n\nfrom __future__ import division #use for python2\n\ndef merge(A, B): #Merge A[0:m], B[0,n]\n (C, m, n) = ([], len(A), len(B))\n (i, j) = (0, 0) #Current positions in A, B\n\n while (i + j) < (m + n): #i+j is no. of elements merged s... | false |
5,258 | 240f5e9cbb38f319b6e03b1b7f9cae7655ac4385 | """
*** Three Number Sum ***
Write a function that takes in a non-empty array of distinct integers and an integer representing a target sum. The function
should find all triplets. The numbers in each triplet should be ordered in ascending order, and the triplets themeselves
should be ordered in ascending order with re... | [
"\"\"\"\n*** Three Number Sum ***\n\nWrite a function that takes in a non-empty array of distinct integers and an integer representing a target sum. The function\nshould find all triplets. The numbers in each triplet should be ordered in ascending order, and the triplets themeselves\nshould be ordered in ascending ... | false |
5,259 | 6b2bd6954f188626fa857ffc37611d3f971d22e2 | from command import Command, is_command, CommandException
from event import Event
class ItemInfo(Command):
@is_command
def item_info(self, player, *args):
if len(args) == 0:
raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS)
item_id = args[0]
if item_id in playe... | [
"from command import Command, is_command, CommandException\nfrom event import Event\n\n\nclass ItemInfo(Command):\n\n @is_command\n def item_info(self, player, *args):\n if len(args) == 0:\n raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS)\n item_id = args[0]\n if ... | false |
5,260 | bfcf6e241881c4f668f926e087ab0f7dcad61dee | from django import forms
from acl.models import Alert
class CreateAlertForm(forms.ModelForm):
class Meta:
model = Alert
exclude = ['role','age_analysis','Date_Uploaded','alias_name','CAMT_Reveiewer','Date_Regularised','alert_message', 'Count2']
| [
"from django import forms\nfrom acl.models import Alert\n\n\nclass CreateAlertForm(forms.ModelForm):\n class Meta:\n model = Alert\n exclude = ['role','age_analysis','Date_Uploaded','alias_name','CAMT_Reveiewer','Date_Regularised','alert_message', 'Count2']\n\n \n\n",
"from django import f... | false |
5,261 | d70d3d8eef711441ac89c2d98c72a5f95e0ab20d | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script reads in video information frame-by-frame, and then calculates
visual edge information for each frame, storing the information in a vector.
This can be averaged within TRs in an fMRI analysis to 'regress out'
high-frequency visual information in the video.
... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nThis script reads in video information frame-by-frame, and then calculates\nvisual edge information for each frame, storing the information in a vector.\nThis can be averaged within TRs in an fMRI analysis to 'regress out'\nhigh-frequency visual information ... | false |
5,262 | 604c94e50b1fb9b5e451c4432113498410a4ac1f | #!/g/kreshuk/lukoianov/miniconda3/envs/inferno/bin/python3
# BASIC IMPORTS
import argparse
import os
import subprocess
import sys
import numpy as np
# INTERNAL IMPORTS
from src.datasets import CentriollesDatasetOn, CentriollesDatasetBags, GENdataset
from src.utils import get_basic_transforms, log_info, get_resps_tran... | [
"#!/g/kreshuk/lukoianov/miniconda3/envs/inferno/bin/python3\n\n# BASIC IMPORTS\nimport argparse\nimport os\nimport subprocess\nimport sys\nimport numpy as np\n\n# INTERNAL IMPORTS\nfrom src.datasets import CentriollesDatasetOn, CentriollesDatasetBags, GENdataset\nfrom src.utils import get_basic_transforms, log_info... | false |
5,263 | 9cebce7f97a1848885883692cd0f494cce6bae7f | # Copyright 2019 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"# Copyright 2019 PerfKitBenchmarker Authors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless re... | false |
5,264 | b1d8a454e590dfa4afa257ca665376c320a4acb5 | # Generated by Django 3.0.8 on 2020-07-12 19:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('CRUD', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='eAdddress',
ne... | [
"# Generated by Django 3.0.8 on 2020-07-12 19:05\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('CRUD', '0001_initial'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='employee',\n old_name='eAdddre... | false |
5,265 | 4b5f58d471b05428caef3ca7a3bdc0d30a7e3881 |
from PrStatusWorker import PrStatusWorker
import threading
def initialize_worker():
worker = PrStatusWorker()
worker.start_pr_status_polling()
print("Starting the PR status monitor worker thread...")
worker_thread = threading.Thread(target=initialize_worker, name="pr_status_worker")
worker_thread.start()
| [
"\nfrom PrStatusWorker import PrStatusWorker\nimport threading\n\ndef initialize_worker():\n worker = PrStatusWorker()\n worker.start_pr_status_polling()\n\nprint(\"Starting the PR status monitor worker thread...\")\nworker_thread = threading.Thread(target=initialize_worker, name=\"pr_status_worker\")\nworker... | false |
5,266 | e4f97018567559fc2714b75654974fb7c51f770f | def phi(n):
r = n
d = 2
p = n
while r > 1:
if r % d == 0:
p -= int(r/d)
while r % d == 0:
r = int(r/d)
d += 1
return p
m = (0, 1)
for n in range(2, 1000000):
p = phi(n)
m = max(m, (n/p, n))
if n % 10000 == 0:
print(n)
prin... | [
"def phi(n):\n r = n\n d = 2\n p = n\n while r > 1:\n if r % d == 0:\n p -= int(r/d)\n while r % d == 0:\n r = int(r/d)\n d += 1\n return p\n\nm = (0, 1)\nfor n in range(2, 1000000):\n p = phi(n)\n m = max(m, (n/p, n))\n if n % 10000 == 0:\n... | false |
5,267 | 9ba74c7ecbd20c59883aff4efdc7e0369ff65daf | # Stubs for binascii
# Based on http://docs.python.org/3.2/library/binascii.html
import sys
from typing import Union, Text
if sys.version_info < (3,):
# Python 2 accepts unicode ascii pretty much everywhere.
_Bytes = Text
_Ascii = Text
else:
# But since Python 3.3 ASCII-only unicode strings are accep... | [
"# Stubs for binascii\n\n# Based on http://docs.python.org/3.2/library/binascii.html\n\nimport sys\nfrom typing import Union, Text\n\nif sys.version_info < (3,):\n # Python 2 accepts unicode ascii pretty much everywhere.\n _Bytes = Text\n _Ascii = Text\nelse:\n # But since Python 3.3 ASCII-only unicode ... | false |
5,268 | 102ba5c1cb4beda6f9b82d37d9b343fe4f309cfb | #!/usr/bin/python
###########################################################################
#
# Copyright 2019 Dell, Inc.
#
# 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.... | [
"#!/usr/bin/python\n###########################################################################\n#\n# Copyright 2019 Dell, Inc.\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#... | true |
5,269 | 5e7a589af69a604021ed9558fcce721a8e254fee | from .context import mango
from solana.publickey import PublicKey
def test_token_lookup():
data = {
"tokens": [
{
"address": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"decimals": 9,
... | [
"from .context import mango\n\nfrom solana.publickey import PublicKey\n\n\ndef test_token_lookup():\n data = {\n \"tokens\": [\n {\n \"address\": \"So11111111111111111111111111111111111111112\",\n \"symbol\": \"SOL\",\n \"name\": \"Wrapped SOL\",\n ... | false |
5,270 | 8753996c90ecea685e6312020dfd31fabb366138 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class ClassMKB(models.Model):
name = models.CharField(max_length=512,verbose_name = 'Наименование')
code = models.CharField(max_length=20, null=True, blank=True,verbose_name = 'Код')
parent_id = models.IntegerFie... | [
"# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom django.db import models\n\n\nclass ClassMKB(models.Model):\n\n name = models.CharField(max_length=512,verbose_name = 'Наименование')\n code = models.CharField(max_length=20, null=True, blank=True,verbose_name = 'Код')\n parent_id = mod... | false |
5,271 | abcefa0a3312e158517ec8a15421d1d07220da6a | count = int(input())
for i in range(1, count + 1):
something = '='
num1, num2 = map(int, input().split())
if num1 > num2:
something = '>'
elif num1 < num2:
something = '<'
print(f'#{i} {something}')
| [
"count = int(input())\n\nfor i in range(1, count + 1):\n something = '='\n num1, num2 = map(int, input().split())\n if num1 > num2:\n something = '>'\n elif num1 < num2:\n something = '<'\n print(f'#{i} {something}')\n ",
"count = int(input())\nfor i in range(1, count + 1):\n ... | false |
5,272 | 6c5c07dadbe7ec70a210ee42e756be0d710c0993 | #!/usr/local/bin/python
import cgi
import pymysql
import pymysql.cursors
import binascii
import os
from mylib import siteLines
import threading
def checkStringLine(ip, host, pagel, objects, title):
onlyIp = ip.split(":")[0]
connection = siteLines()
with connection.cursor() as cursor:
#... | [
"#!/usr/local/bin/python\r\nimport cgi\r\nimport pymysql\r\nimport pymysql.cursors\r\nimport binascii\r\nimport os\r\nfrom mylib import siteLines\r\nimport threading\r\n\r\ndef checkStringLine(ip, host, pagel, objects, title):\r\n onlyIp = ip.split(\":\")[0]\r\n connection = siteLines()\r\n with connection... | false |
5,273 | 22c2425f1dc14b6b0005ebf2231af8abf43aa2e1 | from flask import Flask, flash, abort, redirect, url_for, request, render_template, make_response, json, Response
import os, sys
import config
import boto.ec2.elb
import boto
from boto.ec2 import *
app = Flask(__name__)
@app.route('/')
def index():
list = []
creds = config.get_ec2_conf()
for region in config.r... | [
"from flask import Flask, flash, abort, redirect, url_for, request, render_template, make_response, json, Response\nimport os, sys\nimport config\nimport boto.ec2.elb\nimport boto\nfrom boto.ec2 import *\n\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef index():\n\n\tlist = []\n\tcreds = config.get_ec2_conf()\n\... | false |
5,274 | d29c8ec737b8e962d381c8fdd0999e7e01847836 | import sys
import psyco
sys.stdin = open("/home/shiva/Learning/1.txt", "r")
sys.stdout = open("/home/shiva/Learning/2.txt", "w")
def compute(plus,minus,total,inp):
if plus == 1 and minus == 0:
print(total); return
elif (plus == 1 and minus == 1):
print("Impossible"); return
elif (abs(plus-minus) > total):
pl... | [
"import sys\nimport psyco\nsys.stdin = open(\"/home/shiva/Learning/1.txt\", \"r\")\nsys.stdout = open(\"/home/shiva/Learning/2.txt\", \"w\")\n\ndef compute(plus,minus,total,inp):\n\tif plus == 1 and minus == 0:\n\t\tprint(total); return\n\telif (plus == 1 and minus == 1): \n\t\tprint(\"Impossible\"); return\n\telif... | false |
5,275 | 479411727de14e8032b6d01cdb844632111af688 | import os
import argparse
from data.downloader import *
from data.utils import *
from data.danmaku import *
from utils import *
key = '03fc8eb101b091fb'
parser = argparse.ArgumentParser(description = 'Download Video From Bilibili')
parser.add_argument('-d', type = str, help = 'dataset')
parser.add_argument('-o', ty... | [
"import os\nimport argparse\nfrom data.downloader import *\nfrom data.utils import *\nfrom data.danmaku import *\nfrom utils import *\n\nkey = '03fc8eb101b091fb'\n\nparser = argparse.ArgumentParser(description = 'Download Video From Bilibili')\n\nparser.add_argument('-d', type = str, help = 'dataset')\n\nparser.add... | false |
5,276 | 754b34028780231c7eccb98cdf3e83bd615d843f | import pandas as pd
import os
from appia.processors.core import normalizer
from math import ceil
class Experiment:
def __init__(self, id) -> None:
self.id = id
self.version = 4
self._hplc = None
self._fplc = None
@property
def hplc(self):
try:
return se... | [
"import pandas as pd\nimport os\nfrom appia.processors.core import normalizer\nfrom math import ceil\n\n\nclass Experiment:\n def __init__(self, id) -> None:\n self.id = id\n self.version = 4\n self._hplc = None\n self._fplc = None\n\n @property\n def hplc(self):\n try:\n... | false |
5,277 | 3bea4413a41a9eecb5e3184d090b646e17892b5c | from typing import List, Tuple
test_string = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2"
with open('data/day8_input.txt', 'r') as fp:
my_string = fp.read()
class Node:
def __init__(self):
self.metadata = list()
self.children = list()
def checksum(self):
return sum([x for x in self.met... | [
"from typing import List, Tuple\n\ntest_string = \"2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2\"\nwith open('data/day8_input.txt', 'r') as fp:\n my_string = fp.read()\n\n\nclass Node:\n def __init__(self):\n self.metadata = list()\n self.children = list()\n\n def checksum(self):\n return sum(... | false |
5,278 | 85ac851e28dba3816f18fefb727001b8e396cc2b | # Алексей Головлев, группа БСБО-07-19
def lucky(ticket):
def sum_(number):
number = str(number)
while len(number) != 6:
number = '0' + number
x = list(map(int, number))
return sum(x[:3]) == sum(x[3:])
return 'Счастливый' if sum_(ticket) == sum_(lastTicket) else 'Нес... | [
"# Алексей Головлев, группа БСБО-07-19\n\ndef lucky(ticket):\n def sum_(number):\n number = str(number)\n while len(number) != 6:\n number = '0' + number\n x = list(map(int, number))\n return sum(x[:3]) == sum(x[3:])\n\n return 'Счастливый' if sum_(ticket) == sum_(lastTi... | false |
5,279 | e732fa0e2b377a87b8b088303b277cc08cb695b3 | from flask import Flask, render_template, request, redirect, flash, session
from mysqlconnection import connectToMySQL
from flask_bcrypt import Bcrypt
import re
app = Flask(__name__)
bcrypt = Bcrypt(app)
app.secret_key = "something secret10"
DATABASE = "exam_quote_dash"
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-... | [
"from flask import Flask, render_template, request, redirect, flash, session\nfrom mysqlconnection import connectToMySQL\nfrom flask_bcrypt import Bcrypt\nimport re\n\napp = Flask(__name__)\nbcrypt = Bcrypt(app)\napp.secret_key = \"something secret10\"\nDATABASE = \"exam_quote_dash\"\nEMAIL_REGEX = re.compile(r'^[a... | false |
5,280 | 3d49d03dbc38ee37eadd603b4b464b0e2e1a33d5 | import itertools
def permutations(string):
return list("".join(p) for p in set(itertools.permutations(string))) | [
"import itertools\n\ndef permutations(string):\n return list(\"\".join(p) for p in set(itertools.permutations(string)))",
"import itertools\n\n\ndef permutations(string):\n return list(''.join(p) for p in set(itertools.permutations(string)))\n",
"<import token>\n\n\ndef permutations(string):\n return l... | false |
5,281 | a90db2073d43d54cbcc04e3000e5d0f2a2da4a55 | # Generated by Django 2.1.3 on 2020-06-05 23:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('index', '0005_userip_serial_number'),
]
operations = [
migrations.AddField(
model_name='userip',
name='ip_attributio... | [
"# Generated by Django 2.1.3 on 2020-06-05 23:06\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('index', '0005_userip_serial_number'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='userip',\n ... | false |
5,282 | f17ae8a44f8b032feac7c18fe39663054fea40c0 | import gc
import unittest
import numpy as np
from pydrake.autodiffutils import AutoDiffXd
from pydrake.common import RandomDistribution, RandomGenerator
from pydrake.common.test_utilities import numpy_compare
from pydrake.common.test_utilities.deprecation import catch_drake_warnings
from pydrake.common.value import Va... | [
"import gc\nimport unittest\nimport numpy as np\n\nfrom pydrake.autodiffutils import AutoDiffXd\nfrom pydrake.common import RandomDistribution, RandomGenerator\nfrom pydrake.common.test_utilities import numpy_compare\nfrom pydrake.common.test_utilities.deprecation import catch_drake_warnings\nfrom pydrake.common.va... | false |
5,283 | 50f6bcb4d2223d864cca92778ab3483a2d2c3214 | __author__ = 'christopher'
import fabio
import pyFAI
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from pims.tiff_stack import TiffStack_tifffile as TiffStack
from skxray.io.save_powder_output import save_output
from xpd_workflow.mask_tools import *
geo = pyFAI.load(
'/mnt/bulk-data/researc... | [
"__author__ = 'christopher'\nimport fabio\nimport pyFAI\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\nfrom pims.tiff_stack import TiffStack_tifffile as TiffStack\nfrom skxray.io.save_powder_output import save_output\nfrom xpd_workflow.mask_tools import *\n\ngeo = pyFAI.load(\n '/mnt/bu... | true |
5,284 | f45313e4e8f3ecba0c7dc0288d9d5ec4e26f0ba6 | # Goal: Let's Review
# Enter your code here. Read input from STDIN. Print output to STDOUT
T = int(input())
# Iterate through each inputted string
for i in range(T):
even = ''
odd = ''
s = str(input())
for i in range(len(s)):
if (i % 2 == 0):
even = even + s[i]
else:
... | [
"# Goal: Let's Review\n\n# Enter your code here. Read input from STDIN. Print output to STDOUT\n\nT = int(input())\n\n# Iterate through each inputted string\n\nfor i in range(T):\n even = ''\n odd = ''\n s = str(input())\n\n for i in range(len(s)):\n if (i % 2 == 0):\n even = even + s[... | false |
5,285 | 7c82565a4184b2e779e2bb6ba70b497cc287af35 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 14:55:12 2019
@author: Furankyyy
"""
import numpy as np
import matplotlib.pyplot as plt
import timeit
###worst sort function###
#define the function that checks whether the list is in ascending order
def right_permutation(arr):
if len(arr)=... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Feb 11 14:55:12 2019\n\n@author: Furankyyy\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport timeit\n\n###worst sort function###\n\n#define the function that checks whether the list is in ascending order\ndef right_permutati... | false |
5,286 | e2572b48f7183353ba2aab0500130dc8a71a0b22 |
# coding: utf-8
# In[50]:
## Description
## Adds the Fibonacci numbers smaller than 4 million
## Weekly Journal
## When using while True, "break" MUST be used to avoid infinite loops
## Questions
## None
fib=[1,2]
counter=1
while True:
if fib[counter]>4000000:
flag=0
break
else:
f... | [
"\n# coding: utf-8\n\n# In[50]:\n\n\n## Description\n## Adds the Fibonacci numbers smaller than 4 million\n\n## Weekly Journal\n## When using while True, \"break\" MUST be used to avoid infinite loops\n\n## Questions\n## None\n\nfib=[1,2]\ncounter=1\nwhile True:\n if fib[counter]>4000000:\n flag=0\n ... | false |
5,287 | e8f05a66c642ef3b570130a2996ca27efb8b0cb5 | """Time client"""
import urllib.request
import json
from datetime import datetime
# make sure that module51-server.py service is running
TIME_URL = "http://localhost:5000/"
def ex51():
with urllib.request.urlopen(TIME_URL) as response:
body = response.read()
parsed = json.loads(body)
date = datet... | [
"\"\"\"Time client\"\"\"\n\nimport urllib.request\nimport json\nfrom datetime import datetime\n\n# make sure that module51-server.py service is running\nTIME_URL = \"http://localhost:5000/\"\n\ndef ex51():\n with urllib.request.urlopen(TIME_URL) as response:\n body = response.read()\n parsed = json.loa... | false |
5,288 | 829c833866198307d7d19c4a0cbe40299ee14eb9 | from botocore_eb.model import ServiceModel
from botocore_eb.exceptions import ParamValidationError
from botocore_eb.exceptions import DataNotFoundError
from botocore_eb.exceptions import OperationNotPageableError
from botocore_eb import xform_name
from botocore_eb.paginate import Paginator
import botocore_eb.validate
i... | [
"from botocore_eb.model import ServiceModel\nfrom botocore_eb.exceptions import ParamValidationError\nfrom botocore_eb.exceptions import DataNotFoundError\nfrom botocore_eb.exceptions import OperationNotPageableError\nfrom botocore_eb import xform_name\nfrom botocore_eb.paginate import Paginator\nimport botocore_eb... | false |
5,289 | ac6f2287390bdad8fe20cdc73c0063f685970cfb | import sys
n = int(input())
min_number = sys.maxsize
max_number = -sys.maxsize
for i in range(0, n):
num = int(input())
if num > max_number:
max_number = num
if num < min_number:
min_number = num
print(f"Max number: {max_number}")
print(f"Min number: {min_number}") | [
"import sys\r\n\r\nn = int(input())\r\nmin_number = sys.maxsize\r\nmax_number = -sys.maxsize\r\n\r\nfor i in range(0, n):\r\n num = int(input())\r\n if num > max_number:\r\n max_number = num\r\n\r\n if num < min_number:\r\n min_number = num\r\n\r\nprint(f\"Max number: {max_number}\")\r\nprint... | false |
5,290 | 7f406c1cd4d56da3a7d5f8739e0b65b0e61cf637 | import time
# Returns time in seconds for func(arg) to run
def time_func(func, arg):
start = time.time()
func(arg)
return time.time() - start
| [
"import time\n\n# Returns time in seconds for func(arg) to run\ndef time_func(func, arg):\n start = time.time()\n func(arg)\n return time.time() - start\n",
"import time\n\n\ndef time_func(func, arg):\n start = time.time()\n func(arg)\n return time.time() - start\n",
"<import token>\n\n\ndef t... | false |
5,291 | 46e2955756cf1aea902f31685b258ffd14b2e62b | # -*- coding: utf-8 -*-
# @Time : 2021/5/12 2:48 下午
# @Author : shaoguowen
# @Email : shaoguowen@tencent.com
# @FileName: train.py
# @Software: PyCharm
import argparse
from mmcv import Config
import trainers
# 解析传入的参数
parser = argparse.ArgumentParser(description='Train IVQA model')
parser.add_argument('config',... | [
"# -*- coding: utf-8 -*-\n# @Time : 2021/5/12 2:48 下午\n# @Author : shaoguowen\n# @Email : shaoguowen@tencent.com\n# @FileName: train.py\n# @Software: PyCharm\n\nimport argparse\nfrom mmcv import Config\nimport trainers\n\n# 解析传入的参数\nparser = argparse.ArgumentParser(description='Train IVQA model')\nparser.add_... | false |
5,292 | cb0b963c0e5aadcb67b5ee5f055fb9b6f21892fc | import pandemic as pd
from typing import Sequence
def save_gml(path: str, peers: Sequence[pd.Peer]) -> bool:
try:
with open(path, "w") as file:
file.write(graph(peers))
except Exception:
return True
return False
def print_gml(peers: Sequence[pd.Peer]) -> None:
print(grap... | [
"import pandemic as pd\nfrom typing import Sequence\n\n\ndef save_gml(path: str, peers: Sequence[pd.Peer]) -> bool:\n try:\n with open(path, \"w\") as file:\n file.write(graph(peers))\n except Exception:\n return True\n\n return False\n\n\ndef print_gml(peers: Sequence[pd.Peer]) ->... | false |
5,293 | 71a5ba520f8bc42e80d8f4ce8cf332bdd5fb96de | /Users/apple/miniconda3/lib/python3.7/sre_constants.py | [
"/Users/apple/miniconda3/lib/python3.7/sre_constants.py"
] | true |
5,294 | a8b5cf45e5f75ae4b493f5fc9bb4555319f1a725 | import pytest
from moa.primitives import NDArray, UnaryOperation, BinaryOperation, Function
from moa.yaccer import build_parser
@pytest.mark.parametrize("expression,result", [
("< 1 2 3>", NDArray(shape=(3,), data=[1, 2, 3], constant=False)),
])
def test_parse_vector(expression, result):
parser = build_parse... | [
"import pytest\n\nfrom moa.primitives import NDArray, UnaryOperation, BinaryOperation, Function\nfrom moa.yaccer import build_parser\n\n\n@pytest.mark.parametrize(\"expression,result\", [\n (\"< 1 2 3>\", NDArray(shape=(3,), data=[1, 2, 3], constant=False)),\n])\ndef test_parse_vector(expression, result):\n p... | false |
5,295 | 7ab9c530035185ee2250f3f6ce8cde87bdfd9803 | from django.conf.urls import url
from . import consumers
websocket_urlpatterns = [
url(r'^account/home', consumers.NotificationConsumer),
url(r'^fund/(?P<fund>[\w-]+)', consumers.NotificationConsumer),
url(r'^websockets', consumers.StreamConsumer),
] | [
"from django.conf.urls import url\n\nfrom . import consumers\n\nwebsocket_urlpatterns = [\n url(r'^account/home', consumers.NotificationConsumer),\n url(r'^fund/(?P<fund>[\\w-]+)', consumers.NotificationConsumer),\n url(r'^websockets', consumers.StreamConsumer),\n]",
"from django.conf.urls import url\nfr... | false |
5,296 | 011dd579bb076ec094e9e3085aa321883c484f1c | import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from WeatherDL.data_maker import dataset_maker
from WeatherDL.model_maker import model_3
# Extract data from data_maker
X, y = dataset_maker(window=5, forecast_day=1)
(X_train, X_test, y_train, y_test) = train_test_split(X, y, test_s... | [
"import matplotlib.pyplot as plt\nfrom sklearn.model_selection import train_test_split\n\nfrom WeatherDL.data_maker import dataset_maker\nfrom WeatherDL.model_maker import model_3\n\n# Extract data from data_maker\nX, y = dataset_maker(window=5, forecast_day=1)\n(X_train, X_test, y_train, y_test) = train_test_split... | false |
5,297 | 47f88bc3836490e08f464f71351096b54118420e | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.web_perf.metrics import timeline_based_metric
from telemetry.web_perf.metrics.trace_event_stats import TraceEventStats
from telemetry.web_per... | [
"# Copyright 2015 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\n\nfrom telemetry.web_perf.metrics import timeline_based_metric\nfrom telemetry.web_perf.metrics.trace_event_stats import TraceEventStats\nfrom telem... | false |
5,298 | 836c1d2083d18c68fe551278d2df4155edc64c8c | import cv2
import numpy as np
frameWidth = 640
frameHeight = 480
# capturing Video from Webcam
cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
cap.set(10, 150)
myColors = [[20,40,40,70,255,255],
[100,169,121,135,255,255],
[0, 90, 90, 41, 255, 255]]
color_value = [[25... | [
"import cv2\nimport numpy as np\n\nframeWidth = 640\nframeHeight = 480\n\n# capturing Video from Webcam\ncap = cv2.VideoCapture(0)\ncap.set(3, frameWidth)\ncap.set(4, frameHeight)\n\ncap.set(10, 150)\n\nmyColors = [[20,40,40,70,255,255],\n [100,169,121,135,255,255],\n [0, 90, 90, 41, 255, 255]... | false |
5,299 | afccd33e4c6bc5b7907a6af4ab698489fc9ea70d | from meross_iot.model.http.exception import HttpApiError
from logger import get_logger
from typing import Dict
from flask import Blueprint
from authentication import _user_login
from decorator import meross_http_api
from messaging import make_api_response
auth_blueprint = Blueprint('auth', __name__)
_LOGGER = get_... | [
"from meross_iot.model.http.exception import HttpApiError\n\nfrom logger import get_logger\nfrom typing import Dict\n\nfrom flask import Blueprint\n\nfrom authentication import _user_login\nfrom decorator import meross_http_api\nfrom messaging import make_api_response\n\n\nauth_blueprint = Blueprint('auth', __name_... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.