blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
9773fec3c8b6c132faa15f9816356084cf65ce7e | Smeers-Timothy/Hypocycloid-dxf | /src/hypocycloid.py | UTF-8 | 6,723 | 3 | 3 | [] | no_license | #!/usr/bin/python
"""
Hypocycloid cam generator
Generate dxfs of hypocycloid cams for cycloid drives
DXF stands for Drawing eXchange Format
and is a file format created by Autodesk Company for exchanging CAD or CAD files
between CAD systems that do not use the same native file format.
It was originally designed to... | true |
79dd75bf652f4452b71ae10f59e9cc264e15f8bd | TweetPete/ProjectIMU | /lib/GeoLib.py | UTF-8 | 836 | 3.6875 | 4 | [] | no_license | """ Geodetic Library
"""
from math import sqrt, sin, cos
from MathLib import toValue, toVector
def earthCurvature(a,f,lat):
""" calculates radius of curvature in North and East
takes ellipsoidal parameters as argument
"""
e = sqrt(f*(2-f))
Rn = a *((1-e**2)/(1-e**2*(sin(lat))**2)*... | true |
4604eccd595185267618c66e9fb6cfb6e1919c14 | chirag1992m/sea-assignments | /assignment2/document_server.py | UTF-8 | 3,913 | 3.03125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
'''
Name: Chirag Maheshwari
Course: Search Engine Architecture
DocumentServer,
Loads the document store.
Starts a server on given port.
Given a query document and query, returns a
document snippet with highlighted query words.
'''
from assignment2.inventory import Inventory
#Impor... | true |
89a200c0d4db1f534342a0881e2155d62c092033 | amitkulkarni1712/python | /python-references/function.py | UTF-8 | 121 | 3.25 | 3 | [] | no_license | def say_hi(name, age):
print("Hello " + name + ", You are " + str(age))
say_hi("Amit", "23")
say_hi("Shri", "17")
| true |
a7c86c9f119332a5bcb919fa1c763eaf823b7b4d | InsightSoftwareConsortium/ITK | /Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declarations_matchers.py | UTF-8 | 13,443 | 2.546875 | 3 | [
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
... | permissive | # Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import os
from . import templates
from . import matcher_base_t
from . import variable
from . import cpptypes
from . import n... | true |
bfe353cf0a91411f3e837b7fe6993223c119139f | pengphei/cinemaman | /ui/PlayListView.py | UTF-8 | 4,917 | 2.609375 | 3 | [
"Unlicense"
] | permissive | # -*- coding: utf-8 -*-
import Tkinter as tk
import tkFont
import ttk
from CMApp import *
PLAY_VIEW_INFO_HALL = u"电影厅"
PLAY_VIEW_INFO_MOVIE = u"电影名称"
PLAY_VIEW_INFO_STARTTIME = u"开始时间"
PLAY_VIEW_INFO_ENDTIME = u"结束时间"
PLAY_VIEW_INFO_RESTTIME = u"中场休息"
PLAY_VIEW_INFO_PRICE = u"价格"
class CMPlayListView(ttk.Frame):
... | true |
34f06c501fd21305a6c043ec646dd4a0cbcb77fe | C-MTY-TC1028-031-2113/tarea1-basicos-BEEbrt | /assignments/03PendienteLinea/src/exercise.py | UTF-8 | 216 | 3.578125 | 4 | [] | no_license | puno=float(input("Dame el x1: "))
duno=float(input("Dame el x2: "))
yuno=float(input("Dame el y1: "))
yduno=float(input("Dame el y2: "))
pendiente= (yduno - yuno) / (duno - puno)
print("La pendiente es: ", pendiente) | true |
3e619ede93f4f9140d6f782b2161e7f8f8bb9bce | jennLam/present-finder | /seed.py | UTF-8 | 2,967 | 2.65625 | 3 | [] | no_license | """Utility file to seed presents database."""
from sqlalchemy import func
from model import User, Contact, Interest, Event, Present, Intensity, Status
from model import connect_to_db, db
from server import app, bcrypt
from datetime import datetime
from update_pkey_seqs import update_pkey_seqs
def load_users():
"... | true |
d98d254b1ebfd7e4bcbdf2159e15d2d1b0cd4ba9 | learnerzhang/AnalyticsVidhya | /dl_tutorials/keras2_demo.py | UTF-8 | 2,846 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/11/10 07:01 PM
# @Author : zhangzhen
# @Site :
# @File : keras2_demo.py
# @Software: PyCharm
import tensorflow as tf
from tensorflow.keras import layers
import numpy as np
print(tf.__version__)
print(tf.keras.__version__)
class MyModel(tf.keras.M... | true |
4dabb8c3322b2aebe2870d772099a3e43861a5bb | alexshellabear/Building-YOLO-from-Scratch-Keras-Python | /image_localization.py | UTF-8 | 13,381 | 3.296875 | 3 | [] | no_license | """
Part 2
Objective:
Find where an object is in an image assuming there is only one object in that image.
Then progress to building a YOLO detection algorithm
Approach:
1) Will use MobileNetV2 as the architecture to transfer learn so that we don't have to build the classifier from sc... | true |
dd4cb22800625cb9f077a77bf6e1b6b1c27fc88b | darrentsaitw/Python | /shopping.py | UTF-8 | 4,508 | 3.34375 | 3 | [] | no_license | nyear = 2019
powlist = ["滑鼠",'主機','螢幕','筆記型電腦',"鍵盤"]
foodlist = ["麵包","餅乾","蛋糕","牛肉","魚肉","蔬菜"]
uselist = ["衛生紙","馬克杯","牙膏","雨傘","牙刷"]
drinklist = ["啤酒","白酒","伏特加","紅酒","威士忌"]
print("此為購物車程式,如須購買,請按照指示進行,購物產品有:\n\n1.電子",powlist,"\n2.食品",foodlist
,"\n3.日用品",uselist,"\n4.酒類",drinklist)
print()
def date(ag... | true |
51be56fa4c293373898a56891322d7825c611047 | hao0710/COMP9021 | /assignment1/q4/nonredundant.py | UTF-8 | 1,084 | 2.84375 | 3 | [] | no_license | # Written by *** for COMP9021
import sys
from copy import deepcopy
try:
file_name = input('Which data file do you want to use? ')
except FileNotFoundError:
print('There is no such file: "{}"'.format(file_name))
exit()
f=open(file_name)
L = []
for line in f:
L.append(list(map(int,line.replace('R',' ').repla... | true |
c90c222b727176277ac0c7947073e2cd7a778cf9 | makcedward/nlpaug | /nlpaug/model/audio/normalization.py | UTF-8 | 804 | 2.796875 | 3 | [
"MIT"
] | permissive | import numpy as np
from nlpaug.model.audio import Audio
class Normalization(Audio):
def manipulate(self, data, method, start_pos, end_pos):
aug_data = data.copy()
if method == 'minmax':
new_data = self._min_max(aug_data[start_pos:end_pos])
elif method == 'max':
new_data = self._max(aug_data[start_pos:en... | true |
c406a16f18aff3eb5ac32bd696f7f34d17d8a446 | danic96/MiniPractica | /main.py | UTF-8 | 1,684 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf8 :
'''
Client web per www.udl.cat
@author: dcv4@alumnes.udl.cat
'''
import urllib2
from bs4 import BeautifulSoup as bs
url = "https://www.packtpub.com/packt/offers/free-learning/"
class Client(object):
"""classe per obrir la pagina, busc... | true |
51aed1efd021cbc759d9bad29040ddf3e13d1f0f | wangrunz/Titanic | /Titanic.py | UTF-8 | 3,431 | 3.171875 | 3 | [] | no_license |
# coding: utf-8
# In[158]:
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import re
get_ipython().magic('matplotlib inline')
# In[159]:
training_data = pd.read_csv('train.csv')
test_data = pd.read_csv('test.csv')
datasets=[training_data,test_data]
# In[160]:
traini... | true |
e2cee0b25ae8b36fb13c95c9e46c8ca78b942a8e | FlorianLudwig/rueckenwind | /rw/template.py | UTF-8 | 1,273 | 2.515625 | 3 | [
"Apache-2.0",
"Python-2.0"
] | permissive | """Rueckenwind tempating
Rueckenwind does not contain it's own templating engine
but is based on Jinja2.
Added methods inside functions:
* url_for
* handler
"""
import json
import tornado.util
import jinja2
import rw.http
def create_template_env(pkgs):
loaders = [jinja2.PackageLoader(pkg, 'templates') for p... | true |
ea9c7ed19fe631eb96d96721eaf9f6a6f3a78109 | jude89654/cs-elec2a-python-exercises | /george.py | UTF-8 | 503 | 3.6875 | 4 | [] | no_license | number_of_rooms = int(input("PLEASE INPUT NO OF ROOMS: "))
rooms_available = 0
for x in range(1,number_of_rooms+1):
room_input = input("PLEASE INPUT THE NUMBER OF WHO ALREADY LIVE AND THE CAPACITY FOR ROOM NO. %i: " % x)
number_of_people_who_already_lived_in_the_room = int(room_input.split()[0])
room_capa... | true |
3fea2421df30c438ca59fa1737bdffd43f9cbba1 | Rishabhjain-1509/Automatic_System | /Main.py | UTF-8 | 1,659 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 25 10:07:00 2020
@author: Rishabh Jain
"""
# Import modules
#Library for document coversion
import docx
#Library for extract the text from image.
import pytesseract
#Library use for sreaching the text in image.
from PIL... | true |
8d721575516046658e76834f23571dd9aa30a2b6 | Cdayz/simple_lang | /interpreter/src/virtual_machine/vm/binary_ops.py | UTF-8 | 2,830 | 3.15625 | 3 | [
"MIT"
] | permissive | """Module with binary operations implementations on VmState."""
import typing
import operator
from interpreter.src.virtual_machine.vm.vm_def import (
VmState,
VM_OPERATION_TO_BYTECODE
)
from interpreter.src.virtual_machine.vm.helpers import vm_operation
def gen_binary_operation(operation_name: str,
... | true |
e3d3cc1f941ff47953053da5a6ad741638db64eb | hanada31/ICC-Resolution-Evaluation | /Figure Information/drawPairwiseGraph.py | UTF-8 | 8,517 | 2.625 | 3 | [
"MIT"
] | permissive | # sphinx_gallery_thumbnail_number = 3
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
import numpy as np
def plot_graph(model_a, model_b, x, y, z, color_a, color_b):
sub = plt.subplot(x, y, z)
plt.ylim((0,1))
y_major_locator=MultipleLocator(1)
ax=plt.gca()
ax.yaxis.se... | true |
2537d91836f88027728706786849f98bf2113bd1 | decomiteA/LGBIO2072-2020 | /Solutions/TP1-Ex1.py | UTF-8 | 657 | 3.59375 | 4 | [] | no_license | #Ex1 - Solution
def syn_in(t, imean = 25e-11):
"""
Function that produces sinusoidal input
Args:
t : Vector of discretized time points
imean : current mean amplitude [A]
Returns:
sin_i : Sinusoidal input current
"""
########################
#### Your ... | true |
149ab0572c25e1d7e1121204e82a8eee7fdc9ef7 | Ranaalmuqati/100DaysOfCode | /Day11.py | UTF-8 | 369 | 4.34375 | 4 | [] | no_license | x = 5
print(x > 3 or x < 4) # returns True because " 5 is greater than 3".
x = ["apple", "banana"]
y = ["apple", "banana"]
z = x
print(x is z)
print(x is y)
print(x == y)
print("banana" in x) # returns True because a sequence with the value "banana" is in the list
print("lemon" not in x) # returns True because a seq... | true |
0eb36968261a309add4fc5de2bba89a84ab0996e | JamesQuintero/OptionsHouse-TradeMonster-Scraper | /optionshouse.py | UTF-8 | 7,722 | 2.75 | 3 | [] | no_license | ##### Scrapes price data from optionshouse/trademonster #####
import urllib.request #script for URL request handling
import urllib.parse #script for URL handling
import time #scripting timing handling
import datetime #data and time handling
from datetime import... | true |
7eee320471e8ffdadb47ffc8bd5a1e14344f1656 | qazvv1/NeuronNetwork_test | /test/20200416/test1.py | UTF-8 | 1,243 | 3 | 3 | [] | no_license | import tensorflow as tf
from numpy.random import RandomState
mini_batch_size = 8
w1 = tf.Variable(tf.random_normal([2,3], stddev=1, seed=1))
w2 = tf.Variable(tf.random_normal([3,1], stddev=1, seed=1))
x = tf.placeholder(tf.float32, [None, 2], name='x_input')
y = tf.placeholder(tf.float32, [None, 1], name='y_input')
... | true |
c35111a4061b517beb900a99cd01865e9a04067c | mzakrze/tkom-interpreter | /main.py | UTF-8 | 711 | 3.015625 | 3 | [] | no_license | """
Autor: Mariusz Zakrzewski
"""
from lexer import *
from tokens import *
from parser import *
import sys
import traceback
def get_line_generator_from_file(filename):
fh = open(filename, 'r')
for line in iter(fh):
yield line
fh.close()
def main(filename):
try:
with open(filename) as openFile:
l... | true |
59e0c77ae48142026e4530a79807b8d493ba6193 | ErkanCetinyamac/Data-Visualization-with-Plotly | /WorldHappinessReport-PieChart.py | UTF-8 | 1,067 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 8 16:23:27 2019
@author: Erkan Çetinyamaç
"""
# data preparation
import pandas as pd
# Plotly library usage in Spyder
from plotly.offline import plot
import plotly.graph_objs as go # import graph objects as "go"
data=pd.read_csv(r"C:\Users\eceti\Deskto... | true |
88a2cb84067e9ca504ae57a72e65fbb4a534d920 | areebasif/Algorithms | /intersection of two arrays.py | UTF-8 | 440 | 3.640625 | 4 | [] | no_license | def intersec(arr1,arr2):
i = 0
j = 0
lst = []
while i < len(arr1) and j < len(arr2):
if arr1[i] == arr2[j]:
if arr1[i] not in lst:
lst.append(arr1[i])
i = i + 1
j = j + 1
elif arr1[i] > arr2[j]:
j = j+1
... | true |
963a205b7dbd5f8b2b655419e990a3f7d81b9ccc | diogoaraujogit/Data-Science | /Python para Análise de Dados/SciPy/12 - ScyPy.py | UTF-8 | 750 | 3.0625 | 3 | [] | no_license | import numpy as np
A = np.array([[1,2,3],[4,5,6],[7,8,8]])
#Álgebra linear
from scipy import linalg
# Determinante de uma matriz
linalg.det(A)
#a decomposição de LU girada de uma matriz
P, L, U = linalg.lu(A)
np.dot(L,U)
#Autovetores e Autovalores
EW, EV = linalg.eig(A)
#Solução de sistemas de equações
v = np.arra... | true |
126acd01de1cc0cf1bc1b96e93a2f25ae2d351eb | Winston120/Lab_Al_05_33 | /5.py | UTF-8 | 4,859 | 2.84375 | 3 | [] | no_license | import csv
import numpy
import statistics
import copy
# Преобразование стоки в число
def str_to_int(str1):
try:
return int(str1)
except:
if ',' in str1:
str1 = str1.replace(',', '.')
return float(str1)
else:
return False
# З... | true |
a6ca1048a5ee5a347419b9e588ba3ca36af14133 | patsongco/41040-Introduction-to-Artificial-Intelligence | /GUI.py | UTF-8 | 2,429 | 2.6875 | 3 | [] | no_license |
import tkinter as tk
from PIL import ImageTk, Image
from tkinter import filedialog
import numpy as np
import subprocess
def load_img():
global img, image_data
for img_display in frame.winfo_children():
img_display.destroy()
image_data = filedialog.askopenfilename(initialdir="/", title="Choose an ... | true |
e71d1228019cdec6acca0b7e291a8113c04c2621 | indo-seattle/python | /Suresh/Week1Exercise11.py | UTF-8 | 128 | 3.90625 | 4 | [] | no_license | #Write a Python program that takes x = 1, y = 1.1, and z = 1.2j and print it.
x = 1
y = 1.1
z = 1.2j
print(x)
print(y)
print(z) | true |
5c1cf59656f9b403276f87439cf0649e288c76ae | AlexZettler/DC_Electronics_Capstone_GroupD | /data_handling/data_retrieval.py | UTF-8 | 5,243 | 2.875 | 3 | [] | no_license | import csv
import datetime
import os
import random
from data_handling.custom_logger import csv_formatter, log_directories
from system.system_constants import base_log_directory
def get_device_types():
return log_directories.keys()
def iget_log_dirs():
"""
Generator function to retrieve all folders in t... | true |
d9183b47104d1458869b864aa21bc19250aae270 | flxj/Django_blog | /blog_app/blog/utils.py | UTF-8 | 2,447 | 2.890625 | 3 | [
"MIT"
] | permissive | #爬取图书图片
from blog_app.settings import MEDIA_ROOT
from bs4 import BeautifulSoup
import requests
def get_book_info(book_name):
if not book_name:
return "default_book.jpg", "佚名", "0000"
#通过书名进行搜索,结果可能包含多个版本,简单取第一个结果
search=requests.get("https://www.douban.com/search/",params={"q":book_name,"cat":1001... | true |
264ec496277aaa91577668b0067d5264281d7f04 | niallrmurphy/twimp | /ships/dice.py | UTF-8 | 940 | 3.578125 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# Dice simulator.
import pprint
import random
class Dice(object):
"""Dice simulator, supporting potential bias."""
@staticmethod
def RollWithTarget(target_number,
number_of_dice,
sides=10,
alteration=None,
... | true |
f59777fcf4f1c16f06e902e9726025bab70f87ae | shaopei/Script | /Fastq_complement_noReverse.py | UTF-8 | 478 | 2.828125 | 3 | [] | no_license | import sys
import gzip
in_fastq = sys.argv[1]
out_fastq = sys.argv[2]
def Comp(seq):
seq_dict = {'A':'T','T':'A','G':'C','C':'G','N':'N'}
return "".join([seq_dict[base] for base in seq])
with open(in_fastq) as f:
with gzip.open(out_fastq ,"wb") as out:
NR = 1
for l in f:
if NR%4 == ... | true |
651dab049f83e25b50ebd9e91992e8674a9d4a06 | sheroze1123/MatScatPy | /plane_forcing.py | UTF-8 | 675 | 2.59375 | 3 | [] | no_license | import numpy as np
from problem_size import problem_size
from eval_potential import eval_potential
def plane_forcing (elt, l):
"""
Compute a forcing vector corresponding to the influence of an
incident wave of the form exp(l*x)
"""
z = l/1.0j
(N, _) = problem_size(elt)
F = np.zeros((N,), ... | true |
d5e764ff58bd0620008cb11da18a2399abc92564 | 1600307376king/Note | /squirrel/view/tool/mysql_con.py | UTF-8 | 893 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/3/3 20:54
# @Author : jjc
import pymysql
class MysqlTool(object):
def __init__(self, host, user, password, db):
self.host = host
self.user = user
self.password = password
self.db = db
def update_db(self):
query... | true |
235e67a9aec39929b5bc3288cdaf342ff9221693 | meganspeir/Booth | /capture/models.py | UTF-8 | 2,158 | 2.546875 | 3 | [] | no_license | from sqlalchemy import Column, Integer, String, DateTime, SmallInteger, ForeignKey
from sqlalchemy.orm import relationship
from capture.database import Base
class Message(Base):
__tablename__ = 'message'
id = Column(Integer, primary_key=True)
sid = Column(String(34), unique=True)
date_time = Column(... | true |
8c6358bea248c085147d3266515a2e78768282b1 | s120rishu/assignments | /assignment5.py | UTF-8 | 1,112 | 3.6875 | 4 | [] | no_license | #q1
year=int(input("enter the year"))
if(year%4==0 & year%400==0):
print("the year is leap year")
elif(year%100!=0):
print("tear is not leap yr")
else:
print("year is not a leap year")
#Q2
lenth=int(input("enter lenth"))
breath=int(input("enter breath"))
if(lenth==breath):
print("the dimens... | true |
3faa6132f4065f06614f62ccbb720e5fe1224a0d | ghomsy/makani | /lib/python/h5_utils/h5_compare.py | UTF-8 | 6,250 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020 Makani Technologies 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | true |
bc27ebb409b9847fde8678e6d3d4e2bc52c2f33f | parambole/LeetCode | /Graph/parallel-course.py | UTF-8 | 1,384 | 3.15625 | 3 | [] | no_license | class GNode(object):
def __init__(self):
self.inDegrees = 0
self.outNodes = []
class Solution:
def minimumSemesters(self, N: int, relations: List[List[int]]) -> int:
from collections import defaultdict, deque
# key: index of node; value: GNode
graph = defaultdict(GNode)... | true |
40ec79c65d5cf9b729bd0aa87c2f184d6f36c2b5 | alwaysra/PythonDev | /计算九宫数独可能性.py | UTF-8 | 5,606 | 2.71875 | 3 | [] | no_license | sd=[
[0,1,0,3,0,9,0,6,0],
[9,0,0,5,1,6,0,0,2],
[0,0,5,0,0,0,9,0,0],
[1,7,0,0,4,0,0,9,5],
[0,5,0,7,0,3,0,2,0],
[2,9,0,0,5,0,0,7,6],
[0,0,6,0,0,0,2,0,0],
[7,0,0,1,8,5,0,0,3],
[0,3,0,2,0,4,0,5,0]
]
sd=[
[0,6,0,0,1,0,0,7,0],
[8,0,1,0,0,0,0,0,2],
[0,0,0,5,2,0,0,1,0],
[0,0,... | true |
c6be5234081b5928a51d46bed5c39ef58f2cb75f | M1zushi/mizus-slave | /slave.py | UTF-8 | 5,197 | 3.21875 | 3 | [] | no_license | import discord
import asyncio
import math
import random
from discord.ext import commands
import os
from dotenv import load_dotenv
load_dotenv('.env')
client = commands.Bot(command_prefix = "s.",
case_insensitive = True,
activity = discord.Game(name = 'SLAVE SIMULATOR!'),
... | true |
d00e29cd720ff7fc8ada59491dbaf139be4c432c | taketakeyyy/atcoder | /abc/132/c.py | UTF-8 | 380 | 3.265625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
def solve():
N = int(input())
D = list(map(int, input().split()))
D.sort()
"""
1 4 4 | 6 7 9 OK
1 4 4 | 4 7 9 だめ
1 2 3 | 3 7 9 だめ
"""
if D[int(N//2)-1] == D[int(N//2)]:
print(0)
return
ans = D[int(N//2)] - D[int(N//2)-1]
prin... | true |
1bf2dd8aa5c4d450cc7a9d176bc6303e4bf66d55 | sangmain/ai_study | /AI/ml/m04_pima_keras.py | UTF-8 | 1,317 | 2.859375 | 3 | [] | no_license | from keras.models import Sequential
from keras.callbacks import EarlyStopping
from keras.layers import Dense, Dropout, BatchNormalization
import numpy
import tensorflow as tf
#시드값 생성
seed = 0
numpy.random.seed(seed)
tf.set_random_seed(seed)
#데이터 로드
dataset = numpy.loadtxt('./data/pima-indians-diabetes.csv', delimiter... | true |
5aed65099fd458d8b5f961e845992f44566b7b94 | rrwiyatn/udem-fall19-public | /notebooks/sw3_submission/controller.py | UTF-8 | 5,616 | 3.125 | 3 | [] | no_license | import numpy as np
class Controller():
def __init__(self):
self.gain = 2.0
self.last_dist = None
self.last_angle = None
self.integral_dist = 0.0
self.integral_angle = 0.0
pass
def angle_control_commands(self, dist, angle):
# Return the angular velocity i... | true |
c2a5e2cd45dd58500b790acaee26dd7187bfbad3 | ChengyangHuang/DiscriminativeActiveLearning | /query_methods.py | UTF-8 | 35,909 | 2.625 | 3 | [
"MIT"
] | permissive | """
The file containing implementations to all of the query strategies. References to all of these methods can be found in
the blog that accompanies this code.
"""
import gc
from scipy.spatial import distance_matrix
from keras.models import Model
import keras.backend as K
from keras.losses import categorical_crossent... | true |
c1e9f92e53090868a41830a7785c711adfab01bc | zhouf1234/untitled3 | /面向对象-类和对象4.py | UTF-8 | 419 | 3.828125 | 4 | [] | no_license | class Person:
school='阳光幼儿园'
def __init__(self):
self.name='丹丹'
p1=Person()
# 使用对象的方法(属性)时,先看有无此属性,如果没有再看类有无此属性
print(p1.school) #阳光幼儿园
# 给对象改school属性后
Person.school='夏天小学'
print(p1.school) #夏天小学
print()
p2=Person()
print(p2.school) #夏天小学 | true |
ddde08f64c2967d5f80054b9cbdedd9389843980 | fasthill/hello_python | /test3 - 복사본.py | UTF-8 | 237 | 2.78125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
import csv
def test(a):
return a**2
list1 = [1,2,3,4,5,6,7]
for i in list1:
print("i : {}, a = {}".format(i, test(i)))
| true |
474d1cbbe5448e9d6a03e24f5475e49afe9ff90b | sandy2008/binary-net-toolkit | /ebnn/utils/binary_util.py | UTF-8 | 2,170 | 2.859375 | 3 | [
"Unlicense"
] | permissive | import numpy as np
storage_ts = ['row_major', 'col_major']
def binarize(W):
return np.where(W >= 0, 1, -1).astype(np.float32, copy=False)
def binarize_real(W):
return np.where(W >= 0, 1, 0).astype(int, copy=False)
def np_to_floatC(xs, name, storage_t):
'''
Converts a numpy array into a float C ar... | true |
e4fe2542cefdec4faf7997d198e396ab5f511c25 | AnthonyArmour/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/2-matrix_divided.py | UTF-8 | 1,021 | 3.65625 | 4 | [] | no_license | #!/usr/bin/python3
"""
matrix_divided returns a matrix divided by div
"""
def matrix_divided(matrix, div):
"""divides every element of matrix by div"""
sq = []
sq_lst = list()
em = "matrix must be a matrix (list of lists) of integers/floats"
ed = "div must be a number"
es = "Each row of the ma... | true |
a203fed00847fe0ec9dac08bf5a0ac3f6cffa5a1 | ytphua/neural-network-journey | /05_perceptron3.py | UTF-8 | 2,181 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 9 01:45:53 2017
@author: tsann
original source: http://www.python-course.eu/neural_networks.php
"""
import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
class Perceptron:
def __init__(self, input_length, weights=None):
if weigh... | true |
83780ab470c407f77e2d8228b27603c746b7c292 | aanam/bigGraphProject | /src/createGraph.py | UTF-8 | 1,780 | 2.65625 | 3 | [] | no_license | from neo4j.v1 import GraphDatabase, basic_auth
import datetime
#fin = open('/Users/amritaanam/Documents/GIT_Repo/bigGraphProject/sample_data/test_movie.cql', 'r')
fin = open('/Users/amritaanam/Documents/GIT_Repo/bigGraphProject/sample_data/drugbank/V3/drugbank_lits_8.cql', 'r')
data = fin.readlines()
data = data
print... | true |
0227791ebd8c946b7b1dade7b73e3825806446a1 | chikuanlin/whats-cooking | /RNN/detect_ingrs.py | UTF-8 | 914 | 2.625 | 3 | [] | no_license |
import numpy as np
import json
import random
from tqdm import *
vocab_file = 'vocab.txt'
with open(vocab_file) as f_vocab:
ingr_vocab = {w.rstrip(): i for i, w in enumerate(f_vocab)}
#ingr_vocab['</i>'] = 1
def detect_ingrs(recipe):
ingr_names = recipe
ts = [',','.',';','(',')','?','!','&','%',':... | true |
367c356da4b63989c7feb4bee572543f36fcea0b | h4ck3rm1k3/scratch | /scratch/KRAMS/src/apps/scratch/rch/latexview/latexview.py | UTF-8 | 1,308 | 2.8125 | 3 | [] | no_license | '''
Created on May 29, 2009
@author: rchx
'''
from enthought.traits.api import HasTraits, Str, List, Float
class _LItem( HasTraits ):
name = Str('')
def export_latex( self, object ):
print 'name', self.name, 'value', getattr( object, self.name )
def LItem( name, **args ):
retur... | true |
2288d8052aaf73df2194c4dcd95163d07b78f60e | shalit-lab/ML4H-Course-Projects-2020 | /best features for predicting hlos - amit fridman and shlomi bereznik/training.py | UTF-8 | 11,392 | 2.78125 | 3 | [] | no_license | from sklearn.preprocessing import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import GridSearchCV
from sklearn.linear... | true |
48562467f82c511e4465e246d3697eb8668ec370 | zhoukaikaizhou/TEST | /数据类型/数据类型.py | UTF-8 | 330 | 3.796875 | 4 | [] | no_license | def count_char(text,char):
count=0
for c in text:
if c==char:
count+=1
return count
filename=input("Enter a filename:")
with open(filename)as f:
text=f.read()
for char in "abcdefghijklmnopqrstuvwxyz":
perc=100*count_char(text,char)/len(text)
print("{0}-{1}%".format(char,round... | true |
b4ce32cf121a4f8847785fb7548942c5813b2f80 | SindhujaVA/sindhuja_files | /str_reversal.py | UTF-8 | 66 | 3.859375 | 4 | [] | no_license | str1=input("Enter the string to be reversed: ")
print(str1[::-1])
| true |
15d2fef559757695139f329957750f104d764966 | CJ5815/pyIBCC | /attic/frequentist_quick.py | UTF-8 | 3,567 | 2.78125 | 3 | [
"MIT"
] | permissive | '''
Created on 10 Jan 2013
@author: Kieran Finn
'''
import settings
from copy import deepcopy
import numpy as np
from functions import *
from collections import defaultdict
def refine_data(dat):
print 'refining data'
objects,people,scores,labels=dat
planets=longlist([])
candidates=longl... | true |
313f97c79078afe97f1e2a1516d5d5c27bc5af55 | lukasmeitz/jetson-cuda | /modules/handlers/load_result_files.py | UTF-8 | 398 | 2.75 | 3 | [] | no_license | import json
import os
def collect_file_list(path):
result = [os.path.join(dp, f) for dp, dn, filenames in os.walk(path) for f in filenames if
os.path.splitext(f)[1] == '.json']
return result
def read_dict_data(files):
data = []
for file in files:
with open(file, 'r') as json_... | true |
50bf3ac6510bad66342cee0528462efaa7b64871 | kishore-narendran/VITCloudClient | /Client Application/update.py | UTF-8 | 953 | 2.53125 | 3 | [] | no_license | import os
from PyQt4 import QtCore
class Updater(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def run(self):
try:
self.check()
except:
print "Error: Update failed!"
return
def check(self):
with open('settings/Version') ... | true |
98a962af7a0432b5ec8ac5192d8185522b0daf40 | pombredanne/python-blueprints | /tests/base.py | UTF-8 | 7,268 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | import shutil
from unittest import TestCase
from blueprints import Graph
class BaseTestGraph(TestCase):
__test__ = False
def setUp(self):
self.graph = Graph(self.name, self.path())
def test_graph(self):
# test graph creation
pass
def test_create_vertex(self):
with ... | true |
19a29899784489b3ee0117040492189e30327fc2 | beentaken/sgt | /polyhedra/regular/mkregular.py | UTF-8 | 29,980 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Generate polyhedron description files for the regular polyhedra.
# TODO
#
# - 4.3.3.3 snub cube
# - 5.3.3.3 snub dodecahedron
import sys
import math
def normalise(vector):
vlen = math.sqrt(sum([x**2 for x in vector]))
return tuple([x/vlen for x in vector])
def dot(v1, v2):
ass... | true |
82fb579e1f1b1f97d29a77667fa3a4de47eeb7e7 | ewrfcas/PalmPrint-Camera | /Hourglass.py | UTF-8 | 2,370 | 2.671875 | 3 | [] | no_license | from keras.layers import *
from keras.models import *
from keras import layers
def preprocess_numpy_input(x):
x /= 127.5
x -= 1.
return x
def Residual(x, filters):
# Skip layer
shortcut = Conv2D(filters, (1, 1), padding='same')(x)
# Residual block
x = BatchNormalization()(x)
x = Activ... | true |
214f184301bd422907e07a73132ddbbd431640be | SantosTiagoC/Projeto-pyhton | /variaveis.py | UTF-8 | 559 | 4.375 | 4 | [] | no_license | """
Variaveis são espaços de alocamentos na memoria
int float str bool
"""
#nome = "Tiago"
#idade = 34
#peso = 70.3
#sexo = "M"
#print("Ola, meu nome é", nome, "Minha idade é", idade)
#print("ola, meu nome é{}\nEu tenho {} Anos".format(nome,idade))
#print(f"Ola, meu nome é {nome}\nEu tenho {idade} anos e meu peso é... | true |
236c608a8ec2eff0ee40261dec941e02cf9047ec | hanrick2000/LeetcodePy | /leetcode/bfs_dfs/convert_binary_search_tree_to_sorted_doubly_linked_list_dfs.py | UTF-8 | 1,442 | 3.671875 | 4 | [] | no_license | # Definition for a Node.
class Node:
def __init__(self, val, left, right):
self.val = val
self.left = left
self.right = right
class Solution:
"""
Runtime: 732 ms, faster than 47.79%
https://leetcode.com/articles/convert-binary-search-tree-to-sorted-doubly-linked/
"""
de... | true |
69a6f2706d428b8c16341058ba6343613f1c5884 | kwonj1234/byte_academy_battleship | /controller.py | UTF-8 | 2,002 | 3.296875 | 3 | [] | no_license | import model
import view
def run():
play = True
while play == True:
rows, columns = view.main_menu()
#return error for non-numeric input
if rows.isnumeric() == False or columns.isnumeric() == False:
view.not_num()
play = False
rows = int(rows)
columns = int(... | true |
3c90a38ab4ae3e10c241943cc59d7d75311565e5 | Alex1066/AutoClicks | /Frames/MenuPage.py | UTF-8 | 2,736 | 2.703125 | 3 | [] | no_license | import tkinter as tk
class MenuPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
canvas = tk.Canvas(self, height=500, width=500, bg="#12454C")
canvas.pack()
btn_image = tk.PhotoImage(file="Assets/Delay.png... | true |
112026c083281a000b8c260dc4369b472ea34d00 | sazid44/pycharm | /Python1/Conditions/if,elif & else.py | UTF-8 | 1,077 | 4 | 4 | [] | no_license |
#if statements cannot be empty, but if you for some reason have an if statement with no content,
# put in the pass statement to avoid getting an error.
mark=40
num=30
# 1 statement
if num<mark:print("pass")
# 2 statements
if num > mark:
print("pass")
else:print("fail")
# 3 statements
if num > mark:
print("pass"... | true |
6fe32bd4e682572932efc41afeeddbb0824666b1 | pedrerete/Partum-Figuris | /memoria.py | UTF-8 | 2,020 | 3.203125 | 3 | [] | no_license | import os
inicioEnteros = 1000
limiteEnteros = 1999
limiteDobles = 2999
limiteBoleanos = 3999
limiteTemporales = 4999
limiteConstantes = 5999
limiteDirecciones = 6999
class Memoria:
def __init__(self):
self.enteros = {}
self.dobles = {}
self.boleanos = {}
self.constantes = {}
self.temporales = {}
self.dire... | true |
bcfc9ee898328743010e45f8dcce19da008c03f9 | Qyu-ai/Reina | /reina/MetaLearners/SLearner.py | UTF-8 | 4,960 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[2]:
"""
Provides a spark-based S-learner heterogeneous treatment effect estimator.
"""
import pyspark
from pyspark.sql.functions import monotonically_increasing_id
from pyspark.ml.feature import VectorAssembler
from pyspark.sql.functions import avg
from pyspark.sql.function... | true |
28681cbe1377cab50af942f7a6dfd5f0eccb6ada | edramir18/42_python_bootcamp | /day00/ex02/whois.py | UTF-8 | 391 | 3.578125 | 4 | [] | no_license | #! /usr/bin/env python
import sys
def main():
if len(sys.argv) == 1:
return
if len(sys.argv) > 2 or not sys.argv[1].isnumeric():
print("ERROR")
return
number = int(sys.argv[1])
if number == 0:
print("I'm Zero.")
elif number % 2 == 0:
print("I'm Even.")
... | true |
3c8fd32a8252d3f324385c23b983f53782df6816 | manojakumarpanda/This-is-first | /sequence/set and list and dict/operation of list.py | UTF-8 | 1,086 | 4.3125 | 4 | [] | no_license | #program to operate different function of the list push pop del
lis=[]
while True:
print('Enter 1 for the push in to the stack ')
print('Enter 2 for the pop of the stack')
print('Enter 3 for the display the stack')
print('Enter 4 for the delete the stack ')
print('Enter 5 for exit of this operation'... | true |
86bbe2990eaa7b96520a912730d5053566245a0a | bssrdf/pyleet | /H/HandlingSumQueriesAfterUpdate.py | UTF-8 | 4,831 | 3.75 | 4 | [] | no_license | '''
-Hard-
*Segment Tree*
*Lazy Propagation*
You are given two 0-indexed arrays nums1 and nums2 and a 2D array queries of queries. There are three types of queries:
For a query of type 1, queries[i] = [1, l, r]. Flip the values from 0 to 1 and from 1 to 0 in nums1 from index l to index r. Both l and r are 0-indexed.
F... | true |
06fc2f60142c54becc155d345854b81c0b9db84f | SuperSat001/Question-Extractor | /testdata/answer.py | UTF-8 | 177 | 2.84375 | 3 | [] | no_license | import csv
with open("5_5 SOL.csv") as f:
csv_reader = csv.reader(f, delimiter=',')
l = [a for a in csv_reader]
for c in l[1:]:
for q in c:
print(q, end="\t")
print() | true |
615995a8fec2a68c3ca2a023913531f22681246c | dar4kamal/Pattern-Recognition-to-Control-Pc | /code/modelTrain.py | UTF-8 | 5,282 | 2.515625 | 3 | [] | no_license | # Larger CNN for the MNIST Dataset
import numpy as np
import keras
from keras.models import load_model
from keras.optimizers import Adam
from keras.metrics import categorical_crossentropy
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Conv2D,... | true |
239d8d43ab78c8a762038808bbc4999295e84d38 | RockZhangCn/extract_ssl_certs | /extract_ssl_certs_mult.py | UTF-8 | 5,939 | 2.515625 | 3 | [] | no_license | #coding=utf-8
#version:20161109
import dpkt
import struct, socket, sys, os, argparse, md5
import multiprocessing
def showUsage():
print 'extract_ssl_certs.py [-f 文件名|-d 目录]'
def extract_file(filepath):
if not filepath.endswith('cap'):
return
print 'Extract: %s' % (filepath)
tc... | true |
b8a9b09296dfa9dc04ad91d3c8894c3e1208bdf8 | Zeryoshka/first_course-work | /app/game_module/players.py | UTF-8 | 1,729 | 3.5 | 4 | [] | no_license | from .player import Player
class Players():
'''
Класс для всех игроков
'''
def __init__(self, lst = None):
'''
Инициализация объекта класса Players
'''
if lst is None:
lst = []
self._players = lst
def __getitem__(self, key):
'''
И... | true |
73d2d5d37a68fb5e474a26c1954cebeafa7ab658 | nnaakkaaii/various-image-recognition-models | /various_image_recognition_models/src/models/optimizers/adam_optimizer.py | UTF-8 | 563 | 2.53125 | 3 | [] | no_license | import argparse
from typing import Any
import torch.optim as optim
def optimizer_modify_commandline_options(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.add_argument('--lr', type=float, default=0.00001, help='learning rate')
parser.add_argument('--beta1', type=float, default=0.5, help=... | true |
04973b45c7273d7ab0009cf17af843cb66948d17 | meghnaraswan/PythonAssignments | /Ch8_ClassesandObjects/define_class.py | UTF-8 | 464 | 4.375 | 4 | [] | no_license | #defining a class with methods
class MyClass(object):
class_attribute = 'world'
def my_method(self, param1):
print('\nhello',param1)
print("The object that called this method is:",self)
self.instance_attribute = param1
my_instance = MyClass()
print("output of dir(my_instance):")
prin... | true |
043baa22f5f28b95fb2d8f0b042c5c5839759536 | aidanknowles/TweetVibe | /app/manager.py | UTF-8 | 11,780 | 3.078125 | 3 | [
"MIT"
] | permissive | from twython import Twython, TwythonAuthError
from app.alchemyapi import AlchemyAPI
from app.models import Tweet
from datetime import datetime
import config
def save_tweets(tweets, search_term, location_search_term=None):
"""
Saves given tweet data in MongoDB database.
:param tweets: Tweet dat... | true |
65a1b2e8426d9baa0f7d5649815f44e18b890398 | YouJaeBeom/capstone | /raspi python/SSDP.py | UTF-8 | 2,707 | 2.609375 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
# THIS SOFTWARE IS PROVIDED BY MURATA "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# MURATA BE LIABLE FOR ANY DIRECT, INDIRECT,... | true |
fde9d38ff974e65424fac013374468608a28daa7 | sguzman/sitemap-gen | /main.py | UTF-8 | 1,619 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import requests
import bs4
import queue
import threading
from multiprocessing.dummy import Pool
base = 'http://briannawu2018.com'
n = 2
cores = 8
pool = Pool(cores)
seen_set = set()
to_see_set = set('/')
seen_queue = queue.Queue()
to_see_queue = queue.Queue()
def remove_prefix(text, prefix):
if text.startswith(p... | true |
375a2df0eacd0c42070b43e8d864d64c8e80072a | skytreader/alexandria | /librarian/tests/dummies.py | UTF-8 | 1,949 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from librarian.utils import Person
"""
Contains plain object definitions for use in testing purposes.
"""
class LibraryEntry(object):
"""
Object with the following fields:
- isbn
- title
- author*: list of dictionaries with `lastname` and `firstname` fields.
... | true |
2ee9716bc6bf15c4c4984fb14a0ec3f6991e2c5d | woochica/trachacks | /regexlinkplugin/tags/trac0.11/0.2/RegexLink/regex_link.py | UTF-8 | 1,908 | 2.6875 | 3 | [
"Beerware"
] | permissive | """
regex_link.py
====================
Copyright (C) 2008 Roel Harbers
----------------------------------------------------------------------------
"THE BEER-WARE LICENSE" (Revision 42):
Roel Harbers wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some ... | true |
850e3dcaa1e6b070a95634e21d920957975722dc | MirduSandy/Tersonflow2 | /day01_python语言基础/02常量、变量、表达式.py | UTF-8 | 4,081 | 4.375 | 4 | [] | no_license | # 一、基本数据类型
# Python中支持6种标准的数据类型:
# 数字,字符串,列表,元组,字典,集合
# 数字(Numbers)——整型(Integer)
# Python3中的整数可以任意大,而不用担心位数不够而导致溢出的情况
print(123456789012345678901234567890)
# 1.数字(Numbers)——浮点数(Float)
# 科学计数法:10的n次方 ---》En en
print(1.233E8, type(1.233E8), ";", 1.233e3, type(1.233e3))
# 2.数字(Numbers)——布尔值(Boolean)
# True( 真)—— 1 False(假... | true |
1d47ad8303510abb2f89526829f6e20a95372eec | martin-welss/ud120-projects | /evaluation/evaluate_poi_identifier.py | UTF-8 | 1,869 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
"""
starter code for the evaluation mini-project
start by copying your trained/tested POI identifier from
that you built in the validation mini-project
the second step toward building your POI identifier!
start by loading/formatting the data
"""
import pickle
import sys
sys.p... | true |
f04317016debcd22885113ab495249de07eddcc3 | helloak/py-datascience | /plots/basic_bubble_plot.py | UTF-8 | 401 | 3.890625 | 4 | [] | no_license | # A bubble plot is close to scatter plot
# With the help of matlibplot library, we construct them using the same scatter function
#libraries
import matplotlib.pyplot as plt
import numpy as np
#creation of data using rand
x = np.random.rand(30)
y = np.random.rand(30)
z = np.random.rand(30)
#scatter funtion
plt.scatte... | true |
a84273af859198dc0354fc33b66306694153e66b | NikTRSK/SpotMe_Backend | /Extras/2-Setup_Users.py | UTF-8 | 1,951 | 2.640625 | 3 | [] | no_license | import sys
import re # Regular Expressions
import codecs # UniCode support
import random
from random import randint # Random number generator
# from pymongo import Connection # For DB Connection
from pymongo import MongoClient
from pymongo import ReturnDocument
from pymongo.errors import ConnectionFailure # For catchin... | true |
5c223794770135c7ed18437fe4d21469be083392 | inuradz/PCSocBot | /commands/help.py | UTF-8 | 890 | 2.875 | 3 | [] | no_license | from commands.base import Command
from helpers import *
class Helpme(Command):
desc = 'This help text'
pprint = dict(args='[<command/subcommand>]')
@staticmethod
def find_command(args):
cls = Command
first_arg = 0
for arg in args:
if arg in cls.subcommands:
... | true |
eeb5133681a84c885254ff59e6c59d310fa1cf6a | sevenry/python_learning_note | /headfirst/hf704.pyw | UTF-8 | 778 | 3.34375 | 3 | [] | no_license | from tkinter import *
import pygame.mixer
sounds=pygame.mixer
sounds.init()
correct_s=sounds.Sound("correct.wav")
wrong_s=sounds.Sound("wrong.wav")
correct_number=0
wrong_number=0
def correct():
global correct_number
correct_number=correct_number+1
correct_s.play()
def wrong():
... | true |
64518c2778dcf6c160131c1aa3145ebee0622f10 | navoanp/IE-Net | /comparison/comparison_experiments_fill_0_multimetric.py | UTF-8 | 5,372 | 2.875 | 3 | [] | no_license | import argparse
import pandas as pd
import numpy as np
import os
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score, roc_auc_score
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import RandomForestClassifier
from s... | true |
8b9da9da0481c59759ec3302d9a66327a5ec6a63 | mturja-vf-ic-bd/AD-Longitudinal-Smoothing | /Subnetwork_mining/Dang/helpers.py | UTF-8 | 3,023 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from read_file import read_temporal_mapping
from sklearn.model_selection import StratifiedKFold
from operator import itemgetter
def get_Kfold_multilabel(y):
hash_map = dict()
for i in range(len(y)):
id = ''
for j in range(y.shape[1]):
id += st... | true |
02b2237a4f8d1d1015a5d961519bc81c46f8530f | tjhlp/numpytest | /numpytest/matplotlib/matplotlib_tjh_01.py | UTF-8 | 364 | 3.203125 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
# fig = plt.figure()
fig = plt.figure(figsize=(3, 6)) # 指定画图区大小(长,宽)
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2)
ax1.plot(np.random.randint(1, 5, 5), np.arange(5)) # 第一个子图画图
ax2.plot(np.arange(10) * 3, np.arange(10)) # 第二个子图画图
plt.show()
| true |
22d32f104a84ecae01f4d7d4928d2fd24c5ac1e1 | CamposRodrigo/Python | /EX./ex015.py | UTF-8 | 231 | 3.9375 | 4 | [
"MIT"
] | permissive | x = int(input('Quantos dias o carro ficou alugado? '))
y = float(input('Quantos quilometros voce andou? Km'))
print('Voce usou o carro por {}dias e andou por km{} .Voce tem que pagar R${:.2f} .'
.format(x,y,(x*60)+(y*0.15)))
| true |
7d09092f5cf6c8850f886c67819b37c3c13290c9 | sloganking/text-compression | /compress.py | UTF-8 | 8,279 | 3.3125 | 3 | [] | no_license | from tqdm import tqdm
import re
def isValidCapitalization(str):
if str.islower():
return True
if str.isupper():
return True
# only first char is upper
if str[0].isupper() and str[-(len(str) - 1):].islower():
return True
return False
class textCompressor:
def __init__(... | true |
4fe0b850eb1c1fabbdea803875fd5c6031122505 | gustavogalho/exercicio_api_01 | /app.py | UTF-8 | 3,081 | 3.359375 | 3 | [] | no_license | '''
Desenvolva uma API que gerencie um cadastro de tarefas
A API tera uma lista de tarefas que devera ter os sequintes campos: ID,
responsavel, tarefa e status
A API devera permitir listar todas as tarefas e tambem incluir novas tarefas
A API devera permitir consultar uma tarefa atraves do ID, alterar o
status de uma t... | true |
f0912ed6c407e4e596b31e706b9b0b54497dad72 | Daizoo/GA_Programming | /throwObject/calcPoint.py | UTF-8 | 432 | 3.296875 | 3 | [] | no_license | from math import sin, cos, radians
def calcPoint(init_y, dist, degree, init_v):
y = init_y
x = 0
t = 0
G = 9.8
fps = 1.0 / 1000.0
theta = radians(degree)
while y > 0:
t += fps
x = init_v * cos(theta) * t
y = init_v * sin(theta) * t - G * t * t / 2 + init_y
ret... | true |
ff6113765a36145df1700ea17ed3d42194f6b23d | plotly/dash-docs | /dash_docs/chapters/deployment/index.py | UTF-8 | 7,848 | 2.609375 | 3 | [
"MIT"
] | permissive | import dash_core_components as dcc
import dash_html_components as html
from dash_docs import styles
from dash_docs import reusable_components as rc
layout = html.Div(children=[
rc.Markdown('''
# Deploying Dash Apps
By default, Dash apps run on `localhost` - you can only access them on your
own machine... | true |
3ec6560cb4d6af0b4b23dc2cbcf2759c73d7dd34 | cadentang/test_ui_demo | /module_exercise/module_00.py | UTF-8 | 4,063 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'caden'
"""
description:
模块
1.内置模块 os time sys
2.自定义模块
3.第三方模块
模块的搜索路径:
1.程序所在目录
2.环境变量python path
3.标准库路径
4..pth文件自定义路径
模块导入的过程:
1.首先在内存中为每个待导入的模块构建module类的实例:模块对象。这个模块对象目前是空对象,这个对象的名称为全局变量b。
2.构造空模块实例后,将编译、执行模块文件b.py,并按照一定的规则将一些结果放进这个模块对象中。
模块的内置属性:
1. __name__ 当前模块的名字,当作为主... | true |