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 |
|---|---|---|---|---|---|---|---|---|---|---|
45d1a22688f1998a4c3f33b497810379b9c43379 | embarktrucks/sour | /sour/common/colors.py | UTF-8 | 508 | 2.796875 | 3 | [
"Zlib"
] | permissive | colors = {
"green": "\f0",
"blue": "\f1",
"yellow": "\f2",
"red": "\f3",
"grey": "\f4",
"magenta": "\f5",
"orange": "\f6",
"white": "\f7",
}
save = "\fs"
restore = "\fr"
class color_wrappers(object):
"""@DynamicAttrs"""
pass
def get_color_wrapper(color_fmt):
return stat... | true |
69c04602ab41b727af6622e183e8c9fc9b25a1bc | dylanBehetre/docker-task-builder_front-end | /scripts/task_loader.py | UTF-8 | 7,512 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
import sqlite3
import json
import subprocess
import os.path
import time
import re
'''
Author : Antoine-Adrien Parent
Ce script a pour but de lancer les tâches stockées en BDD.
Il va aller chercher en BDD les tâches prioritaires s'il y en a, sinon il ira chercher les tâches non-prioritaires.
Pour t... | true |
993218f90ae344d722195fdafead97311a2ff7e1 | csoeller/offsetpiezo-tracking-simulation | /sampleTimeCourse.py | UTF-8 | 865 | 2.921875 | 3 | [] | no_license | import numpy as np
class sampleTC():
def __init__(self,ntics,amp=50,period=100,mode='sin',rawz=None):
self.ntics = ntics
self.amp = amp
self.period = period
self.mode = mode
self.rawz = rawz
self.initialise()
def initialise(self):
self._t = np.arange(sel... | true |
8c8a7c2e7773f61b86a02c46281ce5f2f4028f35 | Nao8426/uni_class | /1seme/Wed_4/kadai1/sample.py | UTF-8 | 4,637 | 3.296875 | 3 | [] | no_license | # サンプルプログラム(python用)
import cv2
import math
import numpy as np
import os
import time
os.chdir(os.path.dirname(os.path.abspath(__file__)))
def mosaicGetMin(image3, image4, xmin, xmax, ymin, ymax, tmin, tmax, tstep, width1, height1, width2, height2):
min = 1.7976931348623157e+308
t = tmin
wh... | true |
80ac5b686eea4fdb368fc0bac3c8106f56ae007f | Underlor/WSGI_Tander | /core/template_parser.py | UTF-8 | 5,064 | 2.84375 | 3 | [] | no_license | import collections
import re
from core.Exceptions import IncludeError
from project_core import settings
def get_value_by_keystr(keystr, dictionary):
"""
Функция для обработки переменных шаблона как в Jinja
:param keystr: строка с цепочкой переменных через '.'
:param dictionary: словарь для обрабо... | true |
43fc9fe38304e541454615c2ee145ae13a57ba01 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/16396fb104c74fccbc86992f8a0ce473.py | UTF-8 | 676 | 3.609375 | 4 | [] | no_license | def hamming(original, mutation):
# Make the sequences equal length. Only one of them will be
# padded and it will be padded with a non-nucleotide symbol (space),
# so it will be safe to compare to a nucleotide in the other sequence.
original = original.ljust(max(len(original), len(mutation)))
muta... | true |
6bc625d6b9deaf578ac2edc5225cf23fa8e9fcfe | rcehemann/kaggle_titanic | /titanic.py | UTF-8 | 8,397 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 07 13:38:34 2017
@author: blenderherad
"""
#############################################
# import packages
#############################################
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.ensemble import RandomForestClas... | true |
b22e0224c6d409aef60f1dd984c4be8b52073b5d | Gleb-Vagin/survival | /blocks.py | UTF-8 | 906 | 2.875 | 3 | [] | no_license | import pygame
import settings
import player
BLOCK_TYPE_GROUND = 1
BLOCK_TYPE_WOOD = 2
BLOCK_TYPE_STONE = 3
class Block(pygame.sprite.Sprite):
def __init__(self, x, y, tip):
pygame.sprite.Sprite.__init__(self)
self.rect = pygame.Rect(x, y, 37, 36)
self.tip = tip
self.... | true |
3f726af4cb65a0c93c61c6f210d24787e14b4125 | chess-seventh/spotify-playlist-downloader | /main.py | UTF-8 | 4,385 | 2.90625 | 3 | [] | no_license | """
Spotify Downloader
"""
from __future__ import unicode_literals
import os
import json
import argparse
from youtubesearchpython import SearchVideos
import youtube_dl
from youtube_dl.utils import DownloadError
from youtube_dl.utils import ExtractorError
import spotipy
from config import CLIENT_ID
from config import CL... | true |
94873ae9e122de9a7204d36034ffac98127db1c3 | eEcoLiDAR/laserchicken | /laserchicken/io/load.py | UTF-8 | 665 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import sys
from laserchicken.io import get_io_handler
from laserchicken.utils import add_metadata
def load(path, format=None, *args, **kwargs):
"""
Read point cloud from a file.
:param path:
:param format:
:param args: optional non-keyword arguments to be passed to the format-specific writer
... | true |
f387022d721c5beafcbf3a6a785ac7ef31287c23 | Aurora-yuan/Leetcode_Python3 | /0567 字符串的排列/0567 字符串的排列.py | UTF-8 | 1,825 | 3.40625 | 3 | [] | no_license | #label: slide window difficulty: medium
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
if len(s1) > len(s2):
return False
s1_hash = {}
s2_hash = {}
for i in range(len(s1)):
if s1[i] not in s1_hash.keys():
s1_hash[s1[i]] =... | true |
4ee9440547adc04f516d10c0ff12c9fb27821f30 | cooparation/FCN_play | /tools/Image_resize/single_iamge.py | UTF-8 | 238 | 2.765625 | 3 | [] | no_license | # coding = utf-8
import Image
def convert(width,height):
im = Image.open("C:\\xxx\\test.jpg")
out = im.resize((width, height),Image.ANTIALIAS)
out.save("C:\\xxx\\test.jpg")
if __name__ == '__main__':
convert(256,256) | true |
5ebb12a67c6995cc01c45190aaa5a6ce37a67d2f | nickliqian/keep_learning | /KnowledgeMapping/TensorFlowExp/1-Code/14-手写集自定义图片训练.py | UTF-8 | 5,315 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import os
import numpy as np
import tensorflow as tf
from PIL import Image
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
# 第一次遍历图片目录是为了获取图片总数
input_count = 0
for i in range(0, 10):
dir_path = 'D:\\A\\data\\mnist\\mnist_digits_images\\%s\\' % i # 这里可以改成你自己的图片目录,i为分类标签
... | true |
12b8737645ab0d4d0d0ca6b4a68aa5bb6650085e | wenjuanchendora/Python_Study | /2017-11/2017-11-28.py | UTF-8 | 4,050 | 4.34375 | 4 | [
"MIT"
] | permissive | """
Python 练习_01
date: 2017-11-28
"""
# 算数运算符
a = 21
b = 10
c = 0
c = a + b
print ("Line 1 - Value of c is", c)
c = a - b
print ("Line 2 - Value of c is", c)
c = a * b
print ("Line 3 - Value of c is", c)
c = a / b
print ("Line 4 - Value of c is", c)
c = a % b
print ("Line 5 - Value of c is", c)
a = 2
b = 3
c = ... | true |
d1f139d5534e1766fc57e7f85458eac3a3d06930 | F3DS/f3ds | /socialswarm/src/network/__init__.py | UTF-8 | 1,471 | 3.25 | 3 | [] | no_license | """
Some basic definitions for use by all social networks.
"""
class NoTimeWindowSetException(Exception): pass
class NoTimeWindowStartException(Exception): pass
class NoTimeWindowEndException(Exception): pass
class TimeWindowMixin(object):
def __init__(self, begin, end):
super(TimeWindowMixin, self).__in... | true |
69c21e247a678da0318695712a1d31e85fdc0f11 | Murarishetti-Shiva-Kumar/Python-Deep-Learning-Programming | /ICP 2/Lb_to_Kg.py | UTF-8 | 966 | 4.625 | 5 | [] | no_license | """
Write a program, which reads weights (lbs.) of N students into a list and convert these weights to kilograms in a separate list using:
1) Loops and
2) List comprehensions
N: No of students (Read input from user)
Ex: L1: [150,155, 145, 148]
Output: [68.03, 70.3, 65.77, 67.13]
"""
students_count = int(input("Enter ... | true |
a704e1e3860b644c40a9e3a21204fce1fc1354cc | inunarun/morph-matrix | /morphologicalmatrix/system.py | UTF-8 | 2,746 | 2.765625 | 3 | [] | no_license | """
:author: inunarun
Aerospace Systems Design Laboratory,
Georgia Institute of Technology,
Atlanta, GA
:date: 2018-04-15 15:19:32
"""
from .matrixnodecollection import MatrixNodeCollection
from .compatibilitymatrix import CompatibilityMatrix
from .component import Compo... | true |
f14b52073894e095f4540d58eee77ff0aa4930fa | acanizares/advent_of_code | /day01.py | UTF-8 | 504 | 3.546875 | 4 | [] | no_license | from functools import reduce
from itertools import cycle
file = "input01.txt"
with open(file, 'rt') as f:
lines = f.readlines()
# Part 1
def sum_str(a: str, b: str):
return int(a) + int(b)
res1 = reduce(sum_str, lines)
print(f"The result is: {res1}")
# Part 2
lines_int = map(lambda x: int(x), lines)
freqs... | true |
3f1512e9826a0f7f3413cc040a4dc94e9e43fde8 | mamta238/AlgoClasswork | /allPairsShortestPath.py | UTF-8 | 1,283 | 3.09375 | 3 | [] | no_license |
def allPairs(cur,n,max1):
for i in range(n):
prev=cur
for j in range(n):
for p in range(n):
if(j==p):
cur[j][p]=0
elif(j==i or p==i):
cur[j][p]=prev[j][p]
else:
if(prev[j][p]<0 an... | true |
7f7f20c8a8cc86319aa63c95c660513487f82a0e | nightlight521/Snake-Game | /Snake Game.py | UTF-8 | 19,815 | 2.984375 | 3 | [] | no_license | #########################################
# File Name: APPLE VS ANDROID
# Description: My snake game!
# Author: Paula Yuan
# Date: November 2018
#########################################
from random import randint
import pygame
import time
pygame.mixer.pre_init(44100, -16, 2, 1024)
pygame.init()
WIDTH = 800
HEIGHT= 60... | true |
40ffd1387a3b46ca1a671e27320e5ffd527cc203 | shujuecn/cluster_entropy | /cluster_zf/prescript_cluster.py | UTF-8 | 8,029 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import sys
import itertools
import copy
from cluster_zf import utils
import cluster_zf.p1_preprocess as clus1
import cluster_zf.p2_relatives as clus2
import cluster_zf.p3_cluster as clus3
def gene_dic(path):
"""
根据同义词表创建词根到词的dict
:param path:同... | true |
09b2e3be729c3d2c5e3993521e548031ded941ed | Moortiii/aoc-2020 | /day15/part_1.py | UTF-8 | 1,169 | 3.703125 | 4 | [] | no_license | from collections import defaultdict
from tqdm import tqdm
with open("input.txt", "r") as f:
data = f.read()
# Puzzle input
starting_numbers = [int(num) for num in data.split(',')]
# Track the current turn
turn = 1
# Track when starting_numbers were previously mentioned
turns = defaultdict(list)
for number in s... | true |
a62ad594c4d427baaeaa08157c3b3b852cad4376 | turhancan97/Machine-Learning-Homeworks | /Decision Tree Regression House Sales in King Country.py | UTF-8 | 1,733 | 3.3125 | 3 | [] | no_license | #Importing the necessary libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import train_test_split
#loading data
data = pd.read_csv("C:/Program Files/Weka-3-... | true |
eafc566797b5eaab919e7aa2c607f58e0ac21b64 | Anfercode/Codigos-Python | /Clase 1/Capitulo4/Problema/Ejercicio6.py | UTF-8 | 413 | 4 | 4 | [] | no_license | ## Ejercicio 6
print('Ingrese un numero:')
Numero = int(input('->'))
Respuesta = 0
Lista = []
for i in range(1,11):
Respuesta = i * Numero
Lista.append(f'{Numero} * {i} = {Respuesta}')
print(Lista)
print('Fin del programa')
print('#####################')
print('Ingrese un numero:')
Numero = int(input('->'))
Li... | true |
917628f03cf8ab25cd17086634b76197b655fbfa | ljsh123ljsh/sim_station | /read.py | UTF-8 | 133 | 2.75 | 3 | [] | no_license | from binascii import b2a_hex
with open('rawdata.txt', 'rb') as file:
data = file.read()
data = b2a_hex(data)
print(data)
| true |
c593020c19e819e81c837da921799ffc56aa2262 | wj1224/algorithm_solve | /codility/python/codility_lesson8_2.py | UTF-8 | 871 | 3.25 | 3 | [] | no_license | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
def solution(A):
# write your code in Python 3.6
ans = 0
if len(A) != 1:
left = A[:1]
right = A[1:]
d_left = dict(Counter(left))
d_right = dict(Counter(right))
leader_left = max(d_left... | true |
6deeef41bbbb1314baa8d06e3dcf109b1d5e6e13 | Lemon2911/about-cryptography | /the cryptopals crypto challenges/Set 2/9. Implement PKCS#7 padding.py | UTF-8 | 1,202 | 3.765625 | 4 | [] | no_license | #!/bin/env python3
# -*- coding: utf-8 -*-
# version: Python3.X
"""
# 题目描述
A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into cipher text.
But we almost never want to transform a single block; we encrypt irregularly-sized messages.
One way we account for irregularly-sized messages i... | true |
f7472a605c9e230d39d609c9851e55d0173a1294 | spookypeanut/rippingscripts | /rescale_srt | UTF-8 | 962 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division, print_function
import sys
import re
factor = 1 / 0.96
time_regex = '(?P<{0}hour>\d{{2}}):(?P<{0}min>\d{{2}}):(?P<{0}sec>[\d,]*)'
start_regex = time_regex.format("start_")
end_regex = time_regex.format("end_")
timeline_regex = re.compile("%s --> %s" % (start_regex,... | true |
d976c65ebc26d73c109b21581e1cfcd6e2eb226e | krishnapvs/Interview | /inorder_iterative.py | UTF-8 | 1,506 | 3.828125 | 4 | [] | no_license | class Node:
def __init__(self,key):
self.key=key
self.left=None
self.right=None
class BinTree:
root=None
def add(self,key):
if self.root == None:
self.root=Node(key)
else:
if self.root.key>=key:
temp=self.root.left
... | true |
4100d4cb2c35033255b181eb0ebf291903ff1559 | vatch123/DA_RNN | /model/decoder.py | UTF-8 | 3,625 | 3.015625 | 3 | [] | no_license | import torch
import numpy as np
from torch import nn
from torch import optim
import torch.nn.functional as F
from torch.autograd import Variable
class Decoder(nn.Module):
"""Decoder in DA_RNN."""
def __init__(self, T, decoder_num_hidden, encoder_num_hidden):
"""
Initialize an decoder in DA_RN... | true |
7d5aa7bf7400f54aa9aec7d41dce106706842cef | animan123/Recommender-System | /word_histogram.py | UTF-8 | 1,623 | 2.703125 | 3 | [] | no_license | import time
import pandas as pd
import numpy as np
from _collections import defaultdict
import matplotlib.pyplot as plt
from collections import Counter
from matplotlib.pyplot import savefig
from question_info_parser import *
import matplotlib
def plot_user_info_data(df, col_name, k):
matplotlib.use('Agg')
countWordT... | true |
c3b4ab5a38371a4b9ab93353f8490a04ac97f040 | vlaadbf/B.Vlad | /youtube.py | UTF-8 | 452 | 3 | 3 | [] | no_license |
from youtube_dl import YoutubeDL
# change the format to bestaudio to get mp3 file.
audio_downloder = YoutubeDL({'format':'bestaudio'})
#This the link for my favorite song (you can put the link to your video).
link_to_youtube_video = str(input("Enter the URL of the video you want to download: \n>> "))
#download the... | true |
10f4b67aab518057291b47176e8bae0c68e79122 | aws-samples/aws-open-data-satellite-lidar-tutorial | /libs/solaris/vector/polygon.py | UTF-8 | 18,544 | 2.671875 | 3 | [
"Apache-2.0",
"MIT-0"
] | permissive | import os
import shapely
from affine import Affine
import rasterio
from rasterio.warp import transform_bounds
from rasterio.crs import CRS
from ..utils.geo import list_to_affine, _reduce_geom_precision
from ..utils.core import _check_gdf_load, _check_crs, _check_rasterio_im_load
from ..raster.image import get_geo_trans... | true |
d84098dcd5560ace64adb288fedbfd77689087b8 | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/_algorithms_challenges/leetcode/leetCode/Array/MaximumProductSubarray.py | UTF-8 | 3,191 | 3.578125 | 4 | [] | no_license | """
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.
Example 1:
Input: [2,3,-2,4]
Output: 6
Explanation: [2,3] has the largest product 6.
Example 2:
Input: [-2,0,-1]
Output: 0
Explanation: The result cannot be 2, because [-2,-1]... | true |
47dae49b798b9cd10a280132b9a19096f0f56322 | stjanv/home_work8 | /lesson5_task.py | UTF-8 | 3,771 | 2.828125 | 3 | [] | no_license | from datetime import datetime
import functools
from functools import singledispatch
from functools import lru_cache
import numbers
from collections import OrderedDict
import pprint
# task 1.1
def check_time(func):
def wrapper():
start = datetime.now()
res = func()
print(datetime.now() - sta... | true |
ba2605e3c0dc3abf071cd5d129932c356fc78b5d | RobD6/test-skill | /__init__.py | UTF-8 | 2,600 | 2.640625 | 3 | [] | no_license | from mycroft import MycroftSkill, intent_file_handler
import gkeepapi
from gkeepapi.node import Note, List
class Test(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
self._keep = gkeepapi.Keep()
def initialize(self):
email = self.settings.get('email')
password = ... | true |
e3ce785276faa39d6fbb659bd86766b1c42e9c97 | qixi7/Python | /fileWatcher/convent2utf8.py | UTF-8 | 1,689 | 2.8125 | 3 | [] | no_license | import chardet
import os
import json
import codecs
# 配置文件,默认当前目录下
fwConfig = json.load(open(os.getcwd() + "\config.json", encoding="utf-8"))
# 是否忽略文件类型
ignoreFileType = True
# 生成结果文件
retFile = open("transform.txt", "w")
retFile.write("--------------------- transform Test Begin -----------------------\n")
# 获取文件编码类... | true |
3fd6605f791518804fe0b9690b148f329ebf4ba0 | vavan/Encryption | /python/ssl-tunnel.py | UTF-8 | 4,711 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
import socket
import sys
import threading, time
import ssl
import logging
SOCKET_TIMEOUT = 3
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(message)s',
filename='ssl-tunel.log',
filemode='a'
... | true |
e2f91875ef2c8acb58353451635ecfc25aae2020 | 912-Crismariu-Ioana/EverydayTarot | /main.py | UTF-8 | 2,092 | 2.984375 | 3 | [] | no_license |
import discord
import os
import random
from bot.data import cards
from bot.card import Card
from bot.stay_alive import stay_alive
client = discord.Client()
@client.event
async def on_ready():
print('Successfully logged in as {0.user}!'.format(client))
@client.event
async def on_message(message):
if messag... | true |
9ac843653c13e8aa038e061ede4f0664e7b10ee0 | apatti/apatti_ml | /Naive_Bayes/Python/spamclassifier.py | UTF-8 | 928 | 3.125 | 3 | [
"MIT"
] | permissive | import csv
import sys
def getVocabulary(line):
vocabularyList = list(set(line.lower().split()))
return [word for word in vocabularyList if len(word)>3]
wordFreq={}
def train():
with open("../data/training.csv") as inputfile:
content = csv.reader(inputfile,delimiter=',')
for line in content... | true |
f080e467c0037531f4bac4ccc0040d2182feff18 | ChrisHayes31/Chris_Rasp_Pi_Programs | /Github Repo/Python Code/LCD_Screen_Driver/i2c_lcd_print_new.py | UTF-8 | 1,660 | 2.953125 | 3 | [] | no_license | """Implements a HD44780 character LCD connected via PCF8574 on I2C."""
# http://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/
#from i2c_lcd import I2cLcd
import I2C_LCD_driver
import time
import sys
# The PCF8574 has a jumper selectable address: 0x20 - 0x27
DEFAULT_I2C_ADDR = 0x3f
def test_main():... | true |
f3a0be73c5949f00a3928b32b9de9fe3d63edccf | cosmologyluke/symposium-organise | /symposium.py | UTF-8 | 8,224 | 2.828125 | 3 | [] | no_license | import PyPDF2
import numpy
import random
import subprocess
import os
import csv
from copy import deepcopy
def create_list_pdfs(dir):
slideSet = os.listdir(dir)
f=open('data/symposium_data.csv','w+')
[f.write(slideName) for slideName in slideSet]
f.close()
return
class Member :
def __init__(sel... | true |
6c931a3150b96f346f9acc7337487be06a5f838e | FishmanL/CS-182-Final-Project | /dominiate/players.py | UTF-8 | 9,531 | 3.234375 | 3 | [] | no_license | from game import Game, BuyDecision, ActDecision, TrashDecision, DiscardDecision, MultiDecision, INF
import cards as c
import logging
import random
class Player(object):
def __init__(self, *args):
raise NotImplementedError("Player is an abstract class")
def make_decision(self, decision, state):
... | true |
40c6df8c3b0e6450d6c8bc27a50d7769d04a5550 | li-xin-yi/HK-journalist | /examples/1_prophet_model_evaluate.py | UTF-8 | 2,734 | 2.671875 | 3 | [
"MIT"
] | permissive | from prophet import Prophet
from hkjournalist import Journalist
import os
import sys
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
# data and models from fbprophet tutorials https://facebo... | true |
8d461b11454e62e32c9fcc142b6d059095b6b939 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_2_1/MadHatter/A.py | UTF-8 | 1,045 | 3.21875 | 3 | [] | no_license | __author__ = 'dkopiychenko'
# g = ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE"]
#
# d = {}
# for i,x in enumerate(g):
# for c in x:
# if c in d:
# d[c].append(i)
# else: d[c] = [i]
# print d
def solve(s):
d = {}
for c in s:
if c in d:... | true |
cb2e5d143b456002094c8c06f265eb51a2b52aa9 | hcs/bootcamp-scraper | /example.py | UTF-8 | 2,121 | 3.59375 | 4 | [] | no_license | import bs4
import urllib
AMAZON_URL = "http://www.amazon.com/s/?keywords=ocaml"
def float_of_money(s):
"""
Converts the money string to a float. For amounts in the format
$30.00 - $65.00
this will return the maximum bound as a float (65.00)
"""
s = str(s)
s = s.replace(",", "") # Remov... | true |
fc95075c7dc843f4ea1add6a105f6e8dea1aa24e | Gabriel-817/OpenCV_data | /OpenCV/OpenCV_ch29_원검출.py | UTF-8 | 567 | 2.875 | 3 | [] | no_license | # Main Code
import cv2
# 그레이 스케일 이미지 사용
src = cv2.imread('./data/insect_damage.jpg')
dst = src.copy()
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
# cv2.HoughCircles(검출 이미지, 검출 방법, 해상도 비율, 최소 거리, 캐니 엣지 임계값, 중심 임계값, 최소 반지름, 최대 반지름)
circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 100, param1 = 250, param2 = ... | true |
9094e1b4ba6d359b6e3e6279887e2d9f2127f7c8 | Maxstyll/PCLCN | /create_embeddings.py | UTF-8 | 2,057 | 2.78125 | 3 | [] | no_license | # import modules & set up logging
import os
import gensim, logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
sentences = [
['autor', 'autores', 'pessoas', 'desconhecidas', 'desconhecido', 'roubadores', 'adolescente', 'infrator', 'roubador', 'indivíduos', 'indivídu... | true |
8dec3d349f773b550e1e17a6ba50f5414966361d | vidal-anguiano/Machine-Learning-for-Public-Policy | /Assignment 3/preprocess.py | UTF-8 | 3,500 | 2.65625 | 3 | [] | no_license | from vatools.utils import data_processing as dp
from vatools.db_conn.db_conn import DBConnection
from vatools.ml import ml
if __name__ == '__main__':
db = DBConnection('../credentials.json')
db.connect()
outcomes = db.query('select * from outcomes')
projects = db.query('select * from projects')
'... | true |
1115fdacf5f00c6bf775a94244a5baf867d0c386 | Jacob6561866/EECS-440-Machine-Learning | /Decision Tree/ID3.py | UTF-8 | 4,884 | 3.25 | 3 | [] | no_license | import numpy as np
from mldata import *
from Node import *
from AttributeHelperFunctions import *
from GainCalculations import *
def ID3(examples,attributes,option3,option4, root):
"""
Decision tree algorithm to produce a tree to classify data based on feature values
If all examples positive: return sin... | true |
d9fbc9db7108dc2213a1cf40a7b92a6219146a0d | wanp80912/Comment_Ali_Spider_20180329 | /Config/Base.py | UTF-8 | 174 | 2.625 | 3 | [] | no_license | #-*-encoding=utf-8-*-
LogPrint = True
def myPrint(*args, sep=' ', end='\n', file=None):
if LogPrint:
print(*args, sep=' ', end='\n', file=None)
else:
pass | true |
1c02d34660a7788d9927768c618d01d4e5d01ae7 | multiangle/MovieLens | /paper.py | UTF-8 | 110 | 2.703125 | 3 | [] | no_license |
import re
v = 'Memory Lane (2010-)'
x = re.findall(r'\((.*)\)', v)[0]
y = re.findall(r'\d+', x)[0]
print(y) | true |
dc5094f6df4bb12421b8338abf7cec9b764656bb | wmm0165/Cookbook | /类与对象_八/改变对象的字符串显示.py | UTF-8 | 664 | 4.40625 | 4 | [] | no_license | # pthon 定义了__str__()和__repr__()两种方法,__str__()用于显示给用户,而__repr__()用于显示给开发人员
class Person(object):
def __init__(self, name, gender):
self.name = name
self.gender = gender
def __repr__(self):
return 'Pair({0.x!r},{0.y!r})'.format(self)
def __str__(self):
return '(Person: %s, %s)... | true |
8bf1d6655db018680a2aff5893379190bcae80d2 | Jinzhi0429/jinzhi | /project.py | UTF-8 | 251 | 2.734375 | 3 | [] | no_license | from YangFunction import*
turtle.bgcolor("black")
turtle.tracer(False)
bob.width(4)
for times in range(50):
c=(250-times*5,250-times*5,times*5)
spikeFlower(4,25-times*2,c)
bob.left(5)
bob.forward(5)
turtle.tracer(True)
| true |
4d2fe8d6735ce729aab3f25ffc82b6da0bac35bd | naamphg/Computer-Vision | /SVM/train.py | UTF-8 | 2,988 | 2.609375 | 3 | [] | no_license | import cv2
import os
import pickle
import numpy as np
from imutils import paths
from sklearn import svm
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.model_selection... | true |
26e93dabb58bed7e2dabee08abcc1d8a05d2fc36 | srknsnmz/gaih-students-repo-example | /Final Project/Final_Project.py | UTF-8 | 1,045 | 3.6875 | 4 | [] | no_license | class Employee():
def __init__(self,name, age):
self.name = name
self.age = age
self.language = []
def addLanguage(self,new_lang):
self.language.append(new_lang)
def showInfo(self):
print(self.name + " is " + self.age + " years old")
for i in self... | true |
0ee5a7e7debe789539c351c6ea4d20d74e20f67e | m-evtimov96/softUni-python-fundamentals | /2 - Data Types and Variables/Exer-2.py | UTF-8 | 132 | 3.4375 | 3 | [] | no_license | def combine_chars (a, b, c):
print(a+b+c)
char1 = input()
char2 = input()
char3 = input()
combine_chars(char1, char2, char3)
| true |
3b118fb0f4f07ec4ffbe13cf2f89a57ecbc281cf | echoleyo/mydev | /hackerrank/angry-children.py | UTF-8 | 1,046 | 2.65625 | 3 | [] | no_license | import random
import time
n = 10**6
k = 10**5
start = time.time()
candies = [random.randrange(0,10**9) for _ in xrange(n)]
# candies = (random.randrange(1,n) for _ in xrange(n))
candies.sort()
def findmin(n, k, candies):
v = max(candies)
for i in xrange(n-k+1):
vnew = candies[i + k -1] - candies[i]
... | true |
dab9d36b8c73fe53c08593529ac46e9be7d0d02a | ankit89shama89/PowerShell | /python_errors/try_except_else.py | UTF-8 | 641 | 3.5 | 4 | [] | no_license | class User:
def __init__(self, name, marks):
self.name = name
self.marks = marks
def __repr__(self):
return f'User {self.name}'
def find_percent(user):
max_marks = user.marks["max"]
obtain_marks = user.marks["obtain"]
percent = (obtain_marks * 100) / max_marks
return pe... | true |
17aeef1f935d191d1e51f5d62662532dc20be066 | EvertonTomalok/crawler-adorocinema | /crawler/cleaner.py | UTF-8 | 240 | 2.578125 | 3 | [
"MIT"
] | permissive | def clean_synopysis(text):
t = text.replace("Classificação indicativa a definir por http://www.culturadigital.br/classind.", "")
t = text.replace("\n", "").replace("\t", "")
t = " ".join(t.split(" "))
return t.strip() | true |
11c3f1c1c86383ef303f7772a54369609254255e | marciof/tools | /puzzles/uncoupled_integers.py | UTF-8 | 918 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Find the only two integers that appear an odd number of times
in a sequence of `integers`.
"""
import unittest
def find(integers):
"""
Time: O(n)
Space: O(1)
https://www.careercup.com/question?id=16306671#commentThread16306671
"""
x_y_xor =... | true |
e123ad43eacc3ce09dab1769265fe1f2e6be6cc7 | Wizmann/ACM-ICPC | /Leetcode/Algorithm/python/3000/02673-Make Costs of Paths Equal in a Binary Tree.py | UTF-8 | 358 | 2.6875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | class Solution(object):
def minIncrements(self, n, cost):
res = 0
for i in xrange(n - 1, -1, -2):
if i == 0:
pass
else:
a, b = i - 1, i
diff = abs(cost[a] - cost[b])
res += diff
cost[a / 2] += max... | true |
1cbf0085cae0d6d7b28d6545724c440d1a707a89 | eg0rmeister/hail | /main1.py | UTF-8 | 8,216 | 2.625 | 3 | [] | no_license | import pygame
import math
import time
import random
import neuro
import pickle
import classes
pygame.font.init()
pygame.init()
speed = 2
speed_obstacle = 1
size = 800
screen = pygame.display.set_mode((size, size))
running = True
key = None
obs = []
gen_am = 100
pygame.display.flip()
with open("memory.txt", "r... | true |
d7d1bb5a173c4360e4ce4e332a4847fea21a2a57 | haochiz/PhenoPad-SpeechEngine | /kaldi-gstreamer-server/kaldigstserver/worker_counter.py | UTF-8 | 1,950 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | import atexit
import os, time, sys
from filelock import FileLock
import rest_server as rs
WORKER_COUNTER_FILE = os.path.join('/tmp/worker_counter.log')
WORKER_COUNTER_LOCK = os.path.join('/tmp/worker_counter.lock')
lock = FileLock(WORKER_COUNTER_LOCK)
WORKER_CAP = 2
rest_server_process = None
def on_start_up():
... | true |
906625f33cbb0671717e79ee8876bd69110592bc | huiyinchu/python | /interactive python/memory.py | UTF-8 | 1,822 | 3.640625 | 4 | [] | no_license | # implementation of card game - Memory
import simplegui
import random
cards = [0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
exposed = []
firstcard = 0
secondcard = 0
state = 0
counter = 0
# helper function to initialize globals
def new_game():
global cards, exposed, counter
random.shuffle(cards)
expos... | true |
3dc7728bf2b3c261ffe51180fea8107aeec81859 | fdetun/holbertonschool-higher_level_programming | /0x0A-python-inheritance/11-square.py | UTF-8 | 491 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
"""
class Square that inherits a class Rectangle
"""
Rectangle = __import__('9-rectangle').Rectangle
class Square(Rectangle):
"""Sqaure class"""
def __init__(self, size):
"""init func of a Square class"""
self.integer_validator("size", size)
super().__init__(size, si... | true |
235707dfbef819fc28c98bc9b0ccacbff61f9ad1 | LelandYan/Pytorch_learning | /tutorial.py | UTF-8 | 1,821 | 2.84375 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
__author__ = 'LelandYan'
__date__ = '2019/7/21 15:16'
import torch as t
from torch.autograd import Variable as V
import torch.nn.functional as F
import matplotlib.pyplot as plt
import torch.nn as nn
# x = t.unsqueeze(t.linspace(-1, 1, 100), dim=1)
# y = x.pow(2) + 0.2 * t.rand(x.size())
n_data... | true |
d773f28faaa95a71896db5d7b15ea2f1ad217f6b | xguse/gfunc | /src/gfunc/devel.py | UTF-8 | 4,886 | 2.703125 | 3 | [] | no_license | """
####################
devel.py
####################
Code under development before being placed in a logical location.
"""
import numpy as np
from scipy import stats as sp_stats
from gfunc.maths import weight_d_for_ptci as scale_the_d
from gfunc.data_classes import Bunch
def is_none_or_nan(value):
"""
Re... | true |
7ab44a7cf14e886e15fc7aacdcbc8a8cf760ba17 | zoeward-nz/PhD | /scripts/sample_list.py | UTF-8 | 4,581 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
"""
NAME: test
=========
DESCRIPTION
===========
INSTALLATION
============
USAGE
=====
VERSION HISTORY
===============
0.0.1 2018 Initial version.
LICENCE
=======
2017, copyright Sebastian Schmeier, (s.schmeier@gmail.com), https://sschmeier.com
template version: 1.9 (2017/12/08)
"""
from ... | true |
e5e48c4e4ac5e59daee256bf9aaf121e0c8d4020 | jaronjlee/algorithms | /group_anagrams.py | UTF-8 | 681 | 3.265625 | 3 | [] | no_license | def groupAnagrams(words):
# Write your code here.
result = []
for i in range(0, len(words)):
letterCount = {}
sub = [words[i]]
for letter in words[i]:
if letter not in letterCount:
letterCount[letter] = 1
else:
letterCount[letter] += 1
for j in range(0, len(words)):
if words[j] =... | true |
b009ac29a66fb56504205d7838beda1b3a49cca4 | gdfelt/competition | /advent_of_code/advent_2019/aoc01.py | UTF-8 | 555 | 3.359375 | 3 | [] | no_license | import math
import os
def main_one():
s = 0 # sum
with open('advent_2019/aoc01.dat') as file:
for line in file:
s += math.floor(int(line.split()[0]) // 3) - 2
return s
def calc_fuel(n):
if n <= 0:
return 0
else:
return n + calc_fuel(n // 3 - 2)
def main_two(... | true |
70bd47ab29b21a6ae96e65c2701ba3c1c2829294 | VilenShvedov/Myprojects | /002-1.py | UTF-8 | 558 | 3.75 | 4 | [] | no_license | a = "Your salary is "
b = 1000
c = None
d = True
#new_string = a + " " + str(b)
#formated_string = "Your salary is {2}, or {1}, or {0}" #Podstavljaet danqe
#print(new_string)
#print(formated_string.format(b, c, d))
#formatted_string = "This is {product:}. It costs {price:.2f}" # .2f pokazvqet skolko 4isel polse zapjat... | true |
b38fd7b06cab901ea298af3eb836f842b69628f4 | pranjali0210/Robot-Collision-Avoidance | /robot.py | UTF-8 | 2,449 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 9 17:38:23 2018
@author: swaprava
"""
#import time
#import curses
#
#def pbar(window):
# for i in range(10):
# window.addstr(10, 10, "[" + ("=" * i) + ">" + (" " * (10 - i )) + "]")
# window.refresh()
# time.sleep(0.5)
#
#curses.w... | true |
5df37dd4de93940ce3c29562d0c71fa5747f291a | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_209/440.py | UTF-8 | 2,476 | 3.203125 | 3 | [] | no_license | import functools
import math
import operator
import sys
def pancakeSort(pancake1, pancake2):
if pancake1["R"] > pancake2["R"]:
return 1
elif pancake1["R"] < pancake2["R"]:
return -1
elif pancake1["H"] > pancake2["H"]:
return 1
elif pancake1["H"] < pancake2["H"]:
return -... | true |
2c06cd0b2d7343ecc58ee8530bbd4a679e00c670 | finnxu404/python | /com/alvin/Thread/EventDemo.py | UTF-8 | 589 | 3.359375 | 3 | [] | no_license | import threading
'''
使用event实现线程间通信
'''
class mythread(threading.Thread):
def __init__(self, threadname):
threading.Thread.__init__(self, name=threadname)
def run(self):
global event
if event.isSet():
event.clear()
event.wait()
print('event is ... | true |
e8d602f7f3a671cc3bf898c894e64d31f950123d | epolimpio/soc | /sandpile_heights.py | UTF-8 | 2,107 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
# Makes the sandpile movies based on
# Kadanoff et al. paper
import copy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
import avalanche
def plotting(i, ups, surf):
ax.clear()
ax.grid(False)
ax.view_init(azim = ... | true |
dfded77c9dbd64d05cd575e43de12cf807e7c68d | CarlEkerot/aoc2016 | /day19.py | UTF-8 | 677 | 3.625 | 4 | [] | no_license | from collections import deque
def solve1(elves):
cnt = 0
l = [1] * elves
while l.count(1) > 1:
for i in range(elves):
if l[i] == 1:
cnt += 1
l[i] = cnt % 2
return l.index(1) + 1
def solve2(elves):
left = deque(range(1, (elves + 1) // 2))
ri... | true |
a02c3416f2122f61b4be76cc5343865a5e988500 | legite/time2buynewcar | /main/Str2Info.py | UTF-8 | 3,514 | 2.90625 | 3 | [] | no_license | import datetime
STD = {True:[365 * 3, 3, 3, 3], False:[365 * 6, 12, 6, 3]} # 寿命及定期保养标准
# 定义字符串转车辆类
class Str2Car(object):
__slots__ = ('id', 'Date', 'brand', 'dis', 'fix', 'ps')
# 初始化车辆信息:编号id,购买日期date,品牌brand,公里数dis,是否检修fix
def __init__(self, str):
ss = str.split('|')
... | true |
30c6efaa6529ddfd60c811f4f292b19c4ed358e8 | Laharel/Python | /Fundamentals/functions_intermediate1.py | UTF-8 | 703 | 3.8125 | 4 | [] | no_license | import random
def randInt(min=0,max=100):
if (min>max) :
max=min+max
min=max-min
max=max-min
num = (random.random()*(max-min)+min)
return round(num)
#print(randInt()) # should print a random integer between 0 to 100
#print(randInt(max=50)) # should pri... | true |
5679ea3d0a7a25e413979d9dd3092f180752c00d | pandapranav2k20/Python-Programs | /Lab 4b/ENGR102_pveerubhotla_Lab4b_P5.py | UTF-8 | 1,490 | 4 | 4 | [] | no_license | # By submitting this assignment, I agree to the following:
# "Aggies do not lie, cheat, or steal, or tolerate those who do."
# "I have not given or received any unauthorized aid on this assignment."
#
# Name: PRANAV VEERUBHOTLA
# Section: 540
# Assignment: Lab 4b-4
# Date: 18 SEPTEMBER 2019
#... | true |
b2500002d579c41a2f0fe6614db68afd39f8a8f0 | samuelwestlake/STL-Writer-for-Terrain | /src/triangle.py | UTF-8 | 682 | 3.25 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import numpy as np
class Triangle(object):
def __init__(self, vx, vy, vz):
self.vx = np.asarray(vx)
self.vy = np.asarray(vy)
self.vz = np.asarray(vz)
self.v0 = np.asarray([v[0] for v in (vx, vy, vz)])
self.v1 = np.asarray([v[1] for v in (vx, vy, vz)... | true |
fddcbe747fb0bbcc5c565f2a45abee51f0dd31ba | OwOY/appium | /txt.py | UTF-8 | 365 | 2.921875 | 3 | [] | no_license | import codecs
class txt:
def txt_write(title, content):
with codecs.open(f'txt/{title}/content.txt','w','utf-8')as f:
f.write(content)
# if __name__ == '__main__':
# title = '沙雕图片(3)'
# content = '感情测试|你还会单身多久'
# txt.txt_wri... | true |
8e7e99c0da6c0e4289bdcfbcd08a34cd850ceaac | gloomySwartz/testRepo | /app.py | UTF-8 | 284 | 2.796875 | 3 | [] | no_license | from datetime import datetime as dt
from hello_printer import print_hello
def another_function():
print(
f'This is a test program. Current time: {dt.now().isoformat()}'
)
def main():
another_function()
print_hello()
if __name__ == '__main__':
main()
| true |
2b0dd270c0d9f0ebffafce78fb9e93a258ecab49 | JianFengY/PythonScraping | /chapter02_advanced_html_parse/1_select_by_class.py | UTF-8 | 2,069 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 2018年1月26日
@author: Jeff Yang
'''
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://pythonscraping.com/pages/warandpeace.html")
# print(type(html)) # <class 'http.client.HTTPResponse'>对象
# print(type(html.read())) # <class 'byte... | true |
83d2b930e7d028e1e34929973c78dbd75cdd30ca | bestmethod/tcconfig-ubuntu-venv | /lib/python3.6/site-packages/pathvalidate/_common.py | UTF-8 | 2,140 | 2.953125 | 3 | [] | no_license | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import, unicode_literals
import re
import string
import sys
from ._six import text_type
from .error import NullNameError
if sys.version_info[0] == 3:
unichr = chr
else:
unichr = unichr... | true |
59127061e5958805cf68beb1d91a29c2563d319a | wanglinjie/coding | /leetcode/154.py | UTF-8 | 851 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# date:20160810
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?... | true |
f82510065362cd367a66d9a1d6ba445c7c51fd75 | tdonlan/NovelGen2017 | /src/wrdTest.py | UTF-8 | 180 | 2.90625 | 3 | [] | no_license | def getWordList():
f = open("data/google-10000-english-no-swears.txt","r")
wordlist = []
for line in f:
wordlist.append(line.strip())
return wordlist
print getWordList() | true |
d3044caadeddb34da349980778a4f556be1e9441 | slsefe/-algorithm015 | /Week_06/152-maximum-product-subarray.py | UTF-8 | 2,668 | 3.546875 | 4 | [] | no_license | """leetcode 152 最大子数组积
给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。
示例 1:
输入: [2,3,-2,4]
输出: 6
解释: 子数组 [2,3] 有最大乘积 6。
示例 2:
输入: [-2,0,-1]
输出: 0
解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/maximum-product-subarray
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
class ... | true |
5afcd3c0bed059ae92c55a4caf49e03907601a48 | npnkhoi/Python-crash-course | /Alien Invasion/bullet.py | UTF-8 | 619 | 3.390625 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
def __init__(self, aiSetting, screen, ship):
# create bullet right above the ship
super(Bullet, self).__init__()
self.screen = screen
self.rect = pygame.Rect(0, 0, aiSetting.bullet_width, aiSetting.bullet_height)
self.rect.centerx = ship.... | true |
04660f5b316f491db4989150a970fbcca231e14b | karimbahgat/Pytess | /pytess/tesselator.py | UTF-8 | 28,010 | 3.125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #############################################################################
#
# Voronoi diagram calculator/ Delaunay triangulator
# Translated to Python by Bill Simons
# September, 2005
#
# Additional changes by Carson Farmer added November 2010
#
# Calculate Delaunay triangulation or the Voronoi polygons for a set o... | true |
915a251c2ee1f450c4506a0bbf8434a24655ed63 | paulorobertocruz/cg_t2 | /view.py | UTF-8 | 6,940 | 3.546875 | 4 | [] | no_license | """###################################################
#Para instalar a biblioteca basta fazer (no ubuntu): sudo apt-get install python-opengl
#
# Exemplo3DComIluminacao.py
# Um programa OpenGL simples que abre uma janela GLUT,
# desenha um "torus" com ilumina��o, permite fazer
# zoom in e zoom out com as teclas Home e... | true |
f3aceec7fe18eb11f66c2c59b2963f9e4444cf82 | NickAlleeProgrammingProjectsPortfolio/OfficialStockMarketPredictionProject | /Find.py | UTF-8 | 6,660 | 2.921875 | 3 | [] | no_license | import findClassifiers as fc
import findHelperTools as fh
def findTheBestAny(dataSet,dataSetTest,allPossibleFeatureCombos,Classifier=0, singleXFeatureOn = 0, singleXFeature = ""):
#Classifiers: 0:linReg, 1:
#singleXFeatureOn: 0:finds best of all 1:finds best of singleXFeature
#singleXFeature: put the featu... | true |
a0102c23dc67c5ed061e172a5a847f117db863fb | melon-li/tools | /ddnum | UTF-8 | 2,002 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#coding:utf-8
import sys
import os
import math
def usage():
'''@function:generate a certain size text file, the file content is the special digits line numbers,shown as follow:
001
002
003
@param: the size of the text file
@param: The path of file or di... | true |
254161e5820ffb95b3da4e541fc9caf46e0a74a5 | phyer219/phyer219.github.io | /docs/posts/2021-09-16-physics-scipy_integrate/code.py | UTF-8 | 503 | 2.875 | 3 | [] | no_license | import numpy as np
from scipy import integrate
import matplotlib.pyplot as plt
nodes = []
def foo(x):
nodes.append(x)
return np.exp(x) + np.sin(10*x)**2 + np.exp(x)**100
result = integrate.quad(foo, -1, 1, epsrel=1e-125, limit=2, full_output=1)
n = np.linspace(1, len(nodes), len(nodes))
print(len(nodes))
p... | true |
7e9d39f517fcaf03ef1f1d3e56100537f10b56dd | arctistic/sys-api-and-data-persistance | /video4.py | UTF-8 | 355 | 2.671875 | 3 | [] | no_license | from subprocess import Popen, PIPE
p = Popen('ls -l', stdin=PIPE, stdout=PIPE, stderr=PIPE)
list_files_stdin = b''
list_files_output, list_files_err = p.communicate(list_files_stdin)
return_code = p.returncode
print(list_files_output)
print('--------------------')
print(list_files_output.decode("utf-8"))
print("The ex... | true |
9c6cb8e4dfbd4d3489b8e7f7ba3a0c8d06ec9218 | BillMaZengou/raytracing-in-python | /02_revealing_the_true_colors/color.py | UTF-8 | 2,494 | 3.421875 | 3 | [] | no_license | import sys, os
LIB_PATH = '../01_point_in_3d_space'
sys.path.append(LIB_PATH)
from Vector import *
class color(vec3d):
"""docstring for color."""
def __init__(self, r, g, b):
r = max(min(r, 255), 0)
g = max(min(g, 255), 0)
b = max(min(b, 255), 0)
vec3d.__init__(self, r, g, b)
... | true |
51b8b89a27fa6576f1724f0c8287032a8cdde924 | INFJakZda/Search-Engine | /tweets/proccessor.py | UTF-8 | 22,359 | 2.703125 | 3 | [] | no_license | import io
import operator
import re
import matplotlib.pyplot as plt
import numpy as np
from nltk.stem.porter import PorterStemmer
porter_stemmer = PorterStemmer()
from nltk.stem import WordNetLemmatizer
wordnet_lemmatizer = WordNetLemmatizer()
reLink = re.compile(r"http[^\s]*")
reMark = re.compile(r"[^a-zA-Z0-9\s]")
r... | true |
f9fb672650bbe3689cdaa4cf085865635f4a54b2 | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/_algorithms_challenges/leetcode/LeetCode_with_solution/480 Sliding Window Median.py | UTF-8 | 4,006 | 3.75 | 4 | [] | no_license | #!/usr/bin/python3
"""
Median is the middle value in an ordered integer list. If the size of the list
is even, there is no middle value. So the median is the mean of the two middle
value.
Examples:
[2,3,4] , the median is 3
[2,3], the median is (2 + 3) / 2 = 2.5
Given an array nums, there is a sliding window of size... | true |
a4734a8658ee83f57e95c6afc130e0464902bf72 | will-sloan/bluetooth_testing_4 | /bt_3.py | UTF-8 | 411 | 2.78125 | 3 | [] | no_license | from bluetooth import *
port = 1
server_sock = BluetoothSocket(RFCOMM)
server_sock.bind(("", port))
server_sock.listen(1)
client_sock, client_info = server_sock.accept()
print(f"Accepted Connection from {client_info}")
while True:
data = client_sock.recv(1024)
if not data:
break
data = bytes.decode(data)
print... | true |
0e80333db9607fb3de1d1e6bbdce7f27919fd252 | jayden199012/prt | /utils.py | UTF-8 | 13,383 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import TruncatedSVD
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler, LabelEncoder
... | true |