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
3d73117218eb813f050cd8120cf18350e9612c35
ymayank97/Flask-Dashboard-for-heart-Disease
/model.py
UTF-8
2,874
2.765625
3
[]
no_license
#importing libraries import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split #for data splitting from sklearn.external...
true
a336b8a617a7447ddf8979599c4fe86f4cbc5533
DataDog/integrations-core
/ddev/src/ddev/validation/tracker.py
UTF-8
3,965
2.5625
3
[ "BSD-3-Clause", "MIT", "BSD-3-Clause-Modification", "Unlicense", "Apache-2.0", "LGPL-3.0-only", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "CC0-1.0" ]
permissive
# (C) Datadog, Inc. 2022-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from __future__ import annotations from collections import defaultdict from typing import TYPE_CHECKING, Any, cast from rich.text import Text if TYPE_CHECKING: from rich.console import Console f...
true
f8f82ee38be5700e2692af9985cc1ecf0e88a286
arghadeep25/Face-Detection
/detectors/cnn_dlib.py
UTF-8
740
2.890625
3
[ "MIT" ]
permissive
import cv2 import dlib class CNNFaceDetector: """ Face detection with CNN using dlib """ def __init__(self, frame): self.frame = frame def detection(self): weight = 'model/mmod_human_face_detector.dat' region_of_interest = dlib.cnn_face_detection_model_v1(weight) ...
true
7a66d2ec6f5318404e12f48039ac364a55fb993b
jong39/python
/55_builtin_module.py
UTF-8
180
2.9375
3
[]
no_license
import random print(random.randint(1, 1000)) import time print(time.localtime()) import urllib.request r = urllib.request.urlopen("https://www.rainmaker.com") print(r.read())
true
59fc9fc694531d6db268d0c6ab66198e306b1a0e
lanctot/open_spiel
/open_spiel/python/algorithms/adidas_utils/games/small_test.py
UTF-8
3,917
2.640625
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
# Copyright 2019 DeepMind Technologies Limited # # 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 applicable law or agr...
true
a0dbeb9c0af21a4e7a8e462cc925adb4182c4d2e
YCodeD/Learn_crawl
/crawler/pass_2/1.py
UTF-8
569
2.59375
3
[]
no_license
import requests from bs4 import BeautifulSoup url = 'http://www.xiachufang.com/explore' res = requests.get(url) soup = BeautifulSoup(res.text,'html.parser') items = soup.find_all('div',class_='info pure-u') for item in items: name_a = item.find('p',class_='name') name = name_a.find('a') zhuliao_p = item...
true
d90bda6ac81acd547486f03421c89b80a034f9bd
DrakeTHPS/TRRP2
/transmitter.py
UTF-8
1,288
2.703125
3
[]
no_license
import socket import rsa from Cryptodome.Cipher import DES import sqlite3 import pika desKey = b'abcdefgh' des = DES.new(desKey, DES.MODE_ECB) def pad(text): while len(text) % 8 != 0: text += b' ' return text with open('C:\\Users\\DrakeTHPS\\Desktop\\TRRP\\connection.txt') as f: ...
true
32a8529ae422e43a865f5e814b2978165e6ced56
Ilovelibrary/My-Favorite-Movie-Trailers-Website
/media.py
UTF-8
314
2.75
3
[]
no_license
class Movie(): """ The Movie class has attributes movie_title, poster_image and trailer_youtube. """ def __init__(self, movie_title, poster_image, trailer_youtube): self.title = movie_title self.poster_image_url = poster_image self.trailer_youtube_url = trailer_youtube
true
4c7a8a61cbfdc18010da8a63b102a39ead4a73a3
cofax48/Project-Euler
/Eulr_67.py
UTF-8
4,583
3.578125
4
[]
no_license
#! Euler 67 triangle = open('p067_triangle.txt') triangle = str(triangle.read()) def staright_down(): count = 1 three_addition = 0 for row in range(100): down = triangle[three_addition:three_addition+2] print(triangle[three_addition+(count *3):three_addition+((count * 3) + 5)]) 10...
true
0846683a38ecaac685ad6000587893e90cbe7c45
sselbach/monty
/2019/12_Web_scraping/holiday_comparison.py
UTF-8
1,247
3.84375
4
[ "MIT" ]
permissive
import requests def compare_holiday_counts(country_code1, country_code2, year=2019): """Returns the difference between the holiday counts of country 1 and country 2. Args: country_code1: The ISO 3166-1 alpha-2 country code for country 1. country_code2: The ISO 3166-1 alpha-2 country code for ...
true
c4abb841058e67af23ea513d8853262868fa3331
tox-dev/tox
/src/tox/tox_env/python/pip/req/util.py
UTF-8
1,390
2.5625
3
[ "MIT" ]
permissive
"""Borrowed from the pip code base.""" from __future__ import annotations from urllib.parse import urlsplit from urllib.request import url2pathname from packaging.utils import canonicalize_name VCS = ["ftp", "ssh", "git", "hg", "bzr", "sftp", "svn"] VALID_SCHEMAS = ["http", "https", "file", *VCS] def is_url(name: ...
true
8281021cab744893f7ab66d4098eeec261ec348f
jameskulu/Data-Types-and-Function-Assingment-Insight-Workshop
/Functions/8.py
UTF-8
307
4.09375
4
[]
no_license
# 8. Write a Python function that takes a list and returns a new list with unique # elements of the first list. # Sample List : [1,2,3,3,3,3,4,5] # Unique List : [1, 2, 3, 4, 5] def remove_duplicate(lst): new_lst = set(lst) return list(new_lst) print(remove_duplicate([1, 2, 3, 3, 3, 3, 4, 5]))
true
3248a3dfa8109f29cd22608c7ef229d033b8d465
jiwoomun/django_firstwork
/basic/01.py
UTF-8
1,258
4.03125
4
[]
no_license
# ***************** # --- Data Type --- # ***************** ''' Python has Five standard types scalar Numbers : int, float, complex String : str vector : List, Tuple, Dictionary, Set hello = 'hello' print(hello) print(hello[0]) print(hello[2:5]) print(hello[2:]) ''' # List CRUD Example print(f'List CRUD Exa...
true
b321f039b138841c5c287f93e83b82befe33e191
YZ775/Simple-substitution-cipher
/analyze.py
UTF-8
905
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- alpha= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] default_freq = ["e","a","t","i","o","s","n","r","h","l","d","c","u","m","p","f","g","y","w","b","v","k","j","x","q","z"] freq = {} freq_sorted = [] f = open('encryptedText.txt') w...
true
b29e7ddb62330fb29beb0d90cd9686135293810f
Roger-Li/Stuff
/HW1/HW1_Q3.py
UTF-8
8,068
2.703125
3
[ "MIT" ]
permissive
from __future__ import division import sys import math import numpy as np import scipy from scipy import stats from scipy.stats import gaussian_kde import matplotlib.pyplot as plt import csv import random as rd ''' define useful functions''' def logit_inverse (t): x = np.exp(t)/(1+np.exp(t)) return x def...
true
6eff018d1dc7f8d792ee4aa1f5ef2852d4867753
callumdscott/FacesPrototype
/facetool.py
UTF-8
6,254
2.6875
3
[]
no_license
import os import sample.dir_tools as dir_tool import sample.recognition as recog import sample.images as imgs import sys from time import sleep import face_recognition import cv2 as cv def main(): print('\033c') print('\x1bc') images = imgs.ImageCollection() recogniser = recog.Recogniser() navigat...
true
76daf50b74dca5682b1f5fe1898c10a586ebdcb0
gaurava45/PythonProjectRepo
/ex1.py
UTF-8
345
3.96875
4
[]
no_license
# val = int(input("Enter the integer")) # print(val) if 2==3: print("not equal") print("inside if") print("after if") if 2==2: print("equal") print("inside if") print("after if") if(True & True): print("True") if(True | False): print("True") if(True and True): print("True") if(True or ...
true
934eef958bf5c830d3b0677c7b8a8a0af39f364f
WyckliffeAluga/potential-happiness
/genetic-algorithms/DEAP_for_appetizers.py
UTF-8
6,774
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun May 10 15:41:03 2020 @author: wyckl """ # The characters want to get exactly $15.05 worth of appetizers, as fast as possible # Appetizers include : # Mixed fruit 2.15 # French fries 2.75 # Side Salad 3.35 # hot wings 3.55 # mozzarella sticks 4.20 ...
true
64c11cb11927f1604d9673d10b1f1c362b7b39bc
doublechenching/hpi
/hpi_torch/lr_scheduler.py
UTF-8
1,619
2.953125
3
[ "MIT" ]
permissive
from torch import optim import numpy as np def get_multilrs(milestones, mode='multiply'): lrs = [step[0] for step in milestones] steps = [step[1] for step in milestones] multi_lrs = [] if mode == 'multiply': for i in range(len(steps) - 1): gamma = np.float_power(lrs[i+1] / lrs[i], 1...
true
e07e7d7d41d11244e4ec89f6c3f920a9fa4e8fab
jgates5/python_learning
/perform_calculation_on_assignment.py
UTF-8
178
3.390625
3
[]
no_license
total = 100 #assignment operator #total -= 10 #total *= 2 #total /= 10 #total **= 2 product_two = 120 product_three = 10 total += product_two total += product_three print(total)
true
ea347014d5be78f0bae6d215f0c59f839483f29b
hermian/backtest
/scripts/crawl_ticker.py
UTF-8
273
2.6875
3
[]
no_license
import pandas_datareader.data as web import datetime if __name__ == "__main__": # 1. get raw data start = datetime.datetime(1970, 1, 1) end = datetime.datetime(2019, 1, 1) spy = web.DataReader("USDKRW=x", "yahoo", start, end)["Adj Close"] print(spy)
true
cd18d5bc4c27df1cb7059598bd0ad746306de344
ParulProgrammingHub/assignment-1-vedang4u
/Program2.py
UTF-8
155
3.859375
4
[]
no_license
pi=3.14 r=input("Enter the radius") area = pi*r*r cir = 2*pi*r print "The area of circle id %s" % (area) print "The Circumference of circle is %s" % (cir)
true
64398702ade6685602e92fcbef945158378590ab
gabrielsr/HMRSplanner
/test.py
UTF-8
708
3.515625
4
[]
no_license
coins = [1, 5, 10, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000] ccount = [i for i in range(10000 + 1)] cselection = [None for i in range(10000 + 1)] for c in coins: ccount[c] = 1 cselection[c] = (c) for i in range(10000): if ccount[i] <= 1: continue else: t = ccount[i] f...
true
89edce2fc8c60c992587e68b0bd82bc41ba826fe
jiangshshui/leetcode
/19thPage/935_KnightDialer.py
UTF-8
505
2.90625
3
[]
no_license
class Solution(object): def knightDialer(self, N): mod=10**9+7 next_step=((4,6),(6,8),(4,8),(7,9),(0,3,9),(),(0,1,7),(2,6),(1,3),(2,4)) dp=[1]*10 for i in range(N-1): dp_new=[0]*10 for i,v in enumerate(dp): for next in next_step[i]: ...
true
c62ecb38019acfcd19293f02ee092af80758be8d
Aasthaengg/IBMdataset
/Python_codes/p03325/s962653032.py
UTF-8
163
3.0625
3
[]
no_license
n = int(input()) al = list(map(int, input().split())) res = 0 for i in range(n): j = al[i] while j % 2 ==0: res +=1 j = j//2 print(res)
true
9093dbe3c5b311acd7631658e1924b8d4aea4c74
Grey2k/yandex.praktikum-alghoritms
/tasks/sprint-6/C - DFS/dfs_test.py
UTF-8
1,760
2.671875
3
[]
no_license
import unittest import io from unittest.mock import patch from dfs import main class DFSTest(unittest.TestCase): @patch('sys.stdin', io.StringIO("\n".join([ '4 4', '3 2', '4 3', '1 4', '1 2', '3', ]))) @patch('sys.stdout', new_callable=io.StringIO) def ...
true
a7d78253c33df57b72cdeb951b7111aa625d42cd
kresimir-lukin/AdventOfCode2020
/day08.py
UTF-8
1,013
3.125
3
[]
no_license
import sys def execute(program): pc_visited = [False] * len(program) accumulator = pc = 0 while pc < len(program) and not pc_visited[pc]: pc_visited[pc] = True instruction, argument = program[pc] if instruction == 'acc': accumulator += argument elif instruction =...
true
236a5299ef1841491836c6f4540309b823a7a10d
janmalec/sandy
/sandy/formats/utils.py
UTF-8
70,686
2.75
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ This module contains all classes needed to organize and structure different nuclear data types into python objects. Nuclear Data Objects (NDO) ========================== The following objects are considered: - `Xs` : dataframe of energy dependent cross section dataframe - `Lpc` :...
true
01191eb3aaa781fce5d4bdc7c4ab86d1b249f83b
vincentgc/Leetcode
/Binary Tree- Base operation/226 Invert BT.py
UTF-8
297
3.15625
3
[]
no_license
class Solution(object): def invertTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ if not root: return root.left,root.right= self.invertTree(root.right),self.invertTree(root.left) #不要分开写 return root
true
ca17993fa4c50582fc7696cbdd2f4c3a2c19ec99
MrKort/Pcfb_Final_Project
/pipeline.py
UTF-8
5,589
2.53125
3
[]
no_license
#! /usr/bin/env python # Authors: K. Kort & H. Kruize import os import sys from Bio import Phylo # Please use the proper extentions for the DNA sequences (000.fnt) and the Amino Acid sequences (000.faa) # sys.argv takes the file name you want to search. #Be sure to enclose it in apostorphes like: "file*.faa", if you...
true
7c489b8e4c2f8cd9f3b6c90c06be521dcc1fe1f1
obonhamcarter/cs300fall2019
/0_lessons/06_17Sept2019_genesAndAlleles/mySandbox/misc/working/fileRead.py
UTF-8
625
3.71875
4
[]
no_license
#!/usr/bin/env python #************************************* # CMPSC 300 Spring 2016 # Class Example # Date: February 9, 2016 # Purpose: illustrating reading files #************************************* # Read an input from a fasta file and print out its name and sequence my_file = open('diabetes.fasta') firstLine ...
true
049d80b190e0d5c9a7df7cf2ecac8e2f34c11126
PythonLebo/Programmeerimine-Python
/Tarkvaraarendus (VG-1)/2.3a Retseptid.py
UTF-8
1,139
2.546875
3
[]
no_license
fail = open("retseptid.txt", encoding="UTF-8") retseptid_tabel = [] # Tühi järjend, kuhu lisame retseptid for rida in fail: # Iga rea jaoks failist koostisosad = [] # Kogume reas olevad koostisosad järjendisse osad = rida.split(",") # Jupitame rea koma koha pealt for osa in osad: # Vaatame iga jup...
true
bf34ecc2b20f907f3a3fd155f3e24fad540f2820
jhb86253817/MLDA
/data/wikipedia/vb_statistics.py
UTF-8
743
2.625
3
[]
no_license
# statistics for computing the real computational efficiency of vb with open('en_50000.dat', 'r') as f: en = f.read() en = en.split('\n') en = en[1:-1] en = [d.split() for d in en] en_count = sum([len(d) for d in en]) en_set = [set(d) for d in en] en_set_count = sum([len(d) for d in en_set]) print 'english, ori...
true
41c9d51537cea5ad5a2ea30fc2f221fe4d0c92d1
ashbake/KavliSummer
/scaleheight.py
UTF-8
3,294
2.609375
3
[]
no_license
# :::::::::::::::::::::: # Cloud Scale Height # ~~~~~~ # Inputs files: # # :::::::::::::::::::::: import numpy as np # Load files containing planet and molecule paramters. List of planets will address # is given in planet_params # Load Planet Parameters PPdat = np.genfromtxt('planetTPparams.txt', dtype=None, ...
true
bb024b924848b175e26838c286e9d484200c94c8
An-Shan/twstock-predict
/connect_database.py
UTF-8
1,253
2.75
3
[]
no_license
import psycopg2 from config import config def connect_db(): """ Connect to PostgreSQL database server """ conn = None try: params = config() print('Connecting to PostgreSQL database from AWS RDS . . .') # conn = psycopg2.connect(host = 'twstock-database.ctaidhzjqlwd.us-east...
true
8d993edfd69fb9e32210f5aa6b1cef6e13e8f1e8
hebron-george/hackerrank
/Python/BasicDataTypes/ListComprehension/testChallenge.py
UTF-8
694
2.9375
3
[]
no_license
import unittest, challenge class TestChallenge(unittest.TestCase): def setUp(self): pass def test_get_list_for_base_1112(self): a = challenge.get_list(1,1,1,2) e = [[0,0,0], [0,0,1], [0,1,0], [1,0,0], [1,1,1]] self.assertEqual(a,e) def test_get_list_for_base...
true
1d92d5950241ffb4098e2e7b93251cf28ec6e5de
svn2github/FreeMat
/PyFM/fmscanner.py
UTF-8
10,861
2.953125
3
[]
no_license
""" The scanner module provides the :class:`scanner`, which performs lexical analysis on an input text. """ from fmtoken import Token FREEMAT_RESERVED = {"break": Token.TOK_BREAK, "case": Token.TOK_CASE, "catch": Token.TOK_CATCH, "continue": Token.TOK_CONTIN...
true
fce679b8d6d95700b8b49a3cbafd161b8a22197f
qinxudong/HM-LSTM
/hmlstm/viz.py
UTF-8
1,073
3.078125
3
[]
no_license
import matplotlib.pyplot as plt def plot_indicators(truth, prediction, indicators): plt.figure(figsize=(16, 9)) plt.plot(truth, label='truth') plt.plot(prediction, label='prediction') plt.legend() colors = ['r', 'b', 'g', 'o', 'm', 'l', 'c'] for l, layer in enumerate(indicators): for ...
true
3caff7578ebecfc2db4f329ee650ba812749e314
yjlee0209/kite
/Python/if_6_Bool.py
UTF-8
523
3.9375
4
[]
no_license
# Bool 타입으로 치환되는 상황 # 0 -> False # None -> False # 빈 문자열 -> False # 빈 리스트 -> False num = 10 str_blank = "asd" nums = [1,2,3] if num: print('0은 True 처리가됩니다.') else: print('0은 False 처리가됩니다.') if str_blank: print('빈 문자열은 True 처리가됩니다.') else: print('빈 문자열은 False 처리가됩니다.') if nums: print('빈 리스트는 True...
true
319bc869401b7bce2215d9a5d7365e95ab4bfd56
sakuv2/procon
/src/procon/abc/abc194/a.py
UTF-8
424
2.984375
3
[]
no_license
# https://atcoder.jp/contests/abc194/tasks/abc194_a from typing import Tuple def get_input() -> Tuple[int, int]: a, b = map(int, input().split()) return a, b def main() -> int: a, b = get_input() if a + b >= 15 and b >= 8: return 1 elif a + b >= 10 and b >= 3: return 2 elif...
true
f5054cb6b9e545a32a0891422a7ce67d34747cd8
Phasor/movie-trailer-website
/entertainment_center.py
UTF-8
1,700
2.890625
3
[]
no_license
import media import fresh_tomatoes import re #create movie instances trading_places = media.Movie("Trading Places", "http://upload.wikimedia.org/wikipedia/en/4/4d/Trading_Places.jpg", "https://www.youtube.com/watch?v=vEaXAsbvHV4", "E...
true
ea624885620e03bcfa9d3eec2ee3e1fbe4fef2b8
pulum03/Algorithms-
/Practice/palindrome.py
UTF-8
629
3.515625
4
[]
no_license
palindrome = [] def get_palindrome(num1, num2): max_palindrome = 0 num2_org = num2 while num1 > (num1/10): #why not 99? and (num1/10)? while num2 > (num2/10): multiple = num1 * num2 if is_palindrome(multiple) and (max_palindrome < multiple): max_palindrome = ...
true
9161055599b2d3c89b5429cb015ae8f8f1f4a22f
kgadek/kpfp
/4_symb/zad1/macierz.py
UTF-8
7,428
3.34375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 """ Operacje na macierzach. TODO zainstalować: - easy_install - virtual_env """ import types class Callable: """ Pozwala na proste tworzenie metod statycznych. EXAMPLE: class Ala: @Callable def getAlaWrazZKotem(): ...
true
88bf6a7176cc701ba51c14173785bcf8ece5e8a8
thanhpham312/ACIT2515Final
/controllers/GUI/interface_controllers/change_pin_controller.py
UTF-8
1,378
2.75
3
[]
no_license
import hashlib from views.GUI.change_pin_interface import ChangePinInterface class ChangePinController(): ''' Controller class for the ChangePinInterface view. Attributes: main_controller: a reference to the main controller object change_pin_interface: the view this class c...
true
ee97a800be36f8e9682ae2ee178c16c750cb9fd3
ViktorSalimonov/langer
/server/downloadworker.py
UTF-8
1,008
2.6875
3
[]
no_license
import html2text import requests import threading import time from server.task import ProcessingTask class DownloadWorker(threading.Thread): SLEEP_INTERVAL = 10 def __init__(self, rl, processing_queue): threading.Thread.__init__(self) self.processing_queue = processing_queue self.rl =...
true
29a8eeff7daaf2417e9ab512f7c61bfd9e496827
chromium/chromium
/third_party/wpt_tools/wpt/tools/third_party/websockets/performance/mem_client.py
UTF-8
1,311
2.625
3
[ "BSD-3-Clause", "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "Apache-2.0" ]
permissive
#!/usr/bin/env python import asyncio import statistics import tracemalloc import websockets from websockets.extensions import permessage_deflate CLIENTS = 10 INTERVAL = 1 / 10 # seconds MEM_SIZE = [] async def mem_client(client): # Space out connections to make them sequential. await asyncio.sleep(clien...
true
fe8af976241f498d3340e8940fa8df53d90c0ded
junzis/memeit
/extraction.py
UTF-8
2,212
3.109375
3
[]
no_license
import os import time import uuid import numpy as np import matplotlib.pyplot as plt from skimage import io from skimage import morphology from skimage import measure from skimage import transform def check_letter(contour): """Check if an contour seems like letter""" xmax = max(contour[:, 1]) xmin = min(c...
true
b461cfcea7d33c4523f775c0ca042a7c513700c8
pcarton/cartonEXE
/PyMods/hammer.py
UTF-8
3,361
2.8125
3
[ "MIT" ]
permissive
# Moderation module, determines actions to take on individual messages # Returns info to the driver as a string in the form 'action user responseMsg' # Expects info in form 'username messagetext' import sys, json, re import profanityfilter try: import ganon except: sys.path.append('..') from PyMods import ganon li...
true
d3bc08d1d20dff06ed628abdfbb92b71ecd534cb
cjblink1/lang
/src/main/python/proc/expression/variable.py
UTF-8
407
3.03125
3
[ "MIT" ]
permissive
from proc.expression.expression import Expression from proc.environment import Environment class VariableExpression(Expression): def __init__(self, identifier: str): self.identifier = identifier def string_representation(self): return "identifier = {0}".format(self.identifier) def eval...
true
4b96c94c1fb0bea6bdba4aef30a6bbd5af36665b
mciaccio/MongoDB
/dataExtractionFundamentals/pythonSourceCode/screenScraper.py
UTF-8
12,820
2.859375
3
[]
no_license
import os import bs4 import requests # Unresolved import: requests def example1(): print("\n\tBegin example1 function") r = requests.get('http://www.transtats.bts.gov/Data_Elements.aspx?Data=2') print("\t\tr is {}".format(r)) # print("\t\tr.__class__.__name__ is {}".format(r.__class__.__name__)) # ...
true
57c8e95dad69edd7e52efcd57670092ecb499a9a
santuchidura/NUMPY
/palindrome.py
UTF-8
322
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 8 16:27:49 2019 @author: Santosh """ def reverse(s): return s[::-1] def isPalindrome(s): # Calling reverse function rev = reverse(s) # Checking if both string are equal or not if (s == rev): return True return Fal...
true
5f6b0bfc9096b10037df36fff49a234f21a56aff
pdavis39/twcHack
/quote.py
UTF-8
2,356
2.84375
3
[]
no_license
import random,time #seed the time #random.seed(time.time()) # cold run # cold bike # replace seed with random number range def getcbquotes(): random.seed(time.time()) quotelist = [] infile = open( '/Users/paul/Documents/twcHack/quotes/cold_quote.txt', "rU" ) for line in infile: if line.startswit...
true
aa1b5c90eb25ba60d1fc4db484aca2f11357da1c
spencercjh/sync-leetcode-today-problem-python3-example
/sliding_window_median.py
UTF-8
189
2.65625
3
[ "Apache-2.0" ]
permissive
class SlidingWindowMedian: """ https://leetcode-cn.com/problems/sliding-window-median/ """ def medianSlidingWindow(self, nums: List[int], k: int) -> List[float]:
true
b73eb1302de53733383730ddfa693911be70bad5
QualityHammer/Floopy
/main.py
UTF-8
2,089
2.8125
3
[]
no_license
import pygame as pg import numpy as np import sys from floop import Floop from pipe import Pipes from score import Score from settings import * class Main: def __init__(self): pg.init() self.screen = pg.display.set_mode(SIZE) pg.display.set_caption(TITLE) self.clock = pg.time.Cloc...
true
6ffd8766612d19b8da4cfb807749e63b054fa709
lwiesek/Python
/sonar.py
UTF-8
1,878
3.125
3
[]
no_license
import random,sys,math def utworzNowaPlansze(): plansza=[] for x in range (60): plansza.append([]) for y in range(15): if random.randint(0,1)==0: plansza[x].append('-') else: plansza[x].append('`') return plansza def na...
true
3f84e534ac817b6a580b4be50a9e98a820146448
susanarivs/new-port-eyes-1
/scrapper/application.py
UTF-8
980
2.734375
3
[]
no_license
import requests from flask import Flask, jsonify from bs4 import BeautifulSoup def fetch_last_banca(): URL = 'https://portafolioinfo.cnbv.gob.mx/PUBLICACIONES/SH/Paginas/bm.aspx' page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') step_1 = soup.prettify().split('var jsonData = ')...
true
ef1db0eab29a3ef869c7155d63756d40f2889802
thibaultbl/feature_engine
/feature_engine/wrappers/wrappers.py
UTF-8
6,495
2.96875
3
[ "BSD-3-Clause" ]
permissive
from typing import List, Optional, Union import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin, clone from feature_engine.dataframe_checks import ( _check_input_matches_training_df, _is_dataframe, ) from feature_engine.validation import _return_tags from feature_engine.variable_manipula...
true
133463d74dcc67c21e1629a838cd8672a735b66f
Fufuhu/ProgrammingTraining
/Chapter1/1-3.py
UTF-8
838
3.5625
4
[]
no_license
def is_rearranged(kou, otsu): if len(kou) != len(otsu): return False kou_counter = character_count(kou) otsu_counter = character_count(otsu) result = True if len(kou_counter.keys()) == len(otsu_counter.keys()): keys = kou_counter.keys() for key in keys: if n...
true
d0fbe0829e32ce71ea2e14b18e59c92c3a34d15f
jiangbin216/zhishixingqiu_spider
/zhishixingqiu_spider.py
UTF-8
2,071
2.71875
3
[]
no_license
from datetime import time from urllib.parse import urlencode import requests import json def get_json(count,end_time): data={ "count": count, "end_time": end_time } url="https://api.zsxq.com/v1.8/groups/2421112121/topics?"+urlencode(data) # 头部信息,直接复制自己的 headers = """ authoriz...
true
df95e1df3dec242b4643b6557e53876c60b71bdf
wumbovii/senior_projects
/proj3-1/tests/test-proj3
UTF-8
4,083
2.546875
3
[]
no_license
#!/usr/bin/env python import os, sys, re from subprocess import Popen, PIPE from getopt import getopt, GetoptError def Usage(): print ''' Usage: test-proj3 [ --errors ] [ --compiler=COMPILER ] [ --show=N ] \ DIR/BASE.py ... Runs COMPILER (default ./apyc) on each DIR/BASE.py with the command ...
true
dfe9475454011da6341bf79e88f63dec7dbc95dd
daegu-algo-party-210824/younghang_algo
/기출/41.여행계획.py
UTF-8
1,029
3.515625
4
[]
no_license
# 41.여행계획 # 3 4 / 2 3 / 1 2 / 0 1 # 케이스로 값을 넣었을 때에는 parent가 갱신되지 않는다. # 대신에 0,4 로 find를 할때에 갱신이 된다. N,M = map(int,input().split(" ")) parent = [i for i in range(N)] # 최상단에 parent를 가져온다. def find(a) : global parent if a != parent[a] : parent[a] = find(parent[a]) return parent[a] def union(a,...
true
a942e3d2e16aa677279529bf6c76dcc4426a23ce
VictorZ94/holbertonschool-web_back_end
/0x03-caching/3-lru_cache.py
UTF-8
1,106
3.40625
3
[]
no_license
#!/usr/bin/env python3 """ Implement a caching system cache replacement algorithm - LRU """ from base_caching import BaseCaching class LRUCache(BaseCaching): """inherit from BaseCaching and is a caching system Args: BaseCaching (Father class): Implement methods """ def __init__(self): ...
true
f4b5fd9bbeb2aede7c6996902b46ebdf77d1c0bc
yym6472/leetcode_everyday
/2020-08-31/616 course schedule ii.py
UTF-8
960
3.265625
3
[]
no_license
class Solution: """ @param: numCourses: a total of n courses @param: prerequisites: a list of prerequisite pairs @return: the course order """ def findOrder(self, numCourses, prerequisites): # write your code here in_degree = [0] * numCourses neighbors = [[] for _ in rang...
true
9a6cdb27236a9ccd7c0fba98476f0b97abe4d021
gmor7/Travelling-Salesman-Problem
/cities.py
UTF-8
14,743
3.625
4
[]
no_license
# Importing math and numpy for random number generation & calculations from math import * import random import numpy as np # Importing Matplotlib Basemap, Figure and Pyplot for visualisation function from mpl_toolkits.basemap import Basemap # please note: requires pip install from matplotlib.figure import Figure imp...
true
d79316991eef6df1955a0a217c05f62f9e9862e1
nicholsonja/JMM2020
/images/genImage_09.py
UTF-8
4,159
3.234375
3
[]
no_license
#!/usr/local/python3 from math import cos, sin, exp, pi, atan2, sqrt import os import cairo import helper IMAGE_WIDTH_IN = 5 IMAGE_HEIGHT_IN = 5 DPI = 500 STROKE = 2 def makeImage(height, width, imageName): imageWidth = min(width, height) imageHeight = max(width, height) surface = cairo.ImageSurface(ca...
true
27673dea9973129b4c3f3c05b3100b489a45b127
liaozp1/algorithm012
/Week_06/countSubstrings.py
UTF-8
2,587
3.578125
4
[]
no_license
# 给定一个字符串,你的任务是计算这个字符串中有多少个回文子串。 # # 具有不同开始位置或结束位置的子串,即使是由相同的字符组成,也会被计为是不同的子串。 # # 示例 1: # # # 输入: "abc" # 输出: 3 # 解释: 三个回文子串: "a", "b", "c". # # # 示例 2: # # # 输入: "aaa" # 输出: 6 # 说明: 6个回文子串: "a", "a", "a", "aa", "aa", "aaa". # # # 注意: # # # 输入的字符串长度不会超过1000。 # # Related Topics 字符串 动态规划 # 👍 297 👎 0 # leetcod...
true
c1440c26aa59024a66bb4e7a41cc741f721d0c1f
vinaybhupathiraju18/dsc80-sp20
/discussions/01/disc01.py
UTF-8
1,218
3.78125
4
[]
no_license
import numpy as np import os def data2array(filepath): """ data2array takes in the filepath of a data file like `restaurant.csv` in data directory, and returns a 1d array of data. :Example: >>> fp = os.path.join('data', 'restaurant.csv') >>> arr = data2array(fp) >>> isinstance(a...
true
89d2d79cf5e4a65579909b65543570769f7c3c3e
h10gforks/learn_python3
/learn_flask/app/utils/gethotapps.py
UTF-8
1,746
2.578125
3
[]
no_license
#coding:utf-8 import requests import redis from bs4 import BeautifulSoup from time import sleep from pprint import pprint def gethot(): head = { 'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' } apps = {} content = [] ...
true
115f014735aabc4d09f0bf1d6fea46f71c3cd02d
privat33r/project02
/index.py
UTF-8
8,730
2.546875
3
[]
no_license
#!/usr/bin/env python3 #Created: 12Apr19 #Author: Ben Valdes, Brandon Shield, Yixin Ye #Description: Backbone of the entire website, serves as the landing page for returning and new users. #New users will be directed to login/signup page. #Returning users will be checked for existing cookies and if they are legitimat...
true
80fb6b0a15fcf428a44e8069377dfe7ef6361ac1
rayankikavitha/InterviewPrep
/Arrays_and_Strings/island_perimeter.py
UTF-8
428
3.296875
3
[]
no_license
s=[[0,1,0,0], [1,1,1,0], [0,1,0,0], [1,1,0,0]] islands*4 - neighbors * 2 def singleNumber(nums): """ :type nums: List[int] :rtype: int """ nums.sort() print nums if len(nums) == 1: return nums[0] for i in range(0,len(nums) - 1, 2): if nums[i] != nums[i + 1]: ...
true
c0d472110f7fbf1b7223fd8e5b99754f29003285
titodeal/desktop
/gui/project_widgets/depricated_projects_viewer_widget/project_viewer.py
UTF-8
3,027
2.5625
3
[]
no_license
from PySide6 import QtWidgets, QtCore # from .projects_table_view import ProjectsTableView # from .filters_widget import FiltersWidget from gui.custom_widgets. \ table_filters_widget. \ table_filters_w import TableFiltersWidget # import sys, os # app_path = os.path.abspath("/home/fed/Development/titodeal_de...
true
120140c2a85225aff152fad777ad7f237f268ce7
AdamZhouSE/pythonHomework
/Code/CodeRecords/2529/47961/248404.py
UTF-8
516
3.0625
3
[]
no_license
N=int(input()) def split(N): sp = {} for char in str(N): if char in sp: sp[char] += 1 elif char not in sp: sp[char] = 1 return sp if N == 1: print("true") elif N==46: print("true") elif N==24: print("false") elif N==16: print("true") elif N==10: print("false") else: l = len(str(N)) ...
true
27d091dace331ca222abf37c1b4567c7015b11f5
Boomshaka/libBot
/dateconfig.py
UTF-8
748
2.65625
3
[]
no_license
import configure as cfg import datetime from datetime import date class Dates: start_date = datetime.datetime(2020, 2, 13, 0, 0) def __init__(self, start_id, target_time): self.current_date = datetime.datetime.now() self.start_id = start_id self.target_time = target_time self.d...
true
1028a05c1a702760b6f7fc400332f510b55f0a3e
teebarjunk/faceo
/faceget.py
UTF-8
10,191
2.78125
3
[]
no_license
import sys, os, dlib, cv2, glob, filehelper from PIL import Image import numpy as np from math import trunc detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat") triangles = [] for line in open("triangle_list.txt", "r"): x, y, z = line.split(' ') ...
true
941f45d5743fa6e3b63b310dfdc3bb1be5b63580
junwenxiong/Remote-sensing-image-road-segmentation
/networks/Ensemble.py
UTF-8
497
2.53125
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class MyEnsemble(nn.Module): def __init__(self, in_channels, n_classes=1): super(MyEnsemble, self).__init__() self.conv1 = nn.Conv2d(in_channels, n_classes * 3, 3, 1, 1) self.conv2 = nn.Conv2d(n_classes * 3, n_classes, 3...
true
03ffe6f56fb91ed32371bb6777c80c450a554436
egreenius/ai.python
/Lesson_4/hw_4_1.py
UTF-8
1,037
3.625
4
[]
no_license
''' Home work for Lesson 4 Exercise 1 1. Реализовать скрипт, в котором должна быть предусмотрена функция расчета заработной платы сотрудника. В расчете необходимо использовать формулу: (выработка в часах * ставка в час) + премия. Для выполнения расчета для конкретных значений необходимо запускать скрипт с параметрами. ...
true
769141b366414df0271960719876eca18581186d
luyao777/leetcode_python
/173.二叉搜索树迭代器.py
UTF-8
1,064
3.671875
4
[]
no_license
# # @lc app=leetcode.cn id=173 lang=python3 # # [173] 二叉搜索树迭代器 # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class BSTIterator: def __init__(self, root: TreeNode): self.n...
true
62fc5f6c18e9cf018f8cee0b0f6bda154c0cfeb5
jsgomez14/platzi_python_django
/intro_selenium/search_csv_ddt.py
UTF-8
1,435
2.96875
3
[]
no_license
import csv, unittest from ddt import ddt,data,unpack from selenium import webdriver def get_data(file_name): rows=[] with open(file_name,'r') as data_file: reader = csv.reader(data_file) next(reader, None) for row in reader: rows.append(row) return rows @ddt class Search...
true
38fc41c871d0fa94ec48a4e684a8cc1c131a12b0
deedee96/CS450ML
/week3/main.py
UTF-8
1,995
3.53125
4
[]
no_license
# coding: utf-8 # In[1]: from carEval import carEval from indian_diabete import indian_diabete from automobile_mpg import automobile_mpg import pandas as pd def get_k(): while True: try: k = int(raw_input("Please enter in the number of neighbor(s): ")) break except ValueE...
true
3a877834fd0c477a0dfac0aa529f97befd8345f1
Troysps/learn_python
/65/传递任意数量的实参.py
GB18030
564
3.484375
3
[]
no_license
# coding=gbk # ħʦ # ؼenumerate names = ['liuqian','zhoujielun','jay'] new_names =[] def make_great(magicians_name): """޸ħʦб""" for index,magician in enumerate(magicians_name): magicians_name[index] = 'the Great ' + magician new_names.append(magicians_name[index]) def show_magicians(...
true
b78232bbc33c5d9133919d2f7fc88796b4bed9fd
fduda/Intro_prog
/Semana 9/ex6/coin_rafa.py
UTF-8
1,248
3.421875
3
[]
no_license
def _pick_coins(coins, p, pickers): # winner = "" # define picker picker = pickers[p] # choose how many coins to pick if coins==1: picked_coins = 1 else: if coins%3==0: # lost, no matter what # print("{} lost here!".format(picker)) ...
true
3c1aff14b9418ed53906d7553b9f5b53d90bc047
zhuchen0310/leetcode
/lcof/数组中重复的数字/main.py
UTF-8
264
2.921875
3
[]
no_license
class Solution: def findRepeatNumber(self, nums: List[int]) -> int: if not nums: return -1 m = {} for n in nums: if n in m: return n else: m[n] = 0 return -1
true
9aa124576f5018131ab8b21b53b6837271fcddf2
cgswjs/Leetcode
/prob36_validSudoku.py
UTF-8
1,469
3.359375
3
[]
no_license
import timeit class Solution: def isValidSudokuSetSimple(self, board): #initiate a set to store visited location and value big = set() for i in range(0,9): for j in range(0,9): if board[i][j]!='.': cur = board[i][j] #use i/3, j/3 to find sub box in sudoku since one number can only appear once i...
true
20f4bd770ddae41e62c3f9b140e839c8e83c6dc0
prateek1404/AlgoPractice
/CareerCup/FB/remove.py
UTF-8
218
3.46875
3
[]
no_license
def remove_duplicates(ar): result =[] result.append(ar[0]) prev = ar[0] for i in range(1,len(ar)): if ar[i]!=prev: result.append(ar[i]) prev = ar[i] return result print remove_duplicates([1,1,2,2,3,3,4])
true
014b8672539e1ec33fc71968e5bb3f9edf743e74
siddhipandare/PythonLab
/gdc.py
UTF-8
263
3.609375
4
[]
no_license
def gcd (big,small): if (big%small==0): return (small) else: return gcd(small,big%small) x=int(input("enter value 1:")) y=int(input('enter value 2:')) small= min(x,y) big=max(x,y) print("GCD is",gcd(big,small))
true
be02f0ab7b5fde035f7001a0b8dd4f5de0c33f7b
GSS-Cogs/HO-asylum
/Refugees resettled(As_19_q).py
UTF-8
5,950
2.8125
3
[]
no_license
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.2.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # Table as_19_q: Refugees (and others) resettled, inclu...
true
5ee18aa72f17713f4450ffd27ee2deade49bdab3
Mickey1964/antevents-python
/tests/test_iterable_as_publisher.py
UTF-8
1,473
2.53125
3
[ "Apache-2.0" ]
permissive
# Copyright 2016 by MPI-SWS and Data-Ken Research. # Licensed under the Apache 2.0 License. """Test of IterableAsPublisher. This was originally test_base.py, but we then added the sensor infrastructure and rewrote the test. This test verfies the specific IterableAsPublisher code. """ import asyncio import unittest fr...
true
23ab23e58b5d3c8f53d82070305ae3d2392bffda
eselyavka/python
/leetcode/solution_108.py
UTF-8
1,378
3.515625
4
[]
no_license
#!/usr/bin/env python import unittest class TreeNode(object): def __init__(self, val): self.val = val self.left = None self.right = None class Solution(object): def sortedArrayToBST(self, nums): """ :type nums: List[int] :rtype: TreeNode """ if...
true
208b549a2c5e1acb7b96194f0da9192b2b2de0ea
neeru0303/learnings
/python/basic/while.py
UTF-8
64
3.21875
3
[]
no_license
a,b=0,1 n=1 while a<50: n=n+1 b,a=a+b,b print("%d" %b)
true
ee3407f64d892663c1bbe2b482722c549f08dbc7
JeffTheHacker/Eye-movement-behavior-during-autonomous-vehicle-human-interaction
/video_detection.py
UTF-8
1,544
2.59375
3
[]
no_license
#from object_detection_applied_using_KITTY import processImages from object_detection_applied_using_resnet import processImages from video_to_frames import convert import pickle import cv2 imgArr = [] dictArr = [] finalTable = [] #convert("/Users/jeffhe/Desktop/commitments/urap/week 1/world.mp4","/Users/jeffhe/Desktop...
true
ee29b13eba14501adaf3cce3b5b7784186236dff
JanaRankova/BookEnthusiast
/app/forms.py
UTF-8
1,302
2.6875
3
[]
no_license
from flask_wtf import FlaskForm, Form from wtforms import PasswordField, StringField, SubmitField, BooleanField, TextAreaField, FileField from wtforms.validators import DataRequired, Length, EqualTo, Optional from .models import User class RegistrationForm(FlaskForm): username = StringField( 'Name:', val...
true
0b67824af0bea9879cb3fd04d98f25e5074bc300
MrHamdulay/csc3-capstone
/examples/data/Assignment_5/mshivh001/question1.py
UTF-8
1,511
4.46875
4
[]
no_license
#A function that a simple BBS with one stored message and 2 fixed files #Maisha Ivha #15 April 2014 #the welcoming message def BBS(): print("Welcome to UCT BBS") print("MENU") print("(E)nter a message") print("(V)iew message") print("(L)ist files") print("(D)isplay file") print(...
true
15bc0df9b79e6d2affda4f726cc2f8791d0e90a0
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_209/95.py
UTF-8
1,389
2.78125
3
[]
no_license
file = open("c:/CodeJam/2017/R1/A-large.in") line = file.readline() from math import pi ## Number of Test Cases: 1<=T<=100 T=int(line) ## Tests each case for testcase in range(T): [n,k] = file.readline().split() # N = Number of Pancakes Available N=int(n) #print('N= '+n) # K = Number...
true
c92e67f004f8e0aa5e530d729d5cf9398cf34d22
ryszard/django-haystack
/haystack/sites.py
UTF-8
6,034
2.53125
3
[ "MIT", "BSD-3-Clause" ]
permissive
from django.db.models.base import ModelBase from haystack.exceptions import AlreadyRegistered, NotRegistered, SearchFieldError try: set except NameError: from sets import Set as set class SearchSite(object): """ Encapsulates all the indexes that should be available. This allows you to registe...
true
71528136cdcfd94923e7ce2982bf5014a9b5654b
Mo0dy/My12Steps
/12Steps/Steps/Step_11_NavierStokes.py
UTF-8
3,760
2.625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import pygame as pg from Viewer import render_scale nx = 81 ny = 81 nt = 500 nit = 50 c = 1 dx = 2 / (nx - 1) dy = 2 / (ny - 1) x = np.linspace(0, 2, nx) y = np.linspace(0, 2, ny) rho = 1 nu = .1 dt = .001 u = np.zeros((ny, nx)) v = np.zeros((ny, nx)) p = np.zero...
true
d6ed4c5ef0c94845840c027a4e2b93ec356b091f
alexjj/crypto
/pools.py
UTF-8
7,117
3.109375
3
[]
no_license
import streamlit as st import altair as alt import pandas as pd import requests def get_prices(): price_url ='https://api.coingecko.com/api/v3/simple/price?ids=pancakeswap-token%2Cbinancecoin%2Cpancake-bunny&vs_currencies=gbp' response = requests.get(url = price_url) price_data = response.json() ...
true
eb2e82e3eecbe565ca17175beea3b59e2bb5d520
amineamich/PythonPractice
/ex17.py
UTF-8
180
3.34375
3
[]
no_license
tot=0 while True: line = raw_input() if line: inp=line.split(' ') if inp[0] == 'D': tot += int(inp[1]) if inp[0] == 'W': tot -= int(inp[1]) else: break print tot
true
3a992169ffe14bb767f967aac7dc909d1212c0f0
jethornton/coop3
/utilities.py
UTF-8
1,813
2.84375
3
[ "MIT" ]
permissive
import sys from time import monotonic_ns try: import RPi.GPIO as gpio gpio.setmode(gpio.BCM) gpio.setwarnings(False) OPEN = 0 CLOSED = 1 WAITING = 2 except: e = sys.exc_info()[0] print(f'error is {e}') class debounce(): def __init__(self, *args, **kwargs): if 'pin' in kwargs: self.pin = kwargs.get('pin'...
true
ad62c10c7e846dd8b2c1c6580d3b016f1b07f964
LangGong-aaaiden/CS632P-Project-1
/main.py
UTF-8
3,184
2.859375
3
[]
no_license
import os import time import argparse import logging # basic config logging.basicConfig(filename="log.txt", format='%(asctime)s %(message)s', filemode='a') logger=logging.getLogger(__name__) # set level logger.setLevel(logging.INFO) def get_file_size(file): ...
true
f7975c62a236b9af490875f63c311e849abb924c
BogdanVko/CS220
/PA2.py
UTF-8
2,637
4
4
[]
no_license
''' PA2: Truth tables and equivalence -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- For PA2 you will be provided with a function callf2(f,p,q) which will cal f(p,q), and with a main to test your code. You will implement two functions: eval_tt_f2(f) and equivalent(tt1,tt2). Read main to understand how the comma...
true