index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
995,700 | 9c1c9ab15a30e2eb26c952a349f7329e4e7bea46 | import numpy as np
#------part 1------#
wires = np.loadtxt('input.txt', dtype = str)
wire1 = wires[0].split(',')
wire2 = wires[1].split(',')
w, wmax, wmin, h, hmax, hmin = 0, 0, 0, 0, 0, 0
for order in wire1:
if order[0] == 'R':
# print('R-', order)
w += int(order[1:])
wmax = max(w, wmax)
# print... |
995,701 | 8b3929a49383f9c8bb22acbb2b96731918c4ae4c | # ---------------------------------------------------------------------------- #
# Title: mailroom part 1
# Description: A program that holds a list of donors and amounts they donated.
# Prompt the user to choose 3 menu actions; thank you, report, quit.
#
# <05/30/2020>, Created Script
# ------------------... |
995,702 | e942bafe9740285f9a0f651d7e28ca89456bc902 | # -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import numpy as np
import pandas as pd
from sklearn.datasets import make_classification
from sklearn.ensemble import ExtraTreesClassifier
"""
Runs data cleaning scripts to turn data from (../... |
995,703 | 5f62ad61e225223abce9bbde84f06bb2f0a4a780 | import io
import os
import os.path
import struct
import socket
import stat
import time
import config
import storage
import database
import proto.nofs_local_pb2 as nofs_local
from proto.nofs_local_pb2 import *
def enum_from_value(enumtype, value):
for v in enumtype.values:
if v.number == value:
... |
995,704 | 9accc4f4a287608c670a1ca6752198f590a52219 | import hashlib
import datetime
import couchdbkit
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from pyramid.threadlocal import get_current_registry
from pyramid.events import NewRequest
from pyramid.events import subscriber
from beaker.cache import cache_region
from pygments impo... |
995,705 | eacf2e57af3d54eaf300747b70774c7f83dbddfc | # -*- coding: utf-8 -*-
from java.util.logging import Level
from java.io import File
from java.lang import Class
from java.sql import DriverManager
from java.sql import SQLException
import os
import IM_sqlitedb_android
def kate(self, progressBar, kate_files):
blackboardAttribute = IM_sqlitedb_android.BlackboardA... |
995,706 | ddf5009dc0e99a9ed5d72d384a77b481c5611f13 | # variables that contain the user credential to access twitter api
import tweepy
from tweepy import OAuthHandler
import json
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
CONUMER_KEY = ""
CONSUMER_SECRET = ""
#auth = OAuthHandler(CONUMER_KEY, CONSUMER_SECRET)
# auth.set_access_token(ACCESS_TOKEN, #ACCESS_TOKEN_SECRET)
... |
995,707 | 41020552d0b8af16e1ca43eea2eb93721f0845fd | import numpy as np
import gym
import tensorflow as tf
import json, sys, os
import random
import time
from gym import wrappers
log_dir= 'tmp'
env_to_use = 'Pendulum-v0'
# hyperparameters
# game parameters
env = gym.make(env_to_use)
# set seeds to 0
env.seed(10)
np.random.seed(10)
np.set_printo... |
995,708 | 237d01b1742f28c19a2eced9f34af0a60e2bfbc7 | import torch
import torch.nn.functional as F
from torch import nn as nn
from torch.autograd import Variable
SUPPORTED_METRICS = ['BCEWithLogitsLoss', 'CrossEntropyLoss', 'MSELoss', 'Accuracy']
class NewMetric:
def __init__(self, params, **kwargs):
super(NewMetric, self).__init__()
pass
def __c... |
995,709 | 33b677a40cadadbae0a9a1c8ed5cceeddc863472 | import re
import numpy as np
import pandas as pd
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
stopwords_english = stopwords.words('english')
# 考虑用频度阈值和停用词表进行过滤 http://www.cnblogs.com/amiza/p/10407801.html
class SAOMR:
def __init__(... |
995,710 | bbecfe66355e140492732160df209f7b65399a37 | n,m = map(int, input().split())
a = []
ans = 0
a = input().split()
for i in range(n):
a[i] = int(a[i])
for i in range(m):
b,c = map(int, input().split())
a = a + [c]*b
a.sort()
for i in range(n):
ans += a[len(a)-i-1]
print(ans) |
995,711 | 4d5d6f8884c349c617163f85e6a09f5309c17f89 | #!/usr/bin/env python
"""Define hooks to be run before project generation."""
import sys
from slugify import slugify
PROJECT_SLUG = "{{ cookiecutter.project_slug }}"
PROJECT_DIRNAME = "{{ cookiecutter.project_dirname }}"
def check_identifiers():
"""Check if project_slug and project_dirname are valid Python ide... |
995,712 | b01cd8d40699a81c62b461685a4b4efaeff4b12c |
class BonusFact:
def __init__(self, player, bonus):
self.player_id = player.PlayerID
self.description = bonus.Identifier
self.product_id = bonus.ProductID
self.currency = bonus.Currency
self.value = bonus.Value
self.activity_time = bonus.TransactionDate
def to... |
995,713 | 5533b09a2be4e6c22649000a166028efbb4e8659 | #!/usr/bin/env python3
import sys
import os
sys.path.append('../modules')
import numpy as np
import matplotlib.pyplot as plt
import raytracing as rt
import visualize as vis
import ray_utilities
if __name__ == '__main__':
# Constants
image_plane = -1e6 # Image plane from first lens
fs = 100 #... |
995,714 | 2a310859ce9c1897580fce000e068cd243a88f7f | #!/usr/bin/python
import subprocess
import sys
def run_command(command):
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
print line
retval = p.wait()
def get_backup_name(file):
fileHandle = open(file, "r")
lineLi... |
995,715 | aa20e342f87ee6e8f0a3751af1a504302a38fad7 | #!/usr/bin/env python
# coding=utf-8
import numpy as np
import os
import shutil
import sys
from cv_bridge import CvBridge, CvBridgeError
import cv2
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
Nshot = 50
image_path = "/home/nizar/Images/tpROS/"
def mse(imageA, imageB):
# the 'M... |
995,716 | f2bf2c6e2549deb323e5ed753ccce4a39f8e97ae | from bson.objectid import ObjectId
class Clients:
def __init__(self, db):
self.db = db
self.clients = []
def list(self):
return self.db.find()
def find_by_criteria(self, criteria):
clients = self.db.find(criteria)
return clients
def find_by_id(... |
995,717 | b8038d21ba2c48ec2fd61eca7f33bf95c9f15f4d | from cpp_parameters import *
# Testing correct and incorrect parameter counts being passed (kwargs and non-kwargs)
# Note that the implementation depends a lot on whether zero, one, two or more args are being wrapped
def is_python_fastproxy():
"""Return True if SWIG is generating Python code using -fastproxy."""
... |
995,718 | 82109f7a4ad6d7a665692e5ce44b6586ece0b2d6 | import random
class Letters(object):
"""Getting random letters and reutning them"""
def __init__(self,owning_letters):
self.owning_letters=owning_letters
def having_letters(self):
"""Letters checked and added based on previous word
:returns list"""
self.letter=[... |
995,719 | a90330b71ffb41dbdd90aad1abef51318983bcde | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 04:56:49 2019
@author: Ayush
"""
#Libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Dataset
dataset= pd.read_csv('Ads_CTR_Optimisation.csv')
#Implement thompsons
import random
N=10000
d=10
ads_selected=[]
number_of_r... |
995,720 | 5d86361c8bb4ab72f6bec3af61dc066525c2eb32 | #!/usr/bin/env python
from __future__ import division, absolute_import, print_function
"""
This is the unittest for the Efficient/Sequential Elementary Effects module.
python -m unittest -v test_eee.py
python -m pytest --cov pyeee --cov-report term-missing -v tests/
"""
import unittest
# ----------------... |
995,721 | 1d4336f387c2030ead17b7dff957b4660cb963ec | # Generated by Django 3.2.8 on 2021-10-31 12:47
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('domain_user', '0005_auto_20211031_1810'),
]
operations = [
migrations.AlterField(
model_name='domain',
n... |
995,722 | 109933b184cd6c89dba07b3483202ff6aec4c360 | '''
Print distance distributions of each trip segment
'''
from sys import argv
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from statsmodels.distributions.empirical_distribution import ECDF
matches_path = argv[1]
result_path = argv[2]
# read and transform
df_matche... |
995,723 | 7ed9fc4f962cfc46881a0d4e07f2366cee6697b6 | import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
colors = plt.cm.cool
def error_sum(pred, y_test):
e = []
for i in range(len(pred)):
e.append((y_test... |
995,724 | e96c34904df19459b317eef2a3f4095e6997924e | from django.urls import path
from django.conf.urls import url, include
from . import views
from . import utils
urlpatterns = [
path('add/', views.add_factoid, name='add_factoid'),
path('random/', utils.random_factoid, name='random_factoid'),
path('user/', views.factoids_list, name='factoids_list'),
pa... |
995,725 | 010a0f6ee066ea8bd101251dedc164b2ab7557fa | from django.shortcuts import render
# Create your views here.
def home_view(request):
return render(request,'testapp/home.html')
def educ_view(request):
return render(request,'testapp/edu.html')
def poli_view(request):
return render(request,'testapp/polit.html')
def sprt_view(request):
return render... |
995,726 | 421cf573786b2c6924a695914f979e0935875829 | from typing import List
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
方法一:使用一个新数组存储交换位置以后的数据,再覆盖原数组
"""
k %= len(nums)
if k == 0: return
new_nums = nums[-k:] + nums[:-k]
for i in range(len(nums)):
nums[i] = new_nums[i]
... |
995,727 | f3c72f955293fd4ca0c48b1a7bf40c9d08e7e37c | from ray import Ray
from vector import Vector
class Camera:
def __init__(self):
self.lowerLeftCorner = Vector(-2.0, -1.0, -1.0)
self.horizontal = Vector(4.0, 0.0, 0.0)
self.vertical = Vector(0.0, 2.0, 0.0)
self.origin = Vector(0.0, 0.0, 0.0)
def getRay(self, u, v):
dir... |
995,728 | e61d3486265d7520a6beebf120b8a0ab16962768 | import numpy
import math
import cmath
def detect_coefficient(X,RATE,FREQ):
s_prev=0
s_prev2=0
norm_freq=FREQ*1./RATE
coeff=math.cos(2*math.pi*norm_freq)
for x in X:
s=x/32768.+2*coeff*s_prev-s_prev2
s_prev2=s_prev
s_prev=s
return s_prev2**2+s_prev**2-2*coeff*s_prev*s_prev... |
995,729 | 8be89f62e69b3c768ebf590c2cc454cc52730b95 | from collections import deque
def rotate(magnetic, direction):
if direction == 1:
tmp = gears[magnetic].pop()
gears[magnetic].appendleft(tmp)
elif direction == -1:
tmp = gears[magnetic].popleft()
gears[magnetic].append(tmp)
def cal(curmag, exmag, flow):
curmagcheck = 6
... |
995,730 | 1f21e0ebd16d9a90a3b49abd9b2bdc67fa8662a0 | from src import Props as props
import random as rng
import numpy as np
def AddProps(system):
wall_angle = 90 + np.rad2deg(-np.arctan(211/1380-0.05))
props.MIT_door(system, [-5, 3.3, 8.22])
props.MIT_door(system, [13.49,3.3, 1.2], wall_angle)
props.MIT_door(system, [14.48, 3.3, -8.5], wall_angle)
... |
995,731 | 269e127f12d5ede1600ee2e470e409c7290a62ed | from google.appengine.ext import ndb
class Note(ndb.Model):
date_created = ndb.DateTimeProperty(auto_now_add=True)
text = ndb.StringProperty()
owner = ndb.StringProperty()
subject = ndb.StringProperty()
title = ndb.StringProperty()
class Song(ndb.Model):
title = ndb.StringProperty()
arti... |
995,732 | 0b7cc39e8150b2c13b86fc1f211569702bf7d50c | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def findDuplicateSubtrees(self, root: Optional[TreeNode]) -> List[Optional[TreeNode]]:
self... |
995,733 | 35e8a302212eb2ffca9c834bc4b1f29bc533e27d | # Unit Testing
def is_equal(a, b):
if a == b:
print('sai')
return True
return False |
995,734 | c752d8e4f6a07713e94dd84b981365caa273462c | from aksdp.data import RawData, DataFrameData
from aksdp.repository import S3FileRepository, LocalFileRepository
import unittest
from pathlib import Path
import os
class TestS3FileRepository(unittest.TestCase):
def setUp(self):
# TODO:このテストを実行するには AWSのアクセスキー・テスト用バケットが必要です
self.access_key_id = os.g... |
995,735 | 3082a426e64091c7c67d7d21a41d3325ab25cf90 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 9 13:11:44 2021
@author: prcohen
"""
import copy
import numpy as np
import numpy.ma as ma
from numpy.random import default_rng
rng = default_rng(1108) # stuff for random sampling; fix random seed
import pandas as pd
import matplotlib.pyplot as... |
995,736 | cbf3cb73451a5869dd073e6990268bcef092d5f7 | def main():
cadena = input()
probar = input()
inversa = cadena[-1::-1]
if (probar==inversa):
print('YES')
else:
print('NO')
main() |
995,737 | 5515b3232f82fbfcea727891052b532f07a2a03a | import itertools
import logging
from typing import List, Dict, Tuple, Optional
import numpy as np
from checkmate.core.dfgraph import DFGraph
from checkmate.core.schedule import OperatorEvaluation, AllocateRegister, DeallocateRegister, Schedule, SchedulerAuxData
from checkmate.core.utils.definitions import active_env_... |
995,738 | 50d20ae0993ead6d3a5400227513a7eae0d7651d | #!/usr/bin/env python
import sys
import math
import json
import tf_conversions
import tf2_geometry_msgs
import rospy
import tf2_ros
import tf.transformations as tf_trans
# from tf.transformations import quaternion_from_euler, euler_from_quaternion, concatenate_matrices, translation_matrix, quaternion_matrix
from geom... |
995,739 | 0610dc5dbcbf1f512f6285bdb1beff7f96cdd032 | """This class performs database queries for the notification_spool table"""
import datetime
__license__ = "GPLv3"
class Notification:
def __init__(self, db, verbose, notification_type, notification_origin, process_id):
"""
Constructor method for the Notification class.
:param db ... |
995,740 | 0b6b362c8d56b4399304d42a9b9ca1d71d3ba473 | from torch import nn
from manopth import rodrigues_layer
from meshreg.datasets.queries import BaseQueries, TransQueries
from meshreg.models import project
from libyana.camutils import project as camproject
class ObjBranch(nn.Module):
def __init__(self, trans_factor=1, scale_factor=1):
"""
Args:
... |
995,741 | 1ead0856c2cb362a6211a787352f0299502c622e | # -*- coding: utf-8 -*-
import os
from datetime import date
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from texting.models import ClientLogo, Client
from texting.forms import ClientForm, OfferF... |
995,742 | 2ed8e2ee99e70d4fb88d5df1c1c6b74a3e7671d3 | # coding: utf-8
import os
import sys
import time
class Solution:
def largestPalindrome_cheat(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1: return 9
if n == 2: return 987
if n == 3: return 123 # 913 993
if n == 4: return 597 # 9901 9999
... |
995,743 | 4a65745b1eeb2c861614426e234903664809beb4 |
import random
import string
def random_string_generator(size=10, chars=string.ascii_lowercase):
return ''.join(random.choice(chars) for _ in range(size))
|
995,744 | f14143967b93928db51a0faea40936ff200f7a47 | import telebot
from telebot import types
from pycoingecko import CoinGeckoAPI
from py_currency_converter import convert
import time
import stockquotes
############## PYPI
#### CRYPTOCURRENCY: pip install pycoingecko
#### FIAT: pip install py-currency-converter
#### STOCKS: pip install stockquotes
bot = telebot.TeleBo... |
995,745 | 39f7e59f584dc4fd50c424039ec3e768d79faec6 | # This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2014-2015, Michigan State University.
# Copyright (C) 2015-2016, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... |
995,746 | 237c61b029e98b65dc2375ed8446f70cb7ac6478 | l=[1,2,3,4,5,6,7,8,9,10]
s=list(filter(lambda x:x%2==0,l))
print(s)
s1=list(filter(lambda x:x%2!=0,l))
print(s1)
"""
output:
-------
[2, 4, 6, 8, 10]
"""
|
995,747 | 3cd1f9d24feeceddb6a8bb5cd623ceaa18263d24 | import platform
import time
import collections
from twisted.internet import reactor,defer, task
from twisted.internet.protocol import Factory, Protocol
from twisted.internet.endpoints import SSL4ClientEndpoint
from twisted.internet.ssl import CertificateOptions
import MumbleControlProtocol
import MumbleVoiceProtocol
... |
995,748 | d1921f642da4fa56bf3879d61ebf5009f854bdd6 | import time
if __name__ == "__main__":
start_indexing_time = time.time()
'''
Insert indexing functionality
'''
end_indexing_time = time.time()
start_retrieval_time = time.time()
'''
Insert retrieval functionality
'''
end_retrieval_time = time.time()
ela... |
995,749 | 44e249876f0bd5aca94dc32337cd2e718f6e302a | from django import forms
from django.core.exceptions import ValidationError
from datetime import date
import requests
import pandas as pd
class Ticker(forms.Form):
ticker = forms.CharField(label='股票代碼', initial='0050')
start_date = forms.DateField(label='開始日期', initial='2020-01-01', widget=forms.DateInput(attr... |
995,750 | b9cf0747c6e106acfd8a31cd3d5dde37effd0820 | import re
brojReg = re.compile(r'(\d{3})-(\d{3}-\d{3})')
recenica = 'Mojot domasen broj e 032-382-941, a mobilniot e 078-357-145'
broevi = brojReg.findall(recenica)
for i, j in broevi:
print(i)
print(j)
print(i + '-' + j)
print()
|
995,751 | 636ade553eb5d21c1b46ce90c58571844b36a19b | # Copyright (c) 2021 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"""Defines a circle."""
import numpy as np
from .base_classes import Shape2D
class Circle(Shape2D):
"""A circle with the given radius.
Args:
radius (floa... |
995,752 | e105f56f1db0cc38e78ebf496285d1686dbd50a7 | from .europian_option_fdm import EuropianOptionImplicitFDM |
995,753 | 6e4186a4bb50d42010dee10eacbc1346eb38dbc7 | # Brianna Atayan - 1632743 - batayan@ucsc.edu
# Colin Maher - 1432169 - csmaher@ucsc.edu
# Lily Nguyen - 1596857 - lnguye78@ucsc.edu
import argparse, pandas, sys, string, numpy, sklearn.metrics, performance_metrics, word_category_counter
from nltk.stem import WordNetLemmatizer
from sklearn.feature_extraction.tex... |
995,754 | 979547a13da14ff3b95f8e90564d25200904e025 | from lxml import etree as ET
# xml.etree.ElementTree as ET does not work,
# as we use components that are only available in lxml
__version__ = '0.1'
METS_NS = "http://www.loc.gov/METS/"
XLIN_NS = "http://www.w3.org/1999/xlink"
mets_nsmap = {
'mets': METS_NS,
}
xlin_nsmap = {
'xlin': XLIN_NS
}
ET.regis... |
995,755 | 6e7401263fed66f6e8a303bc6aa91d99aef08864 | def gcd(x,y):
if x%y!=0:
return gcd(y,x%y)
else:
return y
def GCD(x,y,z):
return gcd(gcd(x,y),z)
ans=0
K=int(input())
for a in range(1,K+1):
for b in range(1,K+1):
for c in range(1,K+1):
ans+=GCD(a,b,c)
print(ans)
|
995,756 | 1bc55bd721211fb233de9c75f9d2366068b9eccd | from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter(trailing_slash=False)
router.register(r'', views.RatingViewSet, basename="rating")
urlpatterns = [
path('map/', views.get_cinema_width, name='get_cinema_width'),
path('map/<int:ci... |
995,757 | 47b05ad94c16cffe21214db567b0d61689fc0611 | '''Advent of Code 2015 day 1: Not Quite Lisp
https://adventofcode.com/2015/day/1'''
def process(instructions):
'''Generate a sequence of (position, floor) for the given instructions.
Start at floor 0; go up a floor for each '(' and down a floor for each ')'
The position counts from 1.
'''
flo... |
995,758 | 25a43870555ef9a46d6ff9d308c3603b4daea152 | # !interpreter [optional-arg]
# -*- coding: utf-8 -*-
# Version
'''
{
Load the numpy array and calculate the features, then split the datasets and save them
including rebuild the joint order
}
{License_info}
'''
# Futures
# […]
# Built-in/Generic Imports
import os
import sys
import json
import numpy as np... |
995,759 | f8581d1f2fe8dbc57613e746407a7d8382cdc428 | ## Exploratory Data Analysis cheat sheet
### Yasith Kariyawasam
## Distribution plots
sns.distplot(tips['total_bill'])
### remove kde layer using
sns.distplot(tips['total_bill'], kde=False)
## Joint Plot
sns.jointplot(x='variable1',y='variable2',data=data,kind='scatter')
## use kind to specify type of jointplot i.e ... |
995,760 | 6e6f8a70b54599012195421d60b15c979f568baa | class Hotel():
def __init__(self, numero_maximo_de_huespedes, lugares_de_estacionamiento):
self.numero_maximo_de_huespedes = numero_maximo_de_huespedes
self.lugares_de_estacionamiento = lugares_de_estacionamiento
self.huespedes = 0
def anadir_huespedes(self, cantidad_huespedes):
... |
995,761 | 387d1be03e42e99191161660ab17565e4ade50c5 | print("Enter number: ")
num=int(input())
list=[]
sum=0
n=len(str(num))
for i in str(num):
list.append(int(i)**n)
for i in list:
sum+=i
print(sum)
if sum==num:
print("Number is an armstrong number")
else:
print("Number is not an armstrong number")
|
995,762 | 078a54e2774e7113b5fea021c8516a1fec7d2794 | ####### TOKENIZER
class Tokenizer(object):
def __init__(self):
self.stoi = {}
self.itos = {}
def __len__(self):
return len(self.stoi)
def fit_on_texts(self, texts):
vocab = set()
for text in texts:
vocab.update(text.split(' '))
vocab = ... |
995,763 | 257250de9f505df4491759ab22bd8634aebf0419 | # all axes tutorial
# This program will:
# clear blocks above 0,0,0
# place floor at 0,0,0
# place walls 100 blocks away in each direction
# place 5 block grid on ceiling
# set the player to 0,0,0
#
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
import mcpi.minecraftstuff as minecraftstuff... |
995,764 | 9442347dbfbc94a12b973e30efc15ee110a4bf8f | import unittest
from urlparse import parse_qs
from django.test.client import Client
from placethings.api.models import Thing
from placethings.settings import DOMAIN, MEDIA_ROOT
class MediaHandlerTest(unittest.TestCase):
def testimage_handler(self):
"""
Verifies that placing anonymously is working
"""
thing... |
995,765 | 6166a7613647ca3a549330c02310203c78a653e2 | from numpy import *
from matplotlib.pyplot import *
# Plot Drake Passage transport and ice shelf melt rates/mass loss for the third
# repetition of the spinup forcing (1992-2005), for both the low-res and
# high-res control simulations.
def timeseries_rep3_compare ():
# Paths to experiment directories
directo... |
995,766 | abdceabf3353032529001d576443cce654fc4e6e | import pandas as pd
dados = list()
pessoa = dict()
mulheres = list()
acima_da_media = list()
tot = 0
while True:
pessoa['nome'] = str(input('Nome: '))
while True:
pessoa['sexo'] = str(input('Sexo: [F/M]: ')).upper()
if pessoa['sexo'] == 'F' or pessoa['sexo'] == 'M':
break
els... |
995,767 | c97949a4d1fdadab4346296f8eacc539a5007e63 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 14 14:08:05 2018
@author: likkhian
"""
import numpy as np
class DecisionTree():
def __init__(self,max_depth=5,min_samples_split=1,debug=False):
self.max_depth = max_depth
self.min_samples_split = min_samples_split
self.debug = debug
#def gi... |
995,768 | 2800320db8ee8ab7b968c0002de83b74b11b2ff2 | list = [12,24,35,24,24,88,120,155,88,120,155]
range = []
for i in list[:]:
flag = 0
for j in range :
if i == j:
flag = 1
if flag == 1 :
continue
else :
range.append(i)
print range
|
995,769 | ab10ec5e900f6a554a1df87bbf5384bd148bb2dc | import sys
graph=[list(map(int,sys.stdin.readline().split()))for _ in range(9)]
xSet=[list([False]*10)for _ in range(9)]
ySet=[list([False]*10)for _ in range(9)]
box=[list([False]*10) for _ in range(9)]
dia=[[i//3*3+j//3 for j in range(9)]for i in range(9)]
spot=[]
for i in range(9):
for j in range(9):
if g... |
995,770 | d6d2e58f1b2c78039f63ddecea46031c85e39e6a | # coding: utf-8
import dataclasses
import typing
import serpyco
from guilang.description import Description
from guilang.description import Part
from rolling.action.base import WithResourceAction
from rolling.action.base import WithStuffAction
from rolling.action.base import get_with_resource_action_url
from rolling.... |
995,771 | 0ad8aadb90234f727d2ef25260ad9d57d0d1b476 | #!/usr/bin/python
#Python implementation of Shamir's Secret Sharing using the BGW protocol
#Author: Patrick Crain
#BGW reference: http://cseweb.ucsd.edu/classes/fa02/cse208/lec12.html
import sys, os, random, json, time, shutil
from random import shuffle
from mpmath import * #mpmath for arbitrary float precision
mp.dps... |
995,772 | 497fda2bad9f3a7cf7fceaf8df87a97c2c5dd50d | # ChoiceModels
# See full license in LICENSE
from .mergedchoicetable import *
from .simulation import * |
995,773 | 80f6b00c7d668b217322e813281da57ebcaeee61 | #!/usr/bin/env python
import rospy
import math
import tf
if __name__=='__main__':
rospy.init_node('frame_a_frame_b_listener_node')
listener = tf.TransformListener()
rate = rospy.Rate(1.0)
listener.waitForTransform('/frame_a','/frame_b',rospy.Time(),rospy.Duration(4.0))
while (not rospy.is_shutdo... |
995,774 | dd95f280a37c2535619154229fe5115da5901e12 | import pytest
from typing import List, Tuple, Optional, Union
from block import Block
from blocky import _block_to_squares
from goal import BlobGoal, PerimeterGoal, _flatten, generate_goals, Goal
from player import _is_move_valid, _get_block, create_players, Player, SmartPlayer, RandomPlayer, HumanPlayer
from renderer ... |
995,775 | fd752c43d4ddd02d1b6672ebbbbc9563c3e0f7db | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 17:21:41 2019
@author: up201808912
"""
import math
def f(x):
return (2*x+1)**2-5*math.cos(10*x)
def regra_aurea_min(x1,x2,intervalo):
B=(math.sqrt(5)-1)/2
A=B**2
while abs(x2-x1)>intervalo:
x3=x1+A*(x2-x1)
x4=x1+B... |
995,776 | e63511f23cdfb43935c61ae83983fbfbfc392764 | from django.shortcuts import render
# Create your views here.
from django.shortcuts import HttpResponse
from fantasy.models import Character
def add(request):
a = request.GET['a']
b = request.GET['b']
c = int(a) + int(b)
return HttpResponse(str(c))
def add2(request, a, b):
c = int(a) + int(b)
... |
995,777 | a5eadbb16815bd14141645f951b301e2a1563e07 | import random
class Search:
"""Analyze board for best positions to play."""
def __init__(self, args=()):
self.key_values = []
self.most_valuable = []
def strategy(self, game, args=()):
"""Return open key for player to play in game."""
def evaluate(self, board):
"""Set... |
995,778 | de8f0b9a44dd7af2f4b749ecd729f3aa7793a29a | import matplotlib.pyplot as plt
from Table import *
from MathO import *
class Main(object):
fig = plt.figure( 1 )
plt.xlabel("Значения X")
plt.ylabel("плотность распределения p*")
plt.title("Гистограмма плотности функции распределения")
plt.bar( Math1.otr,Math1.p, align='center', width=0.1, color =... |
995,779 | d8274ed2b5bc2cdb27e4fa8c0bbe635746c05957 | # Generated by Django 3.2.6 on 2021-08-12 16:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0006_remove_todo_ordre'),
]
operations = [
migrations.AddField(
model_name='todo',
name='couleur',
... |
995,780 | 3a6bd01495f1cab1cc7662131d7d6fe98b724a9b | import os
import glob
import imageio
from config import NTH_SAVE, GPU
if __name__ == '__main__':
print('Createing GIF ...')
training_img_dir = 'training_images'
num_training_images = len([name for name in os.listdir(training_img_dir)])
output_name = 'MNIST_VAE_Training_{}_epochs.gif'.format(
... |
995,781 | b9051ce3a6486928c43dfdf328b7188eb6b965fb | #!/Users/tmcfarlane/pyProjects/3_6_1/BucketListApp/venv/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
995,782 | dd4b79c8d43ea1486e2af05c42dbb38369a94be7 | from classification_contract.wine_test_data.utilities import get_classified_wine
import json
from classification_contract.messages import create_create_message, create_delete_message, read_all_messages
from nose.tools import assert_equals, assert_dict_equal
@given(u'I have a classified wine')
def step_impl(context):
... |
995,783 | acb131373553a5831285a4822232a739860afadd | #!/usr/bin/python
import os
import sys
def deduparg(arg):
if arg.startswith("@"): return True
if arg.startswith("-fsanitize="): return True
if arg.startswith("-Wl,-plugin-opt="): return True
if arg.startswith("-Wl,-l:") and arg.endswith(".a"): return True
if arg == "-Wl,-whole-archive,-l:libmetadata.a,-no-whole-... |
995,784 | 3a2928da2b495c3c52e99911e9beec94fca5fcef | """
dev2 api schema
'dev2.baidu.com' api schema # noqa: E501
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import baiduads
from baiduads.dpacreative.model.format_template_type import FormatTemplateType
globals()['FormatTemplateType'] = FormatTemplateType
from baiduads.dpacrea... |
995,785 | 05d727f16fee28eba0c1e5ff2106ae12b3afcfe7 | # Write a python function that takes a sequence of numbers and determines if all the numbers are different from each other(that is they are distinct)
def distinct(n):
num = set()
for i in n:
if i in num:
return "Numbers are not unique."
else:
num.add(i)
retu... |
995,786 | 3315dcb9cd32ce82dd82885db9fbf20abbdc44bc | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 11 18:08:22 2020
@author: ANA
"""
def w(x,y):
return -1.1*x*y + 12*y + 7*x*x - 8*x
def dwx(x,y):
return -1.1*y + 14*x - 8
def dwy(x,y):
return -1.1*x + 12
def gradiente(x, y, h, numItr):
xn = 0
yn = 0
for i in range(numItr):
xn = x - ... |
995,787 | 64cc0cd5fc6d57247138ec19cd97486a303578cf | # this program defines a method that finds the max of three entered value
def MaxOfThree(x, y, z):
Max = x
if y > Max:
Max = y
if z > Max:
Max = z
return Max
x = raw_input('Enter first value: ')
y = raw_input('Enter Second value: ')
z = raw_input('Enter third value: ')
try:
a=f... |
995,788 | 4711f29046e342d5d51b8f266643379e041c7f11 | # -*- coding: utf-8 -*-
import os, sys, subprocess, platform, socket
try:
from discord_webhook import DiscordWebhook, DiscordEmbed
except ImportError:
if sys.version_info[0] == 2:
os.system('pip install discord_webhook')
else:
os.system('pip3 install discord_webhook')
from discord_web... |
995,789 | a7370a6259cbec0b236bbc89cef7086898838aa9 | '''
Script for retrieving the list of ICPE documents
'''
import os
import random
from typing import List
from urllib.request import HTTPError, urlretrieve # type: ignore
from envinorma.models.document import Document, DocumentType
from tqdm import tqdm
from tasks.data_build.filenames import CQUEST_URL, DOCUMENTS_FOL... |
995,790 | cbdde0ea3727bbdf1857cfdd8710659b7f82eb07 | class BaseHandler(object):
test2_field = 'test2'
|
995,791 | eed0924cd76249e2cc4dbf9b21b586267443b0f2 | import kin
# each motor is given the positional id ab, with a the leg number (0 being the one closest to the power plug),
# and b among 0, 1, 2 in proximo distal order.
# that define the global order or motors, as the numerical one.
pos_name = set(['position', 'goal_position', 'cw_angle_limit', 'ccw_angle_limit', 'pr... |
995,792 | ad78cb6253bacde847a20215a303b38cc642e8ad | import nuke
import nukescripts
import re
class MassivePanel(nukescripts.PythonPanel):
def __init__(self):
nukescripts.PythonPanel.__init__(self, 'MassivePanel', 'com.ohufx.MassivePanel')
############# setting help messages
KnobInfo = " type knob's name in, also you can Ctrl+Drag&Drop from the ... |
995,793 | 40df77949435401eeeae7c6a2c599e5204fa24aa | from app import app
from flask import render_template, request, redirect, flash, url_for, Markup, g, send_from_directory, abort, Response
from app.helpers import allowed_file, writeTex, deleteImgUpload, deletePdf
from werkzeug.utils import secure_filename
from werkzeug.exceptions import default_exceptions, HTTPExceptio... |
995,794 | 854cf836c72fe5c848c0ebd385a880563953a4af | '''
instalacja lepszego interpretera, lpesze wyswietlanie itp.
# pip install ipython
'''
napis = "Ala ma kota"
print(napis[2])
print(napis[4])
print (napis[0:4])
print (napis[::2])
print (napis[-1])
# for litera in napis:
# print(litera)
# print(litera)
ala=('A', 'l', 'a', ' ', 'm' 'a')
print (ala[0:5]... |
995,795 | 5107e820b41cbee675dffcd0f0d6b9210c64c00a | class BTNode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
# 1. Find the root (First element in the preorder_list)
# 2. Find the left and right subtree (from inorder list via root node)
# 3.
def BTbuildInorderPostorder(inorder, postorder):
if len(postorder) == 0:
return ... |
995,796 | 9ff3e847c4b6355a875ae6e02376a0768c06cf41 | import pygame
import time
import random
pygame.init()
white = (255,255,255)
black = (0,0,0)
red = (255,0,0)
green = (0,155,0 )
display_width = 800
display_height = 600
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('Snake')
clock = pygame.time.Clock()
block_size... |
995,797 | 563a8009f7288ae154ce8e4020bcb99b74692ea0 | """this script is used to perform operations on the the speech to text api. the operations are such as
(1) adding a custom model....
this is done using the listener.speech_to_text.create_custom_models().
(2) list the custom models created for the speech to text service.
(3) delete and update models and corpora.
... |
995,798 | 9e0591c43f6bc74ee2ce7d7c830b33f27ba01d9f | # Xander Kehoe
import time
maleValues = [1375, 2047, 2233, 2559, 3265]
femaleValues = [945, 2479, 3007, 3398, 4415]
def drawLine(t, x1, y1, x2, y2, colorP="black"): # Basic method to draw lines
t.up()
t.goto(x1, y1)
t.down()
t.pencolor(colorP)
t.goto(x2, y2)
def drawLineWithDots(t... |
995,799 | c920062cf8850d9e0775f2c00d15fa6e7b959d5b | def ex3(x):
'''
function which break down the number into prime numbers, and return max element with list
:param x: the number we break down into prime numbers
:return: max prime numbers
'''
prime_factors = []
i = 2
while x != 1:
while x % i == 0:
prime_factors.append... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.