index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
5,700 | a17c448b068b28881f9d0c89be6037503eca3974 | import tensorflow.keras
from preprocessing_and_training.train import reshape_and_predict
import glob
""" Script for prediction - testing and importing the trained model from train.py """
def make_predictions(file_list, model, is_game=False):
""" Predictions with model that is locally saved
:param file_list:... | [
"import tensorflow.keras\nfrom preprocessing_and_training.train import reshape_and_predict\nimport glob\n\n\"\"\" Script for prediction - testing and importing the trained model from train.py \"\"\"\n\n\ndef make_predictions(file_list, model, is_game=False):\n \"\"\" Predictions with model that is locally saved\... | false |
5,701 | b3a2db38e2074b02c8837bfce85d06598a7b194d | #!/usr/bin/env python
import rospy
from op3_utils.op3_utils import *
from vision import *
import cv2
import sys
import rosnode
#Yellow >> Right
#Red >> Left
class States:
INIT = -1
GET_READY = 1
FIND_BAR = 2
WALK_2_BAR = 3
WALK_SIDEWAYS = 4
PICK_BAR = 5
WALK_WITH_BAR = 6
LIFT_BAR = 7
... | [
"#!/usr/bin/env python\n\nimport rospy\nfrom op3_utils.op3_utils import *\nfrom vision import *\nimport cv2\nimport sys\nimport rosnode\n\n#Yellow >> Right\n#Red >> Left\n\nclass States:\n INIT = -1\n GET_READY = 1\n FIND_BAR = 2\n WALK_2_BAR = 3\n WALK_SIDEWAYS = 4\n PICK_BAR = 5\n WALK_WITH_B... | false |
5,702 | b5160a2574dd2c4eec542d7aca8288da0feadaba | # Кицела Каролина ИВТ 3 курс
# Вариант 6
# Найти сумму всех чисел с плавающей точкой
b = ("name", " DeLorean DMC-12", "motor_pos", "rear", "n_of_wheels", 4,
"n_of_passengers", 2, "weight", 1.230, "height", 1.140, "length", 4.216,
"width", 1.857, "max_speed", 177)
print sum(b[9:16:2])
| [
"# Кицела Каролина ИВТ 3 курс \n# Вариант 6 \n# Найти сумму всех чисел с плавающей точкой\n\nb = (\"name\",\t\"\tDeLorean\tDMC-12\",\t\"motor_pos\",\t\"rear\",\t\"n_of_wheels\",\t4,\n\"n_of_passengers\",\t2,\t\"weight\",\t1.230,\t\"height\",\t1.140,\t\"length\",\t4.216,\n \"width\", 1.857, \"max_speed\", 177)\n\np... | true |
5,703 | 32fc0db68c32c2e644f9c1c2318fbeff41a0543d | import pygame
from pygame import Rect, Color
from pymunk import Body, Poly
from config import WIDTH, HEIGHT
class Ground:
def __init__ (self, space):
# size
self.w = WIDTH - 20
self.h = 25
# position
self.x = 10
self.y = HEIGHT - self.h
# pygame... | [
"import pygame\nfrom pygame import Rect, Color\n\nfrom pymunk import Body, Poly\n\nfrom config import WIDTH, HEIGHT\n\nclass Ground:\n\n def __init__ (self, space):\n \n # size\n self.w = WIDTH - 20\n self.h = 25\n\n # position\n self.x = 10\n self.y = HEIGHT - se... | false |
5,704 | aa17e22bc13436333b1db4aee41eeced373119a8 | from selenium import webdriver
import math
import time
browser = webdriver.Chrome()
website = 'http://suninjuly.github.io/find_link_text'
link_text = str(math.ceil(math.pow(math.pi, math.e)*10000))
browser.get(website)
find_link = browser.find_element_by_link_text(link_text)
find_link.click()
input_first_name = brow... | [
"from selenium import webdriver\nimport math\nimport time\n\nbrowser = webdriver.Chrome()\nwebsite = 'http://suninjuly.github.io/find_link_text'\nlink_text = str(math.ceil(math.pow(math.pi, math.e)*10000))\n\nbrowser.get(website)\nfind_link = browser.find_element_by_link_text(link_text)\nfind_link.click()\n\ninput_... | false |
5,705 | 2df679fc3407c15f5d0c006e9da8d1fc74bcf875 | from __future__ import unicode_literals
import json, alice_static
import logging
from random import choice
# Импортируем подмодули Flask для запуска веб-сервиса.
from flask import Flask, request
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
# Хранилище данных о сессиях.
sessionStorage = {}
# Задаем... | [
"from __future__ import unicode_literals\nimport json, alice_static\nimport logging\nfrom random import choice\n# Импортируем подмодули Flask для запуска веб-сервиса.\nfrom flask import Flask, request\napp = Flask(__name__)\n\n\nlogging.basicConfig(level=logging.DEBUG)\n\n# Хранилище данных о сессиях.\nsessionStora... | true |
5,706 | fe5050fdf010ce1c4d458b8a52ac92485a7d8cea | '''
Problem Description
Given two numbers n1 and n2
1. Find prime numbers between n1 and n2, then
2. Make all possible unique combinations of numbers from the prime
numbers list you found in step 1.
3. From this new list, again find all prime numbers.
4. Find smallest (a) and largest (b) number from the 2nd gener... | [
"'''\nProblem Description\nGiven two numbers n1 and n2\n\n1. Find prime numbers between n1 and n2, then\n\n2. Make all possible unique combinations of numbers from the prime \nnumbers list you found in step 1. \n\n3. From this new list, again find all prime numbers.\n\n4. Find smallest (a) and largest (b) number fr... | false |
5,707 | 55e743cb027d27cc6b668424c1584f27a8e8c51a | # Formatters example
#
# Requirements:
# Go to the ../hello_world directory and do: python prepare_data.py
#
# Instructions:
#
# Just run this file:
#
# python table.py
# Output:
# * standard input – text table
# * table.html
# * cross_table.html
#
from cubes import Workspace, create_forma... | [
"# Formatters example\n#\n# Requirements:\n# Go to the ../hello_world directory and do: python prepare_data.py\n#\n# Instructions:\n#\n# Just run this file:\n#\n# python table.py\n# Output:\n# * standard input – text table\n# * table.html\n# * cross_table.html\n#\n\nfrom cubes import Wo... | true |
5,708 | 97ca134ffce404f4b2bc7352d4aac73a7bb764bd | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | [
"# Copyright Materialize, Inc. and contributors. All rights reserved.\n#\n# Use of this software is governed by the Business Source License\n# included in the LICENSE file at the root of this repository.\n#\n# As of the Change Date specified in that file, in accordance with\n# the Business Source License, use of th... | false |
5,709 | bfc6f6acef26e3dc4f6bf2b76363daec68c53cd1 | # This file is part of the Adblock Plus web scripts,
# Copyright (C) 2006-present eyeo GmbH
#
# Adblock Plus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Adblock Plus is distributed in the hop... | [
"# This file is part of the Adblock Plus web scripts,\n# Copyright (C) 2006-present eyeo GmbH\n#\n# Adblock Plus is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3 as\n# published by the Free Software Foundation.\n#\n# Adblock Plus is distribute... | true |
5,710 | 002b795f61645ba2023cdb359167d2a65535d768 | /home/runner/.cache/pip/pool/f6/0b/37/37d1907955d15568c921a952a47d6e8fcc905cf4f36ab6f99f5fc7315a | [
"/home/runner/.cache/pip/pool/f6/0b/37/37d1907955d15568c921a952a47d6e8fcc905cf4f36ab6f99f5fc7315a"
] | true |
5,711 | 5fe81a6143642d671686c6623a9ecc93e04a82bf | try:
from setuptools import setup, find_packages
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name = "pip-utils",
version = "0.0.1",
url = 'https://github.com/mattpaletta/pip-utils',
packages = find_packages(),
inc... | [
"try:\n from setuptools import setup, find_packages\nexcept ImportError:\n import ez_setup\n\n ez_setup.use_setuptools()\n from setuptools import setup, find_packages\n\nsetup(\n name = \"pip-utils\",\n version = \"0.0.1\",\n url = 'https://github.com/mattpaletta/pip-utils',\n packages = fin... | false |
5,712 | 46b51f46f6ed73e3b9dc2f759535ba71facd2aae | import pandas as pd
import random
import math
# takes 2 row series and calculates the distances between them
def euclidean_dist(a: pd.Series, b: pd.Series):
diff = a.sub(other=b)
squares = diff ** 2
dist = 0
for feature_distance in squares:
if not math.isnan(feature_distance):
dis... | [
"import pandas as pd\nimport random\nimport math\n\n\n# takes 2 row series and calculates the distances between them\ndef euclidean_dist(a: pd.Series, b: pd.Series):\n diff = a.sub(other=b)\n squares = diff ** 2\n dist = 0\n\n for feature_distance in squares:\n if not math.isnan(feature_distance)... | false |
5,713 | 6dfd59bbab74a3a657d2200d62964578c296ee54 |
from ..utils import Object
class ChatMembersFilterAdministrators(Object):
"""
Returns the owner and administrators
Attributes:
ID (:obj:`str`): ``ChatMembersFilterAdministrators``
No parameters required.
Returns:
ChatMembersFilter
Raises:
:class:`telegram.Error`
... | [
"\n\nfrom ..utils import Object\n\n\nclass ChatMembersFilterAdministrators(Object):\n \"\"\"\n Returns the owner and administrators\n\n Attributes:\n ID (:obj:`str`): ``ChatMembersFilterAdministrators``\n\n No parameters required.\n\n Returns:\n ChatMembersFilter\n\n Raises:\n ... | false |
5,714 | e7bec9018f25ba9e3c3ae8a5bbe11f8bc4b54a04 | import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildou... | [
"import logging, os, zc.buildout, sys, shutil\n\nclass ZipEggs:\n def __init__(self, buildout, name, options):\n self.name, self.options = name, options\n if options['target'] is None:\n raise zc.buildout.UserError('Invalid Target')\n if options['source'] is None:\n rai... | true |
5,715 | 0b0ae6101fd80bdbcf37b935268f3e49230599fb | import cv2
print(cv2.__version__)
image = cv2.imread("download.jpeg", 1)
print(image)
print(image.shape)
print(image[0])
print("~~~~~~~~~~~~~~~")
print(image.shape[0])
print("~~~~~~~~~~~~~~~")
print(len(image)) | [
"import cv2\nprint(cv2.__version__)\n\nimage = cv2.imread(\"download.jpeg\", 1)\nprint(image)\nprint(image.shape)\n\nprint(image[0])\nprint(\"~~~~~~~~~~~~~~~\")\nprint(image.shape[0])\nprint(\"~~~~~~~~~~~~~~~\")\nprint(len(image))",
"import cv2\nprint(cv2.__version__)\nimage = cv2.imread('download.jpeg', 1)\nprin... | false |
5,716 | d957fd5fbcdcf2e549323677185eabb8a50536c6 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from contextlib import suppress
import asyncio
import shutil
from aiohttp import web
from bot import app
from var import var
from logger import update_logging_files
loop = asyncio.get_event_loop()
def import_handlers():
from deezer import handlers, callback_handle... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nfrom contextlib import suppress\nimport asyncio\nimport shutil\n\nfrom aiohttp import web\n\nfrom bot import app\nfrom var import var\nfrom logger import update_logging_files\n\nloop = asyncio.get_event_loop()\n\n\ndef import_handlers():\n from deezer import hand... | false |
5,717 | 8a4269f2094fa8ab8f6a93e653183dafb141232e | import re
from pathlib import Path
RAW_DUMP_XML = Path("raw_data/Wikipedia.xml")
def count_regexp():
"""Counts the occurences of the regular expressions you will write.
"""
# Here's an example regular expression that roughly matches a valid email address.
# The ones you write below should b... | [
"import re\r\nfrom pathlib import Path\r\n\r\nRAW_DUMP_XML = Path(\"raw_data/Wikipedia.xml\")\r\n\r\n\r\ndef count_regexp():\r\n \"\"\"Counts the occurences of the regular expressions you will write.\r\n \"\"\"\r\n # Here's an example regular expression that roughly matches a valid email address.\r\n # ... | false |
5,718 | 88dfb422b1c9f9a9a8f497e1dbba5598c2710e9b | import pygame
# import random
# import text_scroll
from os import path
img_dir = path.join(path.dirname(__file__), 'img')
# define screen and refresh rate
WIDTH = 720
HEIGHT = 720
FPS = 30
# define colors
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
YELLOW = (255, 255, 0)
BROWN = (165, ... | [
"import pygame\n# import random\n# import text_scroll\n\nfrom os import path\nimg_dir = path.join(path.dirname(__file__), 'img')\n\n# define screen and refresh rate\nWIDTH = 720\nHEIGHT = 720\nFPS = 30\n\n# define colors\nRED = (255, 0, 0)\nGREEN = (0, 255, 0)\nBLUE = (0, 0, 255)\nBLACK = (0, 0, 0)\nYELLOW = (255, ... | false |
5,719 | ccfcc5b644d592090786ceb35a85124c9d3275ad | # USAGE
# python predict_video.py --model model/activity.model --label-bin model/lb.pickle --input example_clips/lifting.mp4 --output output/lifting_128avg.avi --size 128
# python predict_video.py --model model/road_activity.model --label-bin model/rd.pickle --input example_clips/fire_footage.mp4 --ou
# tput output/fir... | [
"# USAGE\n# python predict_video.py --model model/activity.model --label-bin model/lb.pickle --input example_clips/lifting.mp4 --output output/lifting_128avg.avi --size 128\n# python predict_video.py --model model/road_activity.model --label-bin model/rd.pickle --input example_clips/fire_footage.mp4 --ou\n# tput ou... | false |
5,720 | 4015078ee9640c4558a4f29ebbb89f9098a31014 | from collections import Counter
import numpy as np
import random
import torch
import BidModel
from douzero.env.game import GameEnv
env_version = "3.2"
env_url = "http://od.vcccz.com/hechuan/env.py"
Card2Column = {3: 0, 4: 1, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7,
11: 8, 12: 9, 13: 10, 14: 11, 17: 12}
Nu... | [
"from collections import Counter\nimport numpy as np\nimport random\nimport torch\nimport BidModel\n\nfrom douzero.env.game import GameEnv\n\nenv_version = \"3.2\"\nenv_url = \"http://od.vcccz.com/hechuan/env.py\"\nCard2Column = {3: 0, 4: 1, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7,\n 11: 8, 12: 9, 13: 10,... | false |
5,721 | de1262da699a18266ad8673597391f625783a44d | # #writing a file
# fout = open('Session14/output.txt', 'w')
# line1 = "How many roads must a man walk down\n"
# fout.write(line1)
# line2 = "Before you call him a man?\n"
# fout.write(line2)
# #when you are done writing, you should close the file.
# fout.close()
# #if you dont close the file, it gets closed for you wh... | [
"# #writing a file\n# fout = open('Session14/output.txt', 'w')\n# line1 = \"How many roads must a man walk down\\n\"\n# fout.write(line1)\n# line2 = \"Before you call him a man?\\n\"\n# fout.write(line2)\n# #when you are done writing, you should close the file.\n# fout.close()\n# #if you dont close the file, it get... | false |
5,722 | a3382c3e6e04ccb87b1d55f072ce959b137f9fdd | # Generated by Django 2.2.7 on 2019-11-22 21:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Product', '0003_productimage'),
]
operations = [
migrations.RemoveField(
model_name='productimage',
name='comm... | [
"# Generated by Django 2.2.7 on 2019-11-22 21:09\r\n\r\nfrom django.db import migrations\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n dependencies = [\r\n ('Product', '0003_productimage'),\r\n ]\r\n\r\n operations = [\r\n migrations.RemoveField(\r\n model_name='product... | false |
5,723 | c0e349be45cd964e8e398baaed64eae792189dd1 | sentence = "Practice Problems to Drill List Comprehension in Your Head."
sentence = sentence.split()
sentence = [i.replace(".", "") for i in sentence]
[print(i) for i in sentence if len(i)<5] | [
"sentence = \"Practice Problems to Drill List Comprehension in Your Head.\"\nsentence = sentence.split()\nsentence = [i.replace(\".\", \"\") for i in sentence]\n[print(i) for i in sentence if len(i)<5]",
"sentence = 'Practice Problems to Drill List Comprehension in Your Head.'\nsentence = sentence.split()\nsenten... | false |
5,724 | b94392c9c6547415326d80ff0923cb8ba9251783 | # V0
class Codec:
def encode(self, strs):
s = ""
for i in strs:
s += str(len(i)) + "#" + i
return s
def decode(self, s):
i, str = 0, []
while i < len(s):
sharp = s.find("#", i)
l = int(s[i:sharp])
str.append(s[sharp + 1:sh... | [
"# V0 \nclass Codec:\n def encode(self, strs):\n s = \"\"\n for i in strs:\n s += str(len(i)) + \"#\" + i\n return s\n\n def decode(self, s):\n i, str = 0, []\n while i < len(s):\n sharp = s.find(\"#\", i)\n l = int(s[i:sharp])\n s... | false |
5,725 | 2e075c3ee6b245b1ffd0bb8c4e205199f794da76 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'ghou'
from datetime import datetime
bGameValid = True
dAskUserInfo = {}
gAccMode = 0
#============UserSyncResource2.py===================
#============前端资源热更白名单测试功能================
#============去读配置表config.xml==================
#============大于配置标号的热更内容只有... | [
"#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\n__author__ = 'ghou'\n\nfrom datetime import datetime\n\nbGameValid = True\ndAskUserInfo = {}\ngAccMode = 0\n\n\n\n#============UserSyncResource2.py===================\n\n#============前端资源热更白名单测试功能================\n#============去读配置表config.xml==================\n#===... | false |
5,726 | 5bbaffb35a89558b5cf0b4364f78d68ff2d69a01 | # from django.urls import path,include
from django.conf.urls import include, url
from . import views
urlpatterns = [
url('buy',views.BuyPage,name='BuyPage'),
url('sell',views.SellPage,name='SellPage'),
url('',views.TradePage,name='TradePage'),
]
| [
"# from django.urls import path,include\nfrom django.conf.urls import include, url\n\nfrom . import views\n\nurlpatterns = [\n url('buy',views.BuyPage,name='BuyPage'),\n url('sell',views.SellPage,name='SellPage'),\n url('',views.TradePage,name='TradePage'),\n]\n",
"from django.conf.urls import include, u... | false |
5,727 | 445e91edbeb88a3e300761342b28369fd9833fbb | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"# Copyright 2015 Google Inc. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\n# in compliance with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable ... | false |
5,728 | f6b38698dbed6c1a48faa86183b601f855a7f737 | {"filter":false,"title":"settings.py","tooltip":"/mysite/settings.py","undoManager":{"mark":53,"position":53,"stack":[[{"start":{"row":107,"column":13},"end":{"row":107,"column":16},"action":"remove","lines":["UTC"],"id":2},{"start":{"row":107,"column":13},"end":{"row":107,"column":23},"action":"insert","lines":["Asia/... | [
"{\"filter\":false,\"title\":\"settings.py\",\"tooltip\":\"/mysite/settings.py\",\"undoManager\":{\"mark\":53,\"position\":53,\"stack\":[[{\"start\":{\"row\":107,\"column\":13},\"end\":{\"row\":107,\"column\":16},\"action\":\"remove\",\"lines\":[\"UTC\"],\"id\":2},{\"start\":{\"row\":107,\"column\":13},\"end\":{\"r... | false |
5,729 | 0ddac0aac5bd001504ed37d31b74c6442304e350 | # coding: utf-8
"""
Adobe Experience Manager OSGI config (AEM) API
Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API # noqa: E501
OpenAPI spec version: 1.0.0-pre.0
Contact: opensource@shinesolutions.com
Generated by: https://openapi-generator... | [
"# coding: utf-8\n\n\"\"\"\n Adobe Experience Manager OSGI config (AEM) API\n\n Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API # noqa: E501\n\n OpenAPI spec version: 1.0.0-pre.0\n Contact: opensource@shinesolutions.com\n Generated by: https://... | false |
5,730 | 58c7e81d1b3cf1cff7d91bf40641e5a03b9f19ac | import argparse
import json
import os
import warnings
import numpy as np
import pandas as pd
import src.data_loaders as module_data
import torch
from sklearn.metrics import roc_auc_score
from src.data_loaders import JigsawDataBias, JigsawDataMultilingual, JigsawDataOriginal
from torch.utils.data import DataLoader
from... | [
"import argparse\nimport json\nimport os\nimport warnings\n\nimport numpy as np\nimport pandas as pd\nimport src.data_loaders as module_data\nimport torch\nfrom sklearn.metrics import roc_auc_score\nfrom src.data_loaders import JigsawDataBias, JigsawDataMultilingual, JigsawDataOriginal\nfrom torch.utils.data import... | false |
5,731 | 407f549cf68660c8f8535ae0bed373e2f54af877 | from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
class netdespatch_config(models.Model):
_name = 'netdespatch.config'
name = fields.Char(String='Name')
url = fields.Char(string='URL')
# Royal Mail
rm_enable = fields.Boolean('Enable Royal Mail')
domestic_name =... | [
"from odoo import models, fields, api, _\nimport odoo.addons.decimal_precision as dp\n\nclass netdespatch_config(models.Model):\n _name = 'netdespatch.config'\n name = fields.Char(String='Name')\n url = fields.Char(string='URL')\n\n # Royal Mail\n rm_enable = fields.Boolean('Enable Royal Mail')\n ... | false |
5,732 | 6d92b944ab8503d3635626c0c23021fc2b40dce3 | import random
def main():
#print('You rolled a die')
return random.randint(1,6)
if __name__== "__main__":
main()
| [
"import random\n\ndef main():\n #print('You rolled a die')\n return random.randint(1,6)\n\nif __name__== \"__main__\":\n main()\n",
"import random\n\n\ndef main():\n return random.randint(1, 6)\n\n\nif __name__ == '__main__':\n main()\n",
"<import token>\n\n\ndef main():\n return random.randint(1, 6... | false |
5,733 | fbac2d66f4d69a52c3df5d665b622659e4d8dacd | """
All rights reserved to cnvrg.io
http://www.cnvrg.io
cnvrg.io - Projects Example
last update: Nov 07, 2019.
-------------
rnn.py
==============================================================================
"""
import argparse
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow i... | [
"\"\"\"\nAll rights reserved to cnvrg.io\n http://www.cnvrg.io\n\ncnvrg.io - Projects Example\n\nlast update: Nov 07, 2019.\n-------------\nrnn.py\n==============================================================================\n\"\"\"\nimport argparse\n\nimport numpy as np\nimport pandas as pd\nimport tensorflo... | false |
5,734 | 892dd4259950c66669b21c5dbc7b738ddb5aa586 |
___ findmissingnumberusingxor(myarray
print "Given Array:", myarray
#print "Len of the Array:", len(myarray)
arraylen _ l..(myarray)
xorval _ 0
#print "In the First loop"
___ i __ r..(1, arraylen + 2
#print xorval,"^",i,"is",xorval^i
xorval _ xorval ^ i
#print "In t... | [
"\n___ findmissingnumberusingxor(myarray\n print \"Given Array:\", myarray\n #print \"Len of the Array:\", len(myarray)\n\tarraylen _ l..(myarray)\n\txorval _ 0\n #print \"In the First loop\"\n\t___ i __ r..(1, arraylen + 2\n #print xorval,\"^\",i,\"is\",xorval^i\n\t\txorval _ xo... | true |
5,735 | 9c9005acb40e4b89ca215345361e21f08f984847 | def h1_wrap(func):
def func_wrapper(param):
return "<h1>"+func(param) + "</h1>"
return func_wrapper
@h1_wrap
def say_hi(name):
return "Hello, " + name.capitalize()
print(say_hi("Stephan"))
| [
"def h1_wrap(func):\n def func_wrapper(param):\n return \"<h1>\"+func(param) + \"</h1>\"\n return func_wrapper\n\n\n@h1_wrap\ndef say_hi(name):\n return \"Hello, \" + name.capitalize()\n\n\nprint(say_hi(\"Stephan\"))\n",
"def h1_wrap(func):\n\n def func_wrapper(param):\n return '<h1>' + ... | false |
5,736 | 66c2d73c100f7fc802e66f2762c92664e4b93fcd | from sklearn.model_selection import train_test_split
from azureml.core import Run
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import argparse
import os
import joblib
import numpy as np
# Get the experiment run context
run = Run.get_context()
# Get arguments
parser = argparse.ArgumentParse... | [
"from sklearn.model_selection import train_test_split\nfrom azureml.core import Run\nfrom sklearn.ensemble import RandomForestClassifier\nimport pandas as pd\nimport argparse\nimport os\nimport joblib\nimport numpy as np\n\n\n# Get the experiment run context\nrun = Run.get_context()\n\n# Get arguments\nparser = arg... | false |
5,737 | 21b9844fce10d16a14050a782ce7e15e3f6fb657 | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Country, TouristPlaces, Users
# Create database and create a shortcut for easier to update database
engine = create_engine('sqlite:///country_catalog.db')
Base.metadata.bind = engine
DBSession = sessionmaker(b... | [
"from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\nfrom database_setup import Base, Country, TouristPlaces, Users\n\n# Create database and create a shortcut for easier to update database\nengine = create_engine('sqlite:///country_catalog.db')\nBase.metadata.bind = engine\nDBSession = se... | false |
5,738 | 2506c5b042f04d1490ba2199a71e38829d4a0adc | from dataclasses import dataclass
from typing import Optional
@dataclass
class Music(object):
url: str
title: Optional[str] = None
| [
"from dataclasses import dataclass\nfrom typing import Optional\n\n\n@dataclass\nclass Music(object):\n url: str\n title: Optional[str] = None\n",
"<import token>\n\n\n@dataclass\nclass Music(object):\n url: str\n title: Optional[str] = None\n",
"<import token>\n<class token>\n"
] | false |
5,739 | a61132d2d504ed31d4e1e7889bde670853968559 | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft, Intel Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------... | [
"#!/usr/bin/env python\n# -------------------------------------------------------------------------\n# Copyright (c) Microsoft, Intel Corporation. All rights reserved.\n# Licensed under the MIT License. See License.txt in the project root for\n# license information.\n# ----------------------------------------------... | false |
5,740 | 32db21ed7f57f29260d70513d8c34de53adf12d7 | import time,pickle
from CNN_GPU.CNN_C_Wrapper import *
from pathlib import Path
FSIGMOIG = 0
FTANH = 2
FRELU = 4
REQUEST_INPUT = 0
REQUEST_GRAD_INPUT = 1
REQUEST_OUTPUT = 2
REQUEST_WEIGTH = 3
class CNN:
def __init__(self, inputSize, hitLearn=.1, momentum=.9, weigthDecay=.5, multip=1.0):
file = '%s/%s' %... | [
"import time,pickle\nfrom CNN_GPU.CNN_C_Wrapper import *\nfrom pathlib import Path\n\nFSIGMOIG = 0\nFTANH = 2\nFRELU = 4\n\nREQUEST_INPUT = 0\nREQUEST_GRAD_INPUT = 1\nREQUEST_OUTPUT = 2\nREQUEST_WEIGTH = 3\n\nclass CNN:\n def __init__(self, inputSize, hitLearn=.1, momentum=.9, weigthDecay=.5, multip=1.0):\n ... | false |
5,741 | 0de27101675eb8328d9a2831ed468a969b03e7d3 | import sys
prop = float(sys.argv[1])
def kind(n):
s = str(n)
l = len(s)
i = 0
j = i + 1
decr, bouncy, incr = False, False, False
while j < l:
a = int(s[i])
b = int(s[j])
if s[i] > s[j]:
decr = True
elif s[i] < s[j]:
incr = True
i += 1
j += 1
if decr and incr:
retu... | [
"import sys\n\nprop = float(sys.argv[1])\n\ndef kind(n):\n s = str(n)\n l = len(s)\n i = 0\n j = i + 1\n decr, bouncy, incr = False, False, False\n while j < l:\n a = int(s[i])\n b = int(s[j])\n if s[i] > s[j]:\n decr = True\n elif s[i] < s[j]:\n incr = True\n i += 1\n j += 1\n if... | false |
5,742 | 92529c4d4c33a7473773f081f730e64bae4d7f54 | # This Python file uses the following encoding: utf-8
import json
import os
import logging
from .utility_helper import (
check_path,
)
from .formats import (
OUTPUT_FORMATS,
FORMATS
)
class OptionsManager(object):
"""
This clas is responsible for storing & retrieving the options.
Args:
... | [
"# This Python file uses the following encoding: utf-8\n\nimport json \nimport os\nimport logging\n\nfrom .utility_helper import (\n check_path,\n)\n\nfrom .formats import (\n OUTPUT_FORMATS,\n FORMATS\n)\n\nclass OptionsManager(object):\n \"\"\"\n This clas is responsible for storing & retrieving th... | false |
5,743 | 464980a2f17aeedfa08548d6c4e247f8c047e2cb | # Generated by Django 3.2.3 on 2021-07-24 12:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0018_userprofile_membership_fee_pending'),
]
operations = [
migrations.RenameField(
model_name='userprofile',
ol... | [
"# Generated by Django 3.2.3 on 2021-07-24 12:14\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('profiles', '0018_userprofile_membership_fee_pending'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='userprofil... | false |
5,744 | 0b42f458097d11d66160bcb8e706ccb9b5c4682a | def K_Wilson(w, Tr, Pr):
# Inserting necessary libraries
import numpy as np
# Calculating K-value using Wilson correlation
K_value_Output = (1 / Pr) * np.exp(5.37 * (1 + w) * (1 - 1 / Tr))
# Returning output value
return K_value_Output | [
"def K_Wilson(w, Tr, Pr):\r\n \r\n # Inserting necessary libraries\r\n import numpy as np\r\n \r\n # Calculating K-value using Wilson correlation\r\n K_value_Output = (1 / Pr) * np.exp(5.37 * (1 + w) * (1 - 1 / Tr))\r\n \r\n # Returning output value\r\n return K_value_Output",
"def K_Wi... | false |
5,745 | 76420ec1b37d4b9b85f35764a7f8a0e1f19a15dd | import boring.dialog
import boring.form
FORMSTRING = '''
Project name@string
Width@int|Height@int
Background color@color
Fullscreen@check
'''
class NewProjectWindow(boring.dialog.DefaultDialog):
def __init__(self, master, _dict=None):
self._dict = _dict
self.output = None
boring.dialog.Def... | [
"import boring.dialog\nimport boring.form\n\nFORMSTRING = '''\nProject name@string\nWidth@int|Height@int\nBackground color@color\nFullscreen@check\n'''\n\nclass NewProjectWindow(boring.dialog.DefaultDialog):\n def __init__(self, master, _dict=None):\n self._dict = _dict\n self.output = None\n ... | false |
5,746 | 2d444c00e4dbdcb143d19752cd1a751169de73d3 | import sys
import os
import csv
import urllib2, socket, time
import gzip, StringIO
import re, random, types
from bs4 import BeautifulSoup
from datetime import datetime
import json
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def ... | [
"import sys\nimport os\nimport csv\nimport urllib2, socket, time\nimport gzip, StringIO\nimport re, random, types\nfrom bs4 import BeautifulSoup\nfrom datetime import datetime\nimport json\nfrom HTMLParser import HTMLParser\n\nclass MLStripper(HTMLParser):\n def __init__(self):\n self.reset()\n sel... | true |
5,747 | d5acde6c6139833c6631a2d88a181cd019d3d2da | #Charlie Quinn if.py
#Check < in an 'if' statement
#use a 'while' loop to make testing easier
def income_input(prompt_message):
prompt = prompt_message + ' '
temp = input(prompt)
#get input from user
return float(temp)
do_again = 'y'
while do_again =='y':
income = income_input("\nHow much did ... | [
"#Charlie Quinn if.py\n#Check < in an 'if' statement\n#use a 'while' loop to make testing easier\n\ndef income_input(prompt_message):\n\n prompt = prompt_message + ' '\n temp = input(prompt)\n #get input from user\n return float(temp)\n\n\ndo_again = 'y'\n\n\nwhile do_again =='y':\n income = income_i... | false |
5,748 | 8d8c211895fd43b1e2a38216693b0c00f6f76756 | #Main thread for starting the gui
import cv2
import PIL
from PIL import Image,ImageTk
from tkinter import *
from matplotlib import pyplot as pt
from matplotlib.image import imread
from control.control import Control
control=Control()
#gives the indtruction for saving the current frame
def takePicture():
global s... | [
"#Main thread for starting the gui\n\nimport cv2\nimport PIL\nfrom PIL import Image,ImageTk\nfrom tkinter import *\n\nfrom matplotlib import pyplot as pt\nfrom matplotlib.image import imread\nfrom control.control import Control\ncontrol=Control()\n\n#gives the indtruction for saving the current frame\ndef takePictu... | false |
5,749 | 276d7ac493ddcb327dbce279d9f4bc8a74c98245 | __author__ = 'Jager'
from equipment import Equipment
class Weapon (Equipment):
def __init__(self, name, power):
super(Weapon, self).__init__(name)
self.power = power
@staticmethod
def fromJSON(jsonstr):
obj = Equipment.fromJSON(jsonstr)
return Weapon(obj["name"], obj["powe... | [
"__author__ = 'Jager'\nfrom equipment import Equipment\n\n\nclass Weapon (Equipment):\n def __init__(self, name, power):\n super(Weapon, self).__init__(name)\n self.power = power\n\n @staticmethod\n def fromJSON(jsonstr):\n obj = Equipment.fromJSON(jsonstr)\n return Weapon(obj[\... | false |
5,750 | c847e7abe36b62c4518bb535789064e22b5f1db7 | import pymel.core as pm
from alShaders import *
class AEalLayerColorTemplate(alShadersTemplate):
controls = {}
params = {}
def setup(self):
self.params.clear()
self.params["layer1"] = Param("layer1", "Layer 1", "The background layer (will be blended over black if its alpha is not 1.", "rgb", presets=None)
sel... | [
"import pymel.core as pm\nfrom alShaders import *\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n\tcontrols = {}\n\tparams = {}\n\tdef setup(self):\n\t\tself.params.clear()\n\t\tself.params[\"layer1\"] = Param(\"layer1\", \"Layer 1\", \"The background layer (will be blended over black if its alpha is not 1.\"... | false |
5,751 | b07d042c61e9e6647822989444e72db2e01c64d0 | # Generated by Django 3.0.3 on 2020-02-09 06:29
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('devices_collect', '0004_auto_20200209_1304'),
]
operations = [
migrations.AlterField(
... | [
"# Generated by Django 3.0.3 on 2020-02-09 06:29\n\nimport datetime\nfrom django.db import migrations, models\nfrom django.utils.timezone import utc\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('devices_collect', '0004_auto_20200209_1304'),\n ]\n\n operations = [\n migr... | false |
5,752 | da2b946238b429188fe3fa50286658d4b5cdbf41 | import krait
from ctrl import ws
krait.mvc.set_init_ctrl(ws.WsPageController())
| [
"import krait\nfrom ctrl import ws\n\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n",
"import krait\nfrom ctrl import ws\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n",
"<import token>\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n",
"<import token>\n<code token>\n"
] | false |
5,753 | d6213698423902771011caf6b5206dd4e3b27450 | import numpy as np
a = np.ones((3,4))
b = np.ones((4,1))
# a.shape = (3,4)
# b.shape = (4,1)
c = np.zeros_like(a)
for i in range(3):
for j in range(4):
c[i][j] = a[i][j] + b[j]
print(c)
d = a+b.T
print(d)
| [
"import numpy as np\n\na = np.ones((3,4))\nb = np.ones((4,1))\n# a.shape = (3,4)\n# b.shape = (4,1)\n\nc = np.zeros_like(a)\n\nfor i in range(3):\n for j in range(4):\n c[i][j] = a[i][j] + b[j]\n\nprint(c)\n\nd = a+b.T\nprint(d)\n",
"import numpy as np\na = np.ones((3, 4))\nb = np.ones((4, 1))\nc = np.zeros_l... | false |
5,754 | ab343f88c84d45cf90bddd52623362f047c72d3c | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-18 07:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0008_alter_user_username_max_length'),
]
operations = [... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.11.6 on 2017-10-18 07:31\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ('auth', '0008_alter_user_username_max_length'),\n ]\n... | false |
5,755 | 00c57e7e26a3181ab23697a25257aca479d9ee05 | frase = "todos somos promgramadores"
palabras = frase.split()
for p in palabras:
print(palabras[p])
#if p[-2] == "o":
| [
"frase = \"todos somos promgramadores\"\r\npalabras = frase.split()\r\nfor p in palabras:\r\n print(palabras[p])\r\n\r\n\r\n #if p[-2] == \"o\":\r\n \r\n ",
"frase = 'todos somos promgramadores'\npalabras = frase.split()\nfor p in palabras:\n print(palabras[p])\n",
"<assignment token>\nfo... | false |
5,756 | 468b5bd8d7b045ca8dd46c76a1829fc499e16950 | import time
import ephem
import serial
import nmea
import orientation
import sys
import threading
from geomag import geomag
#Constants
initial_az = 180
initial_alt = 90
min_elevation = 10.0
sleep_time = 1.0
unwind_threshold = 180
sleep_on_unwind = 45.0
last_lon = '-88.787'
last_lat = '41.355'
last_heading = 0.0
moun... | [
"import time\nimport ephem\nimport serial\nimport nmea\nimport orientation\nimport sys\nimport threading\nfrom geomag import geomag\n\n#Constants\ninitial_az = 180\ninitial_alt = 90\nmin_elevation = 10.0\nsleep_time = 1.0\nunwind_threshold = 180\nsleep_on_unwind = 45.0\n\nlast_lon = '-88.787'\nlast_lat = '41.355'\n... | false |
5,757 | e82b9aa0f7dc669b3d5622c093b766c7e168221c | import mxnet as mx
import numpy as np
import logging
# Example performance:
# INFO:root:Epoch[34] Train-accuracy=0.601388
# INFO:root:Epoch[34] Validation-accuracy=0.620949
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# running device
dev = mx.gpu()
# batch size and input shape
batch_size = 64
data_sh... | [
"import mxnet as mx\nimport numpy as np\nimport logging\n\n# Example performance:\n# INFO:root:Epoch[34] Train-accuracy=0.601388\n# INFO:root:Epoch[34] Validation-accuracy=0.620949\n\nlogger = logging.getLogger()\nlogger.setLevel(logging.DEBUG)\n\n# running device\ndev = mx.gpu()\n# batch size and input shape\nbatc... | false |
5,758 | d1200006b8d7a18b11b01eff4fbf38d9dfd8958e | t = int(input())
while t:
x = list(map(int, input().split()))
x.sort()
if(x[0]+x[1]==x[2]):
print("YES")
else:
print("NO")
t-=1 | [
"t = int(input())\r\nwhile t:\r\n\tx = list(map(int, input().split()))\r\n\tx.sort()\r\n\tif(x[0]+x[1]==x[2]):\r\n\t\tprint(\"YES\")\r\n\telse:\r\n\t\tprint(\"NO\")\r\n\tt-=1",
"t = int(input())\nwhile t:\n x = list(map(int, input().split()))\n x.sort()\n if x[0] + x[1] == x[2]:\n print('YES')\n ... | false |
5,759 | f563bb5bb32d3653d8a4115c75eda80b676ae3c6 | import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# Version: major.minor.patch
VERSION = "1.0.1"
REQUIREMENTS = (HERE / "requirements.txt").read_text()
REQUIREMENTS = REQUIREME... | [
"import pathlib\nfrom setuptools import setup\n\n# The directory containing this file\nHERE = pathlib.Path(__file__).parent\n\n# The text of the README file\nREADME = (HERE / \"README.md\").read_text()\n\n# Version: major.minor.patch\nVERSION = \"1.0.1\"\n\nREQUIREMENTS = (HERE / \"requirements.txt\").read_text()\n... | false |
5,760 | d5d31920f7fd4ed2913c5880dba61c2015181be9 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 22:28:30 2019
@author: donsdev
"""
arr = []
sub = []
n = int(input())
while n > 0:
arr.append(n)
n-=1
while len(arr) + len(sub) > 1:
while len(arr) > 1:
arr.pop()
sub.append(arr.pop())
arr = sub[::-1] + arr
su... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jan 17 22:28:30 2019\n\n@author: donsdev\n\"\"\"\n\narr = []\nsub = []\nn = int(input())\nwhile n > 0:\n arr.append(n)\n n-=1\nwhile len(arr) + len(sub) > 1:\n while len(arr) > 1:\n arr.pop()\n sub.append(arr.pop())\n ... | false |
5,761 | b25e9374458ead85535495e77a5c64117a8b1808 | """
You have a number and you need to determine which digit in this number is the biggest.
Input: A positive int.
Output: An Int (0-9).
Example:
max_digit(0) == 0
max_digit(52) == 5
max_digit(634) == 6
max_digit(10000) == 1
"""
def max_digit(number: int) -> int:
return max(int(i) for i in str(number))
print(m... | [
"\"\"\"\nYou have a number and you need to determine which digit in this number is the biggest.\n\nInput: A positive int.\nOutput: An Int (0-9).\n\nExample:\n\nmax_digit(0) == 0\nmax_digit(52) == 5\nmax_digit(634) == 6\nmax_digit(10000) == 1\n\"\"\"\n\n\ndef max_digit(number: int) -> int:\n return max(int(i) for... | false |
5,762 | 7fb568880c40895870a0c541d9a88a8070a79e5b | import datetime
# weightloss script
currentWeight = 73
goalWeight = 67
avgKgPerWeek = 0.45
startDate = datetime.date.today()
endDate = startDate
while currentWeight > goalWeight:
# adding 7 days to simulate a week passing
endDate += datetime.timedelta(days=7)
currentWeight -= avgKgPerWeek
print... | [
"import datetime\n\n# weightloss script\ncurrentWeight = 73\ngoalWeight = 67\navgKgPerWeek = 0.45\n\nstartDate = datetime.date.today()\nendDate = startDate\n\nwhile currentWeight > goalWeight:\n\n # adding 7 days to simulate a week passing\n endDate += datetime.timedelta(days=7)\n currentWeight -= avgKgPer... | false |
5,763 | 93b00b5c1bec38d2a4ac109f1533d3c0d9e99044 | n = input("Enter a number: ")
def fact(num):
factorial = 1
if int(num) >= 1:
for i in range (1,int(n)+1):
factorial = factorial * i
return factorial
print(fact(n)) | [
"n = input(\"Enter a number: \")\n\ndef fact(num):\n factorial = 1\n if int(num) >= 1:\n for i in range (1,int(n)+1):\n factorial = factorial * i\n return factorial\n\nprint(fact(n))",
"n = input('Enter a number: ')\n\n\ndef fact(num):\n factorial = 1\n if int(num) >= 1:\n ... | false |
5,764 | db9919ab15988828d24b4430a124841f225860cc | from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
import cryptography.hazmat.primitives.ciphers as ciphers
import struct
import secrets
import random
from typing import List
LOCO_PUBLICKEY = serializ... | [
"from cryptography.hazmat.primitives import serialization\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives.asymmetric import padding\nimport cryptography.hazmat.primitives.ciphers as ciphers\nimport struct\nimport secrets\nimport random\n\nfrom typing import List\n\nLOCO_PUBLI... | false |
5,765 | 81cec5c1f28e92bf8e4adc2e2c632e072ed1f901 | # 1장 말뭉치와 워드넷 - 외부 말뭉치 다운로드, 로드하고 액세스하기
from nltk.corpus import CategorizedPlaintextCorpusReader
from random import randint
# 말뭉치 읽기
reader = CategorizedPlaintextCorpusReader(r'/workspace/NLP_python/tokens', r'.*\.txt', cat_pattern=r'(\w+)/*')
print(reader.categories())
print(reader.fileids())
# 샘플 문서 출력
# pos, neg 카... | [
"# 1장 말뭉치와 워드넷 - 외부 말뭉치 다운로드, 로드하고 액세스하기\nfrom nltk.corpus import CategorizedPlaintextCorpusReader\nfrom random import randint\n\n# 말뭉치 읽기\nreader = CategorizedPlaintextCorpusReader(r'/workspace/NLP_python/tokens', r'.*\\.txt', cat_pattern=r'(\\w+)/*')\nprint(reader.categories())\nprint(reader.fileids())\n\n# 샘플 문서... | false |
5,766 | fe1c499efe492dbd4f5c9b99bd6339c503c7902b | import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file, rmdir
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
requi... | [
"import os\nfrom conan import ConanFile\nfrom conan.tools.build import check_min_cppstd\nfrom conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout\nfrom conan.tools.files import copy, get, replace_in_file, rmdir\nfrom conan.tools.scm import Version\nfrom conan.errors import ConanInvalidConfigura... | false |
5,767 | 9f760c0cf2afc746a1fc19ac68d1b2f406c7efe1 | from elasticsearch import Elasticsearch, helpers
from bso.server.main.config import ES_LOGIN_BSO_BACK, ES_PASSWORD_BSO_BACK, ES_URL
from bso.server.main.decorator import exception_handler
from bso.server.main.logger import get_logger
client = None
logger = get_logger(__name__)
@exception_handler
def get_client():
... | [
"from elasticsearch import Elasticsearch, helpers\n\nfrom bso.server.main.config import ES_LOGIN_BSO_BACK, ES_PASSWORD_BSO_BACK, ES_URL\nfrom bso.server.main.decorator import exception_handler\nfrom bso.server.main.logger import get_logger\n\nclient = None\nlogger = get_logger(__name__)\n\n\n@exception_handler\ndef... | false |
5,768 | ea4a55ed17c5cc2c6f127112af636ca885159c86 | n=int(input("please enter the number : "))
for i in range(11):
print(n," X ",i," = ",n*i) | [
"n=int(input(\"please enter the number : \"))\nfor i in range(11):\n print(n,\" X \",i,\" = \",n*i)",
"n = int(input('please enter the number : '))\nfor i in range(11):\n print(n, ' X ', i, ' = ', n * i)\n",
"<assignment token>\nfor i in range(11):\n print(n, ' X ', i, ' = ', n * i)\n",
"<assignmen... | false |
5,769 | 86e97e7eaf0d23ccf4154b5ffc853c5aee966326 | import random
from datetime import datetime
from slackbot.bot import respond_to
from .term_model import Term, Response
from ..botmessage import botsend, botwebapi
# すでに存在するコマンドは無視する
RESERVED = (
'drive', 'manual', 'jira', 'wikipedia', 'plusplus',
'translate', '翻訳',
'weather', '天気',
'term',
'shuff... | [
"import random\nfrom datetime import datetime\n\nfrom slackbot.bot import respond_to\n\nfrom .term_model import Term, Response\nfrom ..botmessage import botsend, botwebapi\n\n# すでに存在するコマンドは無視する\nRESERVED = (\n 'drive', 'manual', 'jira', 'wikipedia', 'plusplus',\n 'translate', '翻訳',\n 'weather', '天気',\n ... | false |
5,770 | 43dc69c66d94d85337c11eb4cfed48d7fdef2074 | # Generated by Django 3.0.8 on 2020-08-11 13:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipe', '0006_recipe_description'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='portions',
... | [
"# Generated by Django 3.0.8 on 2020-08-11 13:43\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('recipe', '0006_recipe_description'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='recipe',\n n... | false |
5,771 | 1a66e7f59ada43deb8e28b9806dc4fb9be4ae247 | # 同一目录下的引用调用还是随意导入使用的
# 跨包使用就需要使用TwoUsage里面的两种方式。
import Importex
Importex.atest()
| [
"# 同一目录下的引用调用还是随意导入使用的\n# 跨包使用就需要使用TwoUsage里面的两种方式。\n\nimport Importex\n\nImportex.atest()\n",
"import Importex\nImportex.atest()\n",
"<import token>\nImportex.atest()\n",
"<import token>\n<code token>\n"
] | false |
5,772 | d145f4c061c8f364756012832a07adc305e35e5c | # Generated by Django 3.2.5 on 2021-07-27 17:12
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', ... | [
"# Generated by Django 3.2.5 on 2021-07-27 17:12\r\n\r\nfrom django.db import migrations, models\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n initial = True\r\n\r\n dependencies = [\r\n ]\r\n\r\n operations = [\r\n migrations.CreateModel(\r\n name='Category',\r\n ... | false |
5,773 | 4e715ccb4f95e7fe7e495a1181ad5df530f5a53f | from torchtext import data
from torchtext import datasets
import re
import spacy
spacy_de = spacy.load('de')
spacy_en = spacy.load('en')
url = re.compile('(<url>.*</url>)')
def tokenize_de(text):
return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]
def tokenize_en(text):
return [tok.te... | [
"from torchtext import data\nfrom torchtext import datasets\n\nimport re\nimport spacy\n\nspacy_de = spacy.load('de')\nspacy_en = spacy.load('en')\n\nurl = re.compile('(<url>.*</url>)')\n\n\ndef tokenize_de(text):\n return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]\n\n\ndef tokenize_en(text... | false |
5,774 | 1651865f120ba4fe440549567a8d9903e5455788 | #!/usr/bin/env python
import argparse
import sys
import logging
import vafator
from vafator.power import DEFAULT_FPR, DEFAULT_ERROR_RATE
from vafator.hatchet2bed import run_hatchet2bed
from vafator.ploidies import PloidyManager
from vafator.annotator import Annotator
from vafator.multiallelic_filter import Mul... | [
"#!/usr/bin/env python\r\nimport argparse\r\nimport sys\r\nimport logging\r\nimport vafator\r\nfrom vafator.power import DEFAULT_FPR, DEFAULT_ERROR_RATE\r\nfrom vafator.hatchet2bed import run_hatchet2bed\r\nfrom vafator.ploidies import PloidyManager\r\nfrom vafator.annotator import Annotator\r\nfrom vafator.multial... | false |
5,775 | 31f302775ef19a07137622ef9d33495cc2a8eed2 | #pymongo and mongo DB search is like by line inside in a document then it moves to the other document
from enum import unique
import pymongo
from pymongo import MongoClient
MyClient = MongoClient() # again this is connecting to deault host and port
db = MyClient.mydatabase #db is a variable to store the database ... | [
"#pymongo and mongo DB search is like by line inside in a document then it moves to the other document\nfrom enum import unique\n\nimport pymongo\nfrom pymongo import MongoClient\n\nMyClient = MongoClient() # again this is connecting to deault host and port\n\ndb = MyClient.mydatabase #db is a variable to store ... | false |
5,776 | 0bc72a558b9bd3b5f74ce5dfce586dd66c579710 | import sys
import os
import json
from collections import OrderedDict
from config import folder, portfolio_value
from datetime import datetime
import logging
# Logger setup
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def valid_date(datestring):
""" Determine if something is a valid... | [
"import sys\nimport os\nimport json\nfrom collections import OrderedDict\nfrom config import folder, portfolio_value\nfrom datetime import datetime\nimport logging\n# Logger setup\nlogger = logging.getLogger(__name__)\nlogging.basicConfig(level=logging.INFO)\n\n\ndef valid_date(datestring):\n \"\"\" Determine if... | false |
5,777 | 23a4ca8eec50e6ab72be3f1b1077c61f676b3cce | """Command 'run' module."""
import click
from loguru import logger
from megalus.main import Megalus
@click.command()
@click.argument("command", nargs=1, required=True)
@click.pass_obj
def run(meg: Megalus, command: str) -> None:
"""Run selected script.
:param meg: Megalus instance
:param command: comma... | [
"\"\"\"Command 'run' module.\"\"\"\n\nimport click\nfrom loguru import logger\n\nfrom megalus.main import Megalus\n\n\n@click.command()\n@click.argument(\"command\", nargs=1, required=True)\n@click.pass_obj\ndef run(meg: Megalus, command: str) -> None:\n \"\"\"Run selected script.\n\n :param meg: Megalus inst... | false |
5,778 | 488c111c051796b481794678cb04108fcf11ac39 | import sys
import bisect
t = int(raw_input())
for i in xrange(1, t+1):
n, k = map(int, raw_input().strip().split())
s = [n]
for j in xrange(k):
num = s.pop()
if num % 2 != 0:
ls = num/2
lr = num/2
if ls != 0:
bisect.insort_left(s,ls)
bisect.insort_left(s,lr)
else:
... | [
"import sys\nimport bisect\n\nt = int(raw_input())\n\nfor i in xrange(1, t+1):\n n, k = map(int, raw_input().strip().split())\n s = [n]\n for j in xrange(k):\n num = s.pop()\n if num % 2 != 0:\n ls = num/2\n lr = num/2\n if ls != 0:\n bisect.insort_left(s,ls)\n bisect.insort_le... | true |
5,779 | 31304c3b0f41b848a36115f1ef098a2104c170ac | import itertools
import math
def score(stack):
syrup = math.pi * max(x[0] for x in stack)**2
for item in stack:
syrup += 2*math.pi*item[0]*item[1]
return syrup
def ring_score(item):
return 2*math.pi*item[0]*item[1]
def solve(pancakes, k):
return max(itertools.combin... | [
"import itertools\r\n\r\nimport math\r\n\r\ndef score(stack):\r\n syrup = math.pi * max(x[0] for x in stack)**2\r\n\r\n for item in stack:\r\n syrup += 2*math.pi*item[0]*item[1]\r\n\r\n return syrup\r\n\r\n\r\ndef ring_score(item):\r\n return 2*math.pi*item[0]*item[1]\r\n\r\n\r\ndef solve(pancake... | false |
5,780 | cb9ea8791009a29a24a76bc2b161e7f8599fec1b | """
definition of a sensor
"""
import datetime
import pytz
class tlimit:
def __init__(self, name, text):
self.name = name
self.text = text
time_limit = [
tlimit("All", "All Data"),
tlimit("day", "Current day"),
tlimit("24hours", "Last 24 hours"),
tlimit("3days", "Three last days"... | [
"\"\"\"\ndefinition of a sensor\n\"\"\"\nimport datetime\nimport pytz\n\nclass tlimit:\n\n def __init__(self, name, text):\n self.name = name\n self.text = text\n\n\ntime_limit = [\n tlimit(\"All\", \"All Data\"),\n tlimit(\"day\", \"Current day\"),\n tlimit(\"24hours\", \"Last 24 hours\")... | false |
5,781 | 720d37e35eb335cc68ff27763cfe5c52f76b98d2 | /home/sbm367/anaconda3/lib/python3.5/types.py | [
"/home/sbm367/anaconda3/lib/python3.5/types.py"
] | true |
5,782 | a0284eba1a0e6c498f240068c586e7f8b79cd86c | """Exercise 9c"""
import time
import numpy as np
import matplotlib.pyplot as plt
from plot_results import plot_2d
from run_simulation import run_simulation
from simulation_parameters import SimulationParameters
def exercise_9c(world, timestep, reset):
"""Exercise 9c"""
n_joints = 10
Rhead = 0.44
... | [
"\"\"\"Exercise 9c\"\"\"\n\nimport time\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom plot_results import plot_2d\nfrom run_simulation import run_simulation\nfrom simulation_parameters import SimulationParameters\n\ndef exercise_9c(world, timestep, reset):\n \"\"\"Exercise 9c\"\"\"\n\n n_joints =... | false |
5,783 | 14b9927435536a4b29b0930791ab4525acd80bc9 | from flask import Flask, render_template, jsonify, request, make_response #BSD License
import requests #Apache 2.0
#StdLibs
import json
from os import path
import csv
###################################################
#Programmato da Alex Prosdocimo e Matteo Mirandola#
###################################... | [
"from flask import Flask, render_template, jsonify, request, make_response #BSD License\r\nimport requests #Apache 2.0\r\n\r\n#StdLibs\r\nimport json\r\nfrom os import path\r\n\r\nimport csv\r\n\r\n###################################################\r\n#Programmato da Alex Prosdocimo e Matteo Mirandola#\r\n########... | false |
5,784 | 06e01dce7e2342be994569099ed51d1fe28eea1c | from django.db import models
# Create your models here.
class Task(models.Model):
level = models.PositiveSmallIntegerField()
topic = models.CharField(max_length=100)
content = models.TextField()
correct_answer = models.CharField(max_length=50)
class Answer(models.Model):
content = models.TextField... | [
"from django.db import models\n\n# Create your models here.\nclass Task(models.Model):\n level = models.PositiveSmallIntegerField()\n topic = models.CharField(max_length=100)\n content = models.TextField()\n correct_answer = models.CharField(max_length=50)\n\nclass Answer(models.Model):\n content = m... | false |
5,785 | 9340c9055a7e0d74d232d878b43d91a3e6cd32e5 | from tkinter import *
import tkinter.messagebox
import apikey
import tinify
class Setting_GUI(Toplevel):
def __init__(self,parent):
super().__init__()
self.parent = parent
key = "Input your key here"
self.keystringvar = StringVar()
self.wm_title("Settings - TingImage")
... | [
"from tkinter import *\nimport tkinter.messagebox\nimport apikey\nimport tinify\n\nclass Setting_GUI(Toplevel):\n def __init__(self,parent):\n super().__init__()\n self.parent = parent\n key = \"Input your key here\"\n self.keystringvar = StringVar()\n\n self.wm_title(\"Setting... | false |
5,786 | ea918bdf96572b38461dc1810bd0b8c16efd0f0d | # Generated by Django 3.0.7 on 2020-07-05 07:34
from django.db import migrations, models
import location_field.models.plain
class Migration(migrations.Migration):
dependencies = [
('driver', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='driver',
... | [
"# Generated by Django 3.0.7 on 2020-07-05 07:34\n\nfrom django.db import migrations, models\nimport location_field.models.plain\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('driver', '0001_initial'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_n... | false |
5,787 | 3acd592594ae4f12b9b694aed1aa0d48ebf485f5 | import glob
import json
import pickle
import gzip
import os
import hashlib
import re
import bs4, lxml
import concurrent.futures
URL = 'http://mangamura.org'
def _map(arg):
key, names = arg
size = len(names)
urls = set()
for index, name in enumerate(names):
html = gzip.decompress(open('htmls/' + name... | [
"import glob\n\nimport json\n\nimport pickle\n\nimport gzip\n\nimport os\n\nimport hashlib\n\nimport re\n\nimport bs4, lxml\n\nimport concurrent.futures\nURL = 'http://mangamura.org'\ndef _map(arg):\n key, names = arg\n size = len(names)\n urls = set()\n for index, name in enumerate(names):\n html = gzip.dec... | false |
5,788 | 41e981e2192b600cdf9c9b515fe9f397cd1b8826 | import re
def make_slug(string):
print(re.sub(^'\w','',string))
make_slug('#$gejcb#$evnk?.kjb')
| [
"import re\n\ndef make_slug(string):\n print(re.sub(^'\\w','',string))\n \nmake_slug('#$gejcb#$evnk?.kjb')\n"
] | true |
5,789 | 17b0baef5e366d70ea393259df1965e75b7d12e1 | #!/usr/bin/env python
# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis
import argparse
import collections
import re
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def data_from_sc_file(axes, f, uf, true_max):
... | [
"#!/usr/bin/env python\n\n# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis\n\nimport argparse\nimport collections\nimport re\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.backends.backend_pdf import PdfPages \n\n\ndef data_from_sc_file(axes, f, u... | true |
5,790 | 96778a238d8ed8ae764d0cf8ec184618dc7cfe18 |
if __name__== '__main__':
with open('./input/day6', 'r') as f:
orbit_input = [l.strip().split(")") for l in f.readlines()]
planets = [planet[0] for planet in orbit_input]
planets1 = [planet[1] for planet in orbit_input]
planets = set(planets+planets1)
system = {}
print(orbit_input)
... | [
"\nif __name__== '__main__':\n with open('./input/day6', 'r') as f:\n orbit_input = [l.strip().split(\")\") for l in f.readlines()]\n planets = [planet[0] for planet in orbit_input]\n planets1 = [planet[1] for planet in orbit_input]\n planets = set(planets+planets1)\n system = {}\n print(o... | false |
5,791 | 8fecfdf4b3772e5304f0b146317f94cdbd7fbd53 | from otree.api import Currency as c, currency_range
from . import models
from ._builtin import Page, WaitPage
from .models import Constants
class Introduction(Page):
timeout_seconds = 60
class Welcome(Page):
timeout_seconds = 60
class Priming(Page):
form_model = models.Player
form_fields = ['text'... | [
"from otree.api import Currency as c, currency_range\nfrom . import models\nfrom ._builtin import Page, WaitPage\nfrom .models import Constants\n\n\nclass Introduction(Page):\n timeout_seconds = 60\n\n\nclass Welcome(Page):\n timeout_seconds = 60\n\n\nclass Priming(Page):\n form_model = models.Player\n ... | false |
5,792 | 59047a113d76c64be48858258441fae5da505790 | from tkinter import ttk
from chapter04a.validated_mixin import ValidatedMixin
class RequiredEntry(ValidatedMixin, ttk.Entry):
def _focusout_validate(self, event):
valid = True
if not self.get():
valid = False
self.error.set('A value is required')
return valid
| [
"from tkinter import ttk\n\nfrom chapter04a.validated_mixin import ValidatedMixin\n\n\nclass RequiredEntry(ValidatedMixin, ttk.Entry):\n\n def _focusout_validate(self, event):\n valid = True\n if not self.get():\n valid = False\n self.error.set('A value is required')\n ... | false |
5,793 | 2e60781da004fb86d3a33deae970c1faf2a5037d | class Rectangulo():
def __init__(self, base, altura):
self.base = base
self.altura = altura
def calcular_area(self):
return self.base * self.altura
base = float(input("Ingrese la base del rectangulo: \n"))
altura = float(input("Ingrese la altura del rectangulo: \n"))
#Primera instan... | [
"class Rectangulo():\n\n def __init__(self, base, altura):\n self.base = base\n self.altura = altura\n\n def calcular_area(self):\n return self.base * self.altura\n\nbase = float(input(\"Ingrese la base del rectangulo: \\n\"))\naltura = float(input(\"Ingrese la altura del rectangulo: \\n... | false |
5,794 | f0deb8ccaf50ea0abb9e1632eaa4354a4f21dece | # uploadops.py
# CS304-Final Project
# Created by: Megan Shum, Maxine Hood, Mina Hattori
#!/usr/local/bin/python2.7
# This file handles all the SQL calls for the upload page.
import sys
import MySQLdb
import dbconn2
def uploadPost(conn, username, description, location, time_stamp, pathname):
'''Inserts post in Po... | [
"# uploadops.py\n# CS304-Final Project\n# Created by: Megan Shum, Maxine Hood, Mina Hattori\n#!/usr/local/bin/python2.7\n# This file handles all the SQL calls for the upload page.\n\nimport sys\nimport MySQLdb\nimport dbconn2\n\ndef uploadPost(conn, username, description, location, time_stamp, pathname):\n '''In... | true |
5,795 | 6f331eedcdaceaded142c3ffe9400aaa817613c1 | # coding=utf-8
from lxml import etree
import frontik.handler
class Page(frontik.handler.PageHandler):
def get_page(self):
self.set_xsl(self.get_argument('template', 'simple.xsl'))
self.doc.put(etree.Element('ok'))
if self.get_argument('raise', 'false') == 'true':
raise front... | [
"# coding=utf-8\n\nfrom lxml import etree\n\nimport frontik.handler\n\n\nclass Page(frontik.handler.PageHandler):\n def get_page(self):\n self.set_xsl(self.get_argument('template', 'simple.xsl'))\n self.doc.put(etree.Element('ok'))\n\n if self.get_argument('raise', 'false') == 'true':\n ... | false |
5,796 | 7dd5ac1110f38c40f2fddf9d7175a5ac40303d73 | # Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[... | [
"# Definition for an interval.\n# class Interval(object):\n# def __init__(self, s=0, e=0):\n# self.start = s\n# self.end = e\n\nclass Solution(object):\n def insert(self, intervals, newInterval):\n \"\"\"\n :type intervals: List[Interval]\n :type newInterval: Interval\n ... | true |
5,797 | e51ca78ca6751f8238a39d3eae55d6cc6ab65128 | # -*- coding: utf-8 -*-
'''
:Title
Insert Date
:Planguage
Python
:Requires
VoodooPad 3.5+
:Description
Inserts Date
EOD
'''
VPScriptSuperMenuTitle = "GTD"
VPScriptMenuTitle = "Insert Date"
VPShortcutMask = "control"
VPShortcutKey = "J"
import AppKit
import time
def main(windowController, *args, **kwargs):
te... | [
"# -*- coding: utf-8 -*-\n\n'''\n:Title\nInsert Date\n\n:Planguage\nPython\n\n:Requires\nVoodooPad 3.5+\n\n:Description\nInserts Date\n\nEOD\n'''\nVPScriptSuperMenuTitle = \"GTD\"\nVPScriptMenuTitle = \"Insert Date\"\nVPShortcutMask = \"control\"\nVPShortcutKey = \"J\"\n\nimport AppKit\nimport time\n\ndef main(wind... | false |
5,798 | 96d7963faf720a3dc0d96b55ad65ee7ac83c1818 | # testa se uma aplicacao em modo de teste esta sendo construida
def test_config(app):
assert app.testing
| [
"# testa se uma aplicacao em modo de teste esta sendo construida\ndef test_config(app):\n assert app.testing\n",
"def test_config(app):\n assert app.testing\n",
"<function token>\n"
] | false |
5,799 | 1aacd04234d60e495888fc44abe3fbacf404e0ce | mapName =input('\nEnter map name(s) (omitting the mp_ prefix)\nSeparate map names with comma\n:').lower()
mapNameList =mapName.split(',')
def convertWPFile(mapName):
#Converts mapname_waypoints.gsc file (old style PEzBot format) to newer mapname.gsc file (new style Bot Warfare format)
fullMapName ='mp_'+m... | [
"mapName =input('\\nEnter map name(s) (omitting the mp_ prefix)\\nSeparate map names with comma\\n:').lower()\r\nmapNameList =mapName.split(',')\r\n\r\ndef convertWPFile(mapName):\r\n #Converts mapname_waypoints.gsc file (old style PEzBot format) to newer mapname.gsc file (new style Bot Warfare format)\r\n fu... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.