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
1b3b873f824cb3ee6f1e2757d6216bd021c68953
Aasthaengg/IBMdataset
/Python_codes/p04033/s591611241.py
UTF-8
194
2.890625
3
[]
no_license
a,b=map(int,input().split()) if 0<a: print("Positive") exit() else: if b<0: S=(b-a+1)%2 if S==1: print("Negative") else: print("Positive") else: print("Zero")
true
92ea9a1159eabbe6969f92cc805e92f151ad01f4
matthewatabet/algorithms
/strings/dna.py
UTF-8
1,172
4.125
4
[]
no_license
''' All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA. Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. For ...
true
cd2f8317037fd1b0cbbba0cc2c7fecf6b5ba566d
Zainapplicon152/python-for-beginners
/sets.py
UTF-8
415
3.875
4
[]
no_license
# like sets in maths # two method for create sets mySet1 = {'sat', 'sun', 'mon', 'tue', 'wed', 'thu', 'fri'} mySet2 = set('Zain Ul Abideen') mySet3 = {1, 2, 3, 4, 5, 6, 7, 8} mySet4 = {1, 22, 9, 4, 53, 66, 7, 8} myset8 = set() print(type(myset8)) print(mySet1) print(mySet2) mySet5 = mySet3.union(mySet4) print(mySet5...
true
5222290ee151236816ddefe4d4f07f88cc9ff845
jinmin527/learning-cuda-trt
/tensorrt-integrate-1.5-unet/unet-pytorch-main/utils/utils_fit.py
UTF-8
7,096
2.546875
3
[ "MIT" ]
permissive
import torch from nets.unet_training import CE_Loss, Dice_loss, Focal_Loss from tqdm import tqdm from utils.utils import get_lr from utils.utils_metrics import f_score def fit_one_epoch(model_train, model, loss_history, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, Epoch, cuda, dice_loss, focal...
true
86249a1ee068f9a8ed366d026646da6cf598b1f1
jmcgettigan/ia241
/lab6.py
UTF-8
976
3.625
4
[ "MIT" ]
permissive
""" Lab 6 for Loop and Range """ #3.1 for i in range(6): if i !=3: print(i) #3.2 #result = 1 #for i in range(1,6): # result = result * i #print(result) # #3.3 # result = 0 # for i in range(1,6): # result = result + i # print(result) # #3.4 # result = 1 # for i in range(3,9): # result =...
true
58d5c81de89bdb8f21fe078f4d004ff49270c636
farhanreynaldo/AoC2020
/AoC2020/day12.py
UTF-8
1,751
3.640625
4
[]
no_license
from collections import defaultdict SAMPLE = """F10 N3 F7 R90 F11""" def solve(raw): instructions = [(e[0], int(e[1:])) for e in raw.split("\n")] x, y = 0, 0 heading = 0 # East as 0, 90, 180, 270 for S, W, N respectively for action, value in instructions: if action == "E": x += v...
true
f7cee4031ee6ca7a46c45c111ff254f8dfdd08e1
theozornelas/pacman
/Pacman AI/qLearningAgent.py
UTF-8
15,483
2.90625
3
[]
no_license
from captureAgents import CaptureAgent import distanceCalculator import random import time import util import sys import game from game import Directions from util import nearestPoint import math from myTeam import createTeam from myTeam import ReflexCaptureAgent from myTeam import DefensiveReflexAgent from IPython.dis...
true
7633c7d9381858fee5c0caafcbaf68d35635af21
Aakashgarg289/Python-Projects
/Covid-19 Infection Prediction/main.py
UTF-8
757
2.640625
3
[]
no_license
from flask import Flask, render_template, request import pickle app = Flask(__name__) f = open("model.pkl", "rb") clf = pickle.load(f) # print(clf) f.close() @app.route('/', methods=['GET', 'POST']) def hello(): if request.method=="POST": myDict = request.form fever = int(myDict['fever']) ...
true
43ef1b5200181c08a74eb7442511fe5c91151641
jszheng/Qt4Examples
/Python/chap10/settingsviewer/settingsviewer.py
UTF-8
3,038
2.609375
3
[]
no_license
from PyQt4.QtCore import * from PyQt4.QtGui import * class SettingsViewer(QDialog): def __init__(self, parent=None): super(SettingsViewer, self).__init__(parent) self.organization = 'Trolltech' self.application = 'Designer' self.treeWidget = QTreeWidget() self.treeWidget.se...
true
65e940990f22633e247503638c84f54bb956bac7
Nitesh-thapliyal/LVM-automation
/LVM_automate.py
UTF-8
2,159
3.09375
3
[]
no_license
import os import getpass os.system("tput setaf 3") print("\t\t\tJust Press and get things done!!") os.system("tput setaf 7") print("\t\t\t---------------------------------------") passwd = getpass.getpass("Enter your password:") if passwd!="lw": print("password incorrect") exit() while True: ...
true
2e2ee10aaf43b96734e5e2eebaa5116732e283b1
BeeMargarida/dissertation
/data/2-B-memory_error_random/generate_all_in_one.py
UTF-8
2,986
2.578125
3
[]
no_license
import plotly.io as pio import plotly.graph_objects as go from plotly.subplots import make_subplots import pandas as pd import numpy as np df_payload = pd.read_csv('./data/last_payload.csv') df_uptime_heat = pd.read_csv('./data/heatmap_uptime.csv') df_nodes_heat = pd.read_csv('./data/heatmap_nodes.csv') df_...
true
031a7bebaeca3c88054b9e5f7488b692c37b594a
obscure76/pyprobs
/primeCheck.py
UTF-8
223
3.109375
3
[]
no_license
__author__ = 'midhunc' def printPrime(): for i in range(1, 100): if ((6*i-1)%5 !=0 ): print(6*i-1) if ((6*i+1)%5 !=0): print(6*i+1) if __name__ == '__main__': printPrime();
true
b53376b72be5f29c9260b6d1db1825b357722646
yujunsen/python
/day01/test1/demo_3.py
UTF-8
173
2.796875
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 a=None if a is None: print 2 if a != None: if a==1: print a elif a == 2: print a else: print a
true
4e9d5b05b1a049f9e784ca7a5892157e45ed5c11
kasa4565/DesignPatterns
/ProjektyStudentow/2019_Jarzembinski_Bartlomiej/menu/quesadillas/grilled_chicken.py
UTF-8
402
2.734375
3
[]
no_license
from menu.quesadilla import Quesadilla class QuesadillaGrilledChicken(Quesadilla): def __init__(self, discount): self._name = "Quesadilla with grilled chicken" self._price = 12.89 * (1 - discount) self._tortilla = "wholewheat" self._cheese = "cheddar" self._spice = "moderate" self._componen...
true
b8ef3e2c629b03a7cc551d2edfc624f3f943f7d8
Roboy/LSM_SpiNNaker_MyoArm
/src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/pyNN/neuron/recording.py
UTF-8
5,569
2.53125
3
[ "BSD-3-Clause" ]
permissive
""" :copyright: Copyright 2006-2013 by the PyNN team, see AUTHORS. :license: CeCILL, see LICENSE for details. """ import numpy from pyNN import recording from pyNN.neuron import simulator import re from neuron import h recordable_pattern = re.compile(r'((?P<section>\w+)(\((?P<location>[-+]?[0-9]*\.?[0-9]+)\))?\.)?(?...
true
6cfa8d258755a907220e4db3c7026c225303d8a7
soumyaricky19/Naive-Bayes
/ANN.py
UTF-8
13,972
2.78125
3
[]
no_license
from Network import Network import sys import csv import numpy as np import math max_iterations=500 class_threshold=0.05 ita=0.5 def preProcess(data_in,data_out): global class_threshold string_att_map=[] attribute_vector_list=[] col_to_delete=[] is_classfication=False num_cols=0 num_rows=...
true
8365d2491d35694002e5f197cae8b1eb849b918f
JeredWilloughby/BusinessIntelligence
/BI_HW2.py
UTF-8
4,336
3.578125
4
[]
no_license
#Import the associative libraries. import pandas as pd import io import requests as r #Assign variables for the filepath, files, and url url = 'http://drd.ba.ttu.edu/isqs6339/hw/hw2/' path = '/Users/jeredwilloughby/Desktop/Business Intelligence/' file1 = 'players.csv' file2 = 'player_sessions.csv' ###I used this file t...
true
efd15a6cedd10bf130d929009e7106d18ec6465b
co360/Data-Science-and-Machine-Learning-Course
/Intro To Machine Learning/Decision Trees and Random Forests/random_forest_project.py
UTF-8
1,927
2.734375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from...
true
a6caa96fe1709d94063f685655e5acdaf058d9ca
endegenazewdu/python-sample-try
/listexaple.py
UTF-8
550
3.484375
3
[]
no_license
#this is list you can change it student=["endegena","nathan","alem"] student[0]="kid"#you can change'cust' print(student[0]) #this is tuple you can't change student=("endegena","nathan","alem") print(student[0]) #this is set un orderd and didn't allow dublicat student={"endegena","nathan","alem"} print(student) #th...
true
9b4d366de7bac6f46a7670c0f556dc0736d5927a
yatinkode/dia-assessment
/can_we_afford.py
UTF-8
6,266
2.734375
3
[]
no_license
#! /usr/bin/env python import argparse import sys import numpy as np import pandas as pd from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.lin...
true
c786bfd82d23401da72a9df4c3af12289d90edd4
zhhehao/LeetcodePrac
/131.分割回文串.py
UTF-8
804
3.03125
3
[]
no_license
# # @lc app=leetcode.cn id=131 lang=python3 # # [131] 分割回文串 # # @lc code=start class Solution: def partition(self, s: str) -> List[List[str]]: def is_par(s): i, j = 0, len(s)-1 while i < j: if s[i] != s[j]: return False i += 1 ...
true
f82be1b5fe4629ba39d6e11e561c683fce4e250a
KaterinaKuznetsova/Machine_Learning_Labs
/lab3/3_lda.py
UTF-8
5,017
3.265625
3
[]
no_license
from math import sqrt import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn import metrics from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA, QuadraticDiscriminantAnalysis as QDA from sklearn.model_selection import train_test_split # функция для вы...
true
30ddd1dd7b4e917d58dbbd2f0d869b315c4a3a8f
majdev/nyc_taxi_fare
/NYC Taxi Fare Predictor.py
UTF-8
19,341
3.5625
4
[]
no_license
# coding: utf-8 # # CSE 519 -- Data Science (Fall 2018) # # Homework 2: Exploratory Data Analysis in iPython # # ## New York City Taxi Fare Prediction # ## Md Majid Jahangir - SBU ID 112077145 # # ### Setting up the libraries and packages and global variables # In[ ]: get_ipython().run_line_magic('matplotlib',...
true
46959095a9a76c0a33d6e537dc53b85428ff9af5
dmeelker/pytris
/timer.py
UTF-8
227
2.9375
3
[]
no_license
class Stopwatch: def __init__(self, startTime): self.lastEventTime = startTime def update(self, time): return time - self.lastEventTime def reset(self, time): self.lastEventTime = time
true
0b180b9dad9f6372bb54e12121937144f52a0478
ijyliu/ECMA-31330-Project
/Source/Simulations/Setup_Parallel_Sims.py
UTF-8
1,774
2.59375
3
[]
no_license
# Directory structure import os repo_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..') input_dir = repo_dir + "/Input" output_dir = repo_dir + "/Output" figures_dir = output_dir + "/Figures" tables_dir = output_dir + "/Tables" sim_results_dir = output_dir + "/Sim_Results" # Packages import panda...
true
4bcad671c5e8598249c3f0936c514b5128e90c5d
son900/Homework
/home/home_works/hw1.py
UTF-8
5,161
3.828125
4
[]
no_license
# 1. Define the id of next variables: int_a = 55 print(id(int_a)) str_b = 'cursor' print(id(str_b)) set_c = {1, 2, 3} print(id(set_c)) lst_d = [1, 2, 3] print(id(lst_d)) dict_e = {'a': 1, 'b': 2, 'c': 3} print(id(dict_e)) # 2. Append 4 and 5 to the lst_d and define the id one more time. lst_d.extend([4, 5]) print(id(ls...
true
bb692f31135ab071ed8d1af307f0f7235c2f4d61
alishawillman/Python-Projects
/DjangoUniversity/Classes/classApp/models.py
UTF-8
980
2.859375
3
[]
no_license
from django.db import models # Creating objects of djangoClasses TYPE_CHOICES = { ('Beginner Python', 'Beginner Python'), ('Intermediate Python', ' Intermediate Python'), ('Advanced Python', 'Advanced Python'), ('Beginner JavaScript', 'Beginner JavaScript'), ('Intermediate JavaScript', 'Intermediat...
true
a4d2ea45c893d0bdb15097ad9d2c1bdf11e6af03
nstandev/qa
/old/user_profile.py
UTF-8
10,389
2.671875
3
[]
no_license
import time import unittest from configparser import ConfigParser from selenium import webdriver from selenium.webdriver.chrome.options import Options parser = ConfigParser() options = Options() options.add_argument('--no-sandbox') options.add_argument('--disable-dev-shm-usage') options.add_argument('--headless') opt...
true
692cb3bb2c86ed051a4c1dc79626ba81f838cf0d
Chrisroj/VeranoCIMAT
/cryptos.py
UTF-8
1,316
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 26 19:52:46 2021 @author: ferro """ from statsmodels.tsa.stattools import acf, pacf import plotly.graph_objects as go import numpy as np # Function to create ACF in plotly def create_corr_plot(series, plot_pacf=False): corr_array = pacf(series.dropna(), alpha=0.05) ...
true
cd55f036e3c0a125d59669a5b8e3d3264a4aa438
Julia-AlmeidaLopes/Python
/ex012.py
UTF-8
178
3.21875
3
[]
no_license
preco = float(input('Digite o preço do produto: ')) desconto = preco - (5/100 * preco) print(f'O preço do produto é R${preco} mas com o desconto ele passa ser R${desconto} ')
true
cc7cd6f25c901fa8f204ff111d1eeb571f6b2721
jespb/Python-GSGP
/gsgp/Individual.py
UTF-8
4,367
2.71875
3
[]
no_license
from .Node import Node import math from sklearn.metrics import accuracy_score, f1_score, cohen_kappa_score, mean_squared_error import warnings warnings.filterwarnings("ignore") # # By using this file, you are agreeing to this product's EULA # # This product can be obtained in https://github.com/jespb/Python-GSGP #...
true
2aff7f19b24eb25d479001d7ab5f3a7263e75bbf
ArnoldKuo/tf
/transfer_learning_worms4.py
UTF-8
1,909
2.78125
3
[]
no_license
### Transfer Learning example using Keras and Mobilenet V2 import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.mobilenet import preprocess_input from tensor...
true
7186c3a26946affc57f4a99aa5630fee2ac44dd0
Aasthaengg/IBMdataset
/Python_codes/p02814/s662967633.py
UTF-8
441
2.546875
3
[]
no_license
import fractions def main(): n, m = map(int, input().split()) a = list(map(int, input().split())) mul = a[0] for i in range(1, n): mul = mul * a[i] // fractions.gcd(mul, a[i]) for i in a: if mul // i % 2 == 0: print(0) exit() if m >= mul // 2: an...
true
9132abcf8fe427cd10a7a3e9c446ae36e483ef70
seniorteck/100DaysofPythonProject
/Workbench_Algorithm/StockCalulator.py
UTF-8
796
4.28125
4
[]
no_license
#stock quanitity input from usert declared and asigned to variable name stock_quantity stock_quantity = int(input('How many ice_cream would you like to buy? ')) #Quantity of Stock avaliable for purchase stock_avaliable = 10 #stock initialization i = 1 #checking and comparing the variable i with stock quanity from user...
true
a8b4076a92a19abbccd88e01b21822ad6aa6929f
Edgeeeeee/xmn
/python/spider/v3.py
UTF-8
462
2.796875
3
[]
no_license
import chardet from urllib import request if __name__ == '__main__': url = "http://news.baidu.com/" rsp = request.urlopen(url) html = rsp.read() print(type(rsp)) print(rsp) print(rsp.geturl()) print(rsp.getcode()) print(rsp.info()) # # 利用chardet自动检测 # cs = chardet.detect(html) ...
true
d2e9cb57c02d45a88593d7c2e22b51c0af284298
TroyMurphy/StampProject
/BrianProject/read_pdf_pypdf.py
UTF-8
12,773
2.640625
3
[]
no_license
#http://stackoverflow.com/questions/21113773/pdfminer-iterating-through-pages-and-converting-them-to-text from PyPDF2 import PdfFileReader, PdfFileWriter from decimal import * import StringIO from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter, legal, elevenSeventeen, landscape,portrait ...
true
badfec373074abea6842fdbf71ee0b43aa7ac0b5
mariazverina/adventofcode2016
/day5.py
UTF-8
455
2.984375
3
[]
no_license
import hashlib door = "cxdnnyjw" password = [None] * 8 print(password) cnt = 0 while True: m = hashlib.md5() m.update((door + str(cnt)).encode()) h = m.hexdigest() if h[:5] == "00000": pos = int(h[5], 16) if pos < len(password) and password[pos] is None: password[pos] = ...
true
292fd9701ec64cf830948b92bf95b27f8d10f1bd
emergoncalves/web-crawler-guia-jogos
/guiaJogos-crawler2.py
UTF-8
900
2.671875
3
[]
no_license
# coding: utf-8 import requests import bs4 import json root_url = 'https://mantosdofutebol.com.br' index_url = root_url + '/guia-de-jogos-tv-hoje-ao-vivo' def get_guia_jogos(): response = requests.get(index_url) soup = bs4.BeautifulSoup(response.text, "html.parser") jogos = [] for jogoSoap in soup....
true
7c4623c762bf0d3393d64d09b0691f1269d3239f
dk47os3r/os-security-reinforcement
/tool/console.py
UTF-8
2,053
3.546875
4
[]
no_license
# -*- coding: UTF-8 -*- """ 控制台相关 Author: 赵明明 """ def promised(msg="?", color=1): """ 向用户发起询问, 获取许可 :param msg: 消息 :param color: 终端显示的颜色, 1绿色, 2黄色, 3红色, 0或其它控制台默认颜色, :return: 用户输入YES'、'yes'、'Y'或'y'返回True; 输入'NOT'、'not'、'N'或'n'返回False """ promise = "" if not msg.endswith("?") and not ms...
true
71dd92b4279e243b0dcae6f78749ec2a8bf4df8f
perellonieto/datasets
/cifar10/scripts/explore_db.py
UTF-8
3,450
2.640625
3
[]
no_license
#!/usr/bin/python from sys import exit from os import rename, remove from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter import numpy as np import leveldb import lmdb import caffe def parse_args(): """Parse input arguments """ parser = ArgumentParser(description=__doc__, ...
true
f06344da93db1814568e5573381d06772834654f
ydocore/deeplearning-keras-tf2-torch
/6/06_attention_torch.py
UTF-8
7,715
2.609375
3
[]
no_license
''' 6.2.5.2 Encoder-Decoder (Attention) - PyTorch ''' import os import random import numpy as np import torch import torch.nn as nn import torch.optim as optimizers from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence from layers.torch import Attention from utils import Vocab from utils.torch impor...
true
56e8657efb9cf570fa4e9cfa8b6df75b7bf63f69
prajdabre/NetBeansProjects
/pythonexercises/src/pythonexercises.py
UTF-8
471
3.328125
3
[]
no_license
import sys import csv if len(sys.argv)!=2: print "Incorrect number of arguments entered\n Usage SCRIPTNAME CSVFILE.csv" else: if sys.argv[1].split('.')[1] is 'csv': csvdata=csv.reader(open(sys.argv[1])) a=[] for i in range(2): csvdata.next() for row in csvdata: ...
true
2ec79069fee6301986804fbc70ad79c9a6bf07c6
iCodeIN/memo
/tests/test_runner.py
UTF-8
2,452
2.71875
3
[ "MIT" ]
permissive
import pytest from memo import memlist, Runner, grid @pytest.mark.parametrize( "kw", [{"backend": "loky"}, {"backend": "threading"}, {"backend": "multiprocessing"}], ) def test_base_multiple_calls(kw): data = [] g = [{"a": 1}] * 100 @memlist(data=data) def count_values(n_jobs=-1, **kwargs): ...
true
75b6860ffd905b9d2be91fde3e1fe46c3e0ea567
hughdbrown/BeerRecommender
/WebScraping/BeerAdvocate.py
UTF-8
3,797
3.21875
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys import pandas as pd def get_beer(): # Gets beer data from beeradvocate.com all_beer_info = [] driver = webdriver.Chrome() driver.get("https://www.beeradvocate.com/beer/") assert "Beer" in driver.title beer_name = d...
true
7a43f48b39f6cea537fcd0cf2ce14fe10bd3b748
apexton2/mis3640-python
/Assignment1/drunkardwalk.py
UTF-8
907
4.375
4
[]
no_license
import random import turtle def drunkard_walk(x, y, n): """ x, y: the original location n: the number of intersections(steps) return the distance after n intersections(steps) from the origin """ person = turtle.Turtle() for i in range(n): step = random.randint(0, 3) ...
true
71818d5693af45b80513a81827c400445aebdefb
daria-nikanorova/Test_analytics
/part_B/main.py
UTF-8
472
2.953125
3
[]
no_license
# main.py from concurrent.futures import ThreadPoolExecutor, as_completed from counter import Counter from task import Task new_counter = Counter() values = [2 for _ in range(10)] # list comprehension is a better way (will not fail with matrices) tasks = [] for value in values: tasks.append(Task(value)) with Thr...
true
97b90ac95957fa1db9be16c9ed2378a239fc12b0
samvv/pyvalidate
/src/pyvalidate/util.py
UTF-8
794
2.71875
3
[ "MIT" ]
permissive
import re import ast def get_type_annotations(instance): return list(instance.__class__.__annotations__.items()) def first_or_none(iterable): try: return next(iterable) except StopIteration: return None def to_human_readable(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1 \2', name) ...
true
6bdde95b5df211778149cd25ded05b61deb96da2
katerinanil/repa
/web_server/sorting_2.py
UTF-8
169
2.90625
3
[]
no_license
from itertools import chain def sort(*lists): return sorted(chain(*lists)) if __name__ == '__main__': for s in sort([1,5,6,9,90],[90,800,2],[]): print(s)
true
d26a52837465f28d5946b406cb7a4ed372e4caac
lmoshood/python201bookcode
/chapter8_itertools/zip_longest_example.py
UTF-8
112
2.71875
3
[]
no_license
from itertools import zip_longest for item in zip_longest('ABCD', 'xy', fillvalue='BLANK'): print (item)
true
5809a691a62e30c2f1d04c8974638d8f42320504
ahmetihsankaya/week5
/exercise 5.3.23/9th.py
UTF-8
315
4.1875
4
[]
no_license
song = "The rain in Spain..." print(song) print(song.split()) #*.split splits the words in the assigned variable. print(" ".join(song.split())) #*.join appends different lists. #in the end, they're same, but if we change sth before the .join, then it will produce different as such: print(";".join(song.split()))
true
06d78f7d0b78a22e3c495bc2f2961d444b3cae2b
kiran-k-kharvi/python-learning
/logical.py
UTF-8
125
2.875
3
[]
no_license
high_income = True good_credit = False if high_income and good_credit: print("Eligible") else: print("not eligible")
true
d58c732b40ee2afe49821f8b43555c499ed9d347
m-housh/bootstrap_wrapper_proxies
/extra.py
UTF-8
7,292
3.359375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
""" proxies.extra ~~~~~~~~~~~~~ Holds classes that I want to keep, but don't necessarily belong in this package. """ from functools import partial from collections import namedtuple class NamedTupleHelper: #:TODO: fix the doc strings with name change. """ NamedTupleHelper class is a n...
true
fda0fdd08b59fd1db42ecea0c4f5c5b260e3ee15
ravielze/Tubes_Daspro
/Function/use.py
UTF-8
3,083
3.109375
3
[]
no_license
from Core.User import User,UserManager from Core.Attraction import AttractionManager from Core.Tickets import TicketManager from Core.Inventory import InventoryManager from Utility.Array import panjangArray # Program Pengunaan Tiket # Last Update: 17 April 2020 # Deskripsi: # Program ini berisi prosedur untuk menggun...
true
f3c521e66e02d8ba5d1bdf9a18e13cecac47527b
lobo-death/tccdatascience
/scripts/models/PurchaseRepository.py
UTF-8
463
2.5625
3
[]
no_license
from scripts.models.models import Purchase, Items class PurchaseRepository: @staticmethod def find_by_id(id): return Purchase.get(Purchase.id == id) @staticmethod def create(purchase): return Purchase.insert(purchase).execute() @staticmethod def insert_itens(item): I...
true
e47c18a466b28ade7031952a1f1c62d1ef7ecc16
reside-ic/constellation
/constellation/constellation.py
UTF-8
10,451
2.546875
3
[ "MIT" ]
permissive
import docker import constellation.docker_util as docker_util import constellation.vault as vault from constellation.util import tabulate, rand_str class Constellation: def __init__(self, name, prefix, containers, network, volumes, data=None, vault_config=None): self.data = data ...
true
c2e39362ca58868b0cc04cc4f264a9c61fe89b61
zzzDavid/DPU_Caffe_ToolChain
/power_profiling/plot.py
UTF-8
3,086
2.53125
3
[]
no_license
import csv import matplotlib.pyplot as plt from matplotlib.pyplot import rcParams rcParams['font.family'] = 'serif' rcParams['font.serif'] = ['DejaVu Serif'] names = ['timestamp', 'VCCINT', 'VCCBRAM', 'VCCAUX', 'VCC1V2' 'VCC3V3', 'MGTAVCC', 'MGTAVTT', 'VCCPSINTFP', 'MGTRAVCC' 'MGTRAVTT','VCCO_PSDDR_...
true
a589654d709444c5989beb85b2d6abd1906a08e6
daniel-reich/ubiquitous-fiesta
/Jm4eKTENReSiQFw9t_6.py
UTF-8
86
2.703125
3
[]
no_license
def invert_list(lst): a = []; for elem in lst: a.append(-elem) return a
true
d9bdd42bd3ee63471cfca8e3560b77d57f543036
ZNNNNZ/pratice_code
/code30.py
UTF-8
773
3.453125
3
[]
no_license
''' 输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点 (含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。 ''' #深度遍历方法(DFS),递归思路 class Solution: def TreeDepth(self, pRoot): if pRoot is None: return 0 return max(self.TreeDepth(pRoot.left), self.TreeDepth(pRoot.right)) + 1 #广度遍历方法(BFS) def max_depth(self,root): ...
true
2c447fe22a456f7fe3c08131ccaf806687ef215e
kehuffer/qbb2017-answers
/day2-lunch/day2-exercise2.py
UTF-8
342
2.765625
3
[]
no_license
#!/usr/bin/env python import sys fh = sys.stdin perfect_match = "NM:i:0" numlines = 0 for line in fh: # Don't include any header lines if line.startswith("@"): continue else: if perfect_match in line: numlines+=1 print "There are %s alignments that match perfectly to the geno...
true
c3861c795b34dfff352eb315e3144b815b99578c
phablotassio/exercicios-cursos-python
/aulas/while_pot.py
UTF-8
123
3.3125
3
[]
no_license
num = int (input('Digite um numero Para calcular potencias')) i=0 while i<=10: print('{}'.format(num ** i)) i += 1
true
0d33957655803d02911c7578ba985c361aac391c
lkk654321tw/Twstock
/DownloadStockData.py
UTF-8
3,674
2.828125
3
[]
no_license
#!/usr/bin/env python # -*- conding:utf-8 -*- ########################################### #Time : 2020/7/6 14:39 #Author: Simon Chen #File : DownloadStockData.py ########################################### import requests import pandas as pd import io import datetime import time import os import sqlite3 import glob i...
true
bf80bd76a442a90b449dd73380799ebdfaf79c0a
KenalTheOne/PythonCodeSkulptor
/mini-projects/stopwatch.py
UTF-8
1,613
3.6875
4
[]
no_license
# template for "Stopwatch: The Game" import simplegui # define global variables time = 0 tries = 0 wins = 0 # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def format(t): '''Formats the time''' tenths = t % 10 sec = (t - tenths) // 10 % 60 min =...
true
71701c2b2b993439dd8eb4b0bea6b5e7d1e0b451
ankurjaiswal496/Leetcode-Solutions
/problems-tab/LC453.py
UTF-8
301
3.078125
3
[]
no_license
from typing import Counter class Solution: def minMoves(self, nums): count=0 for i in range(len(nums)-1): nums[i]+=1 nums[i+1]+=1 count+=1 if count==1: print(nums) obj=Solution() obj.minMoves([1,2,3])
true
a7d7ba0f48d8b3e966184930f9fec65f41328b0b
FredHutch/caisis_query_and_de_identify
/de_id_specimen_files.py
UTF-8
1,419
2.6875
3
[ "Apache-2.0" ]
permissive
''' author@esilgard April 2016 replace patient identifiers in specimen tsv files with unique de-identified id ''' import os # directories for input and output files input_file_dir = 'H:\DataExtracts\OncoscapeLungHoughton-4229' output_file_dir = 'H:\DataExtracts\OncoscapeLungHoughton-4229\Output' # first l...
true
495f71bb058066c6eaf5ef1ff234fe374d87b24e
jkjium/contactGroups
/proc_htmlgallery.py
UTF-8
1,566
2.6875
3
[]
no_license
import sys # convert cathpair aligned figures into html table # cath aligned pair file name: p.2dpmA02.1q0sA02.seq.cb2.png # given list format: 2dpmA02 1q0sA02 def main(): if len(sys.argv) < 2: print 'Usage: python proc_htmlgallery.py pairlist.txt' return prefix = ['<html>' , '<head>' , ...
true
68359d3f3a2ec929b6b1df430250b1236785d12e
dpsanders/dumbbell
/Codigo-python/Gram_Schmidt.py
UTF-8
894
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu May 22 15:33:46 2014 @author: rafael """ import numpy as np from numpy import array la = np.linalg def proy(uu, vv): l = len(uu) if uu.any() == 0.: return np.zeros(l) else: coef = 1.*np.dot(uu,vv)/(la.norm(uu)**2) return coef*uu ...
true
2316f24a7e6edd1eef63a81f222661d37eecc12b
dfuent/Scrapers_Sandbox
/BaseballRef_Web_Scraper.py
UTF-8
6,413
3.578125
4
[]
no_license
''' CS 5010: Homework 3: Python and Web Scraper by David Fuentes (dmf4ns) & Dylan Howe (dsh7pd) Data scraped from BaseballReference.com ''' # function to produce Baseball Reference data. Function returns a tuple # of file names -- one for batting and one for pitching data -- to which # the data were written def y...
true
d1f767330e3b3ff5bf5b4ba96213b41b0e53f4c9
asjad99/sandbox
/Python/Language and Alogs /DS and algorithms book code/queue.py
UTF-8
387
3.921875
4
[]
no_license
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.insert(0,item) def pop(self): return self.items.pop(1) def peek(self): return self.items[0] s = Stack() s.p...
true
4f7f96a2df6885a23edb1ab7f71cfd701574435a
luitzenhietkamp/cs50
/pset6/cash/cash.py
UTF-8
393
3.625
4
[]
no_license
from cs50 import get_float # prompt for user input while True: change = 100 * get_float("Change owed: ") if not change < 0: break # calculate quarters... coins = change // 25 change = change % 25 # dimes... coins += change // 10 change = change % 10 # nickles... coins += change // 5 change = change ...
true
ec5a197556b408e8bbdd4fb2c4ed2c212da5ca65
ericdepotter/Gloomhaven-Monster-Recognizer
/YoloV5/list_monster_names.py
UTF-8
313
2.546875
3
[ "MIT" ]
permissive
import os current_dir = os.path.dirname(__file__) images_dir = os.path.join(current_dir, '../Images/Monsters/Prepped') monsters = [] for (dirpath, dirnames, filenames) in os.walk(images_dir): monsters.extend([filename.replace(".png", "") for filename in filenames]) break print(len(monsters), monsters)
true
87a89d749f1522429e9c1613acf656319699cb75
pombredanne/findex-gui
/findex_gui/controllers/findex/auth.py
UTF-8
462
2.53125
3
[ "MIT" ]
permissive
from bottle import auth_basic, request, HTTPError def basic_auth(): def check(user, password): if user == 'admin' and password == 'admin': return True def err(): err = HTTPError(401, "Access denied") err.add_header('WWW-Authenticate', 'Basic realm="%s"' % "admin area") ...
true
19ea9dbea6ffbddd9407456a3378ae7b39a64397
newtonis/22.05-Signals-and-Systems-Analysis-Projects
/TP1/simulacion_ej5/IndividualTests/espectros.py
UTF-8
1,403
2.71875
3
[]
no_license
import csv import matplotlib.pyplot as plt from ExpressPlot import ExpressPlot from util_python import Senial from Utils import FourierTransform from Etapas import SignalsReadWrite import math def spectra_plot(medcsv, simxml, out, fmax=None): fmed = [] pmed = [] with open(medcsv, 'rt') as csvfile: reader = list...
true
cd1cc5e571739e3d5effbae85a6396552954e7b2
netsystemsaustralia/ds_helper
/post_production_monitoring.py
UTF-8
2,029
3.03125
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from IPython.display import display, Markdown import ipywidgets as widgets import scipy import scipy.stats def get_drift_stats(original, current): p = scipy.stats.kstest(original, current)[1] p = np.around(p, 5) ...
true
540d9a0e1584ae1a1975a6f5ef148f72c2b8f5d4
GSindhuReddy/Python
/ParseFileToList.py
UTF-8
413
3.328125
3
[]
no_license
class ParseFileToList: def __init__(self, filename): self.filename = filename def parse_file(self, filename=None): if filename is None: filename = self.filename cities_list = [] with open(filename) as f: line = f.readlines() for i in range(le...
true
85d6de9f5e1e48c2e55e7ab65106e5a7a8d300ae
efc-robot/optitrack_ros_multiagent-sys
/catkin_ws/src/vrpn_keyboard_control/scripts/vrpn_pose.py
UTF-8
2,432
2.53125
3
[]
no_license
#!/usr/bin/env python import rospy import math from geometry_msgs.msg import PoseStamped from vrpn_keyboard_control.msg import poses import PyKDL as kdl import threading agent_num = 4 def callback(msg, car_index): global rigidbody_poses seq = msg.header.seq x = msg.pose.position.x y = msg.pose.positi...
true
6ad4b00a25d974d013408f720258c130aa3d7e5f
TheZ3ro/rockyrainbow
/rockyrainbow/rockyrainbow.py
UTF-8
2,124
3.359375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from queue import Queue from threading import Thread, Lock import hashlib # Numbers of concurrent threads THREADS = 10 table = [] class HashConsumer(Thread): def __init__(self, queue): Thread.__init__(self) self.queue = queue self.lock = Loc...
true
160d3e3817781c8a39c4f7fdfcaa3bd6cafc3cc5
nathanlmeyers/contextual_model
/ops/stimuli.py
UTF-8
4,174
2.59375
3
[]
no_license
#!/usr/bin/env python import numpy as np import scipy as sp from model_utils import mul, ifloor, iceil, iround DEFAULT_FDOMAIN = (0., 1.) DEFAULT_SVAL = .375#214 DEFAULT_CVAL = .625#271 DEFAULT_CVAL2 = .375#214 DEFAULT_CONCENTRIC_VALUES = sp.linspace(0.375, 0.625, 6) #------------------------------------------------...
true
ffdb065d226e07d770bcdf60d1233aaa05b4c0f9
courtneyhasenstab/Checkmate
/main.py
UTF-8
46
2.78125
3
[ "MIT" ]
permissive
mystring = "abcdefghij" print(mystring[0:3])
true
ab460763b5a7215ee751518be9fb61e09bf55c46
stringie/machine-learning
/reinforcement-learning/MC.py
UTF-8
2,116
2.75
3
[]
no_license
get_ipython().magic(u'matplotlib inline') import gym import matplotlib import numpy as np import sys from collections import defaultdict if "../" not in sys.path: sys.path.append("../") from BlackjackEnv import BlackjackEnv from cliffwalking import CliffWalkingEnv from windyGrid import WindyGridworldEnv import pl...
true
44cfb5205c611c13b6863ca1a73b6db4077fb967
rajeevj0909/FunFiles
/IDEs Code Example.py
UTF-8
2,635
4.3125
4
[]
no_license
#This sets the input_valid to false so that the iteration can begin input_valid = False #Position is set to 1, in the list this is the second value, this value and every two onward must be doubled position = 1 #Total must be initially defined total = 0 #This ensures that the system keeps asking for an input unt...
true
3bff409046dd50cbea93bac5fb23d343930b702f
yapdianang/drug_bandits
/model/mab.py
UTF-8
719
2.875
3
[]
no_license
class MultiArmedBandit(object): def __init__(self, nb_input_features, nb_arms=3): self.nb_input_features = nb_input_features self.nb_arms = nb_arms def extract_features(self, df_row): """ Placeholder for extract_features """ pass def estimate_dosage(self, features)...
true
2cd4112177d01f57e3fd469ad63907fb2e42e5b6
andreidan/cr8
/cr8/metrics.py
UTF-8
3,620
3.390625
3
[ "MIT" ]
permissive
import statistics import random import math DEFAULT_NUM_SAMPLES = 1000 def percentile(sorted_values, p): """Calculate the percentile using the nearest rank method. >>> percentile([15, 20, 35, 40, 50], 50) 35 >>> percentile([15, 20, 35, 40, 50], 40) 20 >>> percentile([], 90) Traceback ...
true
fde0cc0b09a27fd474cfd4b52ed0cfab0418e944
Aasthaengg/IBMdataset
/Python_codes/p03288/s434803663.py
UTF-8
64
2.796875
3
[]
no_license
r=int(input()) print("ABC" if r<1200 else ("AGC","ARC")[r<2800])
true
b28199bc5344ff507a6300a447a03a34cc690fc6
ivanplex/dinosaur
/receiver.py
UTF-8
1,710
2.625
3
[]
no_license
from threading import Thread from queue import Queue from network.multicastClient import MulticastClient from audio.audioHandler import AudioHandler from fec.fecHandler import FECHandler def listen(): frameQueue = Queue() frameblock = [] frameblockStartTime = None # Start processing frames when the...
true
db35d0bbb1308de31663a2cdf00b5a9ed69bbc79
yashchitre03/Logistic-Regression-Email-Classification
/logreg_A.py
UTF-8
3,627
3.109375
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt from numpy import genfromtxt def predict(X, w): n_ts = X.shape[0] # use w for prediction pred = np.zeros(n_ts) # initialize prediction vector for i in range(n_ts): # TODO pred[i] = 1 if (np.dot(w.T, X[i]) > 0) else 0 # computes...
true
e1faf8dc532294053cf4e3d1ed0d6f17e7ce5616
SaretMagnoslove/Python_3_Basics_Tutorial_Series-Sentdex
/Lesson52_exec.py
UTF-8
516
4.375
4
[]
no_license
# exec compiles and evalute whatever you pass to it in string form # example 1: like eval exec("print('so it works like eval')") # example 2: exectuting an assertion list_string = "[1,2,3,4,5]" list_num = exec(list_string) # returns None # to actually return the list exec("list_string2 = '[1,2,3,4,5]'") print(list_stri...
true
ac477945676d9f0e2c238fbeec5f0476065e0026
sflanker/PyProcessingJezzball
/Jezzball.pyde
UTF-8
8,972
3.671875
4
[]
no_license
import math class Dimension: def __init__(self, width, height): self.width = int(width) self.height = int(height) class Direction: def __init__(self, value): self.value = value def __eq__(self, other): """Overrides the default implementation""" if isinstan...
true
d581ac56eda8aab37e36c16ec2fb17915a27b378
thejaredchapman/JMC_Python
/Fibonnaci.py
UTF-8
374
3.9375
4
[]
no_license
#This program calculates the Fibonacci sequence a = 0 b = 5 count = 0 max_count = 15 while count < max_count: count = count + 1 #we need to keep track of a since we change it old_a = a old_b = b a = old_b b = old_a + old_b #Notice that the , at the end of a print statement keeps ...
true
8a85c1392983216143fe3966f86f02e999468d5b
gretaivan/multivariate-timeSeries-forecating-nn-python
/redundant/etl.py
UTF-8
7,149
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: Greta Ivanauskaite ETL - Export, Transform, Load Simulating ETL program to provide the univariate and multivariate data """ import numpy as np # linear algebra import pandas as pd # data processing from csv import matplotlib.pyplot as plt import seaborn as sns import os #package...
true
5573500db4279afc5527142f1bdd1b59423425c4
soy-sauce/cs1134
/lab5/q5.py
UTF-8
430
2.84375
3
[]
no_license
import os def disk_usage(path): total=os.path.getsize(path) if os.path>os.isdir(path): for filename in os.listdir(path): childpath=os.path.join(path,filename) total+=disk_usage(childpath) print('{0:<7)'.format(total),path) return total #analysis/recursive t...
true
83557e5fa7cc1e6bc9eaeb1358cda933f749ab21
UtgardaLokki/2GIS_simple_parser_py
/main.py
UTF-8
2,320
3.109375
3
[]
no_license
# Parser of 2GIS that takes list of addresses and converts it to geo coordinates from selenium import webdriver import pandas as pd from time import sleep import constant # Setting Chrome webdriver chrome_driver = constant.chrome_driver_path option = webdriver.ChromeOptions() option.add_argument(constant.ch...
true
eec334338ea033ec978ec8c35fe8d0cd25e3880a
KarlCF/python-challenge
/03-python/function_range.py
UTF-8
439
4
4
[]
no_license
# numeros = range (10) numeros = range(1,200) print (numeros) print (type(numeros)) print (list(numeros)) numeros_impar = [] numeros_par = [] print ('') print ('---') print ('') for numero in numeros: print (f'O valor atual é: {numero}') if numero % 2 == 0: numeros_par.append(numero) else: ...
true
03017caea9415aa5e2d6082aa22d5b56d06a26b4
VakinduPhilliam/Python_Weakref_Caching
/Python_Weakref_Finalizer_Unregister.py
MacCentralEurope
1,360
3.34375
3
[]
no_license
# Python Weakref # weakref Weak references. # The weakref module allows the Python programmer to create weak references to objects. # # In the following, the term referent means the object which is referred to by a weak reference. # A weak reference to an object is not enough to keep the object alive: when the o...
true
1842dee27205786db110ea6c883d9910a399aa54
dillionverma/intern-salaries
/src/scraper.py
UTF-8
2,717
2.640625
3
[]
no_license
import os import praw import re import json import sys CLIENT_ID = os.getenv('PRAW_CLIENT_ID') CLIENT_SECRET = os.getenv('PRAW_CLIENT_SECRET') USERNAME = os.getenv('PRAW_USERNAME') PASSWORD = os.getenv('PRAW_PASSWORD') USER_AGENT = "Intern Salary Scraper https://github.com/dillionverma/intern-salaries...
true
c4461e1a59c9ae8d0c00c60166055837c04f726b
htlcnn/pe_solutions
/52.py
UTF-8
340
2.65625
3
[]
no_license
#!/usr/bin/env python3 from itertools import permutations def solve(): x = 125874 while True: p_x = {''.join(i) for i in permutations(str(x))} sets = {True if str(i*x) in p_x else False for i in range(2, 7)} if False not in sets: return x x += 1 if __name__ == '__m...
true
5d5b76cec49e5344214bf5580af23e233ee7dcad
lipusal/ss
/python/ss/final/ksss_model.py
UTF-8
6,445
2.703125
3
[]
no_license
#TODO change descript from ss.final.car import Car import random from euclid3 import Vector2 import ss.util.args as arg_base from ss.util.file_writer import FileWriter # https://es.wikipedia.org/wiki/Modelo_Knospe,_Santen,_Schadschneider,_Schreckenberg arg_base.parser.description = "FINAL" arg_base.parser.add_argume...
true
91c3eb83c11f9afc5f3cac73a85d90b427b26ff6
Evans88/metallum_scraper
/metallum_scraper/orm/Song.py
UTF-8
693
2.890625
3
[ "MIT" ]
permissive
from sqlalchemy import Column, NVARCHAR from metallum_scraper.orm.Base import base Base = base class Song(Base): def __init__(self, song_id, name, album_id, length): self.song_id = song_id self.name = name self.album_id = album_id self.length = length __tablename__ = 'song' ...
true
f62ca87cc0f0f1b8d7137570b92dae53dc78ab6b
RawitSHIE/Algorithms-Training-Python
/python/Producer-san.py
UTF-8
671
3.421875
3
[]
no_license
"""doc str""" def main(): """doc str""" name = input() age = int(input()) sle = input() if len(name)*1.5 > 9: names = 10 else: names = len(name)*1.5 if (30 - age)*0.5 >= 10: ages = 10 elif age > 30: ages = 0 else: ages = (30 - age)*0.5 if s...
true
d96347873e9e35694bfbbc5d8c3adf35d0c11a59
dg5921096/Books-solutions
/Python-For-Everyone-Horstmann/Chapter9-Objects-and-Classes/P9_25.py
UTF-8
794
4.03125
4
[]
no_license
# Design a class Mailbox that stores e-mail messages, using the Message class of Exercise # P9.24. Implement the following methods: # • def addMessage(self, message) # • def getMessage(self, index) # • def removeMessage(self, index) class Mailbox(): def __init__(self): self._mails = [] def l...
true
36e0bb114c05f943d3c65e1a7f49bf0c8bc29080
xieyalong/python_tronado_web
/其他/test.py
UTF-8
252
3.515625
4
[]
no_license
import datetime date=datetime.datetime(1992, 12, 1, 0, 0) #返回字符串 _str=date.strftime('%Y-%m-%d') #输出 1992-12-01 print(_str) print(type(_str)) # str='datetime.datetime(1992, 12, 1, 0, 0)' # str=str[str.index('('),str.la(')')] # print(str)
true