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
c1a999b43878fcc7c115f281d891b7249501739c
13731282937/store
/pythonday01/demo/test01.py
UTF-8
363
3.109375
3
[]
no_license
from selenium import webdriver # 创建驱动 driver = webdriver.Chrome() # 打开网页 driver.get("http://www.baidu.com") # 窗口最大化 driver.maximize_window() # 定位搜索框,输入java driver.find_element_by_id("kw").send_keys("java") # 点击百度一下 driver.find_element_by_id("su").click() # 关闭网页 driver.quit()
true
2b37cf792de067ff1be49e04c88d21151175d247
Sachin-Kahandal/flask_proj
/Flask_registration/app/application.py
UTF-8
6,426
2.59375
3
[]
no_license
from flask import Flask, render_template, request, redirect, url_for, make_response, session, logging, flash from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base from passlib.hash import sha256_crypt # for encrypting user im...
true
2bb6816563e73d68634597c860d1ef815d9dea78
srikantviswanath/Algo-Practice
/bfs/level_order_successor.py
UTF-8
1,365
3.34375
3
[]
no_license
from trees import TreeNode, build_binary_tree from collections import deque class TreeNodeWithNext(object): def __init__(self, val): self.left = None self.right = None self.next = None self.val = val def print_level_order(root): nextLevelRoot = root while nextLevelRoot: ...
true
0548292beba06fba486fff3ee82c92468f53b466
zzhoulin/OPERATION2.0
/Common/Token.py
UTF-8
1,983
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- # @Author : Joy import requests from Common import Log from Config import Config class Token: def __init__(self): self.log = Log.MyLog() self.config = Config.Config() def get_token(self, env): """ 获取token :param env: 环境变量 :return: ...
true
73f808028add511b159db8ac8831b05f9aad509a
mergerly/SpiderOf51job
/SpiderOf51job.py
UTF-8
3,340
2.71875
3
[]
no_license
import requests from lxml import etree import csv import time import random fp = open('51job.csv', 'wt', newline='', encoding='GBK', errors='ignore') writer = csv.writer(fp) '''title,salary,company,companyinfo,companyplace,place,exp,edu,num,time,info''' writer.writerow(('职位', '薪资', '公司', '公司信息', '公司地址', '地区', '工作经验', ...
true
384443700afaa373672a14f0b4dfb0d8422072cf
alfiopuglisi/covid_plots
/us.py
UTF-8
4,228
2.53125
3
[]
no_license
#!/usr/bin/env python import sys import os.path import pandas as pd from datetime import date, timedelta from multiprocessing import Pool from covid import i18n, Styles, CovidPlot, DailyPlot, OOPlot try: from my_config_us import csv_dir, outdir, n_proc except ModuleNotFoundError: csv_dir = '../COVID-19-wor...
true
7aa5ba617adc65db67afaaa93b3050a4c6672954
Candyjet/Pool-Controller
/newdemo.py
UTF-8
748
3.15625
3
[]
no_license
#!/usr/bin/env python3 from gpiozero import LED from time import sleep import time print ('This is Opto Zero') led12 = LED(12) led24 = LED(24) tup=1.3 tdown=1.46 def speeddown(): print("Decreasing by",'%2f'%tdown) led12.on() time.sleep(tdown) led12.off() def speedup(): print("Increas...
true
9c4f45dbb382fb405af8be95d350c0ae911a3172
gasvaktin/gasvaktin
/logman.py
UTF-8
9,972
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/python3 # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------------------------- # import collections import copy import json import logging import os import time __author__ = "Sveinn Floki Gudmundsson" __email__ = "svefgud@gmail.com" __version__ = "0.0.1" N...
true
da8b4a11d6ee990bd8e1afc4d4b83be2d935935c
Zer0xPoint/NowCoder_OJ
/1.53.py
UTF-8
998
3.953125
4
[]
no_license
# 题目描述 # 小明同学在参加一场考试,考试时间2个小时。试卷上一共有n道题目,小明要在规定时间内,完成一定数量的题目。 # 考试中不限制试题作答顺序,对于 i 第道题目,小明有三种不同的策略可以选择: # (1)直接跳过这道题目,不花费时间,本题得0分。 # (2)只做一部分题目,花费pi分钟的时间,本题可以得到ai分。 # (3)做完整个题目,花费qi分钟的时间,本题可以得到bi分。 # 小明想知道,他最多能得到多少分。 # 输入描述: # 第一行输入一个n数表示题目的数量。 # # 接下来n行,每行四个数p_i,a_i,q_i,b_i。(1≤n≤100,1≤p_i≤q_i≤120,0≤a_i≤b_i≤1000)。 # 输出描...
true
0680ddc8cc46b7b67bf38151af92cf9184c9864b
icescrub/code-abbey
/smoothing_the_weather.py
UTF-8
332
2.5625
3
[]
no_license
def f(): with open('C:\\Users\\Duchess\\Desktop\\Data.txt') as data: for line in data: line = [float(x) for x in line.split()] line2 = line.copy() for i in range(1,len(line2)-1): line2[i] = round((line[i-1] + line[i] + line[i+1])/3,7) pr...
true
57483d97a41b004bfd7e9a47a241ada764790b9a
yangxiaoxiaoo/Weibo
/Hash_filter.py
UTF-8
1,028
2.59375
3
[]
no_license
#Jul5:try shrinking data size by filtering out less then 2 comments import hashlib import os Commenter = "../CommentUser/" output = "../BigCommenterHashed/" #output_threshold = 0.01 user_set_map = {} users = set() def map_filter_init(): global user_set_map,users for username in os.listdir(Commenter): ...
true
0f5ff5d7118398bd41bc6f0ae34a081cb4d290a5
enriquefromojaro/host-info-kafka-producer
/monitors/cpu.py
UTF-8
340
2.5625
3
[]
no_license
import psutil class CPUMonitor: def __init__(self): self.num_cpus = psutil.cpu_count() def get_percentage(self, cpu:int=None, per_cpu:bool=True, interval:int=1): result = psutil.cpu_percent(interval, per_cpu) return result if not per_cpu or cpu is None or cpu < 0 or self.num_cpus <= ...
true
efce6967115e2dfa3594978f83c446c9dd1c5700
Punga3/Luon
/core.py
UTF-8
2,218
3
3
[]
no_license
import random def D(num): return random.randrange(1,num+1) def weaponSword(str,dex): return D(4)+D(4)+(str//2) def weaponDagger(str,dex): return D(4)+(dex//2) class Person: def __init__(self,name,strspi,strspin,dexrob,dexrobn,weapon): self.name=name self.strspi=strspi self.strspi...
true
a3ba480139a34b536d95ebe6d8114c6f7d0ff131
bopopescu/SQL-Pthon
/MYSQLLearning/selectWhere.py
UTF-8
1,060
3.0625
3
[]
no_license
import mysql.connector db = mysql.connector.connect( host="localhost", user="root", passwd="68221102a", database="testDb" ) mycursor = db.cursor() # sql statement to do retieveing sql = "SELECT * FROM teachers WHERE name = 'A'" # execute querie mycursor.execute(sql) # put the results of the querie in ...
true
416a104073b08dac78c97604651740983898ad99
tienskowl/python_project
/computer/copy_files/progress_main.py
UTF-8
2,081
2.71875
3
[]
no_license
import sys from PyQt5.QtWidgets import QWidget, QApplication, QMainWindow, QFileDialog from PyQt5.QtCore import pyqtSignal, QObject from ui import Ui_MainWindow from PyQt5.QtGui import QTextCursor from copy_file import CopyFile class EmittingStr(QObject): textWritten = pyqtSignal(str) # 定义一个发送str的信号 def wri...
true
6d3f44e311d4f28dc10b8500777aad05db17c0b4
5l1v3r1/py-mpworker
/test/test_callbacks.py
UTF-8
981
2.578125
3
[ "MIT" ]
permissive
from ctypes import c_uint32 from multiprocessing import Pipe, Value from multiprocessing.connection import Connection as PipeConnection from py_mpworker import MPWorker TEST_INTERVAL = 1 def process_event( state: Value, desired_call_count: int, finished_signaler: PipeConnection, ): with state.get_lock(): ...
true
eb27d25923394a83c6d8a0c61e94c4d4d41508dc
franlk221/IMUbot
/discord_func.py
UTF-8
8,639
2.640625
3
[]
no_license
import mysql.connector import pymongo import random import api_func import traceback import time myclient = pymongo.MongoClient("mongodb+srv://Jimmy:Chips@doobie.jsw33.mongodb.net/<dbname>?retryWrites=true&w=majority") db = myclient.test print(myclient.list_database_names()) Database = myclient.get_database('ZaydsSwil...
true
b8769d9df48106b4edd11284b33e1d4913f99a56
xxbioinfor/DeNovoNeo
/src/util/kmer.py
UTF-8
1,679
2.625
3
[]
no_license
import re re_read = re.compile('^[ATCGN]+$') re_ref = re.compile('^\>|^[N]+$') re_head = re.compile('^\>') re_N = re.compile('N') def ref_del(line): if re_ref.match(line): return False else: return True def ref_read(reference,count): refRead = [] for i in range(count-1): if re_...
true
cd4a1146dab9f6ade6ed81a2dd85eb0c49d82524
brisvv/New-project-
/Martin/BookORelly/Recursion.py
UTF-8
365
3.6875
4
[]
no_license
def tri_recursion(k): if(k>0): result = k+tri_recursion(k-1) print(result) else: result = 1 print ("end") return result print("\n\nRecursion Example Results") tri_recursion(3) def maximum(L): if len(L) == 1: return L[0] else: return max(L[0],maximum(L[1:])) L = [2, 4, 6,...
true
36473e735a25dcbae37e69482de28a6d02a7e427
sandeepnmenon/Competitive-Coding
/codechef/SEREJAANDDIVIDING.py
UTF-8
288
3
3
[]
no_license
t=raw_input() t=int(t); def c7(num): if num==0: return 0 ans="" while num>0: q=num/7 r=num%7 ans=ans+str(r) num=q return ans[::-1] for i in xrange(t): a=raw_input() b=raw_input() l=raw_input() a=int(a,7) b=int(b,7) l=int(l) l=7**l ans=(a/b)%l s=c7(ans) print s
true
7a9976aabcfba0a7b3ab43c3d69cccb241457446
pawardatta/Crop-Prediction
/predictions.py
UTF-8
2,610
2.875
3
[]
no_license
import crop_pred import market_pred import pickle import streamlit as st import pandas as pd import numpy as np # from sklearn.ensemble import RandomForestClassifier def minimumProbabilty(prob): return prob>=0.0001 with open('./models/' + 'crop', 'rb') as f: model = pickle.load(f) def predict_crop(state,distr...
true
cd328a0a047ce4adf93c9f44e6f38dc7f241228e
Dreyvor/ADVPETs_projects
/project1/ttp.py
UTF-8
2,116
3.234375
3
[]
no_license
""" Trusted parameters generator. MODIFY THIS FILE. """ import collections from typing import ( Dict, Set, Tuple, List, ) from secret_sharing import ( share_secret, Share, q, ) import random as rnd # Feel free to add as many imports as you want. class TrustedParamGenerator: """ ...
true
66352824d9aefcd41f2c5cc887615c25ec241b6f
MaxShapiro/SQL_DataBase
/schedule.py
UTF-8
5,992
3.03125
3
[]
no_license
import sqlite3 import os def main(): dataBaseExists = os.path.isfile('schedule.db') dbcon = sqlite3.connect('schedule.db') with dbcon: cursor = dbcon.cursor() if dataBaseExists: iteration_ctr = 0 cursor.execute("SELECT * FROM courses") finishProgram = ...
true
fbef948403c4c71eecf5af56a1dda64aa8146929
sharpyy/gordian
/gordian/files/json_file.py
UTF-8
298
2.609375
3
[ "Apache-2.0" ]
permissive
from . import BaseFile import json class JsonFile(BaseFile): def __init__(self, github_file, repo): super().__init__(github_file, repo) def _load_objects(self): return json.loads(self.file_contents) def _dump(self): return json.dumps(self.objects, indent=4)
true
3596aba751109cd04a1b53b67eb3d522d90693d9
jurestanic/FlaskApp
/tests.py
UTF-8
6,342
2.59375
3
[]
no_license
from project.config import TestConfig from project import create_app, db import unittest import jwt app = create_app(TestConfig) class CreateUser(unittest.TestCase): def setUp(self): self.app = app self.client = app.test_client() with self.app.app_context(): ...
true
b5ca4de5ba6636dad276938a39091b418af2dd29
developeryuldashev/python-core
/python core/Lesson_3/Boolean/bool_10.py
UTF-8
60
2.78125
3
[]
no_license
a,b=2,3 r=(a%2==1 and b%2==0) or(a%2==0 and b%2==1) print(r)
true
eadefb21980731555d799371d5d5e15b17c0099d
leliel12/talks
/scipyconar2013/whypython/examples/pilas/example.py
UTF-8
593
2.546875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import pilas pilas.iniciar() mono = pilas.actores.Mono() mono.x, mono.y = 100, 100 # mono.aprender(pilas.habilidades.Arrastrable) # bananas = pilas.actores.Banana() * 10 bombas = pilas.actores.Bomba() * 5 def mono_come_banana(mono, banana): mono.sonreir() bana...
true
c6dfa3477228df78a16bc96a0aa30ac71a7bd741
s4to/PyBench
/binary_open.py
UTF-8
1,391
3.40625
3
[]
no_license
# coding: utf-8 """ 一時ファイルを利用しないで、バイナリファイルを加工する場合 検証するファイル 1ファイルあたり1行100文字のファイルを1MB, 10MB, 100MB, 1000MBのファイル """ @profile def read(path: str) -> str: with open(path, "br") as binary_file: b = binary_file.read() return b """ # MEMO: 下記コメントアウトされた方法だと、各ファイルをオープンした際にどの程度メモリを利用したかわからない。 re...
true
4f250886469592658097120e4b9808b25072d147
csahmad/291-Mini-Project-2
/Phase3Source/PrintRecords.py
UTF-8
1,439
3.421875
3
[]
no_license
import xml.etree.ElementTree as ET import textwrap class PrintTweets: @staticmethod def extractTweet(item): """ extract tweets and user info from tweet record (xml) values: tweet: id, created_at, text, retweet_count, user user: name, location, description, ...
true
555994b59922435f714fe6a4327b69db842b6a3f
haixiaosu/project-euler
/28.py
UTF-8
197
3.125
3
[]
no_license
steps = range(2, 1001, 2) print steps current_number = 1 sum = 1 for step in steps: for mini_step in range(1, 5): current_number += step print current_number sum += current_number print sum
true
486aa0a4fd95c00d08b75cd832b8ad4f1f4ef53a
KathrynRunolfsdottir/Reusables
/test/test_reuse_namespace.py
UTF-8
7,690
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import reusables from .common_test_data import * class TestReuseNamespace(BaseTestClass): def test_namespace(self): test_dict = {"key1": "value1", "Key 2": {"Key 3": "Value 3", "Key4": {"Key5": "Value5"}}} namespace = reusables.Namespace(**test_dict) ...
true
27a083e428af2905d45f2098cd50b674f3a50333
PeterZs/operatornet
/general_tools/plotting.py
UTF-8
4,054
2.890625
3
[]
no_license
import numpy as np import matplotlib.pylab as plt import matplotlib.cm as cm from matplotlib import transforms import cv2 from PIL import Image from . arrays import is_true def stack_images_horizontally(file_names, save_file=None): ''' Opens the images corresponding to file_names and creates a new image stac...
true
134c59a6ef9c360d87546ba20ebdcae035deb335
maarten42k/PracticePython
/Exercise4.py
UTF-8
205
4.0625
4
[]
no_license
# Give the divisors of a certain number number = int(input("Give me a number: ")) range = range(1, number+1) result = [] for num in range: if number % num == 0: result.append(num) print(result)
true
fbc78a8da086849df1dc3c3573aeb813c0ffcbe1
bopopescu/nut
/nut/apps/web/utils/formtools.py
UTF-8
785
3.296875
3
[]
no_license
import re def innerStrip(str_input): replace_regex = re.compile(r'\s+', re.M | re.I) return re.sub(replace_regex, ' ', str_input).strip() translate_table = {ord(char): None for char in "<>\'\"&;"} strict_translate_table = {ord(char): None for char in "<>\'\"&;)(:"} def clean_user_text(contents): if no...
true
34145e4937126ffa1f0809946e0d61d446985ae8
rguliev/readpdf
/pdfconvert.py
UTF-8
1,292
2.609375
3
[]
no_license
import sys from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter from pdfminer.pdfpage import PDFPage from pdfminer.converter import XMLConverter, HTMLConverter, TextConverter from pdfminer.layout import LAParams import io ''' This function converts pdf to one of formats: xml, html, txt (default) * pdf...
true
5f68eb8b4688b5a3256f4168eb035ad77e560bd1
sksanjiv77/leetcode
/88-merge-sorted-array/solution.py
UTF-8
613
2.859375
3
[]
no_license
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ last = m+n-1 m, n = m-1, n-1 # if len(nums1) == 1 and len(nums2) == 1: # nums1[0] = nums2[0] ...
true
51ddf693214ad6084e3f46d8db86e6c6a10c17e8
donghyeops/3D-SGG
/_planner.py
UTF-8
2,882
2.84375
3
[ "MIT" ]
permissive
# -*- coding:utf-8 -*- from __future__ import print_function import time import argparse from runner import CT # 토마토 집어서 냉장고에 넣기 def plan1(ct, interval=0.5): ct.set_scene('FloorPlan1') print('plan1 start') time.sleep(interval*3) # do plan move1 = [ct.left] + [ct.go]*4 + [ct.right] + [ct.go...
true
9ca51de6e02bde17346fac51d3765e71e6a10d7c
adityaekbote/6.189
/Assignments/6.189 Homework 3/written_hw3.py
UTF-8
2,905
4.40625
4
[]
no_license
# Name: Tyler Brown # Section: # written_hw3.py # ********** Exercise 3.7 ********** #Mutable: Elements can be modified #lists #Immutable: Elements cannot be modified #strings #tuples # ********** Exercise 3.8 ********** #Bugs #1. def negate(num) #How do you deal with negative numbers or 0? # Do som...
true
8128ee508f80c303feae64837f6f8cd1de62723a
john-m24/fact-ai
/src/networks/baseline/lenet.py
UTF-8
1,447
2.515625
3
[]
no_license
import torch.nn as nn class LeNetEncoder(nn.Module): def __init__(self, additional_layers=False): super(LeNetEncoder, self).__init__() network = [ nn.Conv2d(3, 6, kernel_size=5, stride=1), nn.ReLU(True), nn.MaxPool2d(kernel_size=2, stride=2), ] ...
true
d37ddecfa92f3621bf44a7a5d769f8f6deeb21df
ganeshtiwari/algoimplemet
/binaryadd.py
UTF-8
517
3.53125
4
[]
no_license
# adding two binary numbers def addbin(a, b, n): ''' a: List of binary bits b: List of binary bits n: number of bits in a and b ''' carry = 0 i = n - 1 c = [] while i >= 0: ans = carry + a[i] + b[i] if ans > 1: carry = 1 if ans == 2: ...
true
aa447f35fef815bb22309176c701813cc24c41a6
DzungHg/TinhDauTuMay_Py
/GiaInNhanhTheoBang.py
UTF-8
272
2.734375
3
[]
no_license
from TinhToan import giaInNhanhTheoBang #dữ liệu để tính giá in nhanh #/dữ liệu giá bảng 1 level_steps = [1, 11, 51, 101] level_prices = [20000, 7000, 4000, 3000] #bảng 2 #tính thử theo bảng 1 print(giaInNhanhTheoBang(level_steps, level_prices, 1))
true
6dbb02ad06afe29a187abb8cd5cdf08dd3756e41
wasade/bloom-analyses
/ipynb/filterbiomseqs.py
UTF-8
3,274
2.84375
3
[]
no_license
#!/usr/bin/env python """ Filter sequences from a biom table based on a fasta file used for AG bloom filtering """ # amnonscript __version__ = "1.4" import biom import argparse import sys def iterfastaseqs(filename): """ iterate a fasta file and return header,sequence input: filename - the fasta file name ...
true
951a2d45d447f88a3db34d85831fe6796b24faca
AvinashBolineni/tcs_digital_17_18_07_21
/code_2.py
UTF-8
412
3.15625
3
[]
no_license
n = input() list_a = [] if n <= 100: for i in range(0,int(n)): # print((input()) list_a.append(int(input())) zero = [] one = [] two = [] for list_a_ele in list_a: if list_a_ele == 0: zero.append(str(list_a_ele)) elif list_a_ele == 1: one.append(str(list_a_ele)) ...
true
4db83ff78d22616894a12d1f3ead1582b9adc684
Csquid/Isacc-organize-item-site
/public/img/isaac_items/test.py
UTF-8
688
2.53125
3
[]
no_license
import os import glob import shutil files = glob.glob('F:/D-Programming/2020/Study Language/Node/node-js-web/2020-09/Isacc-organize-item-site/public/img/isaac_items/accessory/*.png') src = 'F:/D-Programming/2020/Study Language/Node/node-js-web/2020-09/Isacc-organize-item-site/public/img/isaac_items/test/test2/' dir =...
true
0073144c2fe86e2543e74fdd425ac18f8a6897e4
Tao-Kim/study_algo
/programmers/p12_43105_정수삼각형.py
UTF-8
757
3
3
[]
no_license
def solution(triangle): for i, floor in enumerate(triangle): if i == 0: continue for j, num in enumerate(floor): if j == 0: triangle[i][j] += triangle[i-1][j] elif j == i: triangle[i][j] += triangle[i-1][j-1] else: ...
true
b2803594d5d484dade6c97a38b860d0ba020f398
swarmer/cfglib-py
/cfglib/sources/env.py
UTF-8
1,387
2.84375
3
[ "MIT" ]
permissive
import os from ..config import ConfigProjection, ProjectedConfig, ProxyConfig # pylint: disable=too-many-ancestors class EnvConfig(ProjectedConfig): """A config that takes its contents from the environment.""" def __init__(self, prefix: str = '', lowercase: bool = False): projection = EnvConfigProje...
true
cd7cdf2fbe5e61a532738a6c97b634b46d0e0f3a
pyvista/pyvista-docs
/version/0.40/api/plotting/charts/_autosummary/pyvista-ChartPie-title-1.py
UTF-8
141
3.03125
3
[]
no_license
# Create a pie chart with title 'My Chart'. # import pyvista chart = pyvista.ChartPie([5, 4, 3, 2, 1]) chart.title = 'My Chart' chart.show()
true
b63c68a384bf22ffeae648d820f060b24058035b
c4s4/django-rest
/api/tests.py
UTF-8
5,197
2.515625
3
[ "Apache-2.0" ]
permissive
# encoding: UTF-8 # pylint: disable=line-too-long,invalid-name,missing-docstring,no-member import json from django.test import TestCase, Client from django.contrib.auth.models import User from api.models import Customer class CustomerTestCase(TestCase): def setUp(self): User.objects.create_user(username...
true
7439b9d085b7b1b6170df731c951a08c91483f2a
nonowd/dj
/blog/templates/blog/date.py
UTF-8
611
2.703125
3
[]
no_license
{% extends "base.html" %} {% block title %}Ma page d'accueil{% endblock %} {% block content %} <h2>Bienvenue !</h2> <p>La date actuelle est : {{ date }}</p> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus massa non tortor. Vestibulum diam diam, posuere in viverra in, ...
true
f8cbc614b94e51316c016ca6602185f7c7a402a4
VadimVolynkin/learning_python3
/01_datatypes/02_numbers.py
UTF-8
4,563
3.15625
3
[]
no_license
# ================================================================================================================ # NUMBERS # ================================================================================================================ # неизменяемый тип # Атомарный объект # int вес - 24 байта целые числа # flo...
true
8b2b114a3a2f7e2f8c368e81f4d0bd32007ef72c
farazmah/hyperparameter
/hyperparameter/xgb.py
UTF-8
2,453
2.890625
3
[ "MIT" ]
permissive
""" Xgboost hyperparameter tuning module """ import xgboost from hyperopt import fmin, tpe, hp from hyperopt.pyll import scope from .base import Hyperparameter from .utils import logger class XgboostHyper(Hyperparameter): def __init__(self, is_classifier=False): super().__init__(is_classifier=False) ...
true
4139391a999571fd6e5d4efd551cb8a7d927a0e9
Aasthaengg/IBMdataset
/Python_codes/p03127/s585248107.py
UTF-8
203
3.0625
3
[]
no_license
N = int(input()) A_list = list(map(int, input().split())) def gcd(v1, v2): if v2 == 0: return v1 return gcd(v2, v1%v2) tmp = A_list[0] for a in A_list: tmp = gcd(tmp, a) print(tmp)
true
854deb0a22eeb8d2a093c4927564eab0cba83da1
NapoleonWils0n/cerberus
/ffmpeg/curve2-ffmpeg.py
UTF-8
1,809
2.765625
3
[]
no_license
# https://video.stackexchange.com/questions/16352/converting-gimp-curves-files-to-photoshop-acv-for-ffmpeg import re #make generator lower=0 upper=1 length=256 zerotoonestepped256gen = [lower + x*(upper-lower)/length for x in range(length)] def formatForFFMPEG(values): serializedValues = values.split(' ') lis...
true
120d6e205136a7f7470520a976226754676f00be
Iseke/BFDjango
/week1/CodeingBat/Logic-1/squirell_play.py
UTF-8
157
2.59375
3
[]
no_license
upper = 0 def squirrel_play(temp, is_summer): if is_summer: upper = 100 else: upper = 90 return 60 <= temp and temp <= upper
true
e77c65afe2d0b3eb8cab5af6459f44ede1bf0a7c
marcuscarr/UCB_cs61a
/lab/lab3/lab3.py
UTF-8
1,431
4.09375
4
[]
no_license
def sum(n): if n == 0: return 0 else: return sum(n - 1) + n def ab_plus_c(a, b, c): if b == 0: return c else: return ab_plus_c(a, b - 1, a) + c def hailstone(n): """Print the hailstone sequence starting at n and return its length. >>> a = hailstone(10) # Seve...
true
413247ed1f90229284131a048c5d532ceb58058d
ralicagulubova/Thinkpython
/Hangman/game.py
UTF-8
981
2.75
3
[]
no_license
""" Final game""" from ClassPlayer import Player from ClassDisplay import HangmanDisplay from ClassWord import Word from ClassGame import Game #import gettext import logging def main(): """ pass""" from ConfigParser import SafeConfigParser parser = SafeConfigParser() parser.read("ConfigParser.ini") ...
true
f6615226e8d0346619a28a851fba2e2526e4cb7b
Divyansh12/SuperPACs
/server/src/datasource/__init__.py
UTF-8
1,471
2.984375
3
[ "Apache-2.0" ]
permissive
""" File: datasource/__init__.py Author: Spencer Norris and Kevin Reitano Description: Implementation of Datasource base class. """ import requests import json class APIKeyException(Exception): """ Class for defining Datasource instantiation errors where the user has provided an API key or t...
true
c47b6537ec7ae4168301845a778aecd8384fe0f3
tlming16/Project_Euler
/python/p012.py
UTF-8
1,156
3.265625
3
[ "MIT" ]
permissive
#!/usr/bin/python3 #-*- coding:utf-8 -*- # author: mathm # email: tlming16@fudan.edu.cn from factor_pair import factor_pair from is_prime import is_prime class solution: __slots__=('num') def __init__(self,n:int): self.num=n def factor_num(self,num:int): n=num pair_n = fac...
true
e8ff2b7c24b8c13fe7bf6b409ad6b11486518190
ksiailaohuyou/AI_code
/machine_learn/Regression/Tree/iris_random_forest.py
UTF-8
1,249
2.734375
3
[]
no_license
from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import make_moons from sklearn.model_selection import train_test_split from sklearn.ensemble import BaggingClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn.datasets import load_iri...
true
5a422cb3e2c66095feedf6f7d3b34699a3bf4422
sandy2864/VI
/alex.py
UTF-8
3,679
3.09375
3
[]
no_license
# importing pyttsx3 import pyttsx3 # importing speech_recognition import speech_recognition as sr import datetime # creating take_commands() function which # can take some audio, Recognize and return # if there are not any errors def take_commands(): # initializing speech_recognition r = sr.Recogn...
true
c2145ddc1f67f05c65e03142cebc229eb9ffe7e8
cmquintanilla/titanic-database-charts
/Evaluacion03/Evaluacion03.py
UTF-8
706
2.875
3
[ "MIT" ]
permissive
import functions as fnc import pandas as pd import os os.system("cls") fnc.welcome() df = fnc.loadCSVFile('Listade_Pasajeros_del_Titanic.csv') #fnc.inspectingData(df) df = fnc.cleaningData(df) #print(df.isnull().sum()) while True: fnc.menu() option = input(" Please type your option: ") if fnc.optionValid...
true
3d6559d72cdab38c45a6aceabaca8628293a5a00
Nahayo256/cswpy
/10.py
UTF-8
1,702
4.15625
4
[]
no_license
#An administrator is a special kind of user. Write a class called #Admin that inherits from the User class you wrote in Exercise 9-3 (page 166) # or Exercise 9-5 (page 171). Add an attribute, privileges, that stores a list # of strings like "can add post", "can delete post", "can ban user", and so on. # Write a method ...
true
19af3f61d25b80c206f71dc55e1854440fc649c5
Hongze-Wang/TargetOffer
/ctrip09082.py
UTF-8
613
3.671875
4
[]
no_license
# 第二题:按规律输出矩阵,给定矩阵大小,沿主对角线方向,锯齿形打印1~n在矩阵中 # 找规律题 需要多练习几道 # 一般如果数字在主对角线就是 i = j,在同一条副对角线上就是 i + j = k for some k # 矩阵最右下角 行号和列号之和为 (m-1) + (n-1) = N m, n = map(int, input().split()) matrix = [[0] * n for _ in range(m)] N = m-1 + n-1 t = 1 for k in range(N+1): i = min(k, m-1) # i不会超过m-1 while i > -1 and -1 < k...
true
463895c079eb576f44aa6adb5a4c4656e260fc73
openstack/cloudkitty
/cloudkitty/backend/__init__.py
UTF-8
1,642
2.5625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # Copyright 2014 Objectif Libre # # 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 ...
true
dc81f5d063192290c20e297d867aca360b974946
ejolly/pymer4
/examples/example_02_categorical.py
UTF-8
9,230
3.859375
4
[ "MIT" ]
permissive
""" 2. Categorical Predictors ========================= """ ############################################################################### # The syntax for handling categorical predictors is **different** between standard regression models/two-stage-models (i.e. :code:`Lm` and :code:`Lm2`) and multi-level models (:co...
true
efdf7441decbd4dfbad9a4403d0faffa0e5a7082
Pirayn/StudManager
/tests/covetrics.py
UTF-8
3,621
2.671875
3
[]
no_license
import requests import re from lxml import html import time STARTING_URL = 'http://localhost:8080/' filename = "/Users/artem/Desktop/StudManager/tests/frontTests.py" class PageElementFinder(object): """Visual elements finder""" def __init__(self): self.TotalElementList = [] self.BaseUrl = ''...
true
6f09355693c85c0aa21d457c823bca2ffeef6bbb
autotest2017/suntest
/UnittestAll.py
UTF-8
942
3.53125
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest #按住ctrl,然后点击unittest就可以看到这个模块的定义 class ClassExample(unittest.TestCase): #按住ctrl,然后点击TestCase就可以看到这个类的定义 # 定义了一个ClassExample类,继承unittest.TestCase这个类,这样在这个类里面就能使用unittest.TestCase里的方法了 def test_add_sum1(self): #每一个测试用例都要用test_开头 ...
true
cc455ba682d67f3acdd8950fe76fd63b93df5dfb
jaejaejae/indian-election
/topic-geo/parserGeo.py
UTF-8
702
2.640625
3
[]
no_license
import json import nltk from bs4 import BeautifulSoup f_in = open('tweets.txt','r') f_geo = open('geo.txt','w') for line in f_in.readlines(): js_data = json.loads(line) usr_id = js_data['id'] if 'geo' in js_data.keys(): geo = js_data['geo'] else: geo = 'nogeo' time = js_data['pub_ti...
true
9d275594c3aabae4904cbdc0daf7dd65440b17d8
great-benny/AI_local_global_search
/nQueenMain.py
UTF-8
6,302
2.78125
3
[]
no_license
#!/usr/bin/python from random import randint import sys,copy from utility import * from termcolor import colored from optparse import OptionParser try: import psyco psyco.full() except ImportError: pass from hillClimbing import * from geneticAlgo import * """ cowboy code, but seems to work USAGE: python pro...
true
861cf704e07933e97e5ca009320bb7a00a2617ac
igorvalamiel/material-python
/Exercícios - Mundo 2/068.py
UTF-8
1,059
3.765625
4
[ "MIT" ]
permissive
from random import choice print('=-='*10) print('VAMOS JOGAR PAR OU ÍMPAR!') print('=-='*10) print('') a = True c = list(range(10)) while a: print('-'*30) b = str(input('Par ou ímpar? [P/I]: ')).upper().strip() d = int(input('Digite seu número:')) e = choice(c) f = e + d if f % 2 == 1 and b == '...
true
1d18809b0277e4c97804f24d834f3717232b222a
sdwilliams847/amadon
/apps/amadon_app/views.py
UTF-8
1,578
2.71875
3
[]
no_license
from django.shortcuts import render, redirect PRODUCTS = [ { "id": 1, "name": "Dojo Tshirt", "price": "19.99", }, { "id": 2, "name": "Dojo Sweater", "price": "29.99", }, { "id": 3, "name": "Dojo Cup", "price": "4.99", ...
true
d32849ff8307a92540a4a10f7daa589dced5c245
pikuch/AOC19
/Day04.py
UTF-8
1,443
3.6875
4
[]
no_license
# AOC19 day 04 def load_data(f_name): with open(f_name, "r") as f: data_read = f.read() return data_read def count_passwords(digits, has_pair, val_range): if len(digits) == 6: if has_pair and val_range[0] <= digits <= val_range[1]: return 1 else: return 0 ...
true
fefb2f3f46bb7f0cda85d6eb7395347d25da180f
w5802021/leet_niuke
/Linked_list/single_linkedlist.py
UTF-8
4,064
3.53125
4
[]
no_license
import math class LNode: def __init__(self,elem,next_=None): self.elem = elem self.next = next_ class LinkedListUnderflow(ValueError): #自定义链表抛出异常错误 pass class LList: def __init__(self): self._head = None def is_empty(self): return self._head is None d...
true
04b1ee1eed628f439e7f83db5d0b38d630c14a5a
mikepaxton/StarClucks
/main.py
UTF-8
8,443
3
3
[]
no_license
""" main.py Author: Mike Paxton Creation Date: 12/01/2020 Python Version: 3 Free and open for all to use. But put credit where credit is due. OVERVIEW:----------------------------------------------------------------------- A simple program which opens and closes a chicken coop door at sunrise and dusk. I use dusk to...
true
e86caac744b33a1c013f83115946d60c374bd355
bobcaoge/my-code
/python/leetcode/345_Reverse_Vowels_of_a_String.py
UTF-8
803
3.234375
3
[]
no_license
# /usr/bin/python3.6 # -*- coding:utf-8 -*- class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ s_list = list(s) vowels = "aeiouAEIOU" start = 0 end = len(s) - 1 while start < end: if vowels.__cont...
true
9a745d2d0ef20492d63c3871cc5e216e0d4fc99c
Huang-chi/face_classification
/src/test.py
UTF-8
1,178
2.640625
3
[ "MIT" ]
permissive
import cv2 as cv import matplotlib.pyplot as plt import random as rd import pandas as pd from emotion_icon import load_emotion_icon angry_man = None all_image = load_emotion_icon() # images = pd.DataFrame(all_image) # print(all_image['angry_man']) # load # angry_man = cv.imread("./img/angry_man.jpg...
true
886e6436f34831102d2a1d04fd42db86ebcf6736
xifeiwu/workcode
/python/python-abc/other/myclass.py
UTF-8
377
3.25
3
[]
no_license
#!/usr/bin/python class abc: i=12345 def f(self, p): if(p == "True"): print "value of i:", self.i return self.i @staticmethod def gfunc(v): print "static method:\t", v print "static method: %s", f(True) def outfunc(): a = abc() a.f('True') abc.gfun...
true
b0b2050faa0e199a9ab7f29d19a11f902b2d35b0
MaximZolotukhin/erik_metiz
/chapter_7/exercise_7.5.py
UTF-8
1,435
4.21875
4
[]
no_license
""" Билеты в кино: кинотеатр установил несколько вариантов цены на билет в зависимости от возраста посетителя. Для посетителей младше 3 лет билет бесплатный; в возрасте от 3 до 12 билет состоит 10 долларов; наконец, если возраст посетителя больше 12 лет, билет стоит 15 долларов. Напишите цикл, который предлагает пользо...
true
b16e1aef1feaed0b638a0f4289c09cb8daeb166d
jimjshields/python_learning
/euler/3.py
UTF-8
545
3.8125
4
[]
no_license
# https://projecteuler.net/problem=3 import math num = 600851475143 primes = [] def all_divisors(num): divisors = [] sqr = int(math.sqrt(num)) for i in range(2, sqr + 1): if i not in divisors: if num % i == 0: divisors.append(i) divisors.append(num/i) return sorted(divisors) def check_if_prime(num)...
true
8c1fd58eab69ea21c99b754d0f60752ce4fb2ced
amosjyng/healthcare-scheduler
/bailey_welch.py
UTF-8
5,092
2.65625
3
[]
no_license
import generate_patients as gp from collections import deque import pymc as mc import sys def time_str(time): return '%i:%02i' % (time/60, time % 60) doctor_busy = False wait_times = [0 for _ in range(gp.N_PATIENTS)] idle_time = 0 overtime = 0 ####### SCHEDULING days = [{}] day = 0 # current day, don't touch when ...
true
c770874e533e58eb30c3776ad12b4bdf7fef4a92
natalie-i/gh
/HT_3/3.py
UTF-8
722
4.34375
4
[]
no_license
""" 3. Написати функцію < is_prime >, яка прийматиме 1 аргумент - число від 0 до 1000, і яка вертатиме True, якщо це число просте, и False - якщо ні. """ def is_prime (a): if a in range(1001): if a<2: print('Введене число не є простим або складеним') return() else: n=0 for i in range(1,a+1): if a%...
true
f907415ea5fb7ae592ca76b7953e70325aa37cbe
lamer34/latest_lamer
/tasks.py
UTF-8
373
3.109375
3
[]
no_license
import pyautogui import numpy moduls = ["pyautogui", "numpy"] def scroll_mouse(): pyautogui.moveTo(100, 200) def scroll_again(): pyautogui.moveTo(500, 100) def write_numbers(): print(numpy.arange(10)) def any_func(): pass def main(): scroll_mouse() scroll_again() write_numbers() ...
true
eb73a15d37218f039690d6626dec1ba4e42a12e8
chrisrgunn/cs156project
/PEAK-0.5a4dev_r2085/src/peak/util/tests/test_mockets.py
UTF-8
7,039
2.546875
3
[ "Python-2.0" ]
permissive
from unittest import TestCase, makeSuite, TestSuite import peak.util.mockets as mockets import errno class SystemTests(TestCase): def setUp(self): self.ss = mockets.SocketSystem() def testMakeSocket(self): ss = self.ss sock = ss.socket(ss.AF_INET, ss.SOCK_STREAM) ...
true
493f06bfbcbded934b9405ee21b1f4f79e695997
cariasmartelo/shcp_ing_tribut
/scripts/models_multivariate.py
UTF-8
53,438
2.796875
3
[]
no_license
''' SHCP UPIT Forecasting Public Revenue Models ''' import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import statsmodels.api as sm from statsmodels.tsa.arima_model import ARIMA, ARMA from statsmodels.tsa.vector_ar.var_model import VAR from dateutil.relativedelta im...
true
2badc24d173016377f5bde4dc8772c3b10f554fe
KD4N13-L/Combat-Tracker
/Tests/Test 08.6 Button Sound (copied from Lilit).py
UTF-8
648
3.203125
3
[]
no_license
from tkinter import * def onclick1(): import winsound winsound.Beep(800, 300) def onclick2(): import winsound winsound.Beep(600, 300) root = Tk() topFrame = Frame(root) topFrame.pack() bottomFrame = Frame(root) bottomFrame.pack(side=BOTTOM) button1 = Button(bottomFrame, text="Next Page", fg="red...
true
ac941b037a17d40b6df3e11caf0b92254d85afd4
PatelProjects/ProjectEulerAlternateSolutions-with-Explanations
/23.py
UTF-8
1,098
3.6875
4
[]
no_license
# sumOfDiv consumes a number and returns the sum of the numbers divisors def sumOfDiv(n): sum = 1 i = 2 # We only need to check up until the square root of the number while i * i < n: if n % i == 0: sum += i + n // i i += 1 ...
true
d6504ba9c9dc7256369ea13824553ec3e206aab5
breuleux/breakword
/examples/demo2.py
UTF-8
546
2.984375
3
[ "MIT" ]
permissive
import breakword as bw def lfsr_hash(state): bw.brk() result = 0 for i in range(32): bit = ((state >> 0) ^ (state >> 2) ^ (state >> 3) ^ (state >> 5)) & 1 state = (state >> 1) | (bit << 15) result = (result << 1) | bit return result def myhash(word): h = 0...
true
6cab34dc51e8df93796f87e8c5981d37b742fb70
doomedxx/RolDieShit
/View/temperature.py
UTF-8
1,418
2.9375
3
[]
no_license
from tkinter import * import Frame.mainframe as mainframe import View.widgetValues as value from Controller import temp_controller as controller class tempwidget: ## Creates the block where current temperature is shown mainframe.widgetList.append("Temperature") tempWidgetPosX = 25 tempWidgetPosY = 70 ...
true
f32df7292fb96afe1af25ae5ba2ab216aef182a7
decastro-alex/Design-of-Computer-Programs-1
/lesson3e.py
UTF-8
5,000
3.6875
4
[]
no_license
""" changing functions as a design pattern (e.g., using function decorators) changes should ensure backwards compatibility of the functions; that is, the functions should still be able to be used in the way that they used to, in addition to new ways that your changes/refactoring seeks to accomplish; the general ...
true
f08398e6e3351f88651393b435d8b5f45e6fadb8
chirag-j/Eklavya-2017
/Room org 1/Aruco detect/Auto canny.py
UTF-8
1,282
2.546875
3
[]
no_license
import numpy as np import cv2 def auto_canny(image, sigma=0.33): # compute the median of the single channel pixel intensities v = np.median(image) # apply automatic Canny edge detection using the computed median lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v)) edged = ...
true
d70cc0e714938e5e383b70645687aab554c3510e
andymtv/pythonLessons
/FuncProgrConcepts.py
UTF-8
1,437
4.46875
4
[]
no_license
def multiply_by2(li): new_list = [] for item in li: new_list.append(item*2) return new_list print(multiply_by2([1,2,3])) # This function keeps us DRY(Do not Repeat Yourself) def new_multiply_by2(item): return item *2 # The Map Built-In function in Python gives us a way to execute ...
true
6f6b037fb2dd5851e5d93913e911702df3bf1f49
Axhar85/python-test-app
/hello.py
UTF-8
2,897
2.71875
3
[]
no_license
from darksky.api import DarkSky, DarkSkyAsync from darksky.types import languages, units, weather API_KEY = 'e2fea81b36c2588f1315c4ad2b721989' # Synchronous way darksky = DarkSky(API_KEY) latitude = 42.3601 longitude = -71.0589 forecast = darksky.get_forecast( latitude, longitude, extend=False, # default `F...
true
b00de2936eacb5fd50cdbfac2b643386d1285feb
skyree010/Python
/duplicates.py
UTF-8
1,193
2.828125
3
[]
no_license
import os,sys directoryname = sys.argv[1] print("NAZWA FOLDERU: ", directoryname) current = os.getcwd() dirloc = os.path.join(current,directoryname) xd = os.listdir(directoryname) duplicatesbycontain = list() duplicates=dict() for values in xd: path = os.path.join(dirloc,values) if os.path.i...
true
b85557b46c4c6f45c805e4745e17f19b67c3f8df
ISANGDEV/Algorithm_Study
/11_Test_Greedy/Hyunmin/CH11_5.py
UTF-8
275
2.921875
3
[]
no_license
import sys # n, m = sys.stdin.readline().rstrip().split() data = list(map(int, sys.stdin.readline().rstrip().split())) cnt = 0 for i in range(len(data)): for j in range(i + 1, len(data)): if data[i] == data[j]: continue cnt += 1 print(cnt)
true
715cbfebf8d4239214fd7cec3130613dc3b93230
digideskio/datatemplate
/examples/example_forselect.py
UTF-8
670
2.65625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python import datatemplate LANG_NAMES = dict( en='English', es='Spanish', ru='Russian', nl='Dutch', de='German', ) TEMPLATE = ''' Results greater than {{threshold}}%: {% forselect *, `Metric 1 F` AS result FROM data WHERE Test = "test1" AND result > {{threshold}...
true
6b407f7d3bcb782d9db39a38f2a722f925f67829
Teeeeeeeeeed/GaleShapely-Algorithm
/GaleShapely.py
UTF-8
2,250
2.8125
3
[]
no_license
import sys import collections #import time #from testrandomcase import randomcase #from worstcase import worst_case #if odd -> man #if even -> woman # try deque collection for all lists # std out for print #strings = randomcase(1000) strings = sys.stdin.readlines() #start_time = time.time() cases = int(strings[2].s...
true
3ea254e40b779cd3d01da0a03bc03b7d65184b08
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/1562.py
UTF-8
1,870
3.328125
3
[]
no_license
#! /usr/bin/env python import sys ARRANGEMENT_SIZE = 4 MULTIPLE_SOLUTIONS = "Bad magician!" NO_SOLUTION = "Volunteer cheated!" def solve_magic_trick(first_row, first_arrangement, second_row, second_arrangement): first_index = first_row - 1 second_index = second_row - 1 first_row = first...
true
11e511378d7d46324eb4be32ff5e4aefe7d96195
SboneloMdluli/Automatic-Music-Transcription-using-Deep-Learning
/Digital Signals Processing/model_input.py
UTF-8
3,420
2.59375
3
[]
no_license
# View Spectrogram of the Audio File.. # Importing General Packages import numpy as np import skimage import skimage.io import librosa import librosa.display from glob import glob import os import h5py # Define Variable Q-Transform Parameters for Audio Signals Processing fs = 44100 # Sampling frequency...
true
88d1db7ac1d8b5b21bb3118a767c5b0a4cdafc97
erose/Scheduler
/windows.py
UTF-8
7,305
3.5
4
[]
no_license
import curses, calendar, datetime import shared class Window(): def __init__(self, height, width, startx, starty): self.width, self.height = width, height self.startx, self.starty = startx, starty #The underlying curses window. self.window = curses.newwin(height, width, startx, sta...
true
05880ab7fee8ff4a4707485d4b0d2ca06216412f
wahyubimantara/Python-Programming
/hybrid metode K-Means dengan ACO/salesAsli.py
UTF-8
1,714
3.015625
3
[]
no_license
import numpy as np import pandas as pd from geopy.distance import great_circle def runSales(): def PerjalananSalesAsli(file_name): def Data(): df = pd.read_excel(file_name) print("\nHasil Perjalanan Sales PT Indomarco Adi Prima Nganjuk") print(file_name) ...
true