index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
4,200 | bfb52a5ee6d88d63c4ef89dae26bb8cbecb091c6 | # ============================================================================
# Archivo cnn_sisben.py
# autor Johan S. Mendez, Jose D. Mendez
# fecha 27/Agos/2020
# Clasificacion de beneficiarios del nuevo sistema de clasificacion del sisben
# agrupado en 4 grandes grupos de beneficiarios, se utiliza un red neuronal
... | [
"# ============================================================================\n# Archivo cnn_sisben.py\n# autor Johan S. Mendez, Jose D. Mendez\n# fecha 27/Agos/2020\n\n# Clasificacion de beneficiarios del nuevo sistema de clasificacion del sisben\n# agrupado en 4 grandes grupos de beneficiarios, se utiliza un re... | false |
4,201 | 56d4532b633242f34f7a6ed86a35290836861f67 | from binaryninja import *
import yara
def get_yara_rule_path():
return get_open_filename_input("Open YARA rule", "YARA rules (*.yar *.yara)")
def get_markdown_result(matches):
entry_fmt = "| {} | {} | {} |\n"
md_text = """# YARA - Scan results
| Rule Name | Function | Strings offsets |
|-----------|----------|---... | [
"from binaryninja import *\nimport yara\n\ndef get_yara_rule_path():\n\treturn get_open_filename_input(\"Open YARA rule\", \"YARA rules (*.yar *.yara)\")\n\ndef get_markdown_result(matches):\n\tentry_fmt = \"| {} | {} | {} |\\n\"\n\tmd_text = \"\"\"# YARA - Scan results\n\n| Rule Name | Function | Strings offsets |... | false |
4,202 | 73e23b3560294ca24428e7dd4cc995b97767335c | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@project= Life_is_short_you_need_python
@file= judgement
@author= wubingyu
@create_time= 2017/12/21 下午2:58
"""
#a if condition else b
#(falseValue,trueValue)[test]
#(falseValue,trueValue)[test==True]
#(falseValue,trueValue)[bool(<expression>)]
| [
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\n@project= Life_is_short_you_need_python\n@file= judgement\n@author= wubingyu\n@create_time= 2017/12/21 下午2:58\n\"\"\"\n\n#a if condition else b\n#(falseValue,trueValue)[test]\n#(falseValue,trueValue)[test==True]\n#(falseValue,trueValue)[bool(<expression>)]\n\n\n"... | false |
4,203 | 995e42312e286d82fa101128795d8aa60c1a6548 | # -*- coding: utf-8 -*-
# Copyright 2019, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=undefined-loop-variable
"""
Run through RB for different qubit numbers to check that it's working
and that... | [
"# -*- coding: utf-8 -*-\n\n# Copyright 2019, IBM.\n#\n# This source code is licensed under the Apache License, Version 2.0 found in\n# the LICENSE.txt file in the root directory of this source tree.\n\n# pylint: disable=undefined-loop-variable\n\n\"\"\"\nRun through RB for different qubit numbers to check that it'... | false |
4,204 | 2385882f040ef4bd0a3611bebfbb2ae5b3cd1dc6 | print('Boolean Exercise')
print(False or False)
print(False and False)
print(not True or not False) | [
"print('Boolean Exercise')\n\nprint(False or False)\nprint(False and False)\nprint(not True or not False)",
"print('Boolean Exercise')\nprint(False or False)\nprint(False and False)\nprint(not True or not False)\n",
"<code token>\n"
] | false |
4,205 | e398908ba74306c5a746d7643b38f08651cf92ec | from datetime import datetime
from poop import objstore
class Comment(objstore.Item):
__typename__ = 'comment'
__table__ = 'comment'
relatesToId = objstore.column('relates_to_id')
relatesToVersion = objstore.column('relates_to_version')
posted = objstore.column()
approved = objstore.colum... | [
"from datetime import datetime\nfrom poop import objstore\n\n\n\nclass Comment(objstore.Item):\n\n\n __typename__ = 'comment'\n __table__ = 'comment'\n\n\n relatesToId = objstore.column('relates_to_id')\n relatesToVersion = objstore.column('relates_to_version')\n posted = objstore.column()\n appro... | false |
4,206 | e78504971c51a98eed60ea8032502b6ce1a11f29 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Given an input with the following format
# x y yerr
# on standard input, print a fit of y = ax+b
# to the data.
import sys, string
from math import sqrt
def cP(X, Yerr):
sum = 0
for i in range(len(X)):
sum = sum + (X[i]*X[i])/(Yerr[i]*Yerr[i])
return sum
def cQ(Y... | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Given an input with the following format\n# x y yerr\n# on standard input, print a fit of y = ax+b\n# to the data.\n\nimport sys, string\nfrom math import sqrt\n\ndef cP(X, Yerr):\n\tsum = 0\n\tfor i in range(len(X)):\n\t\tsum = sum + (X[i]*X[i])/(Yerr[i]*Yerr[i]... | true |
4,207 | 1555583cd3d8938cbaeeac2d1f74bb9c3858f26d | import tensorflow as tf
def makeMnistModel():
mnist = tf.keras.datasets.mnist
(X_train, y_train), (_,_) = mnist.load_data()
X_train= X_train/255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28,28)),
tf.keras.layers.Dense(128, activation='relu'),
t... | [
"import tensorflow as tf\n\ndef makeMnistModel():\n mnist = tf.keras.datasets.mnist\n (X_train, y_train), (_,_) = mnist.load_data()\n X_train= X_train/255.0\n\n model = tf.keras.models.Sequential([\n tf.keras.layers.Flatten(input_shape=(28,28)),\n tf.keras.layers.Dense(128, activation='rel... | false |
4,208 | de557c3c1455acc0a3facfca5729a010f3d123dc | # from cis_dna import
import cis_config as conf
import protocol_pb2 as proto
import uuid
import random
import math
import dna_decoding
import numpy as np
def move(cell):
pass
def is_alive(cell):
starvation_threshold = conf.ENERGY_THRESHOLD
if cell.energy_level < starvation_threshold:
return Fals... | [
"# from cis_dna import\nimport cis_config as conf\nimport protocol_pb2 as proto\nimport uuid\nimport random\nimport math\nimport dna_decoding\nimport numpy as np\n\n\ndef move(cell):\n pass\n\n\ndef is_alive(cell):\n starvation_threshold = conf.ENERGY_THRESHOLD\n if cell.energy_level < starvation_threshold... | false |
4,209 | d234034f7f232e842d0b4e465ea6ec314af6964d | from scrapera.image.duckduckgo import DuckDuckGoScraper
scraper = DuckDuckGoScraper()
scraper.scrape('spongebob squarepants', 1, r'path/to/output/directory')
| [
"from scrapera.image.duckduckgo import DuckDuckGoScraper\n\nscraper = DuckDuckGoScraper()\nscraper.scrape('spongebob squarepants', 1, r'path/to/output/directory')\n",
"from scrapera.image.duckduckgo import DuckDuckGoScraper\nscraper = DuckDuckGoScraper()\nscraper.scrape('spongebob squarepants', 1, 'path/to/output... | false |
4,210 | 9150eb53d309e75299775cd9524a688e8dc2ff76 | import xml.etree.ElementTree as ET
from collections import OrderedDict
import json
import threading
class MyThread(threading.Thread):
def __init__(self, filenum):
threading.Thread.__init__(self)
self.filenum = filenum
print('Inicio del thread:', str(self.filenum))
def run(self):
... | [
"import xml.etree.ElementTree as ET\nfrom collections import OrderedDict\nimport json\nimport threading\n\nclass MyThread(threading.Thread):\n def __init__(self, filenum):\n threading.Thread.__init__(self)\n self.filenum = filenum\n print('Inicio del thread:', str(self.filenum))\n\n def r... | false |
4,211 | 0934163fc6461e30a73c06e74b3a5e983ed2fa02 | import csv
import json
import re
import itertools
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
from networkx.algorithms import community
import snap
import numpy
# setting up data structures to map actor IDs to objects in order to increase run time.
csv.field_size_limit(100000000)
curr_act... | [
"import csv\nimport json\nimport re\nimport itertools\nimport pandas as pd\nimport networkx as nx\nimport matplotlib.pyplot as plt\nfrom networkx.algorithms import community\nimport snap\nimport numpy\n\n# setting up data structures to map actor IDs to objects in order to increase run time.\ncsv.field_size_limit(10... | false |
4,212 | cb4ca5f91c7cd47197784085258536166055afe9 | # first we have to label the Banana / Apple / Tomato in the images
# we will use lables me
# pip install pyqt5
# pip install labelme
# after labeling the images. lets test it.
#Each image has a json file
import pixellib
from pixellib.custom_train import instance_custom_training
train_maskRcnn = instance_custom_tra... | [
"# first we have to label the Banana / Apple / Tomato in the images\n# we will use lables me\n\n# pip install pyqt5\n# pip install labelme\n\n# after labeling the images. lets test it.\n#Each image has a json file \n\nimport pixellib\nfrom pixellib.custom_train import instance_custom_training\n\ntrain_maskRcnn = in... | false |
4,213 | a6c07146f1cbc766cd464dab620d1fb075759c12 | n=int(input("Enter any int number:\n"))
x=1
while(x<13):
print(n ," x ", x ," = ", n*x)
x=x+1
| [
"n=int(input(\"Enter any int number:\\n\"))\n\nx=1\nwhile(x<13):\n print(n ,\" x \", x ,\" = \", n*x)\n x=x+1\n",
"n = int(input('Enter any int number:\\n'))\nx = 1\nwhile x < 13:\n print(n, ' x ', x, ' = ', n * x)\n x = x + 1\n",
"<assignment token>\nwhile x < 13:\n print(n, ' x ', x, ' = ', n *... | false |
4,214 | 52064b518ad067c9906e7de8542d9a399076a0b5 | # 1.- Crear una grafica que muestre la desviacion tipica de los datos cada dia para todos los pacientes
# 2.- Crear una grafica que muestre a la vez la inflamacion maxima, media y minima para cada dia
import numpy as np
data = np.loadtxt(fname='inflammation-01.csv', delimiter=',')
import matplotlib.pyplot as pl... | [
"# 1.- Crear una grafica que muestre la desviacion tipica de los datos cada dia para todos los pacientes\r\n# 2.- Crear una grafica que muestre a la vez la inflamacion maxima, media y minima para cada dia\r\n\r\nimport numpy as np\r\ndata = np.loadtxt(fname='inflammation-01.csv', delimiter=',')\r\n\r\nimport matplo... | false |
4,215 | 535ee547475fbc2e1c0ee59e3e300beda1489d47 | import pickle
import time
DECAY = 0.95
DEPTH = 2
def init_cache(g):
'''
Initialize simrank cache for graph g
'''
g.cache = {}
def return_and_cache(g, element, val):
'''
Code (and function name) is pretty self explainatory here
'''
g.cache[element] = val
return val
def simrank_impl(g, node1, node2, t, is_wei... | [
"import pickle\nimport time\nDECAY = 0.95\nDEPTH = 2\n\ndef init_cache(g):\n\t'''\n\tInitialize simrank cache for graph g\n\t'''\n\tg.cache = {}\n\ndef return_and_cache(g, element, val):\n\t'''\n\tCode (and function name) is pretty self explainatory here\n\t'''\n\tg.cache[element] = val\n\treturn val\n\ndef simrank... | true |
4,216 | fdc8f9ff9a0e2cd8ad1990948036d9e420fdc074 | text = "I love Python Programming"
for word in text.split():
print(word) | [
"text = \"I love Python Programming\"\nfor word in text.split():\n print(word)",
"text = 'I love Python Programming'\nfor word in text.split():\n print(word)\n",
"<assignment token>\nfor word in text.split():\n print(word)\n",
"<assignment token>\n<code token>\n"
] | false |
4,217 | d79e65b7aa09066230dec1a472f4535dff4123b5 | from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.lib.styles import getSampleStyleSheet
def paragraph_spacing():
doc = SimpleDocTemplate("paragraph_spacing.pdf", pagesize=letter)
styles = getSampleStyleSheet()
#Mengahasilkan spasi antar ... | [
"from reportlab.lib.pagesizes import letter\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph\nfrom reportlab.lib.styles import getSampleStyleSheet\n\n\ndef paragraph_spacing():\n doc = SimpleDocTemplate(\"paragraph_spacing.pdf\", pagesize=letter)\n\n styles = getSampleStyleSheet()\n #Mengahasil... | false |
4,218 | 7f4a5779564efde7eaf08741d00254dd4aa37569 | # coding=utf-8
import pytest
from twitter_tunes.scripts import redis_data
from mock import patch
REDIS_PARSE = [
(b"{'trend3': 'url3', 'trend2': 'url2', 'trend1': 'url1'}",
{'trend1': 'url1', 'trend2': 'url2', 'trend3': 'url3'}),
(b"{}", {}),
(b"{'hello':'its me'}", {'hello': 'its me'}),
(b"{'... | [
"# coding=utf-8\nimport pytest\nfrom twitter_tunes.scripts import redis_data\nfrom mock import patch\n\n\nREDIS_PARSE = [\n (b\"{'trend3': 'url3', 'trend2': 'url2', 'trend1': 'url1'}\",\n {'trend1': 'url1', 'trend2': 'url2', 'trend3': 'url3'}),\n (b\"{}\", {}),\n (b\"{'hello':'its me'}\", {'hello': ... | false |
4,219 | 034d4027ea98bca656178b66c5c6e6e8b13e4b9e | import cv2 as cv
def nothing(x):
pass
cv.namedWindow('Binary')
cv.createTrackbar('threshold', 'Binary', 0, 255, nothing)
cv.setTrackbarPos('threshold', 'Binary', 127)
img_color = cv.imread('../sample/ball.png', cv.IMREAD_COLOR)
img_gray = cv.cvtColor(img_color, cv.COLOR_BGR2GRAY)
while(True):
thre = cv.get... | [
"import cv2 as cv\n\ndef nothing(x):\n pass\n\n\ncv.namedWindow('Binary')\ncv.createTrackbar('threshold', 'Binary', 0, 255, nothing)\ncv.setTrackbarPos('threshold', 'Binary', 127)\n\nimg_color = cv.imread('../sample/ball.png', cv.IMREAD_COLOR)\nimg_gray = cv.cvtColor(img_color, cv.COLOR_BGR2GRAY)\n\nwhile(True):... | false |
4,220 | 7ea608b73f592cffc7723b4319cf1a87b3e9b443 | import math
z = 1j
cosinus_real = math.cos(z.real)
cosinus_imaginary = math.cos(z.imag)
sinus_real = math.sin(z.real)
sinus_imag = math.sin(z.imag)
print (cosinus_real)
print (cosinus_imaginary)
print (sinus_real)
print (sinus_imag)
| [
"import math\n\nz = 1j\n\n\ncosinus_real = math.cos(z.real)\ncosinus_imaginary = math.cos(z.imag)\nsinus_real = math.sin(z.real)\nsinus_imag = math.sin(z.imag)\n\nprint (cosinus_real)\nprint (cosinus_imaginary)\nprint (sinus_real)\nprint (sinus_imag)\n\n\n\n\n\n\n\n",
"import math\nz = 1.0j\ncosinus_real = math.c... | false |
4,221 | e9bf5a40360d35f32bd2ad5aa404225f49895a14 | # Generated by Django 4.0.5 on 2023-02-14 18:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0020_festival_boxoffice_close_festival_boxoffice_open'),
]
operations = [
migrations.AlterModelOptions(
name='user',
... | [
"# Generated by Django 4.0.5 on 2023-02-14 18:57\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0020_festival_boxoffice_close_festival_boxoffice_open'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='... | false |
4,222 | d2f760b821fc5c599cda1091334364e18234ab06 | import PIL
from matplotlib import pyplot as plt
import matplotlib
from keras.preprocessing.image import ImageDataGenerator
from keras.models import load_model
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import RMSprop
from keras.layers import Dense, Dropout, Flatten... | [
"import PIL\nfrom matplotlib import pyplot as plt\nimport matplotlib\nfrom keras.preprocessing.image import ImageDataGenerator\nfrom keras.models import load_model\nfrom keras.models import Sequential\nfrom keras.layers import Dense, Dropout\nfrom keras.optimizers import RMSprop\nfrom keras.layers import Dense, Dro... | false |
4,223 | 80f681eb99d1e3f64cacd23ce0a4b10a74a79fe8 | """
给定两个非空链表来代表两个非负整数,位数按照逆序方式存储,它们的每个节点只存储单个数字。将这两数相加会返回一个新的链表。
你可以假设除了数字 0 之外,这两个数字都不会以零开头。
输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)
输出:7 -> 0 -> 8
原因:342 + 465 = 807
"""
"""
解题思路:
先计算两个节点的值和与进位的和
然后将值对10取余存放到新的链表中
循环下去
直到l1 l2 进位都不存在
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
... | [
"\"\"\"\n给定两个非空链表来代表两个非负整数,位数按照逆序方式存储,它们的每个节点只存储单个数字。将这两数相加会返回一个新的链表。\n\n你可以假设除了数字 0 之外,这两个数字都不会以零开头。\n输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)\n输出:7 -> 0 -> 8\n原因:342 + 465 = 807\n\"\"\"\n\n\"\"\"\n解题思路:\n先计算两个节点的值和与进位的和\n然后将值对10取余存放到新的链表中\n循环下去\n直到l1 l2 进位都不存在\n\"\"\"\n\n# Definition for singly-linked list.\nclass ListNo... | false |
4,224 | 9847a9cd360649819f51abfe584fb51a81306f68 | subworkflow data:
workdir:
"../../data/SlideSeq/Puck_180819_10"
include: "../Snakefile"
| [
"subworkflow data:\n workdir:\n \"../../data/SlideSeq/Puck_180819_10\"\n\ninclude: \"../Snakefile\"\n"
] | true |
4,225 | 8a37299154aded37147e1650cbf52a5cdf7d91da | from adventurelib import *
from horror import *
from dating import *
from popquiz import*
from comedy import*
from island import *
start()
| [
"from adventurelib import *\nfrom horror import *\n\nfrom dating import *\nfrom popquiz import*\nfrom comedy import*\nfrom island import * \n \nstart()\n",
"from adventurelib import *\nfrom horror import *\nfrom dating import *\nfrom popquiz import *\nfrom comedy import *\nfrom island import *\nstart()\n",
"... | false |
4,226 | 818623621b609d67f8f657be4ade6e3bb86a0bc5 | """
Package for django_static_template.
"""
| [
"\"\"\"\r\nPackage for django_static_template.\r\n\"\"\"\r\n",
"<docstring token>\n"
] | false |
4,227 | ba9d7b877eda3f7469db58e2ee194b601e3c3e08 | """Support for Bond covers."""
import asyncio
import logging
from typing import Any, Callable, Dict, List, Optional
from bond import BOND_DEVICE_TYPE_MOTORIZED_SHADES, Bond
from homeassistant.components.cover import DEVICE_CLASS_SHADE, CoverEntity
from homeassistant.config_entries import ConfigEntry
from homeassistan... | [
"\"\"\"Support for Bond covers.\"\"\"\nimport asyncio\nimport logging\nfrom typing import Any, Callable, Dict, List, Optional\n\nfrom bond import BOND_DEVICE_TYPE_MOTORIZED_SHADES, Bond\n\nfrom homeassistant.components.cover import DEVICE_CLASS_SHADE, CoverEntity\nfrom homeassistant.config_entries import ConfigEntr... | false |
4,228 | 150e0180567b74dfcd92a6cd95cf6c6bf36f6b5d | # [SIG Python Task 1]
"""
Tasks to performs:
a) Print 'Hello, World! From SIG Python - <your name>' to the screen
b) Calculate Volume of a Sphere
c) Create a customised email template for all students,
informing them about a workshop.
PS: This is called a docstring... and it will not be interepreted
... | [
"# [SIG Python Task 1] \r\n\r\n\"\"\"\r\nTasks to performs: \r\na) Print 'Hello, World! From SIG Python - <your name>' to the screen\r\nb) Calculate Volume of a Sphere\r\nc) Create a customised email template for all students, \r\n informing them about a workshop.\r\n\r\nPS: This is called a docstring... and it w... | false |
4,229 | 6ecbe119c8a14776373d165dc05e81f91084893c | from SMP.motion_planner.node import PriorityNode
import numpy as np
from heapq import nsmallest
import sys
from SMP.motion_planner.plot_config import DefaultPlotConfig
from SMP.motion_planner.search_algorithms.best_first_search import GreedyBestFirstSearch
# imports for route planner:
class StudentMotionPlanner(Greedy... | [
"from SMP.motion_planner.node import PriorityNode\nimport numpy as np\nfrom heapq import nsmallest\nimport sys\nfrom SMP.motion_planner.plot_config import DefaultPlotConfig\nfrom SMP.motion_planner.search_algorithms.best_first_search import GreedyBestFirstSearch\n# imports for route planner:\n\nclass StudentMotionP... | false |
4,230 | 0081ffc2a1de7fb71515fd0070aaebfef806f6ef | def intersection(nums1, nums2):
return list(set(nums1)&set(nums2))
if __name__=="__main__":
print intersection([1, 2, 2, 1],[2, 2]) | [
"def intersection(nums1, nums2):\n return list(set(nums1)&set(nums2))\n \n \nif __name__==\"__main__\":\n print intersection([1, 2, 2, 1],[2, 2])"
] | true |
4,231 | bbbdb30ceef920e600c9f46fb968732b077be2d8 | from analizer_pl.abstract.instruction import Instruction
from analizer_pl import grammar
from analizer_pl.statement.expressions import code
from analizer_pl.reports.Nodo import Nodo
class If_Statement(Instruction):
def __init__(self, row, column,expBool, elseif_list,else_,stmts ) -> None:
super().__i... | [
"from analizer_pl.abstract.instruction import Instruction\nfrom analizer_pl import grammar\nfrom analizer_pl.statement.expressions import code\nfrom analizer_pl.reports.Nodo import Nodo\n\n\nclass If_Statement(Instruction):\n \n def __init__(self, row, column,expBool, elseif_list,else_,stmts ) -> None:\n ... | false |
4,232 | 78e3750a1bbe9f2f6680937729c1a810bd29fd4d | #Q7. Write a program to calculate the sum of digits of a given number.
n=int(input("Enter a number:\n"))
sum=0
while(n>0):
r=n%10
sum=sum+r
n=n//10
print("The total sum of digits is:",sum)
| [
"#Q7. Write a program to calculate the sum of digits of a given number.\r\n\r\nn=int(input(\"Enter a number:\\n\"))\r\nsum=0\r\nwhile(n>0):\r\n r=n%10\r\n sum=sum+r\r\n n=n//10\r\nprint(\"The total sum of digits is:\",sum)\r\n",
"n = int(input('Enter a number:\\n'))\nsum = 0\nwhile n > 0:\n r = n % 10... | false |
4,233 | dd3419f42a3b1aafd1d4f5d88189fb3c6bd0c67e | import logging
from pathlib import Path
import numpy as np
import torch
import re
import json
from helpers import init_helper, data_helper, vsumm_helper, bbox_helper
from modules.model_zoo import get_model
logger = logging.getLogger()
def evaluate(model, val_loader, nms_thresh, device):
model.eval()
stats ... | [
"import logging\nfrom pathlib import Path\n\nimport numpy as np\nimport torch\nimport re\nimport json\n\nfrom helpers import init_helper, data_helper, vsumm_helper, bbox_helper\nfrom modules.model_zoo import get_model\n\nlogger = logging.getLogger()\n\n\ndef evaluate(model, val_loader, nms_thresh, device):\n mod... | false |
4,234 | c247b218267fc7c2bee93053dd90b2806572eaf2 | # https://www.acmicpc.net/problem/20540
# 각 지표의 반대되는 지표를 저장한 dictionary
MBTI_reverse_index = {
'E': 'I',
'I': 'E',
'S': 'N',
'N': 'S',
'T': 'F',
'F': 'T',
'J': 'P',
'P': 'J'
}
# 연길이의 MBTI 4글자를 대문자로 입력
yeongil_MBTI = input()
# 연길이 MBTI의 각 지표에 반대되는 지표를 출력
for i in yeongil_MBTI:
prin... | [
"# https://www.acmicpc.net/problem/20540\n\n# 각 지표의 반대되는 지표를 저장한 dictionary\nMBTI_reverse_index = {\n 'E': 'I',\n 'I': 'E',\n 'S': 'N',\n 'N': 'S',\n 'T': 'F',\n 'F': 'T',\n 'J': 'P',\n 'P': 'J'\n}\n\n# 연길이의 MBTI 4글자를 대문자로 입력\nyeongil_MBTI = input()\n\n# 연길이 MBTI의 각 지표에 반대되는 지표를 출력\nfor i in... | false |
4,235 | 8dab85622a29bc40f8ad6150f9e6f284853aeaf8 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 ... | [
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\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 require... | true |
4,236 | 331b5f0a34db4d12d713439db3d2818e8c922310 | # models.py- Team
from django.db import models
class Team(models.Model):
teamName = models.TextField()
#Seasons associated
#Registrants unique
return
| [
"# models.py- Team\nfrom django.db import models\n\n\nclass Team(models.Model):\n \n teamName = models.TextField()\n\n #Seasons associated\n #Registrants unique\n\nreturn \n",
"from django.db import models\n\n\nclass Team(models.Model):\n teamName = models.TextField()\n\n\nreturn\n",
"<import tok... | false |
4,237 | 4a7d8db2bc3b753ea1a12120e1ad85f31d572dc7 | #!/usr/bin/env python
# encoding: utf-8
"""
@description: 有序字典
(notice: python3.6 以后字典已经有序了)
@author: baoqiang
@time: 2019/11/28 1:34 下午
"""
from collections import OrderedDict
def run206_01():
print('Regular dict:')
# d = {'a':'A','b':'B','c':'C'}
d = {}
d['a'] = 'A'
d['b'] = 'B'
d['c'] = ... | [
"#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"\n@description: 有序字典\n(notice: python3.6 以后字典已经有序了)\n\n@author: baoqiang\n@time: 2019/11/28 1:34 下午\n\"\"\"\n\nfrom collections import OrderedDict\n\n\ndef run206_01():\n print('Regular dict:')\n # d = {'a':'A','b':'B','c':'C'}\n d = {}\n d['a'] = 'A'\n... | false |
4,238 | 23b6d754adf1616bc6ea1f8c74984fbd8dade6dd | # 나의 풀이
def solution(prices):
# 초 단위로 기록된 주식가격이 담긴 배열 prices # 가격이 떨어지지 않은 기간을 리턴
answer = [0]*len(prices)
for i in range(len(prices)-1):
for j in range(i+1, len(prices)):
answer[i] += 1
# 가격이 떨어졌을 경우
if prices[i] > prices[j]:
break
retur... | [
"# 나의 풀이\ndef solution(prices):\n # 초 단위로 기록된 주식가격이 담긴 배열 prices # 가격이 떨어지지 않은 기간을 리턴\n answer = [0]*len(prices)\n \n for i in range(len(prices)-1):\n for j in range(i+1, len(prices)):\n answer[i] += 1\n # 가격이 떨어졌을 경우\n if prices[i] > prices[j]:\n b... | false |
4,239 | 6c10213c2e866ec84f229aa426c7122aa817d167 | from django.contrib import admin
from coupon.models import Coupon, Games
admin.site.register(Coupon)
admin.site.register(Games) | [
"from django.contrib import admin\nfrom coupon.models import Coupon, Games\n\nadmin.site.register(Coupon)\nadmin.site.register(Games)",
"from django.contrib import admin\nfrom coupon.models import Coupon, Games\nadmin.site.register(Coupon)\nadmin.site.register(Games)\n",
"<import token>\nadmin.site.register(Cou... | false |
4,240 | 5f7d05c642339ce0ab02a65ca41f9ee89c2faf57 | weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
i = input('Enter a day of the week and number of days: ').split()
e = int(i[-1])
starting_point = weekdays.index(i[0])
a = e + starting_point - len(weekdays)
print(weekdays[a]) | [
"weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\ni = input('Enter a day of the week and number of days: ').split()\ne = int(i[-1])\nstarting_point = weekdays.index(i[0])\na = e + starting_point - len(weekdays)\nprint(weekdays[a])",
"weekdays = ['Monday', 'Tuesday', 'Wedn... | false |
4,241 | 355e2799e89dfea4f775480ea7d829a075f92473 | from flask import current_app
def get_logger():
return current_app.logger
def debug(msg, *args, **kwargs):
get_logger().debug(msg, *args, **kwargs)
def info(msg, *args, **kwargs):
get_logger().info(msg, *args, **kwargs)
def warn(msg, *args, **kwargs):
get_logger().warning(msg, *args, **kwargs)
... | [
"from flask import current_app\n\n\ndef get_logger():\n return current_app.logger\n\n\ndef debug(msg, *args, **kwargs):\n get_logger().debug(msg, *args, **kwargs)\n\n\ndef info(msg, *args, **kwargs):\n get_logger().info(msg, *args, **kwargs)\n\n\ndef warn(msg, *args, **kwargs):\n get_logger().warning(ms... | false |
4,242 | af523777e32c44112bd37a4b9dcbc0941f7e8236 | # Generated by Django 2.2.6 on 2019-10-10 07:02
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='cronjob',
fields=[
('id', m... | [
"# Generated by Django 2.2.6 on 2019-10-10 07:02\n\nimport datetime\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='cronjob',\n fields=[\n ... | false |
4,243 | 38bd18e9c1d17f25c10321ab561372eed58e8abc | #딕셔너리로 데이터 표현
# sales = {'hong':0,'lee':0,'park':0}
# d = {'z':10, 'b':20,'c':30}
# print(d)
# d.pop('b')
# print(d)
# d['f']=40
# print(d)
# d.pop('z')
# d['z'] = 40
# print(d.keys())
#반복문(while)
#조건이 참일동안 수행
#while True:
# print('python!!!')
# a = 0
# while a < 10:
# a += 1
# print(a)
# a = 0
# while Tr... | [
"#딕셔너리로 데이터 표현\n# sales = {'hong':0,'lee':0,'park':0}\n# d = {'z':10, 'b':20,'c':30}\n# print(d)\n# d.pop('b')\n# print(d)\n# d['f']=40\n# print(d)\n# d.pop('z')\n# d['z'] = 40\n# print(d.keys())\n#반복문(while)\n#조건이 참일동안 수행\n#while True:\n# print('python!!!')\n\n\n# a = 0\n# while a < 10:\n# a += 1\n# pri... | false |
4,244 | e881fcfce933d8f3bafcbaab039ddcf98827bf5e | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: WuTian
# @Date : 2018/5/3
# @Contact : jsj0804wt@126.com
# @Desc :使用广度优先搜索查找芒果商
from collections import deque
graph = {}
graph["you"] = ["alice", "bob", "claire"]
graph["bob"] = ["anuj", "peggy"]
graph["alice"] = ["peggy"]
graph["claire"] = ["thom", "jonny"]
g... | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# @Author: WuTian\n# @Date : 2018/5/3\n# @Contact : jsj0804wt@126.com\n# @Desc :使用广度优先搜索查找芒果商\nfrom collections import deque\n\ngraph = {}\ngraph[\"you\"] = [\"alice\", \"bob\", \"claire\"]\ngraph[\"bob\"] = [\"anuj\", \"peggy\"]\ngraph[\"alice\"] = [\"peggy\"]\ngr... | false |
4,245 | 1a4da621add157fa6d1f578370d64594b102eeb5 | #This is a file from CS50 Finance
from functools import wraps
from flask import redirect, render_template, session
from threading import Thread
from flask_mail import Message
from application import app, mail
ALLOWED_EXTENSIONS = {"png", "PNG", "jpg", "jpeg", "JPG", "JPEG"}
def login_required(f):
"""
Decorat... | [
"#This is a file from CS50 Finance\nfrom functools import wraps\n\nfrom flask import redirect, render_template, session\nfrom threading import Thread\nfrom flask_mail import Message\nfrom application import app, mail\n\nALLOWED_EXTENSIONS = {\"png\", \"PNG\", \"jpg\", \"jpeg\", \"JPG\", \"JPEG\"}\n\ndef login_requi... | false |
4,246 | 2afc1027c6866e8ab9584a5f7feef4470661f763 | '''CLASS message_unpacker
Message bodies sent through RabbitMQ may take various forms. They were packed
accordingly by the message_packager.
This class reverses the process. Currently, only implemented for message bodies
represented as strings, but could also handle various image formats in a real use
... | [
"'''CLASS message_unpacker\n\n Message bodies sent through RabbitMQ may take various forms. They were packed\n accordingly by the message_packager.\n\n This class reverses the process. Currently, only implemented for message bodies\n represented as strings, but could also handle various image formats in a r... | false |
4,247 | cb28e8bb98cbeed0b703fbfcf7cf30ebca52aa25 | #!C:/Users/Tarang/AppData/Local/Programs/Python/Python37-32/python.exe -u
print("Content-Type: text/html")
print()
import cgi,cgitb
cgitb.enable() #for debugging
form = cgi.FieldStorage()
name = form.getvalue('fname')
print("Name of the user is:",name)
import pymysql
db = pymysql.connect("localhost","roo... | [
"#!C:/Users/Tarang/AppData/Local/Programs/Python/Python37-32/python.exe -u\r\nprint(\"Content-Type: text/html\")\r\nprint()\r\n\r\nimport cgi,cgitb\r\ncgitb.enable() #for debugging\r\nform = cgi.FieldStorage()\r\nname = form.getvalue('fname')\r\nprint(\"Name of the user is:\",name)\r\n\r\nimport pymysql\r\n\r\ndb =... | false |
4,248 | 8a9ed10bf25f3aa13fde43079303194fc6db26c0 |
import tensorflow as tf
import numpy as np
import OpenAi.Pendulum.ActorCritic.Models as Models
"""
The `Buffer` class implements Experience Replay.
---

---
**Critic loss** - Mean Squared Error of `y - Q(s, a)`
where `y` is the expected return as seen by the Target netw... | [
"\n\nimport tensorflow as tf\nimport numpy as np\n\nimport OpenAi.Pendulum.ActorCritic.Models as Models\n\n\n\"\"\"\nThe `Buffer` class implements Experience Replay.\n---\n\n---\n**Critic loss** - Mean Squared Error of `y - Q(s, a)`\nwhere `y` is the expected return as s... | false |
4,249 | c80b31bc154d5c1c8f9fc0ac226295160f2f9473 | #!/usr/bin/env python
"""
.. module:: convert
:synopsis: used to create info.txt and the <txname>.txt files.
"""
import sys
import os
import argparse
argparser = argparse.ArgumentParser(description =
'create info.txt, txname.txt, twiki.txt and sms.py')
argparser.add_argument ('-utilsPath', '--utilsPath',
help ... | [
"#!/usr/bin/env python\n\n\"\"\"\n.. module:: convert\n :synopsis: used to create info.txt and the <txname>.txt files.\n\n\"\"\"\nimport sys\nimport os\nimport argparse\n\nargparser = argparse.ArgumentParser(description = \n'create info.txt, txname.txt, twiki.txt and sms.py')\nargparser.add_argument ('-utilsPath... | false |
4,250 | 4957e62deec6192aabdf7144f02b28c7ce60ed4b | from django.contrib import admin
from .models import Account
# Register your models here.
class AuthenticationCustom(admin.ModelAdmin):
list_display = ("email", "id")
search_fields = ["email", "mobile"]
admin.site.register(Account, AuthenticationCustom) | [
"from django.contrib import admin\nfrom .models import Account\n# Register your models here.\n\n\nclass AuthenticationCustom(admin.ModelAdmin):\n\tlist_display = (\"email\", \"id\")\n\n\tsearch_fields = [\"email\", \"mobile\"]\n\n\nadmin.site.register(Account, AuthenticationCustom)",
"from django.contrib import a... | false |
4,251 | 731d2891bbc29879fd8900a11077c93550e4e88d | from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.views.generic import TemplateView
from pos.service.sumup import API_URL, create_checkout
from pos.models.sumup import SumUpAPIKey, SumUpOnline
from pos.forms import RemotePayForm
from pos.models.user import User
class Remote... | [
"from django.http import HttpResponseRedirect\nfrom django.shortcuts import render\nfrom django.views.generic import TemplateView\nfrom pos.service.sumup import API_URL, create_checkout\nfrom pos.models.sumup import SumUpAPIKey, SumUpOnline\n\nfrom pos.forms import RemotePayForm\nfrom pos.models.user import User\n\... | false |
4,252 | 223d96806631e0d249e8738e9bb7cf5b1f48a8c1 | #!/usr/bin/env python
import sys
sys.path.append('./spec')
# FIXME: make the spec file an argument to this script
from dwarf3 import *
def mandatory_fragment(mand):
if mand:
return "mandatory"
else:
return "optional"
def super_attrs(tag):
#sys.stderr.write("Calculating super attrs for... | [
"#!/usr/bin/env python\n\nimport sys\n\nsys.path.append('./spec')\n\n# FIXME: make the spec file an argument to this script\nfrom dwarf3 import *\n\ndef mandatory_fragment(mand):\n if mand: \n return \"mandatory\"\n else:\n return \"optional\" \n\ndef super_attrs(tag):\n #sys.stderr.write(\"C... | true |
4,253 | 1fb3904d48905ade8f83b6e052057e80302ec5a7 | from cancion import *
class NodoLista:
def __init__(self, cancion, s, a):
self.elemento = cancion
self.siguiente = s
self.anterior = a
| [
"from cancion import *\n\nclass NodoLista:\n\tdef __init__(self, cancion, s, a):\n\t\tself.elemento = cancion\n\t\tself.siguiente = s\n\t\tself.anterior = a\n",
"from cancion import *\n\n\nclass NodoLista:\n\n def __init__(self, cancion, s, a):\n self.elemento = cancion\n self.siguiente = s\n ... | false |
4,254 | 2294951af6ad7a5e752285194d0586c79c49ef87 | """Run golden output tests.
The golden tests are a convenient way to make sure that a "small" change
does not break anyone else.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple
import os
import subprocess
import sys
... | [
"\"\"\"Run golden output tests.\n\nThe golden tests are a convenient way to make sure that a \"small\" change\ndoes not break anyone else.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom collections import namedtuple\nimport os\nimpor... | false |
4,255 | 3a1b0b9891fec7b3d722f77cd2f3f6efa878a7a0 | from django import forms
from basic_app_new.models import *
class UpdateFood(forms.ModelForm):
class Meta:
model = Old_Food_Diary
fields = ['mfg_code', 'food_name', 'description', 'food_type', 'calories', 'fats', 'protein', 'carbohydrates', 'link_of_image', 'link_of_recipie', 'purchasing_link... | [
"from django import forms\r\nfrom basic_app_new.models import *\r\n\r\nclass UpdateFood(forms.ModelForm):\r\n class Meta:\r\n model = Old_Food_Diary\r\n fields = ['mfg_code', 'food_name', 'description', 'food_type', 'calories', 'fats', 'protein', 'carbohydrates', 'link_of_image', 'link_of_recipie',... | false |
4,256 | fd57e13269ca00ed5eb05e00bd7999c041141187 | import reddit
import tts
import sys
import praw
import os
#TODO: CENSOR CURSE WORDS,tag images that have curse words in them. strip punctuation from comment replies mp3
#TODO: pay for ads :thinking: buy views?
#TODO: sort by top upvotes
#todo: remove the formatting stuff
#todo: redo ducking
#todo quick scri... | [
"import reddit\r\nimport tts\r\nimport sys\r\nimport praw\r\nimport os\r\n\r\n#TODO: CENSOR CURSE WORDS,tag images that have curse words in them. strip punctuation from comment replies mp3\r\n#TODO: pay for ads :thinking: buy views?\r\n#TODO: sort by top upvotes\r\n#todo: remove the formatting stuff\r\n#todo: redo ... | false |
4,257 | 12ecfd2750f79fd19355665b6e57c2103a3cac3e | #!/usr/bin/env python3
"""Shows how to call C code from python"""
__appname__ = "myccalc.py"
__author__ = "Joseph Palmer <joseph.palmer18@imperial.ac.uk>"
__version__ = "0.0.1"
__license__ = "License for this code/"
__date__ = "Dec-2018"
## imports ##
import os
import ctypes
# Load the C library into python - needs t... | [
"#!/usr/bin/env python3\n\"\"\"Shows how to call C code from python\"\"\"\n__appname__ = \"myccalc.py\"\n__author__ = \"Joseph Palmer <joseph.palmer18@imperial.ac.uk>\"\n__version__ = \"0.0.1\"\n__license__ = \"License for this code/\"\n__date__ = \"Dec-2018\"\n\n## imports ##\nimport os\nimport ctypes\n\n# Load th... | false |
4,258 | 46f218829e1bf324d4c50ea0ff7003bc48b64e2a | from __future__ import absolute_import
import itertools
from django.contrib import messages
from django.core.context_processors import csrf
from django.db import transaction
from django.http import HttpResponseRedirect
from django.views.decorators.cache import never_cache
from django.utils.decorators import method_de... | [
"from __future__ import absolute_import\n\nimport itertools\n\nfrom django.contrib import messages\nfrom django.core.context_processors import csrf\nfrom django.db import transaction\nfrom django.http import HttpResponseRedirect\nfrom django.views.decorators.cache import never_cache\nfrom django.utils.decorators im... | false |
4,259 | c30f11e9bac54771df5198971c312624f68d0a33 | from django.db import models
from django.template.defaultfilters import slugify
# Create your models here.
class SlugStampMixin(object):
'''
An Worflow is an ordered collection of a Protocols
'''
def save(self, *args, **kwargs):
super(SlugStampMixin, self).save(*args, **kwargs) # Method may n... | [
"from django.db import models\nfrom django.template.defaultfilters import slugify\n\n# Create your models here.\n\nclass SlugStampMixin(object):\n '''\n An Worflow is an ordered collection of a Protocols\n '''\n\n def save(self, *args, **kwargs):\n super(SlugStampMixin, self).save(*args, **kwargs... | false |
4,260 | cc7942c406e9bcb5af43f131fdf0a6441f81c16a | from pycat.base.color import Color
from pycat.sprite import Sprite
from pycat.window import Window
from pyglet.gl.glext_arb import GL_FONT_HEIGHT_NV
from random import randint
window=Window()
class Chick(Sprite):
def on_create(self):
self.image = 'chick-a.png'
self.goto_random_position()
... | [
"from pycat.base.color import Color\nfrom pycat.sprite import Sprite\nfrom pycat.window import Window\nfrom pyglet.gl.glext_arb import GL_FONT_HEIGHT_NV\nfrom random import randint\nwindow=Window()\n\n\nclass Chick(Sprite):\n\n def on_create(self):\n self.image = 'chick-a.png'\n self.goto_random_po... | false |
4,261 | a573c6870392024ec2e84571ccb0bad3f5c4033a | import time
import datetime
from pushover import init, Client
from scraper import *
from config import *
# Get the current time
timeNow = time.strftime("%a %b %d, %I:%M %p").lstrip("0").replace(" 0", " ")
# Initialise Pushover for notifications
client = Client(user_key, api_token=api_token)
# Loop for times of ISS ... | [
"import time\nimport datetime\nfrom pushover import init, Client\nfrom scraper import *\nfrom config import *\n\n# Get the current time\ntimeNow = time.strftime(\"%a %b %d, %I:%M %p\").lstrip(\"0\").replace(\" 0\", \" \")\n\n# Initialise Pushover for notifications\nclient = Client(user_key, api_token=api_token)\n\n... | false |
4,262 | b0174b6f6c33434ff9b5cdb59531502899d8348a | # Generated by Django 2.2.3 on 2019-07-18 06:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('juchu', '0003_auto_20190718_1500'),
]
operations = [
migrations.RemoveField(
mode... | [
"# Generated by Django 2.2.3 on 2019-07-18 06:05\r\n\r\nfrom django.db import migrations, models\r\nimport django.db.models.deletion\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n dependencies = [\r\n ('juchu', '0003_auto_20190718_1500'),\r\n ]\r\n\r\n operations = [\r\n migrations... | false |
4,263 | 74bca94cbcba0851e13d855c02fbc13fb0b09e6a | cijferICOR = float(input('Wat is je cijfer voor ICOR?: '))
x = 30
beloningICOR = cijferICOR * x
beloning = 'beloning €'
print(beloning, beloningICOR)
cijferPROG = float(input('Wat is je cijfer voor PROG: '))
beloningPROG = cijferPROG * x
print(beloning, beloningPROG)
cijferCSN = float(input('Wat is je cij... | [
"cijferICOR = float(input('Wat is je cijfer voor ICOR?: '))\r\nx = 30\r\nbeloningICOR = cijferICOR * x\r\nbeloning = 'beloning €'\r\nprint(beloning, beloningICOR)\r\n\r\ncijferPROG = float(input('Wat is je cijfer voor PROG: '))\r\nbeloningPROG = cijferPROG * x\r\nprint(beloning, beloningPROG)\r\n\r\ncijferCSN = f... | false |
4,264 | 3a05ebee8e70321fe53637b4792f5821ce7044be | # -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is here... | [
"# -*- coding: utf-8 -*-\n\n###############################################################################\n# This file is part of metalibm (https://github.com/kalray/metalibm)\n###############################################################################\n# MIT License\n#\n# Copyright (c) 2018 Kalray\n#\n# Perm... | false |
4,265 | ffb17b370c892696b341f6d37a2cfe106a5670a5 | import numpy as np
raw = np.load("raw_with_freq.npy").item()
for i in list(raw.keys()):
if len(i) > 8:
del(raw[i])
print(raw)
print(len(list(raw.keys())))
np.save("shorten_raw_with_freq.npy", raw)
| [
"import numpy as np\nraw = np.load(\"raw_with_freq.npy\").item()\nfor i in list(raw.keys()):\n\tif len(i) > 8:\n\t\tdel(raw[i])\nprint(raw)\nprint(len(list(raw.keys())))\nnp.save(\"shorten_raw_with_freq.npy\", raw)\n",
"import numpy as np\nraw = np.load('raw_with_freq.npy').item()\nfor i in list(raw.keys()):\n ... | false |
4,266 | 00790b9d2648d19a37d1d1864e7fdeab0f59f764 | # coding=utf-8
"""
author = jamon
""" | [
"# coding=utf-8\n\"\"\"\nauthor = jamon\n\"\"\"",
"<docstring token>\n"
] | false |
4,267 | 00f8992173321dfa5ac5b125a2e663b159fafb23 | import cv2
import torch
print('haha') | [
"import cv2\nimport torch\n\nprint('haha')",
"import cv2\nimport torch\nprint('haha')\n",
"<import token>\nprint('haha')\n",
"<import token>\n<code token>\n"
] | false |
4,268 | 2ea33fd06be888db5cda86b345f535532d2a05b5 | #!/usr/bin/python
import glob
import pandas as pd
import numpy as np
manifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0])
mailTypes = pd.read_csv('./mail_types.csv', sep=',', names=['typeId','typeName'], skiprows=[0])
#----- mailTypes['typeId'] = pd.to_numeric(mailTypes['ty... | [
"#!/usr/bin/python \n\nimport glob\nimport pandas as pd\nimport numpy as np\n\nmanifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0])\nmailTypes = pd.read_csv('./mail_types.csv', sep=',', names=['typeId','typeName'], skiprows=[0])\n\n#----- mailTypes['typeId'] = pd.to_numeric... | true |
4,269 | 1af6bda6eb4e7a46b22379180ea82e78c67ce771 | # -*- coding: utf-8 -*-
from qav5.http.client import BaseClient
from qav5.http.helper import api
from qav5.utils import Bunch, low_case_to_camelcase
class AppusersClient(BaseClient):
def __init__(self, base_url, access_token=None, **kwargs):
super().__init__(base_url, kwargs)
self.access_token = ... | [
"# -*- coding: utf-8 -*-\n\nfrom qav5.http.client import BaseClient\nfrom qav5.http.helper import api\nfrom qav5.utils import Bunch, low_case_to_camelcase\n\n\nclass AppusersClient(BaseClient):\n def __init__(self, base_url, access_token=None, **kwargs):\n super().__init__(base_url, kwargs)\n self.... | false |
4,270 | 4a2796645f1ab585084be47c8cd984c2945aa38b | #!/usr/bin/python
import os, sys
import csv
import glob
if len(sys.argv)==3:
res_dir = sys.argv[1]
info = sys.argv[2]
else:
print "Incorrect arguments: enter outout directory"
sys.exit(0)
seg = dict([('PB2','1'), ('PB1','2'), ('PA','3'), ('HA','4'), ('NP','5'), ('NA','6'), ('MP','7'), ('NS','8')])
# Read th... | [
"#!/usr/bin/python\n\nimport os, sys\nimport csv\nimport glob\n\nif len(sys.argv)==3:\n res_dir = sys.argv[1]\n info = sys.argv[2]\n\nelse:\n print \"Incorrect arguments: enter outout directory\"\n sys.exit(0)\n\nseg = dict([('PB2','1'), ('PB1','2'), ('PA','3'), ('HA','4'), ('NP','5'), ('NA','6'), ('MP','7'), (... | true |
4,271 | c1a9c220b9100a927076753d6483ad7c069dea8c | # coding:utf-8
'''
对称二叉树
实现一个函数,用来判断一个二叉树是不是对称的
如果一颗二叉树和它的镜像是一样的,就是对称的
'''
class BinaryTreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def isSymmetryBonaryTree(self, pRoot):
if pRoot is None:
return... | [
"# coding:utf-8\n\n'''\n对称二叉树\n实现一个函数,用来判断一个二叉树是不是对称的\n如果一颗二叉树和它的镜像是一样的,就是对称的\n'''\n\n\nclass BinaryTreeNode(object):\n def __init__(self, x):\n self.val = x\n self.left = None\n self.right = None\n\n\nclass Solution(object):\n def isSymmetryBonaryTree(self, pRoot):\n if pRoot is N... | true |
4,272 | 31246a2e022f3c5b0ce68bb06422307439cbd9b6 | import random
import HardMode
import EasyMode
#Intro function, gets user input of game start, instructions, and game mode
def introduction():
like_to_play = int(input ("Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) "))
#like_to_play = int(like_to_play)
#need to set y/n variables... | [
"import random\nimport HardMode\nimport EasyMode\n\n#Intro function, gets user input of game start, instructions, and game mode\ndef introduction():\n like_to_play = int(input (\"Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) \"))\n #like_to_play = int(like_to_play)\n #need to se... | false |
4,273 | 6d5257158a7d2eef63faf2fea27f36721d4349ae | #!/usr/bin/python
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
engine = create_engine("sqlite:///banco.db")
Base = declarative_base()
Session = sessionmaker(... | [
"#!/usr/bin/python\n\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer, String, ForeignKey\nfrom sqlalchemy.orm import sessionmaker, relationship\n\nengine = create_engine(\"sqlite:///banco.db\")\nBase = declarative_base()\nSession... | true |
4,274 | 8c683c109aba69f296b8989915b1f3b3eecd9745 | import re
rule_regex = re.compile(r'([\.#]{5}) => ([\.#])')
grid_regex = re.compile(r'initial state: ([\.#]+)')
class Rule:
def __init__(self, template, alive):
self.template = template
self.alive = alive
def parse(string):
match = rule_regex.match(string)
if match:
template = match.group(... | [
"import re\n\nrule_regex = re.compile(r'([\\.#]{5}) => ([\\.#])')\ngrid_regex = re.compile(r'initial state: ([\\.#]+)')\n\n\nclass Rule:\n def __init__(self, template, alive):\n self.template = template\n self.alive = alive\n\n def parse(string):\n match = rule_regex.match(string)\n if match:\n t... | false |
4,275 | 2b5df70c75f2df174991f6b9af148bdcf8751b61 | import sys
sys.stdin = open('4828.txt', 'r')
sys.stdout = open('4828_out.txt', 'w')
T = int(input())
for test_case in range(1, T + 1):
N = int(input())
l = list(map(int,input().split()))
min_v = 1000001
max_v = 0
i = 0
while i < N:
if l[i] < min_v:
min_v=l[i]
if l[i] ... | [
"import sys\nsys.stdin = open('4828.txt', 'r')\nsys.stdout = open('4828_out.txt', 'w')\nT = int(input())\nfor test_case in range(1, T + 1):\n N = int(input())\n l = list(map(int,input().split()))\n min_v = 1000001\n max_v = 0\n i = 0\n while i < N:\n if l[i] < min_v:\n min_v=l[i]... | false |
4,276 | a3588a521a87765d215fd2048407e5e54fb87e94 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 09:53:10 2021
@author: kaouther
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
#path = '/home/kaouther/Documents/Internship/pre_process/input_files/heart_forKaouther.xlsx'
#path = '/home/k... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Apr 14 09:53:10 2021\n\n@author: kaouther\n\"\"\"\n\n# -*- coding: utf-8 -*-\n\"\"\"\nSpyder Editor\n\nThis is a temporary script file.\n\"\"\"\nimport pandas as pd\n#path = '/home/kaouther/Documents/Internship/pre_process/input_files/heart_fo... | false |
4,277 | 9a6f159d9208ee9e337de7b717e2e25c7e7f9f06 | """Plugin setup."""
import importlib
from qiime2.plugin import (
Plugin,
Str,
Choices,
Int,
Bool,
Range,
Float,
Metadata,
MetadataColumn,
Categorical,
Numeric,
Citations,
)
import q2_micom
from q2_micom._formats_and_types import (
SBML,
JSON,
Pickle,
SBM... | [
"\"\"\"Plugin setup.\"\"\"\n\nimport importlib\nfrom qiime2.plugin import (\n Plugin,\n Str,\n Choices,\n Int,\n Bool,\n Range,\n Float,\n Metadata,\n MetadataColumn,\n Categorical,\n Numeric,\n Citations,\n)\n\nimport q2_micom\nfrom q2_micom._formats_and_types import (\n SBML... | false |
4,278 | bfb778a2ecf43a697bc0e3449e9302142b20e1f4 | from django.conf.urls import url
from django.urls import path
from . import views
app_name = 'Accounts'
urlpatterns = [
path('update_info', views.update_info, name='update_info'),
path('create_user', views.create_user, name='create_user'),
path('change_password', views.change_password, name='change_passwo... | [
"from django.conf.urls import url\nfrom django.urls import path\n\nfrom . import views\n\napp_name = 'Accounts'\nurlpatterns = [\n path('update_info', views.update_info, name='update_info'),\n path('create_user', views.create_user, name='create_user'),\n path('change_password', views.change_password, name=... | false |
4,279 | 9887e001f13ed491331c79c08450299afcc0d7cd | """
First run in samples:
mogrify -format png -density 150 input.pdf -quality 90 -- *.pdf
"""
import cv2
import os
import numpy as np
from matplotlib import pylab
def peakdetect(v, delta, x=None):
"""
Converted from MATLAB script at http://billauer.co.il/peakdet.html
Returns two arrays
fun... | [
"\"\"\"\nFirst run in samples: \nmogrify -format png -density 150 input.pdf -quality 90 -- *.pdf\n\"\"\"\n\nimport cv2\nimport os\nimport numpy as np\nfrom matplotlib import pylab\n\ndef peakdetect(v, delta, x=None):\n \"\"\"\n Converted from MATLAB script at http://billauer.co.il/peakdet.html\n \n Ret... | true |
4,280 | e069ad88b5173e5859f1b01b9fb45951d1e82593 | Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import turtle
turtle.setup(650,350,200,200)
turtle.penup()
turtle.fd(-250)
turtle.pendown() ... | [
"Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license()\" for more information.\n>>> import turtle \nturtle.setup(650,350,200,200)\nturtle.penup() \nturtle.fd(-250) \nturtle.pen... | true |
4,281 | be408b349e2795101b525ad8d948dbf52cab81bf | import time
import os
import psutil
start = time.time()
from queue import Queue
from copy import copy
process = psutil.Process(os.getpid())
class Node:
object_id = 0
weight = 0
value = 0
def __init__(self,object_id,weight,value):
self.object_id=object_id
self.weight=weight
... | [
"import time\nimport os\nimport psutil\nstart = time.time()\nfrom queue import Queue\nfrom copy import copy\n\nprocess = psutil.Process(os.getpid())\n\nclass Node:\n object_id = 0\n weight = 0\n value = 0\n \n def __init__(self,object_id,weight,value):\n self.object_id=object_id\n self.... | false |
4,282 | f5831b84c1177d8b869db05d332bd364b3f72fff | from ContactBook import ContactBook
import csv
def run():
contact_book = ContactBook()
with open("22_agenda/contactos.csv",'r') as f:
reader = csv.reader(f)
for idx,row in enumerate(reader):
if idx == 0:
continue
else:
contact_bo... | [
"from ContactBook import ContactBook\nimport csv\n\ndef run(): \n\n contact_book = ContactBook()\n \n with open(\"22_agenda/contactos.csv\",'r') as f:\n reader = csv.reader(f)\n for idx,row in enumerate(reader):\n if idx == 0:\n continue\n else:\n ... | false |
4,283 | b7db0d2f4bbbc2c7763b9d2e6bede74979b65161 | import sys
import os
import random
if sys.version_info[0] < 3:
from StringIO import StringIO
else:
from io import StringIO
def file_len(file):
initial = file.tell()
file.seek(0, os.SEEK_END)
size = file.tell()
file.seek(initial)
return size
def run():
rand_seed = None
std... | [
"import sys\nimport os\nimport random\n\nif sys.version_info[0] < 3:\n from StringIO import StringIO\nelse:\n from io import StringIO\n \n \ndef file_len(file):\n initial = file.tell()\n file.seek(0, os.SEEK_END)\n size = file.tell()\n file.seek(initial)\n return size\n\ndef run():\n r... | false |
4,284 | 1aace7b9385aefdc503ce0e43e0f7f0996fe112a | from gamesim import GameSim
from network import Network
from player import RemotePlayer
from mutator import Mutator
from random import *
import copy
game = GameSim()
game.make_players(10)
base = "networks/"
dir = ""
name = "203964_85377"
gens = 2000
game.players[0].import_player(base + dir + name + ".network")
game... | [
"from gamesim import GameSim\nfrom network import Network\nfrom player import RemotePlayer\nfrom mutator import Mutator\nfrom random import *\nimport copy\n\ngame = GameSim()\ngame.make_players(10)\n\nbase = \"networks/\"\ndir = \"\"\nname = \"203964_85377\"\n\ngens = 2000\n\ngame.players[0].import_player(base + di... | false |
4,285 | 685fa78b9c3ec141ce1e9ab568e4ad8a0565d596 | with open("input_trees.txt") as file:
map = file.readlines()
map = [ line.strip() for line in map ]
slopes = [(1,1), (3,1), (5,1), (7,1),(1,2)]
total = 1
for slope in slopes:
treeCount = 0
row, column = 0, 0
while row + 1 < len(map):
row += slope[1]
column += slope[0]
sp... | [
"with open(\"input_trees.txt\") as file:\n map = file.readlines()\n map = [ line.strip() for line in map ]\n\nslopes = [(1,1), (3,1), (5,1), (7,1),(1,2)]\n\ntotal = 1\n\nfor slope in slopes:\n treeCount = 0\n row, column = 0, 0\n\n while row + 1 < len(map):\n row += slope[1]\n column +=... | false |
4,286 | 8283bdab023e22bba3d8a05f8bda0014ee19adee | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import pylab as pl
import pymc as mc
import book_graphics
reload(book_graphics)
# <markdowncell>
# Uniform points in an $n$-dimensional ball
# =========================================
#
# This notebook implements and compares samplers ... | [
"# -*- coding: utf-8 -*-\r\n# <nbformat>3.0</nbformat>\r\n\r\n# <codecell>\r\n\r\nimport pylab as pl\r\nimport pymc as mc\r\nimport book_graphics\r\nreload(book_graphics)\r\n\r\n# <markdowncell>\r\n\r\n# Uniform points in an $n$-dimensional ball\r\n# =========================================\r\n# \r\n# This noteboo... | false |
4,287 | b8ebbef7403a71d6165a5462bc08e2634b4cebc5 | CARD_SIZE = (70, 90)
SPACING = 3 | [
"CARD_SIZE = (70, 90)\nSPACING = 3",
"CARD_SIZE = 70, 90\nSPACING = 3\n",
"<assignment token>\n"
] | false |
4,288 | f105ecb8229020554930bb4f0e00ecf88e83f5ae | # -*- coding: iso-8859-15 -*-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8:........C@@@
# @@@@@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@88@@@@@@@@@@8... | [
"# -*- coding: iso-8859-15 -*-\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8:........C@@@\r\n# @@@@@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@88... | true |
4,289 | 01f0ad8746ed9a9941faa699b146625ad3a0b373 | # GeoPy can be used to interface to map box https://pypi.org/project/geopy/
from pygeodesy.ellipsoidalVincenty import LatLon
from geojson import Polygon, Feature, FeatureCollection, dump
import sys
import random
BEARING_SOUTH = 180.0
BEARING_EAST = 90.0
class Cell(object):
def __init__(self, cellId, top_left_cel... | [
"# GeoPy can be used to interface to map box https://pypi.org/project/geopy/\nfrom pygeodesy.ellipsoidalVincenty import LatLon\nfrom geojson import Polygon, Feature, FeatureCollection, dump\nimport sys\nimport random\n\nBEARING_SOUTH = 180.0\nBEARING_EAST = 90.0\n\n\nclass Cell(object):\n def __init__(self, cell... | false |
4,290 | 1a126ba7e73eb2e7811ab32146fe5aee6c6b30f9 | """
pokespeare.http.py
~~~~~~~~~~~~~~~~~~
Contains definitions of custom HTTP clients, allowing for more flexibility on
the library choice
"""
import abc
import requests
from typing import Dict, Tuple, Any
from .exceptions import HTTPError, UnexpectedError
import requests_cache
class HTTPClient(abc.ABC):
"""Bas... | [
"\"\"\"\npokespeare.http.py\n~~~~~~~~~~~~~~~~~~\n\nContains definitions of custom HTTP clients, allowing for more flexibility on\nthe library choice\n\"\"\"\n\nimport abc\nimport requests\nfrom typing import Dict, Tuple, Any\nfrom .exceptions import HTTPError, UnexpectedError\nimport requests_cache\n\n\nclass HTTPC... | false |
4,291 | 722739086d2777085fdbfdbddef205aaf025580d | # -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-07-21 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.11.8 on 2018-07-21 12:51\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('user', '0001_initial'),\n ]\n\n operations = [\n migrations.Crea... | false |
4,292 | 6d51a088ba81cfc64c2e2a03f98b0ee354eda654 | from time import sleep
import requests
import json
import pymysql
db = pymysql.connect(host="localhost", user="root", password="root", db="xshop", port=33061)
def getCursor():
cursor = db.cursor()
return cursor
class Classify(object):
def __init__(self, **args):
self.cl_name = args['cl_name']
... | [
"from time import sleep\n\nimport requests\nimport json\nimport pymysql\n\ndb = pymysql.connect(host=\"localhost\", user=\"root\", password=\"root\", db=\"xshop\", port=33061)\n\n\ndef getCursor():\n cursor = db.cursor()\n return cursor\n\n\nclass Classify(object):\n def __init__(self, **args):\n se... | false |
4,293 | c64c542b57107c06de2ce0751075a81fcb195b61 | def Merge (left,right,merged):
#Ф-ция объединения и сравнения элементов массивов
left_cursor,right_cursor=0,0
while left_cursor<len(left) and right_cursor<len(right):
if left[left_cursor]<=right[right_cursor]:
merged[left_cursor+right_cursor]=left[left_cursor]
left_cursor+=1... | [
"def Merge (left,right,merged):\n #Ф-ция объединения и сравнения элементов массивов \n left_cursor,right_cursor=0,0\n while left_cursor<len(left) and right_cursor<len(right):\n if left[left_cursor]<=right[right_cursor]:\n merged[left_cursor+right_cursor]=left[left_cursor]\n lef... | false |
4,294 | b04aef64dc0485d9112a40e00d178042833a9ddd | name=['zhangsan']
def func(n):
name=n
print(name)
def func1():
nonlocal name
name='xiaohong'
print(name)
func1()
print(name)
func('lisi') | [
"name=['zhangsan']\ndef func(n):\n name=n\n print(name)\n def func1():\n nonlocal name\n name='xiaohong'\n print(name)\n func1()\n print(name)\n\nfunc('lisi')",
"name = ['zhangsan']\n\n\ndef func(n):\n name = n\n print(name)\n\n def func1():\n nonlocal name\n ... | false |
4,295 | daecbf5280c199b31f3b9d9818df245d9cd165a7 | import uuid
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.profile import region_provider
# 注意:不要更改
from celery_tasks.sms.dysms_python.build.lib.aliyunsdkdysmsapi.request.v20170525 import SendSmsRequest
class SendMes(object):
REGION = "cn-hangzhou"
PRODUCT_NAME = "Dysmsapi"
DOMAIN = "dysmsapi.aliy... | [
"import uuid\nfrom aliyunsdkcore.client import AcsClient\nfrom aliyunsdkcore.profile import region_provider\n\n\n# 注意:不要更改\nfrom celery_tasks.sms.dysms_python.build.lib.aliyunsdkdysmsapi.request.v20170525 import SendSmsRequest\n\n\nclass SendMes(object):\n\tREGION = \"cn-hangzhou\"\n\tPRODUCT_NAME = \"Dysmsapi\"\n\... | false |
4,296 | 9d3d7000ed13a2623a53705d55b5dbb42662ce2f | import xml.parsers.expat
import urllib2
import threading
def check_url(checkurl, checkstring, checkname):
try:
opener = urllib2.urlopen(checkurl, timeout = 5)
if checkstring[0] == "!":
if checkstring.encode('utf-8')[1:] not in opener.read():
print "Open",checkname
else:
#print "... | [
"import xml.parsers.expat\nimport urllib2\nimport threading\n\n\n\ndef check_url(checkurl, checkstring, checkname):\n try:\n opener = urllib2.urlopen(checkurl, timeout = 5)\n if checkstring[0] == \"!\":\n if checkstring.encode('utf-8')[1:] not in opener.read():\n print \"Open\",checkname\n e... | true |
4,297 | b734a4405d1f5b3650d7149ae80e14548e2dbda4 |
# Project Overview
# Implement the k-means algorithm and apply your implementation on the given dataset,
# which contains a set of 2-D points.
# Import Libraries
import scipy.io
import pandas as pd
import matplotlib.pyplot as plt
import random
import numpy as np
import time
print("\nProgram Started :",tim... | [
"\r\n# Project Overview\r\n# Implement the k-means algorithm and apply your implementation on the given dataset,\r\n# which contains a set of 2-D points.\r\n\r\n# Import Libraries\r\nimport scipy.io\r\nimport pandas as pd\r\nimport matplotlib.pyplot as plt\r\nimport random\r\nimport numpy as np\r\nimport time\r\npr... | false |
4,298 | b3f6d255830bdb2b0afc99aab6e3715616ac4dec | # -*- coding:utf-8 -*-
# Author: 李泽军
# Date: 2020/1/27 3:31 PM
# Project: flask-demo
from flask import abort
from flask_login import current_user
from functools import wraps
from simpledu.modes import User
def role_required(role):
'''
带参数的装饰器,可以用它来保护一个路由处理函数智能被特定的用户访问
:param role:
:return:
'''... | [
"# -*- coding:utf-8 -*-\n# Author: 李泽军\n# Date: 2020/1/27 3:31 PM\n# Project: flask-demo\n\nfrom flask import abort\nfrom flask_login import current_user\nfrom functools import wraps\nfrom simpledu.modes import User\n\n\ndef role_required(role):\n '''\n 带参数的装饰器,可以用它来保护一个路由处理函数智能被特定的用户访问\n :param role:\n... | false |
4,299 | 21974274b1e7800b83eb9582ab21714f04230549 | from rllab.envs.base import Env
from rllab.spaces import Discrete
from rllab.spaces import Box
from rllab.envs.base import Step
import numpy as np
import sys, pickle, os
sys.path.append(os.path.dirname(os.getcwd()))
from os.path import dirname
sys.path.append(dirname(dirname(dirname(os.getcwd()))))
from simulation impo... | [
"from rllab.envs.base import Env\nfrom rllab.spaces import Discrete\nfrom rllab.spaces import Box\nfrom rllab.envs.base import Step\nimport numpy as np\nimport sys, pickle, os\nsys.path.append(os.path.dirname(os.getcwd()))\nfrom os.path import dirname\nsys.path.append(dirname(dirname(dirname(os.getcwd()))))\nfrom s... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.