blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
5a55ebfcb0486172c7df66cc89c4277592e4d2f6 | Python | liuxiao214/Leetcode_Solutions_Python | /Excel_Sheet_Column_Number.py | UTF-8 | 545 | 3.484375 | 3 | [] | no_license | class Solution(object):
def titleToNumber(self, s):
"""
:type s: str
:rtype: int
"""
sum=0
i=len(s)-1
while(i>=0):
sum=sum+(ord(s[i])-64)*(26**(len(s)-i-1))
i=i-1
return sum
class Solution1(object):
def titleToN... | true |
d3a9d7a8f5141b053f570d2f32d503cd1a3128cd | Python | wpy-111/python | /Spider/day01/08_group_exercise.py | UTF-8 | 419 | 3.125 | 3 | [] | no_license | c = """<div class="animal">
<p class="name">
<a title="Tiger"></a>
</p>
<p class="content">
Two tigers two tigers run fast
</p>
</div>
<div class="animal">
<p class="name">
<a title="Rabbit"></a>
</p>
<p class="content">
Small white rabbit white and white
</p>
</div>
... | true |
b3875d7b624f9e610750ecbcc35864fd77e150f6 | Python | mada949/dfs-lineup-generator | /NbaConverter.py | UTF-8 | 3,104 | 2.609375 | 3 | [] | no_license | import csv
import sys
import datetime
import re
import os.path
with open('./nba/inputs/{}/{}/players.csv'.format(sys.argv[1], sys.argv[2]), 'w+') as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
writer.writerow(["Player Name", "Pos", "Salary", "Team", "Proj FP", "Actual F... | true |
52f127ca6272a585d7239b280c50e6c8630251d3 | Python | miladnavi/few-shot-learning | /few_shot_generator.py | UTF-8 | 7,033 | 2.640625 | 3 | [] | no_license | import argparse, os
import os
import tarfile
import glob
import shutil
import random
import torch
import torchvision.datasets
import os
def few_shot_dataset_mnist(number_of_sample):
source_path_unzip = './Dataset/MNIST.tar.gz'
destination_path = './Few_Shot_Dataset'
real_dir_name = '/mnist_png'
c... | true |
cf267edfa60b9a9000e42155dcc8219c0d85b66f | Python | ansd15000/baekjoon | /step/level 7 (String)/5622_다이얼.py | UTF-8 | 379 | 3.390625 | 3 | [] | no_license | import sys
ascdial = ['A', 'D', 'G', 'J', 'M', 'P', 'T', 'W', '['] # 아스키 Z값 다음이 [
a = sys.stdin.readline().rstrip()
result = 0
for i in a:
for j in range(len(ascdial)):
if i >= ascdial[j] and i < ascdial[j+1]:
result += j
result += 3 # 앞파벳이 할당되는 다이얼은 숫자2부터라 +1, 다이얼 위치당 +2 = 3
print(result)
| true |
6a24810ad7790195b21da9c9dd81114fa5328913 | Python | UWNETLAB/Nate | /nate/svonet/svo_degree_over_time.py | UTF-8 | 10,339 | 2.59375 | 3 | [
"MIT"
] | permissive | from nate.svonet.graph_svo import generate_ticks, find_max_burst
import networkx as nx
import stop_words as sw
import copy
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.ticker import MaxNLocator
import numpy as np
from multiprocessing impo... | true |
8fe0e1dcb5109242bf10fd2644bc37cbfa1242f7 | Python | duckythescientist/fixedint | /fixedint/tests/test_promotions.py | UTF-8 | 783 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
from nose.tools import assert_raises
from fixedint import *
def test_ordered_promotion():
spam = uint16(42)
eggs = spam + 1
assert isinstance(eggs, uint16)
assert eggs == 43
eggs = 1 + spam
assert not isinstance(eggs, uint16)
assert eggs == 43
def test_soft_cast(... | true |
0dd7f0dfa59923044083f3111660240b63d7b0e3 | Python | Mjheverett/python_dictionaries | /Medium_Exercises/1letter_summary.py | UTF-8 | 227 | 3.90625 | 4 | [] | no_license | input_string = input("Please enter a word: ")
string_dictionary = {}
for i in input_string:
if i in string_dictionary:
string_dictionary[i] += 1
else:
string_dictionary[i] = 1
print(string_dictionary) | true |
9f0a9becd0ff4db1ddea72ceb6250323d26d6615 | Python | baitik07/project1 | /Dm1.py | UTF-8 | 3,242 | 4.1875 | 4 | [] | no_license | # if 12**3 > 13*7:
# print("12**3 bigger")
# elif 12**3 < 13*7:
# print("13*7 bigger")
# else:
# print("Equal")
# if 4**5 > 512+512:
# print("4**5 bigger")
# elif 4**5 < 512+512:
# print("512+512 bigger")
# else:
# print("Equal")
# a = 17925
# print("a = 17925")
# if a < 34**2:
# print(... | true |
3563bfc95963c58b5d9c9d479e7ebdea4940ade4 | Python | Surbeivol/daily-coding-problems | /problems/number_possible_binary_topologies.py | UTF-8 | 504 | 3.875 | 4 | [
"MIT"
] | permissive | """
Write a function that takes in a non-negative integer n and that returns the number of possible Binary Tree configuration, irrespective of node values. For instance, there exist only two Binary Tree topologies when n is equal to 2: a root node with a left node, and a root node with a right node. Note than wen n is ... | true |
d20f2d0266696f8c9d5fd6730e467e7666d1954a | Python | fregataa/Algorithm-Python | /Programmers/Traffic.py | UTF-8 | 849 | 2.671875 | 3 | [] | no_license | def solution(lines):
answer = 0
jobs = []
timeline = []
for line in lines:
tmp = line.split()
s = tmp[1].split(':')
hour, minute, sec = map(float, s)
t = float(tmp[2].strip('s'))
end = (hour*3600 + minute*60 + sec)*1000
start = end - t*1000 + 1
job... | true |
5e712fe79c5f5285f961c0dded4095a91ea8a61a | Python | withjeffrey/PythonLearning | /6Class.py | UTF-8 | 4,677 | 3.8125 | 4 | [] | no_license |
# coding: utf-8
# In[3]:
#6-1:类的定义与实例化
class MyClass:
"MyClass help."
myclass = MyClass()
print(myclass.__doc__) #输出类说明
help(myclass) #显示类帮助信息
# In[4]:
#6-2:类的方法的定义与使用
class SmplClass:
def info(self):
print('my class')
def mycacl(self,x,y):
return x + y
sc = SmplClass()
sc.info... | true |
e350d0b1b9345d1fa2dce58cf482c0c0ca2ae83c | Python | michielborghuis/IPASSBackUp | /ipass6/MainGUI.py | UTF-8 | 1,275 | 2.96875 | 3 | [] | no_license | from tkinter import *
from ipass6.GUI import GUI
class MainGUI:
def __init__(self):
self.root = Tk()
self.label1 = Label(self.root, text='Advanced SIR model for disease spread.',
font=('Calibri', 20)).grid(row=0, columnspan=2)
self.label2 = Label(self.root, tex... | true |
76d2a62df381064442b924e2541fd3847cf6a75d | Python | sreekanesh/mycaptain | /positive_int.py | UTF-8 | 421 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 26 21:22:45 2021
@author: sreekanesh
"""
lst=[]
n=int(input('enter the number of elements :'))
for i in range(0,n):
elements=(int(input()))
lst.append(elements)
def positive_num():
for item in lst:
if item < 0:
... | true |
fe14d54a668940e5b01c3cdec5b54643af0af6f8 | Python | yukselh20/Python | /btkEgitim/tekrar-.py | UTF-8 | 896 | 3.71875 | 4 | [] | no_license | sampleString = """ Phyton's name does not come from a
'snake'""" # 3 tırnak işareti ile yazılan stringler aynı şekilde bastırılır.
print(sampleString)
name = "Atilla"
surname = "İlhan"
formattedMassage = f"{name} [{surname}] is poet"
formattedMassage1 = f"{name:10} [{surname:10}] is poet"
formattedMassage2 = f"... | true |
d2d44650350ad2e9d684f09637afd5bd2d4f110e | Python | kundan4U/ML-With-Python- | /ML With python/practice/p2.py | UTF-8 | 112 | 3.296875 | 3 | [] | no_license | #Areacal
n1=eval(input("plese enter length"))
n2=eval(input("plese enter weight"))
a=n1*n2
print("Area is :",a) | true |
ff286c17f17e15b8fe8ff17145b65decaadeeab5 | Python | kasem777/Python-codeacademy | /Loops/over9000.py | UTF-8 | 895 | 4.71875 | 5 | [] | no_license | # Over 9000
# Create a function named over_nine_thousand() that takes a list of numbers
# named lst as a parameter.
# The function should sum the elements of the list until the sum is greater
# than 9000. When this happens, the function should return the sum.
# If the sum of all of the elements is never greater than 9... | true |
f8220dd8c996fceb1278ff9a4158c04c8d514301 | Python | alagoutte/pyaoscx | /pyaoscx/exceptions/parameter_error.py | UTF-8 | 752 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # (C) Copyright 2019-2021 Hewlett Packard Enterprise Development LP.
# Apache License 2.0
from pyaoscx.exceptions.verification_error import VerificationError
class ParameterError(VerificationError):
"""
Exception class for Verification fails of function of method parameters.
Raised mainly when wrong para... | true |
7e919fa2805499e74972fe9fc1d10eacc1079d2f | Python | AsPhilosopher/tensorflow | /ml/haar-adaboost.py | UTF-8 | 1,829 | 3.140625 | 3 | [] | no_license | # haar 特征 = 像素经过运算得到的结果(具体值 向量 矩阵 多维)
# 如何运用特征区分目标? 如阈值判决等
# 如何得到阈值判决?机器学习
# 1 特征 2 判决 3 得到判决
# haar有一系列模板 滑动 缩放 运算量大
# 举例 1080*720 10*10
# 计算量=14模板 * 20缩放 * (1080/2*720/2) * (100点+-) = 50-100亿
# 实时处理 15祯 (50-100)*15 = 1000亿次
# 积分图
# haar + Adaboost face
# Adaboost分类器将错误样本不断加强
# 训练终止条件:1 for count 2 p(误差概率)
# haar> T1 ... | true |
73c4f0038829d3ff58766faef6f48a80f4a63da5 | Python | WuDiDaBinGe/BiNTM | /utils/contrastive_loss.py | UTF-8 | 14,510 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021/7/8 上午9:49
# @Author : WuDiDaBinGe
# @FileName: contrastive_loss.py
# @Software: PyCharm
import torch
import torch.nn as nn
import math
import numpy as np
class InstanceLoss(nn.Module):
def __init__(self, batch_size, temperature, device):
super(InstanceLoss, self... | true |
0f80504c48250957f48023b48d5b25d9f968ed2d | Python | thrashlover/stepik | /python_part_2.3.1.py | UTF-8 | 611 | 2.84375 | 3 | [] | no_license | import math
from selenium import webdriver
link = "http://suninjuly.github.io/redirect_accept.html"
browser = webdriver.Chrome()
browser.get(link)
browser.find_element_by_css_selector('.btn-primary').click()
new_window = browser.window_handles[1]
# first_window = browser.window_handles[0]
browser.switch_to.window... | true |
c190adee5c1c731fa8e83ab44ad2bc591999722f | Python | Hithru/hacktoberfest2k | /scripts/tan-theressa-2.py | UTF-8 | 120 | 2.75 | 3 | [] | no_license | def hello_world():
""" function to print "Hello World"
"""
hello_text = "Hello World"
print (hello_text) | true |
9f7d5f2ecdec7f68bf7a5ba309d50b8062e03e11 | Python | letmecode1/python | /data_types/string.py | UTF-8 | 800 | 3.703125 | 4 | [] | no_license | single_qoutes = 'This is John'
double_qoutes = "This is Max"
print(single_qoutes)
print(double_qoutes)
triple_qouted = '''
this is a triple
qouted string
'''
print(triple_qouted)
password = "pass" + "word"
print(password)
ha = "HA" * 5
print(ha)
string = "What does the fox say?"
print(string.find("say")) # true, s... | true |
256fe91760390aa4cab1225de8361543d29552c4 | Python | HenryDaiCode/PEulermusings | /Problem 012.py | UTF-8 | 522 | 3.53125 | 4 | [] | no_license | from math import sqrt
from math import ceil
#Returns nth triangle number
def tri(n):
return ((n * n) + n) // 2
mostdivisors = 0
i = 1
while mostdivisors <= 500:
halfdivisors = 0
trinum = tri(i)
for j in range(1, ceil(sqrt(trinum))):
if trinum % j == 0:
halfdivisors += 1
divisors... | true |
734d79159cdfc164ed4b79b22578fcf4d23eed22 | Python | daniel-hasan/ml-metodo-hierarquico | /gera_experimentos.py | UTF-8 | 2,666 | 2.53125 | 3 | [] | no_license | from base_am.resultado import Fold
from base_am.avaliacao import Experimento
from competicao_am.metodo_competicao import MetodoHierarquico, MetodoTradicional
from competicao_am.avaliacao_competicao import OtimizacaoObjetivoSVMCompeticao
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
def gera_e... | true |
7c393b8e0046e489ee0d8e09778d9c759be28a71 | Python | nathanhilton/PythonPals | /PythonPals/Button.py | UTF-8 | 4,658 | 3.265625 | 3 | [] | no_license | import pygame
from pygame.locals import *
class button():
def __init__(self, color, x, y, width, height, text=''):
self.color = color
self.x = x
self.y = y
self.width = width
self.height = height
self.text = text
def modify(self, x, y, width, heigh... | true |
b84bd4fd10135938531e50604ca50b74ab45397e | Python | awani216/FlightFuel | /codes/test.py | UTF-8 | 1,324 | 2.78125 | 3 | [] | no_license | import numpy as np
from numba import jit
import matplotlib.pyplot as plt
import time
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn import svm
from sklear... | true |
e9a6fb887debf8a9a2053beb72c1f8b146231037 | Python | cl19951225/syntheticdatagen | /evaluations/disc_and_preds/metrics/predictive_metrics3.py | UTF-8 | 10,101 | 2.65625 | 3 | [] | no_license |
# Necessary Packages
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Layer, Conv1D, GRU, Flatten, Dense, Input, TimeDistributed
from tensorflow.keras.models import Model
from tensorflow.keras.losses import BinaryCrossentropy, MeanAbsoluteError
import numpy as np
f... | true |
02fe542f602dd29b0760173bb41126cae9289d73 | Python | kjng/python-playground | /python-crash-course/Alien_Invasion/ship.py | UTF-8 | 1,161 | 3.703125 | 4 | [] | no_license | import pygame
class Ship():
def __init__(self, settings, screen):
"""Initialize ship and set its starting position"""
self.screen = screen
self.settings = settings
# Load ship image and get rectangle
self.image = pygame.image.load('ship.bmp')
self.rect = self.image.get_rect()
self.screen... | true |
0803a758f415ff5dd5afa4ac9195b80b42cfb35e | Python | akantuni/Codeforces | /1547C/Pair Programming.py | UTF-8 | 1,637 | 2.5625 | 3 | [] | no_license | t = int(input())
for j in range(t):
input()
k, n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
file_len = k
check = True
actions = []
for i in range(len(a)):
if a[i] > file_len:
if len(b) > 0:
... | true |
2cfcddee6b0c147d36669c7361bf92a00434688b | Python | CooperStansbury/owl_tools | /aporia/scripts_and_data/get_data.py | UTF-8 | 4,591 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from __future__ import print_function # for 2.7 users
import pandas as pd
import argparse
import os
import owlready2 as ow
import subprocess
# function to traverse up the is_a tree
def get_tree(node, path):
# add each node to the path
if node not in path:
path.append(node)
... | true |
6f371030ac5369d6e9893046c1e469dff6eaa9bc | Python | MinMinOvO/leetcode-code-share | /0133 Clone Graph/19-08-16T16-10.py | UTF-8 | 947 | 3.390625 | 3 | [] | no_license | """
# Definition for a Node.
class Node:
def __init__(self, val, neighbors):
self.val = val
self.neighbors = neighbors
"""
from collections import deque
from copy import copy
class Solution:
def cloneGraph(self, node: 'Node') -> 'Node':
if node is None:
return None
n... | true |
de65bb35d2b303aa00dc93dbb1e01d489c638c0d | Python | xuejiekun/cv-demo | /demo_split.py | UTF-8 | 2,369 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sky.cv import *
def demo_split(filename):
def create_trackbar(winname):
cv2.createTrackbar('pos', winname, 130, 255, lambda x: x)
cv2.createTrackbar('gauss', winname, 1, 1, lambda x: x)
cv2.createTrackbar('ksize', winname, 3, 31, lambda x: x)
cv2.creat... | true |
c14e1bf0c6bbb2a377249803c4e3a0cdd03d4b0c | Python | urnotyuhanliu/ormuco | /questionB.py | UTF-8 | 853 | 3.28125 | 3 | [] | no_license | def compareVersion(version1, version2):
versions1 = [int(v) for v in version1.split(".")]
versions2 = [int(v) for v in version2.split(".")]
for i in range(max(len(versions1),len(versions2))):
v1 = versions1[i] if i < len(versions1) else 0
v2 = versions2[i] if i < len(vers... | true |
7e87977cf5d9cc81edc522b3e42d4da283e32eb8 | Python | deerajnagothu/pyaes | /RSA only/single_server_fog_rsa.py | UTF-8 | 1,474 | 3.0625 | 3 | [
"MIT"
] | permissive | import socket # Import socket module
import rsa
(server_public, server_private) = rsa.newkeys(128)
print(type(server_public['n']))
str_pub = str(server_public)
port = 60000 # Reserve a port for your service.
s = socket.socket() # Create a socket object
host = socket.geth... | true |
fbc8f599c3a4737ee528cc19a10b4955dc1a2903 | Python | fikrihasani/NLP_Tweet | /preprocessing.py | UTF-8 | 1,572 | 3.109375 | 3 | [] | no_license | # imports
import re
from string import punctuation
# class
class Preprocessing():
# variables
def __init__(self):
self.tweets_processed = []
self.tweets_splitted = []
self.kelas = []
# methods
def normalization(self,sentence):
return sentence
def Remove_Punctuation... | true |
611e5f0782cfa2893a39ca3a778e1d4b92ad291b | Python | tklutey/ffldraft | /src/draft/state.py | UTF-8 | 745 | 2.78125 | 3 | [] | no_license | # import pandas as pd
#
# import configurations
# from src.DraftState import DraftState
#
#
# def get_state(freeagents):
# num_competitors = 2
#
# num_rounds = 16
# turns = []
# # generate turns by snake order
# for i in range(num_rounds):
# turns += reversed(range(num_competitors)) if i % 2... | true |
2d02b017161ed2b10c48b89660190341f6875b30 | Python | alltheplaces/alltheplaces | /locations/spiders/vivacom_bg.py | UTF-8 | 1,846 | 2.546875 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import re
from scrapy import Spider
from locations.items import Feature
class VivacomBGSpider(Spider):
name = "vivacom_bg"
item_attributes = {
"brand": "Vivacom",
"brand_wikidata": "Q7937522",
"country": "BG",
}
start_urls = ["https://www.vivacom.bg/bg/stores/xhr?method=getJS... | true |
11db461001ab3b78d937796d4709d9593e7c5bd1 | Python | giangnguyen2412/coding-interview | /dynamic_programming/min_partition.py | UTF-8 | 634 | 3.046875 | 3 | [] | no_license | def findMinRec(arr, arr_len, calculated_sum, total_sum):
if (arr_len == 0):
return abs((total_sum - calculated_sum) - calculated_sum)
dct = min(findMinRec(arr, arr_len - 1, calculated_sum + arr[arr_len - 1], total_sum),
findMinRec(arr, arr_len - 1, calculated_sum, total_sum))
return... | true |
2c0f4eedee63f596d02abc0c2ccbb747d270597c | Python | samuelpeet/conehead | /temp2.py | UTF-8 | 1,237 | 3.046875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from numba import cuda
@cuda.jit(device=True)
def mandel(x, y, max_iters):
"""
Given the real and imaginary parts of a complex number,
determine if it is a candidate for membership in the Mandelbrot
set given a fixed number of iteration... | true |
550cfd9baa2f54636a2d44ad1f080af8c62cb2b7 | Python | shreyassk18/MyPyCharmProject | /Basic Programs/Fibonacci.py | UTF-8 | 271 | 4.375 | 4 | [] | no_license | #A series of numbers in which each number is the sum of the two preceding numbers
f1=0
f2=1
f = int(input("Enter a range\n"))
print("The fibonacci series for %d is:"%(f))
print(f1)
print(f2)
for i in range(1, f+1):
fib = f1+f2
print(fib)
f1=f2
f2=fib
| true |
7a514008f4c84094234b3a6ac97a0e90898f71f2 | Python | shankar7791/MI-10-DevOps | /Personel/Siddhesh/Practice/18feb/ShortHandIfElse.py | UTF-8 | 76 | 3.71875 | 4 | [] | no_license |
a = 85
b = 25
print("A") if a > b else print("=") if a == b else print("B") | true |
3afd5d56151d9181d8b2af7c58ec8e89c9fdf170 | Python | asinsinwal/Supervised-Learning | /supervised_sentiment.py | UTF-8 | 10,640 | 2.921875 | 3 | [] | no_license | import sys
import collections
import sklearn.naive_bayes
import sklearn.linear_model
import nltk
import random
random.seed(0)
from gensim.models.doc2vec import LabeledSentence, Doc2Vec
from collections import Counter
from sklearn.naive_bayes import BernoulliNB, GaussianNB
from sklearn.linear_model import LogisticRegres... | true |
b8131bdf74ea77af232bcb83fc4e8688d778dc33 | Python | yiyuli/CSAir | /graph/vertex.py | UTF-8 | 1,646 | 3.734375 | 4 | [] | no_license | class Vertex(object):
"""Vertex object.
Vertex object that stores name, population, country, region, code, continent, timezone, coordinates info and edges starting from it.
It also includes a function that stores an edge which starts from it.
"""
def __init__(self, metro):
"""Constructor o... | true |
505f7c93854e1a2bc1332f7b35d4d00c333ff291 | Python | oozd/network | /termProjectPart2/s.py | UTF-8 | 1,028 | 3 | 3 | [] | no_license | import socket
import hashlib
import sys
import os
import time
from random import randint
import subprocess
TCP_IP = "10.10.1.2" # brokers IP
TCP_PORT = 8080 # brokers port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # creates tcp socket
s.connect((TCP_IP, TCP_PORT)) # connect it to broker ip and port
de... | true |
8a0fc421a547b9964ba013c6c69d9e98851c3a01 | Python | Aasthaengg/IBMdataset | /Python_codes/p02633/s014509336.py | UTF-8 | 113 | 3.1875 | 3 | [] | no_license | cnt = 0
pos = 360
muki = int(input())
while pos != 0:
pos += muki
pos %= 360
cnt += 1
print(cnt)
| true |
24a0c38daa037b6a49fffd97a1fc4e1fa91eb4ad | Python | WeronikaKomissarova/zot_lab3 | /viewing.py | UTF-8 | 1,595 | 2.96875 | 3 | [] | no_license |
import func as lf
import gggg as lab
from tkinter import *
root=Tk()
root.title('ЦОС')
def clicked():
function = getattr(lf, selected.get())
x,y=function()
lab.dft(y)
def clicked1():
function = getattr(lf, selected.get())
x,y=function()
lab.fft(y)
selected=StringVar()
selected.set('heavis... | true |
75fee1afff4fe2a1087f327d39afc797470a8353 | Python | wfgiles/P3FE | /UM Reboot Python3/Week 1/IDLE run examples.py | UTF-8 | 282 | 3.21875 | 3 | [] | no_license | ##x = {'Christopher Brooks': 'brooksch@umich.edu', 'Bill Gates': 'billg@microsoft.com'}
##x['Christopher Brooks'] #Retrieve a calue by using the index operatorx = {'Christopher Brooks': 'brooksch@umich.edu', 'Bill Gates': 'billg@microsoft.com'}
####x['Christopher Brooks'] #Retrieve a calue by using the index operator
... | true |
6e2e81b605682c15a6372a0f4c78ceb4cd372560 | Python | jfunky/rwet | /budget2018/budget3.py | UTF-8 | 1,904 | 3.3125 | 3 | [] | no_license | #by jasmine
#april 2017
#rwet hw 8
import pyPdf
import markov
#learned about comparing dictionaries from:
#https://stackoverflow.com/questions/4527942/comparing-two-dictionaries-in-python
def dict_compare(d1, d2):
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
intersect_keys = d1_keys.intersection(d2_k... | true |
d729b62878f16cdef6c60138580e82a81f6de916 | Python | marconeuckensap/colab_marcoNlaetitia | /exersice_sys.py | UTF-8 | 1,112 | 4.0625 | 4 | [] | no_license | #!/usr/bin/python3
# @ Add necessary import statements.
import sys
import random
secret = random.randint(1, 10) # from the module 'random'
guessed = set()
def guess_number():
num = input # @ replace None, you need to ask the user
try: # You can ignore this for now, we'll come back to it.
num = int(i... | true |
e1780d56a1d36d38a330317684409c15c249285e | Python | psy1088/Algorithm | /practice/Search/search1.py | UTF-8 | 2,296 | 4.25 | 4 | [] | no_license | # p367 정렬된 배열에서 특정 수의 개수 구하기
n, x = 7, 2 # n = 수열의 원소 수, x = 개수를 구하려는 수
data = [1, 1, 2, 2, 2, 2, 3]
# def binary_search(arr, target, start, end):
# # 이진탐색으로 target과 같은 값을 갖는 원소 찾고, 그것을 기준으로 앞뒤로 while문 돌리면서 하나씩 검사
# # 리스트 안에 target의 개수가 적다면 효율적일듯
# cnt, mid = 0, 0
# while start <= end:
# mid... | true |
feb6e6a50473ceab58bc779ea6a4443a777c2d57 | Python | 1012560716/jiqixuexi | /matplotlib 学习/matplotlib 3D图.py | UTF-8 | 958 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
2018年4月1日
绘制3D图
'''
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
# 建一个视图
fig = plt.figure()
# 建一个3D视图
ax = Axes3D(fig)
# 取值,间隔0.25
x = np.arange(-4,4,0.25)
y = np.arange(-4,4,0.25)
# 将X,Y传入网格中
X,Y = np.meshgrid(x,y)
#... | true |
015e86127070b6bcc330ac563e35808345a23574 | Python | SoporteFoji/catastro | /foji_project/foji/api/administrador.py | UTF-8 | 3,371 | 2.546875 | 3 | [] | no_license | from rest_framework.decorators import api_view
from rest_framework.response import Response
from ..serializers.administrator import AdministratorSerializer
from ..models.administrator import Administrator
from ..models.personal_information import PersonalInformation
from ..models.user import User
@api_view(['GET'])
de... | true |
de4a53b55ccd4a62656d06b1880037d8377e8331 | Python | shovonploan/python_short_rpojects | /Connect_Four/script.py | UTF-8 | 5,931 | 3.265625 | 3 | [] | no_license | import numpy as np
import pygame
import sys
import math
board = np.zeros((6, 7))
turn = 0
game = 0
pl1p = 0
pl2p = 0
tie = 0
end = False
win = None
class Error (Exception):
pass
class InputError(Error):
def __init__(self, message):
self.message = message
class SlotError(Error):
def __init__(s... | true |
416c2798e96987b753db7b7e3ce3d84769364136 | Python | ShimizuKo/AtCoder | /ABC/130-139/134/E.py | UTF-8 | 295 | 2.921875 | 3 | [] | no_license | import bisect
from collections import deque
N = int(input())
A = []
for _ in range(N):
a = int(input())
A.append(a)
b = deque([])
for a in A:
if len(b) == 0:
b.append(a)
else:
if a <= b[0]:
b.appendleft(a)
else:
b[bisect.bisect_left(b, a) - 1] = a
print(len(b)) | true |
8021e61783f8891282f3ba721aeab4447302a3f2 | Python | cs-fullstack-fall-2018/python-review-exercise-3-myiahm | /Ex5.py | UTF-8 | 277 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | def forLoopFunction():
smallArray=[]
while True:
userInput=input("whatever?: or 'q' to quit ")
if userInput== "q":
for a in smallArray:
print(a)
break
else:smallArray.append(userInput)
forLoopFunction() | true |
35b964b344aa429424887722e09a4993b4758095 | Python | AmartyaSingh/Saluseon | /demo.py | UTF-8 | 522 | 2.84375 | 3 | [] | no_license | # importing basic modules
import requests
import json
# api-endpoint
URL = "<<server url>>"
# generating data here for demo purposes
feat = list(range(24))
s_id = 1
#creating a json object
PARAMS = json.dumps({s_id:{'feat':feat}})
# defining a params dict for the parameters to be sent to the API
header_lis... | true |
886dad240fee282eb7bc931193550daf5fe64978 | Python | wizardcapone/Basic-IT-Center-Python | /homework3/240.py | UTF-8 | 364 | 3.078125 | 3 | [] | no_license | def input_num(message):
try:
i = float(input(message))
return i
except:
print("mutqagreq miayn tiv")
while True:
my_arr = []
for i in range(1,5):
n = input_num('mutqagreq drakan tiv-' + str(i) + '\n')
my_arr.append(n)
count = 0
for j in range(len(my_arr)):
if my_arr[j] % 7 == 0:
count += 1
print('... | true |
9a068223f60317f8caec9172d40cb67aedbb9378 | Python | zjb617/Python | /project/date_visualization/the_csv_file_format/sitka_highs_lows.py | UTF-8 | 1,301 | 3.5 | 4 | [] | no_license | import csv
from datetime import datetime
import matplotlib.pyplot as plt
plt.style.use('seaborn')
# 支持中文
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
filename = 'D:/Code/Python/project/date_visualization/the_csv_file_format/data/sitka_weather_201... | true |
01f78ee173501fe323e969b49c36009d76d69db6 | Python | tourist-C/packnet-sfm | /scripts/train_sfm_utils.py | UTF-8 | 3,594 | 2.5625 | 3 | [
"MIT"
] | permissive | # Copyright 2020 Toyota Research Institute. All rights reserved.
import torch
from monodepth.models import monodepth_beta, load_net_from_checkpoint
from monodepth.functional.image import scale_image
import os
def load_dispnet_with_args(args):
"""
Loads a pretrained depth network
"""
checkpoint = tor... | true |
04c4f2e7cb521b2801762d382ae95d1f49b86dbd | Python | emilybache/SupermarketReceipt-Refactoring-Kata | /python_pytest/src/texttest_fixture.py | UTF-8 | 2,012 | 2.90625 | 3 | [
"MIT"
] | permissive | """
Start texttest from a command prompt in the same folder as this file with this command:
texttest -a sr -d .
"""
import sys,csv
from pathlib import Path
from model_objects import Product, SpecialOfferType, ProductUnit
from receipt_printer import ReceiptPrinter
from shopping_cart import ShoppingCart
from teller im... | true |
64382a24f46492219661a89235fdcb8f9e1af0a5 | Python | Shikhar21121999/ptython_files | /top_view_btree.py | UTF-8 | 1,740 | 3.953125 | 4 | [] | no_license | class BTnode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def store_top_view(root, recd, curr_dis, level):
'''
utility function to store horizontal distance
of current node(root) from head of the tree
root->curr_node
curr_dis->horizont... | true |
ac4d2e144305046cdfb45818456315f7905270c2 | Python | dongsik93/HomeStudy | /Question/sw_expert/D3/3975.py | UTF-8 | 280 | 3.75 | 4 | [] | no_license | T = int(input())
res = []
for _ in range(T):
a, b, c, d = map(int, input().split())
if(a/b < c/d):
res.append("BOB")
elif(a/b > c/d):
res.append("ALICE")
else:
res.append("DRAW")
for tc in range(T):
print("#{} {}".format(tc+1, res[tc])) | true |
8bd64e7dc68a6938e7b36d7647a0e08dd5892b9c | Python | mrahjoo/Solar-for-Industry-Process-Heat | /heat_load_calculations/EPA_hourly_emissions.py | UTF-8 | 28,567 | 2.59375 | 3 | [] | no_license |
import requests
import pandas as pd
import numpy as np
from zipfile import ZipFile
from io import BytesIO
import urllib
from bs4 import BeautifulSoup
import dask.dataframe as dd
import datetime as dt
import scipy.cluster as spc
import matplotlib.pyplot as plt
from pandas.tseries.holiday import USFederalHolidayCalendar... | true |
824a93c173659c0042f780313f4cb153f19439a0 | Python | Gistbatch/Reinforcement | /src/cartpole/cartpole_rbf.py | UTF-8 | 4,307 | 2.75 | 3 | [] | no_license | import gym
from gym import wrappers
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import uuid
from sklearn.kernel_approximation import RBFSampler
from sklearn.pipeline import FeatureUnion
from sklearn.preprocessing import StandardScaler
class Regressor:
def __init__(s... | true |
ce8474c01d5ca33c2612df42e3e3131026b9eeec | Python | mslitao/Leetcode | /word-breaker.py | UTF-8 | 548 | 3.5625 | 4 | [] | no_license | def breakWords(header):
words = []
n = len(header)
s = 0
for i in range(n):
word = ''
if((header[i] == '_' or header[i] == ' ' or header[i] == '.') and i >= s):
word = header[s:i]
s = i + 1
elif(i == (n -1) and i >= s):
word = header[s:]
elif(header[i].isupper() and i >=s):
... | true |
0df0fdc30068d276b75a0e9530e808a641eca8aa | Python | anntheknee/LeetCode | /Questions/Dynamic_Programming/Unique_Paths.py | UTF-8 | 839 | 3.296875 | 3 | [] | no_license | # Link: https://leetcode.com/problems/unique-paths/submissions/
# Level: Medium
# Runtime: 32 ms, faster than 73.04% of Python3 online submissions for Unique Paths.
# Memory Usage: 12.9 MB, less than 100.00% of Python3 online submissions for Unique Paths.
class Solution:
def uniquePaths(self, m: int, n: int) -> i... | true |
d132323480598566c1704e30ae63916230f4178c | Python | opensafely/T1DM_covid_research | /analysis/match.py | UTF-8 | 14,640 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
import copy
import random
from datetime import datetime
import pandas as pd
NOT_PREVIOUSLY_MATCHED = -9
def import_csvs(
case_csv,
match_csv,
match_variables,
date_exclusion_variables,
index_date_variable,
output_path,
replace_match_index_date_with_case=None,
):
"""
Impo... | true |
621459d7c795ed9e2ceb8603eae83f7e8bac439e | Python | Morgan-Griffiths/RouteMuse | /Local/test/test_math.py | UTF-8 | 1,764 | 2.609375 | 3 | [] | no_license | import numpy as np
import sys
import os
from collections import namedtuple,deque
import time
import pickle
from plots.plot import plot
from gym import Gym
from config import Config
sys.path.append('/Users/morgan/Code/RouteMuse/test')
# sys.path.append('/home/kenpachi/Code/RouteMuse/test')
print('path',os.getcwd())
fr... | true |
f01a53bb16cce6d33c54dd7d8c0747e0dbaa1d85 | Python | mtn/advent18 | /day12/part1.py | UTF-8 | 1,186 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
with open("input.txt") as f:
inp = f.read().strip()
lines = inp.split("\n")
initial_state = "..." + lines[0].split()[2] + "..."
initial_state = list(map(lambda x: 1 if x == "#" else 0, initial_state))
# Only track the growths, because we'll start assuming no growth
grows = set()
for ru... | true |
180fb10d71bb5f050a7a846e243de90a458ddd5f | Python | cww97/visual-language-grasping | /envs/data.py | UTF-8 | 2,821 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive | import os
import re
import yaml
from torchtext import data
from collections import namedtuple
Instruction = namedtuple('Instruction', ('tensor', 'length'))
class Data(object):
class DataSet(data.TabularDataset):
@staticmethod
def sort_key(ex):
return len(ex.text)
def __init__(self, text_field: data.Field,... | true |
63c2486e62de07eb175fe6055391bd23df975fed | Python | MorrellLAB/Deleterious_GP | /Analysis_Scripts/Data_Handling/Remove_Indels.py | UTF-8 | 460 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
"""Super simple script to filter indels/length polymorphisms from a VCF."""
import sys
with open(sys.argv[1], 'r') as f:
for line in f:
if line.startswith('#'):
print line.strip()
else:
tmp = line.strip().split('\t')
ref = tmp[3]
... | true |
9dbba6b7a6a9fde5e64ac37b37945dc3b120a552 | Python | crusaderkarthik/HackerRank-Python-Practice | /ifelse.py | UTF-8 | 307 | 3.953125 | 4 | [] | no_license | ##** TYPE 1 **##
n = int(input())
if (n % 2 == 1):
print("Weird")
elif n in range(2,6):
print("Not Weird")
elif n in range(6,21):
print("Weird")
elif n>20:
print("Not Weird")
##** TYPE 2 **##
n=int(input())
print("Weird" if n % 2 == 1 or n in range(6,21) else "Not Weird")
| true |
a12af2c480688ed1ea4c59c989d31cc65b816f97 | Python | newtonis/22.01-Circuit-Theory | /TP2/graficos/ejercicio1/bode_inv.py | UTF-8 | 5,365 | 2.546875 | 3 | [] | no_license | from read_spice import *
import numpy as np
from scipy import signal
from math import *
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from read_xls import *
from mpldatacursor import datacursor
a0 = 1e5
fp = 12
wp = fp * 2 * pi
k = 1e3
def dibujar_bode(r1,r2,r3,r4,log_range, excel_filename,... | true |
741b5c21e2624377684596c6649382334098286f | Python | drlongle/leetcode | /algorithms/problem_1329/leetcode3.py | UTF-8 | 1,046 | 3.75 | 4 | [] | no_license | class Solution:
def diagonalSort(self, mat: List[List[int]]) -> List[List[int]]:
n, m = len(mat), len(mat[0])
def sort_diagonal(i, j):
"""
Sort the current diagonal
"""
diagonal = []
# store the current diagonal
# in t... | true |
2429b8d9c1e5d2819bfd4d9f0114c8c315897d1d | Python | rishalab/COSPEX | /Sample Code/Calc_profit.py | UTF-8 | 3,227 | 4.03125 | 4 | [
"MIT"
] | permissive | #Calculate the maximum profit that can be earned by a merchant such that weight limit is not exceeded.
def calc_profit(profit: list, weight: list, max_weight: int) -> int:
"""
Function description is as follows-
:param profit: Take a list of profits
:param weight: Take a list of weight if bags correspon... | true |
2e4690ba25ded75d90bbb847e59f46c77dfb7dcd | Python | nickagliano/ai-projects | /Project2/Perceptron.py | UTF-8 | 3,382 | 3.609375 | 4 | [] | no_license | import numpy as np # numpy is for vectors
import random
import math
# for plotting the data
import matplotlib.pyplot as plt
# IMPORTANT NOTE:
# The data set lists all male and then all female data points. Think about which
# data points you should use for training and which for testing --
# i.e. algorithm will fail i... | true |
2bcbe0becc4d80fd963a4e6ff1d143c25caa81a2 | Python | SindhuMuthiah/100daysofcode | /acc3.py | UTF-8 | 197 | 3.3125 | 3 | [] | no_license | '''se=set()'''
arr=[]
n=int(input())
for i in range(n):
num=input()
arr.append(num)
'''for j in range(n):
se.add(arr[j])'''
se=set(arr)
print(se)
k=len(se)
print(k)
| true |
2d5aa7684345d228003b45981ad6f2438097c1ee | Python | Riduidel/codingame | /src/main/2 - medium/mayan numbers.py | UTF-8 | 2,414 | 3.375 | 3 | [] | no_license | import sys
import math
from functools import reduce
def to_mayan_number(number, NUMBERS):
if number<20:
return NUMBERS[number]
else:
remainder = number%20
text = to_mayan_number(int(number/20), NUMBERS)
return line_to_string(text, NUMBERS[remainder])
def to_arabian_number(number, NUMBERS):
returned = 0
po... | true |
b9f011ba69674e7203466da29cde0b908ee07010 | Python | rmazzine/Twitter_Sentiment_Analysis_Rotten_Apple | /preprocessing/GatherMostFrequentWords.py | UTF-8 | 1,604 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 16:31:53 2019
@author: mazzi
"""
# This algo will receive several tweets and store in a dataframe
import tweepy
import operator
import pandas as pd
consumer_key = 'YOUR_KEY_HERE'
consumer_key_secret = 'YOUR_KEY_HERE'
access_token = 'YOUR_TOKEN_HERE'
... | true |
906a2ad3da7416959df74944c9c3f5cdf67c311d | Python | baidoosik/ProblemSolving | /BOJ/problem_9012.py | UTF-8 | 373 | 3.28125 | 3 | [] | no_license | n = int(input())
problems = [input() for i in range(n)]
for p in problems:
criteria = 0
for c in p:
if c == '(':
criteria += 1
else:
criteria -= 1
if criteria < 0:
print('NO')
break
if criteria == 0:
print('YES')
elif crit... | true |
a61c5548221c2cabf47b06e09b4310f25b7f566b | Python | SerioSticks/AprendiendoPython | /Multiplo.py | UTF-8 | 955 | 4.09375 | 4 | [] | no_license | #Creador Jorge Alberto Flores Sánchez
#Matricula: 1622167 Grupo: 22
#Fecha de Creación : 18/09/2019
#Se captura un numero y se almacena una vez convertido a int
numero=int(input("Dame un numero entero:"))
#Se almacenan en valores de tipo booleano los residuos de la operacion.
#Esto quiere decir que si el resid... | true |
35107e11991bdd1f26b686e262a2926492efb690 | Python | punithanae/Python-Basic | /Rocket.py | UTF-8 | 1,285 | 3.609375 | 4 | [] | no_license | print("Welcome to Rocket development system")
print("please enter the details")
print("enter the height of the rocket body ")
a=float(input())
print("enter the weigth of the rocket body")
b=int(input())
print("enter the diameter of the rocket body")
c=float(input())
print("enter the berght of rocket body")
d=i... | true |
479397f00122d6f5b38df326095064e13a195a47 | Python | mike-briggs/QualityAssurance | /src/backend.py | UTF-8 | 6,964 | 3.09375 | 3 | [
"MIT"
] | permissive | # backend.py
# handles all (merged) transactions once a day
import sys
import os
import glob
# Inputs:
# - Transaction summary file (merged from several)
# - Previous instance of Master Account List
# AAAAAAA MMMMM NNNN
# acctNum money name
# Outputs:
# - New instance of Master Account List
# A... | true |
8d9d6ca64023beff353274e849637aa63053b153 | Python | aparna501/python101 | /Milestone_Project_1.py | UTF-8 | 1,826 | 3.953125 | 4 | [] | no_license | #Milestone_Project_1
class Milestone_1:
def __init__(self,w,h,n,str,sent_1,sent_2):
self.w=w
self.h=h
self.n=n
self.str=str
self.sent_1=sent_1
self.sent_2=sent_2
# Reverse string
def reverse(self):
rev=self.str[::-1]
print("the reverse of the string is:",rev)
#Palindrome or ... | true |
c1db88f46c7a773abab7274761f920fb485750bd | Python | HarishGajjar/Python-Projects-for-beginners | /object oriented programming[python]/oops-6.py | UTF-8 | 716 | 3.234375 | 3 | [] | no_license | """
Created on Sat Mar 28 2020
Topic: Inheritance
@author: HarishGajjar
Credit:- Telusko
original Source :- https://youtu.be/qiSCMNBIP2g
"""
class A:
def feature1 (self):
print("Feature1 is working...")
def feature2 (self):
print("Feature2 is working...")
class B:
de... | true |
980bb1dba49d430daaa2ca330057d89955f33372 | Python | anantgupta04/Coding-Challenges | /steps.py | UTF-8 | 1,114 | 4.03125 | 4 | [] | no_license | '''
his problem was recently asked by LinkedIn:
You are given a positive integer N which represents the number of steps in a staircase. You can either climb 1 or 2 steps at a time. Write a function that returns the number of unique ways to climb the stairs.
Bonus: solution in O(n) time?
'''
def staircase_recursion(... | true |
55b78eb29320a330154426e0900d3463180a352e | Python | i-pi/i-pi | /tools/py/a2b.py | UTF-8 | 2,851 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
""" a2b.py
Reads positions of a system in format 'a' and returns a
file written in format 'b'.
Assumes the input file is in a format 'a'.
Syntax:
a2b.py filename format_a format_b
"""
import sys
import re
from ipi.utils.io import read_file, print_file, read_file_raw
from ipi.engine.prop... | true |
6a77d10f434ef38c34ad1926e86387f0894ae70e | Python | aps-7bm/PyMotorTable | /PyMotorTable2/PyMotorTableCalcs.py | UTF-8 | 6,229 | 3 | 3 | [] | no_license | '''Underlying calculations for PyMotorTable.
Alan Kastengren, XSD
Started June 15, 2013
Change Log
November 18, 2014: Make initial points temporary, rather than confirmed, so they don't have to be erased.
'''
#imports
import numpy as np
import math
#Lists to save points.
temp_points = [0,1] #Provisional: all... | true |
39d9b75e095fc26cbd21d37e7e64ea3ee775f36f | Python | davidchen/pathfinder | /utils/a_star.py | UTF-8 | 17,635 | 2.796875 | 3 | [] | no_license | from datetime import datetime
from . import helper_defs
from . import the_david_brian_heap
from copy import copy, deepcopy
from . import colors
import pygame
def weighted_a_star(start_node, goal_node, grid, heuristic, weight):
helper_defs.reset_cells_in_grid(grid)
helper_defs.set_cell_values(grid, goal_node, ... | true |
4ae42680df2a9ead51b442ddee08c1ff21d7586f | Python | jspw/Basic_Python | /basic/print emoji.py | UTF-8 | 909 | 3.09375 | 3 | [
"Unlicense"
] | permissive | #website : https://unicode.org/emoji/charts/full-emoji-list.html
#replace '+' with '000'
print("\U0001F600")
print("\U0001F603")
print("\U0001F604")
print("\U0001F601")
print("\U0001F606")
print("\U0001F605")
print("\U0001F602")
print("\U0001F602")
print("\U0001F602")
print("\U0001F602")
print("\U0001F602")
print("\U... | true |
a13807886e430bc21bc7e078e0e485a2d88edbf7 | Python | CPJKU/score_following_game | /score_following_game/utils.py | UTF-8 | 3,319 | 2.65625 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import os
import shutil
import soundfile as sf
def write_video(images, fn_output='output.mp4', frame_rate=20, overwrite=False):
"""Takes a list of images and interprets them as frames for a video.
Source: http://tsaith.github.io/combine-images-into-a-video-with-python-3-and-open... | true |
8d85459c5c4ef509d4fd3ff1458bd39290960f03 | Python | abhishekjais-124/Contest-Reminder-python-project | /reminder_project/main.py | UTF-8 | 4,942 | 2.6875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import datetime
import re
from twilio.rest import Client
import random
from datetime import timedelta
sid= "" #not written due to privacy
token = ""#due to privacy
client = Client(sid,token)
Name = []
p_title = []
level = ['school','easy']
f1 = open("leet... | true |
c449a168bc35a5dc2c4bbd69080ec793614a77e6 | Python | miguelfscpaulino/AtariGo | /submission/go.py | UTF-8 | 26,521 | 3.796875 | 4 | [] | no_license | import sys
import copy
class State():
"""docstring for class State"""
# class state has the following atributes
def __init__(self, mat, player, filled, dim, groups1, groups2, zeros1, zeros2, terminalflag=False, drawflag= False):
self.mat = mat # game matrix
self.player = player... | true |
e93175ce946f67af41d22d03459afa17e38f7857 | Python | NicoKNL/coding-problems | /problems/code-jam/2021/closest-pick.py | UTF-8 | 1,383 | 3.34375 | 3 | [] | no_license | def findGaps(P, K):
head = 0
gaps = []
tail = 0
if P[0] > 1:
head = P[0] - 1
for i in range(len(P) - 1):
p_0 = P[i]
p_1 = P[i + 1]
winning = (p_1 - p_0 - 1)
if winning:
gaps.append(winning)
if P[-1] < K:
tail = K - ... | true |
04d988ec2b48c578e1742645c2518032c0ce21fd | Python | nitzanadut/Exercises | /Python/7 Ejected/ejected.py | UTF-8 | 1,123 | 3.984375 | 4 | [] | no_license | import re
import math
# Regex to check if a command is legal
validate_command = lambda command: re.match(r'^(UP|DOWN|LEFT|RIGHT)\s\d+$', command)
def main():
print("Hey! Expecting input of format: (UP/DOWN/LEFT/RIGHT NUMBER). 0 to stop inserting commands")
commands = []
command = ''
... | true |
ef848aecf359cbd5d403e5b9dcf4b4949da7f770 | Python | jpmendel/branch-prediction-visualizer | /src/util/util.py | UTF-8 | 263 | 2.96875 | 3 | [
"MIT"
] | permissive | class Util(object):
@staticmethod
def logical_right_shift(val, n):
return (val % 0x100000000) >> n
@staticmethod
def sign_extend(value, bits):
sign_bit = 1 << (bits - 1)
return (value & (sign_bit - 1)) - (value & sign_bit) | true |
88c1b8caa31723047966b939d00e8c77b58a05a4 | Python | kravitejar/PYTHON-MACHINE-LEARNING | /classesandobjects.py | UTF-8 | 1,496 | 4.4375 | 4 | [] | no_license | ##An object is a single software unit that combines data and method.
##Data in an object are known as attributes.
##Procedures/Functions in an object are known as methods.
##
##
##class Car:
## pass
##
##ford=Car() #ford is the object or instance of class Car
##honda=Car()
##audi=Car()
##
###can add attr... | true |
061eabfd0bf87dfd9c7970faf0c00d455b1057d9 | Python | patmoore/anki-conjugate-spanish | /tests/TestEstar.py | UTF-8 | 5,041 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
from conjugate_spanish import Tense, Person
from conjugate_spanish.espanol_dictionary import Espanol_Dictionary, Verb_Dictionary
Espanol_Dictionary.load()
class TestEstar(unittest.TestCase):
def __check__(self, tense, expected):
estar = Verb_Dictionary.get("estar")
... | true |
cc83c2f62da5ebf4bb2c9c36774f8f9d5ca45be7 | Python | Lord-Fifth/Competitive-Coding | /Atoms & Molecules/TCS/Xplore/Python/Prime.py | UTF-8 | 866 | 3.609375 | 4 | [] | no_license | """
Write a Python code to count how many prime integers are there in a given list of integers.
"""
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the 'checkCoPrimeExistance' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY nu... | true |