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
ba520f807dcb500153a9aac5a7a633ff0fa5c2a6
gabydd/DumDumDum
/main.py
UTF-8
699
2.671875
3
[]
no_license
import pygame as pg from game import * from songs import * from create import SCREENX, SCREENY from pygame.locals import * #COLOURS SCREEN_COLOUR = (55, 125, 255) if __name__ == "__main__": fullscreen = False while True: menu = Menu(SCREENX, SCREENY, (SCREEN_COLOUR), fullscreen) song, mode, fu...
true
ed168343894a5c04cdb1c73290238b9f0701e208
DaphLC/name-classification
/trainer.py
UTF-8
4,920
3.3125
3
[]
no_license
import numpy as np import random import torch import copy class Trainer: ''' The Trainer class is used to train a model. It requires a model, a learning rate, and a patience (maximum number of steps after the best score is obtained). It will keep in memory the best weights during the training phase. ...
true
2f2e0a5e19815f44b06079c4781fca21db3a92b6
fredericsonergia/conformity-generationImage
/src/blender/Chimney.py
UTF-8
2,699
3
3
[]
no_license
import random import mathutils import bpy class ChimneyFactory: def createRandomChimney(self): random_type = random.choice(["cylinder", "cuboid"]) if random_type == "cuboid": return CubicChimney() elif random_type == "cylinder": return RoundChimney() def create...
true
e892a703dcd126241d246b57ebc6e0e5bca426f2
bbahngju/coding-test
/Python/NM2.py
UTF-8
536
3.1875
3
[]
no_license
def Permutation(index, N, M): if index == M: for i in range(M): print(result[i], end = " ") print() return 0 for i in range(1,N+1): if index != 0 and result[index-1] > i: continue if visited[i] is not True: result[index] = i ...
true
e8901aaee4a64ec739b093265c7c321db2f4ecb7
CHRISTINEMUTHEE/Week_5-Project
/dashboard.py
UTF-8
7,549
3.265625
3
[]
no_license
import streamlit as st import pandas as pd import numpy as np from streamlit.elements.arrow import Data from streamlit.elements.legacy_data_frame import marshall_data_frame import plotly.graph_objects as go from streamlit.proto.Markdown_pb2 import Markdown import plotly.express as px header=st.container() datasets=st....
true
7d7ced35ed330f968d27f1d77454d7f28619bed9
moon-light-night/learn_python
/is_even.py
UTF-8
414
3.875
4
[]
no_license
print('Данная утилита определит четность и нечетность целого числа') a = int(input('Введите целое число: ')) if a % 2 == 1: print('Данное число является нечетным') elif a % 2 == 0: print('Данное число является четным') else: print('Некорреткная запись')
true
fa0234b42ae74395dcd71856194087ed8363c338
namyangil/edu
/Python/codeup/codeup_2801.py
UTF-8
51
3.03125
3
[]
no_license
n=int(input()) # const dollar=1130 print(n*dollar)
true
b0eddfa5dce40459286ee1661d0a6b6583540711
wuyan-ai/MixedPrecision
/MixedPrecision/tools/folder.py
UTF-8
1,558
2.984375
3
[]
no_license
from typing import * import os import fnmatch import time import hashlib import tempfile def pytorch_folder_visitor(folder): images = [] classes = set() for root, dir, files in os.walk(folder): classes.add(root.split('/')[-1]) for item in fnmatch.filter(files, "*"): images.app...
true
3066e51366e520b0593b76c97cf08345ee681f45
H-Nolan/Functions
/Ex1.py
UTF-8
369
3.8125
4
[]
no_license
#Henry Nolan-Clutterbuck #27/11/2014 #RevisionEx1 def OutputSymbols(): integer = int(input("Please enter the number of times you would like this displayed: ")) character = input("Please enter the character you would like displayed: ") output = str(integer*character) print(output) return ...
true
34ae5bdafa163b99efe996e2e58ad463895dc04a
tdenewiler/thesis.bak
/code/plot_sin_cos.py
UTF-8
650
3.21875
3
[]
no_license
#! /usr/bin/env python from scipy import * from pylab import * saveplots = 1 xres = 0.001 x = arange(-pi,pi+xres,xres) ysin = sin(x) ycos = cos(x) ysincos = sin(x)*cos(x) yx0 = x*0 # Horizontal line for x-axis yx = x*1 # To compare angle to other values plot(x,ysin) hold(True) plot(x,ycos) plot(x,ysincos) plot(x,yx) p...
true
1b8227e6a8b9685ad2cc6aeae7fbdf8bc0c349e4
pstanisl/disertacka
/thesis/ch4-asr/others/functios.py
UTF-8
1,421
3.15625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def relu(x): y = np.array(x) indexes = x < 0 y[indexes] = 0 return y def sigmoid(x): return 1 / (1 + np.exp(-x)) def tanh(x): return (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x)) def plot(x, y, path='function.png'): fig, ax = ...
true
32f4ee7c5db8868590ddd10d353f6ba248a725ea
srkstudy1970/py
/rpsls.py
UTF-8
2,890
3.625
4
[]
no_license
##### To Import Packages######## import math import os import random ##### End of Packages######### ##### Welcom Message######### print "Welcome to Ravi's Rock Paper Scissors Lizzard Spock (rpsls) program" ##### End of Welcome Messages ######### def name_to_num(name): if name == "rock": #p...
true
9c7efbb651e3114399cc32c577b49ae73d50cc86
alexshung/CS-440-Homework
/MP4/MP4.py
UTF-8
8,535
2.671875
3
[]
no_license
import numpy as np from collections import Counter, defaultdict from math import log from sklearn.metrics import confusion_matrix import json class Number(): """docstring for Number""" def __init__(self, data, label): self.data = data self.label = label self.classifiedLabel = None class Perceptron(): def __i...
true
a6ec44d7815971eb987831d80f8e7620473219ef
satyam-seth-learnings/python_learning
/Geeky Shows/Advance Pyhton/220.Module[34]/PythonProject/Example-2.py
UTF-8
185
3.34375
3
[]
no_license
# Example-2.py <---- Main Module import cal as c print("Cal Module's Variable:",c.a) c.name() a=c.add(10,20) print(a) print(c.sub(20,10)) add=c.add print(add(4,7)) s=c.sub print(s(4,7))
true
9ed662c678f58801cd97c6e593d2131261aaa6ee
jack-evan/python
/powerball.py
UTF-8
188
3.25
3
[]
no_license
import random #get numbers for i in range(5): rana = random.randint(1,69) print rana, #get powerball for n in range(1): ranb = random.randint(1,26) print '(' + str(ranb) +')',
true
efca9ef5d8fe8558bd10d533cd70337661626f90
AnonyKwan/Manul-Exploit-Cheat-Sheet
/Buffer Overflow/badchar.py
UTF-8
213
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/env python from __future__ import print_function listRem = "\\x00".split("\\x") for x in range(1, 256): if "{:02x}".format(x) not in listRem: print("\\x" + "{:02x}".format(x), end='') print()
true
4c4148f495f4e735a040556782a3fa442e0b8c25
JoeanAmier/Mastering-Python-Design-Patterns-Second-Edition
/桥接模式/桥接模式.py
UTF-8
1,397
3.421875
3
[ "MIT" ]
permissive
import abc import urllib.parse import urllib.request class ResourceContent: """ 定义抽象接口 维护一个实现者的对象引用 """ def __init__(self, imp): self._imp = imp def show_content(self, path): self._imp.fetch(path) class ResourceContentFetcher(metaclass=abc.ABCMeta): """ 为获取内容的实现类定义接...
true
033d419bca205fe98559c2901a39da66465118c0
filipovskid/DRBoson
/drboson-lib/drboson/drboson.py
UTF-8
2,827
2.609375
3
[]
no_license
from DRBosonProducer import ClientProducer import pathlib import collections import history import messages import json class DRBoson: def __init__(self, run=None, producer=ClientProducer()): self.run = run self.producer = producer self.history = history.History(run, self.producer) de...
true
7ea7030d496c520b6a0f8401f673507edceff221
ciaphas/Python-Code
/Audio Recording/audio.py
UTF-8
1,213
2.859375
3
[]
no_license
#Imports the functions to record the audio import pyaudio import wave import time import sounddevice as sd #This variable creates a custom name for the file that is the current time of completed script timestr = time.strftime("%Y%m%d-%H%M%S") #This sets up the recording and defines objects FORMAT = pyaudio.paInt16 C...
true
5d24abdf3921258d49f557f24dcc69bd320b019d
johnabel/ferreira_malaria_analysis
/expression_clustering_LDDD.py
UTF-8
16,148
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon July 23 2018 @author: john abel python 3.7 """ # imports the needed python packages from collections import Counter import pickle import numpy as np import pandas as pd import scipy.cluster.hierarchy as sch from scipy import stats import seaborn as sns import matplotlib.py...
true
4727e16923735122db2d496a0749e25160dc4ab8
folsomjenna/pythons
/1-3 deliverables/year.py
UTF-8
570
4.40625
4
[]
no_license
# year.py # Created on 12/11/18 by Jenna Folsom # A program that prompts the user for a 4-digit year and then outputs the value of the epact def main(): import math # This is an introduction print("This is a program that prompts you for a 4-digit year and then outputs the value of the epact.") # Thi...
true
9bd5b778eb28c1e0de2287be68bff89b348dfd8f
arslankabir/Python-small-bank_Account
/bank_Account.py
UTF-8
1,019
4.03125
4
[]
no_license
class Bank(): def __init__(self, owner,balance='$0'): self.owner= owner self.balance = balance def __str__(self): return "Welcome {}".format(self.owner) def deposit(self,amount): self.balance+=amount print("You deposit ${} Successfully!".format(amount)) def wit...
true
502610394ac8f0a5d2bc1d6dc630c842374c79ab
chiahsun/problem_solving
/LeetCode/214. Shortest Palindrome/solve1.py.tle.py
UTF-8
612
3.0625
3
[]
no_license
class Solution: def shortestPalindrome(self, s: str) -> str: st, left = list(s), [] while len(st) > 1 : if st[0] != st[-1]: left.append(st.pop()) else: i, k = 0, len(st)-1 ok = True while i < k: ...
true
31078c1b014e69ad13053a6bd8441f4da425f486
asyash26/BigData
/HW1/reducer.py
UTF-8
732
3.203125
3
[]
no_license
#!/usr/bin/env python """reducer.py""" # import sys def reducer(values): result_var = 0 result_mean = 0 result_size = 0 # for line in sys.stdin: for line in values: size, mean, var = list(map(float, line.split(' '))) denominator = result_size + size numer...
true
40facbe1162116e0339fdc6a4c71898f9ab59d09
avengerpenguin/ads-coursework
/parse.py
UTF-8
2,120
3.15625
3
[]
no_license
import csv class Category(object): def __init__(self, cid, title): self.id = cid self.title = title def __eq__(self, other_category): return self.id == other_category.id def __hash__(self): return hash(self.id) class Subcategory(Category): def __init__(self, cid, ti...
true
be90cf89cdfbeead16eef78af9bf87f37ac53dc7
Leonti/home-assistant
/homeassistant/lights/lights_on.py
UTF-8
279
2.96875
3
[]
no_license
import serial from time import sleep with serial.Serial(port = '/dev/ttyUSB0', baudrate=9600) as ser: print("Sending serial command") str(ser.readline(), 'ascii') ser.write('on;'.encode(encoding = 'ascii')) ser.flush() line = str(ser.readline(), 'ascii') print(line)
true
7ea826defb82f1422ed00dacfdb64ade0d0bffca
thjking/guide
/Minkowski.py
UTF-8
639
3.53125
4
[]
no_license
# -*- coding:UTF-8 -*- from math import sqrt # 欧式距离计算函数 def Minkowski(rating1, rating2): distance = 0 for key in rating1: if key in rating2: distance += pow((rating1[key]-rating2[key]),2) distance = sqrt(distance) return distance # print Minkowski(users["Bill"],users["Hailey"]) # 利用欧式函数进行相似度递增排序 def comput...
true
5ff253edf845a033ebdef156f6341030e912a1d0
Aveturi13/cmri_planning
/metrics/dice.py
UTF-8
436
2.59375
3
[ "MIT" ]
permissive
import tensorflow.keras from keras import backend as K def dice_score(y_true, y_pred, axis=None, smooth=1): #Convert predicted mask to a one-hot encoding y_true = K.round(y_true) y_pred = K.round(y_pred) #Calculate DICE score intersection = K.sum(y_true * y_pred, axis=axis) area_true = K.sum(y_true, axis...
true
d161dc5be7a94c8f15c28e8a9fa24f261f611bcc
taochenlei/leetcode_algorithm
/187. Repeated DNA Sequences.py
UTF-8
809
3.25
3
[]
no_license
class Solution: def findRepeatedDnaSequences(self, s): """ :type s: str :rtype: List[str] """ def compute_hash(slice): ''' Computes the has for the given array :rtype: int ''' return str(slice) # Check edge ...
true
7fc806d8d4918f0a41f182ee11ad4b74399412c8
amanmishra98/python-programs
/assign/2-if else/greatest no among 3no.py
UTF-8
371
3.640625
4
[]
no_license
#WAPS to find no is the greatest no among 3 a=int(input("enter first no\n")) b=int(input("enter second no\n")) c=int(input("enter third no\n")) if a>b and a>c: print("a is %d"%a) print("a is greatest") elif b>a and b>c: print("b is %d"%b) print("b is greatest") else: print("c is %d"%c)...
true
bdd5fb702b3c22dcb50183c64411c2efbb13a79f
dev-learn-git/HelloWorld
/test.py
UTF-8
42
3.015625
3
[]
no_license
a = 4 b = 5 c = 7 print('Result: ',a+b+c)
true
fe91658863259ad1381dfcb02cc0862a921d3405
eXascaleInfolab/clubmark
/utils/remlinks.py
UTF-8
8,284
2.890625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :Description: copy network omitting some links :Authors: (c) Artem Lutov <artem@exascale.info> :Organizations: eXascale lab <http://exascale.info/>, ScienceWise <http://sciencewise.info/>, Lumais <http://www.lumais.com/> :Date: 2015-06 """ from __future__ import print_...
true
12826af8117541124d85810bd3ee858d04ab9a45
ChanJeunlam/dmelon
/dmelon/ocean/core.py
UTF-8
566
2.84375
3
[ "MIT" ]
permissive
""" General functions used specifically in ocean data analysis """ import numpy as np class DispersionRelation: """ Dispersion Relation """ @staticmethod def low_freq(m): """ Compute the scaled wavenumber and frequency for the mode m """ BETA = 2.29e-11 C =...
true
66063c5e5715bf0a063ddf71200a9c8024014489
vain7byte/battle_s_03-13a
/main.py
UTF-8
2,785
3.953125
4
[]
no_license
# -*- coding: utf-8 -*- import random board = [1,2,3,4,5,6,7,8,9] def show(): print board[0], "|", board[1], "|", board[2] print "---------" print board[3], "|", board[4], "|", board[5] print "---------" print board[6], "|", board[7], "|", board[8] print "---------" def check_winner(playe...
true
b51382dd3480aef9d6caa9a98f975e3549e33472
zahraakhlaghi/python-packet-sniffer
/core/main.py
UTF-8
3,609
2.78125
3
[ "MIT" ]
permissive
import protocol import socket import textwrap from pcap import Pcap def format_multi_line(prefix, String, size=80): size -= len(prefix) if isinstance(String, bytes): string = ''.join(r'\x{:02x}'.format(byte) for byte in String) if size % 2: size -= 1 return '\n'.join([prefix + l...
true
df5131be51ff2d5af587818c05e367e5e04575c3
undersonrs1/PYTHON_Projetos
/números_pares_intervalo.py
UTF-8
52
3.34375
3
[ "MIT" ]
permissive
for a in range (0,101,2): print(a,end=':')
true
681936b3a90220015acae1404d3776963e394504
viralbhandari/python_training
/python assignment/module 4/flatten_planets.py
UTF-8
203
3.03125
3
[]
no_license
planets=[['mercury','venus','earth'],['mars','jupiter','saturn'],['uranus','neptune','pluto']] flatten_planets=[val for sublist in planets for val in sublist if len(planets)<6] print(flatten_planets)
true
354cdcad9c240a83250f6c1e1a2fe29216c32ef5
zhulf0804/Coding.Python
/codeforces/988B_Substrings_Sort.py
UTF-8
300
3.5
4
[]
no_license
n = int(input()) strs = [] for i in range(n): strs.append(input()) strs = sorted(strs, key=lambda x:len(x)) ok = True for i in range(n-1): if strs[i] not in strs[i+1]: print("NO") ok = False break if ok: print("YES") for i in range(n): print(strs[i])
true
4509f9ccf0b50dfa0e3b15c020e29f3f14933f77
andrewvuong123/Wallbreakers
/Week2/uncommonFromSentences.py
UTF-8
888
3.328125
3
[]
no_license
class Solution(object): def uncommonFromSentences(self, A, B): """ :type A: str :type B: str :rtype: List[str] """ # General Idea: Have a dictionaries with the words from A and B and check for the word that appears only once. A_split = A.split() ...
true
638ca7759da7ce4c424bccc0155790aa21f718f4
thydungeonsean/fairy_kingdom
/src/fairy_powers/rock.py
UTF-8
1,994
2.765625
3
[ "BSD-3-Clause" ]
permissive
from power import Power from src.constants import HOUSE_L, HOUSE_R, ROCK class Rock(Power): instance = None @classmethod def get_instance(cls): if cls.instance is None: cls.instance = cls() return cls.instance def __init__(self): Power.__init__(self) def p...
true
9c9951f3095258b759a3ab3f65a16e624520a517
clEsperanto/pyclesperanto_prototype
/pyclesperanto_prototype/_tier3/_histogram.py
UTF-8
5,058
2.921875
3
[ "Python-2.0", "BSD-3-Clause" ]
permissive
# Author: Robert Haase adapted work from Aaftab Munshi, Benedict Gaster, Timothy Mattson, James Fung, Dan Ginsburg # adapted code from # https://github.com/bgaster/opencl-book-samples/blob/master/src/Chapter_14/histogram/histogram_image.cl # # It was published unter BSD lice...
true
4900df95f8c6edcb9dc6f90a9d9ca5d847b6dd4f
sergenp/TodoList
/server/validator.py
UTF-8
231
2.8125
3
[ "MIT" ]
permissive
import re def email_validator(email): return re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email) def password_validator(password): return re.match('^[a-zA-Z0-9]{8,32}$', password)
true
ee5f593b7007e9a06107298189883c52daeb257b
alexshieu/gothonweb
/app.py
UTF-8
2,586
2.765625
3
[]
no_license
import os from flask import Flask from flask import redirect from flask import render_template from flask import request from flask import send_from_directory from flask import url_for from werkzeug.utils import secure_filename app = Flask(__name__) @app.route('/hello', methods=['POST', 'GET']) def index(): greet...
true
6ded832d4c979c85c3d163f71e0b04b8f0bea0ad
XGBTrain3/02.basics
/03param_order.py
UTF-8
312
3.53125
4
[]
no_license
''' 1. parameters 2. *args 3. default parameters 4. **kwargs ''' def display_info(a, b, *args, inst="Kabir", **kwargs): return [a, b, args, inst, kwargs] print(display_info(1, 2, 3, name="Humayun", job="Teacher")) ''' a - 1 b - 2 args - (3,) inst - "Kabir" kwargs - {'name': "Humayun", 'job': "Teacher" '''
true
b3e4e6897cc26388db2dfc2d630b19a250866671
rkdms0116/SWEA
/SW1954_달팽이_숫자_D2/SW1954.py
UTF-8
780
3.25
3
[]
no_license
import sys sys.stdin = open('input.txt') def dalpang(N): # 우하좌상 dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] dal = [[0]*N for _ in range(N)] x = y = 0 num = 1 dal[x][y] =1 while num < N**2: if x+1 < N and dal[y][x+1] == 0: x += dx[0] y += dy[0] elif ...
true
46071154f182cc35c2e211c8d15d14584588defe
aikiyy/AtCoder
/abc002/d.py
UTF-8
483
2.53125
3
[]
no_license
N, M = map(int, input().split()) edges = [[] for _ in range(N)] for _ in range(M): x, y = map(int, input().split()) edges[x-1].append(y-1) ans = 0 for i in range(1 << N): num = list(reversed(list(map(int, format(i, '0'+str(N)+'b'))))) count = 0 need_count = sum(range(sum(num))) for n in range(N...
true
f553673ebcc1d7f956b730d8581db19cc5015da9
GiorgosPad/Data-Management-and-Intelligence-First-Graded-Assignment
/SQLAssignment.py
UTF-8
997
2.765625
3
[]
no_license
import mysql.connector db = mysql.connector.connect( host="localhost", user="root", passwd="admin", database="crc" ) cursor = db.cursor() query = ""\ "SELECT sumofMonths - tamountThis as Previous_Months, tamountThis as This_Month, total - sumofMonths as Next_Months FROM "\ "(SELECT YEAR(r.pickupda...
true
c52ccbcb73366b1879f2219d01bf428de422bce4
quekai/geomedian
/geomedian.py
UTF-8
2,932
2.6875
3
[ "MIT" ]
permissive
import numpy as np import math from math import pi import utils from externals import nputils f = 1/298.257223 R = 6378137.0 R_km = R/1000 e = 8.1819190842622e-2 b = np.sqrt(np.power(R,2) * (1-np.power(e,2))) ep = np.sqrt((np.power(R,2)-np.power(b,2))/np.power(b,2)) def llaToECEF(points): lat = np.radians(points...
true
d1638884e29aa372e11d831c8479a1b99543cc45
alldatacenter/alldata
/ai/modelscope/modelscope/models/cv/image_to_image_translation/ops/random_mask.py
UTF-8
2,745
2.921875
3
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
permissive
# Copyright 2021-2022 The Alibaba Fundamental Vision Team Authors. All rights reserved. import cv2 import numpy as np __all__ = ['make_irregular_mask', 'make_rectangle_mask', 'make_uncrop'] def make_irregular_mask(w, h, max_angle=4, max_length=2...
true
ce6deff3f81196af315193c468531e1fd335ab58
patricknitschke/ClassificationTTT4275
/Iris/iris.py
UTF-8
4,550
2.890625
3
[]
no_license
import numpy as np import random import matplotlib.pyplot as plt import seaborn as sns classmap = { 'Iris-setosa': np.array([1, 0, 0]), 'Iris-versicolor': np.array([0, 1, 0]), 'Iris-virginica': np.array([0, 0, 1]) } def arrange_order(x,t): ''' Sets up the array such that the first 90 rows are 30*3...
true
f71e8bb41a4c7eabab713c6136e1e0440cba717d
sumanth-lingappa/prayathna
/emp_records.py
UTF-8
314
2.75
3
[]
no_license
""" add, edit, delete employee records. Employee : Name, Emp.ID, age, designation, salary """ class Employee(object): def __init__(self, name, id, age, desgn, sal): self.name = name self.id = id self.age = age self.designation = desgn self.salary = sal
true
206239441e9314e681ffa9bbd3408c1b5b9ed67c
lompabo/bbs2019dtm
/lab02/lutil.py
UTF-8
11,870
3
3
[]
no_license
#/usr/bin/env python # -*- coding: utf-8 -*- import itertools import numpy as np from matplotlib import pyplot as plt import os import pandas as pd def load_lr_data(fname): ''' Load data for the language recognition problem ''' # parse datafile snippets = [] languages = [] with open(os.pat...
true
0d0ba11d331a4acb1a4fa0b48c87307230ff5fc4
WCHENG1222/Purchase_Prediction
/purchase_prediction.py
UTF-8
7,269
2.828125
3
[]
no_license
# Online Purchase Intention Prediction import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.feature_selection import mutual_info_classif, SelectKBest from sklearn.model_selection import train_test_split from imblearn.over_sampling import SMOTE from sklearn.linear_model i...
true
bd0f6575f2b9b5bb86d682d3de217aea6ce25d6f
pataquets/py_upnp_redirect
/upnp_redirect/commands/chromecast.py
UTF-8
533
2.515625
3
[ "MIT" ]
permissive
import pychromecast import logging class Chromecast(object): def __init__(self, args): super(Chromecast, self).__init__() self._args = args def run(self): logging.info('run chromecast command:%s' % self._args.chromecast_cmd) chromecasts, _ = pychromecast.get_chromecasts() ...
true
61c6334cddb5d9981347b6b72ccf199e90c124f9
karlgama/faculdade-lp
/ac1/main.py
UTF-8
433
2.90625
3
[]
no_license
import ac01 # tupla = (0, 1, 8, 8, 8, 7, 5) # print(tupla) # print(ac01.quantidade(tupla,8)) # lista = [0, 5, 8] # print(ac01.excluir(lista, 8)) lista = [0,5,7,3,8,2,5,8,4,2,8] # print(ac01.posicoes_lista(lista, 8)) print(ac01.excluir(lista,7)) # dicionario = {"joao":[], # "maria":[5.5,7,8], # ...
true
cb236928421e62dfd23cca2e5d1b7da2b432b9b7
shuxiangguo/Python
/Learn/spider/21DaysOfDistributedSpider/ch03/weather_spider/spider.py
UTF-8
401
2.640625
3
[]
no_license
# encoding: utf-8 """ @author: shuxiangguo @file: spider.py @time: 2018-11-02 03:33:44 """ import requests from bs4 import BeautifulSoup def parse_page(url): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' } response =...
true
5c8d531474c4cf8f36ccf6688d0e4690ab777fce
ikamensh/pydolons
/game_objects/items/on_unit/slot_groups/Inventory.py
UTF-8
406
2.65625
3
[ "Unlicense" ]
permissive
from game_objects.items import Slot from game_objects.items.on_unit.slot_groups.SlotGroup import SlotGroup class Inventory(SlotGroup): @staticmethod def slot_name_at(i): return f"inventory_{i:00d}" def __init__(self, max_capacity, owner): all_slots = [Slot(Inventory.slot_name_at(i), owner...
true
7cb9017d0e6d1df5c73c65d9e67c452f4f6f7711
QinGeneral/Algorithm
/leetcode/palindrome-number.py
UTF-8
1,118
3.453125
3
[]
no_license
class BetterSolution: def isPalindrome(self, x: int) -> bool: if x < 0 or (x % 10 == 0 and x != 0): return False if x < 10: return True revert = 0 while(x > revert): revert = int(revert * 10) + int(x % 10) x = int(x / 10) ...
true
c51d61bbcfc771566bc90897610f71e9274af902
elijahkash/python_study
/subfolders/test_subfolders.py
UTF-8
340
2.6875
3
[]
no_license
from subfolders import Solution def test_1(): assert(Solution.removeSubfolders(None, ["/a", "/a/b", "/c/d", "/c/d/e", "/c/f"]) == ["/a", "/c/d", "/c/f"]) def test_2(): assert(Solution.removeSubfolders(None, ["/a", "/a/b/c", "/a/b/d"]) == ["/a"]) def test_3(): assert(Solution.removeSubfolders(None, ["/...
true
9b884f8265de88aef1debe091cc26d60b7c31557
Chhekur/codechef-solutions
/COOK100B/TRUEDARE.py
UTF-8
395
2.5625
3
[ "MIT" ]
permissive
for _ in range(int(input())): tr = int(input()) tra = [int(x) for x in input().split()] dr = int(input()) dra = [int(x) for x in input().split()] ts = int(input()) tsa = [int(x) for x in input().split()] ds = int(input()) dsa = [int(x) for x in input().split()] f = 0 for i in tsa: if i not in tra:f = 1 for...
true
ee43ae2e6ec7ccc899b7986ab7c3eb09e92ec781
abecus/DS-and-Algorithms
/problems/leetcode/matrix542.py
UTF-8
1,611
4.03125
4
[]
no_license
""" 542. 01 Matrix Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: [[0,0,0], [0,1,0], [0,0,0]] Output: [[0,0,0], [0,1,0], [0,0,0]] Example 2: Input: [[0,0,0], [0,1,0], [1,1,1]] Output: [[0,0,0], [0,1,0], [1...
true
cfaffa029c13d759fe3bc39973cb4d9521f9d7b0
lenolib/filter-lab
/save_load.py
UTF-8
5,357
2.53125
3
[]
no_license
# -*- coding:utf-8 -*- import cPickle import pickle import os from filters_package.filter_base import EMPTY import re import imp #Cleans a string to make it a valid python identifier (variable name) clean = lambda varStr: re.sub('\W|^(?=\d)','_', varStr) def loadFilters(filename): filename = unicode(filename).r...
true
a90bb9b7d2d413bc9e111dd2bda8403e986f859a
thebigbluebox/Code-Playground
/Algorithms/Python/CTCI/Solutions/CH10/q1.py
UTF-8
509
3.921875
4
[]
no_license
# sorted merge def in_place_merge_sort(a, b): length_a = len(a) length_b = len(b) index_start = length_b - length_a - 1 for key in reversed(a): if a > b[index_start]: b[length_b - 1] = a[key] length_b -= 1 else: b[length_b - 1] = b[index_start] ...
true
8458d3769056a7c05d72fb012409016cba255307
Qazzquimby/leet_code_practice
/tests/test_self_dividing_numbers.py
UTF-8
1,141
3.3125
3
[]
no_license
from tasks import self_dividing_numbers def assert_returns_same_as_left(left: int, right: int): actual = self_dividing_numbers.self_dividing_numbers(left, right) expected = [left] assert expected == actual def test_when_left_right_1__return_1(): assert_returns_same_as_left(1, 1) def test_when_left...
true
5812fe3dd01b252fb7409e0f71e40503a11d29e3
nikitabondarenko/DeepSounds.io
/mapi.py
UTF-8
993
2.828125
3
[]
no_license
import sentiment from flask import Flask, request from flask_restful import Resource, Api # from sqlalchemy import create_engine from json import dumps #Create a engine for connecting to SQLite3. #Assuming salaries.db is in your app root folder # e = create_engine('sqlite:///salaries.db') app = Flask(__name__) api ...
true
9f6f51a24dd65c78a28c8996cf7254380c42f866
ausecocloud/silvereye_wps_demo
/src/silvereye_wps_demo/models/helpers/validators.py
UTF-8
3,486
3.25
3
[]
no_license
from typing import Tuple import silvereye_wps_demo.models.ecoconstants as eco_constants class Validators(object): @staticmethod def is_valid_range(var_range: Tuple, var_type: str) -> bool: """ validates a (lo, hi) range tuple of type var_type. var_type :: "time" | "lat" | "lon" ...
true
2f80e66a30a0f688845a61eb1efc7493351c04a6
Baxonn2/ids
/pre_proceso.py
UTF-8
1,298
3.171875
3
[]
no_license
import pandas as pd import numpy as np def load_data(path): result = pd.read_csv(path, header=None) print(result.shape) # print(result.info()) # result.iloc[:,[1]].astype(str)#.astype(int) groups = { 1: result.iloc[:, 1].unique(), 2: result.iloc[:, 2].unique(), 3: result.i...
true
f251f43a13c12471183c553b3faa3c8c985255bb
Aasthaengg/IBMdataset
/Python_codes/p03239/s520985801.py
UTF-8
221
3.015625
3
[]
no_license
N, T = map(int, input().split()) min_cost = 1001 for i in range(N): c, t = map(int, input().split()) if t <= T: min_cost = min(min_cost, c) if min_cost == 1001: print('TLE') else: print(min_cost)
true
4e81d1c12502472bbc3a26084b4d97f8313c80ed
anishLearnsToCode/python-workshop-1
/day-1/sumOfSquares.py
UTF-8
117
3.5
4
[]
no_license
number = int(input()) sum = 0 for i in range(1, number + 1): sum += i ** 2 # --> sum = sum + i ** 2 print(sum)
true
bbe93fbcfebd587cb76915649b4137d26e00e17e
bramlenting12345/leren_programmeren
/Leren programeren/meten-is-weten.py
UTF-8
679
3.984375
4
[]
no_license
a = 100 b = 10 max = 100 min = 10 if a > b: print("a is grooter dan b") print ('a is het grooste getal') print(max) print(" ") print("..........................") print(" elif statement ") print("..........................") if a < b: print("b is kleiner dan a ") print('b is het kle...
true
221ffe1dcaf828f13f155c1ea7cb09f3326b09c2
Oxydros/Phantom-of-the-Opera
/AlphaBeta/GameNode.py
UTF-8
417
3.109375
3
[ "MIT" ]
permissive
class GameNode: def __init__(self, pos, color, sColor, score, used, parent=None): self.pos = pos # a char self.color = color self.sColor = sColor self.score = score self.used = used # an int self.parent = parent # a node reference self.move = "" self.child = [] # a list o...
true
7699d14acc939af161f49b000ac458d874857220
ultrabots/QuadraTot
/code/example2.py
UTF-8
1,635
2.734375
3
[]
no_license
#! /usr/bin/env python import os, dynamixel, time, random def actuators_moving(actuators): for actuator in actuators: if actuator.cache[dynamixel.defs.REGISTER['Moving']]: return True return False # The number of Dynamixels on our bus. nServos = 11 # Set your serial port accordingly. if ...
true
8a81d56f1941359c370ce009bac866abc3c3d053
CaronDylan/HL_prog
/Prog_pyt.py
UTF-8
798
3.6875
4
[]
no_license
#Programme réalisé par: CARON Dylan #Groupe : BROHAN Romain, GASCOIN Samy, CARON Dylan #Version peu efficace (voir pas du tout) def era(nb) : #Initialisation l = [2] #On stocke le 1er nombre premier insert = True #On parcours tous les nombre entre 3 et celui passé en paramètre for cpt in [...
true
dfd8766cd5e6355703a118732fd08787d81af512
andreww/MSAT
/doc_src/extract_matlab_help.py
UTF-8
1,894
2.65625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import re import os def matlab2asciidoc(matlab_file, path='./funcs'): # Grab the text from the first comment block helptext = [] gothelp = False inhelp = False fmat = open(matlab_file, 'r') for line in fmat: if gothelp: exit elif re.match(r'\s*...
true
a7c4501156efc67ec23c3059cd5c856a25a2927e
lizwood/mvTCR
/tcr_embedding/models/bigru.py
UTF-8
6,761
2.5625
3
[ "MIT" ]
permissive
import torch import torch.nn as nn class BiGRUEncoder(nn.Module): def __init__(self, params, hdim, num_seq_labels): """ :param params: hyperparameters as dict :param hdim: output feature dimension :param num_seq_labels: number of aa labels, input dim """ super(BiGRUEncoder, self).__init__() self.embed...
true
957b402ca0ef50b2e6fe249c5db02dfa2e581343
cutierobot/Folder-Compare
/FC.py
UTF-8
11,463
3.125
3
[ "MIT" ]
permissive
# \033[1;32;40m green # \033[1;35;40m purple # \033[1;34;40m Bright Blue # \033[0;37;40m Normal text # \033[2;37;40m Normal text underline import filecmp import sys # folder1="/Volumes/Mikaela\'s Hardrive/TV SHOWS" # folder2 = "/Volumes/Grayson/Tv shows/" # dc = filecmp.dircmp(folder1, folder2) # dc.report_full_closur...
true
aa360d4a833b646cb5c4f69a4c277d204eb6fbad
srikarporeddy/project
/list1.py
UTF-8
790
3.4375
3
[]
no_license
a = [1,1,2,3,3,5,8,13,34,55,89] b = [1,2,3,4,5,6,7,8,9,0,13,11,12,13] '''print([a,b]) c=[] c.append(a) print(c) c.insert(b) print(c)''' #s=list(set(a).intersection(b)) #print(s) def common_element(a,b): result =[] for element in a: if element in b: #if a not in result: result.append(element) print (set...
true
efbb45b1209427b88f7a217ef9f17416f86ec05a
fmogollonr/hambox
/src/common/pynicerfsa828.py
UTF-8
6,842
2.609375
3
[]
no_license
#!/usr/bin/env python import serial from .logger import Logger import RPi.GPIO as GPIO class Sa828: ''' A class for managing the NiceRF Sa828 chip via serial ''' def __init__(self, **kwargs): self.log = Logger("nicerf") self.log.send_log("debug", "__init__") GPIO.setmode(GPIO....
true
8893ae19b6909d1efbde506bfb3d2f17a831f122
MarkusPettersson98/MVE051-Assignment3
/python/frequencies.py
UTF-8
1,123
3.140625
3
[]
no_license
import numpy as np from textprocessing import clean_file, frequencies def sort_dict(dictionary): return sorted(dictionary.items(), key=lambda key_value: key_value[0]) def frequencies_percentage(words): word_lenghts = np.array(list((map(len, words)))) freq = frequencies(word_lenghts) sorted_freqs = ...
true
3f2daf10f0a7a27e7d47af5acb435ee2e9a3a4d4
ErickMimin/Ukranio
/Parcial 1 y 2/C-java-Python/FindIPN.py
UTF-8
242
3.3125
3
[]
no_license
import random cadenota = "" enota = 17536 * 1000 while enota != 0: for x in range(3): cadenota += random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZ") cadenota += " " enota -= 1 print("IPN aparace " + str(cadenota.count("IPN")))
true
987af3c992be351b530c9d2a21ba770638159e60
luanshiyinyang/LeetCode
/0013-Roman to Integer.py
UTF-8
832
4.21875
4
[]
no_license
class Solution: def romanToInt(self, s: str) -> int: """ 这个题目虽然给的难度是easy,,但是个人感觉比反过来的之前那一题medium稍显复杂 思路就是罗马数字大致是由大到小表示逐渐相加,但是也可能存在小到大的相减情况 这里又一个简单思路:累加一直进行,但是一旦倒转输入串存在大到小的情况,虽然累加了这个数,但是再减两次这个数 :param s: :return: """ chars = {"M": 1000, "D": 500, "C": 1...
true
e16e156fa88af0188282b060e353fa8bb0c13ec9
chxzh/stroke_rendering_thesis
/src/texture_test.py
UTF-8
1,988
2.703125
3
[]
no_license
from scipy import misc as misc from scipy import ndimage as ndimage from numpy import array as array infilename = "../res/strokes/paint_stroke_revised.jpg" outfilename = "../res/strokes/paint_stroke_revised_2.png" def covRGB2HSV((r,g, b)): h, s, v = 0.0, 0.0, 0.0 M = float(max(r, g, b)) m = float(min(r, g, ...
true
1626d5dcc6e62e99ae014c086893476d07c6f982
DirkdenHoedt/AdventOfCode2020
/day2/src/puzzle2.py
UTF-8
725
3.1875
3
[ "MIT" ]
permissive
#!/bin/env python3 rules = [] def puzzle2(): valid = 0 # Read in all the rules with open('input.txt', 'r') as input: for line in input: (minmax, letter, seq) = line.split(' ') letter = letter[:-1] # seq = seq[:-1] (minC, maxC) = minmax.split("-") ...
true
d023a9e385e50814682de8f6395b199d116e6935
crccheck/postdoc
/postdoc.py
UTF-8
4,541
2.75
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Usage: phd COMMAND [options] [command options] COMMAND A command like psql, createdb, dropdb Options: --postdoc-dry-run Print output and then exit. --postdoc-quiet Don't print debugging output. """ from __future__ import unicode_literals import os import...
true
b4544f0fe181a4262f42498736afe1954b617c37
Stillkam/game_python
/client.py
UTF-8
10,041
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- from sys import exit from time import sleep import pygame from thread import * black = (0,0,0) red = (255,0,0) slateGray = (112,128,105) DarkSlateGra=(47,79,79) DeepSkyBlue4=(0,104,139) grey31=(79,79,79) RoyalBlue=(65,105,225) Grey=(190,190,190) pygame.init() xofont = pygame....
true
6aac59e296b04b823987babf0693853b0a2ab6f6
TheRebelOfBabylon/obilisk
/archive/old_math_core/solve_functions.py
UTF-8
84,333
3.53125
4
[]
no_license
#TODO - Fix circular referencing between Algebra.py and this file """Solve functions""" from __future__ import annotations from math_core.Equation import is_number, bracketify, stringify from math_core.Arithmetic import is_even import copy from math_core.Algebra import Algebra, bracket_add from typing import List, Tupl...
true
6ee3a5885ff3eb44ffe18cd5b508bf336c262f76
yodien/simple-python-snakeGame
/snakePanel.py
UTF-8
1,700
3.390625
3
[]
no_license
from snakeControl import * def main(): # set up window width, height = turtle.screensize() turtle.setworldcoordinates(0, - 20, width, height - 20) turtle.title('Game of Snake') # write instructions writer = turtle.Turtle() writer.hideturtle() writer.penup() writer.setposition(5, -1...
true
2f9dac73a37efe4abb994f8d2b52630b1ceb5401
Jabari-Dawkins/Udacity
/Web Development/chpt2prob2/main.py
UTF-8
3,228
2.65625
3
[]
no_license
#Blog signup import webapp2 import re form = """ <form method="post"> <h1>Signup</h1> <br> <pre>Username: <input type = name = "username" "text" value = %(username)s> <b style="color:red">%(usr_err)s</b> <pre>Password: <input type = "password" name = "password" value = %(password)s> <b style="color...
true
6d263a4b2d49bd387d1d694d7846d808eae49ce1
geosoco/twitter_capture_client
/listeners/file.py
UTF-8
2,891
2.609375
3
[]
no_license
#!/usr/bin/env python """Listeners for handling streaming events.""" import os import logging from .base import BaseListener from rotating_out_file import RotatingOutFile log = logging.getLogger(__name__) class FileListener(BaseListener): """File Listener.""" def __init__(self, base_dir, collection_name...
true
9ce585782d5fd7c9e066da65c6ed5bae5dabd15b
Lokesh97Bansal/tf_basics
/Tarea_Classification_Deep/Wines_Superficial_Norm.py
UTF-8
15,349
3.1875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 26 12:16:08 2018 @author: Cortana """ import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import csv import itertools from sklearn.metrics import confusion_matrix # Ruta de los archivos con los datos de entrenamiento y validación DATA_FILE_DATA ...
true
5c2e09e7e1fc570cd10717a3d75d9461f8be5263
juliagong/sketch2face
/datasets/colorferet/gen_grayscale.py
UTF-8
716
2.515625
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
import numpy as np import os from PIL import Image test_color_dir = './test/color' train_color_dir = './train/color' test_gray_dir = './test/grayscale' train_gray_dir = './train/grayscale' image_list = [os.path.join(test_color_dir, f) for f in os.listdir(test_color_dir) if os.path.isfile(os.path.join(test_color_dir, ...
true
5d9825ed9dd6a1dd7581c7ef348e727b22ff4651
JohnPhillipRobertson/uab-coursework
/CS303/lab5assi5/driver.py
UTF-8
1,544
3
3
[]
no_license
from time import perf_counter as perf from quick_sort import quicksort, med_quicksort from lib import ins_sort_wrapper, merge_sort_w, heap_sort files = ['input_16.txt', 'input_32.txt', 'input_64.txt', 'input_128.txt', 'input_256.txt', 'input_512.txt', 'input_1024.txt', 'input_2048.txt', 'input_4096.txt', 'input_81...
true
bdfed4cf0c8de16e747d511d135a4fcbc796a508
tksmd/simple-lasso
/lasso/cd.py
UTF-8
544
3.125
3
[]
no_license
import numpy as np def soft_threshold(X: np.ndarray, thresh: float): return np.where(np.abs(X) <= thresh, 0, X - thresh * np.sign(X)) def coordinate_descent(X: np.ndarray, y: np.ndarray, alpha: float = 1.0, n_iter: int = 1000) -> np.ndarray: n_samples = X.shape[0] n_features = X.shape[1] w = np.zero...
true
df43cce6d68d8e9f120fe0141abe4396f2d6e203
imucici/my-learning-note
/LeetCode/week4/922. Sort Array By Parity II.py
UTF-8
367
3.21875
3
[]
no_license
class Solution: def sortArrayByParityII(self, A: List[int]) -> List[int]: even = [] odd = [] final = [] for i in A: if i%2 == 0: even.append(i) else: odd.append(i) for x,y in zip(even,odd): final.append(x) ...
true
d0423ad984a6f51aef8d9846b971b7c5d4ee1ede
lincolnkinley/PointCloud_DynamicObjectFinder
/odom_filter/src/odom.py
UTF-8
2,892
2.71875
3
[]
no_license
#!/usr/bin/env python #-*- coding: utf-8 -*- import rospy import math from tf.transformations import euler_from_quaternion from dbw_mkz_msgs.msg import WheelSpeedReport from sensor_msgs.msg import Imu from geometry_msgs.msg import Pose class Callback: def __init__(self): self.Imu = None self.Wh...
true
c8e8023c1f1e556be4922dd75e7599e333200a46
JackVoice/Testing
/Code Accdemy/Polymorphism_Dunder.py
UTF-8
345
3.28125
3
[ "Unlicense" ]
permissive
class Atom: def __init__(self, label): self.label = label def __add__(self, other): return Molecule([self, other]) class Molecule: def __init__(self, atoms): if type(atoms) is list: self.atoms = atoms sodium = Atom("Na") chlorine = Atom("Cl") #salt = Molecule([sodium, chlorine]) ...
true
be151860151d80b5fd9a868cd95514fd2bc946fa
jrivo/prisma-client-py
/tests/integrations/postgresql/tests/test_json.py
UTF-8
4,227
2.671875
3
[ "Apache-2.0" ]
permissive
import pytest from prisma import Client, Json @pytest.mark.asyncio async def test_create(client: Client) -> None: """Creating a model with Json data""" model = await client.types.create( data={ 'json_obj': Json.keys(country='Scotland'), }, ) assert model.json_obj == {'count...
true
834e3a859f34b303b964965ecbd9725e8517cb51
spotted-deer/python
/Scrapy-Django/models.py
UTF-8
2,744
2.765625
3
[]
no_license
from django.db import models # Create your models here. class News(models.Model): id = models.AutoField(primary_key=True) title = models.CharField('标题', max_length=70) # 文章标题,CharField 表示对应数据库中表的列是用来存字符串的,'标题'是一个位置参数 # (verbose_name),主要用于 django 的后台系统,不多做介绍。max_length 表示能存储的字符串 # 的最大长度 ...
true
b406ee6f1b62ffa1d4c078e9011dc438e950983c
sunitskm/Python
/recursion/print_elements.py
UTF-8
169
3.546875
4
[]
no_license
a = [1,2,3,4,5,6,7,8] def recur_print(a): if(len(a)==1): print(a[0],end= " ") else: recur_print(a[:1]) recur_print(a[1:]) recur_print(a)
true
bc1c6f957154fc502f5146723b9ff061d471e91c
JWill831/Algorithms
/Longest Peak in Array.py
UTF-8
642
3.296875
3
[]
no_license
def longestPeak(array): longestPeakLength = 0 i = 1 while i < len(array)-1: peak = array[i-1] < array[i] and array[i] > array[i+1] if not peak: i += 1 continue lIdx = i - 2 while lIdx >= 0 and array[lIdx] < array[lIdx+1]: lIdx -= 1 ...
true