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
3a87654b83509299873f9cf033c7f7efcbb5350b
johndurde14/Python_Learn
/《Python编程从入门到实践》/08-函数/work_make_ablum1.py
UTF-8
445
3.296875
3
[]
no_license
#coding = utf-8 class MakeAblum(): def __init__(self): pass def make_ablum(self, singer, ablum, num = 10): """打印并返回字典""" cd = {'singer':singer.title(),'ablum':ablum.title(),'num':num} print(cd) return cd makeablum = MakeAblum() makeablum.make_ablum(singe...
true
ff275dfb0cab624205bd3c61c411f3afbe83dff5
CobanSoft/bert-semantic-search
/getTitles.py
UTF-8
1,068
2.90625
3
[]
no_license
from gazpacho import get, Soup import time productTitle = list() def get_article(url): """ This function return title list. """ urls = url html = get(urls) soup = Soup(html) titles = soup.find('h3', {'class': 'pn_v8'}, partial=True) titleList = list() for title in titles: ...
true
4ac22b8adc89dff68af0b0f1a83117c7b9e4ff37
tyblevins/api-sample
/household_api.py
UTF-8
3,892
3.140625
3
[]
no_license
import json import os import uuid import redis from flask import Flask, request, jsonify, abort from schematics.exceptions import DataError from schematics.models import Model from schematics.types import IntType, StringType, FloatType from schematics.types.compound import ModelType, ListType app = Flask(__name__) R...
true
8a9f3135ef2790cfe77f21161067300a50ee1da0
DecimBlade/CECS-274-Project-2
/1_1_merge_lists.py
UTF-8
2,193
4.375
4
[]
no_license
class Node: # constructor def __init__(self, data=None, next=None): # This initializes the variables in the Node class self.data = data self.next = next class LinkedList(): def __init__(self): # This initializes the variables in the LinkedList class self.head = None def inse...
true
afd277dc4c77f0371f0cdb57e4eee5e597cb6d7a
Aasthaengg/IBMdataset
/Python_codes/p03110/s176250926.py
UTF-8
230
3.03125
3
[]
no_license
(n), *l, = [list(s.split()) for s in open(0)] sum_m = 0 for x, y in l: # print(x) # print(y) x = float(x) if y == 'JPY': sum_m += x if y == 'BTC': sum_m += (x * 380000.0) print(sum_m)
true
122ff97b15b0b53eeba86952be3b2ab3608ba98e
drasmuss/spaun2.0
/_spaun/_networks/detect_change.py
UTF-8
2,901
3.015625
3
[]
no_license
import nengo from nengo.dists import Choice, Uniform def DetectChange(net=None, dimensions=1, n_neurons=50, diff_scale=0.3, item_magnitude=1, blank_output_value=1.0): # item_magnitude: expected magnitude of one element in the input vector if net is None: net = nengo.Network(label="De...
true
51c67fc271aeddd8e3c11c4b44417895f16e4812
Shivaum14/Pacman
/classifierAgents.py
UTF-8
5,350
3.15625
3
[]
no_license
# classifierAgents.py # parsons/07-oct-2017 # # Version 1.0 # # Some simple agents to work with the PacMan AI projects from: # # http://ai.berkeley.edu/ # # These use a simple API that allow us to control Pacman's interaction with # the environment adding a layer on top of the AI Berkeley code. # # As required by the l...
true
238b8c2178ad0e1babf5abb3ce32bd6eb343eaf5
SchiffFlieger/semantic-segmentation-master-thesis
/scripts/common/fix_label_interpolation.py
UTF-8
1,808
2.6875
3
[ "MIT" ]
permissive
import os import cv2 import numpy as np import scipy.spatial as sp from scripts.common.constants import LABEL_RGB_VALUES def validate_image(image): segments = [] for col in LABEL_RGB_VALUES: segments += [image == col] return np.all(np.logical_or.reduce(segments)) def fix_image_pixels(image, t...
true
c7d78e7c60b1ae8e660f34e9d3e2f82a47dcaeba
prankard/tuya-bulb-control
/tuya_bulb_control/bulb.py
UTF-8
16,124
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import colorsys from ._tuya_api import _TuyaApi from .exceptions import ModeNotSupported, FunctionNotSupported, ArgumentError class Bulb(_TuyaApi): """ Allows you to control the operation of your smart light bulb. :param client_id: your client i...
true
c76463efc85ac4ad07a8990e1deefefe027ad622
manicmaniac/Project_Euler
/python/Problem74.py
UTF-8
1,733
4.25
4
[]
no_license
# coding:utf-8 """ The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145: 1! + 4! + 5! = 1 + 24 + 120 = 145 Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it turns out that there are only three such loops that...
true
62482eb26b465185c7301587a6667e2b8fa18603
phttrang/MITx-6.00.1x
/Problem_Sets_3/Problem_2.py
UTF-8
1,834
4.84375
5
[ "MIT" ]
permissive
# Problem 2 - Printing Out the User's Guess # (10/10 points) # Next, implement the function getGuessedWord that takes in two parameters - a string, secretWord, and a list of letters, # lettersGuessed. This function returns a string that is comprised of letters and underscores, based on what letters in # lettersGuessed...
true
4a96d0e20b18b622d7a2830b7b086a3a956fabd6
ajakaiye33/pythonic_daily_capsules
/set_intersection.py
UTF-8
624
3.828125
4
[]
no_license
def all_common_element(lst1, lst2): """ Receives two list and return the elements common """ if isinstance(lst1, list) == True and isinstance(lst2, list) == True: sey1 = set(lst1) sey2 = set(lst2) fey = sey1.intersection(sey2) return fey else: return "Param n...
true
e9927426ffaaca5e3ff3873b3fd31ce1e65a8853
ofekluis/sonic_project_ss19
/sonic/eval.py
UTF-8
3,849
2.53125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def main(): global epsilons global epsilons4 global epsilons1 epsilons = ['Act 1 \u03B5= 0.3','Act 1 \u03B5= 0.5','Act 1 \u03B5= 0.7','Act 2 \u03B5= 0.3',' Act 2 \u03B5= 0.5','Act 2 \u03B5= 0.7','Act 3 \u03B5= 0.3','Act 3 \u03B5= 0.5','Act 3 \u03B5= 0.7'] epsilon...
true
220c3bf6ea6aee839cfa036bcbd1c314dc4ccdbd
vatsj/Gamer-bot
/src/gamer/players/types/RandomPlayer.py
UTF-8
314
3.15625
3
[]
no_license
from .Player import Player # to make random choices import random # inherits all but makeMove() fn from superclass class RandomPlayer(Player): def makeMove(self, gameState): game = self.game allMoves = game.getLegalMoves(game, gameState, self.turnNum) return random.choice(allMoves)
true
54e05c590a79a401a413af58bb6af369d9cfff8e
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_157/629.py
UTF-8
3,653
3.34375
3
[]
no_license
T = int(input()) class Quaternion(object): def __init__(self, val='0', one=0, i=0, j=0, k=0): self.one = one self.i = i self.j = j self.k = k if val not in ('1', 'i', 'j', 'k', '0'): raise ValueError('Initial values can only be one dimensional unit vectors or ze...
true
29deb8b926462e6219a216b42d5a75d58aadece5
DiyAI-robocar/wth4
/main.py
UTF-8
2,639
3.046875
3
[]
no_license
import time from threading import Thread import socket import os import json import math UDP_IP = "127.0.0.1" UDP_PORT = 2115 UDP_PORT_SEND = 2116 class WTH4: """ Class to update the map file """ def __init__(self): self.on = True self.map = None self.socket_data = None ...
true
712d90462098477ecaf01ac205e0bb6b7ac58cd1
bhardwajrizul/stopwatch-python
/stopwatch.py
UTF-8
1,302
2.953125
3
[]
no_license
from tkinter import * root = Tk() root.minsize(width=300, height=300) timer = False counter = -1 def start(): global timer, counter timer = True button.config(state="disabled") buttonstop.config(state="active") label.after(1000, incCounter) def incCounter(): global counter ...
true
7ed5b3b97d92bcf007d75443adefcacce89a0f40
Pegasus-01/DataCamp-works
/10-DataManipulationWithPandas/16-GroupBy2.py
UTF-8
503
3.53125
4
[ "Apache-2.0" ]
permissive
#part1 # Group by type; calc total weekly sales sales_by_type = sales.groupby("type")["weekly_sales"].sum() # Get proportion for each type sales_propn_by_type = sales_by_type / sum(sales_by_type) print(sales_propn_by_type) #part2 # From previous step sales_by_type = sales.groupby("type")["weekly_sales"].s...
true
21ab6c14d42fe2078df266d35a216fd05530027c
OlesiaBK/LisaChatBot
/Final Project/my_module/functions.py
UTF-8
6,175
3.3125
3
[]
no_license
"""A collection of function for doing my project.""" import apiai, json import ipywidgets as widgets from IPython.display import display # constant # list of items MENU = {"Cheese Cake": "$7","Coffee":"$3","Pancakes":"$5","Cookie":"$3"} #The idea of the basic structure of code set-up is coming from solkogan #(https:...
true
d75e66b454b94506ac4a0fe14ed7a2f035587d92
danbikle/py4us
/public/class07/sb17.py
UTF-8
448
3.1875
3
[]
no_license
""" sb17.py Ref: https://seaborn.pydata.org/tutorial/aesthetics.html#overriding-elements-of-the-seaborn-styles """ import seaborn as sns import numpy as np import matplotlib.pyplot as plt print(sns.axes_style()) def sinplot(flip=1): x = np.linspace(0, 14, 100) for i in range(1, 7): plt.plot(x, np.s...
true
ce4dfceb6aa52b09371ccee1999bb471d3798333
Dev-Jang/BAEKJOON-Algorithm
/단계별로 풀어보기/05. 1차원 배열/05. 나머지.py
UTF-8
100
2.765625
3
[]
no_license
#3052 n = [] for i in range(10): n.append((int(input()))%42) n = set(list(n)) print(len(n))
true
e2d08ccff26636cc009eb49d32ad62b4fa11e38a
Gaccobee/filternews
/run.py
UTF-8
1,966
3.140625
3
[]
no_license
import twitter import requests import random import time from thesaurus import Word from environment import TwitterEnv def setup_twitter_api(): api = twitter.Api(consumer_key=TwitterEnv['CONSUMER_KEY'], consumer_secret=TwitterEnv['CONSUMER_SECRET'], access_token_key=TwitterEnv...
true
251ed958db33d045c014d98205d244ca9e9f05ae
ryanGT/personal
/copy_based_on_EXIF_date.py
UTF-8
13,084
2.78125
3
[]
no_license
import photo_db, os, rwkos, shutil, re, glob, file_finder import time import pdb from file_finder import Image_Finder def find_all_photos(pathin): myfinder = Image_Finder(pathin) pathsout = myfinder.Find_All_Images() return pathsout def _build_path(year_str, month_str, day_str, \ root=No...
true
4165fb20e5fcd1ba40a8961526a141cc4a48175c
ehan77/Exercise-1
/mailing address.py
UTF-8
159
3.0625
3
[]
no_license
name = "Erica Han" address = "1004 Red Road" cityprovince = "Toronto, Ontario" zipcode = "Y3H1G75" print(name) print(address) print(cityprovince) print(zipcode)
true
e3db33e1c18978a027c1004a0097bf511520053e
prohealthbox/apn-formats
/apn/lookup.py
UTF-8
3,691
2.765625
3
[ "MIT" ]
permissive
import re from fuzzywuzzy import fuzz from apn import APNS states = ( 'Washington', 'Delaware', 'District of Columbia', 'Wisconsin', 'West Virginia', 'Hawaii', 'Florida', 'Wyoming', 'New Hampshire', 'New Jersey', 'New Mexico', 'Texas', 'Louisiana', 'North Carolina', 'North Dakota', 'Nebraska', 'Tennessee',...
true
c508df5da6ad6ad2bbfb77e4eaeb78f6e77f4143
melijov/course_python_essential_training
/hello-working.py
UTF-8
283
3.15625
3
[]
no_license
#!/usr/bin/env python3 def main(): x =42 print('Hello, world. %d' % x) # deprecated use format and {} instead print('Hello, World. {}'.format(x)) print(f'Hello, World. {x}') # this is the new way to use since version 3.6 if __name__=='__main__': main()
true
778f83fb190f9f506993aa577619a8e5caac4b21
MiguelMartinez20/Olnex-Portal
/portal/filters.py
UTF-8
662
2.671875
3
[]
no_license
from django.contrib.auth.models import User from .models import Employee import django_filters class EmployeeFilter(django_filters.FilterSet): name = django_filters.CharFilter(lookup_expr='icontains') lastname = django_filters.CharFilter(lookup_expr='icontains') address = django_filters.CharFilter(lookup_...
true
76e840b3bce8a99bd78cd3a1110eaeb7d610f818
anilkohli98/My-Assignments
/sorting/tempCodeRunnerFile.py
UTF-8
603
3.1875
3
[]
no_license
def main(): t=int(input()) while(t!=0): n=int(input()) a=list(map(int,input().split())) start=0 end=n-1 while(start<n-1): if(a[start]>a[start+1]): break start+=1 while(end>0): if(a[end<a[end-1]]): break end-=1 print(start,end) a2=a[start:end+1]...
true
3ede117131feaa9b05016e54891e52a12e65c0c2
TEAMROBOCON-MJCET/TRM
/2018/Autonomous_Robot/detect_colored_balls.py
UTF-8
6,307
3.640625
4
[]
no_license
#!/usr/bin/env python2.7 """ Code was used to detect the color of the Ball when the autonomous Robot recieved it from the Manual Robot. Successful color recognition initiated the recieve command on the Autonomous Robot """ # Intial Library Imports import cv2 import numpy as np import RPi.GPIO as GPIO # Setting up t...
true
14c14dd54ea3b64a5e9c60db21c79286ba692fd1
PBL-2016/apis
/utils.py
UTF-8
429
3.046875
3
[]
no_license
# coding: utf-8 # Utility functions written by Tamamu. # 2016-12-04 import cv2 def color_text(text, r, g, b): return "\033[38;2;{0};{1};{2}m{3}".format(r, g, b, text) def resize(img, size): if img.shape[1] < img.shape[0]: w = size h = int((size/float(img.shape[1]))*img.shape[0]) else: ...
true
ed15d3661a6f3c75188bb1f46532868c55d43e33
mrdo19111911/datascience_supplychain_practice
/Jupyternotebook_source/Section_18_seasonal_inventory/seasonal+inventory+answer.py
UTF-8
1,084
2.59375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 13 12:48:06 2020 @author: haythamomar """ import pandas as pd import inventorize as inv retail= pd.read_csv('twentyeleven.csv') retail['InvoiceDate']= pd.to_datetime(retail['InvoiceDate']) retail['date']= retail['InvoiceDate'].dt.strftime('%Y-...
true
7b15efab1a6295fe4146ff90dbdcf5662b4755db
BasdekD/fake-news-detection
/main.py
UTF-8
7,771
2.90625
3
[]
no_license
import utilities import feature_extraction import text_preprocessing import file_handling import conf from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import naive_bayes, model_selection, neural_network, tree, svm, ensemble import numpy as np from sklearn import preprocessing from time import pe...
true
a54ad82adb46bd1da0a789dcb5e3c1c1ca6b57d7
castargo/SarcDetectionRusModels
/sarcsdet/utils/mark_ling_feat.py
UTF-8
964
2.578125
3
[ "MIT" ]
permissive
from sarcsdet.configs.ling_feat_config import interjections, funny_marks def funny_marks_feature(text): text_set = (str(text)).split() return sum([text_set.count(x) for x in funny_marks]) def interjections_feature(text): text_set = (str(text)).split() return sum([text_set.count(x) for x in interject...
true
e25b61f5d83ea62ff6215a7bcefca958f3bab8fa
lexspirtes/recruitment_dash
/recruitment_analysis.py
UTF-8
4,402
2.921875
3
[]
no_license
import pandas as pd import numpy as np import plotly.graph_objs as go import psycopg2 import os import dash_html_components as html ''' #reading in data applicants = pd.read_csv('~/dev/play-dash/applicants.csv') #by bootcamp, online, or school ...
true
d6d2fd3ef0fd8643d18bd434ffbdce22d76c4eea
marykaykincaid/msds510
/src/archive/DateTime.py
UTF-8
912
4
4
[]
no_license
def month_string_to_number(string): """Convert month names to numbers.""" m = { 'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12 } s = ...
true
3e75c21d47bf1d8829b0645d832df75e5e6f2647
HomeroValdovinos/hello-world
/Cursos/devf/Lesson11/Infraestructura.py
UTF-8
2,186
2.71875
3
[]
no_license
# Encoding # -*- coding: utf-8 -*- class Infraestructura(object): def __init__(self, database, application, connection, ticket, users, port): self.database = database self.application = application self.connection = connection self.ticket = ticket self.users = u...
true
53e9cea350ac1c89364f3a04ce9a019950538d44
likgjava/apiTestGit
/mockdemo/test02.py
UTF-8
626
2.90625
3
[]
no_license
import unittest from unittest import mock def add(x, y): print("该方法还未写完...") return 0 def side_effect(*args, **kwargs): print("args=", args) return 9 class TestAdd2(unittest.TestCase): def test_add01(self): # mock add = mock.Mock(name="mock1", return_value=5, side_effect=side_ef...
true
0850b15498bd578763795702c15303bc8a1e6bc6
hsydamia/stock-market
/2-3-data-analysis-cleansing.py
UTF-8
2,409
2.984375
3
[]
no_license
import numpy as np import json import os import itertools import threading import time import sys from colors import bcolors companies = [ "maybank", "axiata", "cimb", "petronas", "sime darby" ] directories = [ 'data/cleaned', 'data/dirty' ] done = False def animate(): for c in itertools.cy...
true
b36d4538e07d18517eae5bcfc4e03c705d793209
dpaster52/bitfinex-api-python
/LendingStrategy.py
UTF-8
3,744
2.8125
3
[ "MIT" ]
permissive
''' Created: 2014-11-06 Author: Andrew Ahern ''' from decimal import Decimal from BFXinterface import LendBook from datetime import datetime from datetime import timedelta import sys maxLends = {'usd': Decimal(1000.00)} exchangeRate = Decimal(1) class LendingStrategy(object): ''' This class is used as strat...
true
6bf6b0be577f1d1bb4fea5e647a388f3fe8a441b
LinZLin/Interface_Test
/public/common/cm_excel.py
UTF-8
2,037
2.953125
3
[]
no_license
''' @Author: lzl ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┃ ┗━━━┓ ┃ 神兽保佑 ┣┓ ┃ 永无BUG! ┏┛ ┗┓┓┏━┳┓┏┛ ┃┫┫ ┃┫┫ ...
true
abe5592fa4ca33c8a04c401bcbfc39d95134f9bc
Marat200/python_task
/задание 1 к уроку 1.py
UTF-8
246
4.28125
4
[]
no_license
number = input('Введите число: ') sum = 0 prod = 1 for f in number: sum += int(f) prod *= int(f) print(f"Сумма цифр числа {number}: {sum}") print(f"Произведение цифр: {number}: {prod}")
true
65307d9013fa55f166c2c669bd7290547c4e986b
DavidFitoussi/InheritanceSample
/Person.py
UTF-8
1,433
3.125
3
[]
no_license
from enum import Enum class TypePerson(Enum): student = 1 worker = 2 class Person: def __init__(self,name ="ingonito", age = None , height = None ): self.name = name # if name != None else "incognito" self.age = age self.height = height def WhoIam(self): ...
true
65f164904ab663307cf6ee4c7227e98f452f0838
richiedjohnson/python3-rampage
/load_tester/LoadTester.py
UTF-8
2,569
3.078125
3
[]
no_license
import sys import requests import simplejson as json import datetime import time from enum import Enum import threading from collections import Counter Method = Enum('Method', 'GET POST PUT DELETE') current_milli_time = lambda: int(round(time.time() * 1000)) time_capture_lock = threading.Lock() times_captured = [] sta...
true
a59b1ec8a1e14b6255d2603b9f1b1abbebcd110d
anurocks1/cupy
/tests/cupy_tests/math_tests/test_window.py
UTF-8
341
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import unittest from cupy import testing @testing.parameterize( *testing.product({ 'm': [0, 1, -1, 1024], 'name': ['blackman', 'hamming', 'hanning'], }) ) class TestWindow(unittest.TestCase): @testing.numpy_cupy_allclose(atol=1e-5) def test_window(self, xp): return getattr(xp...
true
890084a68aa202536f17d16def4f93e4c8ddb1aa
carlosgregoriorodriguez/OpenCV
/basics/borders.py
UTF-8
934
2.625
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- # opencv 2.3.1 import cv2 if __name__ == "__main__": camera = cv2.VideoCapture(0) g,im = camera.read() while True: f,img = camera.read() #Python: cv2.copyMakeBorder(src, top, bottom, left, right, borderType[, dst[, value]]) → dst¶ cv2.imshow("BORDER...
true
aa3b0c8e32a77a1b9dc746aaf985f6ca1f0c1a60
christiantaggart/Software_Notes
/Data_Science/notes/numpy_prac2.py
UTF-8
2,256
3.328125
3
[]
no_license
import numpy as np # https://docs.scipy.org/doc/numpy/user/quickstart.html # py_list = list(range(1000000)) # # print(sum(py_list)) # np_arr = np.arange(1000000) # # print(np.sum(np_arr)) # alpha = np.array([1., 2., 3.,4.,5.,]) # print(alpha.shape) # print(alpha.dtype) # bravo = np.array([1, 2, 3, 4, 5, 6, 7], n...
true
4230c819a56443a5e7f1b5a366e03450c3fb9355
hklhkl123/YDJ_APP
/base/base_action.py
UTF-8
8,538
2.78125
3
[]
no_license
import time import allure from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait class BaseAction(object): def __init__(self, driver): self.driver = driver def click(self, loc): self.find_element(loc).click() def input(self, loc, text): ...
true
17a17c90ebd66dc22efce0adddc804d4a6703393
osmandi/programarcadegames
/Capítulo 14: Bibliotecas y módulos/grafica_lineas.py
UTF-8
543
4.28125
4
[ "MIT" ]
permissive
""" Aquí mostramos cómo establecer el estilo de línea y los símbolos. """ import matplotlib.pyplot as plt x = [1, 2, 3, 4] y1 = [1, 3, 8, 4] y2 = [2, 2, 3, 3] # Primer carácter: Estilo de línea # Elegir entre '-', '--', '-.', ':', 'None', ' ', ” # Segundo carácter: color # http://matplotlib.org/1.4.2/api/colors_ap...
true
d7b75f4557c43009220c0ce95c7ebd432c133241
Infomatyczni-pakerzy/ASD
/cw/ithorder.py
UTF-8
662
3.46875
3
[]
no_license
def partition(arr, start, end): pivot = arr[end] i = start for j in range(start, end): if arr[j]<=pivot: arr[j], arr[i] = arr[i], arr[j] i=i+1 arr[end], arr[i] = arr[i], arr[end] #return the current position of the pivot return i def select(arr, start, end, i): ...
true
c5f01e55ad8b6054af48a51d043898f554bc6d02
heYeCheng/dataMining
/common/HuffmanCoding.py
UTF-8
3,099
3.28125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- '''auth HeYecheng fshyhyc@gmail.com 2015 - 04 -14 本算法是 哈夫曼编码算法 核心是找出最小的两个数作为最低等的结点,合并之后插入列表中,然后不断递归这个程序 ''' # http://blog.csdn.net/liufeng_king/article/details/8720896 # http://www.cnblogs.com/Jezze/archive/2011/12/23/2299884.html class Node(object): """docstring f...
true
2c540818a18198aa9376ed7b515f00bb3ad87b2d
PuppiesAndKitties/PythonMachineLearning
/ch3_scikit_learn_script.py
UTF-8
5,667
3.234375
3
[]
no_license
''' 逻辑斯蒂回归、线性支持向量机、核SVM、决策树、随机森林 ''' from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn import datasets import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import Perceptron from skle...
true
b001e0da85828314ca01df511dc8899e60d15ab8
rogeriosilva-ifpi/adsi-algoritmos-2016.1
/atividade_f/Atividade_F - Luiz Júnior, Mariano Barbosa/Questao24_Lista04.py
UTF-8
628
3.71875
4
[]
no_license
def Questao24_Lista04(razao, primeiro_termo, Numero_Termos): cont = 0 PA = primeiro_termo while cont < Numero_Termos: if cont == 0: print "primeiro termo: %.2f" % primeiro_termo cont += 1 PA += razao print "termo seguinte: %.2f" % PA ...
true
60c2929d8ef8c9842375a4f4edda9dc8c896e2b5
thomaschoi666/chatbot_faq
/FAQ_function.py
UTF-8
6,400
3.09375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[ ]: import numpy as np import matplotlib.pyplot as plt import pandas as pd import string from keras.models import Model from keras.layers import Dense, Input, Dropout, LSTM, Activation from keras.layers.embeddings import Embedding from keras.preprocessing import sequence ...
true
90200e5d8b24c80f4464dad9270a8cf21953b18c
docxed/codeEjust
/[Midterm 2019] Stair.py
UTF-8
741
3.375
3
[]
no_license
"""main""" def main(): """main""" height = int(input()) level = int(input()) cnt, keep, tmp = 0, 0, 0 while 1: if cnt == level: break val = int(input()) if val > height: print("NO") return elif tmp > 0 or val < height: i...
true
d17f96f3be9081c1491cd78ad8462f0b8810b115
teraspora/python-utils
/partitioning.py
UTF-8
1,154
3.75
4
[]
no_license
# partitioning.py class Klist: """ A list with a key """ def __init__(self, list, key): self.list = list self.key = key def partition(arr, func): """ Return a list of lists, being partitions of set(arr) according to the provided function. """ plist = [] keys = s...
true
fc61035cf6b0a16ff9fe8f1c5f5e838397734b0b
teslastine08/py_nielit
/programs/si.py
UTF-8
256
2.984375
3
[]
no_license
def eliza(c): print("Hi {}".format(c)) eliza("Ankan") pas={"Ankan":12345} i=int(input("enter pass: ")) if (i==12345): print("Access") print("enter the no :") x=int(input()) x=x**3 print(x) else: print("Access denied")
true
1391979769853e93997408ded9e6e77a74e41081
maxx1256/scripts
/slideshow/config.py
UTF-8
1,386
2.546875
3
[]
no_license
import configparser import const class Config(object): def __init__(self, configfile): c = configparser.ConfigParser() if configfile is None: c.read(const.Config.FileName, encoding='utf-8') else: c.read(configfile, encoding='utf-8') self.Work...
true
05615aee333f9cce007e69d0e2e8892e35318fc4
shermannatrix/python-dev
/Supercharged_Python/CH04_shortcuts_cmdline_pkg/func_decorators.py
UTF-8
403
3.296875
3
[]
no_license
import time def make_timer(func): def wrapper(*args, **kwargs): t1 = time.time() ret_val = func(*args, **kwargs) t2 = time.time() print('Time elapsed was', t2 - t1) return ret_val return wrapper @make_timer def count_nums(n): for i in range(n): for j in rang...
true
9f3b72b4396794dcae1363d05868759dae556712
jerbob/cyberspeedrun
/python/main.py
UTF-8
2,159
2.953125
3
[]
no_license
from json import load from re import compile from time import time from threading import Thread from requests import Session csrf_pattern = compile(r'name="csrf" value="([a-z0-9]+)"') go_endpoint = 'https://go.joincyberdiscovery.com' with open('../solutions.json') as file: solutions = load(file) session = Sess...
true
d26399306463f27356bb606a3666bb3b45ea245d
amrithm98/NP-Lab
/Expt8_UDP_Chat/client.py
UTF-8
375
2.78125
3
[]
no_license
import socket sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) server = ('127.0.0.1',3000) n = 0 try: while n == 0: msg = raw_input("Enter Data: ") sent = sock.sendto(msg,server) print("Waiting for resp") data,server = sock.recvfrom(4096) print("Received Data: "+data) n=input("1 to exit or 0 to con...
true
a94ebca0b2b7c587f97d28e08318ada013af3142
FinnStokes/elevation
/src/main.py
UTF-8
10,091
2.515625
3
[]
no_license
# Cosplay Chase # A top-down stealth game import itertools import argparse import cProfile import os import pygame from pygame.locals import * import entity import platform import world import lift ONEONSQRT2 = 0.70710678118 def main(): # Initialise screen pygame.init() screen = pygame.display.set_mod...
true
4fd625aa4a0d8dad9d6ef336ba22bee679d23d20
smqh-smqh/lecture
/人工智能实践/p20.py
UTF-8
480
3.09375
3
[]
no_license
# softmax与交叉熵损失函数的结合 import tensorflow as tf import numpy as np y_ = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 0, 0], [0, 1, 0]]) y = np.array([[12, 3, 2], [3, 10, 1], [1, 2, 5], [4, 6.5, 1.2], [3, 6, 1]]) y_pred = tf.nn.softmax(y) E1=tf.losses.categorical_crossentropy(y_,y_pred) E2 = tf.nn.softmax_cross_...
true
a000f7984cac5fa47b5d21f706701e24e46b2ed3
natashamjaques/ray
/kubernetes/example.py
UTF-8
1,168
2.65625
3
[ "Apache-2.0", "MIT" ]
permissive
from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import Counter import sys import time import ray if __name__ == "__main__": # Note that if you run this script on a non-head node, then you must # replace "localhost" with socket.getho...
true
af42bf8abfb614db69408a47e28c3cdb18779eb3
Breakfast404/WebWizKidz
/Assignment_01/information_extraction.py
UTF-8
2,276
3.546875
4
[]
no_license
# coding: utf-8 # In[4]: import spacy # In[5]: nlp = spacy.load('en') persons = [] pets = [] trips = [] # In[6]: #Takes file def process_data_from_input_file(file): text = open(file, 'r') cleanText = [] for line in text: if not line[0].startswith(('$', '#','=')): cleanText.a...
true
f690c41c2d6fdfd24bfdec37c0090b80a1b5c202
maxbyk/PeakCleaner
/Widgets/DWidget.py
UTF-8
1,367
2.609375
3
[]
no_license
from PyQt5.QtWidgets import QWidget, QTableWidgetItem from qtpy import QtGui from Widgets.DspacingsWidget import Ui_DSpacings from PyQt5 import QtGui class DspacingsWidget(QWidget): def __init__(self, data): QtGui.QWindow.__init__(self) self.ui = Ui_DSpacings() self.ui.setupUi(self) ...
true
558fb44433059250124e4a47d73628062fd8266c
LSSTDESC/txpipe-reanalysis
/notebooks/cosmosis_functions.py
UTF-8
9,629
2.5625
3
[]
no_license
import numpy as np import pylab as mplot import os import scipy import pandas as pd from getdist import plots, MCSamples from chainconsumer import ChainConsumer import matplotlib.pyplot as plt import sys sys.path.append('/Library/Python/2.7/site-packages') from chainconsumer import ChainConsumer Color = ['#d45e00',...
true
0b07978d24d79ef927e421b67f8c4673cb0e12bc
Carouan/UNamur
/_UNamur/exo 8.py
UTF-8
798
3.984375
4
[]
no_license
## exo 8 amount = float(input("Montant a convertir : ")) currency = input("Monnaie de départ : ") taux = 1.12586 chg = flaot(input("Taux de change : ")) def currency_conversion (amount, currency,chg) : ## """ Specification de la fonction ## Paramètres ## --------- ## amount : amount to convert (flo...
true
775a20b5c516d64b42afd81899d6dcb9590575a9
prositen/advent-of-code
/python/test/y2020/test_dec17.py
UTF-8
446
2.6875
3
[]
no_license
import unittest from python.src.y2020.dec17 import Dec17 class TestDec17(unittest.TestCase): def test_active_cubes_3d(self): state = [".#.", "..#", "###"] self.assertEqual(112, Dec17(instructions=state).part_1()) def test_active_cubes_4d(self): stat...
true
dacac139cb28ebcbbd97d275653fc10ac79819d1
SubhoBasak/CodingProblems
/Solved/Problem#90/Solution.py
UTF-8
625
3.75
4
[]
no_license
class iterator: def __init__(self, arr): self.arr = arr if len(self.arr) != 0: self.cur_item = self.arr.pop(0) def next(self): if len(self.cur_item) != 0: return self.cur_item.pop(0) elif len(self.arr) != 0: self.cur_item = self.arr.pop(0) ...
true
1790037aafded851870c1e4b0a436748809cb9f0
salwaalkhatib/CamVid19
/server/server_chat.py
UTF-8
2,091
3
3
[]
no_license
from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import time from person import Person buffer_size = 512 host = '127.0.0.1' port = 8888 address = (host,port) server = socket(AF_INET, SOCK_STREAM) server.bind(address) max_connections = 10 persons = [] def broadcast(message,name): for p...
true
ed35fab99140fb5404f595d54e1d4034d7535466
Aasthaengg/IBMdataset
/Python_codes/p03285/s773137041.py
UTF-8
223
3.46875
3
[]
no_license
n = int(input()) xmax, ymax = n//4, n//7 ok = False for x in range(0, xmax+1): for y in range(0, ymax+1): if n == 4*x + 7*y: ok = True break if ok: break print("Yes" if ok else "No")
true
5bbb29fe82539befd67e482ae700b8a5c232b95c
vatsaashwin/Adaboost-DecisionTree-RandomForest
/randomForest.py
UTF-8
1,219
3.296875
3
[]
no_license
import numpy as np from decision_tree import DecisionTreeClassifier from treeFunc import createTree, predictLabel # import time def createForest(m, n, d, data): # m: Number of features for a tree; n: Number of trees; d: Depth of each tree print("Number of features, m = {}".format(m)) print("Number of trees, n = {}"...
true
aeb4f2ec6d0897af919891c88ba6171c5253b1f9
Vaild/python-learn
/homework/20200707/63_字符串的输出.py
UTF-8
174
3.125
3
[]
no_license
#!/usr/bin/python3 # coding = UTF-8 def Out_put(phone): str = 'Mobile:' + phone return str phone_number = input('输入电话号码:') print(Out_put(phone_number))
true
33e0614a56b0a630117a6fcb84344438f6f0225d
gammasoft71/Examples_Python
/tkinter/SaveFileDialog/SaveFileDialog.py
UTF-8
1,202
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*-coding:utf-8 -* import os import platform import tkinter import tkinter.filedialog import tkinter.ttk class Form1(tkinter.Tk): def __init__(self): super().__init__() self.frame = tkinter.ttk.Frame(self) self.frame.pack(fill = tkinter.BOTH, expand=1) self.button = tkinte...
true
2829435e07de379898804a16c2502da82f592056
wandadars/stream_scripts
/lagrangian_particle_post_processing/particle_histogram_tools/droplet_pdf_comparison.py
UTF-8
10,972
2.8125
3
[]
no_license
#! /usr/bin/env python #### import modules import math import matplotlib import matplotlib.pyplot as plt import numpy as np import os from scipy import stats import sys import time from droplet_histogram_tools import particle_histogram from utilities import * if len(sys.argv) <2: print 'Error: M...
true
361b716c1a8aaf6161537bb8825c1f6542bebd3a
toscawidgets/tw2.d3
/tw2/d3/widgets.py
UTF-8
3,734
2.796875
3
[]
no_license
""" tw2 widgets that make use of `d3 <http://mbostock.github.com/d3/>`_. """ import simplejson import uuid import warnings import tw2.core as twc import tw2.jquery as twj modname = '.'.join(__name__.split('.')[:-1]) d3_js = twc.JSLink( modname=modname, filename='static/js/2.8.0/d3.v2.js', ) class D3Widget...
true
02b544ce5a3f68fd87a7b3472439cf2a05215096
DavidHuarino/codeSignal_interviewPractice
/Trees_Basic/findSubstrings.py
UTF-8
1,290
3.5
4
[]
no_license
class TrieNode: def __init__(self): self.children = {} self.isEnd = False class Trie: def __init__(self): self.root = TrieNode() def insert(self, word): current = self.root for el in word: if el not in current.children: current.children[el]...
true
476525125a70e6b732df2e040e4e72e456d1b99f
Girundi/face-recognition
/db.py
UTF-8
1,253
2.578125
3
[]
no_license
import sqlite3 import click from flask import current_app, g from flask.cli import with_appcontext import os def get_db(): try: if "db" not in g: g.db = sqlite3.connect( "sqlite_db", detect_types=sqlite3.PARSE_DECLTYPES ) g.db.row_factory ...
true
a46f929c9bc0c3d15d212d0bec88f08a6331ad29
sadatrafsanjani/MIT-6.0001
/Lec02/for.py
UTF-8
123
3.609375
4
[]
no_license
sum = 0 for i in range(5, 11): sum += i print(sum) print("\n") for i in range(1, 10, 3): print(i)
true
5acfd58f2110da39de26ce68beb79d9cac1f5b9f
sungwoncho94/SWexpert
/intermediate/day_07/5110수열합치기_7일.py
UTF-8
685
3.234375
3
[]
no_license
T = int(input()) for t in range(1, T+1): # N = 수열의 길이, M = 수열의 개수 N, M = map(int, input().split()) origin_list = list(map(int, input().split())) result = [] for m in range(M-1): # list 2, 3, 4를 받는다 input_list = list(map(int, input().split())) for n in range(len(origin_li...
true
34538b9131a45002359c9c6a75db14a2a13ee8b2
yiboyang/PyVB
/pyvb/sampling.py
UTF-8
2,684
3.15625
3
[ "BSD-3-Clause" ]
permissive
import numpy as np from numpy.random import randn from scipy.linalg import inv, cholesky def mixture_data(pi,m,cv,n=1000): """ sample data from Gaussian Mixture input pi [ndarray, shape (nmix)] : mixing coefficients m [ndarray, shape (nmix x dim)] : parameter of mean S [ndarray, sh...
true
2ab7e327e18f5ca8a8fbe3675b38898312787db8
Dimas-Curti/alg_fht
/fht/main.py
UTF-8
5,422
2.703125
3
[]
no_license
from fht.core.signature import * from interfaces.db_interface import * from interfaces.json_interface import * from interfaces.gui_interface import * import os MARGIN_OF_DIFF = 5 class Main: def __init__(self, input_file, offset, reset_database): self.input_file = input_file self.offset = offset ...
true
f0771284fb3e2605ba07af7db0303800dab90b60
vpjuguilon/AppPhysics155
/chapter 8 exercises/exercise 8.3.py
UTF-8
919
3.03125
3
[]
no_license
from numpy import array, arange from matplotlib.pyplot import plot, xlabel, show, legend def f(r, t): x = r[0] y = r[1] z = r[2] sigma = 10 R = 28 B = 8/3 fx = sigma*(y-x) fy = R*x - y - x*z fz = x*y - B*z return array([fx, fy, fz], float) a = 0.0 b = 50.0 ...
true
9d9bdcb6531ce7275b14fc8b121440d38a12ee1b
craighillelson/daily_focus
/functions.py
UTF-8
2,351
3.359375
3
[]
no_license
"""Functions.""" import csv import datetime from datetime import datetime from datetime import (date, timedelta) import pyinputplus as pyip target_date = date(2021, 8, 7) todays_date = date.today() date_tasks_to_add = {} dates_tasks = {} def days_out(num_days): """Find the date a given num...
true
6987b8020ecab4559bfa6afa84e43264d755e03f
https-seyhan/MachineLearning
/XGBoost/XGBRegressor.py
UTF-8
2,258
3.078125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: saul """ #XGBoost Regression with Decision Trees import pandas as pd import numpy as np import xgboost # XGBoost module import os from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder # Encode target labels with va...
true
2128f66bb678468d7efe57c0790327840005e8ba
Nisarg-S/coop-fall-2020-challenge
/solution_python.py
UTF-8
2,100
3.328125
3
[]
no_license
class EventSourcer(): # Do not change the signature of any functions def __init__(self): self.value = 0 # holds value of num at a moment in time i.e action1, action2 etc.. self.history = [] # holds the differential values (i.e current value - previous value) for the redo queue (...
true
6d303369851e8f0b3ba1eefa26a6c72650877abb
glotars/detection-experiments
/fpn/bifpn.py
UTF-8
4,208
2.546875
3
[ "Apache-2.0" ]
permissive
import torch from collections import OrderedDict from torch import nn class SoftMaxWeightedSum(nn.Module): def __init__(self, op_number=2): super(SoftMaxWeightedSum, self).__init__() shape = (op_number, 1, 1, 1, 1) self.weights = nn.Parameter(torch.ones(shape), requires_grad=True) def forward(self, x): r...
true
3f879e1c39200a3ece5731b0f4c39ebe82cb582a
Pexet/ChervonyiPaulHomeWorkPMI23Pyrhon
/python_1sem/practice/VirobnichaPrktika1.py
UTF-8
951
3.84375
4
[]
no_license
def finding_currentnum(a): n = 1 while True: if ((n**n)%a)==0: break else: n+=1 print(n) pass # провірка на те чи введене число А є в [1-109] def getNumber(): # inputing and ckecking number method while type: getTempNumber=input() ...
true
2da4861e399b73faaf6448f3f4a65aaaf123db12
jes5918/TIL
/Algorithm/BEAKJOON/2231_분해합.py
UTF-8
172
3.171875
3
[]
no_license
N = int(input()) flag = True for i in range(int(N/2), N): if sum(map(int, str(i))) + i == N: print(i) flag = False break if flag: print('0')
true
7d382e88904ed3cbdac78231670f75568673eecb
Isopodus/Wroombian
/flash/lib/modules/standard_commands.py
UTF-8
19,740
2.640625
3
[ "MIT" ]
permissive
import os import gc import machine import sys from pye import pye from wifi import Wifi import json import _thread as thread from command.command import Command from command.commands_module import CommandsModule from colors import * from wifi import Wifi def makeTab(line:str, size=25): return ' ' * (size - len(li...
true
ccf05779b3894fb8c32ef13aab3d1748e042b66d
lufovic77/DLfromScratch
/CH2_perceptron/logic.py
UTF-8
1,190
3.59375
4
[]
no_license
import numpy as np class logic: def __init__(self): print("initialized") def AND(self,x1,x2): x = np.array([x1, x2]) w = np.array([0.5, 0.5]) b = -0.7 tmp = np.sum(x*w)+b if(tmp<=0): return 0 else: return 1 def OR(self,x1,x2): ...
true
05fb6df0ff7b7d799505b2d8a6291e3a8e8d1b96
goldsmith777/smartAgent
/acceleration/ACC_Bayes.py
UTF-8
3,571
3.390625
3
[]
no_license
#coding=utf-8 ######################################### # ACC_Bayes: 贝叶斯 # 用法说明:读取文件 # 输出分类准确率 ######################################### import math import numpy as np from numpy import * import random def separateByClass(dataset): # 将训练集按照类标号进行划分,返回字典形式 separated = {} for i in range(len(dataset))...
true
a89f5b3aa0e47189f0e1d4f027a7d80ae6aa1c16
jtwangac/HFC_simulations
/expr_competitive_scores.py
UTF-8
2,486
2.84375
3
[]
no_license
import numpy as np import scores as sc # source: scores.py import matplotlib.pyplot as plt # Set the outcome and participant d = 2 # # of realizations of outcome n = 4 # # of participants # Generate the ground truth distribution of the outcome p_truth = np.random.dirichlet(np.ones((d,))) # Generate participants' ...
true
0ed97600a934a91e17d756b8ca2b0ce40291ca89
wouterkessels/PREDICTFastr
/.eggs/xnat-0.2.2-py2.7.egg/xnat/datatypes.py
UTF-8
4,221
2.546875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Copyright 2011-2015 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
true
e15cc86baeb0ae26eeb4dcf8567a869179bb1a52
civrev/PythonTutorials
/Databases/census4.py
UTF-8
1,336
3.421875
3
[]
no_license
#census4.py #based on a course I got from DataCamp.com "Introduction to Databases in Python" #SQLite, SQLAlchemy+Pandas, plotting results import pandas as pd import matplotlib.pyplot as plt from sqlalchemy import create_engine, Table, MetaData from sqlalchemy import select, or_, and_, not_, desc from sqlalchemy import...
true
a2d9ea7b1d56b7bb05b89e74c37c2f864dc96b99
linetools/linetools
/linetools/analysis/interactive_plot.py
UTF-8
20,462
2.546875
3
[]
no_license
""" Classes for making interactive plots. """ from __future__ import division, print_function, unicode_literals, absolute_import import os import numpy as np from ..utils import between, loadjson, savejson from ..spectra.convolve import convolve_psf from ..spectra.plotting import get_flux_plotrange from ..guis import ...
true
28f2811f36b5a138b52371d7896e4759196823b8
deanconnell1999/kattis
/Bela.py
UTF-8
563
3.25
3
[]
no_license
inp = input().split() hands = int(inp[0]) dom = inp[1] tot = 0 for i in range(4 * hands): card = input() num = card[0] suit = card[1] if num == "J" and suit == dom: tot = tot + 20 elif num == "9" and suit == dom: tot = tot + 14 elif num == "A": tot = tot + 11...
true
ec609a01a7f58b6af5e4b1166d747d2ac235394a
rtanvr/pathon
/text/piglatin.py
UTF-8
416
4.3125
4
[]
no_license
#Returns string in pig latin vowels = 'AaEeIiOoUuYy' class StringMan(): def piglatin(self, string): pig = string.split() x = 0 for char in pig: if char[0] in vowels: char += '-yay ' else: char = char[1:len(char)] + char[0] + 'ay ' pig[x] = char x += 1 return "".join(pig) if __name__ ==...
true
094a78d92e18e14477dec0dd7bdd900f5a863a97
TheChanRProject/PieranDataAssistance
/Learner/string-verse.py
UTF-8
68
2.90625
3
[]
no_license
a = 'abcdefg' print(''.join([a[i] for i in range(len(a)-1,-1,-1)]))
true
b59859124e32d19e92f1fea29f40bc73edadabc0
AriTheGuitarMan/AI-Pacman
/AI Pacman Challenge Part 3/tracking/bustersAgents.py
UTF-8
12,690
2.5625
3
[]
no_license
# bustersAgents.py # ---------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkel...
true