index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
7,100 | d17081ef94df1e14308128341d040559edb81805 | #This file was created by Tate Hagan
from RootGUI import RootGUI
root = RootGUI()
root.mainloop() |
7,101 | f07b95a3b18aecf6cadaa8398c9158a7cd10aeeb | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 4 12:14:16 2020
@author: mdevasish
"""
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression,Lasso,Ridge
from sklearn.metrics import mean_squared_error,mean_absolute_error
from sklearn.model_selection import train_test_split
import job... |
7,102 | d9bf58dc76d4e8d7146fac3bb2bdfb538ebf78a5 | '''import pyttsx3
#engine = pyttsx3.init()
#Conficuração das vozes
#voices = engine.getProperty('voices')
#engine.setProperty('voice', voices[2].id)
engine=pyttsx3.init()
voices=engine.getProperty('voices')
engine.setProperty('voice',voices[3].id)
#Falar texto
engine.say('Olá meu nome é Jarvis. Sou uma inteligênci... |
7,103 | 87f8cc65cf7d0ea932de79a6daf5b29ad387ec6f | # Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWa... |
7,104 | 94b3fa700d7da0ca913adeb0ad5324d1fec0be50 | import os
import pandas as pd
import numpy as np
from dataloader import *
from keras.optimizers import Adam, SGD
from mylib.models.misc import set_gpu_usage
set_gpu_usage()
from mylib.models import densesharp, metrics, losses
from keras.callbacks import ModelCheckpoint, CSVLogger, TensorBoard, EarlyStopping, ReduceL... |
7,105 | 0158141832423b567f252e38640e384cdf340f8b | # question 1d
# points: 6
import sys
import numpy as np
from astropy.stats import kuiper
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import handin2 as nur
def main():
seed = 8912312
np.random.seed(8912312)
u = 0
sigma = 1
cdf = nur.gaussian_cdf
num_samples = np.lo... |
7,106 | b11210e73b403bc7a9ee24a53201ab2366ec1808 | class item():
def __init__(self,iname,itq,iup):
self.iname = iname
self.itq = itq
self.iup = iup
class store():
def __init__(self,dic):
self.dic = dic
def add(self,iname,itq,iup):
i = item(iname,itq,iup)
self.dic[iname]=[itq,iup]
def cal... |
7,107 | 418798369578e80ecbf82da802b23dc6ca922569 | import pickle
import select
import socket
import sys
from threading import Thread
from typing import Dict, Tuple
import pygame
from pygame.locals import *
import c
from models import *
class Game:
location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2]
velocity: list[int, int] = [0, 0]
current_player: Pl... |
7,108 | dbda5df7dff3f8acc320ffe7b9c7c279ebed2cc2 | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','mkrandom.settings')
import django
django.setup()
from main.models import Character, Vehicle, Tire, Glider
char_names = [
'Mario',
'Luigi',
'Peach',
'Daisy',
'Rosalina',
'Mario Tanooki',
'Peach cat',
'Yoshi',
'Yoshi (LBlue)',
... |
7,109 | 22b697790516e1160ac501a58ad93ef5b579414a | from django.contrib.auth.decorators import permission_required
from django.db import models
from students.models import Student
# Create your models here.
class Fine(models.Model):
amount = models.DecimalField(max_digits=8, decimal_places=2, null=True, default=0)
student = models.OneToOneField(Student, on_de... |
7,110 | 88e34ee5cd5af7d3b04321c4aa4fc815f926add1 | # A program to display and find the sum of a list of numbers using for loop
list=[10,20,30,40,50]
sum=0;
for i in list:
print(i)
sum=sum+i
print('sum =',sum) |
7,111 | 497203be99643e2bb0087977f292f4ed890f9ead | import requests
import sqlite3
url = 'http://dummy.restapiexample.com/api/v1/employees'
r = requests.get(url)
packages_json = r.json()
# Create the employee database if it does not exist
db = sqlite3.connect('employee.sqlite')
#create the table
db.execute("CREATE TABLE IF NOT EXISTS employee (id INTEGER P... |
7,112 | 31996699bec6507d941eb8a7aaacffbd6248d79c | # coding: utf-8
import re
import numpy as np
from sklearn.manifold import TSNE
import word2vec
from matplotlib import pyplot as plt
from adjustText import adjust_text
import nltk
'''
word2vec.word2phrase('all.txt', 'phrases.txt', verbose=True)
word2vec.word2vec('phrases.txt', 'text.bin', size=100, verbose=True)
word2ve... |
7,113 | 7801676df91a7ded6f123113acc62f3955dfe6cb | providers = {
'provider-1': {
'name': 'provider-1',
'roles': ['licensor', 'producer'],
'description': 'This is a full description of the provider',
'url': 'https://www.provider.com'
},
'provider-2': {
'name': 'provider-2',
'roles': ['licensor'],
'descr... |
7,114 | d3f42f329246164cdb6113df3da0eb2d3203b2a9 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(in_planes, planes,
kernel_size=3, stride=stri... |
7,115 | 7bac3b224586f8c42a104123432a7321a1251369 | function handler(event, context, callback){
var
AWS = require("aws-sdk"),
DDB = new AWS.DynamoDB({
apiVersion: "2012-08-10",
region: "us-east-1"
}),
city_str = event.city_str.toUpperCase(),
data = {
city_str: city_str,
... |
7,116 | d7240703bc4cf9b566e7b50a536c83497cd8c6d7 | from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqldb://sql3354595:7Haz6Ng1fm@sql3.freemysqlhosting.net/sql3354595'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'mysecret'
db = S... |
7,117 | 3b29912788fa4cc76f34f52da7728e934ee96637 | include('f469-disco/manifest_f469.py')
freeze('src') |
7,118 | f2292d1816699392663bdbf7a06c334de3b2022c | # ------------------------------------#
# Title: Mailroom Part 1
# Dev: SChang
# Date: Feb 2nd, 2019
# ChangeLog: (Who, When, What)
# SChang,02/02/2019, Created Script
# ------------------------------------#
import os
import sys
import math
donor_list = {"William Gates": [1010, 2020, 3030],
... |
7,119 | 2e5dbd84eb1f9cc09602df8ef8d7bdd30e1b2f26 | #encoding=utf-8
import json
import os
def get_Userid(path):
path_Divided = path.split('\\')
#print(path_Divided)
get_id= path_Divided[6].split('.')
get_id = get_id[0]
#print(get_id)
return get_id
def compose_Json_Path_ToRead(path_json_source,get_id):
json_path_to_read = path... |
7,120 | 45856b4c5cbf1d3b414ad769135b2d974bc0a22b | # -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
from cameo.spiderForCROWDCUBE import SpiderForCROWDCUBE
"""
測試 抓取 CROWDCUBE
"""
class SpiderForCRO... |
7,121 | f9cc9348d36c131aa3d34e4f78f67b008a1b565a | # coding: utf-8
"""
__author__: onur koc
"""
import numpy as np
import matplotlib.pyplot as plt
from mpldatacursor import datacursor
#optional to annotate any clicked point
# ------------
# Input values
# ------------
gamma = 23
# Specific weight of the rock mass [kN/m³]
H = 270
# Overburden [m]
nu ... |
7,122 | a610ccf4fe154ee12de9212a10958fda2000b425 | import numpy as np
from scipy.linalg import solve
from matplotlib import pylab as plt
def f(x):
return (np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2))
xx = np.arange(1, 15, 0.1)
yy = f(xx)
# 1 степень
x = np.array([1,15])
y = f(x)
A = np.array([[1,1], [1,15]])
w = solve(A, y)
y1 = w[0] +... |
7,123 | d52b6dda7111aefb7f9a7b10ad606cda615389d9 | import time
class Solution(object):
def __init__(self):
self.n = None
self.memory = dict()
def dfs(self, bottom, energy):
# optimize for memory, save search time for duplicate results
if (bottom,energy) in self.memory:
return self.memory[(bottom,energy)]
... |
7,124 | 12c3fe8a3ca1e660eeb90b16eca17eddd47e5de7 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-28 17:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('KYusers', '0017_caprofile_regs'),
]
operations = [
migrations.AddField(
... |
7,125 | c9d25460022bb86c821600dfaed17baa70531c9f | from django.test import TestCase, Client
from django.contrib.auth.models import User
from blog.factories import BlogPostFactory, TagFactory
from blog.models import BlogPost
from faker import Factory
faker = Factory.create()
class ServicesTests(TestCase):
def setUp(self):
self.tag = TagFactory()
... |
7,126 | 46194829fc54c2f3e51febde572e05bcff261fb2 | # line_count.py
import sys
count = 0
for line in sys.stdin:
count += 1
# print goes to sys.stdout
print count |
7,127 | 1a710916461644a0676a3bd84926aeabb2aa3f71 | # coding: utf-8
def init_list():
print("=== init_list ===")
l = list()
print(l)
l2 = []
print(l2)
l3 = list((1, 2))
print(l3)
l4 = [1, 2]
print(l4)
def insert_append_and_extend_list():
print("=== insert_append_and_extend_list ===")
l = ['e', 'h']
l.insert(-1, 'g')
... |
7,128 | 7d43b20ebee2f4cd509bbd896c9e6ae8b2c4b354 | #!/usr/bin/env python3
import torch
import torch.nn as nn
import torch.nn.functional as F
import pytorch_lightning as pl
import torchmetrics
class BaselineModule(pl.LightningModule):
def __init__(self, input_size, num_classes=4, lr=3e-4):
super().__init__()
self.backbone = nn.Sequential( # CBR-Ti... |
7,129 | 0b05b027e3c3147aa2b9c35a0bdc33633ba6e658 | #!/usr/bin/env python3
"""Shannon entropy and P affinities"""
import numpy as np
def HP(Di, beta):
"""
Function that calculates shannon entropy
"""
P = np.exp(-Di * beta)
sumP = np.sum(P)
Pi = P / sumP
Hi = -np.sum(Pi * np.log2(Pi))
return (Hi, Pi)
|
7,130 | bb173d8869039f8bbd3e35529cf2d99b26d2b8ff | #!/usr/bin/env python3
import argparse
from speaker.main import run
def parse_args():
parser = argparse.ArgumentParser(description='Network speaker device.')
parser.add_argument('-d', '--debug', action='store_true',
help='enable debugging messages')
parser.add_argument('--host', t... |
7,131 | 27976e9f7fbe030910b3595ea1a13e0e505183e5 | #!/software/python-2.7-2014q3-el6-x86_64/bin/python
import SNANA_Reader as simread
import REAL_Reader as dataread
#import astropy.cosmology as cosmo
import traceback
import scipy
import scipy.stats as stats
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
#import Cosmology
import scipy.stats... |
7,132 | b6a0a49e05fbc0ac7673d6c9e8ca4d263c8bb5cd | # Generated by Django 2.2.17 on 2020-12-05 07:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='identification',
name='id_card_img',... |
7,133 | a444e215b64b3a2d7f736e38227b68c1a1b952a0 | import os
import platform
import _winreg
def gid(x):
find=x
winreg = _winreg
REG_PATH1 = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
REG_PATH2 = r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
registry_key = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, REG_PATH1, 0, win... |
7,134 | 6dbafbcf126c37edb2187eb28c01e2c1125c1c64 | import sys, os; sys.path.insert(0,'..'); sys.path.insert(0,'../NEURON');
from tests.cells.NEURONCellTest import NEURONCellTest
from tests.cells.NeuroMLCellTest import NeuroMLCellTest
class NEURON(NEURONCellTest):
def __init__(self):
super(NEURON, self).__init__()
self.path = "../NEURON/... |
7,135 | 3727c4413cd69305c8ee8d02f4532629da7d25de | def twenty():
pass |
7,136 | 10e1756dc1d6c7b6b7e3569de78e9fa4cdfb0d7e | #-*- coding: UTF-8 -*-
import re
import time
import sys
import command.server.handle_utility as Utility
from ee.common import logger
from ee.common import xavier as Xavier1
sys.path.append('/opt/seeing/app/')
from b31_bp import xavier1 as Xavier2
global agv
agv=sys.argv[1]
Xavier=Xavier1
xavier_module = {"tcp:7801":Xa... |
7,137 | 3344eb5b3e5b5eaee7b08d0991be732dae62c7fc | import io
from PIL import Image
def bytes_from_file(path, size, quality=15):
img = Image.open(path)
img = img.resize(size)
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format="JPEG", quality=quality)
return img_byte_arr.getvalue()
|
7,138 | 721e014bc5bf53a39556e31f281b77b90508cf12 | # -*- Python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# California Institute of Technology
# (C) 2008 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
... |
7,139 | 3d3b77630d275f830daf9f6e0d50a77ef624521e | # Midterm Review Class!
'''
This is a Multi line comment:
'''
# Break and Continue
# for i in range(10):
# if i == 5:
# continue
# print(i)
# Prints 0-4, 6-9
# # Structure
# Some MCQ
# Some T/F
# Some short answer
# # Lists
# Append
# remove
# del
# ... |
7,140 | d5f66d92371838c703abbf80e2b78717cdd4a4fb | from django.shortcuts import render
from django.http import HttpResponse
# from appTwo.models import User
from appTwo.forms import NewUserForm
# Create your views here.
# def index(request):
# return HttpResponse("<em>My Second Project</em>")
def welcome(request):
# welcomedict={'welcome_insert':'Go to /user... |
7,141 | c0524301a79788aa34a039fc46799021fb45362c | import random
from common.ast import *
from mutate.mutate_ctrl import *
def _check_parent_type(node, nodes, types):
par = node
while(nodes[par] != None):
par = nodes[par]
if type(par) in types:
return True
return False
def mutate_operator(root, nodes, path):
candidates = [... |
7,142 | 0ae626df5a471af77f7361bb765b46b861ee8a2c | # terrascript/spotinst/__init__.py
import terrascript
class spotinst(terrascript.Provider):
pass |
7,143 | cc097b4d2a5a521a0adb83ca1b58470b4ce84f39 | '''
Copyright
Jelen forráskód a Budapesti Műszaki és Gazdaságtudományi Egyetemen tartott
"Deep Learning a gyakorlatban Python és LUA alapon" tantárgy segédanyagaként készült.
A tantárgy honlapja: http://smartlab.tmit.bme.hu/oktatas-deep-learning
Deep Learning kutatás: http://smartlab.tmit.bme.hu/deep-learning
A forr... |
7,144 | 899cdb5cbdbd0a57af76a5044d54e1fe2a497847 | '''
Created on Jan 19, 2014
@author: felix
'''
import sys
from PyPDF2 import PdfFileReader
from pytagcloud import create_tag_image, make_tags, LAYOUT_HORIZONTAL
from pytagcloud.lang.counter import get_tag_counts
def main():
for i in range(0, len(sys.argv)):
if (sys.argv[i] == '-f'):
try:
... |
7,145 | eb3a32c17d8e5e9f717e813d5612d077c8feac48 | import sys
import time
from cli.utils import get_container_runtime, get_containers, run_shell_cmd
runtime = get_container_runtime()
def rm(ids):
cmd = f'{runtime} rm {" ".join(ids)}'
sys.stdout.write(f'{cmd}\n')
run_shell_cmd(cmd)
def stop(ids):
cmd = f'{runtime} stop {" ".join(ids)}'
sys.stdout... |
7,146 | de24b341102f5979cc48b22c3a07d42915b6dd18 | from .tokening import sign_profile_tokens, validate_token_record, \
get_profile_from_tokens
from .zone_file import create_zone_file
from .legacy import is_profile_legacy_format, get_person_from_legacy_format
|
7,147 | b46f19708e9e2a1be2bbd001ca6341ee7468a60d | #!/usr/bin/env python
# coding:utf-8
"""
200. 岛屿数量
难度
中等
给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。
示例 1:
输入:
11110
11010
11000
00000
输出: 1
示例 2:
输入:
11000
11000
00100
00011
输出: 3
"""
# ===============================================================================... |
7,148 | f1e335d0187aeb78d857bc523eb33221fd2e7e6d |
def most_expensive_item(products):
return max(products.items(), key=lambda p: p[1])[0]
|
7,149 | e2671911894871c32ad933fde8e05c913a4cc942 | from django.urls import path
from . import views
from .views import propertyForRent, propertyForSale, PropertyDetailView
app_name = "core"
urlpatterns = [
path("", views.index, name="home"),
path("property_for_rent/", views.propertyForRent, name="property_rent"),
path("property_for_sale/", views.propertyF... |
7,150 | 09ea684cfb6f0a521d3bdadf977d9385636bdc83 | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
path('', views.PostList.as_view(), name='blog_index'),
path('<slug:slug>/', views.post_detail, name='post_detail'),
path('tag/<slug:slug>/', views.TagIndexView.as_vi... |
7,151 | 81f75498afcca31e38ea7856c81c291af3ef6673 | import urllib2
import csv
from bs4 import BeautifulSoup
url = {
"Home ": 'https://www.moneycontrol.com/',
# "Market": 'https://www.moneycontrol.com/stocksmarketsindia/',
# "Mf Home": 'https://www.moneycontrol.com/mutualfundindia/'
}
def get_last_element_timestamp(url):
conn = urllib2.urlopen(url)
html ... |
7,152 | 3c2873add66172a5ed038949c31d514dcd5f26b3 | # -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, thi... |
7,153 | 62857a015087500fec534ba1297d42a33ae61927 | import testr
import testg
import time
def run():
parser = testg.OptionParser(description='Autonomous grasp and manipulation planning example.')
parser.add_option('--scene',
action="store",type='string',dest='scene',default='/home/user/experiment/data/lab1.env.xml',
h... |
7,154 | 6b731e329eec3947a17ef8ee8280f2ddf980c81c | print("Praktikum Programa Komputer ")
print("Exercise 7.21")
print("")
print("===========================")
print("Nama : Ivanindra Rizky P")
print("NIM : I0320054")
print("")
print("===========================")
print("")
import random
a = [23, 45, 98, 36]
print('a = ', a)
print('random 1')
print('choice ... |
7,155 | 49492ad1a1734be02ebefb77095fd560a7a7efd8 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import airflow
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.operators import BashOperator, DummyOperator
from datetime import datetime, timedelta
# -----------------------------------------------------... |
7,156 | c2d8e34ab0b449a971c920fc86f259f093f16cc5 | import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset.mnist import load_mnist
from controller import Controller
# データの読み込み
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, one_hot_label=True)
# instance
controller = Controller()
# accuracy
trycount = ... |
7,157 | d3a22cad850e895950ce322aac393b31758a2237 | def SimpleSymbols(str):
if str[0].isalpha() and str[-1].isalpha():
return "false"
for i in range(0, len(str)):
if str[i].isalpha():
if str[i-1] == '+' and str[i+1] == '+':
return "true"
return "false"
# keep this function call here
# to see how to enter arguments in Python scrol... |
7,158 | 634c826d30b22c6061531c514914e9ca62b21605 | for row in range(7):
for col in range(5):
if (col == 0) or (row % 3 == 0):
print("*", end=" ")
else:
print(" ", end=" ")
print()
|
7,159 | 41e642c4acb212470577ef43908a1dcf2e0f5730 | import glob
from collections import defaultdict
from stylalto.datasets.extractor import read_alto_for_training, extract_images_from_bbox_dict_for_training, split_dataset
data = defaultdict(list)
images = {}
for xml_path in glob.glob("./input/**/*.xml", recursive=True):
current, image = read_alto_for_training(xml_... |
7,160 | e4b49faaad648c6e85274abb18f994083a74013d | import numpy as np
catogory = np.array([50,30,40,20])
data = np.array([
[20,50,10,15,20],
[30,40,20,65,35],
[75,30,42,70,45],
[40,25,35,22,55]])
print(catogory)
print(data)
print(catogory.dot(data))
print(data.T.dot(catogory))
|
7,161 | 45f9d5ac0fa7d9259c1d53b92c030559f3bfda89 | #-*- coding: utf8 -*-
#Programa: 04-palindromo
#Objetivo:Un Numero Palindromo es aquel numero que se lee igual, de izquierda a derecha y viceversa
#El palindromo mas grande que se pued obtener por el producto de dos numeos de dos digitos
# es: 9009 que es igual a 91x99.
#Encuentre el pali... |
7,162 | badbfdbdeb8b4fd40b1c44bf7dcff6457a0c8795 | def get_value(li, row, column):
if row < 0 or column < 0:
return 0
try:
return li[row][column]
except IndexError:
return 0
n = int(input())
results = {}
for asdf in range(n):
table = []
title, rows, columns = input().split()
rows = int(rows)
columns =... |
7,163 | 2df2cccc22aba2104ab15820e13d304addf83f63 | """slack_utils.py: slack-specific utilities"""
from os import path
import pprint
HERE = path.abspath(path.dirname(__file__))
PP = pprint.PrettyPrinter(indent=2)
def parse_slack_message_object(message_obj):
"""parse user_name/channel_name out of slack controller
Notes:
`slackbot.message`.keys(): [type... |
7,164 | 845d04312abc0e64a7810b52bbee333d2bdf3dfb | from torch import Tensor
from torch.autograd import Variable
from torch.optim import Adam
from maac.utils.misc import hard_update, onehot_from_logits
from maac.utils.policies import DiscretePolicy
class AttentionAgent(object):
"""
General class for Attention agents (policy, target policy)
"""
def __i... |
7,165 | 397d9b1030a1ec08d04d2101f65a83547495b861 | import numpy as np
import cv2
import os
from moviepy.editor import *
N = 1
# Initiate SIFT detector
sift = cv2.xfeatures2d.SIFT_create()
# count file number in folder frames
list = os.listdir('./frames')
number_files = len(list)
# array to store similarity of 2 consecutive frames
similarity = []
boundaries = []
ke... |
7,166 | 55252fc78c67e48c64e777e4c3a713c898312b81 | import pyenttec, math, time
global port
MAX = 60
panels = [408, 401, 404, 16]
def render():
port.render()
def setColor(panel, color):
if panels[panel]:
port.set_channel(panels[panel] - 1, color[0])
port.set_channel(panels[panel], color[1])
port.set_channel(panels[panel] + 1, color[2... |
7,167 | 0ac9e757fa827b311487169d0dc822951ce8c4bb | #!/usr/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
evaluate-gbvi.py
Evaluate the GBVI model on hydration free energies of small molec... |
7,168 | 7e328992392a4ff2b0e23920a8907e38f63fcff0 | from django.contrib import admin
from .models import Game, Scrap
admin.site.register(Game)
admin.site.register(Scrap)
|
7,169 | acd6197e60cf59ffcaa33bb50a60a03592bb3559 | #! /usr/bin/python3
from scapy.all import *
import sys
ip=IP(src=sys.argv[1], dst=sys.argv[2])
syn_packet = TCP(sport=52255, dport=1237, flags="S", seq=100, options=[('MSS',689),('WScale',1)])
synack_packet = sr1(ip/syn_packet)
my_ack = synack_packet.seq+1
ack_packet = TCP(sport=52255, dport=1237, flags="A", seq=101,... |
7,170 | 3941f283893c259033d7fb3be83c8071433064ba | from output.models.nist_data.list_pkg.nmtokens.schema_instance.nistschema_sv_iv_list_nmtokens_min_length_5_xsd.nistschema_sv_iv_list_nmtokens_min_length_5 import NistschemaSvIvListNmtokensMinLength5
obj = NistschemaSvIvListNmtokensMinLength5(
value=[
"f",
"D",
"T",
"a",
"b"... |
7,171 | 7700e3c4061f0e81a1dea8fa8b27a0380fc26e71 | #!/usr/bin/env python
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is CONFIDENTIAL. You may not work
# with, install, use, duplicate, modify, redistribute or share this
# file, or any part thereof, other than as allowed by any agreement
# specifical... |
7,172 | a6365104125725f11010c35eb0781c941de803f8 | import pandas
import evaluation
import sys
sys.path.append('D:\\libs\\xgboost\\wrapper')
import xgboost as xgb
# Read training data
folder = '../data/'
train = pandas.read_csv(folder + 'training.csv', index_col='id')
# Define features to drop from train data
# variables_to_drop = ['mass', 'production', 'min_ANNmuon'... |
7,173 | 8419aee5dbc64b51f3c0f364716aad1630f00fe9 | import sys, os, json
sys.path.append(os.path.join(os.path.dirname(__file__), "requests"))
import requests
def findNonPrefixes(prefix, array):
result = []
prefixLength = len(prefix)
for string in array:
if string[0:prefixLength] != prefix:
result.append(string)
return result
def run ():
r = requests.post("... |
7,174 | ae8add3adc336c9404cd2aeab4aff81c94c8884e | from django.contrib.auth.forms import UserChangeForm
from django.contrib.auth.models import User
from django import forms
class editForm(forms.ModelForm):
username = forms.CharField(max_length=100, widget= forms.TextInput(attrs={'class': 'form-control'}))
first_name = forms.CharField(max_length=100, widget= fo... |
7,175 | 892f90edbd8bd54841b815a6bc29d136c5e84a38 | # This defines a new interface, called MyClosedInterface
# which is closed (does not allow new members to be added).
# "eci" is the schema id for this extension.
{"fs": { "eci": {
"info": {
"name": "Example closed Interface extension",
"version": "1.0",
"date": "Sept. 22, 2016",
"author": "Jeff Teete... |
7,176 | 3f2221f5f3a699020dd5986acb793e3083976dff | import subprocess
import datetime
def ping_address(host,n):
ping = subprocess.Popen(
["ping","-c",str(n),host],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
out,error = ping.communicate()
return out, error
def ping_address_windows(host,n):
ping = subprocess.Popen(
["... |
7,177 | 6027836b1b5d3cb8b842b1a1b77f5c9777269896 | """
В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
"""
import random
SIZE = 10
MIN_ITEM = -100
MAX_ITEM = 100
array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)]
print('Массив случайных чисел:\n', array)
min_el = array[0]
max_el = array[0]
max_el_inx = 0
min_... |
7,178 | 962a9781e4f2ad787dd695896b6455c9b336603a | from core import Postgresdb
db = Postgresdb()
print(db) |
7,179 | 03677f02473019fcc6a40d91569a85be78ca0a87 | #!/usr/bin/env python3
from datetime import datetime
import re
import sys
MONTHS_REGEXP = ('Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|'
'January|February|March|April|June|July|August|September|October|November|December')
re_entry_begin = re.compile(r'(?P<version>[\d.]+)[ :]*\(?(?P<date>\d\d\d\d... |
7,180 | 1330addd53c6187a41dfea6957bf47aaecca1135 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-27 21:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
class Migration(migrations.Migration):
dependencies = [
('regions', '0002_auto_2... |
7,181 | 5f2427c077d460d109f5a3e94b93f72c090f036d | # -*- coding: utf-8 -*-
# python >= 3.7
# supported xmanager version <5.1, 5.1, 5.2, 6
import os
import argparse
import configparser
import unicodedata
from win32api import GetComputerName, GetUserName
from win32security import LookupAccountName, ConvertSidToStringSid
from base64 import b64encode, b64decode
from Cryp... |
7,182 | 82f86284dddf48bf2c65ddf55eb6d7a372306373 | #Import dependencies
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import string
import operator
from sklearn.feature_extraction.text import CountVectorizer
import pickle
import nltk
from nltk.corpus import stopwords
#nltk.download('stopwords')
from nltk.tokenize import wo... |
7,183 | cb1e73d172314c8d3d31f6e49fa67582375c0c58 | #!/usr/bin/env python3
# coding:utf-8
# 改进小红球
class Ball:
def __init__(self, canvas, paddle, color):
self.canvas = canvas
self.paddle = paddle
self.id = canvas.create_oval(10, 10, 25, 25, fill=color)
self.canvas.move(self.id, 245, 100)
starts = [-3, -2, -1, 1, 2, 3]
... |
7,184 | 222948fb0a991bb6d7faa186c7442a303b88290b | from django.contrib import admin
from apps.cart.models import *
# Register your models here.
class CartAdmin(admin.ModelAdmin):
list_display = ('user_id', 'goods_id', 'goods_num')
search_fields = ('user_id', 'goods_id', 'goods_num')
list_filter = ['user_id', 'goods_id', 'goods_num']
admin.sit... |
7,185 | 9a02bd0bc14494db033c032003aa5baea111ea8c | import random
import Manhattan_segmental_dist
# Greedy
# s: dictionary of points
# k: number of medoids
# returns
# k medoids from sample set s
def greedy(s, k):
# print("Hello Word!")
m_1 = random.choice(list(s.keys()))
medoids = {m_1: s[m_1]}
dimensions = list(range(len(s[m_1])))
s.pop(m_1... |
7,186 | 1f8040776a55d6fe52b64c714d4003469460e454 | # 심사문제 22
# 표준 입력으로 정수 두 개가 입력됩니다(첫 번째 입력 값의 범위는 1~20, 두 번째 입력 값의 범위는 10~30이며 첫 번째 입력 값은 두 번째 입력 값보다 항상 작습니다).
# 첫 번째 정수부터 두 번째 정수까지를 지수로 하는 2의 거듭제곱 리스트를 출력하는 프로그램을 만드세요
# (input에서 안내 문자열은 출력하지 않아야 합니다). 단, 리스트의 두 번째 요소와 뒤에서 두 번째 요소는 삭제한 뒤 출력하세요. 출력 결과는 리스트 형태라야 합니다.
start, stop = list(map(int, input().split()))
1 10
... |
7,187 | d4a4ea67a06107ad7ea18bb21fb1ec9e74ccd7c1 | #!/usr/bin/env python
import sys
import subprocess
import mystem
def run(args, fin=sys.stdin, fout=sys.stdout, ferr=sys.stderr, input_data=None):
'''\
Generic wrapper for MyStem
'''
mystem_path = mystem.util.find_mystem()
# make utf-8 a default encoding
if '-e' not in args:
args.exten... |
7,188 | 84febcc599aa97858ded3b6f803b6b76960878d4 | from itertools import takewhile
import numpy as np
from .rrt import TreeNode
from .trajectory.linear import get_default_limits, solve_linear
from .trajectory.retime import spline_duration
from .utils import argmin, negate, circular_difference, UNBOUNDED_LIMITS, get_distance, get_delta
ASYMETRIC = True
def asymmetr... |
7,189 | f19e853af675c16dfbb911bf2b756de0f1e3f2f8 | #!/usr/bin/python
import os
from base_exploit import *
from reporter import *
from netfw import *
import sys
class remote_shell(base_exploit):
id = EXPLOIT_ID_REMOTE_SHELL
def exploit(self, ip, port):
# Create a connection to requested destination
s = socket(AF_INET, SOCK_DGRAM)
s.con... |
7,190 | 014509170b98a38838859d3ca48c74ca6be0bd46 | #encoding:utf-8
class Employee():
def __int__(self,name,sex,salary):
self.name = name
self.sex = sex
self.salary = salary
def give_raise(self):
222 |
7,191 | 061c287d5f0a5feeeaedc80eea6b3fc4ff02286e | import logging
from typing import Dict
import numpy as np
from meshkit import Mesh
from rendkit.materials import DepthMaterial
from vispy import gloo, app
from vispy.gloo import gl
logger = logging.getLogger(__name__)
class Renderable:
def __init__(self,
material_name: str,
at... |
7,192 | 34c91d273648ae72731fba7f5519a4920d77c0c3 | include ("RecExRecoTest/RecExRecoTest_RTT_common.py")
from BTagging.BTaggingFlags import BTaggingFlags
BTaggingFlags.Active=False
# main jobOption
include ("RecExCommon/rdotoesdnotrigger.py")
include ("RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py")
|
7,193 | f0f9541eba29b4488c429c889f3b346d53d0239d | import json
data = '{"var1": "harry", "var2":56}'
parsed = json.loads(data)
print(parsed['var1'])
# data2 = {"channel_name": "Chill_Out",
# "Cars": ["BMW", "Audi a8", "ferrari"],
# "fridge": ("loki", "Aalu", "pasta"),
# "isbad": False
# }
# jscomp = json.dumps(data2)
# print(jscomp)
|
7,194 | 9a60449aa13bc5e7e413d0e47a1972d93ccfe69f | a=input().split(' ')
A=int(a[0])
B=int(a[1])
X=int(a[2])
if A<=X and A+B>=X:
print('YES')
else:
print('NO') |
7,195 | bb5bea4ea100950b59fb2b168b75dec349938aac | import numpy as np
import cv2
import myrustlib
def detect_lines_hough(img):
lines = cv2.HoughLinesP(
cv2.bitwise_not(opening),
rho = 1,
theta = np.pi / 2,
threshold=50,
minLineLength=120,
maxLineGap=10
)
return [line[0] for line in lines] # weird HoughLinesP ... |
7,196 | 4e9674ea46bdf930d1e99bcda56eaa300c84deef | from nbt import nbt
from matplotlib import pyplot
class Banana(object):
id = 10
def srange(x1, xDoors, spaces):
"""
a counting thing that i dunno what does.
"""
for a in xrange(x1, x1 + xDoors):
yield a
for a in xrange(x1 + xDoors + spaces, x1 + spaces + xDoors * 2):
yield a
... |
7,197 | 2898506b9fd5b112f93a1ff6b010848244c398bd | from collections import deque
class Queue:
def __init__(self):
self.container = deque()
def enqueue(self, data):
self.container.appendleft(data)
def dequeue(self):
return self.container.pop()
def is_empty(self):
return len(self.container) == 0
def size(self):
... |
7,198 | 3c7237e5770dd5552c327dbf53451a2889ea8c6b | import torch
import typing
__all__ = ['NoOp']
class Null(torch.optim.Optimizer):
def __init__(self,
parameters: typing.Iterator[torch.nn.Parameter],
):
super(Null, self).__init__(parameters, {"lr": 0.0, "eps": 1e-8})
def step(self, closure=None):
if closure is not None:
closure()
return N... |
7,199 | 146db68fb84569b914fa741457c595108088dc63 | from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
from scipy.misc import imread
import os
import numpy as np
files = [ "oracle.PNG",
"SQL.jpg" ]
def plotImage(f):
folder = "C:/temp/"
im = imread(os.path.join(folder, f)).astype(np.float32) / 255
plt.im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.