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
ac92625bdda2c42ef21a7f74a7d52de72948192f
Python
reo11/AtCoder
/atcoder/AGC/agc036/agc036_b.py
UTF-8
371
2.765625
3
[]
no_license
n, k = map(int, input().split()) a = list(map(int, input().split())) a_idx = [-1] * (2 * 10 ** 5) ans = [0] * (2 * 10 ** 5) idx = 0 for i in range(n * k): a_i = a[i % n] if a_idx[a_i] == -1: ans[idx] = a_i a_idx[a_i] = idx idx += 1 else: idx = a_idx[a_i] a_idx[a_i] = ...
true
c12aafc1a54ce7b59376ffa467431f0a4a213d3e
Python
luizfelipers19/IPythonCourse-MIT-x-Unicamp
/Set3/p3_7.py
UTF-8
282
3.5625
4
[]
no_license
def hailstone_sequence(a_0): lista = [a_0] while a_0 != 1: if (a_0 %2) == 0: a_0 = a_0 //2 lista.append(a_0) else: a_0 = (a_0 * 3) + 1 lista.append(a_0) return lista print(hailstone_sequence(3))
true
0c73161d1db94b1eb9f91cb5d6770d548decbe63
Python
ericchen12377/Leetcode-Algorithm-Python
/1stRound/Easy/657 Robot Return to Origin/Complexnumssum.py
UTF-8
324
2.859375
3
[ "MIT" ]
permissive
class Solution: def judgeCircle(self, moves): """ :type moves: str :rtype: bool """ directs = {'L':-1, 'R':1, 'U':1j, 'D':-1j} # real for axis x and complex for axis y return 0 == sum(directs[move] for move in moves) moves = "UD" p = Solution() print(p.judgeCircle(mov...
true
56dfe8f16ca0777983b291333d6ff123155d6382
Python
sonkute96/hocPython
/Function.py
UTF-8
309
3.625
4
[]
no_license
# cach 1 de khai bao mot function def print_two (*args): arg1,arg2 = args print " arg1 = %r, arg2 = %r " % (arg1, arg2) print_two("Zed", "Shaw") # cach 2 de khai bao mot function def print_two_again(arg1 , arg2): print "arg1 = %r , arg2 = %r " % (arg1, arg2) print_two_again("zed","Show")
true
f39c170f3b598710b128e7236940c906a03156c5
Python
bcveber/COSC101
/lab4/num_pizzas.py
UTF-8
534
3.71875
4
[]
no_license
total_slices = 0 def num_pizzas (adults, boys, girls): ''' (int, int, int) --> int Adults, boys, and girls order pizza slices with a ratio for each type of person and 8 slices of pizza make one whole pizza. ''' adults_pizza = adults * 2 boys_pizza = boys * 3 girls_pizza = girls * 1 tota...
true
89512aff2dc99429e0e2e6a358c23ae05cda423b
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2377/60810/289192.py
UTF-8
494
3.828125
4
[]
no_license
''' 回旋镖定义为一组三个点,这些点各不相同且不在一条直线上。 给出平面上三个点组成的列表,判断这些点是否可以构成回旋镖。 ''' n = int(input()) inp1 = input() point1 = inp1.split(',') inp2 = input() point2 = inp2.split(',') inp3 = input() point3 = inp3.split(',') x1, y1 = int(point1[0]), int(point1[1]) x2, y2 = int(point2[0]), int(point2[1]) x3, y3 = int(point3[0]), int(point...
true
8bcf462762f702a1c2851b5f1fbfeaf2e240ed89
Python
medoocs/SIRD-model-for-COVID-19-in-Croatia
/SIRD-COVID19.py
UTF-8
11,704
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 17 14:20:53 2021 @author: NIKOLA """ import pandas as pd import numpy as np from matplotlib import pyplot as plt from scipy.integrate import odeint from scipy.interpolate import interp1d from sklearn.metrics import mean_squared_error def plotPred(sve): ...
true
4060bd3d0479b22fd3d884a1b74fb7cdc6b7f476
Python
zhengyi144/OCR_RESTFUL_SERVICE
/resources/common/utils.py
UTF-8
1,415
2.96875
3
[]
no_license
import base64 import cv2 from PIL import Image import numpy as np from io import BytesIO import re def imageFromBase64(base64Str): base64Data = re.sub('^data:image/.+;base64,', '', base64Str) decodeData=base64.b64decode(base64Data) return decodeData def imageFileToCvImage(imageFile): image=Image.open(...
true
2092fc667798be408b15067ad6d43ec8bf23e7a7
Python
w51w/python
/0928/함수6_turtle.py
UTF-8
561
4.09375
4
[]
no_license
import turtle def drawBarChar(t, value): t.begin_fill() t.left(90) t.forward(value) t.right(90) t.forward(40) t.right(90) t.forward(value) t.left(90) t.end_fill() def bubble(alist): for p in range(6): for i in range(6): if alist[i] > alist[i+1]: ...
true
52ea791cee8b39c56e1bf6a1bf68c48c2fcf56a9
Python
MarkBanford/Master_OOP
/dunders.py
UTF-8
854
3.25
3
[]
no_license
class ASAPMob: def __init__(self): self._members = [ 'A$AP Ant', 'A$AP Bari', 'A$AP Ferg', 'A$AP Illz', 'A$AP Lotto', 'A$AP Nast', 'A$AP Relli', 'A$AP Rocky', 'A$AP Snacks', 'A$AP TyY', ...
true
60123b60bc24b3a7fbaeb7697a83e5f6c3983fa2
Python
AbdulMalik-Marikar/COMP-1405
/a2/a2q1b.py
UTF-8
364
3.734375
4
[]
no_license
#Abdul-Malik Marikar #101042166 #Key Reference: Gaddis, T. (2015). "Starting out with python" 3rd edition #get user input character = input("does you charachter have a beard? Type yes or no.\n") #because no characters have a beard the program is forced down the else branch if character == "yes" : print("I know you...
true
85ac68b2ed5cdfe3bc4dcd57ca49497a32ee6513
Python
SINHOLEE/Algorithm
/python/프로그래머스/호텔방배정_힌트보고.py
UTF-8
591
2.921875
3
[]
no_license
# union find def find(x): global parent if parent[x] == 0: return x parent[x] = find(parent[x]) return parent[x] def solution(k, room_number): global parent parent = [0] * (k+1) answer = [0] * len(room_number) i = 0 for num in room_number: if parent[num] == 0: ...
true
3c27929fe74bfbd1ab0b5055ef879123df8363dc
Python
dansoh/python-intro
/python-crash-course/exercises/chapter-6/6-7-people.py
UTF-8
381
3.078125
3
[]
no_license
favorite_languages = { 'jen': 'python', 'sarah': 'c', 'edward': 'ruby', 'phil': 'python', } favorite_color = { 'dave': 'blue', 'simon': 'red', 'mike': 'purple', 'max': 'green', } favorite_number = { 'jesse': 5, 'daniel': 28, 'alex': 9, 'anthony': 4 } favorites = [favorite_languages, favorite_color, f...
true
965b1e5747e38c73f6ef245d26afe176333088c0
Python
rewonderful/MLC
/src/problem_221.py
UTF-8
2,678
3.796875
4
[]
no_license
#!/usr/bin/env python def maximalSquare(self, matrix): """ My Method 算法:动规 思路: 用dp[i][j]记录以matrix[i][j]为"1"矩形的右下角的矩形的最大边长 matrix[i][j] == 0 的显然dp[i][j] == 0 对matrix[i][j] == 1的来说,如果在第一行或者第一列,显然dp[i][j]=1,最大也就是这么大了 对于其他位置, 像下面这样,右下角的那个1称之为matrix[i][j],那么要检查它的左,上,左上...
true
41205e31ecab567d6357d3611f392566ca51f2e1
Python
Eddie-yz/Frequent-Phrase-Mining-Document-Vector-Display
/DocDistribute.py
UTF-8
3,601
3.171875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from collections import Counter from sklearn.metrics import euclidean_distances from sklearn import manifold from sklearn.svm import SVC import os import re class AuthorClassifier(object): def __init__(self): self.phrase_dict = Counter() def dictConst...
true
6c0d2ee01936a935570ade3403e09c260c586aff
Python
Spazzy757/neural-networks
/logistic_regression.py
UTF-8
612
3.03125
3
[]
no_license
import numpy as np from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler # Importing dataset X, y = load_iris(return_X_y=True) # Scaling data scaler = StandardScaler() ...
true
08e4cdcd642d8e75bd88fe80f0b2f1a395a3b89e
Python
shubhamjaiswal889/PREDICTION-USING-ARIMA-SARIMA-MODEL
/Sales Prediction Using Arima & Sarima Model.py
UTF-8
5,168
3.203125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[4]: df = pd.read_csv(r'C:\Users\shubham.kj\Downloads\Perrin Freres monthly champagne sales millions.csv') # In[5]: df.head() # In[...
true
4ce230196e74b10b147ea6191965830cb82f76ac
Python
Dmitry1973/Python_Basics
/py_basics_HW5_e.py
UTF-8
1,320
3.4375
3
[]
no_license
# Задача-1: # Напишите скрипт, создающий директории dir_1 - dir_9 в папке, # из которой запущен данный скрипт. # И второй скрипт, удаляющий эти папки. import os #from os import listdir import shutil dir_name = '' for i in range(1, 10): #dir_name = 'dir_' + str(i) dir_path = os.path.join(os.getcwd(), 'dir_'+s...
true
163fbee6e7faab0d2871beb9c81631a04df60e7e
Python
wattlebirdaz/geql
/TrainingStats.py
UTF-8
6,055
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec class TrainingStats: def __init__(self, q_estimator_desc, action_policy_desc, comment=None, ma_width=20): self.comment = '' if comment is None else '\t' + comment self.ma_width = ma_width self.n_episo...
true
374bd51389b52a21c7fc2e589961154260e652db
Python
gjwei/leetcode-python
/easy/twoSum.py
UTF-8
521
3.28125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created by gjwei on 2016/12/6 ''' class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ elements = {} for i in range(len(nums)): ...
true
b06af184b5e7d250a4a919d57396d039b20e85e1
Python
matthiasamberg/TigerJython---The-fantastic-Elevator-Game
/functions.py
UTF-8
2,630
2.640625
3
[ "Apache-2.0" ]
permissive
# coding=UTF-8 # code zum starten des Spiels - bitte ignorieren import os, sys def setElevatorDestination(floor): if gs.elevators[0].state != "waitingForCommand": msg="The Elevator is busy (Did you call setElevatorDestination() twice in the play() function?)" msgDlg(msg,title="Error") ...
true
04b34e6c6d3f62e31b9d01054b929b207c4cbd37
Python
ashcoder2020/Python-Practice-Code
/take multiple user.py
UTF-8
209
3.484375
3
[]
no_license
num = lambda x: x + 5 print(num(10)) print("Program to take multiple user input ") print("------------------------------------") a,b=map(int,input("Enter two numbaers : ").split()) print(a,b)
true
ac1c0307dc6013e3c10e737075240adfcb6377c5
Python
chae-heechan/Codeup_Algorithm_Study
/CodeUp/1535.py
UTF-8
324
3.421875
3
[ "MIT" ]
permissive
# 함수로 가장 큰 값 위치 리턴하기 count = int(input()) lst = [0]*count elements = map(int, input().split()) times = 0 for i in elements: lst[times] = i times += 1 def f(): max_num = lst[0] for i in range(count): if max_num < lst[i]: max_num = lst[i] print(max_num) f()
true
3fc1855c77175b9bfc1ea27a62bde76f8eddd630
Python
Adiel30/Windows
/venv/Comprehensions.py
UTF-8
957
4.03125
4
[]
no_license
# Will put a list on evrey letter in th word lst = [x for x in 'word'] # x in 'word' PRINT W O R D # x for x Crete the , fo the list print(lst) # Example 2 lst = [x**2 for x in range(0,11)] # # in Range of 0-10 Make A list of evrey number in power of 2 print(lst) #Example 3 lst = [x for x in range(11) if x % 2 == 0] #...
true
09d6d241342d52142c2d606b88be2a74d38ee6c4
Python
ritou11/wxPubVis
/backend/dataproc/pub_theme.py
UTF-8
6,521
2.578125
3
[ "MIT" ]
permissive
# encoding=utf-8 import os import jieba from pymongo import MongoClient import numpy as np import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition import LatentDirichletAllocation from sklearn.feature_extraction.text import TfidfTransformer im...
true
e31e1dedd8bd8e214550a931e9f80fa1a05b9607
Python
forana/simplesvg
/example.py
UTF-8
365
3.03125
3
[]
no_license
""" python example.py """ import simplesvg svg = simplesvg.SVG(200, 200) svg.circle(100, 100, 100, fill = "blue", stroke = "green", strokeWidth = "3", id="c1") svg.rectangle(50, 50, 100, 50, fill = "green") svg.line(100, 0, 100, 180, stroke = "red", strokeWidth = "5") svg.polygon([(50, 100), (100, 100), (150, 150)], ...
true
36e74227fc22842d0bcef287dc62e59e5ad7fb94
Python
ciaranB3/CameraCal
/CameraCalibration_CB.py
UTF-8
3,774
3.359375
3
[]
no_license
'''cs410 camera calibration assignment ''' import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches from mpl_toolkits.mplot3d import axes3d from numpy.linalg import eig def calibrateCamera3d(data): """Calculates perspective projection matrix for given data""" # Create an amp...
true
aaabb99f4cf99d13fe9d58200a0cbc75b9cfca95
Python
kartikeya-shandilya/project-euler
/python/116.py
UTF-8
259
3.078125
3
[]
no_license
#!/usr/bin/python # generalized: arr1=[0,1,2,3,5] arr2=[0,1,1,2,3] arr3=[0,1,1,1,2] for i in range(5,51): m=i-1 n=i-2 o=i-3 p=i-4 j=arr1[m]+arr1[n] k=arr2[m]+arr2[o] l=arr3[m]+arr3[p] print i,j+k+l-3 arr1.append(j) arr2.append(k) arr3.append(l)
true
87228349d7911fac20a7db66840db61bc5e7cb50
Python
rheehot/problem_solving-1
/BOJ/백트래킹/신기한소수.py
UTF-8
1,277
3.0625
3
[]
no_license
import sys sys.stdin = open("신기한소수.txt","r") def solve(index, word): global start if index == N+1: number = int(word) result.append(number) return val = word[:index+1] val = int(val) val = int(val**0.5) for i in range(2, val+1): for j in range(len(prime)): ...
true
c1905822c40d8d174264d4b335ad6c580a892115
Python
amaranmk/comp110-21f-workspace
/exercises/ex03/happy_trees.py
UTF-8
298
3.3125
3
[]
no_license
"""Drawing forests in a loop.""" __author__ = "730484862" # The string constant for the pine tree emoji TREE: str = '\U0001F332' output: str = "" i: int = 0 j: int = 0 user_depth: int = int(input("Depth: ")) while i < user_depth: output = output + TREE print(output) i = i + 1
true
c8d7d5365e9ed5243a9db9e69d1f1fd837dfad8d
Python
smart-trains/raspberry-pi
/test/read_temp.py
UTF-8
657
2.671875
3
[]
no_license
from digitemp.master import UART_Adapter from digitemp.device import DS18B20 import http.client as http import json server = "52.65.244.105" api = "/api/temperature" bus = UART_Adapter('/dev/serial0') # DS9097 connected to COM1 # only one 1-wire device on the bus: sensor = DS18B20(bus) sensor.info() temp = sensor...
true
49a3925a4709a2e5a093a8bfdb4ebb1feeffa725
Python
upskyy/Baekjoon-Online-Judge
/Data-Structures/(9093)단어 뒤집기.py
UTF-8
539
3.3125
3
[]
no_license
import sys input = sys.stdin.readline num = int(input()) for _ in range(num): string = input() sentence = list() stack1 = list() stack2 = list() for j in string: sentence.append(j) sentence.append('\n') for ch in sentence: if (ch == ' ') or (ch == '\n'): while le...
true
1602c4df5a340b432f768bd0e5fed0afcc9d08bf
Python
douyixuan/LeetCode
/786.py
UTF-8
366
3.09375
3
[]
no_license
#!/usr/bin/python class Solution(object): def kthSmallestPrimeFraction(self, A, K): """ :type A: List[int] :type K: int :rtype: List[int] """ ans = () cur = 0 l = len(A) for i in range(0,l): for j in range(i+1,l): ans[cur] = [A[j]/A[i],A[i],A[j]] cur = cur+1 ans.sort(key = lambda x:x['x...
true
7759367fa444ea49df687baa4da3d5c3609ff1f6
Python
nuvention-web/A-2019-backend
/testsite/utils/weather.py
UTF-8
365
2.859375
3
[]
no_license
import requests import pytemperature def getWeatherInfo(): api_address = 'http://api.openweathermap.org/data/2.5/weather?q=Evanston,us&APPID=00635a2705abb24f3c1e116788d7614e' json_data = requests.get(url=api_address).json() formatted_data = json_data['main'] temperature = pytemperature.k2c(formatted_d...
true
14f83620e4b59b2cd2067b682289e4996f22b318
Python
THeK3nger/yoshix
/yoshix/yoshix.py
UTF-8
6,872
3.125
3
[]
no_license
from itertools import product from yoshix.yoshiegg import YoshiEgg, YoshiEggKeyException class YoshiExperiment(object): """ `YoshiExperiment` is the base class for every user created experiment. The class provide the basic interface and infrastructure to register data, run single experiments, generat...
true
5ea87279a0762c5372c787822d3d775d447face3
Python
nanxung/-Scrapy
/zhihu/pipelines.py
UTF-8
1,373
2.53125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql class ZhihuPipeline(object): def process_item(self, item, spider): return item class MysqlPipeline...
true
5a813967667fa134bd8ddc8237a8ba774123a907
Python
ariannedee/intro-to-python
/Problems/problem_7_new_years.py
UTF-8
120
2.6875
3
[]
no_license
""" Start at 10 seconds and count down until 1 and then print "Happy New Year! 🎉" """ print('Happy New Year! 🎉')
true
d54963d896ef47815e1aaae42bf9ef366143027d
Python
inkyu0103/BOJ
/DFS , BFS/1926.py
UTF-8
868
3.203125
3
[]
no_license
#1926 그림 from collections import deque import sys input = sys.stdin.readline def sol(): n,m = map(int,input().split()) dirs=[[0,1],[0,-1],[1,0],[-1,0]] room,area = 0,0 graph = [list(map(int,input().split())) for _ in range(n)] def bfs(r,c): q = deque([[r,c]]) graph[r][c] = 0 ...
true
d867ba0a92468421b04fb933f14123ccde65e5f9
Python
IbrahimAC/programming-python
/functions/fruit_questions/trash_fruit.py
UTF-8
882
4.40625
4
[]
no_license
"""Find trashfruits""" # Go through list of fruits. Check if the fruit is trash or good. # Trash fruits are any fruits longer than 5 letters # Change the names of the trash fruits to "Trash" in the list. # Return the newlistoffruits listoffruits = ["Cherry", "Mango", "Apple", "Peach", "Banana", "Plum", "Grap...
true
826304c7b511bf5a7d4da9f6799d74d39df44c5b
Python
dockerizeme/dockerizeme
/hard-gists/7310160/snippet.py
UTF-8
2,543
2.625
3
[ "Apache-2.0" ]
permissive
#! /usr/bin/python import Image #_______________________________________________________load image/create 'canvas' source = Image.open("test26.jpg") img = source.load() print source.format print source.size print source.mode x = source.size[0] y = source.size[1] scale=int(raw_input("\nscale: (the multiple the ima...
true
5c918d3fa9e4304847dc2890af963f080d6fd2f8
Python
stocyr/BassNotes
/main.py
UTF-8
1,937
3.203125
3
[]
no_license
from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.config import Config from kivy.clock import Clock from random import choice from math import floor from kivy.core.audio import SoundLoader class BassNotes(BoxLayout): notes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'Ab', 'Bb', 'Db', 'Eb', 'G...
true
0620732f52f7027914169c297b7ee8589d72978d
Python
a-yasar/streaming_MapReduce
/mapupdate.py
UTF-8
1,686
2.703125
3
[]
no_license
from optparse import OptionParser from operators import Source, Mapper, Reducer from states import StateManager import os, logging, imp, Queue def parse_arguments(args): if(len(args) != 3): print 'Invalid number of arguments' print 'Usage: %s TASKFILE FILE' % (args[0]) print 'Arguments:' print ' TASKFILE \t...
true
5c64b0bd4b3305646519c74711dc1caa4709305c
Python
aayushkumarjvs/Next-Tech-Reads
/Recommendation based on Age/collaborative_filtering_age.py
UTF-8
4,178
3.578125
4
[ "MIT" ]
permissive
#!/usr/bin/env python # Implementation of collaborative filtering recommendation engine from recommendation_data_age import dataset_age from math import sqrt def similarity_score(person1,person2): # Returns ratio Euclidean distance score of person1 and person2 both_viewed = {} # To get both rat...
true
b8e592be69cef06e80522f33552c645e8c23c5f6
Python
JumperC2P/PandaDiary_PyTest
/src/Sprint3/PBI_04/Buy_DiaryTest.py
UTF-8
2,629
2.6875
3
[]
no_license
import unittest from selenium import webdriver from selenium.webdriver.chrome.options import Options import pathlib from Buy_Diary import Buy_Diary import platform from datetime import date WEB_URL = "http://localhost:3000/" class Buy_DiaryTest(unittest.TestCase): def setUp(self): self.user = { ...
true
25d30585b142745e0b9a3662a5384649bcd7b208
Python
mgbo/My_Exercise
/2017/Turtule/lesson_1/turtle_5.py
UTF-8
355
3.5
4
[]
no_license
import turtle t=turtle.Turtle() t.shape("circle") x=75 ang=90 t.forward(x) t.left(ang) t.forward(x) t.right(ang) x=50 t.forward(x) t.left(ang) t.forward(x) t.right(ang) x=x-5 t.forward(x) t.left(ang) t.forward(x) t.right(ang) t.forward(x) t.left(ang) t.forward(x) t.right(ang) t.forward(x) t.left(ang) t.forward...
true
b94c79c06ccba7aca9b61ac8a86763ae98fdd7e9
Python
AlbertoIHP/detectorImagenOpenCV
/Primeros videos/video6.py
UTF-8
1,736
2.8125
3
[]
no_license
import cv2 import numpy as np try: img = cv2.imread('bookpage.jpg') # Se realiza thresh binary con la imagen a color retval, treshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY) grayscaled = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #Se realiza thresh binary con la imagen a escala de grises retval2, tres...
true
d44bbcc0ae8caed55a4cea335f79123eec44761e
Python
Agos95/Projects
/Neural Network and Deep Learning/Autoencoders for digit reconstruction/test.py
UTF-8
8,061
2.5625
3
[]
no_license
# %% import os import numpy as np import pandas as pd import torch import matplotlib.pyplot as plt import random from torch import nn from torch.utils.data import DataLoader, Subset from torchvision import transforms from torchvision.datasets import MNIST from tqdm import tqdm import json from sklearn.manifold import ...
true
49b09e8d71708831bb60b49bd5ceb638a6a9e866
Python
aditya25022001/general-purpose-programs
/use_model.py
UTF-8
681
2.546875
3
[]
no_license
import cv2 as cv import numpy as np import tensorflow as tf CATEGORY = ["adi" , "Nadi"] CATEGORY_SHOW = ["this is Aditya" , "this is not Aditya"] ''' face_cascade = 'haarcascade_frontalface_alt.xml' face_cascade_name = face_cascade face_cascade = cv.CascadeClassifier() face_cascade.load(face_cascade_name)''' def pre...
true
5a695d082e6183cbd1b6a9fcc5941997c113fc22
Python
saltstack/salt
/salt/returners/kafka_return.py
UTF-8
2,143
2.75
3
[ "Apache-2.0", "MIT", "BSD-2-Clause" ]
permissive
""" Return data to a Kafka topic :maintainer: Justin Desilets (justin.desilets@gmail.com) :maturity: 20181119 :depends: confluent-kafka :platform: all To enable this returner install confluent-kafka and enable the following settings in the minion config: returner.kafka.bootstrap: - "server1:9092" - "...
true
13c67a4bea7d93a113becd70ba3e4f66da9948f5
Python
oscarburga/tutorias-complejidad-algoritmica-2021-1
/s3/clase/max-subarray-sum.py
UTF-8
924
3.953125
4
[]
no_license
# a = [-5, -5, -5, -5, -5] # subarreglo vacio [] con suma 0 # nosotros no vamos a considerar el subarreglo vacío inf = 10**18 def merge(a, l, mid, r): # mezclar respuestas # calcular b1 (bloque de la izquierda que termina en el medio) b1 = -inf # inicializar en -infinito para no considerar subarreglos vací...
true
ee50783817e46a7ee08f954f4981b92980ebaa11
Python
sutarnilesh/DataStructuresPython
/algorithms/Sorting/quick_sort.py
UTF-8
1,507
4.34375
4
[]
no_license
""" The quick sort uses divide and conquer to gain the same advantages as the merge sort, while not using additional storage. A quick sort first selects a value, which is called the pivot value. We will simply use the first item in the list. The role of the pivot value is to assist with splitting the list. The ...
true
88dfda8cd47bc0c48acf4757a4af993463b5392b
Python
lesterfernandez/Messenger
/client.py
UTF-8
1,160
2.84375
3
[]
no_license
import socket import threading HEADER = 8 PORT = 5050 FORMAT = 'utf-8' DISCONNECT_MESSAGE = "!leave" SERVER = "IPV4 ADDR" # Enter the IPV4 address that you are hosting ADDR = (SERVER, PORT) # the server with here # use "IPCONFIG" on windows or "hostname -I" on linux name = " " set_name = False ...
true
e88d0990f05c16bced90946bf108e051f3a5d0b7
Python
wyaadarsh/LeetCode-Solutions
/C++/0819-Most-Common-Word/soln-1.py
UTF-8
589
2.8125
3
[ "MIT" ]
permissive
class Solution { public: string mostCommonWord(string paragraph, vector<string>& banned) { unordered_set<string> banset(banned.begin(), banned.end()); unordered_map<string, int> counter; for(auto & c : paragraph) c = isalpha(c) ? tolower(c) : ' '; istringstream iss(paragraph); ...
true
0dc79614166f42a6951bde844c9577f57398ef47
Python
nthanhtung/vn_stock_analysis
/source/xxx/load/to_df.py
UTF-8
573
2.8125
3
[]
no_license
############### import pandas as pd import glob import datetime as dt def csv_path_to_df(path: str = "C:/data", file_name_to_exclude: str = "abc.csv"): all_files = glob.glob(path + "/*.csv") file_path_to_exclude = [s for s in all_files if file_name_to_exclude in s] try: all_files.remove(file_path_...
true
f50625ac7f20d9f5f04f87000ef7ebbc09ca772c
Python
efratkohen/python_HW
/HW1/question3.py
UTF-8
548
3.71875
4
[]
no_license
def check_palindrome(): """Runs through all 6-digit numbers and checks the mentioned conditions. The function prints out the numbers that satisfy this condition. Notes ----- It should print out the first number (with a palindrome in its last 4 digits),not all four "versions" of it. """ # You...
true
d45589459d045cb1e6e4d21f80f9e46852a14e6f
Python
arolariu/2NHACK2020
/main.py
UTF-8
673
2.625
3
[]
no_license
from config import * from tkinter import * #INTERFATA GRAFICA: def update(ind): frame = frames[ind] ind += 3 if ind == frameCnt: ind = 0 label.configure(image=frame) app.after(100, update, ind) app = Tk() app.title('Soft Squad - School Assistant') app.geometry('800x600') app.resizable(...
true
c2ec7d8274c0b2a14de558cf17052191f2eec8b0
Python
SeitzhagyparovaTE/web
/week_7/2.HackerRank/9.py
UTF-8
320
3.03125
3
[]
no_license
if __name__ == '__main__': marklist = [] for _ in range(0,int(input())): marklist.append([input(), float(input())]) second = sorted(list(set([marks for name, marks in marklist])))[1] marklist.sort() for name, mark in marklist: if mark == second: print(name, end = '\n')
true
e4d836fe94dc05c8f47d0fa9bb332453eca03553
Python
WertheimKhon/CompMatSciTools
/Stress_Strain_Analysis/ElasticMD/extract/__init__.py
UTF-8
7,389
3
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # MIT License # Copyright (c) 2021 Dr. William A. Pisani # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
true
29d9a56987b817f8a8642faa10d9a2c01c5ab149
Python
shiva-pole/opencv-practice
/video-player.py
UTF-8
771
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- import cv2 import matplotlib.pyplot as plt def main(): windowName = 'Live Video Feed' video_file = "F:\\Projects\\Mine\\Python\\open-cv\\output\\out.avi" cv2.namedWindow(windowName) cap = cv2.VideoCapture(video_file) if cap.isOpened(): ret, frame = cap.rea...
true
eecd7db79365c1e2ed7df822c98b9e14034d3f2b
Python
mahyar-osn/Stride-and-Slice-Images
/strideslice.py
UTF-8
9,466
2.921875
3
[ "MIT" ]
permissive
import numpy as np import cv2 import os import tifffile import nibabel as nib config = dict() config['nibfile'] = False config['tiffile'] = False config['volumetric'] = False def read_images(dir_path): Images = [] image_names = sorted(os.listdir(dir_path)) for im in image_names: i...
true
6e203982376f1137731eb79f4e72d144e31f9cc1
Python
KevinJ-Huang/StereoLow-Light
/merge.py
UTF-8
3,739
2.75
3
[]
no_license
import cv2 import numpy as np import os def calWeight(d, k): ''' :param d: 融合重叠部分直径 :param k: 融合计算权重参数 :return: ''' x = np.arange(-d / 2, d / 2) y = 1 / (1 + np.exp(-k * x)) return y def imgFusion(img1, img2, overlap, left_right=True): ''' 图像加权融合 :param img1: :param i...
true
5e8dfa89497316e17ec56152801ebf4f4c960fc9
Python
qdufour/module
/sklearn.py
UTF-8
536
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- from sklearn import tree features = [[7, 0.6, 40], [7, 0.6, 41], [37, 600, 37], [37, 600, 38]] #definition des caractéristiques de classification #labels = [chicken, chicken, horse, horse] labels = [0, 0, 1, 1] #définition des résultats de classification classif = tree.DecisionTreeClas...
true
c0c40e66ddea5f659a4bf9d5355c1b1e25744c04
Python
e-kolpakov/e-kolpakov.github.io
/_code/2020-01-19-building-tests/src/ints.py
UTF-8
167
3.296875
3
[]
no_license
def multiply(i1: int, i2: int) -> int: return i1 * i2 def self_test(): assert(multiply(1, 2) == 2) assert(multiply(3, 4) == 12) print("Tests passed")
true
3578e54eba0bef321a71b81d9dbad9c3c3220271
Python
Annish1234/My-python-files
/mark2.py
UTF-8
3,597
2.71875
3
[]
no_license
#!/usr/bin/python3 import smtplib import time import os import RPi.GPIO as GPIO import speech_recognition as sr import random a=0 x=0 print("secrity system with high security opens only for authorised users only") r=input("press the letter s for entering into the acceing menu :::") if r=="s": print("your now in front ...
true
5c13075751a78b79f7d681dcb54ce3c7a5f6eea6
Python
mariia-kiko/AdequateNameForPythonLab
/REFACTORING.py
UTF-8
5,106
3.40625
3
[]
no_license
import pygame from pygame.draw import * import math as m pygame.init() #SCREEN PARAMETERS WIDTH = 1000 HEIGHT = 600 #LIST OF COLORS LIGHT_OLIVE = (206, 235, 206) BLUE = (44, 117, 255) YELLOW = (237, 255, 33) BLACK = (0, 0, 0) WHITE = (255, 255, 255) BROWN = (168,47,20) LIGHT_RED = (235, 76, 66) FPS = 30 screen = pyg...
true
93e765deb4a05a105e8f9458e25079c05a4a3477
Python
rbiegelmeyer/CodeFights-Python
/Arcade/Core/24 - equalPairOfBits.py
UTF-8
75
2.6875
3
[]
no_license
def equalPairOfBits(n, m): return 2**(str(bin(~n ^ m)[::-1]).find('1'))
true
00c3ff8a607f398f527108ae7451dd955b97fbad
Python
ZsNagy89/Python
/PE_01_LAB_Day_of_the_year.py
UTF-8
1,379
3.40625
3
[]
no_license
def day_of_year(year,month,day): months=range(month) for i in range(month): days_vector=[] if year%4==0: #maybe Leap year if year%100==0 and year%400!=0: #not a leap year if months[i] in x: if months...
true
ede40fe2a86f05fe52f011607b3ab293378ecb40
Python
stahl/adventofcode
/2017/day4/a.py
UTF-8
397
3.046875
3
[]
no_license
"""Counts passphrases as defined by https://adventofcode.com/2017/day/4.""" import fileinput from collections import Counter def valid_passphrase(passphrase): cardinalities = Counter(passphrase) return all(cardinality == 1 for cardinality in cardinalities.values()) phrases = (line.split() for line in filein...
true
fbba64103888fec29c9081601219a861bdc991c6
Python
omidmogasemi/stock-trading-bot
/Stock.py
UTF-8
1,481
2.765625
3
[]
no_license
from Algorithms.MomentumAlgorithm import MomentumAlgorithm class Stock: ORDER_QUANTITY = 5 def __init__(self, ticker, api): self.ticker = ticker self.api = api self.current_pos = None self.barset = None self.algo = None def get_ticker(self): return self.ti...
true
cbf32ef8297a95a0a2914a99ca7df04b9e99f675
Python
aayushi-droid/Python-Thunder
/Solutions/Geometry1-LengthOfLineSegment.py
UTF-8
394
3.6875
4
[ "MIT" ]
permissive
''' Problem statement: Write a function that takes coordinates of two points on a two-dimensional plane and returns the length of the line segment connecting those two points. Problem Link: https://edabit.com/challenge/3Ekam9jvbNKHDtx4K ''' import math def line_length(dot1, dot2): x1, y1 = dot1 x2, y2 = dot2 dis = ...
true
45eae450bea6cfc9f685a96d402efe4d0f864b23
Python
ncastal/sqlalchemy-challenge
/app.py
UTF-8
4,937
2.78125
3
[]
no_license
import numpy as np import datetime as dt import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify engine = create_engine("sqlite:///Resources/hawaii.sqlite") # reflect an existing database into a n...
true
01036fe6474cdfd7d9de1e9e8a4a3d8404d98f3a
Python
Jan200101/Sentry-Cogs
/nep/nep.py
UTF-8
2,149
2.9375
3
[ "WTFPL" ]
permissive
import discord from discord.ext import commands from random import choice from cogs.utils.dataIO import dataIO from os import path, makedirs class Nep: "Nep Nep" def __init__(self, bot): self.bot = bot self.nep = dataIO.load_json('data/nep/images.json') self.nepsay = dataIO.load_json('...
true
14834e6e89da4922ffd9970c591b27edd0f0f9ab
Python
Asunqingwen/LeetCode
/Cookbook/String/括号生成.py
UTF-8
914
3.828125
4
[]
no_license
''' 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。   示例 1: 输入:n = 3 输出:["((()))","(()())","(())()","()(())","()()()"] 示例 2: 输入:n = 1 输出:["()"]   提示: 1 <= n <= 8 ''' from typing import List class Solution: def generateParenthesis(self, n: int) -> List[str]: def helper(s=[], lc=0, rc=0): ...
true
38419209c45078bf240a2965103a4ccdc0e19a08
Python
K4RI/Half-Vie-3
/HALF-VIE 3.py
UTF-8
19,065
2.515625
3
[]
no_license
# Ceci est le code en Python de "Half-Vie 3". # Voilà. import random, math, decimal, pygame from pygame.locals import * from classes import * from constantes import * pygame.init() # initialisation de Pygame #Ouverture de la fenêtre Pygame fenetre = pygame.display.set_mode((1024, 768)) continuer_accue...
true
9accca202124907094f7f48b1fc881c36accaedb
Python
fennerm/i3ark
/i3ark/workspace.py
UTF-8
816
3.421875
3
[ "MIT" ]
permissive
"""Functions for examining and modifying the i3 workspace""" def get_empty_workspace(i3): """Get the index of the first empty workspace""" full_workspaces = get_workspace_indices(i3) i = 1 while i in full_workspaces: i = i + 1 return i def get_workspace_indices(i3): """Get list of cu...
true
6810338c96ce2979f85a3f7a978970bd6c21bf38
Python
shubhamgupta30/Collective-Intelligence
/deliciousrec.py
UTF-8
1,121
2.90625
3
[]
no_license
from pydelicious import get_popular, get_userposts, get_urlposts import time # Get the list of users who recently posted a popular link with a specified tag # The API returns only 30 users who posted a recent link, and thus gather users # from top 5 links shared. def initializeUserDict(tag, count=5): top_users= {} ...
true
69bc50e8b2ec5705b7f726b8437fd3b6f28ddd6f
Python
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/nucleotide-count/a419b016e856423983f2af9cf1284de5.py
UTF-8
488
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- from collections import Counter class DNA: def __init__(self, strand): counts = {'A':0, 'C':0, 'G':0, 'T':0} counts.update(Counter(strand)) self.counts = counts def count(self, nucleotide): if not nucleotide in 'ACGTU': raise V...
true
d7607e51839cab21f402b2582e086ce2555254a4
Python
Boris-2021/Location_awareness-
/net_structure.py
UTF-8
1,556
3.09375
3
[]
no_license
# ================================== # !/usr/bin/python3 # --coding:utf-8-- # Author : time-无产者 # @time : 2021/8/24 10:04 # ================================== import torch.nn as nn import torch.nn.functional as F import torch import pdb # 网络结构 # 基本定义__init__, 前向传播forward class LeNet(nn.Module): d...
true
f5b8cde6cc1fd72dbabac81912b2082d0e3527cb
Python
morsvox/face_detector
/facedetect.py
UTF-8
828
2.8125
3
[]
no_license
import cv2 import sys import os # Get user supplied values imagePath = sys.argv[1] cascPath = "haarcascade_frontalface_default.xml" # Create the haar cascade faceCascade = cv2.CascadeClassifier(cascPath) # Read the image image = cv2.imread(imagePath) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Detect faces in ...
true
e5e15c2aaaad9b0fc93ccd372c43cecd63e228d6
Python
KilHwanKim/practiceB
/code/2096.py
UTF-8
482
3.09375
3
[]
no_license
n = int(input()) number =[list(map(int,input().split())) for _ in range(n)] big = number[0] small = number[0] for i in range(1,n): big = [max ( big[0],big[1])+ number[i][0] , \ max ( big[0],big[1],big[2])+ number[i][1], \ max ( big[1],big[2])+ number[i][2]] small = [min(small[0], small[1]...
true
07a66aba49d6308725c0d0d01d4ef2cee6a59de8
Python
jeowsome/Python-Adventures
/Coffee Machine/Problems/The Louvre/main.py
UTF-8
352
3.609375
4
[]
no_license
class Painting: place = "Louvre" def __init__(self, title, artist, year): self.title = title self.artist = artist self.year = year def get_info(self): print(f'"{self.title}" by {self.artist} ({self.year}) hangs in the {Painting.place}.') painting = Painting(input(), input...
true
e0fe35f64c589aafe040d6c995c076f5359b9997
Python
yolkoo95/flask
/sql/sqlalchemy/flask-sqlalchemy/print1.py
UTF-8
700
2.796875
3
[]
no_license
import os from flask import Flask from models import * app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("database_url") app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False app.config["DEBUG"] = True db.init_app(app) def main(): flights = Flight.query.all() # compare with print.py in sqlalc...
true
7db070354eb8fdc308fb73715bb4112275b262f9
Python
thetremendous/facebook-automated-invite
/facebook-invite.py
UTF-8
2,761
2.65625
3
[]
no_license
#---------------------------- # | # Facebook - invite to group| #https://github.com/thetremendous/facebook-automated-invite # UPDATE: 18.08.2021 | #---------------------------- from selenium import webdriver from time import sleep from selenium.webdriver.common.keys import Keys import random i...
true
c81d53c04d350e9d221555482572b957c6671021
Python
AlexandertheG/crypto-challenges
/set_2/cbc_bitflipping_attack.py
UTF-8
3,029
2.75
3
[]
no_license
#!/usr/bin/python import sys import random import binascii import base64 from Crypto.Cipher import AES def sanitize_input(in_str): build_str = '' for i in range(0, len(in_str)): if in_str[i] == ";" or in_str[i] == "=": build_str = build_str else: build_str+=in_str[i] return build_str def pad_msg(msg, k...
true
ba62cb24983f5e2bf316f84405fe5340dbba4aee
Python
longjiemin/Interviews-and-algorithms-python-
/coder-interview-guide/5-用一个堆栈来实现另一个堆栈的排序.py
UTF-8
381
3.6875
4
[]
no_license
#5 #用一个堆栈实现另一个堆栈的排序,不允许额外变量 #功能实现,基本没有问题 def sort_another(nums): if len(nums)==0: return [] stack2 = [nums.pop()] while len(nums)>0: cur = nums.pop() while len(stack2) != 0 and cur>stack2[-1] : nums.append(stack2.pop()) stack2.append(cur) return stack2
true
cceeb22f2e92cb8f64363916ad0a314458105827
Python
sagarsharma122000/Sudoku-Game
/sudoku (1).py
UTF-8
11,071
3.28125
3
[]
no_license
from tkinter import * board = [] def main_screen(): top = Tk() top.title("SUDOKU") top.configure(background='antiquewhite1') top.geometry("300x360") lb = Label(top, text="Select Level",fg='navy',bg='antiquewhite1', font=("Arial Black", 30)) lb.pack(pady=5) l1 = Button(top, text=...
true
545a83335f8c44c5dea3d9f884448200688b0a7b
Python
Sapnil98/Python
/Eyantra/task_1b/task2_final.py
UTF-8
2,673
2.71875
3
[]
no_license
import cv2 import imutils import numpy as np from math import exp def find_contours(image): gray=image.copy() blur=cv2.GaussianBlur(gray,(7,7),0) ret,thresh = cv2.threshold(blur,200,255,cv2.THRESH_BINARY) contours = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, ...
true
cc7c68c4db3c631a484375a48496aea5783bd428
Python
cooLBooy1128/cpython39
/tsTclntSS.py
UTF-8
513
2.796875
3
[]
no_license
import socket HOST = 'localhost' PORT = 8000 ADDR = (HOST, PORT) BUFSIZ = 1024 def main(): while True: tcpCliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcpCliSock.connect(ADDR) data = input('> ') if not data: break tcpCliSock.send(b'%s\r\n' % data...
true
be25cb33b4564df84ea30a77c2e1baee3431987c
Python
djrrb/Python-for-Visual-Designer-Summer-2021
/session-3/waves.py
UTF-8
743
3.359375
3
[]
no_license
def myShape(sh=200): # handle starting length hsl = 130 # get the right and left handle lengths rightHandleLength = randint(-hsl, hsl) leftHandleLength = randint(-hsl, hsl) # define a bezier path bp = BezierPath() # move to my starting point bp.moveTo((0, 0)) # straight line...
true
91ff55e807ff40de390d0b1e6693511f942b94e1
Python
Electrostatics/APBS_Sphinx
/plugins/PDB2PQR/extensions/newresinter.py
UTF-8
13,193
2.515625
3
[]
no_license
""" Resinter extension Print interaction energy between each residue pair in the protein. """ __date__ = "21 October 2011" __authors__ = "Kyle Monson and Emile Hogan" import extensions from ..src.hydrogens import Optimize #itertools FTW! from itertools import product, permutations, count from ..src.hydrogen...
true
9c7f9dde7d7cc6fe14c10393beb0afde742c8353
Python
chinmairam/Python
/positional_only_arg.py
UTF-8
223
3.703125
4
[]
no_license
# To specify positional-only arguments,you include a forward slash in your # function's arguments. def number_length(x, /): return len(str(x)) print(number_length(2112)) #print(number_length(x=31557600)) #TypeError
true
324c0e7ac798be4fc3c83dc9a40e5bee620f06d6
Python
g3rv4/notify-me-anything
/notifications/mac_os_notification.py
UTF-8
1,903
2.53125
3
[]
no_license
import Foundation import objc from notifications.base_notification import BaseNotification class MacOSNotification(BaseNotification): def __enter__(self): self.helper = NotificationHelper.alloc().init() return self def __exit__(self, exc_type, exc_val, exc_tb): self.helper.dealloc() ...
true
f025a0838a97e5d8c06dbafc364cc956e5ebea95
Python
samikhailov/coursera
/python_osnovy_programmirovaniya/week_7/polighloty.py
UTF-8
536
3.234375
3
[]
no_license
amount_pupils = int(input()) famous_languages = set() all_languages = set() for counter, i in enumerate(range(amount_pupils)): known_languages = int(input()) pupils_languages = set() for j in range(known_languages): pupils_languages.add(input()) if counter == 0: famous_languages = pupils...
true
12f40f75e97ea94001fbf50034c89b77e6f48454
Python
ctreffe/alfred
/src/alfred3/cli/extract.py
UTF-8
11,337
3.0625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
r""" Provides a command line interface for transforming .json data files into .csv files. By default, the command expects to find the .json files in the current working directory. A basic example would look something like this. You have run some local experiment sessions. Now you have an experiment directory that look...
true
70018785948566c05025fb023d4edc249aa17212
Python
optionalg/cracking_the_coding_interview
/chapter02_lists/03_delete_middle.py
UTF-8
624
3.34375
3
[]
no_license
from ctci.chapter02_lists.LinkedList import LinkedList def find_middle_element(self): p1 = self.head p2 = self.head.next while p2.next: p1 = p1.next p2 = p2.next.next return p1.data def delete_middle_element(self, k): p1 = self.head tmp = self.head for i in range(k): ...
true
0a1e1598485397f04ff0b5284e70806961373684
Python
dsapan/hotel-management-system
/Hotel-Management-System/roomhistory.py
UTF-8
4,716
2.671875
3
[]
no_license
from tkinter import * from subprocess import call import mysql.connector from tkinter import messagebox from tkinter import scrolledtext root = Tk(className=" HOTEL MANAGEMENT") root.geometry('1020x700+200+20') # calling functions def click_vacancy(): call(["python", "vacancy.py"]) def click_developers(): ...
true
d8d30a1d4fc60e4ce16947f12fade84c19ebb2d9
Python
Xiangyu-Han/autoclip
/autoclip.py
UTF-8
992
2.578125
3
[ "MIT" ]
permissive
import numpy as np import torch from ignite.engine import EventEnum def _get_grad_norm(model): total_norm = 0 for p in model.parameters(): if p.grad is not None: param_norm = p.grad.data.norm(2) total_norm += param_norm.item() ** 2 total_norm = total_norm ** (1. / 2) ret...
true
7b4452e714190a01d49374d0761f8dcc355e3182
Python
ProspePrim/PythonGB
/Lesson 3/task_3_4.py
UTF-8
1,164
4.4375
4
[]
no_license
# Программа принимает действительное положительное число x и целое отрицательное число y. # Необходимо выполнить возведение числа x в степень y. # Задание необходимо реализовать в виде функции my_func(x, y). # При решении задания необходимо обойтись без встроенной функции возведения числа в степень. # ** Подсказка:*...
true
e3fa3d8df8826e519a3ce1f806f5dd4586d3353e
Python
nikita494/BioInf
/29.06.21/Interleaving Two Motifs.py
UTF-8
949
2.9375
3
[]
no_license
#http://rosalind.info/problems/scsp/ def common_supersequence(s, t): m, n, l = len(s), len(t), [[0] * (len(t) + 1)] * (len(s) + 1) for i in range(m + 1): for j in range(n + 1): if i == 0 or j == 0: l[i][j] = max(i, j) elif s[i - 1] == t[j - 1]: l[i...
true
b9bb602d5eb377ffa3c21f6cb135a32c9c619f75
Python
daboross/quick-repo-backup-tagit-python
/rename_music_album_and_artist_folder_names_in_music_dir.py
UTF-8
2,130
2.8125
3
[ "MIT" ]
permissive
# Note: this does require music to already be in a two-directory format, of ~/Music/<some text>/<some text>/track-name.file-format # if the directory depth in ~/Music/ is greater than 2, this script will malfunction. import os from tinytag import TinyTag print("Valid responses:\nY: Rename\nS: Skip album\nN: Do nothing...
true