blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7fbf4d539fcf86f3f2364f56425361f3644ee391 | Python | Aasthaengg/IBMdataset | /Python_codes/p02400/s481890568.py | UTF-8 | 124 | 2.984375 | 3 | [] | no_license | from math import pi
from decimal import Decimal
r=Decimal(str(input()))
p=Decimal(str(pi))
print(str(p*r**2)+" "+str(2*p*r)) | true |
2e3a06b8abdf5ada00bf5ea5515b4a61e52942cb | Python | ameerabdulaziz/coffee_shop_full_stack | /backend/src/auth/auth.py | UTF-8 | 4,815 | 2.703125 | 3 | [] | no_license | import json
from flask import request, _request_ctx_stack, abort
from functools import wraps
from jose import jwt
from urllib.request import urlopen
AUTH0_DOMAIN = 'dev-k4h6i0dh.us.auth0.com'
ALGORITHMS = ['RS256']
API_AUDIENCE = 'image'
# AuthError Exception
class AuthError(Exception):
def __init__(self, error... | true |
593450289114b67034021a5ddcbd5f29b3dd7138 | Python | taesookim0412/Python-Algorithms | /2020_/08/LeetCodeStrings/29E_14. Longest Common Prefix.py | UTF-8 | 968 | 3.578125 | 4 | [] | no_license | import collections
import numpy as np
from typing import List
#Runtime: 28 ms, faster than 94.89% of Python3 online submissions for Longest Common Prefix.
#Memory Usage: 13.9 MB, less than 59.52% of Python3 online submissions for Longest Common Prefix.
class Solution:
def longestCommonPrefix(self, strs: List[str... | true |
64e6e898476e6e1f8e4e93b5c66a4f5d2dc72b90 | Python | cvasqxz/spv | /spv/utils/log.py | UTF-8 | 192 | 2.65625 | 3 | [] | no_license | from time import time, strftime, localtime
def log_print(msg_type, msg):
date = strftime("%d/%m/%Y %H:%M:%S", localtime(time()))
print("%s [%s]: %s" % (date, msg_type.upper(), msg))
| true |
c7e9f5408b40e11cb4aa206c9f30d0819da63619 | Python | kartone/Scripts | /Parser_Fortigate.py | UTF-8 | 1,630 | 2.59375 | 3 | [] | no_license | import sys
import re
from alive_progress import alive_bar
# First argument is the source file to be parsed, output will be saved into the second argument
# First argument should be a merge of all FGT fw logs as they are extracted from firewall or from Fortianalyzer
filename = sys.argv[1]
file_parsed = sys.argv[2]
#fi... | true |
ebf6d257112bc47de27a8851026bb43ad5acbdd3 | Python | Alexship896/Algoritmia_21-2 | /S8/Ciclos while.py | UTF-8 | 1,526 | 3.5 | 4 | [
"MIT"
] | permissive | laptop = 12_000
print('Costo de laptop $', laptop)
sueldoPorSemana = 3_500
print('Sueldo por semana $', sueldoPorSemana)
semanas = 0
for i in range((laptop//sueldoPorSemana)+1):
semanas += 1
print('Semanas: ', semanas)
semanas = 0
ahorrado = 0
while (ahorrado < laptop):
semanas += 1
ahorrado += sueldoP... | true |
06ad34998bec7b7c97195cdc3c14e963239e70d4 | Python | bsc-wdc/compss | /tests/sources/local/python/8_checkpoint_kmeans/src/task_tracing_kmeans.py | UTF-8 | 4,180 | 2.515625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench KMeans
========================
"""
# Imports
from pycompss.api.task import task
from pycompss.functions.reduce import merge_reduce
import random
def init_board_gauss(numV, dim, K):
n = int(float(numV) / K)
data = []
random.seed(5)
f... | true |
f317cd8e7bf7e0e216399ef0aaa7d6d2cde5fa9e | Python | lebgit/RSOI_lab_2-5 | /mechanic/repository/meh_repository.py | UTF-8 | 1,396 | 2.75 | 3 | [] | no_license | from flask_mongoalchemy import MongoAlchemy
from mechanic import app
from mechanic.domain.meh import Mechanic
db = MongoAlchemy(app)
class Mechanics(db.Document):
name = db.StringField()
lvl = db.StringField()
year = db.StringField()
class MehRepository:
def create(self, name, lvl, year):
... | true |
9c64261e1a092a43beaf6588829efd63ffc78435 | Python | kiriphorito/ELEC311P | /pi_files/mqtt_publish_collect_data_ml.py | UTF-8 | 4,087 | 2.78125 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import time
import datetime
import json
import _thread
from random import *
# from picamera import PiCamera
# Import SPI library (for hardware SPI) and MCP3008 library.
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
MCP3008_SAMPLING = 200000 # at 5V
SAMPLE_WINDOW = 50 # in mS... | true |
1da989188b7592656843a80c639f10f904bcf86c | Python | hemuke/python | /17_process_thread/23_multithread_insecure.py | UTF-8 | 471 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | from threading import Thread
num = 0
def do_sth():
global num
for i in range(1000000):
# 相当于 num = num + 1
# 首先计算num + 1,存入临时变量中;然后将临时变量的值赋给
# cpu调度不正确,因此结果不正确
num += 1
t1 = Thread(target=do_sth)
t2 = Thread(target=do_sth)
t1.start()
t2.start()
t1.join()
t2.join()
print(n... | true |
7c5c90efae4da298499805d0ac827afb51350f40 | Python | Digital2Slave/UrbanRegionFunctionClassification | /bak/UrbanRegionClassification/scut/mixed_training.py | UTF-8 | 2,934 | 2.640625 | 3 | [] | no_license | # USAGE
from scut import datasets
from scut import models
from sklearn.model_selection import train_test_split
from keras.layers.core import Dense
from keras.models import Model
from keras import losses
from keras.optimizers import Adam, RMSprop
from keras.layers import concatenate
from keras.utils import to_categorica... | true |
af6040330d3ea4df2b34a2bbeaed87e050733e77 | Python | FREDY1969/tampa-bay-python-avr | /ucc/codegen/order_triples.py | UTF-8 | 25,707 | 2.625 | 3 | [] | no_license | # order_triples.py
import sys
import itertools
from ucc.database import crud
Debug = False
def order_children():
update_order_constraints()
with crud.db_transaction():
iterations = 0
re_triple_count = re_block_count = re_fun_count = 0
tp_order_count = 1 # force calc_reg_est_for_tri... | true |
c82f73ccae6aa2fee0395f29814802f9975a031e | Python | oledjiks/DEV-PYTHON-COURSE | /strtosock.py | UTF-8 | 411 | 3.0625 | 3 | [] | no_license | import socket, struct
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr):
return socket.inet_ntoa(struct.pack("!I", addr))
def strToSock(*args):
try:
addr, port = ''.join(args).split(':')
return ip2int(addr), int(port)
except Exception as e:
... | true |
f61cb36ea495f223d1666cac00e56038b47377c8 | Python | so-link/SeqFlow | /visual/seqvisual.py | UTF-8 | 1,367 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import matplotlib.pyplot as plt
import numpy as np
def plot_series(x, label=None, color=None, name=None):
s = np.shape(x)
print(s)
if len(s)==1:
fig = plt.figure(name)
plt.plot(x, label=label, color=color)
return
if... | true |
f608a2fa90167e111752a7388306fde87ff274ac | Python | GTGGit/davaleba-1 | /main.py | UTF-8 | 1,206 | 4.40625 | 4 | [] | no_license | # ======================= Calculator ======================= #
# ======================= Calculator ======================= #
class Calculator:
def __init__(self, x, y):
self.x = x
self.y = y
def add(self):
print(self.x + self.y)
def subtract(self):
print(self.x - self.y)
... | true |
e7d36823539a1668d208a75d4c8e9b9676c1aac4 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_3_1/Nick.Aum/Senate_Evacuation.py | UTF-8 | 3,084 | 3.140625 | 3 | [] | no_license | """
Created on 2016/05/08
@author: nico
"""
import string
import operator
def read_lines(path):
f = open(path, 'r')
all_lines = f.readlines()
f.close()
return all_lines
def clean_up(all_lines):
final_lines = []
for line in all_lines:
line = line.replace('\n','')
line ... | true |
ab6c8aebbc2051ac294057acf321ad31f5804949 | Python | DL2021Spring/CourseProject | /data_files/475 Heaters.py | UTF-8 | 889 | 3.25 | 3 | [] | no_license |
import bisect
class Solution:
def findRadius(self, houses, heaters):
houses.sort()
heaters.sort()
r = 0
i = 0
for h in houses:
i = bisect.bisect(heaters, h)
left = max(0, i - 1)
right = min(len(heaters) - 1, i)
r_... | true |
cb1f8798a4625d56c9bfaebce524aa9f2386ef58 | Python | Dinesh94Singh/PythonArchivedSolutions | /Concepts/Standard_Problems/Task_Scheduling.py | UTF-8 | 1,425 | 3.875 | 4 | [] | no_license | """
There are ‘N’ tasks, labeled from ‘0’ to ‘N-1’. Each task can have some prerequisite tasks which need to be completed before it can be scheduled. Given the number of tasks and a list of prerequisite pairs, find out if it is possible to schedule all the tasks.
Example 1:
Input: Tasks=3, Prerequisites=[0, 1], [1, 2... | true |
0f54c29c8249822736eab6f4d8dd42b7a5b18fba | Python | s001015/Baekjoon | /Baekjoon 1110.py | UTF-8 | 145 | 3.1875 | 3 | [] | no_license | N = int(input())
M = N
cnt = 0
while True:
N = (N % 10)*10 + (N // 10 + N % 10)%10
cnt += 1
if N == M:
break
print(cnt)
| true |
64b1330e222312a9c43a5656d78e7017f698fdc5 | Python | gxgarciat/Playground-GUI-Tkinter | /10_radiobuttonswithloops.py | UTF-8 | 991 | 3.328125 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk,Image
# This code will use radio buttons
root = Tk()
root.title("Radio Buttons")
r = IntVar() # It will collect what has been stored in this variable
# In case it is a string, it should be StrVar()
r.set("2")
TOPPINGS = [
("Pepperoni","Pepperoni"),
("Cheese","C... | true |
3d3cdcc44948a0af1c3c9bb419eafdb392dc1d82 | Python | zyk930/leetcode | /120_triangle.py | UTF-8 | 972 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python
# _*_coding:utf-8 _*_
#@Time :2019/3/11 17:54
#@Author :ZYK
#@FileName: 120_triangle.py
'''
给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。
例如,给定三角形:
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。
说明:
如果你可以只使用 O(n) 的额外空间(n 为三角形的总行数)来解决这个问题,那么你的算法会很加分。
'''... | true |
15d1e30f448ec92ec5af2043b566ca8aeaa7038e | Python | rohith2334/hackerrank | /python/Strings/Merge the Tools!.py | UTF-8 | 402 | 3.03125 | 3 | [] | no_license | def merge_the_tools(s, k):
# your code goes here
temp = []
count = 1
for i in range(len(s)):
if s[i] not in temp:
temp.append(s[i])
if count == k:
print(''.join(temp))
temp = []
count = 1
else:
count += 1
if __name__ =... | true |
01cfc2fc2642d983947dc47a0746729fed3844b9 | Python | alexandraback/datacollection | /solutions_5738606668808192_0/Python/3190m/problem_C.py | UTF-8 | 1,198 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Qualification Round 2016
# Problem C. Coin Jam
primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257]
def find_a_divisor(num):
for p in primes... | true |
15412522cd1ddda51d2fe6d4cfa1da60ca5d1b03 | Python | brian-m-ops/codewars | /7kyu/dont_give_me_five.py | UTF-8 | 198 | 3.515625 | 4 | [] | no_license | def dont_give_me_five(start, end):
count = 0
for i in range(start, end + 1):
if str(5) not in str(i):
count += 1
return count
print(dont_give_me_five(4, 17))
###### | true |
ea71f17aaf4c05cb74832fdda4cf9f1e0b9e55bf | Python | tp-yan/PycharmProject | /ForTensorFlow2/04TensorFlow/02vector_sample.py | UTF-8 | 312 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras import layers
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
net = layers.Dense(10)
net.build((4,8)) # 假设输入层为 [4,8],构建模型
print(net.kernel.shape,net.kernel) # 权重参数w一般随机初始化
print(net.bias) # 偏置一般初始化为0
| true |
c91954586644f03bff1cb000486f8b092c793849 | Python | mhNi00/APIprograms | /WHOISinfo/venv/lib/python3.8/site-packages/uhttplib/__init__.py | UTF-8 | 490 | 3 | 3 | [] | no_license | import httplib
import socket
class UnixHTTPConnection(httplib.HTTPConnection):
def __init__(self, path, host='localhost', port=None, strict=None,
timeout=None):
httplib.HTTPConnection.__init__(self, host, port=port, strict=strict,
timeout=timeout)
... | true |
47cd514961ae90772d837f353e103a7c8f60565a | Python | fxjy15550/Python-Project | /QTYOLOV5/main.py | UTF-8 | 21,475 | 2.53125 | 3 | [] | no_license | import argparse
import numpy
import math
import torch
from PyQt5.QtWidgets import * # 这两个是pyqt5常用的库
from PyQt5.QtGui import QImage, QIcon, QPixmap # 可以满足小白大多数功能
from PyQt5.QtCore import pyqtSignal, QThread, QMutex
from detcetUtil import *
from yolov5.utils.general import check_img_size
import os
import sys
class Ch... | true |
c72b86f300b19d152496bdc76f576980fbbe80b6 | Python | UKPLab/tacl2018-preference-convincing | /python/analysis/simulations/replot_as_bar.py | UTF-8 | 1,713 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | '''
Generate a bar chart with error bars -- might be easier to read than a line graph with error bars.
'''
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
def plot_result(idx, filename, xlabel, ylabel, linelabel, fig=None):
if fig is None:
fig = plt.figure(figsize=(5, 4))
else:
... | true |
2e969cf75d052a8cede2d6293b1092c68351d58b | Python | ChenMicky/CNN-by-tensorflow | /train.py | UTF-8 | 5,116 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
NUM_EXAMPLES_PER_EPOXH_FOR_TRAIN = 10000
NUM_EPOCH_PER_DECAY = 350
INITIAL_LEARNING_RATE = 0.1
LEARNING_RATE_DECAY_FACTOR =0.1
MOVING_AVERAGE_DECAY = 0.999
def _losses(label,logits,reuse):
if reuse ==True:
_val_cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels= label,... | true |
7104fac2e4c1c529efdac8efc976ddbd10dac7cb | Python | AmishMoses/PyGames | /JetFighter/JetFighterMain.py | UTF-8 | 5,893 | 3.203125 | 3 | [] | no_license | import pygame
import os
pygame.mixer.init()
pygame.font.init()
pygame.display.set_caption("CyberPunk 3077")
WIDTH, HEIGHT = 900, 500
PLAYER, SIZE = 34, 34
WIN = pygame.display.set_mode((WIDTH,HEIGHT))
'''We have now created the window and it's size
Now lets create the background display'''
FPS = 60
HEALTH_FONT = pyga... | true |
d4a63c59101e5fa1076fa293e12f5163d1727e51 | Python | angaddubey10/ASFR | /training_module.py | UTF-8 | 3,776 | 2.84375 | 3 | [] | no_license | import cv2
import os
import numpy as np
import face_recognition
subjects = ["Chaitanya","Phanindra","Angad","Praneeth","Ashutosh","Praneeth","Dhoni","Modi","Salman","RakulPreet","SomeOne","Katrina","UnknownPerson"]
branch_code = {'CS':'01','ME':'02','CE':'03'}
course_code = {'UG':'01','PG':'02' }
def detect_f... | true |
4363f659e329a3c663958514e16d9e4bd05b5042 | Python | sdwhturbosun/pcf8591 | /电位器.py | UTF-8 | 570 | 2.953125 | 3 | [] | no_license | #用于在不中断电路的情况下,改变电路中电阻的装置。
#实验:PCF8591用于读取电位计的模拟值,并将值输出到LED。
import pcf8591 as ADC
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
def setup():
ADC.setup(0x48)
def loop():
status = 1
while True:
value = ADC.read(0)
print('Value:', value)
ADC.write(value... | true |
7dcace1904ab8655ed052fd124154825a169aadb | Python | jinmyeonglee/practice_algorithm | /google_intern/second_largest_in_BST.py | UTF-8 | 943 | 3.9375 | 4 | [] | no_license | class BinaryTreeNode(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert_left(self, value):
self.left = BinaryTreeNode(value)
return self.left
def insert_right(self, value):
self.right = BinaryTreeNode(value... | true |
02775bdccd08d6fab543eb638bf9390db3648435 | Python | mohmehmo/ReleaseEngCodes | /resamplingSmote.py | UTF-8 | 6,129 | 2.5625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from imblearn.over_sampling import SMOTE
from matplotlib import pyplot
from sklearn.model_selection import train_test_split
from numpy import where
from collections import Counter
import csv
from sklearn.ensemble import RandomForestClassifier
from sklearn import metrics
from sklea... | true |
ca495818f352139819d9dc48e386b2b47e9be799 | Python | Savitar1997/ASCII | /as.py | UTF-8 | 514 | 3.6875 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
a=str(input('a.字符串转换成ASCII码\nb.ASCII码转换成字符串\n请输入你需要的模式:'))
def zhuana(x):
b=list(x)
for i in range(len(x)):
print(ord(b[i]),end='')
print(' ',end='')
def zhuanb(x):
for i in range(len(x)):
z=chr(int(x[i]))
print(z,... | true |
ff204607e125e8dc3930663999b35934bcacbd24 | Python | Aasthaengg/IBMdataset | /Python_codes/p02829/s334062401.py | UTF-8 | 101 | 2.96875 | 3 | [] | no_license | a=int(input())
b=int(input())
ans = set()
ans.add(a)
ans.add(b)
all = {1,2,3}
print((all-ans).pop()) | true |
ef930e8e60cd34899ed9ae2296351950ddc16f52 | Python | mirzaevaziz/uztrafficcalc | /main.py | UTF-8 | 2,034 | 2.9375 | 3 | [] | no_license | """
Calculates Internet Provider approx. traffic per day use
If you have unlim unlim then you don't need it
"""
import sys
import traceback
from uztrafficcalc.providers.sarkor import Sarkor
# =======================
# MENUS FUNCTIONS
# =======================
# Main menu
def main_menu():
print("Выберите в... | true |
ab7d9eb3de1028ee7bb19a3ec84a913cca01dd4d | Python | sona444/CAR-RENTAL-SYSTEM | /car_interface.py | UTF-8 | 5,043 | 2.78125 | 3 | [] | no_license | import hashlib as hasher
import datetime as date
import sqlite3
conn=sqlite3.connect('cars.sqlite')
cur=conn.cursor()
class block:
def __init__(self, indexx, timestamp, owner,car_number, previous_hash):
self.indexx=indexx
self.timestamp=timestamp
self.owner=owner
self.car... | true |
7d024aec13d4bdb30435cb2c92ceafd2e44d5caa | Python | akelbert/bezpy | /bezpy/mag/utils.py | UTF-8 | 5,967 | 2.875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | """Magnetic field utility routines."""
__all__ = ["read_iaga", "detrend_polynomial", "write_iaga_2002",
"get_iaga_observatory"]
import pandas as pd
import numpy as np
import pkg_resources
IAGA_PATH = pkg_resources.resource_filename('bezpy', 'mag/data') + "/"
def read_iaga_header(fname):
# IAGA-2002 f... | true |
31d58e6fac6bb279e7262937ddb2a4d8ae9703c4 | Python | buy/leetcode | /python/26.remove_duplicates_from_sorted_array.py | UTF-8 | 663 | 3.875 | 4 | [] | no_license | # Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
# Do not allocate extra space for another array, you must do this in place with constant memory.
# For example,
# Given input array A = [1,1,2],
# Your function should return length = 2, and A is... | true |
5f55d30c8fa3d0f0169c4bf401c063a564231990 | Python | mahmudz/UriJudge | /URI/URI/2457.py | UTF-8 | 158 | 2.953125 | 3 | [] | no_license | c = input()
v = [i for i in input().split()]
quant =0
total =0
for i in v:
quant+=1
if(i.count(c)>=1):
total+=1
resp = 100*total/quant
print("%.1f"%resp) | true |
102ff1276fc40756ae3092ccff97fe6c08714711 | Python | makoshark/wikipedia-data-examples | /win_unicode_console/streams.py | UTF-8 | 6,811 | 2.609375 | 3 | [] | no_license |
from ctypes import byref, windll, c_ulong
from win_unicode_console.buffer import get_buffer
import io
import sys
import time
kernel32 = windll.kernel32
GetStdHandle = kernel32.GetStdHandle
ReadConsoleW = kernel32.ReadConsoleW
WriteConsoleW = kernel32.WriteConsoleW
GetLastError = kernel32.GetLastError
ERROR_SUCCE... | true |
5187bac6bc31829f1ef7636c88b3bbc4ce26af31 | Python | marina8888/minigames | /primes/ver1.2.py | UTF-8 | 829 | 3.765625 | 4 | [] | no_license | # a prime sieve using the sieve of atkin implementation:
import math
import time
# generates a list of tuples containing all values to check.
# initially all values are False, where 'True' means the value is a prime.
def generate_sieve_list(max_val):
sieve_list=[]
for i in range(1,max_val,1):
sieve_li... | true |
3958c7d8157117acc0c61c666ceecabc3e574445 | Python | Llcoolsouder/MachineLearningDemos | /SVM/SVM.py | UTF-8 | 2,895 | 2.796875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# from quadprog import solve_qp
from sklearn import svm
from sklearn.model_selection import KFold
def runSVM(X, Y, Cs):
#KFold cross validation
kf = KFold(n_splits=10, shuffle=True)
kf.get_n_splits(X)
# Fit SVM model and predict for various C's
a... | true |
84d35d202121423dd0f1a5a5e5e1cd8bcb47d558 | Python | LogicalFish/SoccerSimulator | /matchup/forms.py | UTF-8 | 1,511 | 2.640625 | 3 | [
"MIT"
] | permissive | from django import forms
class TeamSelection(forms.Form):
# error_css_class = "alert alert-danger"
def __init__(self, team, *args, **kwargs):
self.team = team
super(TeamSelection, self).__init__(*args, **kwargs)
self.create_position_form(team)
def create_position_form(self, tea... | true |
c3fca28a1f903ea8a144f285bcbe639f6eef126e | Python | Jkatzeff/Datalitics | /app/gun-violence/scripts/remake_csv.py | UTF-8 | 1,010 | 3.140625 | 3 | [] | no_license | #USAGE: remake_csv.py FILENAME.csv OUTPUT_NAME.csv
#OUTPUT: new file OUTPUT_NAME [with vars you'd like -- asks interactively]
import sys
from csv import reader
filename = sys.argv[1]
output = sys.argv[2]
g = open(output, "w+")
with open(filename, "r") as f:
lines = f.readlines()
var_names = lines[0].split(",")
var_... | true |
7c67f77740902b6c3e90410ff53ba9ee8c31e10d | Python | koryagin2006/GB_Course_Methods_of_collecting_and_processing_data_from_the_network | /Lesson_3 MongoDB/Mongo.py | UTF-8 | 1,163 | 2.59375 | 3 | [] | no_license | from pymongo import MongoClient
from pprint import pprint
client = MongoClient('localhost',27017)
db = client['database_305']
users = db.users305
# letters = db.letters_305
# users.insert_one({'author':'Second_author',
# 'age':19,
# 'tags':'Super tag!'})
#
# users.insert_many([{"aut... | true |
47625c15dee08e873b7b33e205b4e752c8940a3f | Python | acmfi/AdventCode | /2020/day07/csanchez/day07.py | UTF-8 | 1,623 | 3.078125 | 3 | [] | no_license | import copy
import functools
f = open('input.txt')
lines = f.read().split('\n')
gold_bags = list(filter(lambda x: 'shiny gold bag' in x, lines))
upper_bags = []
for l in gold_bags:
container = l.split(' contain')[0][:-5]
if container not in 'shiny gold bags' and container not in upper_bags:
upper_ba... | true |
d95d698fd4b2b9c9a67a3da0023dafefa8bf1547 | Python | Halle-Astra/Recognition_Brand_Vessel | /src/utils.py | UTF-8 | 21,623 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.patches as patches
import math
import os
from PIL import Image
import paddle
from .aug import image_augment
from matplotlib.pyplot import imread
import cv2
def draw_rectangle(currentAxis, bbox, edgecolor = 'r', facecolor = 'y', fill=False, linestyle='-'):
'''定义画矩形框的程序
curre... | true |
b4fed1d6f0e107509e8d653bf80a1eb14388c4ee | Python | NarmadhaG313/Sample | /Inhertion.py | UTF-8 | 427 | 3.0625 | 3 | [] | no_license | class Student:
def __init__(self,fname,id):
self.fname=fname
self.id=id
def display(self,ph):
print(self.fname)
print(self.id)
print(self.ph)
class Parent(Student):
def __init__(self,fname,id):
super().__init__(fname,id)
def display(... | true |
ff3395167f35d44ef73bd46139d1d7a00d32e8f2 | Python | Amgry/AE402-Python | /add.py | UTF-8 | 1,132 | 3.6875 | 4 | [] | no_license |
names=list()
scores=list()
avg=0
def average(scores):
total=0
n=len(scores)
for item in range(n):
total=total+scores[item]
average=total/n
return average
def highest(scores, names):
highest=0
highestname=""
n=len(scores)
for i in range(n):
if scores[i]>highe... | true |
6a9276a95e8dea6ed7d122f9d6d4ee7bc2aaeeb7 | Python | KevinMMendez/cimcb | /cimcb/model/NN_SoftmaxSoftmax.py | UTF-8 | 3,354 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
from keras.callbacks import Callback
from keras.optimizers import SGD, Adam
from keras.models import Sequential
from keras.layers import Dense
from scipy.stats import logistic
from .BaseModel import BaseModel
from ..utils import YpredCallback
class NN_SoftmaxSoftmax(BaseModel):
"""2 Layer logis... | true |
db9009ad877f4f0fe3cd5ae9d24388f9bf8882a1 | Python | shuruiz/tfopt | /example/Jython_Codes/flipflop.py | UTF-8 | 4,116 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Backprop NN training on Madelon data (Feature selection complete)
"""
import os
import csv
import time
import sys
sys.path.append("C:/ABAGAIL/ABAGAIL.jar")
from func.nn.backprop import BackPropagationNetworkFactory
from shared import SumOfSquaresError, DataSet, Instance
from opt.example import NeuralNetworkOptimiza... | true |
b02dda23e625d96809bc6d18b2268a3a6301b6c8 | Python | umeda/nezumi | /Projects/garden_logger/monitor_grapher.py | UTF-8 | 3,537 | 2.75 | 3 | [] | no_license | '''
Monitor Grapher v0.1
Plots Sunlight Logger data from CSV file.
Copyright 2020 Nezumi Workbench
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/... | true |
eb4f2402113ec36ea952338b48aab40a5399f933 | Python | teekay2020/python-training | /python/friendssqlite/user.py | UTF-8 | 462 | 2.921875 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect("users.db")
# create cursor object
c = conn.cursor()
# execute some sql
#c.execute ("CREATE TABLE users (username TEXT, password TEXT);")
people = [
("Roald","Amundsen2020"),
("Rosa", "Parks1000"),
("Henry", "Hudson2000"),
("Neil","Armstrong3000"),
("Daniel", "Boone2100")]
#... | true |
68fc7f388c67b421beb9a9826f53e802c0326bf9 | Python | Breno-Valle/Nasa-WebScraping | /change_background.py | UTF-8 | 1,246 | 2.625 | 3 | [] | no_license | from folder_menager import dir_picture_path
import os
import struct
import ctypes
# Mycrosoft System Parameter to set Wallpaper
SPI_SETDESKWALLPAPER = 20
# Paths to Main images (Wallpaper image)
picture_folder = dir_picture_path('Nasa_images')
wallpaper_path = os.path.abspath(picture_folder + '\\nasa.jpg')
def is_6... | true |
d8ffc56e06a2650b3bf869d5054ab78bb37f9a45 | Python | JozefGonczol/FEI_SUNS | /MyLib/Neuro.py | UTF-8 | 1,439 | 2.9375 | 3 | [] | no_license | import numpy as np
from sklearn.neural_network import MLPClassifier
from sklearn import svm
def mlp(data, data_size, hidden_lay_number):
dim = len(data['train_data'][0])
hidden_lay_size = data_size
hidden_layers = ()
for i in range(0, hidden_lay_number):
hidden_layers += (hidden_lay_size,)
... | true |
c8615651aa43b41f27a1ba3f3d4f59d403771c6a | Python | SubalakshmiShanthosi/JOC-Python_NPTEL | /assignmentSix/problemOne/lowerTriangMat.py | UTF-8 | 906 | 3.3125 | 3 | [] | no_license | # @Author: subalakshmi
# @Date: 2019-09-17T12:35:49+05:30
# @Last modified by: subalakshmi
# @Last modified time: 2019-09-17T13:55:13+05:30
def lowerTrianMat(matrix,sqMatSize):
for i in range(0, sqMatSize):
for j in range(0, sqMatSize):
if (i < j and j!=sqMatSize-1):
pri... | true |
08e574e4c2efd906031bda8ecb0a135a28968330 | Python | AGronowski/MNISTexperiments | /plot.py | UTF-8 | 1,913 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def plot_4_history(train_loss, train_acc, val_loss, val_acc, big_title='', start=0, end=None):
# How much to plot, everything by default
if not end:
end = len(train_loss)
train_loss = train_loss[start:end]
... | true |
f4541d2fadced23d24fd7cf955c09d9baf792dba | Python | caniro/algo-note | /Baekjoon/python/18870.py | UTF-8 | 276 | 2.828125 | 3 | [] | no_license | # 좌표 압축 : https://www.acmicpc.net/problem/18870
N = int(input(''))
X = list(map(int, input('').split(' ')))
arr = sorted(set(X))
dic = {}
for idx, num in enumerate(arr):
dic[num] = idx
for i in range(len(X)):
X[i] = dic[X[i]]
print(' '.join(map(str, X)))
| true |
e8311d2c74a5915f16fed05b9a9e8de61fe2bd28 | Python | malachico/Infix_calculator | /Operators/Plus.py | UTF-8 | 247 | 2.890625 | 3 | [] | no_license | from Operator import Operator
class Plus(Operator):
def __init__(self):
Operator.__init__(self)
self.symbol = '+'
self.precedence = 1
self.associative = 'L'
def evaluate(self, a, b):
return a + b
| true |
23c568be5a374b5c7dd60e68de277534c004cc82 | Python | durgakiran/ALGOPYTHON | /find_if_number_add_upto_given_number.py | UTF-8 | 596 | 3.765625 | 4 | [] | no_license | """
problem: Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this in one pass?
"""
def findIfTwoNumbersAddToGivenNumber(k,givenList):
tmpNum = list(range(1,k+1,1))
... | true |
2a2559f1a782809533306c34aa2ddb6bdea54656 | Python | Tongyuang/cough_project | /blocks.py | UTF-8 | 1,663 | 2.546875 | 3 | [] | no_license | from tensorflow.keras.layers import Dense, BatchNormalization, Activation, Input, Conv1D, MaxPooling1D,GlobalAveragePooling1D, Dropout
from tensorflow.keras.models import Model
import tensorflow as tf
import config
class add_Tensor(tf.keras.layers.Layer):
def __init__(self,X1):
super(add_Tensor, self).__ini... | true |
41589feb89c82529fe47ab030cd3f38411fb1a86 | Python | darrenpmeyer/python-certificate-maker | /test/test_Certificate.py | UTF-8 | 6,894 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import pytest
loc = "Minneapolis/Minnesota/US"
org = "Application Testing Group@My Company, Inc."
email = "myemail@mydomain.tld"
class TestFunctionalCertificate:
def test_create_self_signed_cert_for_localhost(self):
from test.cert_validator import validate_x509_cert
import pycert_maker
ce... | true |
d0efe0fd1dad9069948a3765cc1a144d093aded9 | Python | tomasz-galuszka/flask-simple-video-streaming | /lib/camera.py | UTF-8 | 548 | 2.671875 | 3 | [] | no_license | from time import time
import cv2
class Camera(object):
def __init__(self):
ext = '.jpg'
self.frames = [open(f + ext, 'rb').read() for f in ['1', '2', '3']]
def get_frame(self):
return self.frames[int(time()) % len(self.frames)]
class LaptopCamera(object):
def __init__(self):
... | true |
cb148b90e48a9b94b8ff7a84c5405e2dc553ef06 | Python | Saptarshi-prog/Philaland-coin | /Philaland Coin.py | UTF-8 | 278 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 20:47:09 2020
@author: saptarshi
"""
import math
arr = []
T= int(input())
for i in range(T):
n=int(input())
q= 1 + math.floor(math.log(n,2))
arr.append(q)
for i in range(T):
print(arr[i]) | true |
37351f3084669e97b28045c0fba5837749b12d0d | Python | drzazga00/Course-Python | /06/02_christmas_tree.py | UTF-8 | 265 | 3.4375 | 3 | [] | no_license | s = int(input('Choose size of the Christmas tree: '))
def print_segment(n, szer):
for size in range(1, n+1, 2):
print((size * "*").center(szer))
def print_xtree(size):
for i in range(3, size+1,2):
print_segment(i, size)
print_xtree(s)
| true |
57c5abafc0e0efe1648c9afb8e33c02ccb4c6b8a | Python | kyungminlee/quest-qmc-analyzer | /common/fequals.py | UTF-8 | 490 | 3.3125 | 3 | [] | no_license | from __future__ import division
__author__ = 'vladimir'
def equals(a, b, **kwargs):
'''
Function compares 2 float numbers.
default precision is 5 decimal places.
@param a:
@param b:
@param kwargs:
place - number of places after the decimal point that we
want these numbers being equal to
@return:... | true |
db2a8fb33bc56a6670f941a421a24870240e8f10 | Python | aesara-devs/aesara | /aesara/tensor/nnet/sigm.py | UTF-8 | 5,212 | 2.65625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | """
These functions implement special cases of exp and log to improve numerical
stability.
"""
import aesara
from aesara import printing
from aesara import scalar as aes
from aesara.graph.rewriting.basic import copy_stack_trace, node_rewriter
from aesara.printing import pprint
from aesara.scalar import sigmoid as sca... | true |
17ee1e937c539dc68e90b4e0669a7cc2a7909444 | Python | QingqinLi/hm | /old_boy/网络基础/进程的常用方法/start_and_join.py | UTF-8 | 904 | 3.828125 | 4 | [] | no_license | from multiprocessing import Process
import time
def func():
for i in range(5):
time.sleep(0.05)
print("hello")
if __name__ == '__main__':
p = Process(target=func)
p.start()
p.join() # 是让主进程等待子进程执行完, (当主进程执行到这句话的时候, 主进程阻塞,等待子进程执行完,主进程继续执行
for i in range(5):
time.sleep(0.0... | true |
d96658e9cc16ed3ffb14752b266084cfb4cb3ebc | Python | Studienarbeit-et2017/Arbeitsfortschritt | /RaspberryPiConfig.py | UTF-8 | 787 | 2.578125 | 3 | [] | no_license | #from Control import Control
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup (1, GPIO.IN) #LevelControl
GPIO.setup (5, GPIO.OUT) #WaterPump
GPIO.setup (6, GPIO.OUT) #Valve1
GPIO.setup (7, GPIO.OUT) #Valve2
GPIO.setup (8, GPIO.OUT) #Valve3
GPIO.setup (9, GPIO... | true |
44de0fbbaf6b36817c4df3319ccecf3bc5051a98 | Python | Sakthi299/py4e | /web_data/find_numbers_regex.py | UTF-8 | 211 | 3.03125 | 3 | [] | no_license | import re
added_value = 0
file_name = open("actual_data.txt", "r")
numbers = re.findall('[0-9]+', file_name.read())
results = list(map(int, numbers))
for num in results:
added_value+=num
print(added_value)
| true |
4148d6c890356add1283bb1ab52aa22ace9c7450 | Python | DeepikaSampangi/Addtnl | /coinFlip.py | UTF-8 | 723 | 4.03125 | 4 | [] | no_license | import random
import time
print("I will flip a coin 1000 times. Guess No of times heads show up")
input()
flips = 0
heads = 0
while(flips < 1000):
if(random.randint(0,1) == 1):
heads +=1
flips +=1
if(flips == 900):
print('900 flips and there have been' + str(heads) + 'heads')
time.s... | true |
3a33fd2ef256150b34cc7e91099ffe9af9e76d76 | Python | mbradber/GameOfLife | /scripts/find_coords.py | UTF-8 | 492 | 3.15625 | 3 | [] | no_license | import sys
input_file = sys.argv[1]
x_offset = int(sys.argv[2])
y_offset = int(sys.argv[3])
line_list = []
with open(input_file, 'r') as fp:
for line in fp:
line_list.append(line)
num_rows = len(line_list)
num_cols = len(line_list[0])
o_offset_x = num_cols / 2
o_offst_y = num_rows / 2
for i, line in e... | true |
812835c6ef2b2a67ec8a314a6929e84d001eb0c1 | Python | Aalan1/Data-Structures-Python | /priorityQueue.py | UTF-8 | 1,974 | 3.796875 | 4 | [] | no_license | import math
class Queue():
""" My implementation of a Priority Queue using Heap"""
""" When performing the operations, ensure the heap is more than 5 elements """
def __init__(self):
self.heap = []
def getParent(self, index):
return math.floor(index/2)
def getLeft(self, index):
... | true |
95ea15dfa045621997503e9ca5c6a324659727cb | Python | faizmaricar/fewd-final-project | /script/catalogItem.py | UTF-8 | 2,185 | 2.78125 | 3 | [] | no_license | from makesoup import makesoup
from updateJSON import updateJSON
class CatalogItem(object):
def __init__(self, url):
self.url = url
self.soup = makesoup(self.url)
self.soup = self.soup.find("div", {"class":"CatalogFullDetail"})
def getDetailFields(self):
self.detailfields = ... | true |
ebb1d697a3414ab5a387492ff6739ea05cbdadf1 | Python | Eli-liang-liang/python_code | /course-9/8.3.py | UTF-8 | 469 | 3.9375 | 4 | [] | no_license | # 找到以前的作业:计算1000以内所有不能被7整除的整数之和?将其包装成一个函数
# 该函数接受参数:n
# 返回结果:1 ~ n 以内(不包括n)所有不能被7整除的整数之和
# def sumOfNot7(n):
# sum = 0
# for i in range(0,n):
# if i % 7 == 0:
# continue
# else:
# sum += i
# return sum
# # n = input("📖:")
# # n = int(n)
# # sumOfNot7(n)
# print(sum... | true |
ddf970fd82f6c60f7dcfca4af395d816a1f33265 | Python | roychanmeliaz/carla-rl-dqn-thesis | /generate_waypoint.py | UTF-8 | 2,475 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# ==============================================================================
# -- find carla module ---------------------------------------------------------
# ==============================================================================
from draw_lane_line import point_pos
import glob
imp... | true |
a15e12f201a8a30a347d898ab2a9abedf8807e20 | Python | dativebase/old | /onlinelinguisticdatabase/model/formbackup.py | UTF-8 | 10,753 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016 Joel Dunham
#
# 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 in writi... | true |
405a9ba7b540ad592b4751f06408f43e2bf81d8d | Python | gaylonalfano/python-deepdive | /Part 1/Section 02 - A Quick Refresher/functions.py | UTF-8 | 3,384 | 4 | 4 | [] | no_license | # %% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataScience.changeDirOnImportExport setting
# ms-python.python added
import os
try:
os.chdir(os.path.join(os.getcwd(), 'Part 1/Section 02 - A Quick Refresher'))
print(os.getcwd())
except:
pass
#... | true |
7515256b2162dfdc2147b01162fbf2503f04f578 | Python | KhallilB/Tweet-Generator | /Code/sentance_sampling.py | UTF-8 | 2,094 | 3.28125 | 3 | [] | no_license | import dictogram
import queue
import random
def word(histogram):
random_word = ''
sum_of_weights = sum(histogram.values())
random_weight = random.randrange(sum_of_weights)
for key, value in histogram.items():
if random_weight - value < 0:
random_word = key
break
... | true |
0bae05eb6c8fac564417008c7d596a36286d4ebe | Python | N-B-H/Advent_of_Code_2020 | /day 15/day 15.py | UTF-8 | 2,818 | 3.765625 | 4 | [] | no_license | '''
Advent of Code 2020
--- Day 15: Rambunctious Recitation --- see https://adventofcode.com/2020/day/15
Status: PART I Solved, PART II functional, but too slow with 27.xx seconds..
Agenda: Efficiency for PART II, mathematical solution?
'''
from copy import deepcopy
from collections import deque
#import queue
impo... | true |
3d8108f653e86a6a710864d427f8fd608749cac9 | Python | Beowulfdgo/HackerRank | /Day 5 Normal Distribution II.py | UTF-8 | 304 | 3.546875 | 4 | [] | no_license | import math
mu=70
sd=10
x=80
y
=60
phi1=(0.5)*(1+math.erf((80-mu)/(sd*math.sqrt(2))))
phi2=(0.5)*(1+math.erf((60-mu)/(sd*math.sqrt(2))))
phi3=(0.5)*(1+math.erf((60-mu)/(sd*math.sqrt
(2))))
print(round(100-(phi1*100),2))
print(round(100-(phi2*100),2))
print(round((phi3*100),2))
| true |
8548b750daa7d7399ad619d51421991207e83a9e | Python | parkjaehyeun/practice-for-coding-test | /BOJ/12849.py | UTF-8 | 688 | 2.875 | 3 | [] | no_license | # 0 정보과학관
# 1 전산관
# 2 미래관
# 3 신앙관
# 4 한경직
# 5 진리관
# 6 학생회관
# 7 형남공학관
# 0분에 도착할 수 있는 상태
dp = [1, 0, 0, 0, 0, 0, 0, 0]
def nxt(state):
tmp = [0 for _ in range(8)]
tmp[0] = state[1] + state[2]
tmp[1] = state[0] + state[2] + state[3]
tmp[2] = state[0] + state[1] + state[3] + state[4]
tmp[3] = state[1]... | true |
f21ed33d74c3a3d6131a5ed73a4e79a469fd5f13 | Python | otaviocv/stochasticsimulations | /pigraph.py | UTF-8 | 1,204 | 3.09375 | 3 | [] | no_license | from random import random
from random import uniform
from random import seed
import matplotlib.pyplot as plt
import numpy as np
def main():
N = int(input("n:"))
Seed = int(input("seed:"))
seed(Seed)
M = 0
outP = [[],[]]
inP = [[],[]]
points = []
for i in range(1,N+1):
x = unifo... | true |
24bd61b8f86ec1b79acd3c8bff03b9ff6b2cd27f | Python | nathan-sixnines/ringCommander | /receive_frame.py | UTF-8 | 1,960 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
'''
Writes out data received from websocketd on stdin as
png frames.
'''
import time
import base64
import binascii
from sys import stdin, stdout
import StringIO
import os
import numpy as np
# From http://stackoverflow.com/a/9807138
def decode_base64(data):
"""Decode base64, padding being ... | true |
398bb70dc55afc67e2507231818d885dd1f30513 | Python | WonyJeong/algorithm-study | /koalakid1/While/bj-1110.py | UTF-8 | 315 | 3.109375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
num = input().strip()
result = [int(num)]
while True:
add = 0
for i in str(result[-1]):
add += int(i)
num = int(str(add)[-1]) + int(str(result[-1])[-1]) * 10
print(num)
if num == result[0]:
break
result.append(num)
print(len(result))
| true |
69d519afa488f950227a8a79e121b6293982d580 | Python | ermidebebe/Python | /text wrap.py | UTF-8 | 303 | 3.421875 | 3 | [] | no_license | def wrap(string, max_width):
string2=[]
i=0
while i<=len(string):
string2.append(string[i:i+max_width])
i+=max_width
return '\n'.join(string2)
if __name__ == '__main__':
string, max_width = input(), int(input())
result = wrap(string, max_width)
print(result)
| true |
6ebdfc8bad037f9a333e26175b2302c5350db2de | Python | Aasthaengg/IBMdataset | /Python_codes/p02689/s684957846.py | UTF-8 | 357 | 2.71875 | 3 | [] | no_license | from sys import stdin
import sys, math
n,m = [int(x) for x in stdin.readline().rstrip().split()]
h = [int(x) for x in stdin.readline().rstrip().split()]
c = [1 for x in range(n)]
for i in range(m):
a,b = [int(x) for x in stdin.readline().rstrip().split()]
if h[a-1] >= h[b-1]: c[b - 1] = 0
if h[a-1] <= h[... | true |
53aa29883daf922a9c6272e7e08d908a307206e9 | Python | cjb5799/DSC510Fall2020 | /ANGEL_DSC510/3_1_assignment.py | UTF-8 | 1,613 | 3.96875 | 4 | [] | no_license | # DSC 510
# Week 2
# Programming Assignment Week 2
# Author Daniel Angel
# 09/10/2020
# This block defines variables with user inputted strings or floats.
print('Hello. Welcome to this fiber optic installation estimator.')
cust_name = input('What is your name?') # Ask user's info and prompt input.
proj_name ... | true |
6fcde015789e3d8199ab03c76523a3faa5a2ddc1 | Python | cappudata/TPs-Python | /TP2/TP2_Exercice 3.py | UTF-8 | 757 | 3.390625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#1
np.random.seed(0)
#2
print("Question 2:")
#table = np.random.randint(0,500,500)
table1 = np.random.random(500)
#3
print("Question 3:")
""""
o = 15
u = 100
new_table = []
def func(x):
y = x*15+100
return y
for x in range(len(table1))... | true |
440d8aeb73afa26b98066d468154683b02ee2501 | Python | Vaaleanpunainen/pySerial | /test.py | UTF-8 | 875 | 3.359375 | 3 | [] | no_license | import time
import serial
# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
port='COM1',
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)
print("Port opened on " + ser.name)
if ser.isOpen() == Fal... | true |
0310e273a2c9c47f3cb9a3c0576d0b2aa2036929 | Python | pratiksharma8/MapsWithPython | /main.py | UTF-8 | 540 | 2.734375 | 3 | [] | no_license | import folium
m = folium.Map(location=[37.774929, -122.419418], zoom_start=4)
folium.Marker(location=[27.717245, 85.323959], popup='Kathmandu', tooltip='Click for more info', icon=folium.Icon(icon='envelope', color='lightgreen')).add_to(m)
folium.Marker(location=[34.052235, -118.243683], popup='Los Angeles', tooltip='... | true |
7238dd3fa72b7e9cfeb85256b79b270e8823e8d7 | Python | Shavezz/Project2-Basketball-Stats-Tool | /app.py | UTF-8 | 4,237 | 3.390625 | 3 | [] | no_license |
import constants
import copy
if __name__ == '__main__':
teams = copy.deepcopy(constants.TEAMS)
players = copy.deepcopy(constants.PLAYERS)
x = players
#cleaning data: removing 'inches' from Height strings
for char in x:
char['height'] = char['height'].replace(' inches', ''... | true |
db613476d4b2e7cab6d3fc5792b4c5da39deb218 | Python | kuyezhiying/MLinAction | /DecisonTree/TreePlotter.py | UTF-8 | 3,692 | 3.09375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import trees
'''
Set the style of text area and arrow
'''
decisionNode = dict(boxstyle = "sawtooth", fc = "0.8")
leafNode = dict(boxstyle = "round4", fc = "0.8")
arrow_args = dict(arrowstyle = "<-")
'''
Plot tree node with text annotations
'''
def plotNode(nodeText, center... | true |
105766ccebbdb191779636c9468c81e283b5dffc | Python | VishakVeerasamy/Freshworks | /merge_json.py | UTF-8 | 2,099 | 2.828125 | 3 | [] | no_license | import json
import sys
import argparse
from collections import OrderedDict
def parse():
parser = argparse.ArgumentParser(description='To merge multiple json files')
parser.add_argument('-f', '--folder_path', help='Folder path for json files')
parser.add_argument('-i', '--input_prefix', help='Folder path f... | true |
9dc73566aa3bfc290510cf2e1ed194b58a68722f | Python | naimucar/21.Hafta-Odevler | /stickman.py | UTF-8 | 5,852 | 2.640625 | 3 | [] | no_license | from kivy import Config
Config.set('graphics', 'multisamples', '0')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.pagelayout import PageLayout
import random
country=[]
thing=[]
animal=[]
plant=[]
with open("C:\\Users\\asime\\Desktop\\Programlama\\PYTON program\\pycharm\\kivy\\stickman... | true |
32766a30ff7774581f852a84bd677528b905af4e | Python | Codewyf-top/python-learning | /1.7矩阵乘法.py | UTF-8 | 226 | 2.5625 | 3 | [] | no_license | import torch
import numpy as np
data = [[1,2],[3,4]]
tensor = torch.FloatTensor(data)
data = np.array(data)
print(
'\nnumpy:',np.matmul(data,data),
'\nnumpy:',data.dot(data),
'\ntorch:',torch.mm(tensor,tensor),
) | true |
691951d4c92c7a064e87027616e10773463bba04 | Python | athuls/android_monitor | /salsa/ProfiledData/BatteryRateProfile/.idea/energy/battery/profile/battery_profiler_incr.py | UTF-8 | 2,079 | 2.734375 | 3 | [] | no_license | # param 1: log file to be processed
# param 2: time interval in seconds
import sys
import json
import re
import bisect
from datetime import datetime
from datetime import timedelta
from battery_change_intervals import LogIntervalSplitter
intervalSplitter = LogIntervalSplitter()
batteryChangeIntervals=intervalSplitter.... | true |
9d8e31092f904100ea28342ce2c1bb56b3513fa7 | Python | hitochan777/kata | /atcoder/abc236/C.py | UTF-8 | 242 | 2.96875 | 3 | [] | no_license | N, M = (int(x) for x in input().split())
S = input().split(" ")
T = input().split(" ")
s = 0
oks = [False] * N
for i in range(M):
while T[i] != S[s]:
s += 1
oks[s] = True
s += 1
for ok in oks:
print("Yes" if ok else "No")
| true |