index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
7,400
90fc6590dab51141124ca73082b8d937008ae782
"""Файл, который запускается при python qtester """
[ "\"\"\"Файл, который запускается при python qtester\n\"\"\"", "<docstring token>\n" ]
false
7,401
f024b0736f5fcdebede8d5b0985cf9d7170db8fc
api_key = "your_key"
[ "api_key = \"your_key\"\n", "api_key = 'your_key'\n", "<assignment token>\n" ]
false
7,402
810e9e4b18ff8cb388f9e16607b8ab3389a9831d
def add_route_distance(routes, cities, source): c = source.split() citykey = c[0] + ':' + c[2] cities.add(c[0]) routes[citykey] = c[4] def get_route_distance(routes, source, dest): if (source+":"+dest in routes): return routes[source+":"+dest] else: return routes[dest+":"+sourc...
[ "def add_route_distance(routes, cities, source):\n c = source.split()\n citykey = c[0] + ':' + c[2]\n cities.add(c[0])\n routes[citykey] = c[4]\n\n\ndef get_route_distance(routes, source, dest):\n if (source+\":\"+dest in routes):\n return routes[source+\":\"+dest]\n else:\n return r...
false
7,403
34acb6da1dc9403a311ce3bca0a828a77b7b36da
"""Some random mathematical helper functions. """ from __future__ import division, print_function import math # STATISTICS def mean(L): """Calculate mean of given List""" return sum(L) / len(L) def variance(L, is_sample=0): """calculate variance (or sample variance) of given List""" m = mean(L) return sum((x...
[ "\"\"\"Some random mathematical helper functions.\n\"\"\"\n\nfrom __future__ import division, print_function\nimport math\n\n\n# STATISTICS\n\ndef mean(L):\n\t\"\"\"Calculate mean of given List\"\"\"\n\treturn sum(L) / len(L)\n\t\ndef variance(L, is_sample=0):\n\t\"\"\"calculate variance (or sample variance) of giv...
false
7,404
b111d799b9e71cf36253c37f83dc0cdc8887a32e
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Agile Business Group sagl (<http://www.agilebg.com>) # Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com> # # This program is free software: you can redistribute it and/or modi...
[ "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2014 Agile Business Group sagl (<http://www.agilebg.com>)\n# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>\n#\n# This program is free software: you can redistribute it ...
false
7,405
83ebebbb6191295adcb58b003bf1c3bcc6fb189f
from selenium import webdriver import time def test_check_error_page_1(): try: link = "http://suninjuly.github.io/registration1.html" browser = webdriver.Chrome() browser.get(link) # Проверяем Fisrt name* field_text = browser.find_element_by_xpath( '//body/div/f...
[ "from selenium import webdriver\nimport time\n\ndef test_check_error_page_1():\n try:\n link = \"http://suninjuly.github.io/registration1.html\"\n browser = webdriver.Chrome()\n browser.get(link)\n\n # Проверяем Fisrt name*\n field_text = browser.find_element_by_xpath(\n ...
false
7,406
c1bcce809aa073ecd6e64dfa65ead9bd48aee3ff
from ui.pages import BasePage from ui.locators.login_page_locators import LoginPageLocators class LoginPage(BasePage, LoginPageLocators): def __init__(self, driver=None): super(LoginPage, self).__init__(driver=driver) self.identifier = self.IDENTIFIER def login(self, email=None, password=Non...
[ "from ui.pages import BasePage\nfrom ui.locators.login_page_locators import LoginPageLocators\n\n\nclass LoginPage(BasePage, LoginPageLocators):\n\n def __init__(self, driver=None):\n super(LoginPage, self).__init__(driver=driver)\n self.identifier = self.IDENTIFIER\n\n def login(self, email=Non...
false
7,407
a62dd287f9fc6f79ef95a3de83f52c794efe00a7
import math import turtle wn = turtle.Screen() wn.bgcolor('lightblue') PI=3.14 R_outer=50 R_inner=200 fred = turtle.Turtle() fred.speed(99999) def cycloid(r, k, nos_cycle, direction): n=36 angle=2*PI/n x=1 y=0 for i in range(nos_cycle*n): beta = i * angle x = r*(beta-math.sin(beta)) ...
[ "\nimport math\nimport turtle\n\nwn = turtle.Screen()\nwn.bgcolor('lightblue')\nPI=3.14\nR_outer=50\nR_inner=200\n\nfred = turtle.Turtle()\nfred.speed(99999)\n\ndef cycloid(r, k, nos_cycle, direction):\n n=36\n angle=2*PI/n\n x=1\n y=0\n for i in range(nos_cycle*n):\n\t beta = i * angle \n\t x = ...
true
7,408
34a7fd66a9e2eae25994336f22a76c24c11a6e1b
from django.urls import path from admin_panel import views urlpatterns = [ path('admin_panel/', views.AdminPanel.as_view(), name='admin_panel'), path('admin_panel/connection/', views.Connection.as_view(), name='connect_group-teacher'), path('admin_panel/connection/<str:choiced_departament>', views.Conne...
[ "\nfrom django.urls import path\n\nfrom admin_panel import views\n\nurlpatterns = [\n\n path('admin_panel/', views.AdminPanel.as_view(), name='admin_panel'),\n path('admin_panel/connection/', views.Connection.as_view(), name='connect_group-teacher'),\n path('admin_panel/connection/<str:choiced_departament>...
false
7,409
c420fb855fbf5691798eadca476b6eccec4aee57
points_dict = { '+': 5, '-': 4, '*': 3, '/': 2, '(': -1, } op_list = ['+','-','*','/'] def fitness(x1,op,x2): #Mengembalikan point dari penyambungan expresi dengan operasi dan bilangan berikutnya try: hasil = eval(f"{x1} {op} {x2}") diff = points_dict[op] - abs(24-hasil) ...
[ "points_dict = {\n '+': 5,\n '-': 4,\n '*': 3,\n '/': 2,\n '(': -1,\n}\n\nop_list = ['+','-','*','/']\n\ndef fitness(x1,op,x2):\n #Mengembalikan point dari penyambungan expresi dengan operasi dan bilangan berikutnya\n try:\n hasil = eval(f\"{x1} {op} {x2}\")\n diff = points_dict[o...
false
7,410
ea4e4c8067d9e910b8d4c6a1c4c01f1ef70d7341
/home/pushkar/anaconda3/lib/python3.6/_bootlocale.py
[ "/home/pushkar/anaconda3/lib/python3.6/_bootlocale.py" ]
true
7,411
9dfb3f58127b30467651ac4209277cd947643c65
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse from django.contrib import messages # Create your views here. from User.models import User, check_if_auth_user from .models import Chat # def recv_chat(request, id = None): # check = check_if_auth_user(request) # if...
[ "from django.shortcuts import render, redirect, get_object_or_404\nfrom django.http import HttpResponse\nfrom django.contrib import messages\n# Create your views here.\nfrom User.models import User, check_if_auth_user\nfrom .models import Chat\n\n# def recv_chat(request, id = None):\n# \tcheck = check_if_auth_user(...
false
7,412
db9068e54607e9df48328435ef07f15b4c25a6db
# %matplotlib inline import tensorflow as tf #import tensorflow.keras as K import numpy as np import math import matplotlib matplotlib.use('GTKAgg') import matplotlib.pyplot as plt # from keras import backend as K from keras.models import Sequential, load_model # from K.models import Sequential, load_model from keras....
[ "# %matplotlib inline\nimport tensorflow as tf\n#import tensorflow.keras as K\nimport numpy as np\nimport math\nimport matplotlib\nmatplotlib.use('GTKAgg')\nimport matplotlib.pyplot as plt\n\n# from keras import backend as K\nfrom keras.models import Sequential, load_model\n# from K.models import Sequential, load_m...
false
7,413
e839eba2514c29a8cfec462f8d5f56d1d5712c34
#!/usr/bin/env python import argparse import http.server import os class SimpleHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): def log_message(*args, **kwargs): pass parser = argparse.ArgumentParser() parser.add_argument('port', action='store', # default=8000, type=int, ...
[ "#!/usr/bin/env python\n\nimport argparse\nimport http.server\nimport os\n\nclass SimpleHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):\n def log_message(*args, **kwargs): pass\n\nparser = argparse.ArgumentParser()\nparser.add_argument('port', action='store',\n # default=8000, type=i...
false
7,414
48270f70a9d69d15f808f22ec2d11d337b2c4845
def densenet(D,DT,F,model): import scipy.io as sio import time import os import math import numpy as np import matplotlib.pyplot as plt Dataset = D if DT == 'org': data_type = 'original' else: data_type = 'augmented' fs = model.fs fm1 = model.fm1 batch_size = model.ba...
[ "def densenet(D,DT,F,model):\r\n import scipy.io as sio\r\n import time\r\n import os\r\n import math\r\n import numpy as np\r\n import matplotlib.pyplot as plt\r\n\r\n\r\n Dataset = D\r\n if DT == 'org':\r\n data_type = 'original'\r\n else:\r\n data_type = 'augmented'\r\n\r\n fs = model.fs\r\n fm1...
false
7,415
28bf11cb4205dd186b84cc7b7c8b9009f35fe408
# This simulation obtains dose on a cylindical disk phantom at various # distances from a 14MeV photon source. Dose in millisieverts is found # and compared to the yearly limit # The model is built to have a human tissue and human height and volume which # is typically referred to as a phantom. # source details based...
[ "# This simulation obtains dose on a cylindical disk phantom at various\n# distances from a 14MeV photon source. Dose in millisieverts is found\n# and compared to the yearly limit\n\n# The model is built to have a human tissue and human height and volume which\n# is typically referred to as a phantom.\n\n# source d...
false
7,416
f6bfb055e1c1750702580fc9c9295b8528218910
# 给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。 # # DEMO: # 输入: 3 # 输出: # [ # [ 1, 2, 3 ], # [ 8, 9, 4 ], # [ 7, 6, 5 ] # ] class Solution: def generateMatrix(self, n): """ 与 54 思路类似,注意边界... :type n: int :rtype: List[List[int]] """ array = [[0 for _ in ran...
[ "# 给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。\n#\n# DEMO:\n# 输入: 3\n# 输出:\n# [\n# [ 1, 2, 3 ],\n# [ 8, 9, 4 ],\n# [ 7, 6, 5 ]\n# ]\n\nclass Solution:\n def generateMatrix(self, n):\n \"\"\"\n 与 54 思路类似,注意边界...\n :type n: int\n :rtype: List[List[int]]\n \"\"\"\n ...
false
7,417
f6d4208afee7aacd96ea5ae6c9e38d2876466703
import os def mini100(videopath, minipath,mod='train'): with open(videopath, 'r') as video_f: all_videos = video_f.readlines() #if mod=='train': # count = [400 for _ in range(0,100)] #else: # count = [25 for _ in range(0,100)] count = [0 for _ in range(0,100)] ...
[ "import os\n\ndef mini100(videopath, minipath,mod='train'):\n with open(videopath, 'r') as video_f:\n all_videos = video_f.readlines()\n #if mod=='train':\n # count = [400 for _ in range(0,100)]\n #else:\n # count = [25 for _ in range(0,100)]\n count = [0 for _ in ...
false
7,418
8aa35bcaa4e564306125b37c70a8a92f26da736d
import pickle from absl import flags from absl import app from absl import logging import time import numpy as np FLAGS = flags.FLAGS flags.DEFINE_string('sent2vec_dir', '2020-04-10/sent2vec/', 'out path') flags.DEFINE_integer('num_chunks', 36, 'how many files') flags.DEFINE_string('out_dir', '2020-04-10/', 'out pat...
[ "\nimport pickle\n\nfrom absl import flags\nfrom absl import app\nfrom absl import logging\nimport time\nimport numpy as np\n\nFLAGS = flags.FLAGS\nflags.DEFINE_string('sent2vec_dir', '2020-04-10/sent2vec/', 'out path')\nflags.DEFINE_integer('num_chunks', 36, 'how many files')\nflags.DEFINE_string('out_dir', '2020-...
false
7,419
bf8a524e54aa866c8293a93b2321335f2c7b0850
from .checklist_mixin import ChecklistMixin from .citation_mixin import CitationMixin from .license_mixin import LicenseMixin from .registry_mixin import RegistryMixin from .repository_mixin import RepositoryMixin __all__ = [ "RepositoryMixin", "LicenseMixin", "RegistryMixin", "CitationMixin", "Ch...
[ "from .checklist_mixin import ChecklistMixin\nfrom .citation_mixin import CitationMixin\nfrom .license_mixin import LicenseMixin\nfrom .registry_mixin import RegistryMixin\nfrom .repository_mixin import RepositoryMixin\n\n\n__all__ = [\n \"RepositoryMixin\",\n \"LicenseMixin\",\n \"RegistryMixin\",\n \"...
false
7,420
297a17ca5aaafb368a1e4cba35e387c67e9f793f
""" Created on Fri Aug 4 19:19:31 2017 @author: aw1042 """ import requests import threading import sys import re import xml.etree.ElementTree as ET import smtplib from credentials import * argsObj = {} for arg1, arg2 in zip(sys.argv[:-1], sys.argv[1:]): if arg1[0] == '-': argsObj[arg1] = arg2 posts = ...
[ "\"\"\"\nCreated on Fri Aug 4 19:19:31 2017\n\n@author: aw1042\n\"\"\"\nimport requests\nimport threading\nimport sys\nimport re\nimport xml.etree.ElementTree as ET\nimport smtplib\nfrom credentials import *\n\n\n\nargsObj = {}\nfor arg1, arg2 in zip(sys.argv[:-1], sys.argv[1:]):\n if arg1[0] == '-':\n a...
true
7,421
4af53bf9cbe136dec7dcc609e28cdd013911c385
# Copyright (c) 2008 Johns Hopkins University. # All rights reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose, without fee, and without written # agreement is hereby granted, provided that the above copyright # notice, the (updated) modification history ...
[ "# Copyright (c) 2008 Johns Hopkins University.\n# All rights reserved.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose, without fee, and without written\n# agreement is hereby granted, provided that the above copyright\n# notice, the (updated) modificati...
true
7,422
76d2c3f74e8fae160396b4015ccec478dba97b87
# -*- coding: utf-8 -*- """ Created on Tue Mai 15 11:34:22 2018 @author: Diogo Leite """ from SQL_obj_new.Dataset_config_dataset_new_sql import _DS_config_DS_SQL class Dataset_conf_ds(object): """ This class treat the datasets configuration connection tables object has it exists in DATASET_CONF_DS table data...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Mai 15 11:34:22 2018\n\n@author: Diogo Leite\n\"\"\"\n\nfrom SQL_obj_new.Dataset_config_dataset_new_sql import _DS_config_DS_SQL\n\nclass Dataset_conf_ds(object):\n \"\"\"\n This class treat the datasets configuration connection tables object has it exists in D...
false
7,423
7a0e7ede263727ef303ba23dff1949c3a7031360
#!/usr/bin/python import argparse import os import pipes import sys import rospy import std_msgs.msg import actionlib import time import datetime from geometry_msgs.msg import Pose, Point, Quaternion from actionlib import * from location_provider.srv import GetLocationList from std_srvs.srv import Trigger try: i...
[ "#!/usr/bin/python\nimport argparse\nimport os\nimport pipes\nimport sys\n\nimport rospy\nimport std_msgs.msg\nimport actionlib\nimport time\n\nimport datetime\nfrom geometry_msgs.msg import Pose, Point, Quaternion\nfrom actionlib import *\nfrom location_provider.srv import GetLocationList\nfrom std_srvs.srv import...
true
7,424
c7d51f6448400af5630bdc0c29493320af88288e
import pytesseract from PIL import Image import tensorflow as tf from keras.models import load_model from tensorflow import Graph import os import json import cv2 import numpy as np global class_graph def classify(img, c_model): #global class_graph """ classifies images in a given folder using the 'model...
[ "import pytesseract\nfrom PIL import Image\nimport tensorflow as tf\n\nfrom keras.models import load_model\nfrom tensorflow import Graph\n\nimport os\nimport json\nimport cv2\nimport numpy as np\n\nglobal class_graph\n\n\n\n\ndef classify(img, c_model):\n #global class_graph\n \"\"\" classifies images in a gi...
false
7,425
310e6e693cdce6ff71d06eac86214a21bef236d4
"""Produce a multi-panel figure of each output lead time in a forecast """ import matplotlib.pyplot as plt import iris.plot as iplt from irise import convert from irise.plot.util import add_map from myscripts import plotdir from myscripts.models.um import case_studies columns = 3 def main(forecast, name, levels, *a...
[ "\"\"\"Produce a multi-panel figure of each output lead time in a forecast\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport iris.plot as iplt\nfrom irise import convert\nfrom irise.plot.util import add_map\nfrom myscripts import plotdir\nfrom myscripts.models.um import case_studies\n\ncolumns = 3\n\n\ndef main(fo...
false
7,426
50be2cbdaec6ed76e5d9367c6a83222f9153db82
''' Please Note: Note: It is intended for some problems to be ambiguous. You should gather all requirements up front before implementing one. Please think of all the corner cases and clarifications yourself. Validate if a given string is numeric. Examples: 1."0" => true 2." 0.1 " => true 3."abc" => false 4."1 a" =>...
[ "'''\nPlease Note:\nNote: It is intended for some problems to be ambiguous. You should gather all requirements up front before implementing one.\n\nPlease think of all the corner cases and clarifications yourself.\n\nValidate if a given string is numeric.\n\nExamples:\n\n1.\"0\" => true\n2.\" 0.1 \" => true\n3.\"ab...
false
7,427
7b6e73744d711188ab1a622c309b8ee55f3eb471
# Python : Correct way to strip <p> and </p> from string? s = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')
[ "# Python : Correct way to strip <p> and </p> from string?\ns = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')\n", "s = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')\n", "<assignment token>\n" ]
false
7,428
eec2b818ea9d50161bad60e8bf83dcb7ce9bf9fa
from plone import api from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE from plone.app.testing import applyProfile from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting from plone.app.testing import PLONE_FIXTURE from plone.app.testing import PloneSandboxL...
[ "from plone import api\nfrom plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE\nfrom plone.app.testing import applyProfile\nfrom plone.app.testing import FunctionalTesting\nfrom plone.app.testing import IntegrationTesting\nfrom plone.app.testing import PLONE_FIXTURE\nfrom plone.app.testing import Pl...
false
7,429
90b9dcd2dfc28446d1979d58ed49a12a85ce5b98
# Generated by Django 3.1.7 on 2021-03-24 14:51 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Products_Table', fields=[ ('product_id', mo...
[ "# Generated by Django 3.1.7 on 2021-03-24 14:51\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='Products_Table',\n fields=[\n ...
false
7,430
71662ff8c68559bf08e1da7f1a1504bfe842c950
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-08-04 13:16 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0007_alter_validators_add_error_...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2016-08-04 13:16\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ('auth', '0007_alter_val...
false
7,431
acf3d188bd6c99774ddf538dcc83f99ad56c7057
from mpi4py import MPI from random import random comm = MPI.COMM_WORLD mydata = comm.rank data = comm.gather(mydata) if comm.rank == 0: print("Data = ", data)
[ "from mpi4py import MPI\nfrom random import random\n\ncomm = MPI.COMM_WORLD\n\nmydata = comm.rank\n\ndata = comm.gather(mydata)\n\nif comm.rank == 0:\n print(\"Data = \", data)\n", "from mpi4py import MPI\nfrom random import random\ncomm = MPI.COMM_WORLD\nmydata = comm.rank\ndata = comm.gather(mydata)\nif comm...
false
7,432
2019a2a5588e57164ff4226ef3bcbbc506f2b315
""" ============================== Visualize Cylinder with Wrench ============================== We apply a constant body-fixed wrench to a cylinder and integrate acceleration to twist and exponential coordinates of transformation to finally compute the new pose of the cylinder. """ import numpy as np from pytransform...
[ "\"\"\"\n==============================\nVisualize Cylinder with Wrench\n==============================\n\nWe apply a constant body-fixed wrench to a cylinder and integrate\nacceleration to twist and exponential coordinates of transformation\nto finally compute the new pose of the cylinder.\n\"\"\"\nimport numpy as...
false
7,433
9a982e0ab7fff882767a98ed01f5ed68bd710888
import turtle def draw_square(): conrad = turtle.Turtle() conrad.shape("turtle") conrad.color("red") conrad.speed(3) i = 0 while(i < 4): conrad.forward(200) conrad.right(90) i += 1 def draw_circle(): niki = turtle.Turtle() niki.circle(50) def draw_triangle(): tri = turtle.Turtle() tri.shape("t...
[ "import turtle\n\ndef draw_square():\n\t\n\tconrad = turtle.Turtle()\n\tconrad.shape(\"turtle\")\n\tconrad.color(\"red\")\n\tconrad.speed(3)\n\n\ti = 0\n\twhile(i < 4):\n\t\tconrad.forward(200)\n\t\tconrad.right(90)\n\t\ti += 1\n\ndef draw_circle():\n\t\n\tniki = turtle.Turtle()\n\tniki.circle(50)\n\ndef draw_trian...
false
7,434
7c06bd52c924d3e401f50625109c5b8b489df157
def tort(n, a, b): return min(n*a, b) def main(): n, a, b = map(int, input().split()) print(tort(n, a, b)) if __name__ == '__main__': main()
[ "def tort(n, a, b):\n\n return min(n*a, b)\ndef main():\n n, a, b = map(int, input().split())\n print(tort(n, a, b))\n\nif __name__ == '__main__':\n main()\n", "def tort(n, a, b):\n return min(n * a, b)\n\n\ndef main():\n n, a, b = map(int, input().split())\n print(tort(n, a, b))\n\n\nif __na...
false
7,435
0f3ecd0a7189f57fdbda2360f6e39bd6101e2fdb
from LinkedList import LinkedList class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ h1 = l1 ...
[ "from LinkedList import LinkedList\n\nclass ListNode(object):\n def __init__(self, x):\n self.val = x\n self.next = None\n\nclass Solution(object):\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNode\n :type l2: ListNode\n :rtype: ListNode\n \"\"\"...
false
7,436
2b579c3def4c2d02d365f019518e8e0b25664460
import pandas as pd import matplotlib.pyplot as plt from netCDF4 import Dataset from cftime import num2date import os import numpy as np from datetime import datetime, timedelta, date def plot_temperatures_by_country(values, country, start, end): """ Returns a plot for temperature values for a coun...
[ "import pandas as pd\r\nimport matplotlib.pyplot as plt\r\nfrom netCDF4 import Dataset\r\nfrom cftime import num2date\r\nimport os\r\nimport numpy as np\r\nfrom datetime import datetime, timedelta, date\r\n\r\n\r\ndef plot_temperatures_by_country(values, country, start, end):\r\n \"\"\"\r\n Returns a plot for...
false
7,437
ee0ed255b6851696dc57c01100cd67f5f959cf01
from typing import List import pandas as pd import numpy as np import pickle from catboost import CatBoostRegressor from sklearn.preprocessing import MinMaxScaler def calculate_probable_age(usersEducationFeatures): prob_age = {} grads_count = {} age_diff1 = 17 # age difference for school ...
[ "from typing import List\r\n\r\nimport pandas as pd\r\nimport numpy as np\r\nimport pickle\r\nfrom catboost import CatBoostRegressor\r\nfrom sklearn.preprocessing import MinMaxScaler\r\n\r\n\r\ndef calculate_probable_age(usersEducationFeatures):\r\n prob_age = {}\r\n grads_count = {}\r\n age_diff1 = 17 # ...
false
7,438
ee49ce63951721458cb98b370285d04231bb2c20
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import numpy.random as nr import math import os from datetime import datetime from sklearn.linear_model import LinearRegression, SGDRegressor import sys import time import imp from sklearn.ensemble import ExtraTreesRegressor fr...
[ "import pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport numpy as np\nimport numpy.random as nr\nimport math\nimport os\nfrom datetime import datetime\nfrom sklearn.linear_model import LinearRegression, SGDRegressor\nimport sys\nimport time\nimport imp\nfrom sklearn.ensemble import Extra...
false
7,439
adff75857a1de24267e771c599e4d89486a6ad32
# Generated by Django 2.0.5 on 2018-07-12 11:08 import assessment.models from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('assessment', '0006_auto_20180712_1428'), ] operations = [ migrations.AlterModelManagers( name='season',...
[ "# Generated by Django 2.0.5 on 2018-07-12 11:08\n\nimport assessment.models\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('assessment', '0006_auto_20180712_1428'),\n ]\n\n operations = [\n migrations.AlterModelManagers(\n ...
false
7,440
8e34b5e15c5b6107d6841e7b567abf967c631f1b
# coding=utf-8 from __future__ import print_function import os import sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' basedir = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.append('trainer') sys.path.append('downloader') from gen.gen_captcha import gen_dataset, load_templates, candidates fr...
[ "# coding=utf-8\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\nbasedir = os.getcwd()\nos.chdir(os.path.dirname(os.path.abspath(__file__)))\nsys.path.append('trainer')\nsys.path.append('downloader')\n\nfrom gen.gen_captcha import gen_dataset, load_templat...
false
7,441
4d2cb3e0bdd331a1de7f07eb0109f02c9cf832a8
import logging import os import time import urllib from collections import namedtuple from statistics import mean from urllib.request import urlopen import bs4 import regex as re from tika import parser from scipy.stats import ks_2samp import config from TFU.trueformathtml import TrueFormatUpmarkerHTML from TFU.truefo...
[ "import logging\nimport os\nimport time\nimport urllib\nfrom collections import namedtuple\nfrom statistics import mean\nfrom urllib.request import urlopen\nimport bs4\nimport regex as re\nfrom tika import parser\nfrom scipy.stats import ks_2samp\n\nimport config\nfrom TFU.trueformathtml import TrueFormatUpmarkerHT...
false
7,442
a5b7f565a1797e5f326bcf26ff7c8ad2469dca70
#!/usr/bin/env python import argparse import pymssql import json #get the lcmMediaId from DB. def getMediaId(contentProviderMediaName): #test db conn = pymssql.connect(host='CHELLSSSQL23.karmalab.net', user='TravCatalog', password='travel', database='LodgingCatalogMaster_Phoenix') #prod db #conn = pyms...
[ "#!/usr/bin/env python\nimport argparse\nimport pymssql\nimport json\n\n#get the lcmMediaId from DB.\ndef getMediaId(contentProviderMediaName):\n #test db\n conn = pymssql.connect(host='CHELLSSSQL23.karmalab.net', user='TravCatalog', password='travel', database='LodgingCatalogMaster_Phoenix')\n #prod db\n ...
false
7,443
d517c1e2eb4d37a2584f1603c704efce6834df92
# Author: Charse # py 列表的使用 import copy name = ["111", "222", "333", "444", "555"] # 从列表中取得元素 print(name[0], name[2]) # 111 333 print(name[1:3]) # 切片 ['222', '333'] print(name[:3]) # ['111', '222', '333'] 与下标从0开始是一样的 print(name[0:3]) # ['111', '222', '333'] print(name[-2:]) # ['444', '555'] 与name # 往列表中添加...
[ "# Author: Charse\n# py 列表的使用\n\nimport copy\n\n\nname = [\"111\", \"222\", \"333\", \"444\", \"555\"]\n\n# 从列表中取得元素\nprint(name[0], name[2]) # 111 333\nprint(name[1:3]) # 切片 ['222', '333']\nprint(name[:3]) # ['111', '222', '333'] 与下标从0开始是一样的\nprint(name[0:3]) # ['111', '222', '333']\nprint(name[-2:]) # ['444...
false
7,444
88e1eb4cbfe346c663cca23836c23346e18a8488
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from twython import Twython import random tweetStr = "None" #twitter consumer and access information goes here api = Twython(apiKey,apiSecret,accessToken,accessTokenSecret) timeline = api.get_user_timeline() lastEntry = timeline[0] sid = str(lastEntry['id']...
[ "\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\nfrom twython import Twython\nimport random\n\ntweetStr = \"None\"\n\n#twitter consumer and access information goes here\n\n\napi = Twython(apiKey,apiSecret,accessToken,accessTokenSecret)\n\ntimeline = api.get_user_timeline()\nlastEntry = timeline[0]\nsi...
true
7,445
dd936839d71b97b3a21115498092d8984de0e3f1
questions = ('Какой язык мы учим?', 'Какой тип данных имеет целая переменная?', 'Какой тип данных имеет вещественная переменная?', 'Какой тип данных имеет логическая переменная?', 'Какой тип данных имеет символьная переменная?') answers = ('Python', 'Integer', 'Float', 'Bool', 'String') i = 0 count_answers = 0 while i ...
[ "questions = ('Какой язык мы учим?', 'Какой тип данных имеет целая переменная?', 'Какой тип данных имеет вещественная переменная?', 'Какой тип данных имеет логическая переменная?', 'Какой тип данных имеет символьная переменная?')\nanswers = ('Python', 'Integer', 'Float', 'Bool', 'String')\ni = 0\ncount_answers = 0\...
false
7,446
7b459cf321f351e1485a9aef0ca23067f411e430
"""Wrapper over the command line migrate tool to better work with config files.""" import subprocess import sys from alembic.migration import MigrationContext from ..lib.alembic import bootstrap_db from ..lib.sqla import create_engine from ..models import DBSession as db def main(): if len(sys.argv) < 3: ...
[ "\"\"\"Wrapper over the command line migrate tool to better work with\nconfig files.\"\"\"\n\nimport subprocess\nimport sys\n\nfrom alembic.migration import MigrationContext\n\nfrom ..lib.alembic import bootstrap_db\nfrom ..lib.sqla import create_engine\nfrom ..models import DBSession as db\n\n\ndef main():\n if...
false
7,447
56b4262e88793be366d8ffe0fe4427fdb2a99bd7
from app import create_app, db import unittest import json class Test(unittest.TestCase): def setUp(self): """Before each test, set up a blank database""" self.app = create_app("configmodule.TestingConfig") self.app.testing = True self.client = self.app.test_client() with...
[ "from app import create_app, db\nimport unittest\nimport json\n\n\nclass Test(unittest.TestCase):\n def setUp(self):\n \"\"\"Before each test, set up a blank database\"\"\"\n self.app = create_app(\"configmodule.TestingConfig\")\n self.app.testing = True\n\n self.client = self.app.tes...
false
7,448
ae5ec7919b9de4fbf578547c31837add32826f60
class Graph: def __init__(self, num_vertices): self.adj_list = {} for i in range(num_vertices): self.adj_list[i] = [] def add_vertice(self, source): self.adj_list[source] = [] def add_edge(self, source, dest): self.adj_list[source].append(dest) def print_...
[ "\nclass Graph:\n\n def __init__(self, num_vertices):\n self.adj_list = {}\n for i in range(num_vertices):\n self.adj_list[i] = []\n\n def add_vertice(self, source):\n self.adj_list[source] = []\n\n def add_edge(self, source, dest):\n self.adj_list[source].append(dest...
false
7,449
885fd32c9520dfdc2becd6b1a3d0c0f5f5397112
from setuptools import setup, find_packages setup( name="champ", version="0.0.1", description='Channel modeling in Python', url='https://github.com/sgherbst/champ', author='Steven Herbst', author_email='sherbst@stanford.edu', packages=['champ'], include_package_data=True, zip_safe=F...
[ "from setuptools import setup, find_packages\n\nsetup(\n name=\"champ\",\n version=\"0.0.1\",\n description='Channel modeling in Python',\n url='https://github.com/sgherbst/champ',\n author='Steven Herbst',\n author_email='sherbst@stanford.edu',\n packages=['champ'],\n include_package_data=T...
false
7,450
7c4709eaa5123b44e6355c6a60932f286e3b1cf5
#!/usr/bin/env python #-*- coding:utf8 -*- # Power by null 2018-09-19 18:41:17 from codebase.mod.mod_test import test_f
[ "#!/usr/bin/env python\n#-*- coding:utf8 -*-\n# Power by null 2018-09-19 18:41:17\n\nfrom codebase.mod.mod_test import test_f\n", "from codebase.mod.mod_test import test_f\n", "<import token>\n" ]
false
7,451
e38149f0d421a43f6aa34a977eee89fe29021b85
#!/usr/bin/python # This IDAPython code can be used to de-obfuscate strings generated by # CryptoWall version 3, as well as any other malware samples that make use of # this technique. ''' Example disassembly: .text:00403EC8 mov ecx, 'V' .text:00403ECD mov [ebp+var_1C], cx ...
[ "#!/usr/bin/python\n# This IDAPython code can be used to de-obfuscate strings generated by\n# CryptoWall version 3, as well as any other malware samples that make use of\n# this technique. \n\n'''\nExample disassembly:\n\n\t.text:00403EC8 mov ecx, 'V'\n\t.text:00403ECD mov [e...
true
7,452
1c1cd0eeea4dbf446aa4582f42ef1f3b5a4e8875
# Generated by Django 3.2.2 on 2021-05-11 09:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('meeting', '0004_auto_20210511_0947'), ] operations = [ migrations.AlterField( model_name='event', name='end', ...
[ "# Generated by Django 3.2.2 on 2021-05-11 09:49\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('meeting', '0004_auto_20210511_0947'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='event',\n ...
false
7,453
862c5794a4da794678de419f053ae15b11bca6e7
class GameOfLife: @staticmethod def simulate(board): for row in range(len(board)): for col in range(len(board[0])): ones = GameOfLife.countOnes(board, row, col) if board[row][col] and (ones == 2 or ones == 3): board[row][col] |= 2 ...
[ "class GameOfLife:\n @staticmethod\n def simulate(board):\n for row in range(len(board)):\n for col in range(len(board[0])):\n ones = GameOfLife.countOnes(board, row, col)\n if board[row][col] and (ones == 2 or ones == 3):\n board[row][col] |=...
false
7,454
445ae195edfe9fe9ee58c6c5a14ec787719d698c
def get_ecgs_by_query(json_data, query): ecgs_ids = [] for case_id in json_data.keys(): print(case_id) if query.is_query_ok(json_data[case_id]): ecgs_ids.append(case_id) return ecgs_ids def save_new_dataset_by_ids(old_json, ecg_ids_to_save, name_new_dataset): """ Saves...
[ "\n\ndef get_ecgs_by_query(json_data, query):\n ecgs_ids = []\n for case_id in json_data.keys():\n print(case_id)\n if query.is_query_ok(json_data[case_id]):\n ecgs_ids.append(case_id)\n return ecgs_ids\n\ndef save_new_dataset_by_ids(old_json, ecg_ids_to_save, name_new_dataset):\n ...
false
7,455
9540319cf192add1fb24375a35d70ea8e3031a72
__author__ = 'aniket' import freenect import cv2 import numpy as np kernel = nfrp.ones((5,5),np.uint8) freenect.C def grayscale(): maske = np.zeros((480,640,3)) a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0] mask = a == 0 a[mask] = 8000 mask1 = a > 1000 b = freenect.sync_get_video()...
[ "__author__ = 'aniket'\n\nimport freenect\nimport cv2\nimport numpy as np\n\nkernel = nfrp.ones((5,5),np.uint8)\nfreenect.C\ndef grayscale():\n maske = np.zeros((480,640,3))\n a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0]\n mask = a == 0\n a[mask] = 8000\n\n mask1 = a > 1000\n b = freen...
false
7,456
afd184962e8e69843ca518e140d5fdde3d7c9ed2
from django.views.generic import TemplateView, FormView, CreateView, ListView from .models import Order from .form import OrderForm class OrdersListView(ListView): template_name = 'orders/index.html' queryset = Order.objects.all() context_object_name = 'order_list' class OrderCreateView(CreateView): ...
[ "from django.views.generic import TemplateView, FormView, CreateView, ListView\nfrom .models import Order\n\nfrom .form import OrderForm\n\n\nclass OrdersListView(ListView):\n template_name = 'orders/index.html'\n queryset = Order.objects.all()\n context_object_name = 'order_list'\n\n\nclass OrderCreateVie...
false
7,457
605d8144d18207314981872ec57cec6cb2510601
# def qs(li): # n = len(li) # if n <= 1: # return li # pivot = li[n - 1] # left = [] # right = [] # for i in li[:n - 1]: # if i <= pivot: # left.append(i) # else: # right.append(i) # left = qs(left) # right = qs(right) # return left + [...
[ "# def qs(li):\n# n = len(li)\n# if n <= 1:\n# return li\n# pivot = li[n - 1]\n# left = []\n# right = []\n# for i in li[:n - 1]:\n# if i <= pivot:\n# left.append(i)\n# else:\n# right.append(i)\n# left = qs(left)\n# right = qs(right)\n# ...
false
7,458
3222dd7c2d19d86f2e085cb489ab4a48307ba132
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test1.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(...
[ "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'test1.ui'\n#\n# Created by: PyQt5 UI code generator 5.7\n#\n# WARNING! All changes made in this file will be lost!\n\nfrom PyQt5 import QtCore, QtGui, QtWidgets\n\nclass Ui_Dialog(object):\n def setupUi(self, Dialog):\n Dial...
false
7,459
45b46a08d8b304ac12baf34e0916b249b560418f
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, request, jsonify from app import Node from dbm2 import filemanager fm = filemanager() node = Node(fm) app = Flask(__name__) @app.route("/transactions/isfull",methods=['GET']) def isFull(): return jsonify(node.isFull()), 200 @app.route("/tra...
[ "#!/usr/bin/env python3\n\n# -*- coding: utf-8 -*-\n\n\nfrom flask import Flask, request, jsonify\nfrom app import Node\nfrom dbm2 import filemanager\n\nfm = filemanager()\nnode = Node(fm)\n\napp = Flask(__name__)\n\n@app.route(\"/transactions/isfull\",methods=['GET'])\ndef isFull():\n return jsonify(node.isFull()...
false
7,460
2e9d71b8055e1bab107cedae69ca3bc4219e7d38
import joblib import os import shutil import re from scipy import stats from functools import partial import pandas as pd from multiprocessing import Process, Pool from nilearn import masking, image import nibabel as nib import numpy as np from tqdm import tqdm import matplotlib matplotlib.use('Agg') import matplotlib...
[ "import joblib\nimport os\nimport shutil\nimport re\nfrom scipy import stats\nfrom functools import partial\n\nimport pandas as pd\nfrom multiprocessing import Process, Pool\nfrom nilearn import masking, image\nimport nibabel as nib\nimport numpy as np\nfrom tqdm import tqdm\nimport matplotlib\nmatplotlib.use('Agg'...
false
7,461
de7515cb71c8e30018b14baf8846648d0c76a592
#!/usr/bin/env python # Sanjaya Gajurel, Computational Scientist, Case Western Reserve University, April 2015 import vtk # ------------------------------------------------------------------------------ # Script Entry Point # ------------------------------------------------------------------------------ if __name__ ==...
[ "#!/usr/bin/env python\n# Sanjaya Gajurel, Computational Scientist, Case Western Reserve University, April 2015\n\nimport vtk\n\n# ------------------------------------------------------------------------------\n# Script Entry Point\n# ------------------------------------------------------------------------------\ni...
false
7,462
cab45a823e319bd504b3db68cf70bff315f44fc6
import random import numpy as np class Board: def __init__(self, nrows, ncols, random_seed=42): self.nrows = nrows self.ncols = ncols self.random = random.Random() self.random.seed(random_seed) self.board = np.zeros((nrows, ncols)) self.score = 0 self.__add_new_numbers() # Initialize with 1/8 of the ...
[ "import random\nimport numpy as np\n\nclass Board:\n\tdef __init__(self, nrows, ncols, random_seed=42):\n\t\tself.nrows = nrows\n\t\tself.ncols = ncols\n\t\tself.random = random.Random()\n\t\tself.random.seed(random_seed)\n\t\tself.board = np.zeros((nrows, ncols))\n\t\tself.score = 0\n\n\t\tself.__add_new_numbers()...
false
7,463
b38c9357030b2eac8298743cfb4d6c4d58c99ed4
import redis r = redis.StrictRedis() r.set("counter", 40) print(r.get("counter")) print(r.incr("counter")) print(r.incr("counter")) print(r.get("counter"))
[ "import redis\nr = redis.StrictRedis()\n\nr.set(\"counter\", 40) \nprint(r.get(\"counter\"))\nprint(r.incr(\"counter\"))\nprint(r.incr(\"counter\"))\nprint(r.get(\"counter\"))\n\n\n", "import redis\nr = redis.StrictRedis()\nr.set('counter', 40)\nprint(r.get('counter'))\nprint(r.incr('counter'))\nprint(r.incr('cou...
false
7,464
abe53120a485f608431142c6b9452666fcd72dbf
# -*- coding: utf-8 -*- """ Created on Fri Oct 5 17:05:12 2018 @author: Shane """ import math import scipy.integrate as integrate import random import numpy as np import sympy as sym ''' Question 1 plug and play into formula for VC generalization ''' print('Question 1') error = 0.05 for N in [400000,420000,4400...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Oct 5 17:05:12 2018\n\n@author: Shane\n\"\"\"\n\nimport math\nimport scipy.integrate as integrate\nimport random\nimport numpy as np\nimport sympy as sym\n\n'''\nQuestion 1\n\nplug and play into formula for VC generalization\n'''\n\n\nprint('Question 1')\nerror = 0....
false
7,465
8f9d823785d42d02a0a3d901d66b46a5cd59cdd7
import json import glob import sys searchAreaName = sys.argv[1] # searchAreaName = "slovenia_177sqkm_shards/20161220-162010-c9e0/slovenia_177sqkm_predicted/predict_slovenia_177sqkm_shard" print('./{0}_??.txt'.format(searchAreaName)) all_predicts = glob.glob('./{0}_??.txt'.format(searchAreaName)) def getBboxes(bboxes):...
[ "import json\nimport glob\nimport sys\nsearchAreaName = sys.argv[1]\n# searchAreaName = \"slovenia_177sqkm_shards/20161220-162010-c9e0/slovenia_177sqkm_predicted/predict_slovenia_177sqkm_shard\"\nprint('./{0}_??.txt'.format(searchAreaName))\nall_predicts = glob.glob('./{0}_??.txt'.format(searchAreaName))\n\ndef get...
false
7,466
e899b093152ee0923f1e5ad3b5719bbf9eb4339c
from .login import LoginTask from .tag_search import TagSearchTask from .timeline import TimelineTask from .get_follower import GetFollowerTask from .followback import FollowBackTask from .unfollow import UnFollowTask
[ "from .login import LoginTask\nfrom .tag_search import TagSearchTask\nfrom .timeline import TimelineTask\nfrom .get_follower import GetFollowerTask\nfrom .followback import FollowBackTask\nfrom .unfollow import UnFollowTask\n", "<import token>\n" ]
false
7,467
64d955d568a6bfec50aad36c9c4f1e36998e4d74
import csv import boto3 import pytz import time from datetime import datetime, timedelta # current_time = int(datetime.now()) from boto3.dynamodb.conditions import Key, Attr def lambda_handler(event, context): current_date = datetime.now(pytz.timezone('US/Central')) yesterday_date = current_date - timedleta(...
[ "import csv\nimport boto3 \nimport pytz\nimport time\nfrom datetime import datetime, timedelta\n# current_time = int(datetime.now())\nfrom boto3.dynamodb.conditions import Key, Attr\n\n\ndef lambda_handler(event, context):\n current_date = datetime.now(pytz.timezone('US/Central'))\n yesterday_date = current_d...
false
7,468
18eed41cbc419ecbb215f77235be99f15f86ea9a
''' Author: Allen Chen This is an example of entry point to CORE. Pay close attention to the import syntax - they're relative to this repo. Don't try to run this by doing 'python3 main.py' under this directory. Try to add your Target in Makefile under the root dir, and call './run YOUR_TARGET_NAME' from root. ''' fr...
[ "'''\nAuthor: Allen Chen\n\nThis is an example of entry point to CORE. Pay close attention to the import syntax - they're relative to this repo.\nDon't try to run this by doing 'python3 main.py' under this directory. Try to add your Target in Makefile under the root dir,\nand call './run YOUR_TARGET_NAME' from root...
false
7,469
109ca06685eece74034f77a98b1d7172a17aca21
import random import re from datetime import datetime, timedelta from threading import Lock from telegram.ext import run_async from src.models.user import UserDB from src.models.user_stat import UserStat from src.utils.cache import cache, USER_CACHE_EXPIRE from src.utils.logger_helpers import get_logger logger = get...
[ "import random\nimport re\nfrom datetime import datetime, timedelta\nfrom threading import Lock\n\nfrom telegram.ext import run_async\n\nfrom src.models.user import UserDB\nfrom src.models.user_stat import UserStat\nfrom src.utils.cache import cache, USER_CACHE_EXPIRE\nfrom src.utils.logger_helpers import get_logge...
false
7,470
b74c759b51fb6591477757e2ff54b545f225991c
import json from examtool.api.database import get_exam, get_roster from examtool.api.extract_questions import extract_questions from examtool.api.scramble import scramble from google.cloud import firestore import warnings warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials"...
[ "import json\n\nfrom examtool.api.database import get_exam, get_roster\nfrom examtool.api.extract_questions import extract_questions\nfrom examtool.api.scramble import scramble\nfrom google.cloud import firestore\nimport warnings\nwarnings.filterwarnings(\"ignore\", \"Your application has authenticated using end us...
false
7,471
a12f9435eb4b090bc73be14ad64fdf43c5caa4d2
from netsec_2017.Lab_3.packets import RequestItem, RequestMoney, RequestToBuy, FinishTransaction, SendItem, SendMoney from netsec_2017.Lab_3.PLS.client import PLSClient, PLSStackingTransport from netsec_2017.Lab_3.peepTCP import PeepClientTransport, PEEPClient import asyncio import playground import random, logging fro...
[ "from netsec_2017.Lab_3.packets import RequestItem, RequestMoney, RequestToBuy, FinishTransaction, SendItem, SendMoney\nfrom netsec_2017.Lab_3.PLS.client import PLSClient, PLSStackingTransport\nfrom netsec_2017.Lab_3.peepTCP import PeepClientTransport, PEEPClient\nimport asyncio\nimport playground\nimport random, l...
false
7,472
e59bd92a94399d4a81687fc5e52e9ae04b9de768
from django.db import models from colorfield.fields import ColorField from api import settings from os.path import splitext from datetime import datetime, timedelta from PIL import Image def saveTaskPhoto(instance,filename): taskId = instance.id name,ext = splitext(filename) return f'tasks/task_{taskId}{e...
[ "from django.db import models\nfrom colorfield.fields import ColorField\nfrom api import settings\nfrom os.path import splitext\nfrom datetime import datetime, timedelta\nfrom PIL import Image\n\n\ndef saveTaskPhoto(instance,filename):\n taskId = instance.id\n name,ext = splitext(filename)\n return f'tasks...
false
7,473
24b6d33849f034b9f61ffd4aaff90a0f428085fe
from pybot import usb4butia u4b = usb4butia.USB4Butia() while True: bot = u4b.getButton(6) print bot
[ "from pybot import usb4butia\n\nu4b = usb4butia.USB4Butia()\n\nwhile True:\n bot = u4b.getButton(6)\n print bot\n\n\n" ]
true
7,474
2d0d73c0ea20d6736c10d5201abcfa9d561ef216
import random import matplotlib.pyplot as plt import numpy as np def dado(n): i = 1 dos =0 tres =0 cuatro =0 cinco=0 seis =0 siete=0 ocho=0 nueve=0 diez=0 once=0 doce=0 cont = [0,0,0,0,0,0,0,0,0,0,0] while i <= n: r1 = random.randint(1,6)...
[ "import random\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\ndef dado(n):\r\n i = 1\r\n dos =0\r\n tres =0\r\n cuatro =0\r\n cinco=0\r\n seis =0\r\n siete=0\r\n ocho=0\r\n nueve=0\r\n diez=0\r\n once=0\r\n doce=0\r\n cont = [0,0,0,0,0,0,0,0,0,0,0]\r\n while i ...
false
7,475
7639b80c9e6e1b2e1e55a47a862c433b64168cf6
# 代码3-14 pandas累积统计特征函数、移动窗口统计函数示例 import pandas as pd D = pd.Series(range(0, 20)) # 构造Series,内容为0~19共20个整数 print(D.cumsum()) # 给出前n项和 print(D.rolling(2).sum()) # 依次对相邻两项求和
[ "# 代码3-14 pandas累积统计特征函数、移动窗口统计函数示例\n\nimport pandas as pd\n\nD = pd.Series(range(0, 20)) # 构造Series,内容为0~19共20个整数\nprint(D.cumsum()) # 给出前n项和\nprint(D.rolling(2).sum()) # 依次对相邻两项求和\n", "import pandas as pd\nD = pd.Series(range(0, 20))\nprint(D.cumsum())\nprint(D.rolling(2).sum())\n", "<import token>\nD = pd...
false
7,476
a3239bbe4f85c9f0e1bc845245f024c3feb64923
# Generated by Django 3.2.3 on 2021-06-01 07:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('info', '0002_auto_20210531_1958'), ] operations = [ migrations.AddField( model_name='well', name='well_status', ...
[ "# Generated by Django 3.2.3 on 2021-06-01 07:26\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('info', '0002_auto_20210531_1958'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='well',\n name=...
false
7,477
8ad47bf292e0046550cc0ef6f6bb75cf179ebd4b
def group(arr): low, mid, high = 0, 0, len(arr)-1 while mid <= high: print(arr) if arr[mid] == 'R' : arr[low], arr[mid] = arr[mid], arr[low] low += 1 mid += 1 elif arr[mid] == 'G': mid += 1 else: arr[high], ar...
[ "def group(arr):\r\n low, mid, high = 0, 0, len(arr)-1\r\n while mid <= high:\r\n print(arr)\r\n if arr[mid] == 'R' :\r\n arr[low], arr[mid] = arr[mid], arr[low]\r\n low += 1\r\n mid += 1\r\n elif arr[mid] == 'G':\r\n mid += 1\r\n else:\r...
false
7,478
82556291c456b9e43e4e589ea4a77d320430344b
data_dir = "../data" output_dir = './' valid_id = dict() for category in ("beauty", "fashion", "mobile"): with open("%s/%s_data_info_val_competition.csv" % (data_dir, category), "r") as infile: next(infile) for line in infile: curr_id = line.strip().split(',')[0] valid_id[cu...
[ "data_dir = \"../data\"\noutput_dir = './'\nvalid_id = dict()\n\nfor category in (\"beauty\", \"fashion\", \"mobile\"):\n with open(\"%s/%s_data_info_val_competition.csv\" % (data_dir, category), \"r\") as infile:\n next(infile)\n for line in infile:\n curr_id = line.strip().split(',')[0...
false
7,479
96ea9b2b4d892ac88f7fac9594a6d2ad5d69a7c7
# -*- coding: utf-8 -*- import os import logging import subprocess import json import sys ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ROOT_PATH) from src.datafactory.common import json_util from src.datafactory.config import constant class SegmentProcess...
[ "# -*- coding: utf-8 -*-\n\nimport os\nimport logging\nimport subprocess\nimport json\nimport sys\n\nROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\nsys.path.append(ROOT_PATH)\n\nfrom src.datafactory.common import json_util\nfrom src.datafactory.config import constant\n\n\n...
true
7,480
8a9feae4ce209def2c98b7bed993f9b5c019a533
from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import messagebox import random import numpy as np import timeit def main(): root = tk.Tk() # root.geometry('800x500') root.resizable(width=False, height=False) root.title('Tugas Algoritma') canva...
[ "from tkinter import *\r\nimport tkinter as tk\r\nfrom tkinter import ttk\r\nfrom tkinter import messagebox\r\n\r\nimport random\r\nimport numpy as np\r\n\r\nimport timeit\r\n\r\n\r\ndef main():\r\n\r\n root = tk.Tk()\r\n # root.geometry('800x500')\r\n root.resizable(width=False, height=False)\r\n root....
false
7,481
3031f695d57492cf3b29694fecd0a41c469a3e00
botName = "firstBot" username = "mrthemafia" password = "oblivion" client_id = "Y3LQwponbEp07w" client_secret = "R4oyCEj6hSTJWHfWMwb-DGUOBm8"
[ "botName = \"firstBot\"\nusername = \"mrthemafia\"\npassword = \"oblivion\"\nclient_id = \"Y3LQwponbEp07w\"\nclient_secret = \"R4oyCEj6hSTJWHfWMwb-DGUOBm8\"\n", "botName = 'firstBot'\nusername = 'mrthemafia'\npassword = 'oblivion'\nclient_id = 'Y3LQwponbEp07w'\nclient_secret = 'R4oyCEj6hSTJWHfWMwb-DGUOBm8'\n", ...
false
7,482
abfff0901e5f825a473119c93f53cba206609428
# -*- coding: utf-8 -*- import io import urllib.request from pymarc import MARCReader class Item: """ Represents an item from our Library catalogue (https://www-lib.soton.ac.uk) Usage: #>>> import findbooks #>>> item = findbooks.Item('12345678') #>>> item.getMarcFields() ...
[ "# -*- coding: utf-8 -*-\nimport io\nimport urllib.request\nfrom pymarc import MARCReader\n\n\nclass Item:\n \"\"\"\n Represents an item from our\n Library catalogue (https://www-lib.soton.ac.uk)\n Usage:\n\n #>>> import findbooks\n #>>> item = findbooks.Item('12345678')\n #>>> item...
false
7,483
5e2fcc6379a8ecee0378d26108e4deab9d17dba6
# 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 to ...
[ "# All Rights Reserved.\n#\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable l...
false
7,484
b9fe758d5fe12b5a15097c0e5a33cb2d57edfdd2
from django.shortcuts import render, get_object_or_404, redirect from django.utils import timezone from .models import Group,SQLlist from .forms import GroupForm from .oraConnect import * from .utils import IfNoneThenNull ########################### Группы ############################ def group_list(request): grou...
[ "from django.shortcuts import render, get_object_or_404, redirect\nfrom django.utils import timezone\nfrom .models import Group,SQLlist\nfrom .forms import GroupForm\nfrom .oraConnect import *\nfrom .utils import IfNoneThenNull\n\n########################### Группы ############################\ndef group_list(reque...
false
7,485
3eb40dfe68573b93c544a2279ac5c8728ae9601f
# -*- coding: utf-8 -*- from __future__ import absolute_import from tests import unittest from kepler.descriptors import * class DescriptorsTestCase(unittest.TestCase): def testEnumDefaultsToNoopMapper(self): class Record(object): cat = Enum(name='cat', enums=['Lucy Cat', 'Hot Pocket']) ...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom tests import unittest\nfrom kepler.descriptors import *\n\nclass DescriptorsTestCase(unittest.TestCase):\n def testEnumDefaultsToNoopMapper(self):\n class Record(object):\n cat = Enum(name='cat', enums=['Lucy Cat', 'Hot Pock...
false
7,486
1b43125c2ebffd0a268a4a0ffdbbf407de7b0374
''' Compress images ''' from PIL import Image def resizeImage(image_file): try: # get the image's width and height in pixels img = Image.open(image_file) width, height = img.size # get the largest dimension max_dim = max(img.size) if max_dim > 1000: # resize the image using the largest side as dime...
[ "''' Compress images '''\n\nfrom PIL import Image\n\n\ndef resizeImage(image_file):\n\ttry:\n\t\t# get the image's width and height in pixels\n\t\timg = Image.open(image_file)\n\t\twidth, height = img.size\n\n\t\t# get the largest dimension\n\t\tmax_dim = max(img.size)\n\n\t\tif max_dim > 1000:\n\t\t\t# resize the ...
true
7,487
fdf76ff20260c25d95a9bf751fa78156071a7825
class Helper: def __init__(self): self.commands = ["help", "lottery", "poll", "polling", "prophecy", "roll", "team", "ub"] ...
[ "class Helper:\r\n def __init__(self):\r\n self.commands = [\"help\",\r\n \"lottery\",\r\n \"poll\",\r\n \"polling\",\r\n \"prophecy\",\r\n \"roll\",\r\n \"team\"...
false
7,488
5ad8db85f4f705173cf5d0649af6039ebe1544b2
text=open('mytext.txt','w') x=text.write("I like coding\nit is a new part\nof my life!!!") text=open('mytext.txt') read=text.readlines() i=0 counter=0 total=0 print("number of lines :"+str(len(read))) while i<=len(read)-1: counter=counter+read[i].count('\n') + read[i].count(' ') total+=len(read[i])-read[i].cou...
[ "text=open('mytext.txt','w')\nx=text.write(\"I like coding\\nit is a new part\\nof my life!!!\")\ntext=open('mytext.txt')\nread=text.readlines()\ni=0\ncounter=0\ntotal=0\nprint(\"number of lines :\"+str(len(read)))\n\nwhile i<=len(read)-1:\n counter=counter+read[i].count('\\n') + read[i].count(' ')\n total+=l...
false
7,489
973a58013160cbc71ca46f570bde61eaff87f6a7
from Adafruit_LSM9DS0 import Adafruit_LSM9DS0 import math imu = Adafruit_LSM9DS0() pi = 3.14159265358979323846 # Written here to increase performance/ speed r2d = 57.2957795 # 1 radian in degrees loop = 0.05 # tuning = 0.98 # Constant for tuning Complimentary filter # Converting accelerometer readings to degrees ax ...
[ "from Adafruit_LSM9DS0 import Adafruit_LSM9DS0\nimport math\n\nimu = Adafruit_LSM9DS0()\n\npi = 3.14159265358979323846 # Written here to increase performance/ speed\nr2d = 57.2957795 # 1 radian in degrees\nloop = 0.05 #\ntuning = 0.98 # Constant for tuning Complimentary filter\n\n# Converting accelerometer readings...
true
7,490
7ae328bcfdec2d17fceb5d707f13cf495fde4469
import os import re import time import numpy as np import pandas as pd from sklearn.cluster import AgglomerativeClustering import math import edlib from progress.bar import IncrementalBar as Bar from multiprocessing import Pool import argparse parser = argparse.ArgumentParser() parser.add_argument("--pools", ...
[ "import os\nimport re\nimport time\nimport numpy as np\nimport pandas as pd\nfrom sklearn.cluster import AgglomerativeClustering\nimport math\nimport edlib\nfrom progress.bar import IncrementalBar as Bar\nfrom multiprocessing import Pool\nimport argparse\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"...
false
7,491
763d448bc447b88d5f2de777a475a1dd50906527
class Solution: def jump(self, nums: List[int]) -> int: l = len(nums) jump = 0 curEnd = 0 curFarthest = 0 for i in range(l-1): curFarthest= max(curFarthest,i+nums[i]) if i==curEnd: jump+=1 curEnd = curFarthest re...
[ "class Solution:\n def jump(self, nums: List[int]) -> int:\n l = len(nums)\n jump = 0\n curEnd = 0\n curFarthest = 0\n for i in range(l-1):\n curFarthest= max(curFarthest,i+nums[i])\n if i==curEnd:\n jump+=1\n curEnd = curFart...
false
7,492
24b1afb18e1cfdc8d5a62f5ee0147b2d73bc10d8
# # Copyright 2021 Splunk 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
[ "#\n# Copyright 2021 Splunk 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# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed t...
false
7,493
abbefb1e426408b32fa9e125c78b572de22dbb8c
import unittest from unittest.mock import patch from fsqlfly.db_helper import * from fsqlfly.tests.base_test import FSQLFlyTestCase class MyTestCase(FSQLFlyTestCase): def test_positive_delete(self): namespace = Namespace(name='iii') self.session.add(namespace) self.session.commit() ...
[ "import unittest\nfrom unittest.mock import patch\nfrom fsqlfly.db_helper import *\nfrom fsqlfly.tests.base_test import FSQLFlyTestCase\n\n\nclass MyTestCase(FSQLFlyTestCase):\n def test_positive_delete(self):\n namespace = Namespace(name='iii')\n self.session.add(namespace)\n self.session.c...
false
7,494
ab0c3cf3e43f34874dd94629b746ca1237c3349a
import time import numpy as np import matplotlib.pyplot as plt #tutorial: http://pybonacci.org/2012/05/19/manual-de-introduccion-a-matplotlib-pyplot-ii-creando-y-manejando-ventanas-y-configurando-la-sesion/ import threading from random import shuffle T = 1 eps = 0.000000001 agilityMin = 1/T '''------------GOVERMENT'...
[ "import time\nimport numpy as np\nimport matplotlib.pyplot as plt #tutorial: http://pybonacci.org/2012/05/19/manual-de-introduccion-a-matplotlib-pyplot-ii-creando-y-manejando-ventanas-y-configurando-la-sesion/\nimport threading\nfrom random import shuffle\n\n\nT = 1\neps = 0.000000001\nagilityMin = 1/T\n\n'''------...
false
7,495
f3b697e20f60e51d80d655ddf4809aa9afdfcd69
# -*- coding: utf-8 -*- """ Editor de Spyder Este es un archivo temporal. """ def largo (l, n): i=0 cuenta=1 valor1=0 valor2=0 while cuenta < n+1 or cuenta==n+1: a=l[i] b=l[i+1] if a==b: cuenta+= 1 valor1=a i+=1 cuenta=1 while cuenta ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nEditor de Spyder\n\nEste es un archivo temporal.\n\"\"\"\n\ndef largo (l, n):\n i=0\n cuenta=1\n valor1=0\n valor2=0\n while cuenta < n+1 or cuenta==n+1:\n a=l[i]\n b=l[i+1]\n if a==b:\n cuenta+= 1\n valor1=a\n i+=1\n...
false
7,496
1066f86d3a35e892ca2a7054dfc89fe79f1d32c8
from django.db import models from helpers.models import BaseAbstractModel from Auth.models import Profile # from Jobs.models import UserJob from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class Notification(BaseAbstractModel): title = models.CharField(m...
[ "from django.db import models\nfrom helpers.models import BaseAbstractModel\nfrom Auth.models import Profile\n# from Jobs.models import UserJob\nfrom django.db.models.signals import post_save\nfrom django.dispatch import receiver\n# Create your models here.\nclass Notification(BaseAbstractModel):\n title = model...
false
7,497
18dc01f3e1672407800e53d80a85ffc8d5b86c17
# # Copyright (C) 2020 RFI # # Author: James Parkhurst # # This code is distributed under the GPLv3 license, a copy of # which is included in the root directory of this package. # import logging import numpy from maptools.util import read, write # Get the logger logger = logging.getLogger(__name__) def array_rebin(...
[ "#\n# Copyright (C) 2020 RFI\n#\n# Author: James Parkhurst\n#\n# This code is distributed under the GPLv3 license, a copy of\n# which is included in the root directory of this package.\n#\nimport logging\nimport numpy\nfrom maptools.util import read, write\n\n\n# Get the logger\nlogger = logging.getLogger(__name__)...
false
7,498
9184779731d6102498934d77b6d3c0283fc594d9
from pwn import * hostname = "pwnable.kr" portnum = 2222 username = "input2" passwd = "guest" def main(): args = ["./input"] print("./input", end="") for x in range(99): print(" AA", end="") args.append("AA") print(args) ''' s = ssh(host=hostname, port=portnum, ...
[ "from pwn import *\n\nhostname = \"pwnable.kr\"\nportnum = 2222\nusername = \"input2\"\npasswd = \"guest\"\n\ndef main():\n\n args = [\"./input\"]\n print(\"./input\", end=\"\")\n for x in range(99):\n print(\" AA\", end=\"\")\n args.append(\"AA\")\n\n print(args)\n\n'''\n s = ssh(ho...
false
7,499
1ce7b292f89fdf3f978c75d4cdf65b6991f71d6f
# Generated by Django 2.2.1 on 2019-05-05 18:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.AlterField( model_name='divida', name='id_cliente', ...
[ "# Generated by Django 2.2.1 on 2019-05-05 18:41\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='divida',\n name='id_cli...
false