index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
984,300 | 0aedaf487978da49e0731b252f73982bad7ce8a0 |
import pandas as pd
import csv
def EstaCiudad(ruta_archivo:str,Ciudad : str):
suma= ruta_archivo[ruta_archivo["Codigo_Ciudad"]==Ciudad]['Habitantes'].sort_values().sum()
codigo = ruta_archivo['Codigo_Ciudad']
habitantes = ruta_archivo['Habitantes']
diccionario = dict()
diccionario[Ciudad] = suma
... |
984,301 | 337c64eb50d17f7e6e5a252f66efe04642d81661 | ###########################################################
# Computer Project #6
#
# Algorithm
# Call a function to prompt for file names until they open properly
# Call a function to adds data from all files to total_dict
# Call a function to get wanted data from the full dicti... |
984,302 | 79ec2e51034da52dd2db5d98c350da8de246e4b3 | import cv2
import numpy as np
class Postprocess(object):
def __init__(self):
self.h_samples = [160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260,
270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420,
430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 5... |
984,303 | 876e3a718544cba7397a243ef7a680df58ddaec3 | #importing modules
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
#dummy data
n_samples = 200
X = np.random.normal(size=n_samples)
y = (X > 0).astype(np.float)
X[X > 0] *= 4
X += .3 * np.random.normal(size=n_samples)
X = X[:, np.newaxis]
# run the classifier
clf = li... |
984,304 | 4280790e43528be0c4e68983ec9b0a12bc1c7d81 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 1 17:32:55 2017
@author: Atlas
"""
def genPrimes():
next = 2
primes = []
while True:
is_prime = True
for i in range(len(primes)):
if next % primes[i] == 0:
is_prime = False
break
if is_... |
984,305 | 9ce272665b19cb7a732cf7359c3e59be6b2e48fb | /home/ayush/Desktop/auquan/anaconda2/lib/python2.7/sre.py |
984,306 | b891b53005187d2528bce1900e81694db2456ef4 | import unittest
import utils
class SignsTest(unittest.TestCase):
def setUp(self):
self.html = """
<html><body>
<main>
<section></section>
<section></section>
<section>
<div><div><div>
<div></div>
<div>
<p><span>12345</span></p... |
984,307 | f75d5c4cea37f8a9a83d60f4b3931617c5f110cb | import csv
data = [("One", 1, 1.5), ("Two", 2, 8.0)]
f = open("out.csv", "w")
wrtr = csv.writer(f)
wrtr.writerows(data)
f.close()
|
984,308 | 6b184528fd3a243577bbb0ba3ecbd34a95d85b79 | from application import spark_dataframe
from pyspark.sql import functions as f
import ast
class PySparkFilter:
spark_df = spark_dataframe
average_rating = spark_df.select(f.avg("average_rating")).collect()[0][0]
average_rating_2dp = float(f"{average_rating:.2f}")
@staticmethod
def get_average_rat... |
984,309 | 9f5465bc5bd15b1a734202dfea4ac819e02dbaf6 | from constraint_api import *
from test_problems import get_pokemon_problem
#### PART 1: WRITE A DEPTH-FIRST SEARCH CONSTRAINT SOLVER
def has_empty_domains(csp) :
"Returns True if the problem has one or more empty domains, otherwise False"
#raise NotImplementedError
for var in csp.variables:
if len... |
984,310 | 4610d425787b7eff827726b8877c3a1ed6db4631 | from operators.facts_calculator import FactsCalculatorOperator
from operators.has_rows import HasRowsOperator
from operators.s3_to_redshift import S3ToRedshiftOperator
__all__ = [
'FactsCalculatorOperator',
'HasRowsOperator',
'S3ToRedshiftOperator'
]
|
984,311 | 6f4312771e7149e4c4a9bbe783c94b449f7ad729 | for i in range(int(raw_input())):
n1 = int(raw_input())
arr = map(int, raw_input().split())
n2 = int(raw_input())
arr1 = map(int, raw_input().split())
try:
n1 = arr.index(n1)
n2 = arr1.index(n2)
except ValueError:
n1 = ''
n2 = ''
if n1 != '' and n2 != '':
print 'Yes'
else:
print 'No'
|
984,312 | 52ac5d2c5f6c5b413a98a1187a3cc2e5d1204f5f | #encoding:utf-8
from django.db import models
import datetime
CHOICES_TIPO_PREGUNTA = ((0,"Seleccion Multiple"),(1, "Pregunta Abiertas"),(1, "Pregunta Reflexivas"),(1, "Pregunta Cerradas"),(1, "Pregunta Verdadero - Falso"),(1, "Pregunta Abiertas"))
CHOICES_TIPO_USUARIO = ((0,"Psicologo"),(1, "Estudiante"))
Contacto =... |
984,313 | 9771f08b07549eaae1ed47e400efad008fe10504 |
# l=("apple","mango","grapes","banana","kiwi")
# print(l)
# l.append("papaya")
# l.append("lichi")
# l1=[1,2,3,4]
# l.extend(l1)
# l.insert(0,"watermelon")
# print(l)
# l.remove(l[2])
# l.pop()
# print(l)
# print(l[2:5])
# print(len(l))
# l={"apple","mango","grapes","banana","kiwi"}
l={1,3,5,6,7,3,5}
print(l)
s={1,2,... |
984,314 | cf16fa70d0bde21691bdfb68229b3a6e3343b671 | from ui import UI
from ui.low.find import Find
__author__ = 'John Underwood'
class PhysicalAddress(UI):
"""
Adds a new physical address for a provider.
Values are preset using our VISTA physical address.
May override the address description, addressType, address1, address2,
city, state, zipCode, ... |
984,315 | bdc3c536ef0413521b7326c02947cd8564dd32bd | from __future__ import print_function
import time
from panda import Panda
from nose.tools import assert_equal, assert_less, assert_greater
from helpers import time_many_sends, test_two_panda, panda_color_to_serial
@test_two_panda
@panda_color_to_serial
def test_send_recv(serial_sender=None, serial_reciever=None):
p_... |
984,316 | 373fb00de9f54bdaa8e01d42c0b82c14dbcec912 | #!/usr/bin/env python3
import numpy as np
from imutils.video import WebcamVideoStream
import cv2, time, threading, math
from flask import Flask, render_template, Response
cap = WebcamVideoStream(src=0).start()
frame = cap.read()
app = Flask(__name__)
def image2jpeg(image):
ret, jpeg = cv2.imencode('.jpg', image)... |
984,317 | af66f2d2a4b7474ccef0e8f62f779cdddfc371b6 | """
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import openapi_client
from openapi_client.model.net_corda_c... |
984,318 | 5b1fa48e45c152e150cd89be0fcfb8eaa3c78e60 | # -*- coding: utf-8 -*-
# Author: yohannxu
# Email: yuhannxu@gmail.com
# CreateTime: 2020-03-05 15:01:30
# Description: COCO格式数据集
import bisect
import itertools
import json
import math
import os
from glob import glob
import torch
from easydict import EasyDict
from PIL import Image
from pycocotools.coco import COCO
fr... |
984,319 | 96fca447a6494efafdf3238eb9d074f8a1547cd5 | #자주쓰는 빈출 내장함수
#내가 만들고자 하는 프로그램이 이미 만들어져 있는지 보는게 중요하다.
#연습이 아닌이상 또 만드는건 불필요한 일이다.
#이미 만들어진 프로그램들은 테스트 과정을 수도 없이 많은 테스트과정을 거쳐서 검증되어있다.(특히, 파이썬 배포본)
#함수를 외우지는 못해도 그런함수가 있는지를 알면 나중에 찾아서 보면 된다. 혹은 이런 모듈에다가 다 모아두면 찾아보기 쉽다.
num = -3
print(abs(num))
print(all([1,2,3,4])) #true
print(all([1,2,3,4,0])) #false
pr... |
984,320 | 8139e5fdf67c4f01508a2c07799a37a1f1d7154a | from sys import argv
import re
# second argument is the original promoter file
with open(argv[2], 'r') as promoter_file:
names = [line.strip().split('>')[1] for line in promoter_file if ">" in line]
names_dict = dict((name[0:24], number) for number, name in enumerate(names))
input_file = open(argv[1], 'r').read()
... |
984,321 | 068146ba65b358e63037afe883ce1258875495b3 | import sys, time, RPi.GPIO as GPIO
seq0 = [ [1,0,0,0],
[1,1,0,0],
[0,1,0,0],
[0,1,1,0],
[0,0,1,0],
[0,0,1,1],
[0,0,0,1],
[1,0,0,1] ]
seq = [seq0, sorted(seq0)]
def rotate(num, ControlPin):
# num is the direction of rotation
if num !=0 and num !=... |
984,322 | 27edfb2ce6e594fb0e6484978733dff13c499a41 | from SPARQLWrapper import SPARQLWrapper
sparql = SPARQLWrapper("http://206.167.181.124:7200/repositories/era-dd")
ignore = [
"http://projecthydra.org/ns/auth/acl#",
"http://fedora.info/definitions/v4/repository#",
"http://www.iana.org/assignments/media-types/",
"info:fedora/fedora-system:def/model#",
"info:fedo... |
984,323 | 55da58b9f812846bf02be263d4ece4fd04fcbecd | from pandas import read_csv, DataFrame, concat, Series
import attr
import os
from json import load
from numpy import log10, isfinite, any, all, quantile, nan, isnan
from numbers import Number
tissues = ['Brain', 'Muscle', 'Liver']
polarities = ['positive','negative']
@attr.s(auto_attribs=True)
class AstyanaxLi:
l... |
984,324 | 44ac0cf1ac1d5af3a6865c64cf2761eb04945f3d | class Solution(object):
def wiggleSort(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
i, n = 1, len(nums)
flag = False
while i < n:
if not flag and nums[i - 1] > nums[i]:
... |
984,325 | 010b1314af56e802f140463046e3cd26b9fa6252 | #!/usr/bin/env python
# See Fig3-4.ipynb for details.
# Whyjay Zheng
# File created Oct 21, 2021
# Last modified Feb 22, 2022
import pejzero
import rasterio
from netCDF4 import Dataset
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from pathlib import Path
import sys
import os
glacier_file = s... |
984,326 | ec7541f18335fa5fff8a0b19ffda4ab98ec7709b | import platform
import usb.core
import usb.util
import struct
from Monsoon import Operations as op
from copy import deepcopy
import numpy as np
import array
DEVICE = None
DEVICE_TYPE = None
epBulkWriter = None
epBulkReader = None
VID = '0x2ab9'
PID = '0xffff'
class bootloaderMonsoon(object):
def __init__(self,*ar... |
984,327 | 1e4475319372784930d39641434e895f63760c93 | # encoding: utf-8
"""
@author: xingyu liao
@contact: sherlockliao01@gmail.com
"""
import json
import logging
import os
from fastreid.data.build import _root
from fastreid.data.build import build_reid_train_loader, build_reid_test_loader
from fastreid.data.datasets import DATASET_REGISTRY
from fastreid.data.transform... |
984,328 | 473ad6c5526cb0962f023b0a5cb13eb5308f8927 | from collections import deque
class GamePlan(object):
"""
initialise the tournament object with an overall list of players and the system definition (swiss or robin)
input:
a list of players
output:
a list (len = number of rounds) of lists of tuples
with players' names (maybe change to IDs from db) in white, black... |
984,329 | ba8b71a55c689c54b9653ba62c5ced9ad8ee6e41 | import numpy as np
import math
import argparse
import scipy.ndimage
from imageio import imread
from numpy.ma.core import exp
from scipy.constants.constants import pi
from skimage.measure import compare_ssim #skimage version 0.16
from skimage.measure import compare_psnr #skimage version 0.16
def get_args():
parse... |
984,330 | 9d4286f51f796ee07f9c9689d5e16a93c185dad9 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... |
984,331 | f79856f601f3e5c151d58b19f299dd776fe7cc84 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
# In[2]:
datos = ['1.1', 'Python', '0.5', 'pandas', '2.8']
serie = pd.Series(datos)
serie
# In[5]:
serie = pd.Series(serie).sort_values()
# In[6]:
serie
# In[ ]:
|
984,332 | c93e88878f50cb9e75033216b43fbb17eaa24ffb | import cv2
import numpy
from vidutils import _vid_capture
PRIMARY_CAMERA = 0
def processing(source=None):
# use the webcam if no source input.
if source is None:
source = PRIMARY_CAMERA
# background subtractor
fgbg = cv2.BackgroundSubtractorMOG2()
# pos_x = 0
# pos_y = 0
# fixed_... |
984,333 | 9df51665e97afd874a077b04bd161a243d913dbc | # -*- coding: utf-8 -*-
L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
]
# 打印Apple:
print(L[0][0])
# 打印Python:
print(L[1][1])
# 打印Lisa:
print(L[2][2])
height = float(input('请输入您的身高:'))
weight = float(input('请输入您的体重:'))
bmi = weight / height**2
print(bm... |
984,334 | 583b2e7d3c242200fe708ffc00a1908c24428953 | # Low Level DXF modules
# Copyright (c) 2011-2022, Manfred Moitzi
# License: MIT License
|
984,335 | 60a70b738fc172aa5698e5770559ae705305f1ee | import visa,time,string
import random
class device:
def __init__(self,add="GPIB0::14"):
self.device=visa.instrument(add)
self.tauset={
0 : "10mus",
1 : "30mus",
2 : "100mus",
3 : "300mus",
4 : "1ms",
5 ... |
984,336 | da9b001fbd0a7ccd71e25b7c9936a79ce4996f86 | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Blueprint of the /countries route.
This route will be registered in `server.py`.
'''
import os
import flask
import app.utilities.load as Load
from rq import Queue
from redis import Redis
from app.classes.ckan import CKAN
from app.functions.manage_queue import getStatus
f... |
984,337 | e9149656b423a3ea9650ad5ad8eb2df3ae8a41b6 | from pytools import testutil
import sys
import basecase
class calcphotCase1(basecase.calcphotCase):
def setUp(self):
self.obsmode="acs,hrc,coron,fr388n#3880"
self.spectrum="rn(unit(1.0,flam),band(johnson,v),15,vegamag)"
self.subset=True
self.etcid="ACS.MISC.1.IMAG.029"
self.s... |
984,338 | 9fa46aca34208385241bf061501da38204eb5e15 |
log = logging.getLogger(__name__)
|
984,339 | 43ba5409a651a3d9ceffbe57978a72707dc29445 | # Madeleine Nightengale-Luhan
# CSCI 101 - Section A
# Python Lab 1B
# References: No One
# Time: 30 Minutes
F0 = 0
F1 = 1
F2 = F0 + F1
F3 = F1 + F2
F4 = F2 + F3
F5 = F3 + F4
F6 = F4 + F5
F7 = F5 + F6
F8 = F6 + F7
F9 = F7 + F8
print('F0 = ', F0)
print('F1 = ', F1)
print('F2 = ', F2)
print('F3 = ', F3)
print('F4 = ', ... |
984,340 | a8826aae88da4ae11fea85aec93570fc819f1e46 | # coding: utf-8
from django.db.migrations.autodetector import MigrationAutodetector
from operation import PartitionOperation
def generate_altered_db_table_new(self):
self.generate_altered_db_table_orig()
self.generate_altered_partition()
def generate_altered_partition(self):
option_name = PartitionOpe... |
984,341 | bf9705106dd7dca9b5359997a338c3ec49fc6fdb | from . import message_wizard
from . import wizard_assign_mail |
984,342 | 1b988b458f303c3d0ecc2edf59e0ec1e61304e4c |
class Space:
def __init__(self, entity):
self.type = type
self.entity = entity
def setSpace(self, entity):
self.entity = entity
def setFighter(self, fighter):
self.fighter = fighter
class Field:
def __init__(self, xSize, ySize):
self.xSize = xSize
se... |
984,343 | e15d977735c1cb758d61539acc428bbb4d23641f | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-04-12 19:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depend... |
984,344 | c57d31128bcd9699553af7007fb9b9ce59473119 | #!/usr/bin/env python3
import json
#write function readcurrency(filename)
# read file
#Create a dictionary
def readcurrency(filename):
with open(filename) as f:
data = []
list_data= []
dict_data ={}
for line in f:
# print(line, end='')
list_line = line.str... |
984,345 | e938b0d5bd5aac636117de8f4f21f4bba16c5835 | # best test
# type "python hw2_best_test.py {X_test} {hw2_best.csv}" to execute
import sys
import time
import csv
import warnings
import numpy as np
import pandas as pd
from sklearn.externals import joblib
# =============================
warnings.filterwarnings('ignore')
# ===========================... |
984,346 | 867f799ad31bcdc40b1159fe6d014f8dbf0526ba | #!/usr/bin/env python
'''
Command line tool(s) for Strava.
'''
# 2017-07-29 - Shaun L. Cloherty <s.cloherty@ieee.org>
import os, getpass, sys, time, random, webbrowser;
from datetime import datetime;
from argparse import ArgumentParser;
import argparse;
from backend import client, app; # strava-tools backend
impo... |
984,347 | 5ffb4008147b2282c1df65ff5dc7113568d37369 | BENCHMARK_NAMES = [
"resnet",
"ssd",
"maskrcnn",
"transformer",
"gnmt",
"ncf",
"minigo"
]
SUBM_META_PROPS = [
"org",
"poc_email"
]
ENTRY_META_PROPS = [
"division",
"status",
"hardware",
"framework",
"power",
"notes",
"interconnect",
"nodes",
"os",
... |
984,348 | 1df42db95ffef83824f9f901457733de4caeeded | def countRange(lst, minimum, maximum):
cnt = 0
for i in lst:
if minimum <= i <= maximum:
cnt += 1
return cnt
def main():
lst = list(map(int, input('Enter the numbers(a b c...): ').split()))
minimum = int(input('Enter the minimum value: '))
maximum = int(input('Enter the m... |
984,349 | 7fecefa9eaead1b016e8ce83da2161853348fab3 | '''
Created on Aug 2, 2019
@author: Faizan-Uni
'''
import os
import h5py
import numpy as np
import matplotlib.pyplot as plt
from adjustText import adjust_text
from matplotlib.lines import Line2D
import matplotlib.colors as mpl_clrs
from scipy.interpolate import interp1d
from ..models import (
g... |
984,350 | 197c612125b71f6f2c87f20af571c6431409b8d4 | from unittest.mock import Mock
from . import responses
from buycoins import Query
from buycoins.utils import allowed_currencies
class TestQueries:
Query = Mock()
def test_get_balances(self):
self.Query.get_balances.return_value = responses.get_balances
balances = self.Query.get_balances()
... |
984,351 | c82d3d9774b14ab45521da9a2e4262bcea094fb4 | import numpy as np
import math
def Lstability(npstar1x,npstar2x,mass0):
npstar1pos=npstar1x[:,0:3]
npstar1v=npstar1x[:,3:]
npstar2pos=npstar2x[:,0:3]
npstar2v=npstar2x[:,3:]
npstar1L=mass0*np.cross(npstar1v,npstar1pos-npstar2pos)
deltaL=np.abs((np.max(npstar1L[:,2])-np.min(npstar1L[:,2]))/np.me... |
984,352 | 2a301de90bba2f07086494d89bba478d56352ea0 | import os
import math
import numpy as np
import tensorflow as tf
from vgg16 import Vgg16
from concept import Concept
import pdb
class Teacher:
def __init__(self, sess, rl_gamma, boltzman_beta,
belief_var_1d, num_distractors, attributes_size,
message_space_size, img_length):
self.sess = sess
self.num_di... |
984,353 | abd5b9d46f8644b2e4669c7df1d6765b049c76b0 | N,M = list(map(int, input().split()))
if M == 0:
print(N);
exit()
xy = [map(int, input().split())
for _ in range(M)]
A, B = [list(i) for i in zip(*xy)]
dic = {}
for i in range(len(A)):
A[i] -= 1
B[i] -= 1
if A[i] not in dic:
dic[A[i]] = [B[i]]
else:
dic[A[i]].append(B[i])
def dfs(stt: int,... |
984,354 | 7f8521f919415c45971e1a4fa51f2131f9ffa220 | from django.shortcuts import render, HttpResponse, redirect
from .models import Team, User_Team
from django.contrib import messages
def success(request):
context = {
"teams": Team.objects.all(),
"your_team" Teams.objects.filter(),
}
return render(request, 'team_app/success.html', context)
... |
984,355 | 2c6f2d46b0ac0c0c312bed4c048075f2f3d9e188 | #!/usr/bin/env python
import math
import psycopg2
import random
import sys
from tournament import connect, \
playerStandings, \
registerPlayer, \
reportMatch, \
swissPairings
from util.logger import logger
def create_db():
... |
984,356 | 4a2d676fd93064a70aa5b58449270664b36ed164 | from RVObject import RVObject
import xml.etree.ElementTree as xmltree
class NSNumber(RVObject):
def __init__(self, xmlelement=None):
self.hint = "float"
self.value = 0
if xmlelement is None:
return
self.deserializexml(xmlelement)
def deserializexml(self, xmlelem... |
984,357 | 27b9d02be31131ad6f46893e04440263f85c3cdf | import smbus
import RPi.GPIO as GPIO
class I2cRelay(object):
def __init__(self, dev_addr, slave_addr):
self._dev_addr = dev_addr
self._slave_addr = slave_addr
# BUS
self._bus = smbus.SMBus(1)
def open(self):
self._bus.write_byte_data(self._dev_addr, self._slave_addr, ... |
984,358 | 1ac974ff6619b3f0e4ec41972ed7fe7cdf9658cc | import os;
'''
更换文字
'''
# with open('''/Users/fuzhipeng/blog/source/_posts/uptest.md''',"r") as f:
# content=f.readlines()
#
# with open('''/Users/fuzhipeng/blog/source/_posts/uptest.md''',"w") as f:
# for line in content:
# f.writelines(line.replace("test","test_"))
cdClean='''hexo c'''
cdGenerate='... |
984,359 | 2ffec30f96104d3b327bf039bcec7768f8ce754e | from aw import build_app
debug = True
app = build_app()
app.run(debug=debug)
|
984,360 | 6de6eb9043f6288c912b1121cd0cccce71b36b4e |
def nextPrime(n) :
while(True):
n +=1
for j in range(2,n,1) :
if n%j==0:
break
else :
return n
x = int(input(('Enter number for next prime\n')))
print(nextPrime(x))
|
984,361 | 8d94997e803a7f0077b17de94208c3f55579c0d7 | class Solution:
"""
@param A: an integer sorted array
@param target: an integer to be inserted
@return: An integer
"""
def searchInsert(self, A, target):
if len(A) == 0:
return 0
elif len(A) > 0:
leftIndex = 0
rightIndex = len(A) - 1
... |
984,362 | f970baeb1b67e54e34b9e9dc33af3e6129a6d64d | from Ship import Ship
class Flota():
def __init__(self):
self.ship_list = []
self.backup_list = []
def load_flota_file(self, file_name):
"""
:param file_name: file where flota is
:return: ship list with all ships from fille
"""
everything_from_file = ... |
984,363 | 12c500873882e3659680dec5e6e991d72f33a805 | import numpy as np
import matplotlib.pyplot as plt
#Ejercicio 1
nu=np.random.uniform(-10,10,1000)
plt.hist(nu, label="datos uniformes")
plt.title("Valores uniformes")
plt.ylabel("")
plt.xlabel("")
plt.legend()
plt.savefig("uniforme.pdf")
centro=17
sigma=5
ng=np.random.normal(centro,sigma,1000)
plt.hist(ng, label="... |
984,364 | 962025df2abf3deea6e50e105e28bc7a58b44765 | #libraries
from Xception_Model import Xception_Model
from PreProcessing import PreProcessing
from keras.models import model_from_json
if __name__ == '__main__':
# Directory path for images
Base_directory = '/kaggle/input/flame-dataset-fire-classification'
test_path = 'Test/Test'
Training_path = 'Trai... |
984,365 | c164c1a3668071d80c688be93409b6c9712d4a68 | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... |
984,366 | 42d40635e4ddbb4fbc5ad51aac0611173c8568e4 | from django.db.models import Avg
from api.v1.match_player_stat.models import MatchPlayerStat
from api.v1.player.models import Player
class PlayerUtil:
@staticmethod
def filter_from_percentile(player_queryset, percentile):
# get all team player average values
pl_avg_list = []
avg_scor... |
984,367 | a464b5236d18c8477b193a3f1aeddf949e72227d | # Accessing the list using index
books = ["Learn Python the hard way", "Web Application Pentesting", "The Art of Exploitation"]
print("First Book is : {}".format(books[0]))
print("Second Book is : {}".format(books[1]))
print("Third Book is : {}".format(books[2])) |
984,368 | b26461e980ba6f99a8c0963b3345a69ddee07ed8 | # encoding: utf-8
import os
import shutil
FPATH = os.path.dirname(os.path.realpath(__file__))
MOCKUPS_PATH = FPATH + '/mockups'
def clear_mockups_out():
shutil.rmtree(MOCKUPS_PATH + '/out')
def remove_if_exists(fpath):
if os.path.exists(fpath):
os.remove(fpath) |
984,369 | 8b629bbecd06e90e684aa156b9cfa31a18ce8635 | class Solution(object):
def maxCoins(self, piles):
"""
:type piles: List[int]
:rtype: int
"""
piles=sorted(piles)
piles=piles[::-1]
tot=0
c=(len(piles)/3)
i=1
while (i<len(piles)) and (c>0):
... |
984,370 | a40775df6a91647c4829e16a7c19008e0ca5fb1a | n = int(input())
l = []
while n != 1:
l.append(n)
if n%2 == 0: n = n // 2
else: n = 3*n + 1
l.append(n)
print('->'.join([str(i) for i in l[-15:]])) |
984,371 | e2ed61d420e5d30e5597f86604e95ebd96ca6cbf | """En tu programa pide al usuario ingresar 3 números: un límite inferior,
un límite superior y uno de comparación.
Si tu número de comparación se encuentra en el rango de los dos límites, imprímelo en pantalla.
En caso de estar por debajo del inferior o arriba del superior, también muéstralo en pantalla y
pide ingre... |
984,372 | 31b364368b428294dfd94a7b0f2c22d028e1d17e | import numpy as np
################################# Task 2.1: Convolution --- basic forward pass
from conv_layers import conv_layer_forward
batch_size = 1
num_filters = 2
channels_x, height_x, width_x = 3, 4, 4
height_w, width_w = 3, 3
stride = 1
pad_size = 1
x_shape = (batch_size, channels_x, height_x, width_x)
... |
984,373 | fbdada9c0f28746539ddb3ea1a8a3a1b37111695 | from rest_framework import serializers
from project_api import models
class HelloSerializer(serializers.Serializer):
"""Seriallizers a name field for testing our APIView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Seriallizers a user profile objec... |
984,374 | fefdff72704ad88e54b8f4ebbeabf8f58ca4d11f | # Generated by Django 3.2.3 on 2021-05-23 14:18
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoFie... |
984,375 | 564dcd2578aee7f3da2e5df75b74cea6488fae0a | def factorial(x)
i=1
s=1
while i<=x:
s=s*i
i=i+1
continue
print(str.format("The factorial of {0} number is: {1}",,x,s))
return s
|
984,376 | aabeb411edcf99e4b3252dffd2ac2586511ca4ae | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import random
from dataset import *
from model import *
import pandas as pd
from matplotlib import pyplot as plt
from torch.utils.tensorboard import SummaryWriter
import torch.optim as o... |
984,377 | 781dbd4d93f6312e86b3b803c170e7fc22a5bdef | import responder
import requests
from prometheus_client import Counter, Summary, start_http_server
import time
import asyncio
import os
import json
import data
import dinghy_dns
import dns.rdatatype
import socket
import logging
from urllib.parse import urlparse
from kubernetes import client, config
from kubernetes.clie... |
984,378 | dbd68cf10ff7361286eaa7a1259a956ea04f3341 | def get_longest_subsequence_with_property(lst, list_property_predicate):
result = []
length = len(lst)
width = 1
while width <= length:
for start in range(0, length - width + 1):
sub_sequence = lst[start:start + width]
if list_property_predicate(sub_sequence):
... |
984,379 | 1fe67e0ed7439a30a0f2ea219ab356e196007061 | from .settings import *
DEBUG = False
ADMIN_URL = env.str("DJANGO_ADMIN_URL")
# Use S3 for static content
AWS_ACCESS_KEY_ID = env.str('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env.str('AWS_SECRET_ACCESS_KEY')
AWS_S3_BUCKET_NAME = "golf-api-static-21sd3asfa"
AWS_S3_BUCKET_NAME_STATIC = AWS_S3_BUCKET_NAME
AWS_S3_KEY... |
984,380 | 34394c3753d593bb267d7434e84234bbb354f9ff | import pandas as pd
#from sklearn.cross_validation import train_test_split
#from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
dataset = pd.read_csv('sample_submission.csv')
X = dataset.iloc[:,:-1].values
y = dataset.iloc[:,1].values
plt.scatter(X,y)
plt.show()
X_train, X_test, y_train... |
984,381 | 9a550a421a90d0175eae4ad1b30a968eaf7add25 | from message.send import Send
from message.receive import Receive
from time import sleep
if __name__ == "__main__":
receive = Receive()
send = Send()
color = 'blue'
robot_id = 0
send.send_msg(robot_id, 100, 100, 0, power=1.0, d = 300000)
sleep(3)
receive.get_info(color, robot_id)
print(... |
984,382 | 883564560a2a5a999bffad947fc2c31c77c11722 | import ast
import codecs
import pkgutil
import re
from os import path
def escape(string):
encoder = codecs.getencoder('unicode_escape')
string = encoder(string)[0].decode('ascii')
return '"""{0}"""'.format(string)
class ImportTarget:
def __init__(self, absolute_path, module_path):
self.abs... |
984,383 | 6fa0a724f104e22e21a81398bf7856c9112ccc71 | import sys
import io
import requests
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
#Response 상태코드
s = requests.Session()
r = s.get('http://httpbin.org/get')
#print(r.status_code)
#print(r.ok)
#https://jsonplaceholder.typic... |
984,384 | c29db71e7f35f8f892bdcd590a1d6092efa4ea86 | import numpy as np
import pandas as pd
import util
import csv
# Predict via the median number of plays.
train_file = 'train.csv'
test_file = 'test.csv'
soln_file = 'global_median.csv'
# Load the training data.
train_data = {}
with open(train_file, 'r') as train_fh:
train_csv = csv.reader(train_fh, delimiter=',... |
984,385 | e8eb5fa371998f254c96f4cdf32b2d4a6f863a5a | from func import *
FILE_OPEN = False
location = ""
def open_file():
global FILE_OPEN, location
location = input("파일 경로 입력 > ")
# 파일 경로 지정하는 함수에 location 파라미터 값으로 넣기
FILE_OPEN = True
return location
while True:
print("1. 파일 열기")
print("2. 섹터 정보")
print("3. 파티션 정보")
print("4. FAT3... |
984,386 | 5e4931e6fdca2393b1d64c4f6066333f556f6459 | '''
A generalization of Bézier surfaces, called the S-patch, uses an interesting scheme for indexing its control points.
In the case of an n-sided surface of degree d, each index has n non-negative integers that sum to d, and all possible configurations are used.
For example, for a 3-sided quadratic (degree 2) surface ... |
984,387 | 376e7f9fe8681a89a6629054a1c672165c9a08e4 | # -*- coding: utf-8 -*-
from teachablerobots.src.Communicate import SocketComm
from teachablerobots.src.GridSpace import *
import math
from time import sleep
#import threading
import ast
from multiprocessing import Process, Queue, Event, Value, Lock, Manager
from ctypes import c_char_p
class Robot(object):
''' ... |
984,388 | 463d1b602a4127ebd65a12a942d35e9361463ee7 | #!/usr/bin/env python3
import os
import base64
import hashlib
import random
import flask
from gen_db import DATABASE
app = flask.Flask(__name__)
app.secret_key = "dljsaklqk24e21cjn!Ew@@dsa5"
N = int("00ab76f585834c3c2b7b7b2c8a04c66571539fa660d39762e338cd8160589f08e3d223744cb7894ea6b424ebab899983ff61136c8315d9d03aef... |
984,389 | ef9aad95d3ea333ccb87f788d9004e63a1610ee9 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
984,390 | 69132b88a9e8a74536284de828c4a688b2fe193a | from gridworld.GridEnv import *
def get_state_values_td(pi, env, gamma=0.9, alpha=0.2, alpha_decay_rate=.0003, min_alpha=0, episodes=30000):
nS = env.nS
V = np.zeros(nS)
for t in range(episodes):
alpha = max(min_alpha, alpha * np.exp(-alpha_decay_rate * t))
s = env.reset()
is_done... |
984,391 | 8c2d86a1a4d507b80fb8597c014a2d8575036b59 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setO... |
984,392 | 438462dda2cb91227d1bf745a708ceef50c7dbcb | """
generate original data file for hierarchy
Format:
[[[class_index for level i], ... ], [..], ...]
"""
import json
import numpy as np
import os
import argparse
import re
def generate_hierarchy(args):
f = open(args.scene_file, 'r')
scene = json.load(f)
f.close()
f = open(args.output, 'w')
json.du... |
984,393 | 95644e444ce2ed5e1d4a94c9fd0a31d7a68c706c | from libdw import sm
from time import time, sleep
import lightSensorInput
from lightSensorInput import readLight
from FlushButtonInput import buttonState
from valveControl import setValve
from lightControl import changeLightState
# inp includes
# 0: the state of button press
# 1: the output of shitPresence Model
# ... |
984,394 | e5c58c15b7d3e82ff7b96a937001035f20b06eec | # open a link in browser using python
import webbrowser
url = 'https://pythonexamples.org'
webbrowser.register('chrome',
None,
webbrowser.BackgroundBrowser("C://Program Files//Google//Chrome//Application//chrome.exe"))
webbrowser.get('chrome').open(url)
#google search using python
#pip install google
try:
from goog... |
984,395 | 74c5f34ab8aad01377a092b6604a9206d54be86e | #from parse import parse
import re
lines = list()
maxCharLines = 0
numberOfLines = 0
def initializeList():
global numberOfLines
global maxCharLines
f = open("input.txt", "r")
for line in f:
lines.append(line)
numberOfLines = numberOfLines + 1
maxCharLines = len(lines[0]) -... |
984,396 | 0015314b33b969ba837cdf36c4d0a10103703143 | List=[2,7,8,5]
target=9
newlist=[]
for i in range(len(List)):
for p in range(i+1,len(List)):
if List[i]+List[p] == target:
print(List[i],List[p]) |
984,397 | 8d10f463f04a6d90fa22ca13363b3ce91101589e | # Lint as: python3
#
# Copyright 2020 The XLS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
984,398 | 47439e3bb5789de916269539ced928d6dadc8f06 | """training
Revision ID: ffdfe694adfd
Revises: c81ae78ea1bd
Create Date: 2020-11-03 18:59:56.503126
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ffdfe694adfd'
down_revision = 'c81ae78ea1bd'
branch_labels = None
depends_on = None
def upgrade():
# ### c... |
984,399 | 177c82514e3aaf8f9abdef7c4f903bfd5e639afd | # Generated by Django 2.0.6 on 2018-06-29 08:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('evaluations', '0003_auto_20180627_0913'),
]
operations = [
migrations.CreateModel(
name='Evalua... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.