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 |
|---|---|---|---|---|---|---|---|---|---|---|
4917e3b6f797b510e84f2a662cb1ff7da5c3ea2d | Aasif-Multani/hacker_rank | /src/10_Days_of_Statistics/Day_1_Standard_Deviation.py | UTF-8 | 229 | 3.1875 | 3 | [] | no_license | '''
Created on Feb 20, 2019
@author: Aasif Multani
'''
from statistics import stdev
count=input()
numbers=input()
my_list=[]
my_list=numbers.split()
for x in range(len(my_list)):
my_list[x]=int(my_list[x])
print(stdev(my_list))
| true |
07c3b9db89707cd944ad3d65ad3cfa4350c38b87 | seabay/reco_backup | /data_loader/data_generator.py | UTF-8 | 5,171 | 3.140625 | 3 | [] | no_license | import numpy as np
import keras
from itertools import islice
class DataGenerator(keras.utils.Sequence):
def __init__(self, path, row_size, batch_size=32, n_classes=10,
seq_category_pos=None, categorical_pos=None, numeric_pos=None, shuffle=True):
'Initialization'
self.path = path
self.b... | true |
e21e5bfad2532b1663eeb3c278a5922f22eaeab4 | VijayEluri/all | /py/testwin32.py | UTF-8 | 384 | 2.75 | 3 | [] | no_license | import time,ctypes
freq = ctypes.c_longlong(0)
ctypes.windll.kernel32.QueryPerformanceFrequency(ctypes.byref(freq))
f=freq.value
print f
ctypes.windll.kernel32.QueryPerformanceCounter(ctypes.byref(freq))
n1=freq.value
print n1
time.sleep(1)
ctypes.windll.kernel32.QueryPerformanceCounter(ctyp... | true |
04c6fa6a8d16dda0f3aeeeaeca7bd986adabec4c | rsedlr/Python | /camel game.py | UTF-8 | 2,302 | 3.578125 | 4 | [] | no_license | import random
print('Welcome to Camel!')
print('You have stolen a camel to make your way across the great Mobi desert.')
print('The natives want their camel back and are chasing you down! Survive your')
print('desert trek and out run the natives.')
done = False
traveled = 0
thirst = 0
tiredness = 0
Ndistance = 30
drink... | true |
f1d6fb75ede96393da52daed64ae31ac76783c9e | ervinpepic/Python-exercises | /max_min_num.py | UTF-8 | 275 | 3.984375 | 4 | [] | no_license | n= input('How many times')
min=None
max=None
for i in range(n):
broj=input('Brojevi:\n\n')
if min is None:
min=broj;
max=broj;
elif broj < min:
min=broj
elif broj > max:
max = broj
print ("max je ", max)
print ("min je ", min)
| true |
ec30701c54ae2f3203bd0378cc5da50ad77a0896 | dlmarrero/ghidra_scripts | /FindUnsafe.py | UTF-8 | 1,435 | 2.8125 | 3 | [] | no_license | #Find uses of potentially unsafe functions
#@author Davy L. Marrero
#@category Helpers
#@keybinding ctrl shift S
#@menupath Tools.Helpers.Find-Unsafe
def main():
BAD_FUNCS = ['gets', 'read', 'strcpy', 'strncpy', 'strncat', 'strcat',
'memcpy', 'memmove', 'scanf', 'sscanf', 'sprintf', 'fgets',
... | true |
c331a057f1988aba7c3efc1abefef827cfe3c752 | jnau/Jnau-Sample-Scripts | /Python/Other/line_count.py | UTF-8 | 676 | 3.09375 | 3 | [] | no_license | import os
def line_count(file_name):
with open(file_name) as fil:
num_lines = 0
for line in fil:
num_lines += 1
return num_lines
def word_count(file_name):
with open(file_name) as fil:
num_words = 0
for line in fil:
words = line.split()
num_words += len(words)
... | true |
f2b72753c83408830c87f2ac0df512466d0155a1 | lBenevides/CS50 | /pset6/cash.py | UTF-8 | 457 | 3.8125 | 4 | [] | no_license | from cs50 import get_float
cash = 100 * get_float("Change owed: ")
while cash < 0:
cash = 100 * get_float("Change owed: ")
# quarters (25¢), dimes (10¢), nickels (5¢), and pennies (1¢).
quarters = cash / 25
dimes = (cash % 25) / 10
nickels = (cash % 25 % 10) / 5
pennies = (cash % 25 % 10 % 5)
change_count ... | true |
06917932af541a6e7589595c54d4be6912122fd5 | Oussamayousre/VideoDownloader | /Video_Downloader.py | UTF-8 | 1,395 | 2.703125 | 3 | [] | no_license | import time
from selenium import webdriver
import datetime
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class VideoDownloader :
def __init__(self , link) :
self.link = link
... | true |
70faaadfc67a0e64652d10e1464c99d8336af4bd | dockerizeme/dockerizeme | /hard-gists/ebb282c3b73c41c1404123de6cea4771/snippet.py | UTF-8 | 2,485 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | """
pointgrey_camera_driver (at least the version installed with apt-get) doesn't
properly handle camera info in indigo.
This node is a work-around that will read in a camera calibration .yaml
file (as created by the cameracalibrator.py in the camera_calibration pkg),
convert it to a valid sensor_msgs/CameraInfo messag... | true |
8fa00d4ca314b9005a744638570b8f75bc52b45f | falcevor-study/relational-metadata-parser | /dbd_repr/dbd_to_ram.py | UTF-8 | 16,578 | 2.53125 | 3 | [] | no_license | import configparser
import pyodbc
import sqlite3
from ram_repr.ram_structure import Constraint
from ram_repr.ram_structure import ConstraintDetail
from ram_repr.ram_structure import Domain
from ram_repr.ram_structure import Field
from ram_repr.ram_structure import Index
from ram_repr.ram_structure import IndexDetail
f... | true |
a9232cc3b42c1ad00b949e7edc4fcc5ca1bc0cbb | andredoumad/leetcodePython | /incomplete/nearestCity.py | UTF-8 | 3,394 | 3.921875 | 4 | [] | no_license | # Andre Doumad
# 200830
'''
Position: New Grad 2021
Amazon has Fulfillment Centers in multiple cities within a large geographic region. The cities are arranged on a group that has been divided up like an ordinary Cartesian plane. Each city is located at an integral(x,y) coordinate intersection. City names and location... | true |
aed73431efc4b6a498efe07866e6efecf8cebf4f | CXuTao/Python_source | /python_grammar/office文件操作/1.读写CSV文件/1.读CSV文件.py | UTF-8 | 294 | 2.703125 | 3 | [] | no_license | import csv
def readCsv(path):
infoList = []
with open(path, "r") as f:
allFileInfo = csv.reader(f)
for row in allFileInfo:
infoList.append(row)
return infoList
path = r"E:\python\office文件操作\1.读写CSV文件\12.csv"
readCsv(path) | true |
bc7542ec4b5912fec427dfbcd1d7e874a9b4ab0c | kokorev/altcli | /visual.py | UTF-8 | 6,611 | 2.78125 | 3 | [] | no_license | # coding=utf-8
"""
some basic visualisations for cliData
"""
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import colors
from scipy import stats
from altCli.clicomp import movingAvg,removeNone
def getRedBlueCM(segments=100,reverse=False):
"""
return red-blue color map
Возвращает к... | true |
7da4a907202b4f9834b8bdb3d685f6070df77222 | griffinmatt101/csce462_project | /tkinter/news_page/news_test.py | UTF-8 | 2,849 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from Tkinter import *
from PIL import Image, ImageTk
import Tkinter,time,datetime
import sys
#import events
import feedparser
from subprocess import check_output
def tick(time_old, clock):
# get the current local time from the PC
time_now = time.strftime('%I:%M')
... | true |
c5c05e5c4ddfe31fd0e657912f3d357a956c0e47 | liza0525/algorithm-study | /BOJ/boj_2577_number_of_numbers.py | UTF-8 | 265 | 3.125 | 3 | [] | no_license | import sys
sys.stdin = open('../input.txt', 'r')
A = int(input())
B = int(input())
C = int(input())
number_cnt = [0 for _ in range(10)]
result_num = str(A * B * C)
for number in result_num:
number_cnt[int(number)] += 1
print('\n'.join(map(str, number_cnt))) | true |
c897b8d2e83b174e56e4e9d8f9dd783632b1bcec | ISIS1225DEVS/HallOfFame-R1-2021-10 | /AppS04/view.py | UTF-8 | 5,843 | 2.9375 | 3 | [] | no_license | """
* Copyright 2020, Departamento de sistemas y Computación, Universidad
* de Los Andes
*
*
* Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published b... | true |
81bbcd09d1a587a5a92acf2528350a782b4bb220 | jgillies/dbt-helper | /core/open.py | UTF-8 | 3,555 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from dbt.config import RuntimeConfig
import os
import json
import subprocess
COMPILED_DIR = "compiled"
RUN_DIR = "run"
MANIFEST_FILE = "manifest.json"
DEFAULT_OPEN_COMMAND = "open"
COMPILATION_MESSAGE = "You may need to run dbt compile first."
class OpenTask:
def __init__(self, args):
self.args = args
... | true |
b7d6542b8e17610d8003b7cf00ac4424ab266988 | Aasthaengg/IBMdataset | /Python_codes/p02779/s255748283.py | UTF-8 | 153 | 2.984375 | 3 | [] | no_license | import sys
n = int(input())
a = dict()
for x in map(int, input().split()):
if a.get(x) == 1:
print('NO')
sys.exit()
a[x] = 1
print('YES')
| true |
6370f39c86cc51bd8de85d4d4ccee16e326aec56 | vafaei-ar/Ngene | /scripts/backup/unetdataprovider.py | UTF-8 | 9,194 | 2.75 | 3 | [
"MIT"
] | permissive | import glob
import numpy as np
from astropy.io import fits
import h5py
from PIL import Image
from scipy.misc import toimage
'''
Created on Aug 18, 2016
original author: jakeret
Modified at: March 20, 2018
by: yabebal fantaye
Modified on July 20, 2018
by: Anke van Dyk
'''
def to_rgb(img):
"""
Co... | true |
c5168e29de5b6c45f4dc562c9ac791be6c671ad4 | fp-computer-programming/cycle-3-labs-p22crsullivan | /lab_5-1.py | UTF-8 | 187 | 3.1875 | 3 | [] | no_license | # Author: CRS 10/03/21
# int(a)
# Name error.
# int('a')
# Value error.
# 'a' + 2
# Type error.
# import date
# Module not found error.
# print("I'm a happy camper!)
# Syntax error.
| true |
38281aa1ec45e4e4a5d495b76da438f44f9b9a91 | viktar25777/python_algoritm_lab | /python_algoritm_lab_1/python_script9.py | UTF-8 | 252 | 2.890625 | 3 | [] | no_license | a = 2021
def year(a):
try:
a = int(input("Введите год числом: "))
except zerodivisionerror:
return
b = a // 4
c = a // 400
d = a // 100 != 0
s = a // b and c // d
return s
print(year(a))
| true |
87bdabaace2692c172100bbcacb96e2bc5284696 | ksayee/programming_assignments | /python/CodingExercises/LeetCode1603.py | UTF-8 | 2,652 | 4.15625 | 4 | [] | no_license | '''
1603. Design Parking System
Design a parking system for a parking lot.
The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the ParkingSystem class:
ParkingSystem(int big, int medium, int small) Initializes object of the ParkingSystem class... | true |
fa90f99f7ffcf60ee6ee6d720dbe86a9d36a7efa | VegBirdaa/Code | /爬取乘风破浪的姐姐百度百科的代码.py | UTF-8 | 5,146 | 2.875 | 3 | [] | no_license | import pandas as pd
import requests
import re
import numpy as np
from pyquery import PyQuery as pq
import matplotlib.pyplot as plt
#添加头,防止反爬虫
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
}
r = reques... | true |
2ec6ca5ee678b24defe26145e9e867e39e52b1c8 | kazuhayase/study | /python/pro-con-python/ch3/sec2_techs_Shrink_HalfBrute_Hanten_Shakutori_IntegersSet/FaceTheRightWayByHanten.py | UTF-8 | 817 | 2.859375 | 3 | [] | no_license | '''
Created on 2016/12/17
@author: kazuyoshi
'''
def solve(N,D):
dir=[]
for c in D:
if c =="F":
dir.append(0)
else:
dir.append(1)
M=N
K=1
for k in range(1,N+1):
m=0
s=0
f=[0 for i in range(N)]
for i in range(N-k+1): #[i,i+k-1]... | true |
69ee9ffcb978d9b52da5aee1af15202ae996b0c7 | falkdavid/advent-of-code | /2020/day15.py | UTF-8 | 1,342 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
- Make sure to 'export AOC_SESSION=<your_aoc_token>'
- Run the script in an ipython session using '%run <name>'
"""
from aocd.models import Puzzle
from typing import NamedTuple, List, Dict
from collections import Counter, defaultdict
# Enter year and day
puzzle = Puzzle(2020, 15)
d... | true |
a3aed303741db218a7e0d4d9b65f9d5f3364f73c | jw3329/leetcode-problem-solving | /Top Interview Questions/212. Word Search II/time_limit_solution.py | UTF-8 | 1,246 | 3.390625 | 3 | [] | no_license | class Solution:
def findWords(self, board: List[List[str]], words: List[str]) -> List[str]:
res = []
visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]
for word in words:
found = False
for i in range(len(board)):
for j in rang... | true |
3fe2f2fa11ce7e76f28a2ba6dcafacca007cad91 | moontree/leetcode | /version1/394_Decode_String.py | UTF-8 | 2,252 | 4 | 4 | [] | no_license | """
Given an encoded string, return it's decoded string.
The encoding rule is: k[encoded_string],
where the encoded_string inside the square brackets is being repeated exactly k times.
Note that k is guaranteed to be a positive integer.
You may assume that the input string is always valid;
No extra white spaces, squa... | true |
1c1572a9faddce1e63b39601df1652a9435f025b | xinyal/11-791-spring2019 | /src/error_analysis.py | UTF-8 | 2,172 | 2.96875 | 3 | [] | no_license | import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import precision_recall_fscore_support, accuracy_score, confusion_matrix
# from dev output file, calculate accuracy, precision, recall, f1
region_to_num = {'at': 0, 'mi': 1, 'ne': 2, 'no': 3, 'so': 4, 'we': 5}
num_to_region = {v... | true |
16bf455431e1c8bee59be7775e7e8424ef0271d5 | paintception/Deep-Quality-Value-Family | /src/test_value_functions.py | UTF-8 | 7,050 | 2.59375 | 3 | [] | no_license | import gym
import random
import time
import numpy as np
from skimage.color import rgb2gray
from skimage.transform import resize
from utils import Utils
from scipy.ndimage.filters import gaussian_filter1d
from matplotlib import pyplot as plt
plt.style.use('seaborn-paper')
plt.rcParams.update({'font.size': 50})
EPIS... | true |
d22f27c2f357b195eaf1956df3582533a57268c7 | policecar/pyOpenGLcontext | /julia.py | UTF-8 | 2,788 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# inspired by https://christopherolah.wordpress.com/2009/12/19/formation-of-escape-time-fractals/
# potentially approaching https://christopherolah.wordpress.com/2011/08/08/the-real-3d-mandelbrot-set/ ;)
from context import *
from time import time
from math import sin, pi... | true |
a6ebfc08fdc3dc742b5a6303161c6eafc11182d2 | ChangxingJiang/LeetCode | /0901-1000/0969/0969_Python_1.py | UTF-8 | 974 | 3.5625 | 4 | [] | no_license | from typing import List
class Solution:
def pancakeSort(self, arr: List[int]) -> List[int]:
ans = []
now_idx = len(arr) - 1
while now_idx > 0:
# 寻找最大值
max_val = max(arr)
# 最大值已经在数组末尾
if arr[now_idx] == max_val:
arr.pop()
... | true |
1c481c3c8a207dc6b4911d6759195716b3df69c1 | Hx-someone/aly-blog | /alyBlog/utils/page/per_page.py | UTF-8 | 1,556 | 2.78125 | 3 | [
"WTFPL"
] | permissive | # -*- coding: utf-8 -*-
"""
@Time : 2020/3/13 13:35
@Author : 半纸梁
@File : per_page.py
"""
def get_page_data(page, current_page, around_count=3):
"""
分页对象 当前页 总页数
:return:
"""
current_page_num = current_page.number # 1
# 获取总也码数
total_page_num = page.num_pages # 1--100
# 默认左... | true |
dda457ca9108b4b1d29018ddc0fc598ed977fe44 | joaquinmaya/sharing_binder | /bokeh-app/main.py | UTF-8 | 11,415 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 17 16:42:55 2020
@author: danielmaya
"""
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
from bokeh.io import output_file, show,curdoc
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource,... | true |
51de41ee842b0e2f4a3a6dacd2bb692485086791 | victorcarnaval/uri-online-judge-exercises | /iniciante/uri_1035.py | UTF-8 | 288 | 3.1875 | 3 | [] | no_license | [A, B, C, D] = [int(x) for x in input().split()]
is_accepted = False
if (B > C and D > A):
somaCD = C + D
somaAB = A + B
if (somaCD > somaAB and C >= 0 and D >= 0 and A % 2 == 0):
is_accepted = True
print('Valores aceitos' if is_accepted else 'Valores nao aceitos')
| true |
a9d14e5ca80cd840d5bf9b9c507516dc4ee975c8 | rbenefo/Orbital-Warfare-Game | /gamev1/Spacecraft.py | UTF-8 | 6,256 | 2.640625 | 3 | [] | no_license | from Coilgun import CoilgunRound
import math
class SpaceCraftPrimitive(object):
def __init__(self, pos, vel, sounds, img, p):
self.pos= pos
self.theta = 0
self.vel = vel
self.accel = PVector(0,0)
self.h = 8
self.w = 20
if p == 0:
self.img_body = ... | true |
e4640fbdc883e7dfe790856bbe88f7e595468dac | chat-code/leetcode-everyday | /20220217_688/nonmean.py | UTF-8 | 1,548 | 3.078125 | 3 | [] | no_license | #
# @lc app=leetcode id=688 lang=python3
#
# [688] Knight Probability in Chessboard
#
# @lc code=start
class Solution:
def knightProbability(self, n: int, k: int, row: int, column: int) -> float:
if k == 0:
return 1.0
def getNextStep(i, j, n):
res = []
res.app... | true |
7b866876717a5d35dcf2649c72cd63985aabf171 | yanzhiqiang/python | /test_set.py | UTF-8 | 310 | 3.203125 | 3 | [] | no_license | s =set('cheeseshop')
t =frozenset('che')
print t,s
#test else in while
def showMaxFactor(num):
count=num/2
while count > 1:
if num%count == 0:
print 'largest factor of %d is %d' %\
(num,count)
break
count-=1
else:
print num,"is prime"
for eachNum in range(10,21):
showMaxFactor(eachNum)
| true |
64b6a7281fa2898cef24a2c8771a2523261e6cf2 | WalterConway/COMP-5700 | /CA04/prod/Project.py | UTF-8 | 1,671 | 3.515625 | 4 | [] | no_license | '''
Created on Nov 1, 2014
@author: WalterC
'''
class Project(object):
def __init__(self):
self.iterationList = []
def add(self, iteration = None):
if(iteration is not None):
self.iterationList.append(iteration)
return len(self.iterationList)
else:
... | true |
9deed8dc25fd1c7a5ad178e14cb3464a5d7c2250 | RafalBuchner/beziertests-in-Drawbot | /bezierTests/implementation.py | UTF-8 | 1,230 | 2.9375 | 3 | [] | no_license | """NEXT STEP: expand the curve to the whole segment with lines and few beziers and try to be able to work on that"""
from easyEnvironment import *
from thickness_math import *
setEnvironment(786, -226)
cursorPoint = (328, 382)
P1 = (20, 30)
P2 = (150, 320)
P3 = (322, 336)
P4 = (404, 158)
drawCross(cursorPoint,True)
... | true |
bb8656dcb847f5dbd11c8e083e95e8556474ef73 | DevopediaOrg/wikipedia-reader | /utils.py | UTF-8 | 3,240 | 2.84375 | 3 | [
"MIT"
] | permissive | ''' A selection of utility functions.
'''
import argparse
from datetime import datetime
import json
import os
import random
import sys
def parse_args():
''' Parse command line arguments. '''
now = datetime.now().strftime('%Y%h%d.%H%M%S')
maxpages, rmaxpages = 100, 1000
maxlevels, rmaxlevels = 2, 10
... | true |
7fdd34ab1794bae2b075c7b7650cb0514b265a3f | mtokovarov/Non-Uniform-Isolation-Forest | /tree.py | UTF-8 | 382 | 2.890625 | 3 | [] | no_license | class Tree(object):
def __init__(self):
self.tree_depth = 0
self.border = None
self.rot_op = None
self.exnodes = 0
self.root = None
def get_node(self, path):
node = self.root
for p in path:
if p == 'L' : node = node.left
... | true |
50dc35978fae6cc7a206ee919a5fcf412104fd2c | Shyam844/insurance_risk_assessment | /src/naive_bayes.py | UTF-8 | 916 | 2.90625 | 3 | [] | no_license | from database import Database
from pre_processor import Pre_processor
from constants import Constants
from sklearn.naive_bayes import GaussianNB
# CONTAINS ALL STATIC MEMBERS
class Naive_bayes:
@staticmethod
def epoch(train_x, train_y, test_x, test_x_raw, filename):
clf = GaussianNB()
clf.fit(train_x, train_y)
... | true |
a7b6042fcdcc49e387427e23f207a4d49523a38c | luchen29/Algorithm-Practice | /704r_Binary_search_last_position_non_recursion.py | UTF-8 | 881 | 3.625 | 4 | [] | no_license | class Solution:
"""
@param nums: An integer array sorted in ascending order
@param target: An integer
@return: An integer
"""
def lastPosition(self, nums, target):
# write your code here
if not nums:
return -1
start = 0
end = len(nums)-1
while ... | true |
d3bd4ae6cc9c8fa718f1ac1d86e6af27efe9b7d9 | Dr-Waffle19/CIS1415 | /Chap8 add 1.py | UTF-8 | 932 | 3.90625 | 4 | [] | no_license | def main ():
rainfall = rainInput ()
totalRain = totalRainfall (rainfall)
average_Rainfall = averageRainfall (totalRain)
highestMonth, highestMonthly = highestMonthNumber (rainfall)
print ()#for spacing output
print ('Total rainfall for the year: +str(totalRain) + ' inche(s)')
print (... | true |
7f399fe233d98e756b09a3a96054bad1889c17a7 | msarfrazanwar/SmartAttendance-Python | /firstpage.py | UTF-8 | 1,452 | 3.125 | 3 | [] | no_license | #import module from tkinter for UI
from tkinter import Tk, Label, Button
from _tkinter import *
import os
#creating instance of TK
root=Tk()
root.configure(background="#80D8FF")
#root.geometry("600x600")
def function1():
os.system("python training.py")
def function2():
o... | true |
96b5cdf9abf54b64b37fe8d27d04930d91f28059 | Project-Euler-WIVLABS/Project-Euler | /Kevin_25.py | UTF-8 | 233 | 3.171875 | 3 | [] | no_license | a = []
for i in range(10000000):
a.append(0)
a[1] = 1
a[2] = 1
def PI(i):
if a[i] == 0:
a[i] = PI(i-1) + PI(i-2)
return a[i]
for i in range(1,10000000000):
if PI(i) > 10**999:
print(i)
break
| true |
1b4f7a48280619ece0ba9cb7bc4ee83f12d399ac | jansowa/talkingdata-adtracking-competition | /course-content/launcher.py | UTF-8 | 8,194 | 2.71875 | 3 | [] | no_license | import pandas as pd
from sklearn.preprocessing import LabelEncoder
import category_encoders as ce
from itertools import combinations
from processing_utils import get_data_splits
from processing_utils import train_model
train_sample_path = '../competition-data/train_sample.csv'
train_sample_data = pd.read_csv(train_sam... | true |
00f8b814d4e4ad840923f23f2454e501cf89466f | mrzhuzhe/pepper | /statistical-learning/em.py | UTF-8 | 2,650 | 3.140625 | 3 | [
"MIT"
] | permissive | """
http://fangs.in/post/thinkstats/likelihood/
https://github.com/fengdu78/lihang-code/blob/master/%E7%AC%AC09%E7%AB%A0%20EM%E7%AE%97%E6%B3%95%E5%8F%8A%E5%85%B6%E6%8E%A8%E5%B9%BF/9.Expectation_Maximization.ipynb
怎么没有q函数相关的呢
"""
import numpy as np
import math
# 初始值
pro_A, pro_B, por_C = 0.5, 0.5, 0.5
# 概率密度函数
def pm... | true |
9648657070403e783d640d5f8bfcf5f9b5345b50 | SirGnip/crowd_sandbox | /src/minimal/sync/main_sync.py | UTF-8 | 1,281 | 3.765625 | 4 | [] | no_license | # Minimal implementation of "central counter" in synchronous fashion
# Run takes about 15-16 seconds
#
# This "central counter" app is just an app that has a shared counter that is
# being incremented by multiple "workers" (Whatever the workers happen to be
# in a given implementation. Could be threads, processes, asyn... | true |
bf73341fe18c5810add3980e8f61cddfc4f9778a | phucng/master-thesis | /architectures/nb_baseline/model.py | UTF-8 | 1,480 | 2.890625 | 3 | [
"MIT"
] | permissive | """
Model to use for text classification.
"""
from sklearn.naive_bayes import MultinomialNB
from sklearn.externals import joblib
from misc_utils import get_logger
import os
logger = get_logger(__name__)
class NaiveBayes():
def __init__(self, n_features, n_classes, store_path):
self.is_trained = False
... | true |
9c275abc51af17e3dba781d2f91d195c06b477dd | kopok2/CodeforcesSolutionsPython | /src/459A/test_cdf_459A.py | UTF-8 | 1,299 | 2.515625 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import patch
from cdf_459A import CodeforcesTask459ASolution
class TestCDF459A(unittest.TestCase):
def test_459A_acceptance_1(self):
mock_input = ['0 0 0 1']
expected = '1 0 1 1'
with patch('builtins.input', side_effect=mock_input):
Solution ... | true |
eb0d5665d322a0e916c11eaa3d9d40e245de6f4f | taucompling/otml | /source/misc/advanced_aspiration_and_lengthening_generator.py | UTF-8 | 4,271 | 3.140625 | 3 | [] | no_license |
from misc.corpus_generator import CorpusGenerator
import itertools
from random import choice, shuffle
from collections import namedtuple
import re
SyllablesTypeBase = namedtuple('SyllableType', ['aspiration_and_lengthening', 'aspiration_only', 'lengthening_only', 'nothing'])
class SyllablesType(SyllablesTypeBase):
... | true |
2985bc8f3d3fded7c0987affaf673cf3e7238e59 | vs49688/scripts | /gitea-tx.py | UTF-8 | 2,249 | 2.859375 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python3
import json
import urllib.request
import urllib.parse
FROM_ORGS = [
'Org1Name',
'Org2Name',
]
TO_ORG = 'ToOrgName'
class giteaapi(object):
def __init__(self, api, token):
self._api = api
self._token = token
def _post_url_raw(self, url, data, content_type, meth... | true |
078427907882cf1dccd84e0f4a79dcd8c12ee63f | Bugzey/Softuni-Python-Fundamentals | /05. Python-Fundamentals-Objects-and-Classes/07 Websites.py | UTF-8 | 830 | 3.3125 | 3 | [
"MIT"
] | permissive | # Site, domain and queries (if any)
class Website:
def __init__(self, host, domain, queries = []):
self.host, self.domain = [item.strip() for item in [host, domain]]
if len(queries) != 0:
self.queries = [query.strip() for query in queries.split(',')]
else:
self.quer... | true |
b3ab9fa56d254947844c0b0f22f2e2feb7819c1a | FedericoGelsi/algorithmic-trading | /src/main.py | UTF-8 | 2,280 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
import json
from urllib.request import urlopen
from datetime import datetime
import matplotlib.pyplot as plt
import yfinance as yf
from api.algorithms import strategies as als
def plot( data , stockname):
plt.style.use('fivethirtyeight')
plt.figure(figsize=(12.5, 4.5))
... | true |
418eedff9266ea1c07b63611c9e7c50274aa3190 | PeterJackNaylor/challengecam | /learning6_challenge/segm_db_access_original.py | UTF-8 | 9,049 | 2.5625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
"""
Description:
Challenge CAMELYON16.
Classes to access segmentation databases.
Authors: Vaïa Machairas, Etienne Decencière, Peter Naylor, Thomas Walter.
Creation date: 2016-02-24
"""
import pdb
import os
import smilPython as sm
from debug_mode import debug_mess
def bin_jpg(im_segm):
"... | true |
d7e546e10ccc02140f69942ffe76619ec458c770 | green-fox-academy/nandormatyas | /week-02/day-01/guess_the_number.py | UTF-8 | 465 | 5.1875 | 5 | [] | no_license | # Write a program that stores a number, and the user has to figure it out.
# The user can input guesses, after each guess the program would tell one
# of the following:
#
# The stored number is higher
# The stried number is lower
# You found the number: 8
x = 12
guess = int(input('Guess the number: '))
if guess < x:... | true |
64ed8900c1461a3e5590729e816591c52a234821 | RomanMatiiv/algorithms_HSE | /hw/hw3/task_C.py | UTF-8 | 1,697 | 4.15625 | 4 | [] | no_license | """
Задача C. Массивы (python)
Даны два массива.
Для каждого элемента второго массива определите,
сколько раз он встречается в первом массиве.
Используйте lower_bound и upper_bound, а также вычитание итераторов.
Первая строка входных данных содержит одно число
N – количество элементов в первом массиве.
Далее идет N ... | true |
bc111d8577d0ab828703911ea2810fec42b12ffe | aldabbagh/Classes | /CV/ps02/ps2.py | UTF-8 | 12,758 | 3.421875 | 3 | [] | no_license | """Problem Set 2: Edges and Lines."""
import math
import numpy as np
import cv2
def hough_lines_acc(img_edges, rho_res, theta_res):
""" Creates and returns a Hough accumulator array by computing the Hough Transform for lines on an
edge image.
This method defines the dimensions of the output H... | true |
8c37fdfcc907d53b1a36a6229958828c6d3a23be | mohamedhalim1998/ROS-playground | /src/hello_world/scripts/move_turtle.py | UTF-8 | 773 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
from sys import argv
def pose_callback(pose):
rospy.loginfo("Robot pose: %s", pose)
def controller(linear, angle):
rospy.init_node("turtle_control", anonymous=True)
pub = rospy.Publisher("/turtle1/cmd_vel... | true |
48063d34624334e3f03a7a384e85f2591627fdf6 | ueneid/adventcode2020 | /day13/answer.py | UTF-8 | 1,482 | 3.015625 | 3 | [] | no_license | import os
from functools import reduce
current_dir: str = os.path.dirname(__file__)
inputs: list[str] = []
estimated_departing_time = 0
with open(os.path.join(current_dir, "input.txt")) as file:
estimated_departing_time = int(file.readline().strip())
inputs = [id for id in file.readline().split(",")]
def par... | true |
16f23aa0dd7f80c2bfbe2d376a8a53fa3bec120a | caiorss/prelude | /prelude/ControlFlow.py | UTF-8 | 2,833 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
def retry(call, tries, errors=Exception):
for attempt in range(tries):
try:
return call()
except errors:
if attempt + 1 == tries:
raise
def ignore(call, errors=Exception):
try:
return call(... | true |
f7cbf56267b6a338ea2932dd0c5028ceb6fc98db | jeyries/fishionary | /tools/convert_html_to_json.py | UTF-8 | 2,352 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# conversion CSV vers JSON
# export PYTHONIOENCODING=utf-8
import sys, os
import xml.parsers.expat
import json
import codecs
############## HTML table extractor
class TableHTMLHandler:
def __init__(self):
self.table = []
self.tr = []
self.td = []
s... | true |
1d92082175f5a0bf1e1a2d0e1de669ff29bf95cf | sirken/coding-practice | /codewars/7 kyu/find-the-divisors.py | UTF-8 | 1,197 | 4.40625 | 4 | [
"MIT"
] | permissive | from Test import Test, Test as test
'''
Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#) (use Either Str... | true |
b2f0dc01b630c7f2ccac4f9958192670a7b6d0da | jingweimo/mcSIM | /tests/tools_unittest.py | UTF-8 | 4,974 | 3.046875 | 3 | [] | no_license | import unittest
import analysis_tools as tools
from scipy import fft
import numpy as np
import numpy.fft
import matplotlib.pyplot as plt
from matplotlib.colors import PowerNorm
class TestTools(unittest.TestCase):
def setUp(self):
pass
def test_resample(self):
"""
Compare resampling i... | true |
948b0364ae973dee734980097822f043b13b7064 | andrecrjr/Collita-TCC | /tls-refresh.py | UTF-8 | 263 | 2.78125 | 3 | [] | no_license | import requests
import ssl
pagarme_request = requests.get("https://tls12.pagar.me");
if pagarme_request.status_code == 200:
print(pagarme_request.text)
else:
print("Sua versão SSL é: " + ssl.OPENSSL_VERSION)
print("Sua versão deve ser superior à 1.0.1c") | true |
a7210443d305b9bbc14890cea17414086450aff3 | jcrain1/GBS | /Archive/blank_dna_quant_report_v05_p2.py | UTF-8 | 5,839 | 2.765625 | 3 | [] | no_license | #/usr/bin/python
#
# Program: blank_dna_quant_report.py
# Version: 0.5 Sept 9,2014 Added ability to input comma separated list of DNA plate IDs
# Removed on-screen results table output.
# 0.4 August 27,2014 Improved command line option handling
# ... | true |
bff20a7b4590e6d84bcbac276b91ded6e5194c9a | FrenchBear/Python | /Learning/064_OpenWeatherMap/weather.py | UTF-8 | 797 | 2.875 | 3 | [] | no_license | # Weather.py
# Learning Python
# From https://www.hackster.io/gatoninja236/real-time-weather-with-raspberry-pi-4-ad621f
#
# 2019-08-28 PV
import time
import requests
from pprint import pprint
with open(r'C:\Utils\Local\openweathermap.txt', encoding='utf_8') as f:
api_key = f.read()
settings = {
'api_key':... | true |
4e99761be600c8b7774e5b5d2c8427476633689e | Mps24-7uk/Todays-Petrol-Price | /Python code.py | UTF-8 | 441 | 2.96875 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
page=urlopen("http://www.sify.com/finance/today-petrol-price/")
soup5=BeautifulSoup(page)
table=soup5.find_all("table")[0]
data=[[column.text for column in row.find_all('td') ] for row in table.find_all('tr')]
Current_Price=pd.Dat... | true |
df51e83948b4c388445d8ccde6fecb010bf23e01 | wuqin0791/nlp_related_exercise | /lesson1/homework_program1.py | UTF-8 | 3,337 | 3.21875 | 3 | [] | no_license | #这是我的编程实践部分,第一个程序
import jieba
from collections import Counter
corpus = '/Users/jeannewu/Documents/project/nlp_related_exercise/lesson1/train.txt'
FILE = open(corpus.strip(), 'r').read()
#以下是corpus文件的分词情况
def cutOriginal():
content = FILE.replace('++$++','')
content1 = content.replace(' ','')
content2 = co... | true |
5777648972d6cfba5871d5cf5f018014f600a929 | NaNdalal-dev/hacker-rank-problems | /programs/twice_as_old.py | UTF-8 | 416 | 3.96875 | 4 | [] | no_license | """
Link:
https://www.codewars.com/kata/5b853229cfde412a470000d0/train/python
Your function takes two arguments:
current father's age (years)
current age of his son (years)
Сalculate how many years ago the father was twice as old as his son
(or in how many years he will be twice as old).
"""
twice_as_old = lambda da... | true |
99a0596bfd9bec372f3a8990ed1ab305c9587c5b | Eric-cv/PIL | /02-image_crop.py | UTF-8 | 358 | 3 | 3 | [] | no_license | # coding=utf-8
# @Time :2020/5/6 0006 15:33
# @Author :Eric
# @Email :zhangqi_@pku.edu.cn
# @File :02-image_crop.py
# @Software :PyCharm
from PIL import Image
# 1.加载图片
image1 = Image.open(r'.\files\a1.jpg')
image1.show()
# 2.图片剪切
# crop(范围)
# 范围 - (点1x,点1y,点2x,点2y)
image2 = image1.crop((300, 300, 700, 70... | true |
744cb8d02903741456b37d5e66986a04c1743315 | pratik2601/tutorial_linux | /scripts/print_names.py | UTF-8 | 175 | 3.328125 | 3 | [] | no_license | """
This python files reads the data from 'name.txt'
and print the data present on line.
"""
f=open("name.txt")
data=f.readlines()
for line in data:
print(line)
f.close()
| true |
c5e39f4c7889b5b6c7507157dd10130926f74256 | kiccho1101/atcoder | /abc/232/d.py | UTF-8 | 753 | 3 | 3 | [] | no_license | class Solver:
def __init__(self):
self.h, self.w = map(int, input().split())
self.field = [list(input()) for _ in range(self.h)]
self.ans = 0
self.vis = [[-1] * self.w for _ in range(self.h)]
def dfs(self, y, x, d):
if self.vis[y][x] != -1:
return self.vis[y]... | true |
a3a459a1c657bcc32ba0c9f1bd31f0f9921cbefc | PathagarBooks/fetch_ia_item | /fetch_ia_item.py | UTF-8 | 7,424 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
"""
This script will download all of an user's bookmarked items from archive.org.
"""
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import settings
import re
import os
import sys
import json
import time
import urllib
import subprocess
# Cus... | true |
a79f085e7c4319d47dc5722bc57ab2c5a2dbbd7b | ProneToAdjust/Reminder-System | /reminder_system/timer_loop.py | UTF-8 | 1,221 | 3.625 | 4 | [
"MIT"
] | permissive | from threading import Timer
class TimerLoop:
def __init__(self, interval, function):
self.interval = interval
self.function = function
self.timer_thread = None
def start(self):
self.__create_new_timer_thread()
self.__start_timer_thread()
def stop(self):
se... | true |
163e0034af894a9a7ead6fc469d11e2a2b917cf5 | Ghuashang/GoodShears | /GoodShearTestCase/ToastDemo.py | UTF-8 | 1,768 | 2.65625 | 3 | [] | no_license | # 导入webdriver库
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time
#定义空字典
device_info={}
device_info['platformName']='Android'#设备平台
device_info['platformVersion']="6.0.1"#设备系统版本
device_info["deviceName"]="DUK_AL20"#设备名称
device_info["device"]="hlteuc"#设备厂商信息
device_info["app"... | true |
abdc63afe1b8593eba89c5b21fc3a1e59ddd0afc | clagms/PyCosimLibrary | /src/PyCosimLibrary/jacobit_it_runner.py | UTF-8 | 3,997 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | from typing import List
from PyCosimLibrary.runner import CosimRunner
from PyCosimLibrary.scenario import CosimScenario, VarType
import numpy as np
class JacobiIterativeRunner(CosimRunner):
def __init__(self, max_iterations: int, tol: float):
self.max_iterations = max_iterations
self.to... | true |
e6e1b7055590ebe0660fbb84356263f9a06684b1 | nikhilsaraf/world-cup-predictor | /model/team.py | UTF-8 | 733 | 2.84375 | 3 | [
"MIT"
] | permissive | class Team:
def __init__(self, name, cost):
self.name = name
self.cost = cost
self.stats = Stats()
self.score = 0
def __repr__(self):
return "Team({}, cost={})".format(self.name, self.cost)
class Stats:
def __init__(self, champions=0, runner_up=0, third=0, win=0, dr... | true |
1d7ec8c6f87f4ef89da1a580eab9d2c4d9ec4d0c | itsdeepesh5/PythonProblems | /test3.py | UTF-8 | 218 | 2.8125 | 3 | [] | no_license |
str="172a.17.1.23"
cnt=[]
for i in str.split("."):
cnt.append(i)
try:
if int(i) < 255:
print("valid")
else:
raise ValueError
except ValueError:
print("invalid")
exit
| true |
11c21d8e222b042a19ef320471a4259dad6e7d47 | marcovnyc/penguin-code | /Python_Talk/mpt-master/ch02/get_score.py | UTF-8 | 152 | 3.015625 | 3 | [] | no_license | scores = {'blue':10, 'white':12}
print(scores['blue'])
print(scores['white'])
print(scores.get('yellow'))
print(scores.get('yellow',0))
| true |
e33f1803af34ca2d27b1141342979f8c016d1154 | ElyasRashno/Face-Feature-Extraction | /FaceLib-Age_Gender_Emotion/facelib/AgeGender/models/train.py | UTF-8 | 2,505 | 2.640625 | 3 | [
"MIT"
] | permissive | """
Sajjad Ayoubi: Age Gender Detection
I use UTKFace DataSet
from: https://susanqq.github.io/UTKFace/
download it and put it on FaceSet dir
and I create a annotation file data.npy
which there is in weights folder
"""
from PIL import Image
import numpy as np
import torch
import torch.nn.functional as F
import torch.op... | true |
ca4dc59709e1a94394c5b125bd442760f5df5b42 | Ti-Ho/git_zth | /Python学习/MachineLearningFile/决策树/Demo/DesisionTree/__init__.py | UTF-8 | 702 | 3.140625 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
clf = tree.DecisionTreeClassifier()
clf = clf.fit(iris.data, iris.target)
# # export the tree in Graphviz format using the export_graphviz exporter
with open("iris.dot", 'w') as f:
f = tree.export_graphviz(clf, out_file=f)
# predi... | true |
0a808075409c659ab7e0206cf9788990a7b031ae | SmartPracticeschool/llSPS-INT-3231-Sentiment-Analysis-of-twitter-data-Using-Deep-Learning | /Twitter/Project/app.py | UTF-8 | 927 | 2.59375 | 3 | [] | no_license | from flask import render_template, Flask, request
from keras.models import load_model
import pickle
import tensorflow as tf
graph = tf.get_default_graph()
with open(r'CountVectorizer','rb') as file:
cv=pickle.load(file)
cla = load_model('twitter.h5')
cla.compile(optimizer='adam',loss='binary_crossentropy')
app = F... | true |
3bcc409ca92a2c65e3d682077113fa4f84479329 | Sharmi61/python-programming | /player level/p20.py | UTF-8 | 575 | 3.046875 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: sharmi
#
# Created: 22-07-2018
# Copyright: (c) sharmi 2018
# Licence: <your licence>
#-------------------------------------------------------------------------------
... | true |
695a6b330967457061ea3f9fe7bb16237bce4098 | nicoaizen/Fundamentos_de_informatica_Aizen | /Práctica_POO/ej7.py | UTF-8 | 1,635 | 3.9375 | 4 | [] | no_license | #7
# Definí una clase de gorriones, de los cuales nos interesa conocer dos medidas conocidas como CSS (coeficiente de serenidad silenciosa),
# CSSP y CSSV (como el CSS pero “pico” y “veces”). El CSS resulta de dividir la cantidad total de kilómetros que vuela desde que se lo
# comienza a estudiar, por la cantidad tot... | true |
9b00ec05eadfe8e34efa7dfbc8c53ed423366ef6 | dhammikepiyumal/Pong | /Pong.py | UTF-8 | 3,169 | 3.640625 | 4 | [] | no_license | import turtle
import winsound
# Game window setup
window = turtle.Screen()
window.title("Pong 1.0")
window.bgcolor("black")
window.setup(width=800, height=600)
window.tracer(0)
# Paddle A
paddleA = turtle.Turtle()
paddleA.speed(0)
paddleA.shape('square')
paddleA.color('white')
paddleA.shapesize(stretch_len=1, stret... | true |
ea5d56c7bd0a0b8c134456e1e63612d865ec53e5 | Guillermo-Arjona/githubtarea1 | /Tarea1.py | UTF-8 | 3,619 | 3.65625 | 4 | [] | no_license | import sqlite3
BASE_DE_DATOS = "diccionario.db"
def obtener_conexion():
return sqlite3.connect(BASE_DE_DATOS)
def crear_tablas():
tablas = [
"""
CREATE TABLE IF NOT EXISTS diccionario(
id INTEGER PRIMARY KEY AUTOINCREMENT,
palabra TEXT NOT NULL,
significado... | true |
b8346cb07e136441a0a771da418f3c628d2bfc34 | indrer/ytcsc | /util/acronyms_smileys.py | UTF-8 | 6,782 | 2.578125 | 3 | [] | no_license | # https://www.netlingo.com/acronyms.php
# https://blog.adioma.com/internet-acronyms-intro-list-infographic/
acronyms = {
'btw': 'by the way',
'afaik': 'as far as i know',
'afk': 'away from keyboard',
'asap': 'as soon as possible',
'atm': 'at the moment',
'af': 'as fuck',
'bbl': 'be back late... | true |
1a7058101d444372d723607140b6138a684350eb | toschoch/analysis-hackathon-permafrost | /doitutils/collect.py | UTF-8 | 1,882 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# created: 27.02.2018
# author: TOS
import logging
import inspect
import importlib as imp
import pkgutil
log = logging.getLogger(__name__)
def collect_from_module(path, collect, exclude_module=[]):
"""
recursively iterates through packages in path, imports all modu... | true |
f0373165cb3b0e1f9dacc05380789dd2512c1214 | wojtekgradzinski/WojtekRepo | /GROUP PROJECT/ROCK SCISORS PAPER/handgestures/game.py | UTF-8 | 5,920 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[6]:
from sklearn import metrics
import time
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
import numpy as np
from PIL import Image
import os
import pandas as pd
from sklearn.... | true |
3e046c90688d88f3dca794624fd021d4ac15768d | igizm0/SimplePyScripts | /pynput__key_listener.py | UTF-8 | 521 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
if __name__ == '__main__':
def on_press(key):
print('on_press', str(key), key, type(key))
def on_release(key):
print('on_release', str(key), key, type(key))
from pynput import keyboard
with keyboard.Listener(on_p... | true |
de192eb715e086b0d6c4d361790e9786e1ae3b68 | aeroshev/gendiff | /gendiff/products/product_config.py | UTF-8 | 6,954 | 3 | 3 | [
"MIT"
] | permissive | """
Этот модуль содержит в себе продукты типа INI
Различие этих классов заключается в разном
типе рендеринга результата
Все общие методы для обоих классов определены
в абстрактном классе
"""
import configparser
from abc import abstractmethod
from io import TextIOWrapper
from typing import Any, Dict, List, Set
from gen... | true |
3c7fb8ab93500a8f10d5611676b1cd732bc825d8 | ibarchakov/MIPT | /Lecture8 - Recursions/task7 - dragon curve.py | UTF-8 | 444 | 3.796875 | 4 | [] | no_license | import turtle
def dragon_curve(length, n):
def x(n):
if n == 0:
return
x(n - 1)
turtle.right(90)
y(n - 1)
turtle.forward(length)
def y(n):
if n == 0:
return
turtle.forward(length)
x(n - 1)
turtle.... | true |
8d91da8a965c2845fc1f65014759170843d5d902 | VisakK/MuscleDynamics | /FitShoulderMA.py | UTF-8 | 752 | 3.046875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
angles = [0,25,50,75,100]
ad_ma = [1.,1.75,2.5,4.0,4.9]
ad_ma[:] = [x*0.1 for x in ad_ma]
pd_ma = [-2.3,-3.0,-3.2,-1.6,0]
pd_ma[:] = [x*0.1 for x in pd_ma]
ad_coefs = np.polyfit(angles,ad_ma,3)
print("ad coeffs",ad_coefs)
pd_coefs = np.polyfit(angles,pd_ma,3)
print... | true |
7d8eb775cf7191070c3a60e1567968db2dd75746 | antobom/Reinforcement-Learning-Agents | /train_deepQ_agent.py | UTF-8 | 1,842 | 2.625 | 3 | [] | no_license | from DeepQLearning import DeepQAgent, training_loop
import gym
from threading import Thread
from multiprocessing import Process
envs = []
agents = []
for i in range(4):
envs.append(gym.make("MountainCar-v0"))
env = envs[0]
agent = DeepQAgent(name = "agent1", action_space=env.action_space, observation_space=env... | true |
835973b96f95f962a5c9f336728d03af8f3cca41 | cloudgc/data-statistics | /pandas/readfile.py | UTF-8 | 811 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
filepath = './read.xlsx'
xls = pd.ExcelFile(filepath)
salesDf = xls.parse("Sheet1", dtype='object')
print(salesDf.describe())
print(salesDf.head())
print(salesDf.loc[:, 'name':'money'])
search = salesDf.loc[:, 'num'] > 2
print(salesDf.loc[search, :])
print(salesDf.shape)
cy2016 = './cy2016.xls... | true |
26434c7e752cf4177b6d3088d8716cd4ee2ace9c | Deigaarden/robocup | /main.py | UTF-8 | 2,267 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port, Stop, Direction, Button, Color
from pybricks.tools import wait, St... | true |
6e615ba57a46c626ecb4f5e35cc3a1f7a6d6183d | Wakingupdream/pytorch_learn | /neural network/logistic_regression.py | UTF-8 | 755 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# !/usr/bin/env python
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
class LogisticRegression(nn.Module):
def __init__(self):
super(LogisticRegression, self).__init__()
self.linear = nn.Linear(1, 1)
def forward(self, x):
... | true |