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
780f8e87520ae99183e7d2d8ff9a98255dee2a79
schinmayee/nimbus
/applications/physbam/physbam-lib/External_Libraries/Archives/boost/tools/build/v1/gen_aix_import_file.py
UTF-8
2,996
2.53125
3
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # Valid arguments setValueArgs = {"-ld" : "LD", "-ldflags" : "LDFLAGS", "-optldflags" : "OPTLDFLAGS", "-impfilename" : "IMPFILENAME", "-expflag" : "EXPFLAG", "-maxlinelength" : "maxlinelength", "-verbo...
true
fcbb1dd638e63ace761afc7a7a97f93d3fe1bcdd
null-null-programming/CodeBank
/Python/31~40/pra6.py
UTF-8
221
3.34375
3
[]
no_license
try: print(a) except NameError: print("NameError!") try: a + 1 except (NameError, TypeError): print("Error!") a = 2 try: a + 1 except: print("Error") else: print(a) finally: print("end")
true
ca195230faf6d4c84c74e4b70a0e54b20b7c3a38
linsalrob/PhageHosts
/code/crispr_mismatches.py
UTF-8
2,339
3.015625
3
[ "MIT" ]
permissive
"""Count the crispr hits from blastn and allow for a certain number of mismatches. Report the mean, median, and stdev hosts per phage""" import rob import sys import os import re # allowable errors == sum(gaps + mismatches) errors = 1000 # gaps = # gaps gaps = 0 # mismatches = # mismatches mismatches = 1000 try: ...
true
696f5d7e301b6bf24a5b061cf52ea5ff930c2495
navarrovitor/mackenzie-assignments
/Algoritmos/BRUNO/BRUNO03/ex5.py
UTF-8
941
3.40625
3
[]
no_license
import random def intercalar_iguais(v1, v2, vf): x = 0 for i in range(len(v1)): vf[x] = v1[i] x += 1 vf[x] = v2[i] x += 1 return vf def contem(v, qtd, e): for i in range(qtd): if v[i] == e: return True return False def gerar(v1, v2): qtd_v1...
true
c3b8e61aa239d728eb13e19aa7c2c5e4259397ba
Rhysoshea/Algos
/Algorithmic_Toolbox/week2_algorithmic_warmup/my_lcm1.py
UTF-8
1,933
3.546875
4
[]
no_license
# python2 import sys from random import randint import time ''' Return the least common multiple of two integers ''' ''' insert base solution here ''' def test_solution(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b ''' code for comparing the base s...
true
c4d7e0cd13043d0e3e8852900fedab226d78fd4e
David-bz/Music_Recommendation_System
/dataset/ml_dataset.py
UTF-8
8,188
2.640625
3
[]
no_license
from dataset.user_item_matrix import userTrackMatrix import pandas as pd import numpy as np from utils import generate_path from sklearn.neighbors import NearestNeighbors class MLDataset: def __init__(self, verbose=True, drop=False): self.verbose = verbose user_track_mat = userTrackMatrix(verbose...
true
883bc2acb7bcaa772033511f06599316a41f3260
kuzmik/frogbot
/bot.py
UTF-8
2,034
3
3
[]
no_license
import time from slackclient import SlackClient from RIBBIT.client import RIBBITClient class FrogBot(): def __init__(self, bot_id, oauth_token): # FIRE UP A FROG WORMHOLE self.frog = RIBBITClient() # The actual slack client self.slack = SlackClient(oauth_token) # This is w...
true
3c5ea4b6fddfd65374df5d54a1a99b2bed4592c9
johan-105/Chartering-Management-System
/init_login_db.py
UTF-8
778
3.0625
3
[]
no_license
import sqlite3 def init_db(): connection = sqlite3.connect('logindb.sqlite') connection.executescript(''' DROP TABLE IF EXISTS Users; CREATE TABLE Users ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, name TEXT UNIQUE, email TEXT UNIQUE, password TEXT ...
true
8829d86229c80a42e89bc766d3465a8ae9c40fa1
oowgnoj/TIL
/algorithm/binary-search-tree.py
UTF-8
1,007
3.125
3
[]
no_license
def binary_search(element, some_list, offset=None): # 값 = element, return inde binaryIndex = (len(some_list)/2) if len(some_list)%2 == 0 else (len(some_list)/2) -0.5 binaryIndex = int(binaryIndex) if some_list[binaryIndex]== element: if offset : return offset -1 else: ...
true
2e3991a64ffa94d6e690383da7fa3df075b51a72
hyowong/Machine-Learning
/lab2/linearRegression2.py
UTF-8
641
2.640625
3
[]
no_license
import tensorflow as tf X = tf.placeholder(tf.float32,shape=[None]) Y = tf.placeholder(tf.float32,shape=[None]) W = tf.Variable(tf.random_normal([1]),name="weight") b = tf.Variable(tf.random_normal([1],name="bias")) hypothesis = W * X +b cost = tf.reduce_mean(tf.square(hypothesis - Y)) optimizer = tf.train.Gradi...
true
63ce620f072da4163416dd668dcb744b8fe79c1f
klausmcm/GERADE
/src/label/LabelFullDataMatrix.py
UTF-8
15,709
3.03125
3
[]
no_license
import math import string import sys from .LabelComponentText import LabelComponentText from .LabelComponentBarcodeDataMatrix import LabelComponentBarcodeDataMatrix from PIL import Image from PIL import ImageDraw class LabelFullDataMatrix: def __init__(self, text, separator_line_thickness, label_type, dpi=(600, 60...
true
9c9ecf5fcdb608f3c1a0a0d8f5e34c16d6694875
natkam/adventofcode
/2019/computer.py
UTF-8
10,771
3.046875
3
[]
no_license
from __future__ import annotations from typing import List, Optional, Callable, Union, cast # TODO: This solution works, but... Check the write-params (e.g. for opcodes 1, 2, 3, ...) # TODO: to see if an IndexError can occur there! # TODO:#2 Refactor the code to handle both read and write params together, nicely c...
true
3f8283ca4dab3bd74e8525f838707012145bb398
GillianLau/example01
/InverseFlaw1.3.py
UTF-8
14,636
2.78125
3
[]
no_license
import xgboost as xgb from xgboost import XGBRegressor as XGBR from sklearn.ensemble import RandomForestRegressor as RFR from sklearn.linear_model import LinearRegression as LinearR from sklearn.tree import DecisionTreeRegressor as DTR from sklearn.ensemble import gradient_boosting as GB from sklearn.model_selection i...
true
c9b2de061a482d0c35d1299306f0bd8992c53472
Aasthaengg/IBMdataset
/Python_codes/p02576/s344267568.py
UTF-8
79
2.921875
3
[]
no_license
import math n, x, t = [int(x) for x in input().split()] print(math.ceil(n/x)*t)
true
a56befa48b5aff76766410b999080daadf53cd00
mrForce/tidePipeline
/utilities/qq_plot.py
UTF-8
2,412
2.75
3
[]
no_license
from scipy import stats import random import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt def get_scores(path): sequences = [] scores = [] with open(path, 'r') as f: for line in f: if len(line) > 2 and ',' in line: score_string = line.split(',')[1...
true
967f94ab454d6678a62703b63cf26f610d64cbaf
StandOutstar/learnPython
/python打怪之路/python协程/basic_asynio.py
UTF-8
308
2.703125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from greenlet import greenlet def fun1(): print(12) gr2.switch() print(34) gr2.switch() def fun2(): print(56) gr1.switch() print(78) if __name__ == '__main__': gr1 = greenlet(fun1) gr2 = greenlet(fun2) gr1.switch()
true
3358244dd4c4c64fdc33892d591d329d4d116738
alistair0111/HackerRankSolutions
/Implementations-Python/magic_square.py
UTF-8
1,047
3.09375
3
[]
no_license
#!/bin/python3 import math import os import random import re import sys # Complete the formingMagicSquare function below. def formingMagicSquare(s): p1=[[4,9,2],[3,5,7],[8,1,6]] p2=[[8,3,4],[1,5,9],[6,7,2]] p3=[[6,1,8],[7,5,3],[2,9,4]] p4=[[2,7,6],[9,5,1],[4,3,8]] s1,s2,s3,s4,s5,s6,s7,s8=0,0,0,0,0...
true
0a30182d57bca39115d9c1909e920fbe9e763fc7
enthought/jigna
/examples/ex13_success_error_callbacks.py
UTF-8
1,353
3.03125
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" This example shows how to attach 'done' and 'error' callbacks to a slow method call. """ #### Imports #### from traits.api import HasTraits from jigna.api import HTMLWidget, Template from jigna.qt import QtGui import time #### Domain model #### class Worker(HasTraits): def do_work(self): """ Simula...
true
68d94ca0460570301ae12b95283844bd702ae1b7
xiaoyuehui/LintCode
/easy/A+B_Problem.py
UTF-8
486
3
3
[]
no_license
# -*- coding: utf-8 -*- class Solution: """ @param: a: An integer @param: b: An integer @return: The sum of a and b """ def aplusb(self, a, b): if a == -b: return 0 # write your code here add = a ^ b carry = (a & b) << 1 while carry !=...
true
b70e8bf64fdd1eaa5115a6a1f711e7e8d93ec442
mszczodrak/paper_experiments
/indriya/pyfig/graph_3-4-5-6.py
UTF-8
2,229
2.53125
3
[]
no_license
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import sys from indriya_results import * # Small packets this_pkt_size = 104 this_init_delay = 15000 this_tx_delay = 100 all_backoffs = [10, 8, 6, 4, 2] all_tx_delays = [100, 50, 40, 30] line_marker = ['k-', 'k--', 'k-.', 'k:'] point_marker = ...
true
595bd1e18652325a093affde503f9564bd92e9a1
heDwigF/Lv-439.DenysFedorovych
/All class work/08oct.py
UTF-8
1,861
4.40625
4
[]
no_license
'''1. Спробуйте переписати наступний код через map. Він приймає список реальних імен і замінює їх хеш-прізвищами, використовуючи більш надійний метод-хешування.''' names = ['Sam', 'Don', 'Daniel'] print (list(map(hash, names))) '''2. Вивести список кольору “red”, який найчастіше зустрічається в даному списку ...
true
58f37fb0f19ccf4043948b8287cd929abd621133
cristian-ig/AI_TEMA1
/blueBot.py
UTF-8
17,776
2.71875
3
[ "Apache-2.0" ]
permissive
import aiml import ast import re kernel = aiml.Kernel() materii = ['Matematica', 'Structuri de date', 'Logica pentru informatica', 'Limba engleza 1', 'Arhitectura calculatoarelor si sisteme de operare', 'Introducere in programare', 'Proiectarea algoritmilor', 'Probabilitati si statistica...
true
9ad4f5a7854ec34e020a029a2ea0cc030f946456
ryfeus/lambda-packs
/Keras_tensorflow_nightly/source2.7/tensorflow/contrib/autograph/operators/control_flow.py
UTF-8
6,756
2.765625
3
[ "MIT" ]
permissive
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
true
f6ad46e313e024ff009d7c69fc53857d856aee57
yuweichiu/ML_2019_HW
/hw1/main_script.py
UTF-8
3,091
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Homework 1 for ML course 2019 < Handcraft "linear regression" using Gradient Descent > Created on : 2019/06/22, @author: Ivan Chiu """ # import matplotlib # matplotlib.use('Qt5Agg') import pandas as pd import numpy as np import matplotlib.pyplot as plt import os # read csv...
true
bd6edf05ae2d29bc4465bfabb3309b605e5e0858
daniel-reich/ubiquitous-fiesta
/CjXamaNRmKxwkmBxq_2.py
UTF-8
37
2.515625
3
[]
no_license
def cubes(a): a=a*a*a return a
true
e65235bb79bd49daa6d09cdb9ee05394c418fc6d
EvanBudin/hello
/.vscode/speed.py
UTF-8
431
3.703125
4
[]
no_license
import math speedLimit = input("What is the speed limit in mph? ") avgSpeed = input("What is your average speed? ") distance = input("What distance did you travel? ") speedLimit = float(speedLimit) avgSpeed = float(avgSpeed) distance = float(distance) speedLimit = speedLimit/60 avgSpeed = avgSpeed/60 answerLimit = dist...
true
a99385f96f8d474c1c155257c25faf6a76a37b4f
20060705Sean/codeFiles
/Python/apcs/a410解方程.py
UTF-8
1,233
3.0625
3
[]
no_license
us3rInput = list(map(int, input().split())) gcd = lambda a, b:gcd_factor(max(a, b), min(a,b)) gcd_factor = lambda a, b:b if a % b == 0 else gcd_factor(b, a % b) lcm = lambda a, b:a * b / gcd(a, b) _backslashN = "\n" _patchZero = lambda s:s + "0" if len(s[s.index(".")+1:]) == 1 else s a, b, c, d, e, f = us3rInput if ...
true
b2b79819c2d71a9cb39b009eebcc80d84214bc48
AtiqulHaque/geeksforgeeks
/nth-item-through-sum.py
UTF-8
3,203
4.15625
4
[]
no_license
""" Given two sorted arrays, we can get a set of sums(add one element from the first and one from second). Find the N’th element in the set considered in sorted order. Note: Set of sums should have unique elements. -------------------------------------------------- Input : arr1[] = {1, 2} arr2[] = {3, 4} ...
true
b0b9be67a75861b21a5c38e88106f5adb673f4b2
luciofaso/raspberryProjects
/launch_sos.py
UTF-8
1,181
3.265625
3
[]
no_license
# Hello World + button + turn on lead when pushed import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library from time import sleep GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) # Use physical pin numbering GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # Set pin 10 to be an input pin ...
true
6da2e808de5fccd2d6456dfb33c1e757773530f9
haukegithub/computerVision1920
/Termin2/aufgabenblatt2_2.py
UTF-8
917
3.265625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from skimage.io import imread, imsave img = imread("./catG.png") plt.imshow(img, cmap="Greys_r") # Aufgabe 2 # 1 schwarze_pix = 0 weiße_pix = 0 for zeile in range(img.shape[0]): for spalte in range(img.shape[1]): ...
true
0a201c02021cbb817f82d304914587db0d42015f
michael-stanin/PackmanReturns
/src/main.py
UTF-8
5,044
2.640625
3
[ "MIT" ]
permissive
import pygame import random from pygame.locals import * from block import Block from packman import Packman from blinky import Blinky from layout import Layout from pellet import Pellet from colors import BLACK CAPTION = "Packman Returns" BACKGROUND_IMAGE_FILE = "../resources/backgrounds/2....
true
b99dac95ffc267e0bb96254e480f33055698455e
loafdog/projeuler
/p6-sumSquareDifference.py
UTF-8
2,291
3.78125
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/python # The sum of the squares of the first ten natural numbers is, # 1^2 + 2^2 + ... + 10^2 = 385 # The square of the sum of the first ten natural numbers is, # (1 + 2 + ... + 10)^2 = 55^2 = 3025 # Hence the difference between the sum of the squares of the first ten # natural numbers and the square of...
true
e5a7f9e1ff1dd31c0a963aaae63a9b1c5d66caad
Batroff/python_lab34
/19/19_4.py
UTF-8
185
3.421875
3
[]
no_license
# БСБО-05-19 Савранский С. def palindrome(s): res = ''.join(s.lower().split(' ')) return 'Палиндром' if res == res[::-1] else 'Не палиндром'
true
e25b9fb281ccf901cfe2b7d6d744798ac4cddbca
partyzl/gunana
/server/test/test_app.py
UTF-8
781
2.671875
3
[]
no_license
import json def test_api_get_puns(api): res = api.get("/puns") assert res.json == {"id": 1, "name": "Owen", "pun": "test punny"}, { "id": 2, "name": "Abi", "pun": "test punny2", } def test_api_get_pun(api): res = api.get("/puns/1") assert res.json["puns"]["name"] == "Abi"...
true
2e4af8fe21d0e59b0e64c1004a5bec2ded95392b
JeffreyAsuncion/CodingProblems_Python
/CodeSignal/cs022.py
UTF-8
890
4.34375
4
[ "MIT" ]
permissive
""" You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid al...
true
d5659401c95a34019627a4408bdbe4d3518e8b83
zalwert/AI_trading
/Download_data.py
UTF-8
7,543
2.828125
3
[]
no_license
''' Data downloaded from: "http: // www.histdata.com / download - free - forex - data /? / excel / 1 - minute - - quotes" Column Fields: DateTime Stamp; OPEN Bid Quote; HIGH Bid Quote; LOW Bid Quote; CLOSE Bid Quote;Volume License: for education purposes only. ''' import pandas as pd import matplotlib.pyplot as ...
true
e454f80ed13c3dafce0eea1d11da10f4b600429d
giuseppecampanella/minimal-music-player
/main.py
UTF-8
15,905
2.734375
3
[]
no_license
#------------------------------------------- # music player based on tkinter library # 2020, by Giuseppe Campanella with <3 #------------------------------------------- import os import json from tkinter import filedialog from tkinter import messagebox import tkinter as tk from time import sleep import vlc import date...
true
ee4a2c7d7948a735bd8714f55d40a4106ef0e852
bogobogo/bash-game
/src/main.py
UTF-8
2,538
2.59375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import subprocess import os import fileinput import time import renderer from consts import IN_WIDTH, TESTING from utils import removeNewLine from messages import level1_firstMessage, progressBar, totalxp from strings import first_message getUserInput = lambda: sys...
true
6667a7c676ebf7761bd03f19652d688be37d0590
tej1996/molecularC
/client/staas/new_storage_bulk.py
UTF-8
1,679
2.671875
3
[]
no_license
#!/usr/bin/python import getpass, socket,time, sys,os,commands sock= socket.socket(socket.AF_INET,socket.SOCK_DGRAM) SERVER_IP="192.168.122.152" SERVER_PORT=8000 drive_name=raw_input("Enter the drive name: ") drive_size=raw_input("Enter the drive size (in MB : eg. 1000,500, any size):") sock.sendto(drive_name,(SERV...
true
0081b9bd369f24bd89338ed7b43365d4596ee042
dtgoitia/advent_of_code_2020
/puzzles/puzzle_02/logic.py
UTF-8
835
2.890625
3
[]
no_license
from itertools import combinations from pathlib import Path from typing import Any, List from puzzles.exceptions import PuzzleError SUM_TARGET = 2020 def resolve(input_paths: List[Path]) -> Any: entries_path = input_paths[0] with entries_path.open() as f: entries = [] for line in f: ...
true
56ad4a7b838acfd9703793d5977c7266cc247b08
s3cret/py-basic
/process/distributed-process/taskworker.py
UTF-8
1,370
2.890625
3
[]
no_license
import time import sys from multiprocessing import Queue from multiprocessing.managers import BaseManager # inherit from BaseManager # just to customize the class name class QueueManager(BaseManager): pass # the QueueManager only retrieve queue from internet, # so provide with service name is fine when registerin...
true
d578410970c07c6c1a33007ab36f1942141b7cfc
IAMRAMKING/pythoncrudmysql
/insertsql.py
UTF-8
547
3.484375
3
[]
no_license
def insert(mydb): mycursor = mydb.cursor() i=0 query = "INSERT INTO Students VALUES (NULL,%s, %s, %s, %s)" n= input("Enter the number of students you want to enter in Student Database: ") while(i<int(n)): name=input("Enter the name: ") rollno= input("Enter the roll number: ") ...
true
672785de158704386b9250e6773b39ac98713448
SlickChris95/practicePython
/exercise17.py
UTF-8
543
3.859375
4
[]
no_license
''' Use the BeautifulSoup and requests Python packages to print out a list of all the article titles on the New York Times homepage. ''' import requests #makes http requests from bs4 import BeautifulSoup #allows us to parse data url = 'https://www.nytimes.com/' r = requests.get(url) r_html = r.text soup = Beautiful...
true
0003d3dbcb5cadb56170a126e6fe5eeeed657869
asad632/Python
/generaters1.py
UTF-8
498
3.640625
4
[]
no_license
# # exercise # def even(n): # for i in range(1,n+1): # if i%2==0: # yield i # even(4) # for i in even(10): # print(i) # # # how generaters works # def ab(n): # for i in range(1,n+1): # yield i # print(ab(10)) # gen = ab(10) # print(next(gen)) # print(next(gen)) # print(next(gen))...
true
3e055ef22ce0f5834261d93823f899ac54ab15c2
daniel71-n/django_blog
/pages/models.py
UTF-8
964
2.625
3
[]
no_license
from django.db import models # Create your models here. class Contact(models.Model): sender_name = models.CharField(max_length=50) sender_email= models.EmailField( help_text="The email address of the individual who made contact") additional_contact_information = models.TextField(blank=True) ...
true
54a49714a131dcef802d951c196a104a7a7e10ce
sickmick69/TwoPass-Assembler
/Code.py
UTF-8
10,900
2.671875
3
[]
no_license
main_opcode = {"CLA": "0000", "LAC": "0001", "SAC": "0010", "ADD": "0011", "SUB": "0100", "BRZ": "0101", "BRN": "0110", "BRP": "0111", "INP": "1000", "DSP": "1001", "MUL": "1010", "DIV": "1011", "STP": "1100"} location_counter = 1 # TO GENERATE SPECIFIC ADDRESS...
true
39ef6036d205fff0174f04e79c4c68dfab09aafb
kibanana/Study-Python-With
/yewon/ch05/class_calculator2.py
UTF-8
406
4.03125
4
[]
no_license
# -*- coding: utf-8 -*- class Calculator: def __init__(self, a, b): self.a = a self.b = b def sum(self): return self.a + self.b def sub(self): return self.a - self.b def mul(self): return self.a * self.b def div(self): if self.b != 0: return self.a / self.b else: retu...
true
6316018a82ab2f31321d0ca90105a82280db70fc
ijc-90/coding-playground
/q1/topNCompetitors.py
UTF-8
2,014
3.296875
3
[]
no_license
def comparator(list): return lambda x: list[x] def reviewContainsCompetitor(review, competitor): return review.find(' ' + competitor + ' ') >= 0 or \ review.find(competitor + ' ') == 0 or \ review.find(' ' + competitor) >= 0 and len(review) == len(' ' + competitor) + review.find(' ' + competitor) or \ ...
true
de07503c0b621f02b3ab7e83066c4b3fe26a1372
wwlapaki310/python
/test/py_test.py
UTF-8
886
3.234375
3
[]
no_license
import calculation import pytest class TestCal(object): def setup_method(self,method): print("method={}".format(method.__name__)) self.cal=calculation.Cal() def teardown_method(self,method): print("method={}".format(method.__name__)) del self.cal @pytest.mark.skip(reas...
true
c1b870c9a272f6001b48e4bd59d9d6a979b6672b
jeremiahd/TTA_Student_Projects
/5_Python/Python Projects/FileDrill/drill.py
UTF-8
706
3.25
3
[]
no_license
import os import time if __name__ == "__main__": # First, let's get our current path path = os.getcwd() # Next, let's get a list of files in 'path' files = os.listdir(path) for file in files: # concatenate our full path, and parse out our extension fullPath = os.path.join(path, f...
true
0531ff07af6f18fd497506209c56a13363858c97
FrenchBear/Python
/Learning/130_Fluent_Python/fp2-utf8/freecode/freecode 96.py
UTF-8
71
2.71875
3
[]
no_license
def __init__(self, iterable): self._balls = list(iterable)
true
29a7aafbafa968a4bb6de97c4103cbc7c6386014
VLPB/VLPB
/pythonCodeBase/src/main.py
UTF-8
1,635
2.640625
3
[]
no_license
import sys from programs import SnvCaller ''' The main method is the main flow of the whole program ''' def main(): print("###############################################################################\n") print("input file: " + inputFile) #print("reversed file: " + secondInputFile) print("referen...
true
52d4aebb1dfc3bed4a8ab7c6ee3d45fe02fec21c
ece324-2019/RoadTo10K
/Data_Collection.py
UTF-8
1,387
2.640625
3
[]
no_license
import json import requests import time import pandas as pd def initiate(): matches_json = json.loads(r.text) matches = pd.io.json.json_normalize(matches_json) curr_id = matches.loc[99].match_id matches = matches[matches.avg_mmr > 4500] matches = matches[matches.lobby_type == 7] matches = matc...
true
cfc93c034a953e596545af8b6a5b4b3330f91290
antoniolucas30/Movile-Code-Challenge-3
/quantidade_possivel_de_saques.py
UTF-8
415
2.890625
3
[]
no_license
total = int(input()) lista = list(set((map(int, input().split())))) resultado = 0 def func(moedasAtuais, indexAtual): global resultado if(moedasAtuais > total): return None elif(moedasAtuais == total): resultado += 1 return None for i in range(indexAtual, len(lista)): func(moedasAtuais + li...
true
0fd8ffd4179439e0d1575f65274b305a7b448e13
ducva/vision
/vision/datasets.py
UTF-8
2,006
2.953125
3
[]
no_license
from fastai.core import * from fastai.datasets import URLs, Config def is_tar(url: str): return url.endswith('.tar.gz') def is_gzip(url: str): return url.endswith('.tgz') def modelpath4file(filename): """ Returns URLs.MODEL path if file exists. Otherwise returns config path" :param filename: ...
true
65fa63d2793d2c595cdfdb3b2c52a134ac3565a3
Sofia1306/Python_Clases
/Ejercicio_DecimalBinario.py
UTF-8
329
4.375
4
[ "MIT" ]
permissive
"""Ejercicio Decimal a Binario """ import math numero = int(input('Ingresa un número: \n')) binario = '' while (numero > 0): if (numero%2 == 0): binario = '0' + binario else: binario = '1' + binario numero = int(math.floor(numero/2)) print(f'El número en binario es {binario...
true
927dac0d2aa918e4092560393c274f40424d303b
BIAOXYZ/variousCodes
/_CodeTopics/LeetCode/201-400/000233-h/deliberate-TLE--000233.py
UTF-8
625
2.90625
3
[]
no_license
class Solution(object): def countDigitOne(self, n): """ :type n: int :rtype: int """ # 先写个肯定超时的 def number_of_one(num): res = 0 while num > 0: if num % 10 == 1: res += 1 num /= 10 ...
true
4d9f0d44c7436ee09119b0e80b6ee652b707f509
RKorzeniowski/Lazy_programmer_projects
/unsupervised_ml/my_parameterize_gaussian.py
UTF-8
891
3.203125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy.stats import multivariate_normal as mvn def softplus(x): # log1p(x) = log(1+x). Use cuz its more numerically stable return np.log1p(np.exp(x)) # weights for neural network that is 4x3x2*2 decoder->codedstate->decoder W1 = np.random.randn(4, 3) W...
true
21f10fb3adec1268f68d97811ada7eb1cfc4acc5
ragnraok/MonoReader
/monoweb/mono/api/objects.py
UTF-8
2,368
2.90625
3
[ "MIT" ]
permissive
""" API object specification and correspond methods """ def fill_list_article_object(article_id, title, site, updated, cover_url, is_fav): """ list article object: { article_id: article_id, title: title, site: site_title, updated: YYYY-MM-DD, ...
true
5186421f72cf5dba42f846e4811036d098e31bb4
blackbat13/matura_inf
/cwiczenia/cwiczenie13/zadanie4.py
UTF-8
493
3.9375
4
[]
no_license
file = open("liczby.txt") binary_numbers = file.read().split("\n") file.close() count = 0 for binary in binary_numbers: digit_counter = dict() # Słownik do zliczania cyfr 0 i 1 digit_counter["0"] = 0 # Inicjalizujemy liczniki zer i jedynek digit_counter["1"] = 0 for digit in binary: # Dla każdej ...
true
06c530422ba449623750abdab420532e43634b3c
liujikun/ESRGAN
/utils.py
UTF-8
6,307
2.546875
3
[]
no_license
import os import numpy as np import torch import torch.nn as nn import torchvision as tv import cv2 import network def text_readlines(filename): # Try to read a txt file and return a list.Return [] if there was a mistake. try: file = open(filename, 'r') except IOError: error = [] re...
true
e5a220223a3bdfa42be9ebf4f13218285dd56802
chodges15/AdventOfCode2020
/Chris/Day13/hodges_day13.py
UTF-8
733
2.890625
3
[ "MIT" ]
permissive
from typing import Tuple, List from sympy.ntheory.modular import crt def parse_input(filename: str) -> Tuple[int, List[int]]: with open(filename, 'r') as f: departure_time = int(f.readline()) bus_ids = list(map(lambda x: int(x) if x != 'x' else 'x', f.readline().split(','))) return (departure_t...
true
a986669cff5461237ed8d141bfdaa9013c663316
yizhiyan1992/LeetCode_problems
/582_Kill_Process.py
UTF-8
766
3.28125
3
[]
no_license
# tree traversal from parent to children+stack. # build a hash table to map parent--->children # Be careful that the leave nodes won't be added as keys into hash table in this question. Thus we need to add a if-sentence when pushign elements into the stack. class Solution: def killProcess(self, pid: List[int], ppi...
true
2e049872927341baf8dbe5d76f77b1c3e0a81bd4
kjappelbaum/oximachinetool
/webservice/compute/utils.py
UTF-8
4,116
2.8125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Some utility functions""" import os import pickle import subprocess from tempfile import NamedTemporaryFile from pymatgen.io.ase import AseAtomsAdaptor MAX_NUMBER_OF_ATOMS = 500 THIS_DIR = os.path.dirname(os.path.realpath(__file__)) def load_pickle(file): """Read a pickle with and ret...
true
62341f6e025e1db9704ee7afae944300c43c3874
tiu1234/cs505algo
/CS501WK6.py
UTF-8
2,257
4.71875
5
[]
no_license
def mergeSort(arr): if len(arr) > 1: mid = len(arr) // 2 # Finding the mid of the array L = arr[:mid] # Dividing the array elements R = arr[mid:] # into 2 halves mergeSort(L) # Sorting the first half mergeSort(R) # Sorting the second half i = j = k = 0 ...
true
4f94f8e82c91d2d2d8a67b3322695aa7678d1689
np9603/Python
/Stacks/DecimalToBinary.py
UTF-8
451
3.828125
4
[]
no_license
def decimalToBinary(decimalnumber): stack = [] while decimalnumber > 0: remainder = decimalnumber % 2 stack.append(remainder) decimalnumber = decimalnumber // 2 ans = '' while len(stack) > 0: ans = ans + str(stack.pop()) return ans def main(): pri...
true
10cf063b55151cb965bc7e1eae738c5064e9b00b
SRILEKHA-V19/GCP_STT_API_Transcription
/stt_prgs/video_model_transcribe.py
UTF-8
2,329
2.8125
3
[]
no_license
import argparse from google.cloud import speech # File from local system/PC, SYNCHRONOUSLY def transcribe_model_selection(speech_file, model): client = speech.SpeechClient() with open(speech_file, 'rb') as audio_file: content = audio_file.read() audio = speech.types.RecognitionAudio(content = con...
true
e45034a59e5ebe978570653c8ecb775c76e8f14f
leandro91004850/CursoPy
/jogos.py
UTF-8
812
3.828125
4
[]
no_license
print("--------------------------------------") print("----------- jogo do advinha-----------") print("--------------------------------------") numero_secreto = 42 total_tentivas = 3 rodada = 1 while(rodada <= total_tentivas): print("tentivas:", rodada, "de", total_tentivas) chute = input("digite o numero: ")...
true
21e4fe63ae33f05b3bb8a236db9c0acc5c7401be
ii200400/algorithm
/Baekjoon/Python/X보다 작은 수.py
UTF-8
93
3.28125
3
[]
no_license
n = int(input().split()[1]) for i in map(int,input().split()): if i<n: print(i,end=' ')
true
1331252cc4a578a5c7c8d91319b0e1e374e5266d
sunil1745/py3
/temcov.py
UTF-8
149
3.84375
4
[]
no_license
ctemp=input("enter Celcius Temp:") result=(int(ctemp)*9/5)+32 #converting string value ot ctemp to integer value print("Frhrenheit temp is:",result)
true
ebea2e700a9e4f89bc9798a3b19ebe7259e52956
ChillkroeteTTS/python-basics
/tasks/task_1_module_import_and_file_reading/task_1_2/task_1_2_overview.py
UTF-8
3,983
4.46875
4
[]
no_license
# Hier soll dir ein Überblick über die grundlegendsten Syntax Eigenschaften von Python gegeben werden. # Du kannst immer wieder hier hin zurückkehren um verschiedene Operationen nachzuschlagen. # Variablen wurden ja schon in Task 1.1 eingeführt. Sie können die Werte verschiedener Datentype beeinhalten. # Die wichtigste...
true
de69e3c43c11d9983e5e8f0e7525f0b23976ff2e
HKavalos/ToGather
/TestingGrounds/togather_server.py
UTF-8
5,461
2.78125
3
[]
no_license
import sys from socketserver import * import threading import socket # Overrides socketserver.BaseRequestHandler class. # Class methods setup, handle, and finish are called automatically by superclass constructor. class PythonHandler(BaseRequestHandler): _connections = {} # Static dictionary to keep track of act...
true
201d7398fa61fa92de2d61043961568dce13335f
FangShinDeng/LeetCodeLearning
/1008幾個水桶.py
UTF-8
383
2.84375
3
[]
no_license
# https://oj.lidemy.com/problem/1008 import sys M = int(sys.stdin.readline()) bucketNumber = 0 def findMaxPow(number): for i in range(1,32): if 2 ** i > number: return i - 1 break for j in range(1,99): if M != 0: maxBucket = findMaxPow(M) M = M - 2**...
true
46b08d553e3f06e0beab5ef4230a5bb5a7008fdc
mattias-lw/advent2018
/5/program.py
UTF-8
635
3.328125
3
[]
no_license
import re def do_char(stack,c): if len(stack) == 0: stack.append(c) return last = stack[-1] if last.lower() == c.lower() and ((last.isupper() and c.islower()) or (last.islower() and c.isupper())): stack.pop() else: stack.append(c) def do(d,filt=r'@'): stack = [] ...
true
285eb9d48bfd2ff1b8adb7682ff3be63cbbd2012
xiejinwen113/tensorflow_cookbook
/03_Linear_Regression/C0303_lin_reg_decomposition.py
UTF-8
3,359
3.015625
3
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- """ @Author : zYx.Tom @Contact : 526614962@qq.com @site : https://github.com/zhuyuanxiang/tensorflow_cookbook --------------------------- @Software : PyCharm @Project : TensorFlow_Machine_Learning_Cookbook @File : C0303_lin_reg_decomposition.py @Version ...
true
6dbafe3aec0d7081df3dbdb8702e9a38154ec36b
lennox-davidlevy/python_works
/strings/name.py
UTF-8
227
3.515625
4
[]
no_license
name = "david levy is the most handsome" print(name.title()) new_name = "DAviD is So COOL" print(new_name.title()) uppercase_name = "dAvId lEvY" lowercase_name = "DaViD LeVy" print(uppercase_name.upper()) print(lowercase_name.lower())
true
3af5d1d895911bbf9769aabcc4c84fef87566718
rahuldbhadange/Python
/Python/__function/functions1/functions1/37 lambda2.py
UTF-8
358
3.84375
4
[]
no_license
In which situation you go for lamda function Ans: when providing one function as a parameter to another function,then we go for lambda function ex: def f1(function): ----------- ----------- ----------- def f2(): ----------- ----------- ----------- f1(f2()) Instea...
true
cc2611d02b78f58f23a27ebfff038dae39a69887
pflun/advancedAlgorithms
/groupThePeople.py
UTF-8
639
3
3
[]
no_license
class Solution(object): def groupThePeople(self, groupSizes): if len(groupSizes) == 0: return [] dic = {} for i in range(len(groupSizes)): dic[groupSizes[i]] = dic.get(groupSizes[i], []) + [i] res = [] for k, v in dic.items(): while k in di...
true
457c2b30a98fc758dc7d5c16a8448e467e290932
Pandinosaurus/ensae_teaching_cs
/_todo/programme/copie_usb.py
ISO-8859-1
4,181
3.03125
3
[ "MIT" ]
permissive
# coding: cp1252 """copie de fichiers sur une cl USB""" import re # pour les expressions rgulires import os # pour les fichiers et rpertoires import os.path # pour les noms de fichiers et noms de rpertoires import copy import shutil # pour la copie de fichiers class copie_usb (object): """recopie d...
true
feeaa303772ce91beca9aab5526f593468d4ecdf
LeRoiFou/mooc_sequences
/007_listsAppendExtend.py
UTF-8
944
4.53125
5
[]
no_license
""" Méthodes append() et extend() dans une liste Éditeur : Laurent REYNAUD Date : 25-07-2020 """ personnages = [] prem = [2, 3, 5, 7, 11] """ Utilité de la méthode append() La méthode append() permet de rajouter un composant dans une liste """ nouveau = input("Personnage : ") # Exemple de saisi :...
true
b4503dc8374d3e0d5fc52572916ce2ebe4bb74d1
Ryoung27/Python-Algo-and-Data-Struc-Practice
/summation.py
UTF-8
123
3.125
3
[]
no_license
def summation(num): answer = 0 print(range(num)) for i in range(num +1): answer += i return answer
true
cbab778d3bdcce85be0af0067e3170e200ca0f5f
lshang0311/pandas-examples
/create_a_column_with_random_float_numbers.py
UTF-8
395
3.046875
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame() N = 1000 df['rand_col_1'] = np.random.RandomState(0).uniform(0, 1, size=N) df['rand_col_2'] = np.random.RandomState(0).normal(0, 1, size=N) df['rand_col_3'] = np.random.RandomState(0).binomial(10, 0.5, size=N) df['rand_col_4'] ...
true
1578ce7f7a4fca82d69f5c90e90a343e65cad971
Touchette/UniversityClasses
/CIS313/Project4/Problem2/PolishNotation.py
UTF-8
3,873
4.28125
4
[]
no_license
''' Author: Touchette Project Three: Calculate and Properly Print Polish Notation Completion Date: 2018-03-12 A Syntax Tree class (provided to me) that keeps track of prefix mathematical notation, also known as Polish Notation. The class has two methods to print out what the arithmetic expression looks like as well as...
true
8d44b1502adbb818c69670602540a86a32beb8ac
abiart/evalution_performance
/tp1/tp_eval_exemple4.py
UTF-8
2,547
3.96875
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import matplotlib.pyplot as plt # bibliothéque pour afficher les figures import random # bibliothéque pour génerer une distribution discréte entre [0,1] import numpy as np # bibliothéque pour la création d'axe des x # In[2]: def gen_tabel(n): # Focntion qui va féné...
true
67904201b91011bfd5c82bd3f0a8f70e011e9e02
huip/Algorithm
/Code/Sort/bubble/BubbleSort.py
UTF-8
239
3.734375
4
[ "MIT" ]
permissive
def bubble_sort(array): for i in range(len(array)): for j in range(len(array) - i -1): if array[j] > array[j+1]: array[j],array[j+1] = array[j+1],array[j] return array array = [0,2,1,3,6,4,5,7,9,8] bubble_sort(array)
true
d0cdafffb4ea9d75cc9b11fc4db176dac450e176
okeoxxx/advent-of-code-2017
/day22/22.py
UTF-8
1,655
3.1875
3
[]
no_license
import copy file = open('22.txt','r') board = [] row = 0 extend = 200 while True: line = file.readline()[:-1] if line == '': break board.append(['.']*extend+[i for i in line]+['.']*extend) row += 1 a = len(board[0]) for i in range(extend): board.insert(0, ['.']*a) board.append(['.']*...
true
a037469c8ca202c35e8cbf1890c5cc85a91814f5
mtfelix/python-study
/ball_rec.py
UTF-8
497
3.140625
3
[]
no_license
import simplegui point_pos = [10,20] vel = [1,1] acc = [1.1,1.1] rec_pos = [50,50] width = 130 height = 90 def tick(): point_pos[0] += vel[0] point_pos[1] += vel[1] vel[0] += acc[0] vel[1] += acc[1] def draw(canvas): canvas.draw_circle(point_pos, 1, 5, "Red") canvas.draw_polygon([(50, 50...
true
c08651208e0ef2aaa64f9830b3684ddbe2631126
Demfier/misc-fun-acts
/kiran-ass1-q1-intersection.py
UTF-8
307
3.578125
4
[]
no_license
def get_intersection(x, y, u, v): """ The new interval [a, b] will be such that a = max(x, u), i.e., the higher of the starting points and b = min(y, v), i.e., the smaller of the two boundaries. Draw the two intervals on a number line to visualize. """ return {max(x, u), min(y, v)}
true
2d135434b84bb66525024815677427de52c61759
JorgeDeLosSantos/curso-wxpython
/Clase 08/clase_08.py
UTF-8
1,652
3.25
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import wx class wxEditor(wx.Frame): def __init__(self,parent,title): wx.Frame.__init__(self,parent=parent,title=title,size=(400,300)) # Archivo self.archivo = "" # TextCtrl self.initCtrls() # Crear menu self.initMenu(...
true
77e117db7c3ec9cee90afb39f46a2d233a5ade4a
Tubbz-alt/govuk-entity-personalisation
/tests/utils/test_helper_embedding.py
UTF-8
1,315
2.546875
3
[]
no_license
import src.utils.helper_embedding as f import pytest def test_reshape_df(df_embedding_mess, df_embedding_clean): df = f.reshape_df(df=df_embedding_mess, col_name='embedding') assert df.equals(df_embedding_clean) def test_calculate_cosine_similarity(vectors, vectors_cos_sim): with p...
true
36bd1a9a4032fdd1450a65a5ebb635264cdbe8c9
undersfx/python-interview-exercices
/leetcode/67.py
UTF-8
804
4.1875
4
[]
no_license
""" Given two binary strings a and b, return their sum as a binary string. Constraints: 1 <= a.length, b.length <= 104 a and b consist only of '0' or '1' characters. Each string does not contain leading zeros except for the zero itself. >>> a = "11" >>> b = "1" >>> add_binary(a, b) '100' >>> a = "1010" >>> b = "1011...
true
9fd2a74cd21ae82a4e71a1980afcf06f3e219069
buckket/pyKC
/pykc/objects/thread.py
UTF-8
600
2.921875
3
[ "WTFPL" ]
permissive
import json import pickle class Thread(object): def __init__(self, id, board, flags, posts): self.id = id self.board = board self.flags = flags self.posts = posts def to_safe_dict(self): posts = [] for post in self.posts: post_dict = post.to_safe_d...
true
08bf6cd6d60beee1d594b2fcca8046af9054765e
Naramsim/SPE-Assignment-2
/run.py
UTF-8
1,669
2.921875
3
[]
no_license
########### # IMPORTS # ########### import multiprocessing import os import sys import platform import _thread from subprocess import Popen import numpy as np ############# # FUNCTIONS # ############# def spawn_files(): file = open("data/total.csv", "w+") file.write(",".join(["scale", "throughput", "load", "...
true
e739691cedb9181517dfd8a49f46cac3e9d15f4c
guijiyang/defect_detection
/utils.py
UTF-8
5,821
2.8125
3
[]
no_license
import torch import colorsys import random import cv2 import numpy as np import matplotlib.pyplot as plt def mask2rle(img): """ img : numpy array, 1 - mask, 0 - background Returns run length as string formated """ pixels = img.T.flatten() pixels = np.concatenate([[0], pixels, [0]]) runs = np....
true
88254cd4c1c4499aa81e3c04d412fdfa90be488f
Iscaraca/BBCSLightningLab
/more-threads.py
UTF-8
459
3.71875
4
[]
no_license
import threading import time def sleeper(n): print(f"Hi I'll sleep for {n} seconds") time.sleep(n) print("I have awakened!") start = time.time() threads = [] for i in range(5): t = threading.Thread(target = sleeper, name = 'thread{}'.format(i), args =([5])) threads.append(t) t.start() pri...
true
8d526daf62ab1364fbee9eb5cc5971fb92727c2b
operepo/ope
/libs/gluon/contrib/pyrtf/PropertySets.py
UTF-8
14,016
3.171875
3
[ "MIT" ]
permissive
""" PropertySets group common attributes together, each property set is used to control a specific part of the rendering. PropertySets can be used in different elements of the document. For example the FramePropertySet is used in paragraphs, tables, cells, etc. The TextPropertySet can be used for text or in a Paragr...
true
7ff88eecc3c64dd59f7e2638da9208e6e2435128
samueloliva/GeoCache
/DistributedCache.py
UTF-8
1,770
2.625
3
[]
no_license
from Cache import Cache from Data import Data import socket from threading import Thread import traceback class DistributedCache(): count = 0 def __init__(self, max_size=3, time_expire=2, server_address=None): self.cache = Cache(max_size, time_expire) self.server_address = server_address def start_server(...
true
22a0f093d3e188bf8fff6fd65489687b0c24a495
Doun92/UNIL_DH_memoire
/script_11/prints.py
UTF-8
129,005
2.609375
3
[ "MIT" ]
permissive
""" Page 8 """ # print(EvolutionPhonetique.evolution_phonetique("FLỌRE")) #flour p.8 # print(EvolutionPhonetique.evolution_phonetique("GỌLA")) #goule p.8 # print(EvolutionPhonetique.evolution_phonetique("PẸNA")) #peine p.8 # print(EvolutionPhonetique.evolution_phonetique("PẸRA")) #peire p.8 # print(EvolutionPhon...
true
2c6bd5f89119730a01148fdf43f944193abca2a0
codacy-badger/pythonApps
/numpy/numpyDataTypeObject.py
UTF-8
418
3.5625
4
[ "MIT" ]
permissive
import numpy as np # i4 represents integer of size 4 byte # > represents big-endian byte ordering and # < represents little-endian encoding. dataType = np.dtype('>i4') print("Byte order is:",dataType.byteorder) print("Size is:", dataType.itemsize) print("Data type is:",dataType.name) #different between type and dtyp...
true
f4d7740430605704947ebcb118171d98f6dc0030
hkhurram147/ESC180
/lab06-tictactoe.py
UTF-8
5,251
3.984375
4
[]
no_license
''' X | O | X ---+---+--- O | O | X ---+---+--- | X | ''' import random import sys def print_board_and_legend(board): for i in range(3): line1 = " " + board[i][0] + " | " + board[i][1] + " | " + board[i][2] line2 = " " + str(3*i+1) + " | " + str(3*i+2) + " | " + str(3*i+3) ...
true