index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
8,100 | 58438a1fb0b9e620717ba262c25a43bfbf6b8824 | __author__ = 'tcaruso'
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import fnmatch
import os
import sys
import warnings
from shutil import rmtree
from setuptools import find_packages, setup, Command
from collections import namedtuple
try:
from pip._internal.req import parse_requirements
except Impo... | [
"__author__ = 'tcaruso'\n\n# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport glob\nimport fnmatch\nimport os\nimport sys\nimport warnings\nfrom shutil import rmtree\nfrom setuptools import find_packages, setup, Command\nfrom collections import namedtuple\n\ntry:\n from pip._internal.req import parse_requ... | false |
8,101 | 8a0a98ab072e46463d80d8638c830e6db0032a77 | import cv2
import random
import os
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.utils.data import Dataset
from torchvision import transforms
class ShanghaiTechPartA(Dataset):
def __init__(self, root, shuffle=False, transform=None, downsample=1):
self.root = root
sel... | [
"import cv2\nimport random\nimport os\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nimport torch\nfrom torch.utils.data import Dataset\nfrom torchvision import transforms\n\n\nclass ShanghaiTechPartA(Dataset):\n def __init__(self, root, shuffle=False, transform=None, downsample=1):\n self.root... | false |
8,102 | a3662b4b9569046e67c39c1002234c1fbd85c650 | # Name: BoardingPass.py
# Description: Class to create and output a boarding pass
# Ver. Writer Date Notes
# 1.0 Shuvam Chatterjee 05/22/20 Original
from random import randint
class BoardingPass:
def __init__(self, reservation):
self.reservation = reservation
s... | [
"# Name: BoardingPass.py\n# Description: Class to create and output a boarding pass\n\n# Ver. Writer Date Notes\n# 1.0 Shuvam Chatterjee 05/22/20 Original\n\nfrom random import randint\n\nclass BoardingPass:\n def __init__(self, reservation):\n self.reservation = reserv... | false |
8,103 | bc9718fa57046888961d1b5245abefa8f752e983 | import hashlib
import os
def fileMD(self):
salt_ = os.urandom(32).hex()
hash_object = hashlib.md5()
hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))
print("MD5 Hash: "+hash_object.hexdigest()) | [
"import hashlib\nimport os\n\n\ndef fileMD(self):\n salt_ = os.urandom(32).hex()\n hash_object = hashlib.md5()\n hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))\n print(\"MD5 Hash: \"+hash_object.hexdigest())",
"import hashlib\nimport os\n\n\ndef fileMD(self):\n ... | false |
8,104 | 43ecb173e3d306284f2122410b5b74945572f683 | #!/usr/bin/env python
#coding:utf-8
'''
Created on 2016年8月29日
@author: lichen
'''
def custom_proc(request):
"""
自定义context_processors
"""
return {
"context_test":"test"
} | [
"#!/usr/bin/env python\n#coding:utf-8\n\n'''\nCreated on 2016年8月29日\n\n@author: lichen\n'''\n\ndef custom_proc(request):\n \"\"\"\n 自定义context_processors\n \"\"\"\n return {\n \"context_test\":\"test\"\n }",
"<docstring token>\n\n\ndef custom_proc(request):\n \"\"\"\n 自定义co... | false |
8,105 | 9ae7b6d081529a5c70b7362c852647b3638e7e98 | print ("Hello"*5)
| [
"print (\"Hello\"*5)\n",
"print('Hello' * 5)\n",
"<code token>\n"
] | false |
8,106 | 71c6d5e385e3db8444d7ef8b0231e72db8538eb7 | """
TODO: update description after everything (requirements) is (are) stable/concrete
Description: Script to extract KeepingTrac's creative names and send
team notification to start manual mapping as necessary.
This step must happen BEFORE the processing of deduping of RenTrak
creative names (step 2 in RenTrak p... | [
"\"\"\"\r\nTODO: update description after everything (requirements) is (are) stable/concrete\r\nDescription: Script to extract KeepingTrac's creative names and send\r\nteam notification to start manual mapping as necessary.\r\n\r\nThis step must happen BEFORE the processing of deduping of RenTrak\r\ncreative names ... | false |
8,107 | 6c0080aa62579b4cbdaf3a55102924bfe31ffb40 | #давайте напишем программу русской рулетки
import random
amount_of_bullets = int(input("Сколько вы хотите вставить патронов?"))
baraban = [0, 0, 0, 0, 0, 0]
# 0 -аналогия пустого гнезда
# 1 - аналогия гнезда с патроном
for i in range(amount_of_bullets):
print(i)
baraban[i] = 1
print("Посмотрите на барабан"... | [
"#давайте напишем программу русской рулетки\n\nimport random\n\namount_of_bullets = int(input(\"Сколько вы хотите вставить патронов?\"))\n\nbaraban = [0, 0, 0, 0, 0, 0]\n# 0 -аналогия пустого гнезда\n# 1 - аналогия гнезда с патроном\n\nfor i in range(amount_of_bullets):\n print(i)\n baraban[i] = 1\n\nprint(\"... | false |
8,108 | 9e751bbddabbec7c5e997578d99ef1b8c35efe06 | from djitellopy import Tello
import time
import threading
import pandas as pd
class DataTello:
def __init__(self):
# Inicia objeto de controle do Tello
self.tello = Tello()
# Array onde será armazenado a lista de dados coletado pelo Tello
self.__data = []
self.... | [
"from djitellopy import Tello\nimport time\nimport threading\nimport pandas as pd\n\nclass DataTello:\n \n def __init__(self):\n # Inicia objeto de controle do Tello\n self.tello = Tello()\n \n # Array onde será armazenado a lista de dados coletado pelo Tello\n self.__data =... | false |
8,109 | c8d5b8515a468190d14311118e12a7d414908be6 | class UF(object):
def __init__(self, n):
self.parents = [i for i in range(n)]
self.weights = [1 for i in range(n)]
self.n = n
def find(self, i):
while i != self.parents[i]:
self.parents[i] = self.parents[self.parents[i]]
i = self.parents[i]
return... | [
"class UF(object):\n def __init__(self, n):\n self.parents = [i for i in range(n)]\n self.weights = [1 for i in range(n)]\n self.n = n\n\n def find(self, i):\n while i != self.parents[i]:\n self.parents[i] = self.parents[self.parents[i]]\n i = self.parents[i]\... | false |
8,110 | acb9b6128a3432aecf3498e1d27bdff204fee0f4 | import unittest
import calla.test
TestCase = calla.test.TestCase
from math import pi
from calla.TB.RC_strength import *
class test(TestCase):
def test1(self):
"""
标准验证:铁路混凝土结构设计原理(容许应力计算法).ppt 例1
"""
b = 200
h0 = 411
As = 763
n = 15
M = 31.5
r... | [
"import unittest\nimport calla.test\nTestCase = calla.test.TestCase\nfrom math import pi\nfrom calla.TB.RC_strength import *\n\nclass test(TestCase):\n def test1(self):\n \"\"\"\n 标准验证:铁路混凝土结构设计原理(容许应力计算法).ppt 例1\n \"\"\"\n b = 200\n h0 = 411\n As = 763\n n = 15\n... | false |
8,111 | 9d142e8de5235d55cd99371c9884e8dc7a10c947 | import os
from flask import (
Flask,
render_template,
request
)
# from flask_jwt_extended import JWTManager
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_wtf.csrf import CSRFError, CSRFProtect
from config import Config
from log_con... | [
"import os\nfrom flask import (\n Flask,\n render_template,\n request\n)\n# from flask_jwt_extended import JWTManager\nfrom flask_login import LoginManager\nfrom flask_migrate import Migrate\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_wtf.csrf import CSRFError, CSRFProtect\n\nfrom config import Co... | false |
8,112 | be9c21ee04a612f711a1e6a82ea9478c77b62a82 | import ZooAnnouncerInterface
class ZooAnnouncer(ZooAnnouncerInterface):
def updateZoo(self,annoucement):
print("ZooAnnouncer :" + annoucement) | [
"import ZooAnnouncerInterface\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n def updateZoo(self,annoucement):\n print(\"ZooAnnouncer :\" + annoucement)",
"import ZooAnnouncerInterface\n\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n\n def updateZoo(self, annoucement):\n print('ZooAnnouncer :... | false |
8,113 | 8bae45de54535e7b0788aa12717645ae9f193664 | from flask import Flask, request, jsonify
from flask_restful import Api
import json
import eth_account
import algosdk
app = Flask(__name__)
api = Api(app)
app.url_map.strict_slashes = False
@app.route('/verify', methods=['GET','POST'])
def verify():
content = request.get_json(silent=True, force=True)
#Check i... | [
"from flask import Flask, request, jsonify\nfrom flask_restful import Api\nimport json\nimport eth_account\nimport algosdk\n\napp = Flask(__name__)\napi = Api(app)\napp.url_map.strict_slashes = False\n\n@app.route('/verify', methods=['GET','POST'])\ndef verify():\n content = request.get_json(silent=True, force=T... | false |
8,114 | 04dc4d46a645a23913e33606c500037d37418cd7 | import numpy as np
import pandas as pd
from scipy import sparse, io
import cPickle as pickle
import sys
sys.path.append('code')
import models
import split
from itertools import chain
def test_simple_instance(items, item_numbers, negative_items, user):
model = models.Word2VecRecommender(size=200, window=max(item_nu... | [
"import numpy as np\nimport pandas as pd\nfrom scipy import sparse, io\nimport cPickle as pickle\nimport sys\nsys.path.append('code')\nimport models\nimport split\nfrom itertools import chain\n\ndef test_simple_instance(items, item_numbers, negative_items, user):\n model = models.Word2VecRecommender(size=200, wi... | true |
8,115 | 1262d41be3bf873d003464cb23998dde20fde318 | import array
def swap(arr, first, second):
"""
Swaps the first index with the second.
arr: an input array
first: an index in the array
second: an index in the array
This function has the side effect mentioned above.
"""
arr[first], arr[second] = arr[second], arr[first]
def parent(i):... | [
"import array\n\ndef swap(arr, first, second):\n \"\"\"\n Swaps the first index with the second.\n\n arr: an input array\n first: an index in the array\n second: an index in the array\n\n This function has the side effect mentioned above.\n \"\"\"\n arr[first], arr[second] = arr[second], arr... | false |
8,116 | d483314fa7e8a2514fd5089b872b9e480e7454f4 | ####################################################################################
# About
# Date: April 12, 2018
# Notes
'''
Code that renames a list of files in a directory
MUST Run in Python 3 environment!
jpeg Drop extra number at the end of unique ID
add DEL or INS based on variant type
'''
'''
Resources
-----... | [
"####################################################################################\n# About\n# Date: April 12, 2018\n# Notes\n'''\nCode that renames a list of files in a directory\nMUST Run in Python 3 environment!\n\njpeg Drop extra number at the end of unique ID\nadd DEL or INS based on variant type\n'''\n\n''... | false |
8,117 | 79c4a2d4503c2639950675b398e000aae367ff4a | from app.models.tables import Warehouse, Contractor, Articles
class ContractorTools(Contractor):
"""
Работа со справочником КА
"""
@staticmethod
def add_contractor(**kwargs):
ca = Contractor(**kwargs)
ca.insert()
@staticmethod
def delete_contractor(**kwargs):
ca =... | [
"from app.models.tables import Warehouse, Contractor, Articles\n\n\nclass ContractorTools(Contractor):\n \"\"\"\n Работа со справочником КА\n \"\"\"\n\n @staticmethod\n def add_contractor(**kwargs):\n ca = Contractor(**kwargs)\n ca.insert()\n\n @staticmethod\n def delete_contracto... | false |
8,118 | dbf831540d11a994d5483dc97c7eab474f91f0d3 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xde\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x28\x... | [
"# -*- coding: utf-8 -*-\n\n# Resource object code\n#\n# Created by: The Resource Compiler for PyQt5 (Qt v5.15.0)\n#\n# WARNING! All changes made in this file will be lost!\n\nfrom PyQt5 import QtCore\n\nqt_resource_data = b\"\\\n\\x00\\x00\\x01\\xde\\\n\\x89\\\n\\x50\\x4e\\x47\\x0d\\x0a\\x1a\\x0a\\x00\\x00\\x00\\x... | false |
8,119 | dad4e14da734f2e2329f4cbe064c73c82a4ae27c | import os as os
import io as io
import re
class Stopwords:
def __init__(self, base_dir='data'):
self.base_dir = base_dir
def load_stopwords(self, base_dir=None, stopwords_file='stopwords.csv'):
# Load stopwords from file.
if base_dir is not None:
self.base_dir = base_dir
... | [
"import os as os\nimport io as io\nimport re\n\nclass Stopwords:\n\n def __init__(self, base_dir='data'):\n self.base_dir = base_dir\n\n def load_stopwords(self, base_dir=None, stopwords_file='stopwords.csv'):\n # Load stopwords from file.\n if base_dir is not None:\n self.base... | false |
8,120 | a2569ccd509fa755f4cad026f483bcf891c6fb41 | from pybrain3.datasets import SupervisedDataSet
inputDataSet = SupervisedDataSet(35, 20) #Creating new DataSet
#A
inputDataSet.addSample(( #Adding first sample to dataset
-1, 1, 1, 1, -1,
1, -1, -1, -1, 1,
1, -1, -1, -1, 1,
1, 1, 1, 1, 1,
1, -1, -1, -1, 1,
1, -1,... | [
"from pybrain3.datasets import SupervisedDataSet\n\ninputDataSet = SupervisedDataSet(35, 20) #Creating new DataSet\n\n#A\ninputDataSet.addSample(( #Adding first sample to dataset\n -1, 1, 1, 1, -1,\n 1, -1, -1, -1, 1,\n 1, -1, -1, -1, 1,\n 1, 1, 1, 1, 1,\n 1, -1, -1, -1... | false |
8,121 | bd25b97de78f04510e43f13d356eb6c0025e223d | #!/usr/bin/python
"""
An extensible private pypi index.
NOTES ON PACKAGE NAMES
----------------------
MPyPi tries the following when it does not find a package
with the given name in the index:
- replaces all _ with - and
- lowercases the package name
"""
from __future__ import print_function
from __future__ ... | [
"#!/usr/bin/python\n\"\"\"\nAn extensible private pypi index.\n\nNOTES ON PACKAGE NAMES\n----------------------\nMPyPi tries the following when it does not find a package \nwith the given name in the index:\n - replaces all _ with - and\n - lowercases the package name\n\"\"\"\nfrom __future__ import print_fun... | false |
8,122 | 74f85732b4e1f4ef2b82a48818cbaedb18a56083 | from pydis.datastruct.sds import SdsImp
class RPCStub(object):
def __init__(self):
pass
def SET(self, key, value):
self
print("{}: {}".format(key, value))
| [
"from pydis.datastruct.sds import SdsImp\n\n\nclass RPCStub(object):\n def __init__(self):\n pass\n\n def SET(self, key, value):\n self\n print(\"{}: {}\".format(key, value))\n",
"from pydis.datastruct.sds import SdsImp\n\n\nclass RPCStub(object):\n\n def __init__(self):\n pas... | false |
8,123 | 45c1510d19af0979326a1b9975ec363b0b80a291 | import pkg_resources
from twisted.enterprise import adbapi
from twisted.internet import defer
# Start a logger with a namespace for a particular subsystem of our application.
from twisted.logger import Logger
log = Logger("database")
class Database:
def __init__(self, context, db_filename="database.sqlite"):
... | [
"import pkg_resources\nfrom twisted.enterprise import adbapi\nfrom twisted.internet import defer\n\n# Start a logger with a namespace for a particular subsystem of our application.\nfrom twisted.logger import Logger\nlog = Logger(\"database\")\n\nclass Database:\n def __init__(self, context, db_filename=\"databa... | false |
8,124 | 3bb6305ceb1491db57c7f8b03e438398644c8f90 | from Eutils.pathmagic import context
with context():
import argparse
import numpy as np
from model.hourglass_yolo_net_multi_gpu import HOURGLASSYOLONet
from evaluator.Eutils.pascal_val import PASCAL_VAL
# from evaluator.Eutils.coco_val import COCO_VAL
from evaluator.Eutils.detector import Detect... | [
"from Eutils.pathmagic import context\nwith context():\n import argparse\n import numpy as np\n from model.hourglass_yolo_net_multi_gpu import HOURGLASSYOLONet\n from evaluator.Eutils.pascal_val import PASCAL_VAL\n # from evaluator.Eutils.coco_val import COCO_VAL\n from evaluator.Eutils.detector i... | false |
8,125 | f6c5c2180a1a4b05b3f103c330b455e7387713a6 | #!/usr/bin/env python
import numpy as np
import cv2
# Creat a Image with Pixel 512x512 RGB
image = np.zeros((512, 512, 3), np.uint8)
# Pt Definition
# x0y0, x1y0, x2 y0
# x0y1 , x1y1, x2y1
# Draw a Line in the Middle of the image
# Start Co-ordinate end Co-ordinate While Color and Line Width
cv2.line(image, (0, 0),... | [
"#!/usr/bin/env python\n\nimport numpy as np\nimport cv2\n\n# Creat a Image with Pixel 512x512 RGB\nimage = np.zeros((512, 512, 3), np.uint8)\n\n\n# Pt Definition\n# x0y0, x1y0, x2 y0\n# x0y1 , x1y1, x2y1\n# Draw a Line in the Middle of the image\n# Start Co-ordinate end Co-ordinate While Color and Line Width\ncv2.... | false |
8,126 | 49722f640eec02029865fd702e13e485eda6391b | import math_series.series as func
""" Testing for fibonacci function """
def test_fibonacci_zero():
actual = func.fibonacci(0)
expected = 0
assert actual == expected
def test_fibonacci_one():
actual = func.fibonacci(1)
expected = 1
assert actual == expected
def test_fibonacci_negative():... | [
"import math_series.series as func\n\n\"\"\" Testing for fibonacci function \"\"\"\ndef test_fibonacci_zero():\n actual = func.fibonacci(0)\n expected = 0\n assert actual == expected\n\ndef test_fibonacci_one():\n actual = func.fibonacci(1)\n expected = 1\n assert actual == expected\n\n\ndef t... | false |
8,127 | d13589979ba7b6facd8339111323270c9920a9bf | # Generated by Django 2.0.4 on 2018-04-30 14:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('base... | [
"# Generated by Django 2.0.4 on 2018-04-30 14:01\n\nfrom django.conf import settings\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 migrations.swappable_dependency(settings.AUTH_USER_MODEL... | false |
8,128 | 4fff64a62776a9d1b06cc11d5e55fc00f6787338 | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Aplicação H2HC criado para CTF
Exploit criado por M4v3r1ck (helvio_junior[at]hotmail[dot]com)
'''
from pwn import *
import os
context(arch='amd64', os='windows', log_level='debug')
host= "192.168.255.201"
port = 54345
# Estágio 1
log.info("Enviando estágio 1")
payload1... | [
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n'''\nAplicação H2HC criado para CTF\nExploit criado por M4v3r1ck (helvio_junior[at]hotmail[dot]com)\n'''\n\nfrom pwn import *\nimport os\n \ncontext(arch='amd64', os='windows', log_level='debug')\n\nhost= \"192.168.255.201\"\nport = 54345\n\n# Estágio 1\nlog.info(\"Envia... | false |
8,129 | 0c7f2412fe9a83d70d41fbc4bbaf135e6bc4149a | # Generated by Django 2.2.6 on 2019-11-05 02:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('drchrono', '0011_patient_cell_phone'),
]
operations = [
migrations.AddField(
model_name='appointment',
name='date',
... | [
"# Generated by Django 2.2.6 on 2019-11-05 02:28\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('drchrono', '0011_patient_cell_phone'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='appointment',\n ... | false |
8,130 | 321147f2e2d8caf6d9224e2a8969f51ded48baf7 | # Generated by Django 3.1.5 on 2021-02-24 18:34
from django.db import migrations, models
import stdimage.models
class Migration(migrations.Migration):
dependencies = [
('Site', '0004_arquivopdf'),
]
operations = [
migrations.CreateModel(
name='historico',
fields=... | [
"# Generated by Django 3.1.5 on 2021-02-24 18:34\n\nfrom django.db import migrations, models\nimport stdimage.models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('Site', '0004_arquivopdf'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='historico',\... | false |
8,131 | e37f958191c9481c6664e90c17f43419a0b5b606 | from __future__ import annotations
from typing import TYPE_CHECKING
import abc
import tcod.event
if TYPE_CHECKING:
from tcodplus.canvas import Canvas
from tcodplus.event import CanvasDispatcher
class IDrawable(abc.ABC):
@property
@abc.abstractmethod
def force_redraw(self) -> bool:
pass
... | [
"from __future__ import annotations\nfrom typing import TYPE_CHECKING\nimport abc\nimport tcod.event\n\nif TYPE_CHECKING:\n from tcodplus.canvas import Canvas\n from tcodplus.event import CanvasDispatcher\n\n\nclass IDrawable(abc.ABC):\n @property\n @abc.abstractmethod\n def force_redraw(self) -> boo... | false |
8,132 | 9b30075183cf9611307afa74aa45979872e7e9d5 | # coding: utf-8
# Copyright 2020. ThingsBoard
# #
# 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
# #
# Unl... | [
"# coding: utf-8\n# Copyright 2020. ThingsBoard\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... | false |
8,133 | a505cc0e382554d65447a3fe3a56fac43c1964f2 | import datetime
import json
import logging
import requests
from lib.crits.exceptions import CRITsOperationalError
from lib.crits.vocabulary.indicators import IndicatorThreatTypes as itt
from lib.crits.vocabulary.indicators import IndicatorAttackTypes as iat
log = logging.getLogger()
class CRITsAPI():
def __init... | [
"import datetime\nimport json\nimport logging\nimport requests\n\nfrom lib.crits.exceptions import CRITsOperationalError\nfrom lib.crits.vocabulary.indicators import IndicatorThreatTypes as itt\nfrom lib.crits.vocabulary.indicators import IndicatorAttackTypes as iat\n\nlog = logging.getLogger()\n\nclass CRITsAPI():... | false |
8,134 | f4e45c19105d4ee1520acc0cd61dadfe27904d0f | from sklearn.base import BaseEstimator
class movingAverage(BaseEstimator):
'''Implements a moving average.'''
def __init__(self, lag):
self.lag = lag
def movingAverage(self, periods=5):
'''Implements a naiveLV forecast.'''
try:
# sets data
x = self.data['Values']
d = ... | [
"from sklearn.base import BaseEstimator\n\n\nclass movingAverage(BaseEstimator):\n '''Implements a moving average.'''\n\n def __init__(self, lag):\n self.lag = lag\n\ndef movingAverage(self, periods=5):\n '''Implements a naiveLV forecast.'''\n try:\n # sets data\n x = self.data['Val... | true |
8,135 | c2f39e33030cbe7c5d4827b47fb28d7604bdbc6d | #Write your function here
def over_nine_thousand(lst):
sum = 0
for number in lst:
sum += number
if (sum > 9000):
break
return sum
#Uncomment the line below when your function is done
print(over_nine_thousand([8000, 900, 120, 5000]))
#9020 | [
"#Write your function here\ndef over_nine_thousand(lst):\n sum = 0\n for number in lst:\n sum += number\n if (sum > 9000):\n break\n return sum\n\n#Uncomment the line below when your function is done\nprint(over_nine_thousand([8000, 900, 120, 5000]))\n\n#9020",
"def over_nine_thousand(lst):\n sum... | false |
8,136 | 4c5db1af9fd1c9b09f6e64a44d72351807c0f7a5 | from functools import reduce
from math import (log, sqrt)
import matplotlib.pyplot as plt
import matplotlib.pylab as mlab
import numpy
import random
import scipy.stats
class Node:
def __init__(
self,
name,
val=None,
observed=False,
candidate_standard_devi... | [
"from functools import reduce\nfrom math import (log, sqrt)\nimport matplotlib.pyplot as plt\nimport matplotlib.pylab as mlab\nimport numpy\nimport random\nimport scipy.stats\n\nclass Node:\n def __init__(\n self,\n name,\n val=None,\n observed=False,\n cand... | false |
8,137 | 575768c200ad81f878c132d68569c84f497091f2 | import xml.etree.ElementTree as ET
class Stage:
def __init__(
self, costumes,
sounds, variables,
blocks, scripts,
sprites
):
self.costumes = costumes
self.sounds = sounds
self.variables = variables
self.blocks = blocks
self.scripts = scri... | [
"import xml.etree.ElementTree as ET\n\nclass Stage:\n\n def __init__(\n self, costumes,\n sounds, variables,\n blocks, scripts,\n sprites\n ):\n self.costumes = costumes\n self.sounds = sounds\n self.variables = variables\n self.blocks = blocks\n ... | false |
8,138 | 163475bbe8a5b6eb161e2bb7e9b9a9a3ea0879d2 | import logging
from subprocess import Popen, PIPE
from .exceptions import VideoEncodingError, WrongVideoTypeError
# TODO: Create a switchable encoding engine.
logger = logging.getLogger('video.encoding')
cmd_ffmpeg = [
'ffmpeg',
'-i',
]
cmd_mp4 = [
'-vf', 'scale=640:360',
'-vcodec', 'h264',
'-a... | [
"import logging\n\nfrom subprocess import Popen, PIPE\nfrom .exceptions import VideoEncodingError, WrongVideoTypeError\n\n# TODO: Create a switchable encoding engine.\n\nlogger = logging.getLogger('video.encoding')\n\ncmd_ffmpeg = [\n 'ffmpeg',\n '-i',\n]\n\ncmd_mp4 = [\n '-vf', 'scale=640:360',\n '-vco... | false |
8,139 | 80ad4459436e2e1cc44509e7dae18d1539bf2bc0 | import pymysql
class DB:
def __init__(self, host='localhost', port=3306, db_='test', user='wj',
passwd='', charset='utf8'):
self.db = db_
self.conn = pymysql.connect(host=host, port=port, db=db_, user=user, passwd=passwd, charset=charset)
self.cur = self.conn.curso... | [
"import pymysql\r\n\r\n\r\nclass DB:\r\n def __init__(self, host='localhost', port=3306, db_='test', user='wj',\r\n passwd='', charset='utf8'):\r\n self.db = db_\r\n self.conn = pymysql.connect(host=host, port=port, db=db_, user=user, passwd=passwd, charset=charset)\r\n self.... | false |
8,140 | 47e9b73fc7f6b3c8295e78d0cdb5aa51ca4c5f8d | from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND
from ...models.brand import Brand
from ...models.product import type_currency_choices, type_condition_choices, User, Product
from ...models.product_c... | [
"from rest_framework.generics import GenericAPIView\nfrom rest_framework.response import Response\nfrom rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND\nfrom ...models.brand import Brand\nfrom ...models.product import type_currency_choices, type_condition_choices, User, Product\nfrom ...models... | false |
8,141 | e626a7f3f9241db8684c3b8c1bd79ea49e03490d | import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, Sequential, optimizers
import numpy as np
from tensorflow.compat.v1.keras.backend import set_session
config = tf.compat.v1.ConfigProto()
config.gpu_optio... | [
"import tensorflow as tf\nimport os\n\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\nimport tensorflow as tf\nfrom tensorflow import keras\nfrom tensorflow.keras import layers, Sequential, optimizers\nimport numpy as np\nfrom tensorflow.compat.v1.keras.backend import set_session\n\nconfig = tf.compat.v1.ConfigProto()\n... | false |
8,142 | bf2b3b74f772026328cdd04412455ee758c43d3f | import requests
from google.cloud import datastore
import google.cloud.logging
###Helper functions
def report_error(error_text):
"""Logs error to Stackdriver.
:param error_text: The text to log to Stackdriver
:type error_text: string
"""
client = google.cloud.logging.Client()
logger = client.l... | [
"import requests\nfrom google.cloud import datastore\nimport google.cloud.logging\n\n###Helper functions\n\ndef report_error(error_text):\n \"\"\"Logs error to Stackdriver.\n :param error_text: The text to log to Stackdriver\n :type error_text: string\n \"\"\"\n client = google.cloud.logging.Client()... | false |
8,143 | f3527185117fd7205f55f47f2f08448a7d7b0100 |
import netCDF4 as nc
import numpy as np
import os
def RangeExtender(filename,directory):
fileNC=nc.Dataset(directory+filename,'r')
nu=fileNC['nu'][:]
filename,ext=os.path.splitext(filename)
fileOut=nc.Dataset(directory+filename+"_50000cm-1.nc",'w')
nu_orig_length=len(nu)
step=abs(nu[1]... | [
"\n\n\nimport netCDF4 as nc\nimport numpy as np\nimport os\n\n\ndef RangeExtender(filename,directory):\n \n fileNC=nc.Dataset(directory+filename,'r')\n nu=fileNC['nu'][:]\n filename,ext=os.path.splitext(filename)\n fileOut=nc.Dataset(directory+filename+\"_50000cm-1.nc\",'w')\n nu_orig_length=len(n... | false |
8,144 | bb540ba4cd96e2485e77ba099f0a1a9ea03e1120 | import random
def multi():
scc = [6, 5, 4]
sc = [6, 5]
cc = [5, 4]
crew = [4]
captain = [5]
ship = [6]
n = 0
while n <= 2:
inp = input("Hit enter to roll")
if inp == "":
roll5 = random.choices(range(1, 7), k=5)
print(roll5)
if set(scc)... | [
"import random\ndef multi():\n\n scc = [6, 5, 4]\n sc = [6, 5]\n cc = [5, 4]\n crew = [4]\n captain = [5]\n ship = [6]\n n = 0\n while n <= 2:\n inp = input(\"Hit enter to roll\")\n if inp == \"\":\n roll5 = random.choices(range(1, 7), k=5)\n print(roll5)\... | false |
8,145 | bf65d4a4e066e3e06b888d4b9ed49e10e66b4e78 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 22 20:21:16 2018
@author: Yijie
"""
#Q4:
#(1)
yours = ['Yale','MIT','Berkeley']
mine = ['Harvard','CAU','Stanford']
ours1 = mine + yours
ours2=[]
ours2.append(mine)
ours2.append(yours)
print(ours1)
print(ours2)
# Difference:the print out results indicate that the list 'o... | [
"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Jan 22 20:21:16 2018\n\n@author: Yijie\n\"\"\"\n\n#Q4:\n#(1)\nyours = ['Yale','MIT','Berkeley']\nmine = ['Harvard','CAU','Stanford']\nours1 = mine + yours\nours2=[]\nours2.append(mine)\nours2.append(yours)\nprint(ours1)\nprint(ours2)\n# Difference:the print out resul... | false |
8,146 | d9908d1ff155390dcd456dd15f92db03f093089e | #!/usr/bin/env python3
class interceptThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.curPkt = None
self.seq = 0
self.foundUAV = False
def run(self):
sniff(prn=self.interceptPkt, filter='udp port 5556')
def interceptPkt(self, pkt):
... | [
"#!/usr/bin/env python3\n\nclass interceptThread(threading.Thread):\n def __init__(self):\n threading.Thread.__init__(self)\n self.curPkt = None\n self.seq = 0\n self.foundUAV = False\n def run(self):\n sniff(prn=self.interceptPkt, filter='udp port 5556')\n def interceptP... | true |
8,147 | 22504b466cdeb380b976e23e2708e94131722e11 | from django.contrib import admin
from apap.models import *
# Register your models here.
admin.site.register(Doggo)
admin.site.register(Profile) | [
"from django.contrib import admin\nfrom apap.models import *\n# Register your models here.\n\nadmin.site.register(Doggo)\nadmin.site.register(Profile)",
"from django.contrib import admin\nfrom apap.models import *\nadmin.site.register(Doggo)\nadmin.site.register(Profile)\n",
"<import token>\nadmin.site.register... | false |
8,148 | 7903484b4a36d4b6ea03b9eaf3bf2b2e056baad8 | from setuptools import setup, find_packages
def find_version():
with open('pytest_defer.py') as fp:
for line in fp:
if '__version__' in line:
version = line.split('=')[-1].strip()
return version[1:-1] # trim ''
with open('README.md') as fp:
long_desc = fp... | [
"from setuptools import setup, find_packages\n\n\ndef find_version():\n with open('pytest_defer.py') as fp:\n for line in fp:\n if '__version__' in line:\n version = line.split('=')[-1].strip()\n return version[1:-1] # trim ''\n\n\nwith open('README.md') as fp:\n ... | false |
8,149 | c87f9885e96abdd32df68f9fe1942b2782bd5b96 | # https://stackoverflow.com/questions/69473844/can-you-calculate-the-size-of-a-text-annotation-in-matplotlib
from matplotlib.figure import Figure as mpl_Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as mpl_Canvas
fig = mpl_Figure()
x, y, text = 5, 7, 'My label text'
fig.gca().plot(x, y, 'k.')
ca... | [
"# https://stackoverflow.com/questions/69473844/can-you-calculate-the-size-of-a-text-annotation-in-matplotlib\n\nfrom matplotlib.figure import Figure as mpl_Figure\nfrom matplotlib.backends.backend_agg import FigureCanvasAgg as mpl_Canvas\n\nfig = mpl_Figure()\nx, y, text = 5, 7, 'My label text'\n\nfig.gca().plot(x... | false |
8,150 | 4488612164435ab062ca66000f0d7dc3ccd89da2 | from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwnerOrStaffOrReadOnly(BasePermission):
def has_object_permission(self, request, view, obj):
"""
Переопределяем права доступа.
Даем все права на запись, только владельцу или
администратору, на чтение даем... | [
"from rest_framework.permissions import BasePermission, SAFE_METHODS\n\n\nclass IsOwnerOrStaffOrReadOnly(BasePermission):\n\n def has_object_permission(self, request, view, obj):\n \"\"\"\n Переопределяем права доступа.\n\n Даем все права на запись, только владельцу или\n администрато... | false |
8,151 | edb80652de641a1a6cbb37a60cc236cd7828a96e |
'''
给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。
返回被除数 dividend 除以除数 divisor 得到的商
链接:https://leetcode-cn.com/problems/divide-two-integers
'''
# 该题看起来也不难,但是其中坑很多,想要写出健壮的代码并不容易
# 我个人思考可以考虑使用上下界,不断缩小范围来确定
def division(dividend, divisor):
temp = 0
for i in range(dividend + 1):
temp += abs(... | [
"\n'''\n给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。\n\n返回被除数 dividend 除以除数 divisor 得到的商\n\n链接:https://leetcode-cn.com/problems/divide-two-integers\n'''\n\n# 该题看起来也不难,但是其中坑很多,想要写出健壮的代码并不容易\n# 我个人思考可以考虑使用上下界,不断缩小范围来确定\ndef division(dividend, divisor):\n temp = 0\n for i in range(dividend + 1):\n ... | false |
8,152 | 27702f72ae147c435617acaab7dd7e5a5a737b13 | import unittest
import subprocess
import tempfile
import os
import filecmp
import shutil
import cfg
import utils
class TestFunctionalHumannEndtoEndBiom(unittest.TestCase):
"""
Test humann with end to end functional tests
"""
def test_humann_fastq_biom_output(self):
"""
Test the standa... | [
"import unittest\nimport subprocess\nimport tempfile\nimport os\nimport filecmp\nimport shutil\n\nimport cfg\nimport utils\n\nclass TestFunctionalHumannEndtoEndBiom(unittest.TestCase):\n \"\"\"\n Test humann with end to end functional tests\n \"\"\"\n\n def test_humann_fastq_biom_output(self):\n ... | false |
8,153 | eb75f6e959e9153e6588a0322d1ebc75e21e73ef | # Generated by Django 2.1.2 on 2018-10-26 05:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('candidate', '0004_remove_candidate_corrected_loc'),
]
operations = [
migrations.AlterField(
model_name='candidate',
... | [
"# Generated by Django 2.1.2 on 2018-10-26 05:03\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('candidate', '0004_remove_candidate_corrected_loc'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='candid... | false |
8,154 | 26df6ddf3533a8648b59f0fa2b03f89c93af7491 | import numpy as np
import pickle
import preprocessor
import pandas as pd
import sys
from scipy import spatial
class Predict:
def __init__(self, text):
"""
taking the user input string
loading trained feature numpy array
loading the output for the numpy array
loading the vec... | [
"import numpy as np\nimport pickle\nimport preprocessor\nimport pandas as pd\nimport sys\nfrom scipy import spatial\n\n\nclass Predict:\n def __init__(self, text):\n \"\"\"\n taking the user input string\n loading trained feature numpy array\n loading the output for the numpy array\n ... | false |
8,155 | ffee0b0e00b4cebecefc3671332af3e2ffe7491b | import visgraph.dbcore as vg_dbcore
dbinfo = {
'user':'visgraph',
'password':'ohhai!',
'database':'vg_test',
}
def vgtest_basic_database():
#vg_dbcore.initGraphDb(dbinfo)
gstore = vg_dbcore.DbGraphStore(dbinfo)
n1 = gstore.addNode(ninfo={'name':'foo', 'size':20})
n2 = gstore.addNode(ninfo={'name':'bar',... | [
"import visgraph.dbcore as vg_dbcore\n\ndbinfo = {\n'user':'visgraph',\n'password':'ohhai!',\n'database':'vg_test',\n}\n\ndef vgtest_basic_database():\n#vg_dbcore.initGraphDb(dbinfo)\n\n gstore = vg_dbcore.DbGraphStore(dbinfo)\n\n n1 = gstore.addNode(ninfo={'name':'foo', 'size':20})\n n2 = gstore.addNode(n... | true |
8,156 | e40f0a25d0c02f36c254e630133dc1fb11f29d4d | from rest_framework.urlpatterns import format_suffix_patterns
from django.urls import path
from external_api import views
urlpatterns = [
path('darksky/', views.DarkSkyView.as_view())
]
urlpatterns = format_suffix_patterns(urlpatterns)
| [
"from rest_framework.urlpatterns import format_suffix_patterns\nfrom django.urls import path\nfrom external_api import views\n\nurlpatterns = [\n path('darksky/', views.DarkSkyView.as_view())\n]\n\nurlpatterns = format_suffix_patterns(urlpatterns)\n",
"from rest_framework.urlpatterns import format_suffix_patte... | false |
8,157 | 87130c2bbf919cacd3d5dd823cd310dcad4dc790 | """Test suite for phlsys_tryloop."""
from __future__ import absolute_import
import datetime
import itertools
import unittest
import phlsys_tryloop
# =============================================================================
# TEST PLAN
# -----------------------------------------... | [
"\"\"\"Test suite for phlsys_tryloop.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport datetime\nimport itertools\nimport unittest\n\nimport phlsys_tryloop\n\n# =============================================================================\n# TEST PLAN\n# ------------------... | true |
8,158 | fee757b91f8c2ca1c105d7e67636772a8b5eafd5 | from logging import getLogger
from time import sleep
from uuid import UUID
from zmq import Context, Poller, POLLIN, ZMQError, ETERM # pylint: disable-msg=E0611
from zhelpers import zpipe
from dcamp.service.configuration import Configuration
from dcamp.types.messages.control import SOS
from dcamp.types.specs import E... | [
"from logging import getLogger\nfrom time import sleep\nfrom uuid import UUID\n\nfrom zmq import Context, Poller, POLLIN, ZMQError, ETERM # pylint: disable-msg=E0611\nfrom zhelpers import zpipe\n\nfrom dcamp.service.configuration import Configuration\nfrom dcamp.types.messages.control import SOS\nfrom dcamp.types.... | false |
8,159 | 93a2385d9ebdbc1a7a88185c0a0d5d1f227e46a3 | import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions,SetupOptions
from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.options.pipeline_options import StandardOptions
dataflow_options = ['--project=lofty-shine-248403', '--job_name=newjob', '--temp_... | [
"import apache_beam as beam\nfrom apache_beam.options.pipeline_options import PipelineOptions,SetupOptions\nfrom apache_beam.options.pipeline_options import GoogleCloudOptions\nfrom apache_beam.options.pipeline_options import StandardOptions\n\ndataflow_options = ['--project=lofty-shine-248403', '--job_name=newjob'... | false |
8,160 | d8cbed25f4c97be5a74a6e1f097fcb9fa9439a9a | import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
# Raspberry Pi pin configuration:
RST = 24
# Note the following are only used with SPI:
DC = 23
SPI_PORT = 0
SPI_DEVICE = 0
# Beaglebone Black pin configuration:
# RST = 'P9_12'
# Note the following are only used with SPI:
# DC = 'P9_15'
# SPI_PORT = 1
# SPI_DEV... | [
"import Adafruit_GPIO.SPI as SPI\nimport Adafruit_SSD1306\n\n# Raspberry Pi pin configuration:\nRST = 24\n# Note the following are only used with SPI:\nDC = 23\nSPI_PORT = 0\nSPI_DEVICE = 0\n\n# Beaglebone Black pin configuration:\n# RST = 'P9_12'\n# Note the following are only used with SPI:\n# DC = 'P9_15'\n# SPI... | false |
8,161 | 997c1c86848b59a3986a579d5b1b50313fdfdf44 | from stats_arrays.distributions import GeneralizedExtremeValueUncertainty as GEVU
from stats_arrays.errors import InvalidParamsError
from ..base import UncertaintyTestCase
import numpy as np
class GeneralizedExtremeValueUncertaintyTestCase(UncertaintyTestCase):
def test_random_variables(self):
params = s... | [
"from stats_arrays.distributions import GeneralizedExtremeValueUncertainty as GEVU\nfrom stats_arrays.errors import InvalidParamsError\nfrom ..base import UncertaintyTestCase\nimport numpy as np\n\n\nclass GeneralizedExtremeValueUncertaintyTestCase(UncertaintyTestCase):\n\n def test_random_variables(self):\n ... | false |
8,162 | 80c6dd1c76b3ac56f34e36f571e8db3927994311 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Fetch screen scores with customizable search criteria
that can be tailored to match your own requirements
in tab format
"""
import requests
from core import config as cfg
screen_id = 178
request_url = cfg.BASE_URL + "/screen/" + str(screen_id)
# These parameters ca... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nFetch screen scores with customizable search criteria\nthat can be tailored to match your own requirements\nin tab format\n\"\"\"\n\nimport requests\nfrom core import config as cfg\n\nscreen_id = 178\nrequest_url = cfg.BASE_URL + \"/screen/\" + str(screen_... | false |
8,163 | 53bf97d66d0b26c6b5639acd0261604082474e7b | '''Instantiate data parsers for all cities.
If additional city parsers are added, the `bikerrawdata` instance in this file should be updated.
Written by: Anders Ohrn 2020
'''
from dataset_creators.cities import parse_taipei_file, taipei_system, \
parse_london_file, london_system, ... | [
"'''Instantiate data parsers for all cities.\n\nIf additional city parsers are added, the `bikerrawdata` instance in this file should be updated.\n\nWritten by: Anders Ohrn 2020\n\n'''\nfrom dataset_creators.cities import parse_taipei_file, taipei_system, \\\n parse_london_file, l... | false |
8,164 | cc71c0cc1ec21dc465486fb5894c4d389c39bd62 | import markovify
import argparse
import sqlite3
import time
modelFile = './data/model.json'
corpusFile = './data/corpus.txt'
dbFile = './data/tweets.sqlite3'
def generate():
generate_count = 168
model_json = open(modelFile, 'r').read()
model = markovify.Text.from_json(model_json)
conn = sqlite3.conne... | [
"import markovify\nimport argparse\nimport sqlite3\nimport time\n\nmodelFile = './data/model.json'\ncorpusFile = './data/corpus.txt'\ndbFile = './data/tweets.sqlite3'\n\ndef generate():\n generate_count = 168\n model_json = open(modelFile, 'r').read()\n model = markovify.Text.from_json(model_json)\n\n c... | false |
8,165 | d3be26d56b3597a5d9e3a870b735a30d90d1e501 | import cv2
import pytesseract
import os
from PIL import Image
import numpy as np
from helper_functions import Helper
class ImageData:
# multipliers to get portion of image with interval value
__bottom_thresh = 0.9
__left_thresh = 0.35
__right_thresh = 0.65
# (words, offset) to contour interval value
__words_of... | [
"import cv2\nimport pytesseract\nimport os\nfrom PIL import Image\nimport numpy as np\n\nfrom helper_functions import Helper\n\nclass ImageData:\n\t# multipliers to get portion of image with interval value\n\t__bottom_thresh = 0.9\n\t__left_thresh = 0.35\n\t__right_thresh = 0.65\n\n\t# (words, offset) to contour in... | false |
8,166 | 72b29764f584c7f824eaa63ab0fdb1839a8d9102 | from collections import OrderedDict
import re
from copy import copy
from datetime import datetime
import json
from bson import ObjectId
from bson.errors import InvalidId
from wtforms import Field
class StringField(Field):
def __init__(self, label=None, validators=None, empty_to_default=True,
st... | [
"from collections import OrderedDict\nimport re\nfrom copy import copy\nfrom datetime import datetime\nimport json\n\nfrom bson import ObjectId\nfrom bson.errors import InvalidId\nfrom wtforms import Field\n\n\nclass StringField(Field):\n\n def __init__(self, label=None, validators=None, empty_to_default=True,\n... | false |
8,167 | e98f28199075e55ddad32d9127f917c982e1e29d | import random
def generate_questions(n):
for _ in range(n):
x=random.randint(11,100)
print(x)
inp=int(input())
if inp==x**2:
continue
else:
print('Wrong! the right answer is: {}'.format(x**2))
n=int(input())
generate_questions(n)
| [
"import random\ndef generate_questions(n):\n for _ in range(n):\n x=random.randint(11,100)\n print(x)\n inp=int(input())\n if inp==x**2:\n continue\n else:\n print('Wrong! the right answer is: {}'.format(x**2))\n\nn=int(input())\ngenerate_questions(n)\n",
... | false |
8,168 | 7ab964352c1d51b70e3a1a7bf0a624f2d96cfd55 | #dependencies go here
import numpy as np
import datetime as dt
from datetime import timedelta
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
#Set up the engine to connect to HW8 datab... | [
"#dependencies go here\nimport numpy as np\nimport datetime as dt\nfrom datetime import timedelta\n\n\nimport sqlalchemy\nfrom sqlalchemy.ext.automap import automap_base\nfrom sqlalchemy.orm import Session\nfrom sqlalchemy import create_engine, func\n\nfrom flask import Flask, jsonify\n\n\n\n\n#Set up the engine to... | false |
8,169 | a1115766c5f17abc1ba90a3314cb5b9c4aab73d6 | import vobject
import glob
import sys
vobj=vobject.readOne(open("Nelson.vcf"))
print vobj.contents
def main(args):
suma = 0
titulos = ['nombre del archivo', 'Total', 'subtotoal', 'rfc', 'fecha', 'ivaTrasladado', 'isrTrasladado', 'ivaRetenido', 'isrRetenido']
import csv
out = csv.writer(open("out.csv"... | [
"import vobject\nimport glob\nimport sys\n\nvobj=vobject.readOne(open(\"Nelson.vcf\"))\nprint vobj.contents\n\n\ndef main(args):\n suma = 0\n titulos = ['nombre del archivo', 'Total', 'subtotoal', 'rfc', 'fecha', 'ivaTrasladado', 'isrTrasladado', 'ivaRetenido', 'isrRetenido']\n import csv\n out = csv.wr... | true |
8,170 | 6c1f7b8e71760cac443a06f68f5f6ee3c2151e50 | # https://leetcode.com/problems/wiggle-subsequence/
#
# algorithms
# Medium (36.9%)
# Total Accepted: 43,722
# Total Submissions: 118,490
# beats 100.0% of python submissions
class Solution(object):
def wiggleMaxLength(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
... | [
"# https://leetcode.com/problems/wiggle-subsequence/\n#\n# algorithms\n# Medium (36.9%)\n# Total Accepted: 43,722\n# Total Submissions: 118,490\n# beats 100.0% of python submissions\n\n\nclass Solution(object):\n def wiggleMaxLength(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: ... | false |
8,171 | e4ecc1746e907f11936683384e1edb34dd637de7 | #!/usr/bin/env python
import sys
import struct
import Queue
import logging
import redis
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from threading import Thread
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import PacketList... | [
"#!/usr/bin/env python\nimport sys\nimport struct\nimport Queue\nimport logging\nimport redis\nlogging.getLogger(\"scapy.runtime\").setLevel(logging.ERROR)\n\nfrom threading import Thread\nfrom scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr\nfrom scapy.all import Packet, IPOption\nfrom scapy.all... | true |
8,172 | 79c8e87e1d247eef8dd1ca8e307bbe6d25bf48e2 | # Copyright 2021 The JAX Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"# Copyright 2021 The JAX Authors.\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# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or a... | false |
8,173 | 035a87ccf21d45b2c147da4315c2143bea1ff21d | import psycopg2
from .connection import get_connection
def get_clientes():
query = 'SELECT nombre, t_documento ,documento, telefono, direccion, correo, ciudad_circulacion, fecha_nacimiento, comercial, primas FROM clientes'
cursor = get_connection(query)
return cursor
def get_clientes_by_id(_id... | [
"import psycopg2\nfrom .connection import get_connection\n\ndef get_clientes():\n query = 'SELECT nombre, t_documento ,documento, telefono, direccion, correo, ciudad_circulacion, fecha_nacimiento, comercial, primas FROM clientes'\n cursor = get_connection(query)\n return cursor\n\ndef get_clien... | false |
8,174 | a18e98db417fe234e3d8d5d1321203fbac18751c | #coding: utf-8
from flask import Flask, redirect, url_for, request
from werkzeug.utils import secure_filename
import torch, torchvision
# Setup detectron2 logger
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
# import some common libraries
import numpy as np
import os, json, cv2, ... | [
"#coding: utf-8\n\nfrom flask import Flask, redirect, url_for, request\nfrom werkzeug.utils import secure_filename\n\nimport torch, torchvision\n\n# Setup detectron2 logger\nimport detectron2\nfrom detectron2.utils.logger import setup_logger\nsetup_logger()\n\n# import some common libraries\nimport numpy as np\nimp... | false |
8,175 | 1cab38721e6b96a9877bd67cbddaa4d6b4e53d1b | '''
Factory for creating and running ssimulations against optimization tools
Author:
Matthew Barber <mfmbarber@gmail.com>
'''
from .strategy_annealer import StrategyAnnealer
from .strategy_deap import StrategyDeap
class CalulateStrategyWith:
@staticmethod
def Annealing(car, include_initial_ty... | [
"'''\n Factory for creating and running ssimulations against optimization tools\n\n Author:\n Matthew Barber <mfmbarber@gmail.com>\n'''\nfrom .strategy_annealer import StrategyAnnealer\nfrom .strategy_deap import StrategyDeap\n\n\nclass CalulateStrategyWith:\n @staticmethod\n def Annealing(car, i... | false |
8,176 | 2f0d611fecdb5717029938d2ec2cd2db345b8f3a | import boto3
import json
from botocore.exceptions import ClientError
# upload_to_s3("abc.png", 1)
def upload_to_s3(file_name, node_number):
try:
key_info_json = open("awsinfo.json").read()
except FileNotFoundError:
print("awsinfo.json is not exist in dir.")
exit(-1)
dat... | [
"import boto3\r\nimport json\r\nfrom botocore.exceptions import ClientError\r\n\r\n# upload_to_s3(\"abc.png\", 1)\r\ndef upload_to_s3(file_name, node_number):\r\n try:\r\n key_info_json = open(\"awsinfo.json\").read()\r\n except FileNotFoundError:\r\n print(\"awsinfo.json is not exist in dir.\")... | false |
8,177 | 80d5cc9871ec753fb9239df7680ac62809baa496 | from cell import Cell
from tkinter import messagebox
import time
import fileTools
class Playground:
"""
The playground for the program. All cells are stored here. This object also import/export cells to the playground
:param screen: The screen object.
:param mouse: The mouse object.
... | [
"from cell import Cell\nfrom tkinter import messagebox\nimport time\nimport fileTools\n\nclass Playground:\n\n \"\"\"\n The playground for the program. All cells are stored here. This object also import/export cells to the playground\n\n :param screen: The screen object.\n :param mouse: The ... | false |
8,178 | 0eab23f4271f724da587707599eb0cbf2144efa1 | # zip(),可以压缩 N 个列表成为一个zip对象(可迭代对象)。
a =['a', 'b', 'c']
b =[1, 2, 3]
[x for x in zip(a, b)] # [('a', 1), ('b', 2), ('c', 3)]
# 列表长度不等时,以短的为准
c =['x','y']
[x for x in zip(a, c)] # [('a', 'x'), ('b', 'y')]
# 例子
books =['简爱','小王子','瓦尔登湖']
prices =[56, 78, 66]
for book, price in zip(books, prices):
print("%s的价格是:%3.... | [
"# zip(),可以压缩 N 个列表成为一个zip对象(可迭代对象)。\na =['a', 'b', 'c']\nb =[1, 2, 3]\n[x for x in zip(a, b)] # [('a', 1), ('b', 2), ('c', 3)]\n\n# 列表长度不等时,以短的为准\nc =['x','y']\n[x for x in zip(a, c)] # [('a', 'x'), ('b', 'y')]\n\n# 例子\nbooks =['简爱','小王子','瓦尔登湖']\nprices =[56, 78, 66]\nfor book, price in zip(books, prices):\n ... | false |
8,179 | 01467a4dad3255a99025c347469881a71ffbae7c | import os
from google.cloud import bigquery
def csv_loader(data, context):
client = bigquery.Client()
dataset_id = os.environ['DATASET']
dataset_ref = client.dataset(dataset_id)
job_config = bigquery.LoadJobConfig()
job_config.schema = [
bigquery.SchemaField('id'... | [
"import os\nfrom google.cloud import bigquery\n\ndef csv_loader(data, context):\n client = bigquery.Client()\n dataset_id = os.environ['DATASET']\n dataset_ref = client.dataset(dataset_id)\n job_config = bigquery.LoadJobConfig()\n job_config.schema = [\n bigquery.Sc... | false |
8,180 | 14023785983f493af57189b3d96254efef2e33ae | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-03-15 16:39:32
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from widgets.favorits.favorit_win import Ui_DialogFavorit
import j... | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# @Date : 2016-03-15 16:39:32\n# @Author : Your Name (you@example.org)\n# @Link : http://example.org\n# @Version : $Id$\n\nfrom PyQt5.QtWidgets import *\nfrom PyQt5.QtCore import *\nfrom PyQt5.QtGui import *\nfrom widgets.favorits.favorit_win import Ui_DialogF... | false |
8,181 | b4a267873c5823ecfa62a5e90b67c37f9cca3cd2 | /Users/apple/anaconda/lib/python3.5/operator.py | [
"/Users/apple/anaconda/lib/python3.5/operator.py"
] | true |
8,182 | e9e119dd69f9416e007e748d7f494741140efc8e | import sys
filepath = 'input.txt'
def intersection(list1, list2):
return set(list1).intersection(list2)
def computeSteps(x, y, step, steps):
# build dictionary with steps for each point
curr = 0
if (x,y) in steps:
curr = steps.get((x,y))
steps[(x,y)] = step + curr
... | [
"import sys\r\nfilepath = 'input.txt' \r\n\r\ndef intersection(list1, list2): \r\n return set(list1).intersection(list2) \r\n\r\ndef computeSteps(x, y, step, steps):\r\n # build dictionary with steps for each point\r\n curr = 0\r\n if (x,y) in steps:\r\n curr = steps.get((x,y)) \r\n step... | false |
8,183 | f870c776a62f3b743356c5515cd25e588dbfca15 | import time
from typing import List
from classiclikeiguana.timeout import timeout
class ExecutionMetrics:
def __init__(self, duration, succeeded: bool, timed_out: bool, lines: int, error: List[str] = None):
if error is None:
error = list()
self.duration = duration
self.succeed... | [
"import time\nfrom typing import List\n\nfrom classiclikeiguana.timeout import timeout\n\n\nclass ExecutionMetrics:\n def __init__(self, duration, succeeded: bool, timed_out: bool, lines: int, error: List[str] = None):\n if error is None:\n error = list()\n self.duration = duration\n ... | false |
8,184 | e2e275c48f28843931412f8e620f1be90289b40c | ### we prepend t_ to tablenames and f_ to fieldnames for disambiguity
import uuid
crud.settings.formstyle="table2cols"
########################################
db.define_table('t_form',
Field('id','id',
represent=lambda id:SPAN(id,' ',A('view',_href=URL('form_read',args=id)))),
Field('f_name', type=... | [
"### we prepend t_ to tablenames and f_ to fieldnames for disambiguity\nimport uuid\n\ncrud.settings.formstyle=\"table2cols\"\n\n########################################\ndb.define_table('t_form',\n Field('id','id',\n represent=lambda id:SPAN(id,' ',A('view',_href=URL('form_read',args=id)))),\n Field... | false |
8,185 | a299bd230a25a646060f85cffc8e84c534e2f805 | # -*- coding: utf-8 -*-
# Copyright (c) 2017 Feng Shuo
#
# 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
from itertools impo... | [
"# -*- coding: utf-8 -*-\n# Copyright (c) 2017 Feng Shuo\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\nfr... | true |
8,186 | ee68ebe146f948f3497577f40741e59b7421e652 | """
Deprecated entry point for a component that has been moved.
"""
# currently excluded from documentation - see docs/README.md
from ldclient.impl.integrations.files.file_data_source import _FileDataSource
from ldclient.interfaces import UpdateProcessor
class FileDataSource(UpdateProcessor):
@classmethod
def... | [
"\"\"\"\nDeprecated entry point for a component that has been moved.\n\"\"\"\n# currently excluded from documentation - see docs/README.md\n\nfrom ldclient.impl.integrations.files.file_data_source import _FileDataSource\nfrom ldclient.interfaces import UpdateProcessor\n\nclass FileDataSource(UpdateProcessor):\n ... | false |
8,187 | 191154c896fe441519ad4f343c6d92d6304fb3db | """
Created on Apr 27, 2017
@author: Franziska Schlösser
"""
from ipet.parsing.Solver import Solver
import re
from ipet import Key
from ipet import misc
class MIPCLSolver(Solver):
solverId = "MIPCL"
recognition_expr = re.compile("Reading data")
primalbound_expr = re.compile("Objective value: (\S*)")
dualbound_ex... | [
"\"\"\"\nCreated on Apr 27, 2017\n\n@author: Franziska Schlösser\n\"\"\"\n\nfrom ipet.parsing.Solver import Solver\nimport re\nfrom ipet import Key\nfrom ipet import misc\n\nclass MIPCLSolver(Solver):\n\tsolverId = \"MIPCL\"\n\trecognition_expr = re.compile(\"Reading data\")\n\tprimalbound_expr = re.compile(\"Objec... | false |
8,188 | ff66b33a133b627ba2329434d6c1649c94b6ec78 | import numpy as np
import copy
'''
本脚本主要用来实现决策树的相关内容。
constrcut_tree:该函数是构建决策树的主要函数
其输入:数据集X:n*p n:样本数,p-1维特征,p为样本类别,
以及属性信息label:属性名称,p-1一维数组,label表示的是此时X每一列对应的属性名称
决策结构用字典来表示,例如{attribution1:{0:{attribution2:{}},1:{attribution3:{}}}
'''
def construct_tree(X,label):
classList = [sample[-1] for sample in X]
... | [
"import numpy as np\nimport copy\n'''\n本脚本主要用来实现决策树的相关内容。\nconstrcut_tree:该函数是构建决策树的主要函数\n其输入:数据集X:n*p n:样本数,p-1维特征,p为样本类别,\n以及属性信息label:属性名称,p-1一维数组,label表示的是此时X每一列对应的属性名称\n决策结构用字典来表示,例如{attribution1:{0:{attribution2:{}},1:{attribution3:{}}}\n'''\n\ndef construct_tree(X,label):\n \n classList = [sample[-1] f... | false |
8,189 | b5835b676eb8ac814086f7482f172f48e2ad5a0a | #anand python problem 2:29
#Write a function array to create an 2-dimensional array. The function should take both dimensions as arguments. Value of each element can be initialized to None:
#
def array_imp(row,col):
res=[[None]*col for i in range(row) ]
return res
if __name__=='__main__':
outs=array_imp(2,3)
p... | [
"#anand python problem 2:29\n#Write a function array to create an 2-dimensional array. The function should take both dimensions as arguments. Value of each element can be initialized to None:\n#\n\ndef array_imp(row,col):\n\tres=[[None]*col for i in range(row) ]\n\treturn res\n\n\n\n\nif __name__=='__main__':\n\tou... | true |
8,190 | e98767fbac44f50f58c149e16124fef95b38cf71 | """
作用域
在Python中,当引用一个变量的时候,对这个【变量的搜索】是按照
本地作用域(Local)、
嵌套作用域(Enclosing function locals)、
全局作用域(Global)、
内置作用域(builtins模块)
的顺序来进行的,
即所谓的LEGB规则。
然而当在一个【函数内部为一个变量赋值】时,并不是按照上面所说LEGB规则来首先找到变量,之后为该变量赋值。在Python中,在函数中为一个变量赋值时,有下面这样一条规则
“当在函数中给一个变量名赋值是(而不是在一个表达式中对其进行引用),Python总是🔹创建或改变本地作用域的变量名🔹,除非它已经在那个函数中被声明为全局变量. ”
"""
... | [
"\"\"\"\n作用域\n\n在Python中,当引用一个变量的时候,对这个【变量的搜索】是按照\n本地作用域(Local)、\n嵌套作用域(Enclosing function locals)、\n全局作用域(Global)、\n内置作用域(builtins模块)\n的顺序来进行的,\n即所谓的LEGB规则。\n\n然而当在一个【函数内部为一个变量赋值】时,并不是按照上面所说LEGB规则来首先找到变量,之后为该变量赋值。在Python中,在函数中为一个变量赋值时,有下面这样一条规则\n\n“当在函数中给一个变量名赋值是(而不是在一个表达式中对其进行引用),Python总是🔹创建或改变本地作用域的变量名🔹,除非它已经在... | false |
8,191 | 5a265ecb9f1d6d0e4a5c66d241fbfe4a6df97825 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 19 09:41:08 2018
hexatrigesimal to decimal calculator,
base 36 encoding; use of letters with digits.
@author: susan
"""
## create a dictionary as reference for BASE 36 calculations
WORD = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" # digits of BASE 36
BASE = {}
for i,... | [
"# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Wed Dec 19 09:41:08 2018\r\nhexatrigesimal to decimal calculator,\r\nbase 36 encoding; use of letters with digits.\r\n@author: susan\r\n\"\"\"\r\n## create a dictionary as reference for BASE 36 calculations\r\nWORD = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\" # digits ... | false |
8,192 | 8e8629dd2d4bb601347694b18d7cb6a94880201d | my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam']
while 'spam' in my_order:
print("I don't like spam!")
my_order.remove('spam')
print(my_order)
| [
"my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam']\nwhile 'spam' in my_order:\n print(\"I don't like spam!\")\n my_order.remove('spam')\nprint(my_order)\n",
"<assignment token>\nwhile 'spam' in my_order:\n print(\"I don't like spam!\")\n my_order.remove('spam')\nprint(my_order)\n",
"<a... | false |
8,193 | c556aaf6aecb3c91d9574e0a158a9fa954108d70 | import numpy as np
import matplotlib.pyplot as plt
# some important constants
x_bound = y_bound = 1.
dx = dy = 0.05
k = 0.1
nx, ny = int(x_bound/dx), int(y_bound/dy)
dx2, dy2 = dx*dx, dy*dy
dt = (dx2 / k) / 4.0
t_end = 80 * dt
# set the grid
u0 = np.zeros((nx, ny))
u_exact = np.zeros((nx, ny))
u = np.zeros((nx, ny))... | [
"import numpy as np\nimport matplotlib.pyplot as plt\n\n# some important constants \nx_bound = y_bound = 1.\ndx = dy = 0.05\nk = 0.1\nnx, ny = int(x_bound/dx), int(y_bound/dy)\ndx2, dy2 = dx*dx, dy*dy\ndt = (dx2 / k) / 4.0\nt_end = 80 * dt\n\n# set the grid\nu0 = np.zeros((nx, ny))\nu_exact = np.zeros((nx, ny))\nu ... | false |
8,194 | 7a4d04bd60b5f5555982af372145f9f4bcd83ca2 | # Get Facebook's bAbi dataset
from utils import maybe_download
from shutil import rmtree
import os
import tarfile
def get_babi_en(get_10k=False):
data_dir = "datasets/tasks_1-20_v1-2/en/"
if get_10k == True:
data_dir = "datasets/tasks_1-20_v1-2/en-10k/"
maybe_download('https://s3.amazonaws... | [
"# Get Facebook's bAbi dataset\nfrom utils import maybe_download\nfrom shutil import rmtree\nimport os\nimport tarfile\n\ndef get_babi_en(get_10k=False):\n data_dir = \"datasets/tasks_1-20_v1-2/en/\"\n if get_10k == True:\n data_dir = \"datasets/tasks_1-20_v1-2/en-10k/\"\n \n maybe_download('... | false |
8,195 | f74e2e6b59330bd63fee9192e74a72178abc1cab | n = int(input())
a = [int(e) for e in input().split()]
ans = [0] * n
for i in range(n):
s = a[i]
ans[s-1] = i+1
print(*ans) | [
"n = int(input())\n\na = [int(e) for e in input().split()]\n\nans = [0] * n \n \nfor i in range(n):\n s = a[i] \n ans[s-1] = i+1 \n \nprint(*ans)",
"n = int(input())\na = [int(e) for e in input().split()]\nans = [0] * n\nfor i in range(n):\n s = a[i]\n ans[s - 1] = i + 1\nprint(*ans)\n",
"<as... | false |
8,196 | bdde3a3725510d4a83b09421e4b8538a38e29584 | from manimlib.imports import *
import math
class A_Swerve(Scene):
def construct(self):
chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY, fill_opacity=1).shift(2*RIGHT)
fr = Dot().shift(UP+3*RIGHT)
fl = Dot().shift(UP+RIGHT)
rl = Dot().shift(DOWN+RIGHT)
rr = Dot().shift(DOWN+3*RIGH... | [
"from manimlib.imports import *\nimport math\n\nclass A_Swerve(Scene):\n def construct(self):\n chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY, fill_opacity=1).shift(2*RIGHT)\n\n fr = Dot().shift(UP+3*RIGHT)\n fl = Dot().shift(UP+RIGHT)\n rl = Dot().shift(DOWN+RIGHT)\n rr = Dot().sh... | false |
8,197 | 4647a7d0996ceeef4f39cf3182ac3944d25cb349 | #!/usr/bin/python2
# -*- coding: UTF-8 -*-
# coding: utf-8
#!/usr/bin/env python
'''
发布轨迹信息
path.x; path.y; c_speed;
'''
import numpy as np
import matplotlib.pyplot as plt
import copy
import math
from cubic_spline import Spline2D
from polynomials import QuarticPolynomial, QuinticPolynomial
import time
import... | [
"#!/usr/bin/python2\n# -*- coding: UTF-8 -*-\n# coding: utf-8\n#!/usr/bin/env python\n\n\n'''\n发布轨迹信息 \npath.x; path.y; c_speed;\n\n'''\n\n\n\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport copy\nimport math\nfrom cubic_spline import Spline2D\nfrom polynomials import QuarticPolynomial, QuinticP... | false |
8,198 | 0b125e7e9e763d4fd71e381ca823f9e9aa8ea606 | from scipy.stats import itemfreq
from sklearn.model_selection import StratifiedKFold
from keras_utils.keras_utils import *
from keras.utils.np_utils import to_categorical
from keras.layers import Input, Embedding, Dense, GlobalAveragePooling1D, Flatten
from keras.layers import add, multiply, LSTM, Bidirectiona... | [
"from scipy.stats import itemfreq\r\nfrom sklearn.model_selection import StratifiedKFold\r\n\r\nfrom keras_utils.keras_utils import *\r\n\r\nfrom keras.utils.np_utils import to_categorical\r\nfrom keras.layers import Input, Embedding, Dense, GlobalAveragePooling1D, Flatten\r\nfrom keras.layers import add, multiply,... | false |
8,199 | 8cabacb64f3b193b957c61d6e1ca21f2046e52d1 | #---------------------------------------------
# File name: phase2app.py
# Description: Launches GUI for Twitter User Timeline Sentiment Analysis program
# Author: Gilbert Yap (gilberty@bu.edu)
# Date: October 03, 2020
#---------------------------------------------
from PySide2.QtWidgets import QApplication, QDialog, ... | [
"#---------------------------------------------\n# File name: phase2app.py\n# Description: Launches GUI for Twitter User Timeline Sentiment Analysis program\n# Author: Gilbert Yap (gilberty@bu.edu)\n# Date: October 03, 2020\n#---------------------------------------------\n\nfrom PySide2.QtWidgets import QApplicatio... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.