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
56da60b91d8888b7961882cd8f969a51633497c6
KeeeeeK/Card_Games
/Dominion/All_Classes.py
UTF-8
12,279
2.9375
3
[]
no_license
from __future__ import annotations from typing import Callable, Dict, List, Union, Optional from functools import reduce from Card_game.CG_Player import CG_Player from Card_game.CG_Card import CG_Card from Card_game.CG_Game import CG_Game from Card_game.Containers import CG_Hand, CG_Deck_and_Discard, CG_Container from ...
true
98477bf2951087e116f58df34fcca890fd38bcff
Aasthaengg/IBMdataset
/Python_codes/p02629/s512449468.py
UTF-8
177
3.390625
3
[]
no_license
n = int(input()) result = "" while n>0: if n%26 == 0: result = "z" + result n=n//26-1 else: result= (chr(ord("a")+n%26-1)) + result n=n//26 print(result)
true
d54e017fa82790c7c512101d2fc576df796ca2a3
laxmanlax/Programming-Practice
/CrackingCodingInterview/2017/linkedlist.py
UTF-8
200
3.03125
3
[]
no_license
#!/usr/bin/env class Node: def __init__(self, data=None, next_node=None): self.data = data self.next_node = next_node def __str__(self): return str(self.data)
true
0a8a1f285f6e2bf3d2bcfc36fa7cce54f2fe9fbc
JoE11-y/PY4E
/C2_Ex3.py
UTF-8
119
3.9375
4
[]
no_license
# Question 3 Temperature Converter T_C = input('Enter Temperature in Celsius: ') T_F = (int(T_C) + 32)*5/9 print(T_F)
true
321f8655c6cc183b9275df2532141f970ee3131a
jingwenh/Leetcode2
/717. 1-bit and 2-bit Characters.py
UTF-8
775
3.890625
4
[]
no_license
from collections import deque # When reading from the i-th position, if bits[i] == 0, the next character must have 1 bit; else if bits[i] == 1, the next character must have 2 bits. We increment our read-pointer i to the start of the next character appropriately. At the end, if our pointer is at bits.length - 1, then th...
true
6b644b0c949ed38bae3c097f44525012110e1988
ismailhy58/server
/pygame/main.py
UTF-8
3,896
3.015625
3
[]
no_license
from numpy import sqrt import pygame import pandas as pd #import time #initialize pygame.init() #variables screen_width = 800 screen_height = 600 treshold = 150 #screen screen = pygame.display.set_mode((screen_width,screen_height)) #create screen running = True #Title and icon pygame.disp...
true
768ba1be6e1f9b30f4a82ba9ca507c060c1befe5
caminden/Small-Projects
/Magic8.py
UTF-8
847
3.671875
4
[]
no_license
#Beginner Magic 8 ball in python import random val = "start" while val != "quit": n = random.randint(0, 10) val = input("Enter question or quit to quit \n") if(val == "quit"): print("Exiting...") else: if (n == 0): print("Yes") elif (n == 1): print("No")...
true
0f21e9badc5dd561641125bf4f16d0fc30aba9c0
junyeong-dev/python3-class_arguments
/class-method.py
UTF-8
1,340
3.96875
4
[]
no_license
class Car(): def __init__(self, **kwargs): self.wheels = 4 self.doors = 4 self.windows = 4 self.seats = 4 # get("k", "d") : k는 key, d는 default를 가리킴 self.color = kwargs.get("color", "black") self.price = kwargs.get("price", "2000") # method는 class안에 있는 fu...
true
a151939dd0cd925605da907bdaa9977d842024c3
jaap67/apresentacao_tesi
/echocardiogram_k-fold.py
UTF-8
4,173
2.5625
3
[]
no_license
import pandas as pd import numpy as np from sklearn.cross_validation import cross_val_score from collections import Counter df = pd.read_csv('echocardiogram.csv') df.drop('name', 1, inplace=True) df.drop('group', 1, inplace=True) df.drop('mult', 1, inplace=True) df.drop('wall_motion_score', 1, inplace=True) df.drop(df...
true
aa9545c2ab465fa2ba1395102253447bbc3676a8
eMZet777/python
/100 Optymalizacja i refaktoryzacja kodu z poprzednich lekcji - lekcja 100.py
UTF-8
171
3.3125
3
[]
no_license
class Rocket: def __init__(self): self.altitude = 0 def moveUp(self): self.altitude +=1 rockets = [Rocket() for x in range(5)] print(rockets)
true
6f6c59e2a36537d231d5a5bdcee97b55b3674022
dleony/PLA
/process/detect_new_files.py
UTF-8
5,548
2.6875
3
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*-# # # Copyright (C) 2010 Carlos III University of Madrid # This file is part of PLA: Personal Learing Analytics # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foun...
true
a2124c5ac060a6f228072db7214bf5229449c693
RobertErlandsson/EITN41
/Assignments/Assignment1/Luhn/main.py
UTF-8
612
3.203125
3
[]
no_license
__author__ = "Marcus Rodan & Niklas Jönsson" import luhn as l import re def read_file(filename): numbers = [] with open(filename) as credit_numbers: for number in credit_numbers: numbers.append(number.rstrip()) return numbers def solve(numbers): solution = "" for number in nu...
true
980729d6f7977bf24f83f4a3b503730d3fdcaebc
nathanmcunha/exercicios
/Phyton Brasil Exercises/Lista Sequencial/ex15.py
UTF-8
310
3.03125
3
[]
no_license
hora=int(input("entre com as horas trabalhadas")) valorh=float(input("entre com o valor da hora")) bruto=hora*valorh inss=bruto*0.08 sindicato=bruto*0.05 imposto=bruto*0.11 liquido=(bruto-inss-sindicato-imposto) print("Salario Bruto: %f \nSindicato: %f \nImposto:%f \nINSS:%f" %(bruto,sindicato,imposto,inss))
true
0304311ac63e4982993916cae1f572d57c92556d
sandhyakopparla/tasks-practice
/day7/methodoverloading.py
UTF-8
85
2.8125
3
[]
no_license
def AddMe(a,b): return a+b def AddMe(a,b,c): return a+b+c print(AddMe(2,3,5))
true
c47aa441cdd20b663139ff1d69ba666f579f346b
paridhi1314/Python-Programs
/list/q27.py
UTF-8
456
3.34375
3
[]
no_license
l = [] n = int(input("Enter N = ")) for i in range(n): v = int(input("Enter number = ")) l.append(v) small = l[0] if i in range(n): if small>l[i]: small = l[i] second_smallest = l[0] if i in range(n): if second_smallest>l[i]: if small!=l[i]: second_smallest = l[i] print(...
true
8d8597094ebb23f9d630ca32075f9b44c1b6a871
rafaelperazzo/programacao-web
/moodledata/vpl_data/424/usersdata/341/95262/submittedfiles/divisores.py
UTF-8
296
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- import math n = int(input('Digite o valor de n: ')) a = int(input('Digite o valor de a: ')) b = int(input('Digite o valor de b: ')) x=1 cont=0 while (cont<n): if(x%a)==0 or (x%b)==0: print(x) x = x+1 cont = cont+1 else: x = x + 1
true
ae0d7d1f7e9f1385b5fde0c7951e2e2b2c3d0b1a
Priyansh2/Automatic-Keyword-Extraction-Data
/datasets/KP20k/src/json_to_txt_files.py
UTF-8
1,515
2.734375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """Convert the JSON file to txt files.""" from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from __future__ import with_statement import sys import logging import json impo...
true
023b06e95109579035be6f3ace088a670d78890a
clones/wtforms
/wtforms/ext/dateutil/fields.py
UTF-8
2,603
3.078125
3
[ "BSD-3-Clause" ]
permissive
""" A DateTimeField and DateField that use the `dateutil` package for parsing. """ from dateutil import parser from wtforms.fields import Field from wtforms.validators import ValidationError from wtforms.widgets import TextInput __all__ = ( 'DateTimeField', 'DateField', ) class DateTimeField(Field): """ ...
true
8987973e23f2f15eb72f425ccb729b61c8e8765d
yasirysr47/CareTakerV2
/best_model_finder.py
UTF-8
5,226
2.5625
3
[ "MIT" ]
permissive
import time import pandas as pd from sklearn.svm import SVC, LinearSVC, SVR, LinearSVR from xgboost import XGBRegressor from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestRegressor from sklearn.naive_bayes import GaussianNB, CategoricalNB, BernoulliNB from sklearn.preprocessing...
true
49d4ccaa6edf38721735fbca1040b05cd11ca4e2
green-fox-academy/hoanjinan
/week-01/day-3/exercises-w1d3/strings/reverse.py
UTF-8
395
3.703125
4
[]
no_license
# Create a function called 'reverse' which takes a string as a parameter # The function reverses it and returns with the reversed string def reverse(value): new_string = "" for i in range(len(value)): new_string = value[i] + new_string return new_string reversed = ".eslaf eb t'ndluow ecnetnes siht...
true
e67ab14ba3e41c204e3e8e2a248c2170b8b17820
Ciwonie/python_cs150
/treehouse/data_analysis/week_3/vowel.py
UTF-8
455
3.875
4
[ "MIT" ]
permissive
def disemvowel(word): index = 0 vowel_list = [] vowel_list.extend(word) print(vowel_list) while index <= len(word): for i in vowel_list: if i == 'A' or i == 'E' or i == "I" or i == "O" or i == "U": vowel_list.remove(i) elif i == 'a' or i == 'e' or i =...
true
f79b78fbc4776579ff99d9f91a2efcd3dd545089
Richard-Lynch/good_to_know
/python/create_classes_in_loop.py
UTF-8
1,151
2.671875
3
[]
no_license
#!/usr/local/bin/python3 # ----- Errors ----- from flask_restful import HTTPException errors = { 'not_found' : { 'message' : "Not Found", 'status' : 404, }, 'user_not_found' : { 'message' : 'ahh couldnt find the user', 'status' : 404, ...
true
8e9fec46c40b023a13bcb82db0583a2c085c1426
AlexVrb/Diploma
/mainDT.py
UTF-8
1,222
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from sklearn import model_selection from sklearn.tree import DecisionTreeClassifier from sklearn.preprocessing import scale data = pd.read_table('objectMatrix.txt', sep=',', header = None) y = data[18] x = data[list(range(0, 18))] x = pd.Data...
true
9ff3acd0acf0d05e3a1eefec96ea3e34196e6342
7in14/pk-python
/tests/integration/crime_test.py
UTF-8
1,803
2.609375
3
[]
no_license
import unittest import json from unittest.mock import Mock, patch from app import app # https://realpython.com/blog/python/testing-third-party-apis-with-mocks/ class CrimeTestCase(unittest.TestCase): crimeData = [{ 'district': 'SOUTHEAST', 'inc_datetime': '2018-02-02T00:00:00.000', 'lcr'...
true
f5f2332b5082ca8cdafcd1220d759a8dfa738b18
bhowiebkr/AnyIMU
/python/SerialThread.py
UTF-8
876
2.65625
3
[]
no_license
from PySide.QtCore import QThread, Signal, QMutex, QWaitCondition import serial, time # ----------------------------------------------------------------------------------------- class SerialThread(QThread): progress = Signal(str) def __init__(self, parent=None): super(SerialThread, self).__init__(parent) s...
true
d72c546277b520afb30cafb2da3a91e51b0947a5
gossrock/utils
/tests/test_command_to_run.py
UTF-8
1,981
3.5625
4
[ "MIT" ]
permissive
import sys import time import argparse def fizzbuzz(start: int = 1, max: int = 100, out_mult: int = 3, err_mult: int = 5, pause: float = 1) -> None: for n in range(start, max+1): if n % out_mult == 0: print(f'{n}', file=sys.stdout) sys.stdout.flush() if n % err_mult == 0: ...
true
d9ec5137ba7357785b8dc6f20543165025a1d024
maiorem/Artificial-Intelligence
/Study/ml/m14_gridSearch2.py
UTF-8
2,387
2.78125
3
[]
no_license
# 유방암 데이터 # 모델 : RandomForestClssifier import numpy as np from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, r2_score # from sklearn.utils.testing import all_estimators from sklearn.model_selection import train_test_split, KFo...
true
f93b46192b8a45f6b6340c89ef8934f7bdc739a1
NagyBz/Iris-detection
/hough_transform.py
UTF-8
4,682
2.9375
3
[]
no_license
import cv2 as cv import numpy as np from intersection_over_union import union_area, intersection_area if __name__ == '__main__': img_name = 'eye2.bmp' dx, dy, dr = 0, 0, 0 zx, zy, zr = 0, 0, 0 k, sigma, min, max, acc, md, p1, p2, r1, r2 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 if img_name == 'eye3.jpg': ...
true
f7a90ac639b046f9beeed96dc21685c9908f675b
Kubo-SVK/strojove-ucenie
/Zadanie 2/main.py
UTF-8
6,487
2.71875
3
[]
no_license
import os # python 3.8 a viac odporucam ale vsetko nad 3.5 by malo byt ok # https://www.python.org/downloads/ ale na macu ho budes mat uz od zaciatku asi # toto treba dat do konzoly/terminalu (ak to nepojde tak len pip) # pip3 install tensorflow pandas matplotlib sklearn os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" # le...
true
4ee8b409925a59407b6613b857925af15960168b
Labyrinth108/Content-Based-News-Recommendation-System-in-Spark
/code/Python/process_data.py
UTF-8
5,044
2.8125
3
[]
no_license
import pandas as pd import time import numpy as np import random from utils import * import os def changeToTimestamp(sep_time): time_struct = time.strptime(sep_time, "%Y-%m-%d %H:%M:%S") timestamp = int(time.mktime(time_struct)) return timestamp def get_data_time(filename, sep, names): raw_data = pd.r...
true
9b968eb9d23aaa4e2104aac29a8243ab1f56423a
peter-shoes/AOC2019
/AOCDAY2/AOCDAY2P1.py
UTF-8
1,258
3.15625
3
[]
no_license
# read the file into the program def readfile(): f = open('AOCDAY2.txt', 'r') flist = f.read().split(',') flist[-1] = flist[-1][:-1] intlist = [] for i in flist: intlist.append(int(i)) return intlist def opcode_reader(intcode,pos=0): # get current opcode opcode = intcode[pos] ...
true
135b025c4c355cd607c68d7a54f753d1480b7d41
BurningSpear/prj-4
/my_stocks_app/views.py
UTF-8
1,711
2.59375
3
[]
no_license
from django.shortcuts import render, redirect from .models import Stock from .forms import StockForm from django.contrib import messages from django.contrib.auth.decorators import login_required def home(request): import requests import json if request.method == 'POST': stockItem = request.POST['stockItem'] ...
true
2295c06a429d2cba3466e07e9f216c34075bf7ba
anacrochas1/compciv-2016
/exercises/0004-shakefiles/h.py
UTF-8
945
3.484375
3
[]
no_license
from os.path import join from glob import glob def single_file_reading_routine(fname): txtfile = open(fname, 'r') total_line_count = 0 nonblank_line_count = 0 for line in txtfile: total_line_count += 1 if line.strip() is not "": nonblank_line_count += 1 txtfile.close() ...
true
7f8dbd76decd85338b095cbcc5c9e95adc3e0570
JohnnyHsieh1020/python_practice
/m03.py
UTF-8
517
3.0625
3
[]
no_license
def credit(score): each_credits = [2, 2, 3, 3, 2, 2.5, 3, 2, 2, 3, 1.5] total_credit = 0 total_got = 0 failed = 0 if score[-1] == -1: total_credit = sum(each_credits) - 1.5 else: total_credit = sum(each_credits) for i in range(len(score)): if score[i]>= 60: ...
true
c3fe4d5e87f6a97e257a870881118902404b21aa
shekeru/lsbasi
/toylang/v3/lark/main.py
UTF-8
975
2.578125
3
[]
no_license
from stdlib import Globals from syntax import Parse from structs import * def Eval(Node, Env): if Node.data == "fn": return Function(Node.children) if Node.data == "strict": Hd, *Xs = [Eval(X, Env) for X in Node.children] print(Hd, Xs) return Hd(*Xs) if Xs else Hd if Node.da...
true
985bffbb6a59e7c19d42ea0873632f3ff1e59e6d
mweinberger-tgm/VenusAndMars
/prototyp/VenusAndMars.py
UTF-8
11,003
3.421875
3
[ "Apache-2.0" ]
permissive
# Author: Shao Zhang and Phil Saltzman # Last Updated: 4/20/2005 # # This tutorial will cover events and how they can be used in Panda # Specifically, this lesson will use events to capture keyboard presses and # mouse clicks to trigger actions in the world. It will also use events # to count the number of orbits the E...
true
3cbb2bc7008927d62cc6a518d679be57b5abef53
metzen/grapher
/grapher.py
UTF-8
6,904
3.03125
3
[ "MIT" ]
permissive
#!/usr/bin/python import argparse import collections import curses from curses import textpad import datetime import operator import threading import time import sys DataItem = collections.namedtuple('DataItem', ('time', 'value')) DataSeries = collections.namedtuple('DataSeries', ('name', 'items')) # Width of the le...
true
9d0ff4aacf39812fdcf815a38873fccde69e7a6a
SpringHuy/python
/core/getstart/comprehension.py
UTF-8
572
3.96875
4
[]
no_license
from math import sqrt def is_prime(x): if x < 2: return False for i in range(2, int(sqrt(x)) + 1): if x % i == 0: return False return True prime100 = [x for x in range(101) if is_prime(x)] print(prime100) a = {x*x: (1,x,x*x) for x in range(20) if is_prime(x)} print(a) iterab...
true
95ab6c7b8d7ff3f0d24b9617d11fd686c7865bf3
Nate8888/LeetCode
/twoSum_BruteForce_TLE.py
UTF-8
168
3.546875
4
[]
no_license
def twoSum(nums,target): for x in range(len(nums)): for y in range(len(nums)): if x != y and nums[x]+nums[y] == target: return [x,y] print(twoSum([1,2,3],4))
true
70f661f86112980b250f216db2aa42c9c2257957
jklypchak13/CFB_Scorigami
/src/scorigami_table.py
UTF-8
4,394
3.625
4
[ "MIT" ]
permissive
from typing import Dict, List, Tuple from data_types import Game import pprint class TableEntry: """Represents an entry in the scorigami table """ def __init__(self, value='Empty', game=None): self.first_game: Game = game self.last_game: Game = game self.value: str = value de...
true
ed1765262b4512f937e75f05b62a024570fb718e
code-lgtm/Problem-Solving
/graduate_algorithms/fixed_point.py
UTF-8
441
3.21875
3
[ "MIT" ]
permissive
def fixed_point(A, left, right): if left > right: return False mid = (left+right)/2 if mid == A[mid]: return True elif A[mid] > mid: return fixed_point(A, left, mid-1) else: return fixed_point(A, mid+1, right) A = [-5, -4, -3, 3, 8, 12, 15, 18, 19, 56, 67, 89, 91, 101, 121, 155, 177, 201, 2...
true
a9dd6c82f81fc109b5df43185c83ee2f1b3607a6
gabriellaec/desoft-analise-exercicios
/backup/user_202/ch59_2020_03_09_20_08_54_600802.py
UTF-8
61
2.828125
3
[]
no_license
def asteriscos(n): n = int(n) a = n*'*' return(a)
true
e188fcb4f7de655adfcf300825178e8e873b7092
p-b-j/uscb-das-container-public
/das_decennial/programs/rdd_like_list.py
UTF-8
7,888
3.0625
3
[ "LicenseRef-scancode-public-domain", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
""" A list that has the same API as Spark RDD, but does everything locally and sequencially, without need for Spark Context Usage: If you have a piece of program flow where you want to have an easier access into processes within map or reduce operations, by having them run locally (sequentially), on the master...
true
9ebe4f0a0d6455e398519b0d7e439ac61b99b0d2
Rishabh450/WebScrapping_Using_Beautifulsoup
/app.py
UTF-8
198
2.765625
3
[]
no_license
import requests from pages.quotes_pages import QuotesPage page_content = requests.get('http://quotes.toscrape.com') page = QuotesPage(page_content.text) for quote in page.quotes: print(quote)
true
ecb0f4b6e1dcfa73cc0adcd8652393dd9be745f1
israelcamp/GeneticAlgorithms
/FlappyPacman/pipe.py
UTF-8
1,204
3.21875
3
[]
no_license
import pyglet.gl as GL from numpy.random import randint class Pipe(): def __init__(self, x, size, height): """Class that defines a pair of pipes, top and bottom.""" self.x, self.height, self.size = x, height, size self.spacing = randint(low=2*self.size, high=4*self.size) self.veloc...
true
4a1040a615fb42748474af516a1df631b1794840
Alegruz/opencv4_py_korean_tutorial
/2_image_processing/1_geometric_transformations.py/1_translation.py
UTF-8
925
3.125
3
[]
no_license
import numpy as np import cv2 as cv # 평행이동이란 물체의 위치를 옮기는 것이다. # (x, y) 좌표가 어떻게 옮길지에 대한 정보 (tx, ty)가 있다면 # 평행이동 변환행렬 M은 [[1 0 tx], [0 1 ty]] 과 같다 # v = (x, y) 라 할 때, tx, ty만큼 평행이동한 새로운 벡터 vt는 # vt = v x M = (x + tx, y + ty) img = cv.imread("1_core/1_arithmetic_operation/apple.jpg") rows, cols = img.shape[:2] # 이미지의 행...
true
37ea3726e6ae639b233eb4dbfa010cfd2c371898
Pragades-Rajagopal/Dash-apps
/example/dataset-test.py
UTF-8
277
2.734375
3
[]
no_license
#%% import pandas as pd data = pd.read_csv('emission-data.csv') data = data.groupby(['Country', 'Continent'])[['Emission']].mean() # a = data[data['Country'] == 'Afghanistan'].mean() # a data.reset_index(inplace=True) c = data[data['Country'] == 'Trinidad And Tobago'] c # %%
true
afb11fd56de5427a18a3c42744c512321ad8282a
charon616/iiiMap
/ceilingCam.py
UTF-8
1,280
2.640625
3
[]
no_license
import cv2 import numpy as np # 定数定義 ESC_KEY = 27 # Escキー INTERVAL= 33 # インターバル FRAME_RATE = 30 # fps WINDOW_ORG = "org" WINDOW_BACK = "back" WINDOW_DIFF = "diff" FILE_ORG = "/Users/karinkiho/Downloads/PETS09-S2L1.mp4" # ウィンドウの準備 cv2.namedWindow(WINDOW_ORG) cv2.namedWindow(WINDOW_BACK) cv2.namedWindow(WIND...
true
ce00ed9c223dca421bcbb67191c21798fbd8a785
vijaysundar2701/python
/be32.py
UTF-8
79
3.21875
3
[]
no_license
h=input() l=1 for i in range(len(h)): if h[i]==' ': l=l+1 print(l)
true
6c8656f7874cbd358c8049c8c03dce1b62b0fd7e
jamine99/Uncertainlyingdice
/agents/random_bot.py
UTF-8
1,483
3.046875
3
[]
no_license
from agents.player import Player import random class Random_Bot(Player): def __init__(self,numDice,name): super().__init__(numDice, name) def takeBet(self, state): new_dice = 0 new_numDice = 0 totalDice = state.totDice() if state.prevBet == None: new_dice =...
true
780bc143f9e1b142288ebac0914ee855db64239d
metaperl/muntjac
/muntjac/terminal/gwt/server/http_servlet_request_listener.py
UTF-8
896
2.5625
3
[ "Apache-2.0" ]
permissive
# @MUNTJAC_COPYRIGHT@ # @MUNTJAC_LICENSE@ """Request start and end listener""" class IHttpServletRequestListener(object): """L{Application} that implements this interface gets notified of request start and end by terminal. Interface can be used for several helper tasks including: - Opening and cl...
true
68be2ab590c664739dfbe5839f9b31cc06932e18
kevinjycui/Competitive-Programming
/Python/DMOJ/WAC/wac3p3.py
UTF-8
503
2.75
3
[]
no_license
s = input() m = int(input()) combos = [] points = [] for i in range(m): t = input().split(' ') combos.append(t[0]) points.append(int(t[1])) total = len(s) while len(s) > 0: cm = -1 for com in range(len(combos)): if combos[com] == s[:len(combos[com])] and (cm == -1 or len(combos[com]) > len...
true
37bdd91ccb7a01f16c99d4222e38f84fca0ccd3d
dong-pro/fullStackPython
/p1_basic/day16_21module/day21/03_模块的导入_fromimport.py
UTF-8
1,535
3.65625
4
[ "Apache-2.0" ]
permissive
# 如何使用 from import # 需要从一个文件中使用哪个名字,就把这个名字导入进来 # from my_module import name # from import的过程中仍然执行了这个被导入的文件 # from my_module import read1 # import谁就只能用谁 # read1() # from my_module import read2 # read2() # 当前文件命名空间和模块的命名空间的问题 # from my_module import read1 # def read1(): # print('in my read1') # read1() # # from my...
true
1f42f24381b338899789f04b752488b5dca5333e
chandanpratap3/hackerrank_programs
/list_comprehension.py
UTF-8
988
4.03125
4
[]
no_license
#!/bin/python3 """ RULER----10--------20--------30--------40--------50--------60--------70--------80--------90--------100 Title : List Comprehensions Problem : You are given three integers x,y and z representing the dimensions of a cuboid along with an integer n. Print a list of all possible coordinates...
true
6d60b17f368edbec29caed12228acfddac130679
Darina23/TBD-Natalia
/feature_class_punctuation.py
UTF-8
963
3.375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 14 18:49:49 2021 @author: Natasha """ from abstract_feature_class import AllFeatures class PunctFeatures(AllFeatures): def __init__(self, text): self.text = text def count_punctuation(self): liste_output = [] for c...
true
671cbfb003ad2ab472933da936e02becdb53cf9c
jusbrandon/All-Things-Python
/Audio_tools/Acr_Song_Finder.py
UTF-8
2,020
2.859375
3
[]
no_license
from acrcloud.recognizer import ACRCloudRecognizer from acrcloud.recognizer import ACRCloudRecognizeType import json import logging from pprint import pprint # ACR Cloud Song Searcher Class # To use this class you need the Acr Python SDK which can be found here # https://github.com/acrcloud/acrcloud_sdk_python # You...
true
b87d92628b90299d4484fdc1165dd10c56ed7246
ImokAAA/classroom
/src/classroom/models.py
UTF-8
1,939
2.53125
3
[]
no_license
from django.db import models from django.db.models.fields import CharField, DateTimeField, IntegerField, TextField from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField from users.models import Student, Teacher, User class Auditory(models.Model): ''' Defines groups of student...
true
c9b8404601f571714f5c0c0498e5ea3bb65efa1a
alibaizhanov/AlgoLeetCode
/Arrays/66-LeetCode.py
UTF-8
1,275
3.265625
3
[]
no_license
##My algo class Solution: def plusOne(self, digits: List[int]) -> List[int]: plusOne = digits[-1] + 1 if plusOne >= 10: digits[-1] = plusOne%10 rOne = plusOne//10 for i in range(len(digits)-2,-1,-1): ...
true
93c6aab2e5312b628fb91a14751a7cce44bf5b9b
martinfofo/recognition_celebrity
/projectAI.py
UTF-8
5,729
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 29 11:22:17 2021 @author: Julien Camboulives - Martin de Foresta - Corentin Fauchet - Lisa Roulet """ #Part 1 : Data preprocessing # a. Importing the data import pandas as pd table = pd.read_csv("list_attr_celeba.csv") # b. Keeping only useful data image...
true
e0bde46262ac9f8489e2ed3ce5e81e5a0cf1eab7
sunkest/Algorithm
/Baekjoon/14502.py
UTF-8
1,499
3.265625
3
[]
no_license
# BOJ 14502 # 연구소 # Gold 5 # 삼성 SW 역량테스트 # dfs/bfs, 완전탐색 # 이것이 취업을 위한 코딩테스트다 - part 3 - dfs/bfs # 책 답안대로 내면 시간초과 # 아래 코드는 통과 import sys from collections import deque from itertools import combinations input = sys.stdin.readline N, M = map(int, input().split()) lab = [[1 for _ in range(M+2)] for _ in range(N+2)] initi...
true
d5965c79c457d16fdbf482d3d92529b869285609
vlkonageski/Logica
/Python/Exercicio17.py
UTF-8
411
4.40625
4
[]
no_license
""" Faça um algoritmo que determine o maior em N números. A condição de parada é a entrada de um valor 0, ou seja, o algoritmo deve ficar calculando o maior valor até que a entrada seja igual a 0 (zero). """ n = 1 maior = 0 while n != 0: n = int(input("Informe um numero: ")) if n > maior: maior = n ...
true
9c50291a3e606ff7f6fe6c0f180c1dced638a0d1
shanqu91/paper_event_detection_microseismic_SVM_demo
/B1_svmtrain_featureselection_add2d.py
UTF-8
3,835
2.546875
3
[]
no_license
#################################################################### # Author: Shan Qu, Delft University of Technology ### # First created: May 2019 ### # This code is propriatary under the Delphi Research Consortium ### # ...
true
1affe08c0b399a224481776c670c3f0c6711fb9d
deimelperez/HackerRank
/Problem Solving/Absolute Permutation.py
UTF-8
384
2.828125
3
[]
no_license
import math import os import random import re import sys # Complete the absolutePermutation function below. def absolutePermutation(n, k): if __name__ == '__main__': t = int(input()) for t_itr in range(t): nk = input().split() n = int(nk[0]) k = int(nk[1]) result = absol...
true
803bb07c6261586d95dcb86070cf5124d90628ae
damiansp/completePython
/image_processing/open_cv4/06_image_filtering/kernels.py
UTF-8
666
2.8125
3
[]
no_license
import cv2 import numpy as np kernel_averaging_5x5 = np.ones((5, 5), np.float32) / 25 smooth_image_f2D = cv2.filter2D(image, -1, kernel_averageing_5x5) # averaging filter smooth_image_b = cv2.blur(image, (10, 10)) smooth_image_bfi = cv2.boxFilter(image, -1, (10, 10), normalize=True) # Gaussian filtering smooth_imag...
true
0c927af5a8e6bcebefabe3abacdc27eff95e2df1
mitches-got-glitches/testing-tips
/test/tidy_multiple_parametrisation.py
UTF-8
4,432
2.84375
3
[]
no_license
from typing import Mapping, Sequence import pandas as pd from pandas._testing import assert_frame_equal import pytest from .helpers import ( Case, create_dataframe, parametrize_cases, ) def filter_retailer_items( df: pd.DataFrame, alt_data_filter: Mapping[int, Sequence[int]], ) -> pd.DataFrame: ...
true
56a5b7d133c23f96c9fae8b529df2cd9a5299498
KashishChanana/Promotions-Analysis-ML
/models/logisticRegression.py
UTF-8
1,193
2.578125
3
[]
no_license
from models.run import * from sklearn.model_selection import GridSearchCV from sklearn.linear_model import LogisticRegression def lr_model(X_train, X_test, y_train, y_test): """ Instantiates decision tree classifier, performs hyperparameter tuning and trains & tests the model :param X_train: Training Data...
true
7d92dde16d429b3104d17efafdf640270e1d4f47
Intel-out-side/AtCoder
/Typical90/044_ShiftAndSwapping.py
UTF-8
327
2.75
3
[]
no_license
from collections import deque N, Q = map(int, input().split()) A = list(map(int, input().split())) A = deque(A) for i in range(Q): T, x, y = map(int, input().split()) if T == 1: A[x-1], A[y-1] = A[y-1], A[x-1] elif T == 2: tmp = A.pop() A.appendleft(tmp) else: print(...
true
5c88a98b956d5fc8cecf2494313e80cc86ea48b9
chiahsun/problem_solving
/LeetCode/944. Delete Columns to Make Sorted/solve1.py
UTF-8
288
2.625
3
[]
no_license
class Solution: def minDeletionSize(self, strs: List[str]) -> int: res = 0 for i in range(len(strs[0])): for k in range(1, len(strs)): if strs[k][i] < strs[k-1][i]: res += 1 break return res
true
94df07b1b80bebf8f4d7e9849f3e0963070e8a01
PervasiveWellbeingTech/HSO-backend
/pyserver.py
UTF-8
2,526
2.625
3
[]
no_license
#!/usr/bin/env python3 from flask import Flask, request, jsonify from inspect import signature from datetime import datetime import json from functools import wraps import lifelines.statistics class CustomEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, datetime): return {'__datetime__':...
true
0559ada77a4d3cf2fe5429f2bd89ef56b22f8b50
LeRayan/Akk
/akkadian_bert/data_collators_bert.py
UTF-8
4,326
3.015625
3
[ "MIT" ]
permissive
from typing import List, Union, Dict, Tuple import torch from torch.nn.utils.rnn import pad_sequence from preprocessing.main_preprocess import MISSING_SIGN_CHAR class DataCollatorForLanguageModelingAkkadian: """ Data collator used for language modeling. - collates batches of tensors, honoring their token...
true
38a9f7c1cc1c24b987ed71b051efa13f48030257
RYNO8/BigInt-cpp
/gen.py
UTF-8
350
3.03125
3
[]
no_license
import random random.seed(int(input("Seed: "))) limit = int(input("Num limit: ")) s = -(10**limit) e = 10**limit with open("test.txt", "w") as f: for rep in range(10**6): # 1M lines, max 200MB file #f.write(f"{random.randint(s, e)} {random.randint(s, e)}\n") f.write(f"{random.randint(0, e)} ...
true
91607d50c62f2923dca07cdd7c307a113c296e34
javierlona/udacity-projects-python
/Udacity/PostgreSQL/PYPostgreSQL.py
UTF-8
2,505
3.484375
3
[ "MIT" ]
permissive
#!/usr/bin/env python2.7 import psycopg2 def main(): ''' Connect to database, create cursor and call three functions ''' conn = psycopg2.connect(database="news", user="user1", password="password", host="127.0.0.1", port="5432") print "Connection ...
true
82eafd098c8e68e8ec3e00496719a1cbd5bd7356
hukeyy/learn_python
/day26/test2.py
UTF-8
3,753
3.375
3
[]
no_license
# -*- coding: utf-8 -*- # Author: hkey # class Student(object): # def __init__(self, name, score): # self.name = name # self.score = score # # def get_grade(self): # if self.score >= 90: # return 'A' # elif self.score >= 60: # return 'B' # else: # ...
true
cf095b9b133c0907161739366e1d6e49cbc6602b
MarcoBurgos/advent_of_code
/2020/src/binary_boarding.py
UTF-8
1,270
3.203125
3
[]
no_license
import os def find_missing(lst): return [x for x in range(lst[0], lst[-1]) if x not in lst] def binary_boarding(): DAY = "day5" cur_path = os.path.dirname(__file__) input_path = os.path.relpath(f'../inputs/{DAY}.txt', cur_path) solution = 0 data = [] max_id =...
true
f4166e882cf05d8bfc926aa36e127c2ca00ca8b7
XicoPi/tfg-LoRa
/tfgEnricGarcia/config/callbacks/ttnNodeDevCallbackDef.py
UTF-8
293
2.609375
3
[]
no_license
def devCallback(sens_data: dict) -> int: event = -1 if (sens_data["event"] == "interval"): event = 0 elif (sens_data["event"] == "button"): event = 1 elif (sens_data["event"] == "motion"): event = 2 sens_data["event"] = event return sens_data
true
802e880aaa780a1f669811ea87c6b499e456a19f
iondulgheru/home-automation
/python-server/communication/IncommingCommunicationThread.py
UTF-8
1,016
2.671875
3
[]
no_license
import threading class IncommingCommunicationThread(threading.Thread): def __init__(self, serial_sensors_parser, sensors_repo, sensor_update_event, communicator): threading.Thread.__init__(self) self.__serial_sensors_parser = serial_sensors_parser self.__sensors_repo = sensors_repo ...
true
3755d5eb1bdacdaca6169ef0dc332f30bd9f0156
tinwilliam/python
/sanantonio/san_antonio_while.py
UTF-8
770
3.765625
4
[]
no_license
# -*- coding: utf8 -*- quotes = [ "Ecoutez-moi,Mr Shakespeare, nous avons beau être ou ne pas être,nous sommes !","On doit pouvoir choisir entre s'écouter parler et se faire entendre"] characters = ["alvin et les Chipmunks","Babar","Betty Boop","Calimero","Casper","Le chat potté","Kirikou"] def show_ran...
true
e763bc973642b9e93dd5293ce586c827befc3a14
gewenhui163/shiyanlou
/challenge10/getrank.py
UTF-8
1,398
2.734375
3
[]
no_license
#!/usr/bin/env python3 import sys from pymongo import MongoClient def get_rank(user_id): client = MongoClient() db = client.shiyanlou pipeline = [ {'$match': {'user_id': user_id}}, {'$group': { '_id':'$user_id', 'total_score':{'$sum': '$score'}, 'total_...
true
1d32e6b2cae8a15c7c6e104f099398bf29861aac
KonstantinSKY/LeetCode
/1399_Count_Largest_Group.py
UTF-8
834
3.53125
4
[]
no_license
"""1399. Count Largest Group https://leetcode.com/problems/count-largest-group/ """ import time from typing import List class Solution: def countLargestGroup(self, n: int) -> int: from collections import defaultdict nums = defaultdict(list) maxx = res = 0 for i in range(1, n+1): ...
true
449df1b3544837a12ea883ec07bc789db2987777
Nathanesteve/Challenge_prediction
/Code_visualisation_Montpellier_cycliste/Edit_gif.py
UTF-8
299
2.640625
3
[]
no_license
import imageio from pathlib import Path import os image_path = Path() images = list(image_path.glob('*.png')) image_list = [] for file_name in images: image_list.append(imageio.imread(file_name)) # Cree le gif dans la racine du dossier imageio.mimwrite('GifMap.gif', image_list, fps=1)
true
5ab370b066154459bba40f1d4667a6f0828fbf3b
dmoini/cmsi299-algorithms-laboratory
/11172.py
UTF-8
295
3.453125
3
[]
no_license
# 11172 - Relational Operator import sys first = True for line in sys.stdin: line = line.strip() if first: first = False continue line = list(map(int, line.strip().split())) x, y = line[0], line[1] print('<') if x < y else print('>') if x > y else print('=')
true
f3024cd7851de3f4cdc6f530c2dbca8a26b0f2d1
liushixin0227/ios_calendar_ics
/src/test_project/testcase.py
UTF-8
219
2.8125
3
[]
no_license
import unittest def add(num1, num2): return num1 + num2 class MyTestCase(unittest.TestCase): def test_something(self): self.assertEqual(3, add(1, 1)) if __name__ == '__main__': unittest.main()
true
acfec89ff794d545789a10aca2b8ac3d0bfd8b2f
fei-z/pythonlearning
/core/io/basic.py
UTF-8
308
2.96875
3
[]
no_license
def main(): # demo_dict = { # "1": "abc", # "2": "bcd", # "3": "cde" # } # for key in demo_dict: # print("key = %s, value = %s \n" % (key, demo_dict.get(key))) print("0x8FC5C377698A70Bc53Db541ad721BD243D0D5FB2".lower()) if __name__ == '__main__': main()
true
70d90a23563f841bc8d0bf8e922c49d1174ddb7f
blackrim/opentree_pytoys
/src/get_dated_tree_for_ottids.py
UTF-8
1,465
2.578125
3
[]
no_license
import requests import json import sys def get_tree(inurl,ids): url = inurl+'/induced_subtree' idss = "{\"ott_ids\":["+",".join(ids)+"]}" payload = json.loads(idss) headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'} r = requests.post(url, data=json.dumps(payload), headers=he...
true
44055daed255d5a53410b1a75dfe2e4fa1b5a3c4
fengttt/sip
/ii/q18.py
UTF-8
445
3.21875
3
[]
no_license
def knapsack(v, w, N, W, mem): if W < 0: return float('-inf') if N < 0 or W == 0: return 0 k = (N, W) if k not in mem: inc = v[N] + knapsack(v, w, N-1, W-w[N], mem) exc = knapsack(v, w, N-1, W, mem) mem[k] = max(inc, exc) return mem[k] if __name__ == '__main_...
true
08776189b959a38fcdb70cc622eb2501a201f3d4
mariuskausas/lectures-and-talks
/hackathons/hackathon_winter2019_problems/solutions/problem-1/problem-1.py
UTF-8
385
3.5
4
[]
no_license
def count_nt(s): """ Count nt using for loop.""" nts = (set(s)) nt_count = {} for nt in nts: nt_count[nt] = s.count(nt) return nt_count def count_nt2(s): """ Count nt using list comprehension.""" nts = ['A', 'C', 'G', 'T'] nt_count = [s.count(nt) for nt in nts] return nt_count print(count_nt2("AGCTTTTCAT...
true
1ec21cc6ab8e690be6faf63eef670f4aa4a197bc
mieskolainen/icenet
/icefit/em.py
UTF-8
2,126
3.21875
3
[ "MIT" ]
permissive
# Expectation-Maximization and mixture density algorithms # # m.mieskolainen@imperial.ac.uk, 2023 import numpy as np import numba @numba.njit def gausspdf(x,mu,sigma): """ Gaussian pdf """ return 1/np.sqrt(2*np.pi*sigma**2) * np.exp(-0.5 * ((mu-x)/sigma)**2) @numba.njit def mixture_nll(pdf, frac): """ Mixture mo...
true
b353e582e4de08991be57573b33101770a41b10c
trummerjo/netatmo-indicator
/netatmo_modules.py
UTF-8
5,434
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- # Copyright (C) 2015 Marco Trevisan # # CoPyCloud: a simple python wrapper to manage the Copy.com cloud # # Authors: # Marco Trevisan (Treviño) <mail@3v1n0.net> # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as pub...
true
aac4992eb8d008f7fd3950fd2da4c42983598ada
AlexS1981/lup-lessons-ht
/2020-09-28_lesson_LT_JSON.py
UTF-8
3,903
3.375
3
[]
no_license
import os import json os.chdir(os.getcwd()) class User: list_objects = list() def __init__(self, surname, name, int_phone, int_age, *args, **kwargs): self.surname = surname self.name = name self.phone = int_phone self.age = int_age self.list_objects.append(self) cl...
true
eb74fcfcfc801209b124cc3343f36760d20ef218
ngannguyen/mhc
/utilities/mhc_removeNs.py
UTF-8
1,838
2.765625
3
[]
no_license
#!/usr/bin/env python #nknguyen@soe.ucsc.edu #03/31/2011 import os, sys, re from optparse import OptionParser def writeNewSeqs(seq, f, name): seqs = re.split('N{10,}', seq) seqStart = 0 for s in seqs: if s == '': continue size = len(s) seqname = '.'.join([name, str(seqStart), str(size)]) seqStar...
true
eba8c4bc63bb41eb542f5776e35fc56c4cd7b263
andyRon/LearnPython
/Python教程/廖雪峰Python教程/0-6/6.1.py
UTF-8
1,648
3.609375
4
[]
no_license
# std1 = {'name':'Michael', 'score':98} # std1 = {'name':'Andy', 'score':85} # def print_score(std): # print '%s:%s' % (std['name'], std['score']) # class Student(object): # def __init__(self, name, score): # self.name = name # self.score = score # def print_score(self): # print '%s:%s' % (self.name, self....
true
9d8b7db133aa2cf25bdb8bd84b479d448d8c9242
olbychos/mathgenerator
/mathgenerator/funcs/computer_science/decimal_to_bcd.py
UTF-8
610
2.90625
3
[ "MIT" ]
permissive
from .__init__ import * def DecimalToBCDFunc(maxNumber=10000): n = random.randint(1000, maxNumber) x = n # binstring = '' bcdstring = '' while x > 0: nibble = x % 16 bcdstring = str(nibble) + bcdstring x >>= 4 problem = "BCD of Decimal Number " + str(n) + " is = " ...
true
61406945b00415a6e7730849aa2f87b3a2b2a41b
Grande19/X-Serv-15.4-Django-calc
/calc/views.py
UTF-8
756
2.734375
3
[ "Apache-2.0" ]
permissive
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def calc_start(request) : return HttpResponse ('Iniciando Calculadora') def calc_sum(request,num1,num2) : suma = int(num1) + int(num2) return HttpResponse ('La suma de es:' + str(suma) ) def calc_res(re...
true
44e0f94307337708130421015180b705dba8681b
erundeddu/self_driving_cars
/self_driving/nodes/obstacles
UTF-8
4,332
2.640625
3
[]
no_license
#!/usr/bin/env python """ PARAMETERS: /obstacles/threshold (double): distance threshold in [m] from sonar reading below which obstacle is detected PUBLISHES: is_clear/front_sonar/all (std_msgs/Byte): if 0 is clear, else an obstacle is detected (4 lsb describe where obstacle is detected, from left to right son...
true
58d192857e7202acd24781b8e99052fe60db2886
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4160/codes/1836_1275.py
UTF-8
196
2.828125
3
[]
no_license
from numpy import* from numpy.linalg import* n= array(eval(input("Digite uma matriz: "))) y = shape(n)[0] total = zeros(y,dtype=int) for i in range(y): total[i] = sum(n[i,:]) print(total)
true
5b7b81a173c4c40bbb288f27e007f52656a6afa0
daniel-reich/ubiquitous-fiesta
/wYcTcJSQJzca39apZ_7.py
UTF-8
403
3.546875
4
[]
no_license
def truncate(txt, length): strn = '' c = 0 for i in range(length): try: strn += txt[c] c += 1 except IndexError: return txt if txt[c].isalpha(): for l in strn[::-1]: if l == ' ': strn = strn[:-1] bre...
true
8f91a8cc2b50dc29e9f0759b469e392a3fb40188
aidiss/Lithuanian-Academic-Circles-and-Their-Networks
/classifications/get_color.py
UTF-8
1,996
3.03125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # get_colors.py # 2014 07 23 def get_node_colors(nodelist, df): """ Gets colors for a list of nodes returns a list of color names Possible changes: A possibility to get a string or a list. A possibility to return different code for colo...
true
aaa1f63bdae646ebb9622033603fc40f02509811
BhushanTayade88/Core-Python
/task/String task/seven.py
UTF-8
511
3.90625
4
[]
no_license
''' 8. l1 = ["M","na","i","Em"] l2 = ["y","me","s","ma"] o/p : ["My","name","is","Emma"] without using any built-in function. try with list comprehention ''' l1 = ["M","na","i","Em"] l2 = ["y","me","s","ma"] l3=[] for x,y in zip(l1,l2): z=x+y l3.append(z) print(l3) l4=[] for i in range(len(l1)): l4.app...
true
26544f7d8409a84bec393cb14257e2f7f84ab921
itsyuanyuan/DL_final_project
/env_exp.py
UTF-8
6,001
2.796875
3
[ "Apache-2.0" ]
permissive
import numpy as np import sys from mlagents.envs import UnityEnvironment SIZE_OBSERVATION = 112 class SocTwoEnv(): """ parameters: env_path: the binary file which is built by Unity. train_mode: It's True when u want to train the brain. n_striker: number of agent of striker in the scen...
true
387562aba9af964963dba779b903a64f5de13edf
victenna/Pendulum
/Pendulum(26_11_2020).py
UTF-8
1,066
3.140625
3
[]
no_license
import turtle,time wn=turtle.Screen() wn.setup(900,900) wn.bgpic('bground0.gif') turtle.tracer(2) t1=turtle.Turtle('turtle') t1.hideturtle() t1.color('blue') t1.penup() t1.begin_poly() t1.fd(400) t1.left(90) t1.circle(30.358) t1.fd(4) t1.left(90) t1.fd(400) t1.end_poly() wn.addshape('pend',t1.get_pol...
true