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
c9db69ad0a4cb879cd66e21433fd2b7b8443ce3c
Hamiltonxx/pyalgorithms
/codeforces/800/271A.py
UTF-8
130
3
3
[]
no_license
year = input() y = int(year) while True: y += 1 st = set(list(str(y))) if len(st)==4: print(y) break
true
848638afa4151fc3009c5180af65304486d6d6f1
grm34/PyZenMaxBuilder
/modules/manager/json.py
UTF-8
2,711
2.5625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ ZenMaxBuilder Copyright © 2021 darkmaster@grm34 https://github.com/grm34 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/l...
true
b3acf26171fa1a74884b774a2a54e46216f69f5d
ddsuhaimi/numerical_methods
/trapezoidal_rule.py
UTF-8
408
3.71875
4
[]
no_license
import numpy import math def f(x): return math.exp(x) * math.cos(x/2) def trapezoidal(a, b, n): h = (b-a) / n # making evenly spaced data points with step = h x = numpy.arange(a, b, h).tolist() # add last point to x, the (n+1)th point, which is b x.append(b) return (h/2) * sum(f(x[i])...
true
7f60291d3b3c88ebda9ea4a32e2f180dfc9ae5dd
papachristoumarios/financial-contagion
/eba_dataloader.py
UTF-8
5,942
2.78125
3
[]
no_license
import networkx as nx import numpy as np import seaborn as sns import scipy.stats import matplotlib.pyplot as plt import pandas as pd import warnings warnings.filterwarnings("ignore") sns.set_theme() def expon_fit_helper(data): params = scipy.stats.expon.fit(data) return 'Exp Fit: scale = {}, loc = {}'.forma...
true
9cb44e6590a093dcd2a0f245b6a8f34a28c0a26d
Patrick5455/jetbrains-python-academy
/Numeric-Matrix-Processor/processor.py
UTF-8
9,263
3.765625
4
[ "MIT" ]
permissive
exit_flg = False user_choice = None def print_menu_get_option(): print("""1. Add matrices 2. Multiply matrix by a constant 3. Multiply matrices 4. Transpose matrix 5. Calculate a determinant 6. Inverse matrix 0. Exit""") return int(input("Your choice: ")) def get_matrix_float(rows, cols): matrix_float =...
true
a915210e036f1f1726212bd031fcb1727f2d848c
harshpreet93/projecteulersolutions
/p10.py
UTF-8
657
3.65625
4
[]
no_license
import time #The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. #Find the sum of all the primes below two million. #sieve function returns a list of all primes from 2 to the upperbound. The list #also contains empty indexes, they can be ignored def sieve(upperbound): plist=[] for i in range(0,upperbound+1):plist....
true
395c94d800466e07b55845c60a6f9016809a874b
yeigit/compublandas-2019-02
/proyecto chatbot/bot.py
UTF-8
7,955
3.390625
3
[]
no_license
from chatterbot import ChatBot #Librería para el Bot from chatterbot.trainers import ChatterBotCorpusTrainer #Librería entrenar al bot con conversaciones prediseñadas from chatterbot.trainers import ListTrainer #Librería para entrenar al Bot con distintos entrenadores o trainers import pyttsx3 #Librería para convert...
true
2de297cc6782da7322435bcc12b0f03e122c5890
Lusimba/Time-module-softwares
/hello.py
UTF-8
60
3.609375
4
[]
no_license
name = "Michael" name = "George" print(f"My name is {name}")
true
4f0b4fec2f32911f374de25f4850206ff02154e9
codedjw/DataAnalysis
/QYW_5th_Analysis/qyw_5th_XESConverterHelp.py
UTF-8
2,228
2.59375
3
[]
no_license
#!/usr/bin/env python # coding:utf-8 import pandas as pd, numpy as np, matplotlib.pylab as plt # 数据库访问 import MySQLdb, datetime # Open database connection conn = MySQLdb.connect(host='localhost',user='root',passwd='',db='qyw', charset='utf8') try: user_visits = pd.read_sql(''' SELECT USER_ID, OPERATE_TIME, P...
true
f37d71f4340522884afbb838532e7314d85bbeb8
parastuffs/esnu
/h473_analysis/analysis.py
UTF-8
1,227
2.890625
3
[]
no_license
#!/usr/bin/env python3 import matplotlib.pyplot as plt import csv # plt.boxplot years = ["2017-2018","2018-2019", "2019-2020"] allData = list() for year in years: risc = list() tis = list() simd = list() total = list() with open("{}.csv".format(year), 'r') as f: reader = csv.reader(f) next(reader) for r...
true
f6ff9f7c6f3fda29477bc25c6ef09f8d1ef24ecf
Sitryk/aikaterna-cogs
/snacktime/phrases.py
UTF-8
5,861
2.75
3
[ "MIT", "Apache-2.0" ]
permissive
FRIENDS = { "Snackburr": "ʕ •ᴥ•ʔ <", "Pancakes": "₍⸍⸌̣ʷ̣̫⸍̣⸌₎ <", "Mr Pickles": "(=`ェ´=) <", "Satin": "▼・ᴥ・▼ <", "Thunky": "ᘛ⁐̤ᕐᐷ <", "Jingle": "꒰∗'꒳'꒱ <", "FluffButt": r"/ᐠ。ꞈ。ᐟ\ <", "Staplefoot": "( ̄(エ) ̄) <", } SNACKBURR_PHRASES = { "SNACKTIME": [ "It's snack time!", ...
true
0360ec2d965cb7d920c484a3f406101bc7d33ba0
chrisxue815/leetcode_python
/problems/test_0507.py
UTF-8
758
3.59375
4
[ "Unlicense" ]
permissive
import unittest import math class Solution: def checkPerfectNumber(self, num): """ :type num: int :rtype: bool """ if num <= 1: return False sum_ = 1 sqrt = int(math.sqrt(num)) for divisor in range(2, sqrt + 1): if not num %...
true
7b77bc49c356778eddff57598b23036f585b411b
A01374496/Tarea-04
/venta de software.py
UTF-8
876
3.96875
4
[]
no_license
# encoding UTF-8 # Autor: Andrea Montero Rivas, A01374496 # Descripcion: Convierte numero decimal a romano. def calcularDescuento(precio, cantidad): if cantidad >= 10 and cantidad<= 19: precioConDescuento = precio - precio * 0.20 return precioConDescuento if cantidad >= 20 and cantidad<= 49: ...
true
c5d6fc68ad6400578d8131dd523e7f994a77933a
Harshacse/Competitive-Coding
/HACKERRANK/code_n_counter/2.py
UTF-8
567
3.03125
3
[]
no_license
def print_all(string,sort_string,result): if string == "": print result return i=0 j=-1 print_all(string[j+1:],sort_string,result) while i<len(sort_string): j = string.find(sort_string[i]) if j!=-1: result += sort_string[i] print_all(string[j+1:],sort_string,result) i+=1 def main(): t = int(in...
true
0d9fe9ecd6032e1606fafd4254f9d58688c15f30
ketzu/klang-api
/vocabulary/models.py
UTF-8
1,264
2.640625
3
[ "MIT" ]
permissive
from datetime import datetime, timezone from django.db import models # Create your models here. from users.models import User class Vocable(models.Model): vocab = models.CharField(max_length=200) translation = models.CharField(max_length=200) def __str__(self): return f"{self.vocab} ({self.tran...
true
1d778b926d2438bdaca981e05d0702ebe9dcbf9f
frrad/leetweek
/1784.check-if-binary-string-has-at-most-one-segment-of-ones.py
UTF-8
606
3.265625
3
[]
no_license
class Solution: def checkOnesSegment(self, s: str) -> bool: reading = False read = 0 for c in s: if c == "1" and reading: continue if c == "1" and not reading: reading = True read +=1 if c == "0" and readi...
true
d2ca2f41c5a34c367b56e52e4d5f64791f191c56
jaggernaut007/Q-learning-tic-tac-toe
/start_learning.py
UTF-8
539
3.09375
3
[]
no_license
#!/usr/bin/env python2 from bot import Bot from board import Board def run_test(): board = Board() bot1 = Bot(1, board) bot2 = Bot(2, board) while not board.get_winner(): print board if not board.can_be_played(): break bot1.act() print board if not board.can_be_played(): break bot2.act() prin...
true
0aa6c66d88d265e24026aec2053a9859d05a9c80
OliverMD/TPOP
/practical3/tasks.py
UTF-8
3,195
3.6875
4
[]
no_license
TEXT = "Tpm owwl vmea ijwcb kwuxcbmza qa bpib bpmg lw epib gwc bmtt bpmu bw lw. Tpm jil vmea qa bpib bpmg lw epib gwc bmtt bpmu bw lw." def palindrome_test(phrase): # palindromeTest(phrase String) -> Bool # Returns True if the phrase entered is a # palindrome, otherwise returns False. chars = []...
true
59c24f1ef8b7d232facbd84cde554d1ba0f1936e
myPyQuest/100
/35_countVowels.py
UTF-8
334
3.921875
4
[]
no_license
s = input("give me a string of yours > ") # [ 'a', 'e', 'o', 'i', 'u'] a = s.count('a') e = s.count('e') o = s.count('o') i = s.count('i') u = s.count('u') print("Here're " + str(a + e + o + i + u) + " vowels.") print("a is " + str(a)) print("e is " + str(e)) print("o is " + str(o)) print("i is " + str(i)) print("u ...
true
77cd0d53b034fbdfcfed339401a1c9d4ce713760
saurabhbatra96/wmf-samplecodes
/gb-tuning.py
UTF-8
1,400
2.546875
3
[]
no_license
from extractor import Extractor from sklearn.model_selection import GridSearchCV from sklearn.model_selection import RandomizedSearchCV from sklearn.ensemble import GradientBoostingClassifier import numpy as np basedata = Extractor.loaddata('data-2-0.5') # Split the data into test/train X = basedata[:, :-1] y = based...
true
3ec7ea9c5ef94ec8890df328eb50e51cfce3f2dc
guillaume-havard/cubes_in_cube
/data.py
UTF-8
1,573
3.34375
3
[]
no_license
import copy class Position: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def __repr__(self): return "({0},{1},{2})".format(self.x, self.y, self.z) class FormT: """ tab of 4 Positions """ def __init__(self, coordinates): self.coord...
true
a28c24567eadc699145129d2d6039e3bbdd6114f
RoPet5990/RoPet
/mysite/dogsearch.py
UTF-8
1,417
3.078125
3
[]
no_license
import time from rssi import * from search import * from camera_control import * def dogsearch(): state = "ready" prev_rssi = 0 rssi = 0 is_found = False while True: # get origin rssi print "=========== CURRENT STATE: %s===========" %(state) prev_rssi = rssi if s...
true
e0627bb4e8f205efeeeca4852232b97dd58e8680
Nan-Do/DailyCoding
/Daily_38.py
UTF-8
595
3.53125
4
[]
no_license
def is_valid(sol, N): x, y = sol[-1] positions = set(sol[:-1]) for r in xrange(N+1): # check row if (x, y-r) in positions: return False # check diagonals if (x - r, y - r) in positions: return False if (x + r, y - r) in positions: ...
true
eb5ebfa7cf5adb15add73478b2984de74725a53f
ferygood/full-stack-bootcamp
/assignment_w2/hw2.py
UTF-8
386
4.15625
4
[]
no_license
def avg(data): sum = 0 for n in range(data["count"]): sum += data["employee"][n]["salary"] avg_salary = round(sum/(data["count"])) #四捨五入至整數 return avg_salary data = {"count":3, "employee":[ {"name":"John", "salary":30000}, {"name":"Bob", "salary":60000}, {"name":"Jenny", "salary...
true
3f2bee332480737a7a30401aac9af047547f6535
forgoodsj/djangoshiyanlou
/shiyanlou/blog/views.py
UTF-8
503
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.views.decorators.cache import cache_page # Create your views here. @cache_page(60 * 15) def my_view(request): queryset=[1,2,3,4,5] return render(request, 'index.html', {'queryset':queryset}) ''' c...
true
27c612049c8ea154361481c55f67de67ef91494a
yibei8811/algorithm
/leetcode/1052/solution.py
UTF-8
902
3.03125
3
[]
no_license
from typing import List class Solution: def maxSatisfied(self, customers: List[int], grumpy: List[int], X: int) -> int: n = len(customers) p = 0 q = X ans = 0 now = 0 for i in range(p, q): if grumpy[i] == 1: now += customers[i] an...
true
6fad01f20e69da1b86bede6681cf0fd730f18663
ymaktepi/imageproc
/Field.py
UTF-8
394
2.96875
3
[]
no_license
from copy import deepcopy class Field: def __init__(self, name, listSeasons): """ :param name: Name of the field :param listSeasons: list of seasons """ self._name = name self._listSeasons = [season for season in listSeasons] self._result = None def __repr__(self): return self._name def computeR...
true
d085e8e8276bc9b1905424af280e7d1d7e451156
m5tt/saved-parser
/catagories-stub.py
UTF-8
208
2.515625
3
[]
no_license
#!/bin/python import pickle CATAGORIES_FILE = 'catagories.pickle' catagories = { 'cat1': [] } with open(CATAGORIES_FILE, 'wb') as fh: pickle.dump(catagories, fh, protocol=pickle.HIGHEST_PROTOCOL)
true
40758c69a291a62449e9b64dfa35963a03eeb94f
uk-gov-mirror/moj-analytical-services.dataengineeringutils
/dataengineeringutils/s3.py
UTF-8
4,310
2.734375
3
[ "MIT" ]
permissive
import pandas as pd import io import boto3 import re import os from dataengineeringutils.utils import _end_with_slash s3_resource = boto3.resource('s3') s3_client = boto3.client('s3') def s3_path_to_bucket_key(path): path = path.replace("s3://", "") bucket, key = path.split('/', 1) return bucket, key de...
true
b8a810b7405cc9492cd80dfa3c9185ea3fbe85e0
antortjim/2ptc-analysis
/ex3.py
UTF-8
4,902
3.265625
3
[]
no_license
# Taken (and slightly modified) from # http://stackoverflow.com/questions/11685716/how-to-extract-chains-from-a-pdb-file # All credit to user David Cain from modules import PDB from modules import os class ChainSplitter: # The object will be initialized with 2 methods inherited from PDB module # self.parser ...
true
5ad50d98bb58f9473ec4ea24f18dfe1474815f3b
trinhtuanvubk/ASR-based-KWS
/util/CTCforward.py
UTF-8
1,714
2.53125
3
[ "MIT" ]
permissive
import numpy as np # create CTC forward fucntion def CTCforward(learned_phoneme, matrix): # matrix of inference file (probs version ,not log version ) vocabs = [' ', 'UW1', 'AW1', 'F', 'UW2', 'AO0', 'EY1', 'V',\ 'ER0', 'NG', 'AY1', 'P', 'UH1', 'EH0', 'ER2', 'sil', 'DH',\ 'S', 'EH2', 'IH2', 'AA1', '...
true
26b32b33bbebb341695a85e8c51554f5ad573d6f
tba109/tmc_cal
/tmc_gain_corr.py
UTF-8
6,980
2.765625
3
[]
no_license
import matplotlib.pyplot as plt import matplotlib.dates as md import numpy as np import time import datetime import sys from scipy.optimize import curve_fit import meas_interp def f_line(x,A,B): return A*x+B # Return datasets cut so that x1 and x2 correspond to x1 values within +/-n*sigma of the mean of x1 def cu...
true
2aab18f7dd89c8190e6f1de838eeacd4fa1d36a3
ZiyiJiangStats/LeetCodeProblems
/973_KClosestPointsToOrigin_quickselect.py
UTF-8
964
3.40625
3
[]
no_license
class Solution: def kClosest(self, points, K): #we want to partially sort the list of points by the distance. We only want the K closest points self.sort(points, 0, len(points)-1, K) #return the closest k points return points[:K] #sort l to r points def sort(self, poi...
true
7bd1fd944769a73087f6b1d2621a31c89fc89a98
Armand-Morin/Emotions_Detection_on_videos
/affichage_resultats_categorie_pdf.py
UTF-8
3,262
2.9375
3
[ "MIT" ]
permissive
import os import cv2 from reportlab.pdfgen import canvas dictEmo = {'happy': 44.31, 'surprised': 0, 'sad': 42.7, 'neutral': 11.84, 'angry': 1.15 } theme = 'joyeux,comique' # Pour changer la taille d'une image (dim est de la forme dim=(largeur,hauteu...
true
9722916694cb1af09a4fbeb05d4a52126b428f23
Bondzio/ami-ia-chub
/fhir_server/src/utils/utils.py
UTF-8
378
2.546875
3
[]
no_license
from datetime import datetime def date_to_datetime(date): return datetime.combine(date, datetime.min.time()) def patient_num_to_ref(patient_num): return "Patient/{}".format(patient_num) def encounter_num_to_ref(encounter_num): return "Encounter/{}".format(encounter_num) def instance_num_to_ref(insta...
true
82446ae06c1fd917222912f62850475390e64b6a
ruspython/server
/main.py
UTF-8
2,745
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import socket from socket import error as SocketError import json import pymysql import time import threading import socketserver HOST = '178.62.237.133' MAIN_PORT = 6666 class MyTCPHandler(socketserver.BaseRequestHandler): def handle(self): self.data = self...
true
64c196fc7bf1d42c4863d90a161b2472c1609e8a
ujjavalkag/pythonassignment
/module4/diform_2dlist.py
UTF-8
135
3.578125
4
[]
no_license
list1=[[1,2,3],[4,5,6],[7,8,9]] list2=[] for x in list1: for y in range(len(x)): list2.append(x[y]) print(list2)
true
97e5824998ababe397e970906846968c82664b1f
Aravs7/bdgtmgr
/transaction.py
UTF-8
450
2.921875
3
[]
no_license
__author__ = 'Aravind Singirikonda' class Transaction(): amount = 0.00 tags = list() tranctype = "" def __init__(self, amount, tags, tranctype): self.amount = amount self.tags = tags self.tranctype = tranctype self.save_to_file() def save_to_file(self): f...
true
b51b280b9d5f077b753814fb657a94928cd1d616
makcuk/piraine
/timetable.py
UTF-8
2,139
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- import datetime import json import RPi.GPIO as GPIO class CronEntry: def __init__(self, zone, start_time, duration = 30): self.zone = zone self.start_time = start_time self.duration = duration def __repr__(self): return "%s start time: %s duration: %d" ...
true
7b8787c4522c7dd86d41f6f983ffd445606165a0
yordanov9/Advanced
/Sets_of_elements_ex.py
UTF-8
204
3.03125
3
[]
no_license
n, m = input().split() n, m = int(n), int(m) n_set = set() m_set = set() for i in range(n): n_set.add(input()) for j in range(m): m_set.add(input()) print('\n'.join(n_set.intersection(m_set)))
true
8fc38a26f041aedfb95e8c75fa430abcc43bed00
oneozerova/tomobox
/cube.py
UTF-8
2,972
2.921875
3
[]
no_license
import math import random from pygame.locals import * import pygame from OpenGL.GL import * from OpenGL.GLU import * verticies = ( (1, -1, -1), (1, 1, -1), (-1, 1, -1), (-1, -1, -1), (1, -1, 1), (1, 1, 1), (-1, -1, 1), (-1, 1, 1) ) main_verticies = ( (4, -4, -4), (4, 4, -4), ...
true
75df30d3d452e4c62426523146df2921d88bbb2c
sfrebel/recamansvg
/recaman.py
UTF-8
331
3.125
3
[ "MIT" ]
permissive
def calculate_racaman(stepps): placestaken = [] hopdistance = 0 i = 0 while (hopdistance < stepps): placestaken.append(i) hopdistance += 1 nexti = i - hopdistance if ((nexti < 0) or (nexti in placestaken)): nexti = i + hopdistance i = nexti return ...
true
6ca05a4c22c06dd56a9c38fa432c780daa03d612
ppyy16/6161Final
/program.py
UTF-8
1,031
2.890625
3
[]
no_license
from seam_carving import SeamCarving from voronoi import nrandompixels import imghdr import sys from pprint import pprint import inquirer from main import mainer from PIL import Image print("Welcome to photo mini-market") image = raw_input("What image would you like to manipulate? \n") isimage = imghd...
true
de2e1b3b361f1ded8ab27579efaed767f98d07d0
Nikkuniku/AtcoderProgramming
/AGC/AGC014/b.py
UTF-8
366
2.984375
3
[]
no_license
n, m = map(int, input().split()) edges = [0]*(n+2) for _ in range(m): a, b = map(int, input().split()) a, b = a-1, b-1 if a > b: a, b = b, a edges[a] += 1 edges[b] -= 1 for i in range(1, len(edges)): edges[i] += edges[i-1] ans = 'YES' for j in range(len(edges)): if edges[j] % 2 != 0...
true
a2ed0dc42307683d87b065267764b3808c181352
kutyrov/practice2021
/server.py
UTF-8
4,589
2.734375
3
[]
no_license
import asyncio import pymysql.cursors from base64 import b64encode def process_data(reqv, people): # обрабатываем запрос # print(reqv) resp = 'error\n\n' try: command, args, _ = reqv.split('\n', 2) except ValueError: return resp args = args.split(' ') if command == 'check' and...
true
00373e1bd3309ab6651be3f779115e93a4b6bc02
lonamiaec/sqjobs
/sqjobs/connectors/base.py
UTF-8
1,919
3.125
3
[ "BSD-3-Clause" ]
permissive
from abc import ABCMeta, abstractmethod from six import add_metaclass @add_metaclass(ABCMeta) class Connector(object): """ Manages a single connection to the broker """ @abstractmethod def get_queue(self, name): """ Gets a queue given it name :param name: the name of the ...
true
0a37565011b416c9701cc1f371585c3906bf1f56
nksubramanian/SnakesAndLadders
/venv/Test_SnakeAndLadder.py
UTF-8
1,760
2.8125
3
[]
no_license
import SnakeAndLadder def test_position(): test1 = SnakeAndLadder.SnakeAndLadder() assert test1.position==1 assert test1.money_available==500 def test_movecheck(): test1 = SnakeAndLadder.SnakeAndLadder() test1.play_onemove(1) assert test1.position==2 test1.play_onemove(2) assert t...
true
358c51133db0d597e05ff95a2455b88486569894
grtkachenko/MachineLearning
/KNN/knn_classifier.py
UTF-8
756
2.984375
3
[]
no_license
from common.metrics import * class KnnClassifier: def __init__(self, k, metrics=euclidean): self.k = k self.metrics = metrics def learn(self, train_data): self.train_data = train_data def get_class(self, test_point): self.train_data.sort(key=lambda point: self.metrics(poi...
true
edc066be74f979bed632c1ed434874cdff069ae3
bpetit/environmental-footprint-data
/tools/spiders/lib/spider.py
UTF-8
918
2.640625
3
[]
no_license
import csv import logging from typing import Any, Optional import scrapy class BoaViztaSpider(scrapy.Spider): """A base scrapy spider to factorize code from our multiple spiders.""" def __init__(self, existing: Optional[str] = None, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwarg...
true
d5973c4ce24af3a1b0ab2cf20a339372e91b0f35
CodePanter/uweb3
/uweb3/pagemaker/new_login.py
UTF-8
4,604
2.921875
3
[ "ISC" ]
permissive
import hashlib import bcrypt from .. import model class UserCookieInvalidError(Exception): """Superclass for errors returned by the user class.""" class Test(model.SettingsManager): """ """ class UserCookie(model.SecureCookie): """ """ class Users(model.Record): """ """ salt = "SomeSaltyBoi" cookie_...
true
43abc55a3767e62c41af3f196077e5c605e219ac
cp4011/Machine-Learning
/05_Logistic回归/EXTRAS/sigmoidPlot.py
UTF-8
271
2.84375
3
[]
no_license
from pylab import * t = arange(-60.0, 60.3, 0.1) s = 1/(1 + exp(-t)) ax = subplot(211) ax.plot(t, s) ax.axis([-5, 5, 0, 1]) plt.xlabel('x') plt.ylabel('Sigmoid(x)') ax = subplot(212) ax.plot(t, s) ax.axis([-60, 60, 0, 1]) plt.xlabel('x') plt.ylabel('Sigmoid(x)') show()
true
9cbaa14565f1212b35ef868bf6afb61a45a6beb9
zhijiemo/financial_analysis_for_listed_companies
/views.py
UTF-8
43,312
3.015625
3
[]
no_license
import os import time, datetime import re import pandas import requests import pymysql from bs4 import BeautifulSoup from lxml import etree from decimal import Decimal, getcontext # 设置货币的有效数字 getcontext().prec = 22 def get_financial_statement(statement_type_code, com_code): """从163股票网站下载特定单位的财务报表,同时对下载的财务报表进行数据...
true
168c422a71d272f3ecfba0ec918a885fd3b2e301
ThomasGarm/Calendar_project
/model/hydratation.py
UTF-8
572
2.984375
3
[]
no_license
class Rdv(): def __init__(self): self.ID = None self.title = None self.date = None self.hour = None self.description = None #if data: #self.hydratation(data) def hydratation(self,data): for key, value in data.items(): if hasattr...
true
f5ab2a62fc0c1e82fabbee310ed1b81aab0709ac
ylkhayat/scroogecoin
/blockchain.py
UTF-8
1,371
3.125
3
[]
no_license
from block import Block from tools import logger class BlockChain(): """ Class representing the ledger which is an array of blocks appended together. The ledger always saves the last appended block. """ def __init__(self): self.blocks = [] def add_block(self, block): self.block...
true
a85571eb10508765d44295d1be0d487c0bf89d33
dyspr0sium/Python-examples
/quiz_1.py
UTF-8
2,013
3.546875
4
[]
no_license
# Written by Daniel Yang and Eric Martin for COMP9021 ''' Generates a list L of random nonnegative integers smaller than the length of L, whose value is input by the user, and outputs two lists: - a list M consisting of L's middle element, followed by L's first element, followed by L's last element, followed by L's...
true
226edec13ce6af53ce99b90e4eec0e5ef8947b49
itsolutionscorp/AutoStyle-Clustering
/assignments/python/61a_hw4/src/78.py
UTF-8
341
2.875
3
[]
no_license
def num_common_letters(goal_word, guess): list1 = get_list(goal_word) list2 = get_list(guess) j, y= 0, 0 count = 0 while j < len(goal_word): i = 0 while i < len(goal_word): if list1[i] == list2[y]: count +=1 i +=1 y +=1 j +=...
true
ee6f516cf6b77b7d4b823251d9a18f27335ee68a
ImGabe/vending-machine
/bot.py
UTF-8
894
2.609375
3
[ "MIT" ]
permissive
from pathlib import Path import configparser import json import discord from app import client, config @client.event async def on_ready(): await client.change_presence( status=config['CLIENT']['STATUS'], activity=discord.Game(config['CLIENT']['ACTIVITY'])) print('Up and running!') def loa...
true
8b9466947351eba56cb2a95b08c38a1a4cd28515
AUNTY-BETTY-pnppb/grokking-algorithms
/CH5.py
UTF-8
953
3.546875
4
[]
no_license
# HASH TABLES/DICTIONARIES (Data Structure) # Hash functions - a function where you put in a string and you get # back a number. # average case - O(1) # worst case - O(n) # “maps strings to numbers, name to index” # Requires: Consistency - Apple = 4, 4 = Apple # map different words to different...
true
9e05246b4417dda56312e6a43404327c61528485
i7sid/Smart-Freezer-Project
/pictured/take_picture.py
UTF-8
592
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/python import os import shutil import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setup(27, GPIO.IN) def take_picture(): r = 9 for i in range(r - 1, 0, -1): if not os.path.isfile("/data/pictures/image-" + str(i) + ".jpg"): continue shutil.move(...
true
45cb349c89c2afe0c4d97bc60bbdebcb4be9d8b6
neuml/paperai
/src/python/paperai/models.py
UTF-8
982
2.875
3
[ "Apache-2.0" ]
permissive
""" Models module """ import os import os.path import sqlite3 from txtai.embeddings import Embeddings class Models: """ Common methods for generating data paths. """ @staticmethod def load(path): """ Loads an embeddings model and db database. Args: path: mod...
true
52323b6b91a0e30df067c57d985b99193b362f89
mai20-meet/meetyl1201819
/lab7.py
UTF-8
2,002
3.359375
3
[]
no_license
from turtle import * import turtle import random import math from random import randint turtle.colormode(255) class ball(Turtle): def __init__(self,radius,color,speed,dx,dy): Turtle.__init__(self) self.shape("circle") self.shapesize(radius/10) self.radius = radius self.color(color) self.speed(speed) se...
true
ba09b43d82565fe9901192299997fe77f9879930
xubonnie/ICS4U
/Modular Programming/pass_by_value.py
UTF-8
219
3.296875
3
[]
no_license
__author__ = 'eric' def addInterest(balance, rate): newBalance = balance * (1 + rate) balance = newBalance def main (): amount = 1000 rate = 0.05 addInterest(amount, rate) print(amount) main()
true
4d2447c06ec1c4c4fed4e8b84ac5a155ede38b7d
xuyu44f/lpr
/lprmix.py
UTF-8
14,535
2.609375
3
[ "Apache-2.0" ]
permissive
""" Author: fanghong edited: 2019.5.12 """ #coding=utf-8 from cv2 import dnn import cv2 from hyperlpr_py3 import pipline as pp import time import argparse import numpy as np from PIL import Image, ImageDraw, ImageFont import os import traceback Sheng = ["京", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "皖", ...
true
87a345b2e8e8a9f243892292a93e283f91643587
sssssssshao/PythonStudyProj
/study/IOProgram/strIOandByteIO.py
UTF-8
1,061
4.5
4
[]
no_license
# StringIO """ 很多时候,数据读写不一定是文件,也可以在内存中读写。 StringIO顾名思义就是在内存中读写str。 要把str写入StringIO,我们需要先创建一个StringIO,然后,像文件一样写入即可 """ from io import StringIO f = StringIO() f.write('hello') f.write(' ') f.write('world!') print(f.getvalue()) # getvalue()方法用于获得写入后的str f = StringIO('goodbye\nhi') while True: s = f.readl...
true
c934ecfb0a3049318c9a8d33761c6ac59ceac8fb
erzelenki/PythonLearning
/prime_01.py
UTF-8
480
3.640625
4
[]
no_license
def isPrime(num): for i in range(2,num//2+1): if num%i == 0: return False return True primes=[] for i in range(1, 104730): if isPrime(i + 1): primes.append(i+1) print("***********************************************************************************************") prin...
true
22ffbd418f443dfc99616301d40b97e578df3003
acardona/scripts
/python/imagej/tests/test_imgmath_view_rgb_hue.py
UTF-8
7,054
2.765625
3
[]
no_license
# The hue of an RGB image as a computation from ij import IJ, ImagePlus, ImageStack from ij.process import ByteProcessor, FloatProcessor from net.imglib2.img.display.imagej import ImageJFunctions as IL from net.imglib2.algorithm.math.ImgMath import let, IF, EQ, LT, THEN, ELSE, add, div, sub, maximum, minimum, compute,...
true
f7fb44336feba06e77f913940df203020ac2cd39
ptraverse/gsc
/barnacle-1.0.0/src/parsers/tokenizer.py
UTF-8
1,887
2.734375
3
[]
no_license
#! /usr/bin/env python """ tokenizer.py Created by Lucas Swanson Copyright (c) 2012 Canada's Michael Smith Genome Sciences Centre. All rights reserved. """ # import standard modules # import custom modules from utils.error import MyError #from utils.messages import DebugMsg # CONSTANTS class TokenizerCls: #{ def...
true
c46bc95e3d6e168cb40b34dc6ab1823f0b6fcfe9
EldanaIbraimova/Week8
/lab10/3/2/d.py
UTF-8
83
3.65625
4
[]
no_license
a = int(input()) while a>1: a = a /2 if a == 1: print("YES") else: print("NO")
true
6a178d9ab50fadfb9bfa96e38a12bf47ffccb2ef
dppham1/Pulsators-Prey-and-Predator
/blackhole.py
UTF-8
1,472
3.4375
3
[]
no_license
# A Black_Hole is a Simulton; it updates by removing # any Prey whose center is contained within its radius # (returning a set of all eaten simultons), and # displays as a black circle with a radius of 10 # (width/height 20). # Calling get_dimension for the width/height (for # containment and displaying)...
true
274852767a95cd203a465184b4ee3a3455552103
OliverBarbeau/LeetCode-Solutions
/sqrtx.py
UTF-8
1,080
3.859375
4
[]
no_license
# Problem #69 # https://leetcode.com/problems/sqrtx # Implement int sqrt(int x). # Compute and return the square root of x, where x is guaranteed to be a non-negative integer. # Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. # Example 1: # ...
true
3950a22e50460c3054152132c620f9cc4bde5dc2
YangXinNewlife/LeetCode
/easy/relative_sort_array_1122.py
UTF-8
842
3.53125
4
[]
no_license
# -*- coding:utf-8 -*- __author__ = 'yangxin_ryan' from collections import Counter """ Solutions: 题目含义是给出两组数组 arr1 较长的数组 arr2 参照数组 我们要把arr1重新排序,其中把arr1中出现arr2的数组按照arr2的顺序排在前面, 其余的在排序在后面。 我们直接遍历arr2,将数组加到返回的结果,然后再把剩下的加进去即可。 """ class RelativeSortArray(object): def relativeSortArray(self, arr1: List[int], arr2: L...
true
4a193793f98c846950e3c809f26ed033ed8d056b
bangarangler/python_stuff
/problems/nth.py
UTF-8
447
4.1875
4
[]
no_license
''' accepts a list and a nunber and returns the element at whatever index is the number in the list. if the number is negative, the nth element from the end is returned. you can assume that number will always be between the negative value of the list length, and the list length minus 1 ''' def nth(arr, idx): if idx ...
true
fde4493759f50c0c6c1964fed5898f2aec6ce6f9
chanchana/python-simple-mqtt
/publisher.py
UTF-8
1,136
3.203125
3
[]
no_license
import sys import socket # default parameter for broker host and port host = 'localhost' port = 80 # check valid argument if len(sys.argv) < 4: print('Invalid argument count!') print('Usage: publish [broker_ip_address] [topic_name] [data to publish]') exit() # if there is a specific host and port in arg...
true
f1c8c88dc5aa1dc840a209b68948318097bb878a
ornitie/random-data-generator
/number_generator.py
UTF-8
1,471
3.84375
4
[ "Apache-2.0" ]
permissive
import random class NumberGenerator: def generate_random_number(self, lower_range: int, upper_range: int): try: random_number = random.randint(lower_range, upper_range) return random_number except ValueError: print(f"Values {lower_range} and {upper_range} are i...
true
4e3fbb27d9019be9ae99ec07e6f8f7f91a0e7f99
python-spokane/2016-09-12-pipeline-demo
/demo/transformer/__init__.py
UTF-8
526
2.734375
3
[]
no_license
# # Written by Franco Gasperino <franco.gasperino@gmail.com>, 2016 # """ Transformer module for the pipeline demo. """ from .capitalize import capitalize from .whitespace import whitespace __all__ = [ 'capitalize', 'whitespace', 'pipeline' ] def pipeline(*coroutines): """ Return a callable whic...
true
d23dc90fe5186bdb0976968c5b0688e11d61ba38
miingjeong/baekjoon
/Python/1934.py
UTF-8
225
3.515625
4
[]
no_license
def gcd(a, b): mod=a%b while mod>0: a=b b=mod mod=a%b return b T=int(input()) for _ in range(T): a, b=map(int, input().split()) print(a*b//gcd(a, b))
true
f4bf069ff3d5aa0dc0f9066776ba00d98c55d43b
rqewqdd/python-starter
/week1/for1.py
UTF-8
53
3.25
3
[]
no_license
aNumber = [1,2,3] for num in aNumber: print(num)
true
4c207095e69359ed39da6c0aba06c5656e114e76
GastonMazzei/bitcoin-autoencoder.com
/app/kafkaHelper.py
UTF-8
1,297
2.65625
3
[]
no_license
import time import numpy as np from kafka import KafkaProducer, KafkaConsumer from config import config def initProducer(): # init an instance of KafkaProducer print('Initializing Kafka producer at {}'.format(time.time())) producer = KafkaProducer(bootstrap_servers=config['kafka_broker']) ...
true
7ee9b96880e6f57bb630eae1cb0b56503c3a8738
danieldiniz1/blue
/aula 18 26.05/OO.py
UTF-8
986
3.640625
4
[]
no_license
class funcionario: def __init__(self, nome, cargo, valor_hora_trabalhada): self.nome = nome self.cargo = cargo self.__valor_hora_trabalhada = valor_hora_trabalhada self.__horas_trabalhadas = 0 self.__salario = 0 @property def salario (self): return self._...
true
4640978be5547e51bf89e81abb8066e67f402802
riahtu/openDPU
/src/dpu_worker/resource_provider/WorkerResource.py
UTF-8
1,530
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- class WorkerResource: def __init__(self, logger): self._logger = logger self._workerID = None self._workerResource = {} self._initResource() print self._workerResource def _initResource(self): self.addAppResource('NILM', 5, 0, 5) self.addAppResource('COLLE...
true
452c0870a58f4148801f0401ce23d959b980e163
nishitm/ZooBar-Webserver
/lab-3/symex/symsql.py
UTF-8
923
3.15625
3
[ "MIT" ]
permissive
## This module wraps SQLalchemy's methods to be friendly to ## symbolic / concolic execution. import fuzzy import sqlalchemy.orm oldget = sqlalchemy.orm.query.Query.get def newget(query, primary_key): ## Exercise 5: your code here. ## ## Find the object with the primary key "primary_key" in SQLalchemy ## quer...
true
fcae0d5b072ac0158bb278690ac9a374710aa4ac
pyk707/PCC_2E
/alien_invasion/game_stats.py
UTF-8
588
2.6875
3
[]
no_license
class GameStats: """외계인 침공 게임 기록 저장""" def __init__(self, ai_game): """기록 초기화""" self.settings = ai_game.settings self.reset_stats() # 게임은 비활성화 상태에서 시작 self.game_active = False # 최고 점수는 리셋하면 안 됨 self.high_score = 0 def reset_stats(sel...
true
8a96183bb2b68ac38a711e857f82c4f3c360bf46
Dfredude/PythonZelle
/Chapter-11/15. Deck Class.py
UTF-8
2,749
3.734375
4
[]
no_license
from random import randrange def shuffle(myList:list): taken, newList = myList[:], myList[:] length = len(myList) for i in range(length): taken[i] = '' iterations = 0 for i in range(length): correct = False while not correct: rnum = randrange(0, length) ...
true
20a79f17d5d4dddf6057286b2a248788988e1a21
HPM573/Lab_OutputAnalysis
/TestPredictionInterval.py
UTF-8
2,269
3.078125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from deampy.plots.plot_support import output_figure from MultiSurvivalModelClasses import MultiCohort MORTALITY_PROB = 0.1 # probability of death over each time-step TIME_STEPS = 100 # length of simulation ALPHA = 0.05 # significance level for ca...
true
19261767bc74e1b1edea67bcb4fd7475a9802883
andersonmontor/ufscarRedes
/E1/genfile.py
UTF-8
115
2.859375
3
[]
no_license
#Gerador de arquivo grande f = open("arquivogrande", 'w') for i in range(50000): f.write(1024 * 'A') f.close()
true
8d7bc56ec2c834856f18034679950fac28646587
XtractTech/xt-cvdata
/xt_cvdata/apis/coco.py
UTF-8
3,156
2.546875
3
[]
no_license
import os import json import numpy as np import pandas as pd from .builder import Builder class COCO(Builder): def __init__( self, source, inst_val_path='annotations/instances_val2017.json', inst_train_path='annotations/instances_train2017.json', image_paths={'train': 'train', 'v...
true
c202fa61e307f3ccc213f341bebc9e366a343472
Doppe1g4nger/biocreative-file-analysis
/Scratch_Scripts/xml_printer.py
UTF-8
619
3.015625
3
[]
no_license
""" Simple script used to write first fulltext document to a file to view its structure """ import lxml.etree as etree if __name__ == "__main__": cnt = 0 with open("/home/daniel/Downloads/fulltexts_collection.xml", "rb") as file: fulltext = etree.iterparse(file, events=("end", )) for _, elem in...
true
ba27e72ee5bf997f0463fde979a8321bd348ec8b
mconsoni/codility
/Peaks.py
UTF-8
558
3.171875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/usr/bin/env python2.7 def solution(A): peaks = [] for c in xrange(1, len(A) - 1): if A[c-1] < A[c] > A[c+1]: peaks.append(c) if len(peaks) == 0: return 0 for size in xrange(len(peaks), 0, -1): if len(A) % size == 0: block_size = len(A) // size found = [False] * size found_cnt = 0 for pe...
true
79b896424460951db044a353fc968264e86ea79e
Behtash-BehinAein/Data-Structures-and-Algorithms-
/CrackingTheCodingInterview/1.7 Rotate_Matrix.py
UTF-8
1,823
3.5
4
[]
no_license
import os clear = lambda: os.system('cls') clear() def Rotate_MatrixClk(array): N = len(array) for Layer in range(N-2): Last = N-Layer-1 for cc in range(Layer, Last): # Save the right wing Right = array[cc][Last] # Top --> Right # Right...
true
6b159c4174c81853ed9e9124918c965bd068a30d
junneyang/studysummary
/008Python学习/PythonSource/ProStructor.py
UTF-8
668
3.6875
4
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: cp936 -*- if (2>2): print("A") elif (2==2): print("B") else: print("C") FLAG=True while FLAG: InputNum=int(raw_input("InPut an Integer:")) if (InputNum==10): print(InputNum) FLAG=False elif(InputNum==0): break else: ...
true
0651c2a413ab40e73fb1e007e88cabc4e16496cf
Jane-Zhai/LeetCode
/easy_math_013_Roma2Int.py
UTF-8
407
3.375
3
[]
no_license
class Solution: def romanToInt(self, s): """ """ dic = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} ans = 0 for i in range(len(s)): if i < len(s)-1 and dic[s[i]]<dic[s[i+1]]: ans -= dic[s[i]] else: ...
true
3b2cd41fc0695934c976b73d6b793cf34bc498ff
Dreeion/django-workon
/workon/utils/cache.py
UTF-8
6,432
2.734375
3
[ "BSD-3-Clause" ]
permissive
from time import time import threading from functools import partial from django.utils.functional import cached_property from django.core.cache import cache try: import asyncio except (ImportError, SyntaxError): asyncio = None __all__ = [ "cached_property", "cached_property_with_ttl", "memoize",...
true
8b464579eeadb006ac1ab8c6d30dc40a5d231295
nellybella/ICodeAI
/game_of_life.py
UTF-8
2,955
3.359375
3
[]
no_license
import random class GameOfLife: def __init__(self,num_cols,num_rows): self.num_cols = self.num_cols self.num_rows = self.num_rows self.active_grid = 0 self.grids = [] def create_grid(self): rows = [] for row in range(self.num_rows): ...
true
ac6c66fb1affac430ac36262d11b82ee5b540161
Wing-Builder/PYTHON-orient-e-objets
/PlayerRPG.py
UTF-8
1,528
2.734375
3
[]
no_license
class PlayerRPG: def __str__(self): return self.name def __init__(self, role): if role == "Guerrier": self.force = 10 self.defense = 100 self.points_de_vie = 100 elif role == "Mage": self.force = 20 self.defense = 150 ...
true
fb578fd4dfef3155ca9c906e6e7292a89abe9b0d
AJSKirk/aoc
/python/y_2021/day01.py
UTF-8
619
3.609375
4
[ "MIT" ]
permissive
import sys from typing import Generator, Iterable def depth_increases(depths: Iterable[int]) -> int: return sum(y > x for x, y in zip(depths[:-1], depths[1:])) def window_increases(depths: Iterable[int]) -> int: windows = [sum(window) for window in zip(*(depths[n:] for n in range(3)))] return sum(y > x ...
true
678e2776c7869518a0fd06ebef410de362e5db72
papagr/TheLMA
/thelma/repositories/rdb/schema/tables/transcript.py
UTF-8
954
2.515625
3
[ "MIT" ]
permissive
""" This file is part of the TheLMA (THe Laboratory Management Application) project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Transcript table. """ from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String from sqlal...
true
094c2f926c34f33744f9bede769eef262b7390bc
KristinaUlicna/NanoPush
/NanoPush/ML_SVM_Worker.py
UTF-8
6,113
3.25
3
[ "MIT" ]
permissive
def PlotSVMGamma(x_axis_data, y_axis_data, y_from, y_to, section=''): import matplotlib.pyplot as plt plt.figure() plt.semilogx(x_axis_data, y_axis_data) plt.title('semilogx') plt.ylim(y_from, y_to) plt.grid(b=None, axis='y') plt.tight_layout() plt.xlabel("Range of 'gamma' parameter") ...
true
5944e6af5ebc44f86314ec071bc719a64d80a1b1
dieselmachine/baph
/baph/auth/registration/forms.py
UTF-8
3,448
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- ''' :mod:`baph.auth.registration.forms` -- Registration-related Forms ================================================================= Forms and validation code for user registration. ''' from baph.auth.models import User from baph.db.orm import ORM from baph.utils.importing import import_any...
true
52237141f0dd5c8b33106b7bb68121467363d3d1
segasai/ioa_stan_workshop
/regression/gendata.py
UTF-8
999
2.671875
3
[]
no_license
import os import numpy as np import pystan import pickle import scipy np.random.seed(1) def generate_distribution(N): ## Generate linear regression data xs = np.random.uniform(0,10,size=N) ys = xs*10 + 5 + np.random.normal(size=N) return xs,ys def generate_distribution1(N): ## Linear regression w...
true
879c57e8319562a89dae3b310ff4aacb210593c4
luntaixiax/Investment
/analyst/investhistory/fundportfolioinvest.py
UTF-8
4,322
2.53125
3
[]
no_license
import datetime import pandas as pd import numpy as np from typing import Union, List, Generator from analyst.investhistory.singlefundinvest import SingleFundInvestAnalyst from analyst.investhistory.calc_tools import MIRR, period_performance from dataUtils.dataApis.funds.fundhist import FundDataManager from dataUtils...
true