blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
5585962927a8633bfc95255a3f3a7a2981608139
Python
devil-cyber/Handling-Categorical-Variable
/categorical_variable_handling/hello.py
UTF-8
254
3.0625
3
[ "MIT" ]
permissive
import pandas as pd from categorical_variable_handling import CategoricalFeature c=['m','p'] data=pd.read_csv('data.csv') cat=CategoricalFeature(data,categorical_features=c,encoding_type='binary',handle_na=True) output=cat.fit_transform() print(output)
true
2641aa3f31b5f44d3d50010d6c9eea32cbac0b14
Python
error404compiled/py-mastr
/Debugging/debugging.py
UTF-8
205
3.984375
4
[]
no_license
def add_num(a,b): '''Return sum of two numbers''' s=a+b return s n1=input('enter first number:') n1=int(n1) n2=input('enter second number:') n2=int(n2) s = add_num(n1,n2) print ('sum is: ',s);
true
04b216ac354f4e5b2696da1dc78d1cae9d1930e8
Python
sundongxu/machine-learning
/python/lib/sklearn/classification/decision-tree.py
UTF-8
2,998
3.328125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: skip-file # 导入pandas用于数据分析 import pandas as pd # 利用pandas的read_csv模块直接从互联网上收集泰坦尼克号乘客数据 titanic = pd.read_csv( 'http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt') # 观察前几行数据,发现数据各异,数值型、类别性,甚至还有缺失值missing value titanic.head() # 使用pandas,数据都...
true
b1aa421e2be470558f4c9e484e51b0c81f133947
Python
WhistleSpread/Crawler
/百度文库/Spider_D_txt.py
UTF-8
1,303
2.609375
3
[]
no_license
import requests import re import argparse import sys import json import os parser = argparse.ArgumentParser() parser.add_argument("url", help="Target Url,你所需要文档的URL",type=str) parser.add_argument('type', help="Target Type,你所需要文档的的类型(DOC|PPT|TXT|PDF)",type=str) args = parser.parse_args() url = args.url type = args.ty...
true
936192bf7599601a50d17f82a39fb1f783904a28
Python
KatrinaWalker/text_mining
/PS1/code.py
UTF-8
10,579
3.25
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 8 07:51:31 2017 @author: k2 """ import numpy as np import matplotlib.pyplot as plt import pandas as pd import nltk import string #nltk.download() # A box will pop up - download all- will take a little time data_origin = pd.read_table("speech_da...
true
4bcca6f9078f7d4d5948e4f0bea531ff8929a067
Python
siddhant68/Cool_Coding_Questions
/overlapping_time_intervals.py
UTF-8
325
3.421875
3
[]
no_license
intervals = [] for _ in range(int(input())): l, r = [int(x) for x in input().split()] intervals.append([l, r]) intervals.sort(key=lambda x: x[0]) ans = 1 for i in range(1, len(intervals)): j = i-1 while j >= 0: if intervals[j][1] > intervals[i][0]: ans += 1 break print...
true
02aa8b8d2db96df9491ae75e06be7ac89135dab6
Python
nr-patel/NP-SDC-T3-P4-Capstone-Project
/ros/src/tl_detector/tl_detector.py
UTF-8
7,877
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python import rospy from std_msgs.msg import Int32, Float32MultiArray from std_msgs.msg import MultiArrayDimension, MultiArrayDimension from geometry_msgs.msg import PoseStamped, Pose from styx_msgs.msg import TrafficLightArray, TrafficLight from styx_msgs.msg import Lane from sensor_msgs.msg import Imag...
true
567f4f1cb4aa90492da71848c5d48d38ef99493f
Python
zjma/codegames
/cf1400/a.py
UTF-8
129
3.265625
3
[]
no_license
tn=int(input()) for ti in range(tn): n=int(input()) s=input() ans=''.join([s[i*2] for i in range(n)]) print(ans)
true
85dc110054809a06c137ad3228b9aca0f54f3e38
Python
ElenaR1/Python-101
/find-all.py
UTF-8
3,918
3.046875
3
[]
no_license
#Task 2 found_values=[] def deep_find_all(data, key): for k,v in data.items(): #print('k:',k,"v:",v) if k==key: found_key=True #found_values.append(v) #print('found; ',found_values) return v #return found_values elif isinstance(v,...
true
0170a78243442ff40ac0ea18e7fcb83e59e149db
Python
nickmezen/wingsfly
/Main.py
UTF-8
727
2.8125
3
[]
no_license
__author__ = 'Galaxcity' from math import exp from math import sqrt y=5126 x=3020 y1=5178 x1=2945 y2=5094 x2=3087 a = 2 aa = 1 q = 6 P = 10000 l = 134 bb = 1 S = 100 d = sqrt((y1 - y2) * (y1 - y2)+(x1 - x2) * (x1 - x2)) dr = sqrt((((y1 - y2) * x + (x2 - x1) * y + x1 * y2 - x2 * y1)/d)*(((y1 - y2)...
true
9ba46a65822a633a14a92a6a3ac6cbe4ecdaa712
Python
daniel-reich/ubiquitous-fiesta
/q5jCspdCvmSjKE9HZ_4.py
UTF-8
151
3.484375
3
[]
no_license
def lcm_of_list(numbers): lcm = 1 while True: for i in numbers: if lcm % i != 0: break else: return lcm lcm += 1
true
9b43e862209595e7001da732ceafe917757ac524
Python
linzexi2001/firstjob
/031904118/mixtest.py
UTF-8
4,511
2.6875
3
[]
no_license
from Init import p import re def dealelse(line,wordList,line_copy,Word_Basic): ans='' for word in wordList: count = 0##循环次数计数 flag = 1##循环标记 while flag: ##判断是否还有需要输出的敏感词,没有则退出循环 line_noblank = re.sub(' ', '', line_copy) line_noblank = p.get_pinyin(lin...
true
76362668141d0235a9d9af50c7b381598c4298cd
Python
hardhatdigital/laser-drift
/laserdrift/websocket_race.py
UTF-8
1,800
2.546875
3
[ "MIT" ]
permissive
import lirc import logging import time import timeit class Race: DELAY = 0.009 WRITE_TIMEOUT = 0.028 READ_TIMEOUT = 0.75 def __init__(self): self.remote = "carrera" self.conn = None self.socket = "/usr/local/var/run/lirc/lircd" def __lirc_conn(self): return lirc.C...
true
db474102dbf401505246ab80aaa127b872e03a4d
Python
17614040741/apper_det
/eyeglasses/eyeglass_Detector.py
UTF-8
7,332
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ https://github.com/wtx666666/realtime-glasses-detection Created on Thu Aug 16 22:20:37 2018 @author: James Wu modified on 2019-4-12 by Gao *Requirements: python 3.6 numpy 1.14.0 opencv-python 3.4.0 dlib 19.7.0 """ import os import cv2 import dlib import numpy as np #===================...
true
626213a01d67f84a8f64019c42fd12e6aa1d11cf
Python
graphcore/examples
/vision/neural_image_fields/tensorflow2/predict_nif.py
UTF-8
4,660
2.703125
3
[ "MIT", "CC-BY-4.0", "CC-BY-2.0" ]
permissive
# Copyright (c) 2022 Graphcore Ltd. All rights reserved. import tensorflow as tf from tensorflow import keras import strategy_utils as su import argparse import cv2 import numpy as np import nif import os from ipu_tensorflow_addons.keras.optimizers import AdamIpuOptimizer from skimage import color, metrics if tf.__ve...
true
251334443de0676cf0074eabaa230ab806babf8f
Python
shektor/how-to-pytest
/inventory/inventory_test.py
UTF-8
2,613
3.390625
3
[]
no_license
import pytest from inventory import Inventory, InvalidQuantityException, NoSpaceException, ItemNotFoundException def test_default_inventory_initialisation(): inventory = Inventory() assert inventory.limit == 100 assert inventory.total_items == 0 def test_custom_inventory_limit(): inventory = Invent...
true
c2271e5427cfa749e1ca17200b02c9c213e8bcb4
Python
KasiaO/CollectiveRationality
/case2.py
UTF-8
3,017
3.046875
3
[]
no_license
# import import numpy as np import base import matplotlib.pyplot as plt # parameters to be set # t - int - number of runs of the simulation # n - int - number of agents # m - int - number of issues # l - int - number of clauses in the constraint # k - int - number of literals in each clause # kneg - int - n...
true
133061e29f381f8899205c366af68584f2019867
Python
haxiaocao/auto_python_tools
/time_task/send_email.py
UTF-8
2,464
3.15625
3
[]
no_license
#coding: utf-8 import smtplib import base64 #reference site: #https://www.tutorialspoint.com/python/python_sending_email.htm #https://automatetheboringstuff.com/chapter16/ # note : you should format the Header carefully, most of errors come from it. # For your programs, the differences between TLS and SSL aren’t imp...
true
a2a7ba4c5cf22ac13ce3c5082e79b0491a021e6f
Python
diji99/upl_learning
/OldBoy_Python-master/day10/reddis_pub.py
UTF-8
447
2.75
3
[]
no_license
#!/usr/bin/env python3 # coding:utf-8 ''' Created on: 2016年3月22日 @author: 张晓宇 Email: 61411916@qq.com Version: V1.0 Description: Redis订阅和发布演示程序,发布方 Help: ''' from redis_helper import RedisHelper # 导入刚才定义的Redis公共类 if __name__ == '__main__': obj = RedisHelper() # 创建redis公共类对象 while True: obj.public(i...
true
60cdb03c0ab3be92d3e25c7d0496c41028745569
Python
anqijing/udacity-catalog
/database_setup.py
UTF-8
2,136
2.875
3
[]
no_license
from sqlalchemy import Column, ForeignKey, Integer, String, Enum, Date, DateTime, Text, Boolean from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy import create_engine import random import string import os import sys # generate secret key secre...
true
0179d16f09c3246a3c20b8a05b8175a22904dcd8
Python
sagorbrur/Python
/Python_By_Anil_Kumar_A/Python_By_Anil_Kumar_A/Networking.py
UTF-8
310
3
3
[]
no_license
''' Syntax: 's = socket.socket (socket_family, socket_type, protocol=0)' ''' import socket s = socket.socket() host = socket.gethostname() port = 22 s.bind((host, 22)) s.listen(5) while True: c, addr = s.accept() print('Connection to', addr) c.send('root') c.send('MixedVc') c.close()
true
dd434c879d4f956c63989932812afac31d23a0f8
Python
JinraeKim/real-learn
/topics/safe-dynamic-soaring/agents.py
UTF-8
7,192
2.734375
3
[]
no_license
from collections import deque import numpy as np import scipy.optimize as sop import torch import torch.nn as nn import torch.autograd as autograd class SafeValue(nn.Module): def __init__(self): super().__init__() self.model = nn.Sequential( nn.Linear(4, 32), nn.BatchNorm1...
true
102baf63559f3717109534b0f7b634d6972095fa
Python
asmca/codeeval
/2/2.py
UTF-8
251
2.984375
3
[]
no_license
import sys mylist=[] test_cases = open(sys.argv[1], 'r') nu=int(test_cases.readline()) for test in test_cases: mylist.append(test.strip()) test_cases.close() print '\n'.join(sorted(mylist,cmp=lambda x,y:cmp(len(x),len(y)),reverse=True)[:nu])
true
ce6a1f760fa6e76e0d1d7b31b8b285e293f173a0
Python
williamwu062/MangaReader
/util.py
UTF-8
2,757
2.78125
3
[]
no_license
import os import shutil from bs4 import BeautifulSoup import requests import sys import re class Manga: def __init__(self, chapter, name): self.__chapter = chapter self.__name = name class WebsiteUtility: @classmethod def getRequests(self, url): try: response = reques...
true
70d3fb39df6fd9c1e6f48569d0057d9c11c32dec
Python
apotato369550/breadth-first-search-python
/main3.py
UTF-8
4,142
3.65625
4
[]
no_license
# i think i get this # x and y # test it with another maze configuration def create_maze(): return [ "O..#.", ".#.#.", "....#", "#...#", "X.###" ] def create_maze_2(): return [ "...O##X", ".###...", ".####..", "...#...", "..###...
true
9952d77ac19e6a6814e592fa9041087a792b874b
Python
rania-el/ProjetS5-Analyse-sentiments
/Preproccessing.py
UTF-8
2,600
3.609375
4
[]
no_license
import json import nltk import re import regexes as regexes from nltk import pos_tag import string import csv def remove_urls(txt): """ Input ----- - a string Output ------ - a cleaned string """ tokens = txt.split(' ') clean_string = '' for toke...
true
ec3c5219086bc9934b4624a2d839b9492e85e8c4
Python
medit74/DeepLearning
/MyPythonDeepLearning/Python/myfunction.py
UTF-8
1,305
4.3125
4
[ "Apache-2.0" ]
permissive
''' Created on 2017. 4. 7. @author: Byoungho Kang ''' def sayHello(name): greeting = "Hello " + name + "." return greeting def noReturn(): print("This function doesn't have return.") def keywordArgs(name, age): print("Hello! I'm", name + ",", age, "years old.") def defaultArgs(n...
true
bcaabb70e9bf3d806ec9a05f6bc45ab6335c06c6
Python
Aasthaengg/IBMdataset
/Python_codes/p02412/s741844174.py
UTF-8
288
2.9375
3
[]
no_license
while True: n, x = map(int, raw_input().split()) if (n+x) == 0: break comb = 0 for i in range(1, n+1): for j in range(i+1, n+1): c = i + j tmp = x - c if (tmp <= n) & (tmp > j): comb += 1 print comb
true
d61d0459b1f125dd821a4065f470166852c47bd9
Python
stophobia/algorithms
/Programmers/쿼드 압축 후 개수 세기.py
UTF-8
486
2.59375
3
[]
no_license
def solution(arr): answer = [0,0] N = len(arr) def dfs(x, y, n): init = arr[x][y] for i in range(x, x+n): for j in range(y, y+n): if arr[i][j] != init: nn = n//2 dfs(x, y, nn) dfs(x+nn, y, nn) ...
true
64586d6dc3023d0d4810d3935310678e11e97802
Python
CYJ1/SeasonS
/Season_test_server.py
UTF-8
825
2.8125
3
[]
no_license
from flask import Flask, render_template, jsonify, request app = Flask(__name__) from pymongo import MongoClient # pymongo를 임포트 하기(패키지 인스톨 먼저 해야겠죠?) client = MongoClient('localhost', 27017) # mongoDB는 27017 포트로 돌아갑니다. db = client.dbsparta # 'dbsparta'라는 이름의 db를 만듭니다. # HTML을 주는 부분 @app.route('/') def home(): ...
true
c97a19d60843ce8fab24bfea4ade208aa964de71
Python
datAnir/GeekForGeeks-Problems
/Recursion/print_abbreviation.py
UTF-8
1,621
3.984375
4
[]
no_license
''' https://www.geeksforgeeks.org/alphanumeric-abbreviations-of-a-string/ You are given a word. You have to generate all abbrevations of that word. The alpha-numeric abbreviation is in the form of characters mixed with the digits which is equal to the number of skipped characters of a selected substring. Input: pep ...
true
334ce0072406c33ca1144b6b3fd6f99fd017acbe
Python
alexreinking/halide-project-tool
/src/makefile.py
UTF-8
8,639
2.609375
3
[]
no_license
import glob import os import re from pathlib import Path from typing import Dict, Optional from src.logging import warn class BuildConfig(object): _cfg_line_re = re.compile(r'^CFG__(\w+?)(?:__(\w*))?[ \t]*=[ \t]*([^\s].*?)?[ \t]*$') def __init__(self, generator: str, config_name: Optional[str] = None, value...
true
2e266d5d4131f59d3fe7ed20b907763a9bb2ba89
Python
marek5050/cs109
/python/BinarySearch1T.py
UTF-8
1,299
3
3
[]
no_license
#!/usr/bin/env python3 # ---------------- # BinarySearch1.py # ---------------- # https://en.wikipedia.org/wiki/Binary_search_algorithm from unittest import main, TestCase from BinarySearch1 import \ binary_search_iteration_1, binary_search_iteration_2, \ binary_search_recurs...
true
dd046115fd363939f85031ae9345bee7b60d418b
Python
soy-sauce/cs1122
/template.py
UTF-8
1,081
2.984375
3
[]
no_license
import socket import sys # create a socket object sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connection info server_address = ('chalbroker.cs1122.engineering.nyu.edu', 3120) # connect to the server sock.connect(server_address) try: # receive data from the server print(sock.recv(1024)) # tell ...
true
d2ac191becf9bd8d42844e27fe9440241aaffd41
Python
arlyon/hyperion
/hyperion_cli/util.py
UTF-8
1,833
2.703125
3
[ "MIT" ]
permissive
import re from asyncio.locks import Event from typing import Dict, Tuple, Generic, TypeVar from hyperion_cli import logger T = TypeVar('T') postcode_regex = re.compile("^([Gg][Ii][Rr] 0[Aa]{2})|" "((([A-Za-z][0-9]{1,2})|" "(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|" ...
true
5a4b0f60f2fc6afeba1fc6af0d21bbeaff2d3700
Python
abshir24/In-Class-Algorithms
/day11.py
UTF-8
1,397
4.625
5
[]
no_license
# Create a function that accepts a list input and shifts all the values # in the list to the left by 1. Then set the last value in the list equal # to zero this must be done in place. Given: [1,2,3,4,5] => [2,3,4,5,0] def shiftLeft(arr): for i in range(len(arr)-1): arr[i] = arr[i+1] arr[len(arr)...
true
9555c0bdbe940cf3e421d18b8577271b5f74a71d
Python
sultanhusnoo/small_programs
/turtle_racing/t_race_1.py
UTF-8
667
4.03125
4
[]
no_license
""" Create a turtle and make it do some random moves, with random direction, random color, random distance at random speeds. """ import turtle import random t_screen = turtle.Screen() sul = turtle.Turtle() color_lst = ["red","blue","yellow","green","black"] for i in range(0,50): t_speed = random.randint(0,100) t...
true
6785f813ccee7ef693aa27413b6677815b48c3a0
Python
williamandrieu/Rancon
/premium_brazzer_account_keygen.py
UTF-8
4,849
2.515625
3
[]
no_license
import os import random import time import urllib.request base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' rand = random.sample(range(1, 64), 63) decode = [random.randrange(63) for i in range(0, 63)] base64 = [base64[rand[element]] for element in range(0, (len(rand) - 1))] base64_crypted = "...
true
861fe5274a58dfcee258dc87c0db9e8bfc7c0eac
Python
conorhenson/cal_poly_cpe
/CPE101/project3/solverFuncs.py
UTF-8
1,412
3.5
4
[]
no_license
####### # Conor Henson # Professor Workman # CPE 101/ Project 3 ####### def get_cages(): cages = [] numCages = input('Number of cages: ') if numCages > 0: for i in range(numCages): tempCage = raw_input('Cage number {0:0d}: '.format(i)).split() cages.append([int(x) for x in tempCage]) ...
true
d184f9749c16dbe0ef14d5162fb2909b3c6eda9c
Python
fxkuehl/keyboard
/scripts/genseq.py
UTF-8
5,883
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import sys # Keys are numbered 0-31. Even numbers are left hand, odd numbers are # right hand, arranged such that for every left hand key x, the right # hand mirror image is x+1. # # 8 | 6 | 4 | 2 0 || 1 3 | 5 | 7 | 9 | 0 # 20 18 | 16 | 14 | 12 10 || 11 13 | 15 | ...
true
99202ca010b9c123beb3769912aa0f152eaf14e2
Python
depstein/tractdb-python
/tractdb/client.py
UTF-8
2,374
2.75
3
[]
no_license
import requests class TractDBClient(object): """ Client for interacting with a TractDB instance. """ def __init__(self, tractdb_url, client_account, client_account_password): """ Create an admin object. """ self._tractdb_url = tractdb_url self._client_account = client_acco...
true
60ac70744de370a89777fb3b55095941c0d57c06
Python
ysenko/xdist-poc
/tests/test_parallel.py
UTF-8
270
2.796875
3
[]
no_license
import os import pytest import socket import time def add(a, b): return a + b @pytest.mark.parametrize('a,b,expected', [ (a, b, a+b) for a in range(10) for b in range(20) ]) def test_add(a, b, expected): time.sleep(0.02) assert add(a, b) == expected
true
4c7e9cc807c9ba81e2e88bfcd2062746423120b4
Python
StefanoDucci/jogoPython
/Bolsa.py
UTF-8
1,049
3.046875
3
[]
no_license
# encoding: UTF-8 def criar_bolsa(bolsa): bolsa.append(1) #0 Level poção de vida bolsa.append(30)#1 Valor recupera de vida bolsa.append(5) #2 Numero maximo de poção de vida bolsa.append(0) #3 Numero atual de poção de vida bolsa.append(1) #4 Level poção de mana bolsa.append(20)#5 Valo...
true
d6aa77eb522112d449638dda7e2a59d3957e7580
Python
jambonsw/django-improved-user
/tests/test_factories.py
UTF-8
2,657
2.734375
3
[ "BSD-2-Clause" ]
permissive
"""Test model factories provided by Improved User""" from django.test import TestCase from improved_user.factories import UserFactory from improved_user.models import User class UserFactoryTests(TestCase): """Test for UserFactory used with Factory Boy""" def test_basic_build(self): """Test creation ...
true
66a7e79ba8462ebcfb8cb2c2a4159b475736e56d
Python
slamatik/codewars
/5 kyu/Double Cola 5 kyu.py
UTF-8
644
3.5625
4
[]
no_license
data = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"] def who_is_next(names, r): if r <= 5: return names[r - 1] start = 1 letter_count = 1 while start < r: start += len(names) * letter_count letter_count *= 2 letter_count //= 2 cnt = len(names) if start == r: ...
true
e032b3741971024ab77674a3b95686fb87d94697
Python
KIMSIYOUNG/Algorithm-study
/programmers-1/DivideArray.py
UTF-8
610
3.78125
4
[]
no_license
''' 파이썬에서 문자열, 튜플, 리스트가 비어있는 경우 False를 반환한다. return문에서도 and | or 를 사용하면 boolean 유무를 판단하여 리턴한다. 둘을 합치면 return answer or -1 이 가능하다. - answer가 빈 리스트가 아니면 true이기에 그냥 리턴하고, 빈 리스트라면 false를 리턴하여 or 뒤의 구문이 실행된다. ''' def solution(arr, divisor): answer = sorted([v for v in arr if v % divisor == 0]) return answer or ...
true
565ad15ac75793f21f6cf5099551d4c2d724fb91
Python
AdamVig/AdamVigData
/api/highlandexpress.py
UTF-8
1,193
2.765625
3
[]
no_license
"""Get Highland Express data.""" from config import ERROR_INFO, TIMEZONE from api.services import db import arrow import couchdb import requests URL = "https://gocostudent.adamvig.com/api/highlandexpress" def get_highland_express(username, password): """Get Highland Express data.""" try: r = requests....
true
2e5aa175257b7d2e92d212355b52a8b816e8c581
Python
Wdywfm/EpamPython2019
/01-Data-Structures/hw/sticks/json_parser2.py
UTF-8
5,138
3
3
[]
no_license
from collections import deque def is_string(json): string = '' if json[0] != '"': return string, json else: json.popleft() for c in json: if c == '"' and string[len(string)-1] != '\\': for i in range(len(string)+1): json.popleft() return ...
true
2696004930a3a09293260004642099bd77104f58
Python
ReDIIN/ZarAtmaca
/Zar.py
UTF-8
400
3.515625
4
[]
no_license
import random min = 1 max = 6 roll_again = "evet" while roll_again == "evet" or roll_again == "Evet" or roll_again == "e" or roll_again == "E": print("Zarlar Atılıyor...") print("sonuç: ") print(random.randint(min,max)) print(random.randint(min,max)) roll_again = input("Bir daha zar...
true
530bad89a970caee61be0931e4aabed91ddc4f9e
Python
lukeherczeg/WizardvsWorld
/WizardVsWorld/classes/spell.py
UTF-8
2,708
3.53125
4
[ "MIT" ]
permissive
class Spell: """Spells are used by wizards and mages to augment their Attack""" def __init__(self, name, description, uses, spell_range, power, aoe=0, exclude=False, effect=None, impact=None): self._name = name # Name of spell for the menu self._description = description # Desc...
true
6318913bd4e9ba9e5a074ca28964bfb6e766287a
Python
deelawor/Python-exercises
/homewrks/list sum.py
UTF-8
76
3.328125
3
[]
no_license
li = [1,2,3,4,5] mul = 1 for x in li: mul = mul * x print(mul)
true
8ee64ad4b3d521e01a4da775daec381d949ae0c2
Python
paulodias99/LapiscoComputerVisionPython
/QuestoesPy/questao43.py
UTF-8
1,298
2.796875
3
[]
no_license
import cv2 image = cv2.imread('C:/Users/User/Desktop/GIT/LapiscoComputerVisionPython/images/variosobjetos.jpg') grayscale_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) canny_image = cv2.Canny(grayscale_image, 80, 180) params = cv2.SimpleBlobDetector_Params() params.filterByArea = True params.minArea = 20 params....
true
8a99c7cfcad62f1bf3861004ce6c15f73f0a6b19
Python
tranmanhdat/panorama
/test4_optimal.py
UTF-8
3,863
2.8125
3
[]
no_license
import collections from threading import Thread import cv2 import time import numpy as np from configparser import ConfigParser import itertools class VideoScreenshot(object): def __init__(self, src=0, src2=0): self.config = self.init_params('config.ini') # Create a VideoCapture object self.capture = cv2.VideoC...
true
20cc22d823b3bb8827e8da58f0ace18ec7707e84
Python
radhika33/Python-Assignment-
/program 8.py
UTF-8
169
3.796875
4
[]
no_license
# Question-8: python program to print an inverted star pattern. n=int(input("Enter number of rows: ")) for i in range (n,0,-1): print((n-i) * ' ' + i * '*')
true
86dca5d4ed9a8bc297290d1d2c95b9fb2d986df9
Python
Stock-Portfolio-Risk-Analyzer/spr
/Tests/test_datautils/rri_tests.py
UTF-8
2,099
2.890625
3
[]
no_license
import unittest from datetime import datetime as dt from datautils.rri import * """ Test methods in rri.py Author: Shivam Gupta (sgupta40@illinois.edu) Rohan Kapoor (rkapoor6@illinois.edu) """ class TestRRI(unittest.TestCase): def test_compute_portfolio_rri_for_range1(self): """ Tests the compute...
true
dfaa99bc1d7a7167cbd5b0ccd5c50f3d525b8b4c
Python
ssabum/ssafy_hws
/workshop/0310_django/crud/articles/views.py
UTF-8
864
2.75
3
[]
no_license
from django.shortcuts import render from django.shortcuts import redirect from .models import Article # Create your views here. def index(request): # 모든 게시글 조회 # articles = Article.objects.all()[::-1] # 파이썬 언어로 해결 articles = Article.objects.order_by('-pk') # DB 단에서 해결 context = { 'articles': ar...
true
2a9dff667ecbaf9b7a0b6c01059a30076b863595
Python
quintasluiz/devaria-python
/main.py
UTF-8
638
3.609375
4
[]
no_license
def print_hi(name): print(f'Olá mundo, {name}') if __name__ == '__main__': print_hi('Luiz') temperatura = 20 print(type(temperatura)) temperatura = 'filipe' print(type(temperatura)) listaNomes = ['filipe', 'daniel', 'rafael'] print(type(listaNomes)) idade =29 print(type(idad...
true
7266100eecbe47d0511594ceb4e8f60a78a9da52
Python
gomsterX/competitive_programming
/code_chef/CHPINTU.py
UTF-8
380
2.78125
3
[]
no_license
#Problem ID: CHPINTU #Problem Name: Pintu and Fruits for _ in range(int(input())): n, m = map(int, input().split()) l = list(map(int, input().split())) c = list(map(int, input().split())) x = set(l) t_cost = [] for i in x: t = 0 for j in range(n): if l[j] == i: ...
true
51eac1824fdd5efcd90817e0b2bffac96d73ec39
Python
Aasthaengg/IBMdataset
/Python_codes/p03724/s213007774.py
UTF-8
208
2.75
3
[]
no_license
import sys n,m=map(int,input().split()) ctl=[0]*n for i in range(m): a,b=map(int,input().split()) ctl[a-1]+=1 ctl[b-1]+=1 for i in range(n): if ctl[i]%2==1: print('NO') sys.exit() print('YES')
true
7f545815a290d43bf35d905622c6d431699683b8
Python
phugen/segmorph
/Network/cell_quantifier/scripts/extract_tile.py
UTF-8
793
2.609375
3
[]
no_license
# Extracts the non-mirrored tile indicated by the input # number from a stack of all validation files # and saves it as a .png. import h5py import sys import glob import numpy as np import scipy.misc valpath = sys.argv[1] imgno = int(sys.argv[2]) # get validation files and stack them in array filenames = glob.glob(...
true
5930f6047572a5418c4c5e5ac85b2ecc02a447c4
Python
HuMiTriet/Music-Sheet-Pitch-Translation
/ReduceSharp.py
UTF-8
1,941
2.859375
3
[]
no_license
def getNonSharpNote(staffs): index = [] for staff in staffs: subIndex = [] j=0 for i in range(len(staff)): if(staff[i][2] == "NONE"): j+=1 continue else: if(staff[i][3] == False): subIndex.append(...
true
444a2386c1ee9d474e23a4e08254923a79a2af03
Python
LordTesseract/CET086
/Relatório 2/trapezio.py
UTF-8
866
2.984375
3
[]
no_license
#Integração por Trapézio import numpy as np import re from sympy import lambdify, Symbol, parse_expr entrada = open("tTrapezio.in", "r") saida = open("tTrapezio.out", "w") for i, linha in enumerate(entrada): resultado = 0 linha = linha.replace("\n","").split(";") expressaoEntrada = linh...
true
6d28be97f2afbd88a2e1dc0864ef9d921ab270b3
Python
kriti-ixix/ml-230
/python/strings.py
UTF-8
669
4.15625
4
[]
no_license
myString = "Hello world!" myString2 = "How are you?" #String Indexing print(myString[2]) print(myString[7]) print(myString[-1]) #Negative Indexing #String slicing #string[start=0 : stop=len(exclusive) : step=1] print(myString[2:8]) print(myString[2:8:2]) print(myString[::-1]) #Reverse a string #Length of a string pr...
true
59be36439bae26f5e3afa1e17d9e86de952eea69
Python
Tecmax/journaldev
/Python-3/basic_examples/python_vars_function.py
UTF-8
461
3.6875
4
[ "MIT" ]
permissive
class Data: # class variables id = 0 name = '' def __init__(self, i, n): self.id = i self.name = n # instance variable self.repr = 'Data[%s,%s]' % (i,n) d = Data(1, 'Pankaj') # vars of object print(vars(d)) # update __dict__ and then call vars() d.__dict__['id'] = 10...
true
b6425f27b21f45628cfa1547eee81ab81934ca23
Python
way2arun/datastructures_algorithms
/src/arrays/maxTurbulenceSize.py
UTF-8
2,258
4.0625
4
[ "CC0-1.0" ]
permissive
""" Longest Turbulent Subarray Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray. More formally, a subarray [arr[i], arr[i + 1], ..., arr[j]] of arr is said to be turbul...
true
b202b7ab947f1ade79bc52d84d8fbae5118c99ba
Python
PascalLeDeveloppeur/OC_DA_P5_OpenFoodFacts
/ocdap5_openfoodfacts/view/details_of_a_food_prod_page_view.py
UTF-8
2,123
2.796875
3
[]
no_license
import sys from icecream import ic import traceback from logger import logger from constants import ( CHOICE_ERROR, ERROR_COLOR, DETAILS_OF_A_FOOD_PROD_PAGE, PRODUCT_DETAILS, SUBSTITUTE) class DetailsOfAFoodProdPageView: """Display the page of the details of a product which is a food""" ...
true
83acefff6194c46728c9aba652cdb832219534e6
Python
GuilhermeFonseca10/ExpressoesRegulares
/main.py
UTF-8
244
3.859375
4
[]
no_license
import re for n in range(0,3): n = str(input("Digite seu nome e sobrenome:")).strip() print("Olá, meu nome é", n) print("Com expressão regular") nome = n.split() print(nome) print("Sem expressão regular") print(nome[0])
true
adfbf867a13c2bf2fc1b846574f30b75a83f9868
Python
CodeKnight626/SpaceCowbot2
/SpaceCowBot2.py
UTF-8
941
2.75
3
[]
no_license
import discord intent = discord.Intents(messages=True, guilds=True, members=True) client = discord.Client(intents=intent) @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) @client.event async def on_message(message): if message.author == client.user: return ...
true
10752af4bbb92e7acde99430029ebfb3143f15d6
Python
WinterBlue16/Function-for-work
/Data Structure/list/1_이중 리스트 해제하고 카운트하기.py
UTF-8
934
4
4
[]
no_license
# 데이터를 처리하다 보면 리스트 안에 리스트가 존재하는 경우가 있다. # 이 경우 리스트 안의 item들을 검색하거나 카운트하는데 어려움을 겪게 된다. # 이러한 상황을 해결하고 싶을 때 사용한다 # 라이브러리 불러오기 import itertools from collections import Counter # 샘플 리스트 만들기 sample_li = [[1], [2], [2], [3], [5]] # 리스트 item 확인해보기 for li in sample_li: print(li) # 타입 list # 리스트 갯수 카운트해보기(실패) count_li ...
true
3eee91d34170725dfea78c8a145dada7bc16d247
Python
AustinBao/Tasks
/CandyStore.py
UTF-8
890
3.65625
4
[]
no_license
class Customer: def __init__(self, firstname, lastname, money): self.firstname = firstname self.lastname = lastname self.money = money def buy(self, candybar): print("Candy bought: " + candybar.brandname) class CandyBar: def __init__(self, brandname, price): ...
true
cca1b28a9ade9157577c46b26d300a9713762486
Python
albertolg/exploiting
/training/crypto/cryptopals/set1/1/python/cryptopalslib/file_utils/test_file_utils.py
UTF-8
759
2.84375
3
[]
no_license
from file_utils import FileUtilsClass as FileUtils import unittest import logging logging.getLogger() class TestStringMethods(unittest.TestCase): def test_write_and_read_file(self): inp = FileUtils.get_temp_file_name() expected = 'File Content' FileUtils.write_text_file(inp, expected) ...
true
a0e73a04a6ec7a2b9a242a691ca8246a1cbdbda2
Python
jpark132/389Rspring19
/assignments/9_Crypto_I/writeup/server_crack.py
UTF-8
976
2.9375
3
[]
no_license
#!/usr/bin/env python3 import hashlib import string import socket import time def server_crack(): hashes = open('hashes.txt','r').readlines() passwords = open('passwords.txt','r').readlines() characters = string.ascii_lowercase server_ip = '134.209.128.58' server_port = 1337 s = socket.socket...
true
2ddea73581e7d37b0d36780b55d96280c0aee7b7
Python
an0ndev/blindinglights
/blindinglights/blindinglights.py
UTF-8
6,668
2.984375
3
[]
no_license
import pathlib import blindinglights.playa as playa try: import board import neopixel except ImportError: import blindinglights.dummy.board as board import blindinglights.dummy.neopixel as neopixel import time pixels = neopixel.NeoPixel(board.D18, 100) # Define the lightstrip, and how many LEDs to us...
true
407786cf74696537b4846a1841d9deaf9627b062
Python
cathy80110017/Judge
/Zerojudge/a/a021.py
UTF-8
290
3.25
3
[]
no_license
while True: try:i=input() except:break num1, a, num2 = i.split() num1=int(num1) num2=int(num2) if a=='+': ans = num1+num2 elif a=='-': ans = num1-num2 elif a=='*': ans = num1*num2 else: ans = num1//num2 print(int(ans))
true
5eb2e9f2e259443898ddb2ef13eb8889cd945757
Python
Fanpanda/WebCrawler
/58city_crawler.py
UTF-8
1,632
2.890625
3
[]
no_license
from bs4 import BeautifulSoup import requests import time ''' Crawl the name, category information, price, number of views, address and image link of the item in 58city ''' info = list() # # url = 'http://bj.58.com/pbdn/0/' urls = ['http://bj.58.com/pbdn/0/pn{}/'.format(str(i)) for i in range(1,10)] # For...
true
1fe55c8c17deccec6fb007a608e5cda69324a6eb
Python
vaopen/blogs
/Codes/DeepLearning/Week_3/Shallow_Neural_Network.py
UTF-8
5,112
2.515625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # from testCases import * # import sklearn # import sklearn.datasets # import sklearn.linear_model import time from planar_utils import plot_decision_boundary, sigmoid, load_planar_dataset, load_extra_datasets ''' 提前适应深层神经网络,增加可移植性 参考:https://blog.csdn.net/u013733326/...
true
f9d7ab95b6f1926a32f8b899cdcf8eb10f409d7b
Python
yoonmyunghoon/JDI
/알고리즘/SW Expert Academy/prac/prac03.py
UTF-8
1,327
4.21875
4
[]
no_license
# 진수변환 다른 진법 수를 10진수로 바꿔줌 print(int("1002", 3)) # 문자열 함수들 name = "reynold" print("hi, i'm {}".format(name)) introduce = ["hi", "i'm", "reynold"] print(" ".join(introduce)) alphabet = "abcd" print(",".join(alphabet)) ex_strip = " s " print(ex_strip.strip()) a = "hobby" print(a.count("b")) print(a.find("b")) prin...
true
40dc865f52c3c6673d220b8e941a599592616c74
Python
tysonggraham/seniorProjectSignalEncoding
/fft_algorithm_pure/fftTest.py
UTF-8
1,659
3.28125
3
[]
no_license
import cmath import numpy as np import timeit from cmath import exp, pi def fft(x): #N is sample length or number of samples #x is our input array aka our signal N = len(x) if N <= 1: return x #divide and conquer portion of algorithm. Divide evens and odds and do fft on both halves even = fft(x[0::2]) odd = ff...
true
cda38d1284248402a6e339cd6b0fa1902fd36b21
Python
mjsheikh/CS786-Assignments
/HW1/1/BooleanFunction.py
UTF-8
2,453
3.5
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np from numpy.random import rand as U # In[2]: x_train = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], ...
true
6a4b4b3663adf01aca523085cfefe6f1853ec7a8
Python
kwx4github/facebook-hackercup-problem-sets
/2015/round_1/2.Autocomplete/solutions/sources/2784.Antoine
UTF-8
756
3.34375
3
[]
no_license
#!/usr/bin/python3 import collections try: input = raw_input range = xrange except: pass class Tree: __slots__ = ('children', 'count') def __init__(self): self.children = collections.defaultdict(Tree) self.count = 0 def result(N): tree = Tree() i = 1 for o in range(N...
true
330918e4b03824b44daa90ebf985c846d900a155
Python
Maniakrzelaza/weather_prediction
/association_rules.py
UTF-8
900
2.734375
3
[]
no_license
import pandas as pd import numpy as np from apyori import apriori from preprocess import * from constants import * def filter_results(row): return ('RainTomorrowYes' in row[0]) or ('RainTomorrowNo' in row[0]) def sort_results(row): return row[1] def do_association_rules(): data = get_categorized_proc...
true
29222a5f02c9ecef7d3129aadd25391e24932428
Python
JulyKikuAkita/PythonPrac
/cs15211/SubstringwithConcatenationofAllWords.py
UTF-8
11,223
3.859375
4
[ "Apache-2.0" ]
permissive
__source__ = 'https://leetcode.com/problems/substring-with-concatenation-of-all-words/' # https://github.com/kamyu104/LeetCode/blob/master/Python/substring-with-concatenation-of-all-words.py # Time: O(m * n * k), where m is string length, n is dictionary size, k is word length # Space: O(n * k) # # Description: Leetco...
true
aabd8706ca86b791d912967f5a09797405e81b27
Python
Raj-1337/guvi
/m4_3.py
UTF-8
257
2.921875
3
[]
no_license
from itertools import permutations x = input() X = int(x) r = [] y = [int(i) for i in x] for i in permutations(y, len(y)): t = int(''.join([str(j) for j in i])) if t > X: r.append(t) if not r: print('impossible') else: print(min(r))
true
adff29f36292e05018808bbb145aaf2711b571a5
Python
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
/students/nDruP/lesson03/list_lab.py
UTF-8
3,739
4.90625
5
[]
no_license
#!/usr/bin/env python3 def fruit_series1(): """ Create a list that contains “Apples”, “Pears”, “Oranges” and “Peaches”. Display the list (plain old print() is fine…). Ask the user for another fruit and add it to the end of the list. Display the list. Ask the user for a number and display the number back to the user an...
true
41e26cd6fd219a2f21864867d5930b682412a406
Python
AdilShaikh1/self_balancing_ugv
/gazebo_simulation/motion_plan/src/python/pidcontrol.py
UTF-8
5,916
3.25
3
[ "MIT" ]
permissive
#!/usr/bin/env python2 import math class PID_Controller(object): ''' General PID control class. ''' def __init__(self, Kp, Ki, Kd): ''' Constructs a new PID_Controller object. ''' # Parameters self.Kp = Kp self.Ki = Ki self.Kd = Kd ...
true
c623c433cb604a12aa6d83e80219481ff03bf186
Python
StroudCenter/midStream
/Local_midStream/midStream_receiver_SRGDdesktop.py
UTF-8
5,139
2.875
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Dec 10 10:46:42 2012 @author: Justin Olexy This script will take all incoming data on a serial port at 'addr' and append it to a file, 'fname'. """ #Import necessary modules import serial #This is the pySerial module: http://pyserial.sourceforge.net/ import sys from time i...
true
e191da6ed1517d962025171f7d78fb6f283cef28
Python
backjoob/coding_practice
/python3/tictactoe/src/tictactoe.py
UTF-8
3,062
3.734375
4
[]
no_license
#!/usr/bin/python3 from array import array from cmd import Cmd class TicTacToeException(Exception): """ Parent exception for TicTacToe errors """ class InvalidMoveException(TicTacToeException): """ Denotes that an invalid move has been attempted """ class InvalidPlayerException(TicTacToeExce...
true
1a616f2cd47568d36a5529883baf0baf2bc739ce
Python
joielee09/-PS-problemsolving
/baekjoon/2294.py
UTF-8
392
2.859375
3
[]
no_license
import sys import math sys.stdin=open('input.txt') n,k = map(int, sys.stdin.readline().split()) coins=[] while n: n-=1 c = int(sys.stdin.readline()) coins.append(c) coins.sort() mm=[math.inf]*int(k+2) mm[0]=0 for i in range(k+1): for j in coins: if i<j: break mm[i]=min(mm...
true
164183c98e3be1d11b498c626b815bd0c38bf0b7
Python
jiceR/france-ioi
/python/galettes.py
UTF-8
232
2.84375
3
[]
no_license
nbMarchands = int(input()); marchand= 0; galettes= []; for marchand in range(nbMarchands): prixGalette= int(input()); galettes.append(int(prixGalette)); marchand+=1; print(len(galettes) - galettes[-1::-1].index(min(galettes)))
true
0f1bc637f010a3643d4d2d8654a7d50cd19ffb8b
Python
neutr0nStar/python-opensource
/Kadane_Algo.py
UTF-8
347
3.890625
4
[]
no_license
def max_arr_sum(x): max=int(x[0]) end=0 for i in range(0,len(x)): end=end+int(x[i]) if(end<0): end=0 if(max<end): max=end return max x=input("Enter each elements by a ',' between them : ") x=x.split(",") result=max_arr_sum(x) print("") print("The Max ...
true
05d3d7fb4203f0d077c17ffc7580967f9c73c91b
Python
authman/Python201609
/Guerrero_Melissa/Assignments/multiply_function.py
UTF-8
115
3.296875
3
[ "MIT" ]
permissive
def multiply(count): x = count*5 return x a = [2, 4, 10, 16] for count in a: multiply(count*5) print count*5
true
54b4f18928eb3b07b990a2c5e701ae7260a940d5
Python
thmnl/Python-Astar-visualization
/src/draw.py
UTF-8
3,057
3.046875
3
[]
no_license
import numpy as np import cv2 import sys SCX, SCY = 700, 700 image = 255 * np.ones((SCX, SCY, 4), np.uint8) SKYBLUE = [250, 206, 135, 1] SKYBLUE_FLASH = [255, 255, 0, 1] PURPLE_BLUE = [240, 144, 141, 1] GREY_BLUE = [162, 161, 130, 1] YELLOW = [79, 243, 241, 1] YELLOW_FLASH = [0, 255, 255, 1] PINK = [249, 99, 233, 1] ...
true
0909f0fc743d962d18afe3d1410752996953d664
Python
DiogoCondecoOphs/Y11-Python-
/WHILELOOPchallenges07.py
UTF-8
722
4
4
[]
no_license
#WHILELOOPchallenges07 #Diogo.c val = 10 while val > 0: print("There are",val,"green bottles hanging on the wall,") print(val,"green bottles hanging on the wall") print("and if one green bottle should accidnetally fall") print(" ") guess = int(input("How many green bottles will be hanging on the wall? ")) ...
true
6c377aa7caadcbcf91bf70885a323d11eec5f91d
Python
shirinegm/sqlalchemy-challenge
/app.py
UTF-8
6,210
2.609375
3
[]
no_license
import numpy as np import pandas as pd from datetime import datetime from dateutil.relativedelta import relativedelta import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify # Database setup engin...
true
60a145a40aa59f139a0abf8e15411aff3172aff7
Python
PawelPlutaUek20/pp1
/07-ObjectOrientedProgramming/Email.py
UTF-8
598
3.0625
3
[]
no_license
from message import Message class Email(Message): def __init__(self,senders_address,receivers_adress,theme): self.senders_address = senders_address self.receivers_address = receivers_adress self.theme = theme def send(self,message): Message.set_message(self,message) print...
true
3a3b811cd6271b74a5dec02fb496a2eba031d9ec
Python
OussemaLouati/Auto-ML
/src/data_loading/local_file_loader.py
UTF-8
379
2.671875
3
[]
no_license
import pandas as pd from .loader import Loader ''' "resource_name" must reference a full path to source/target files in this loader ''' class LocalFileLoader(Loader): def __init__(self): pass def load(self, resource_name): return pd.read_csv(resource_name) def save(self, dataset, resourc...
true
48e98fd8b552613dd7e0fa4ec1d9ac6299b32494
Python
YujiaY/leetCodePractice
/LeetcodePython3/q0449.py
UTF-8
1,775
3.5625
4
[]
no_license
#!/usr/bin/python3 from typing import List from collections import deque class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string. """ if...
true
08d06ed7cd6a96297e2208df5e5dd5509bd57200
Python
inverseTrig/leet_code
/matrix_block_sum.py
UTF-8
1,017
3.21875
3
[]
no_license
from typing import List class Solution: def matrixBlockSum(self, mat: List[List[int]], k: int) -> List[List[int]]: cumulative = [[0] * (len(mat[0]) + 1) for _ in range(len(mat) + 1)] for i in range(len(mat)): for j in range(len(mat[0])): cumulative[i + 1][j + 1] = mat[...
true
50aa0da16d787e1e3150e26d390fa5f6cb168120
Python
bilibalaPlus/Crawler
/爬虫代码_I/L_01/17huo.py
UTF-8
1,202
2.703125
3
[]
no_license
""" 获取杭州男装衬衫数据 """ # coding:utf-8 import requests from bs4 import BeautifulSoup BSLIB = 'html5lib' UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36' HEADERS = {'user-agent':UA} def get_products_info(url): r = requests.get(url, headers...
true
ca7645ca1657c396e04dec4ca6b40763cf7d4c51
Python
Norm723/FinalProject
/RandomForest.py
UTF-8
1,865
3.09375
3
[ "MIT" ]
permissive
import numpy as np import DataSet import DecisionsTree class RandomForest: def __init__(self, data_file, num_trees=1, scoring_func=DecisionsTree.score_by_gini, max_depth=20, alpha=1, min_data_pts=5, min_change=0.001): self.data_file = data_file self.num_trees = num_trees self.trees = list()...
true