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
d7cebe21903f7575196f29bff34d4eebb4a0a31b
skushagra/Notes
/index.py
UTF-8
4,519
2.6875
3
[ "Apache-2.0" ]
permissive
import tkinter from tkinter import * import tkinter.filedialog import tkinter.messagebox from tkinter.colorchooser import askcolor import datetime import webbrowser from tkinter.filedialog import askopenfilename, asksaveasfilename def line(): lin = "_" * 60 text.insert(INSERT...
true
22a5b8c7608c35f6eb56f096b987f9ea70618f9a
jdnorton22/LAPython
/laprogram.py
UTF-8
154
2.984375
3
[]
no_license
my_str = "This is a simple string" print(my_str) my_str="This is a different string" print(my_str) my_str+=" testing" print(my_str) my_str=1 print(my_str)
true
81c2749749e52f87b92277df76d8a02c0530f9d7
benchizhao/Oslo
/Q3-a.py
UTF-8
2,872
2.515625
3
[]
no_license
import logbin230119 as lb import numpy as np import pickle import matplotlib.pyplot as pl from Oslo_model import RelaxModel with open("avalanche_size.txt", "rb") as fp: avalanche_size = pickle.load(fp) print(avalanche_size[6]) with open("Q2-a.txt", "rb") as fp: t_c = pickle.load(fp) for i in r...
true
586bfe2fd7ee563a7b92dbd24fb3c68015d85ffe
qxjl1010/dataset_generator
/get_q.py
UTF-8
823
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- import os txt_list = [] def get_file_name(path): image_files = [] for file in os.listdir(path): image_files.append(file) image_names = [os.path.splitext(name)[0] for name in image_files if os.path.splitext(name)[1]=='.txt'] if len(image_names) >= 200: ...
true
5867bf3e9483f2b9f46a6078a9217d23c3327ec7
amfoggia/HO-python
/HO_problema1b.py
UTF-8
328
3.359375
3
[]
no_license
# Este programa suma los numeros impares de la serie de Fibonacci menores a un millon suma=0 iter_1=1 iter_2=2 a=[1,2] while suma<=1e6-iter_1: suma=iter_1+iter_2 iter_1=iter_2 iter_2=suma a.append(suma) total=0 b=[] for i in a: elem_guard=i%2 if elem_guard!=0: b.append(i) for i in b: total=total+i print...
true
d0fbebccffa4b3be9027640becbfbe688aa8b881
xCrypt0r/Baekjoon
/src/1/1287.py
UTF-8
511
3.140625
3
[ "MIT" ]
permissive
""" 1287. 할 수 있다 작성자: xCrypt0r 언어: Python 3 사용 메모리: 33,032 KB 소요 시간: 132 ms 해결 날짜: 2021년 10월 30일 """ import re def main(): formula = input() if len(re.findall('[+\-*/]', formula)) + 1 != len(re.findall('\d+', formula)): print('ROCK') return formula = formula.replace('/', '//').replace(...
true
00f08d4601973d9a52c3ecb812538827842d9087
ksieng2012/python-challenge
/PyPoll/main.py
UTF-8
3,738
3.796875
4
[]
no_license
#Import Required packages import os import csv import copy # * In this challenge, you are tasked with helping a small, rural town modernize its vote counting process. # * You will be give a set of poll data called [election_data.csv](PyPoll/Resources/election_data.csv). The dataset is composed of # three columns: `V...
true
ffe9ea88ac4fdee6caeaacac00d0bd31bcb5cfd6
microsoft/MM-REACT
/tests/unit_tests/chains/test_sequential.py
UTF-8
5,609
2.875
3
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
"""Test pipeline functionality.""" from typing import Dict, List import pytest from pydantic import BaseModel from langchain.chains.base import Chain from langchain.chains.sequential import SequentialChain, SimpleSequentialChain class FakeChain(Chain, BaseModel): """Fake Chain for testing purposes.""" inpu...
true
af76af2983dfa5ccb648b8634aaea9fa19ea5160
jphacks/NG_1702
/Python/collaborative_filtering_wvec.py
UTF-8
876
2.78125
3
[ "MIT" ]
permissive
""" Just calculate cos similarities. Load vectors generated from wvec model. """ import numpy as np def load_url_feats(path="url_feats.npy"): return np.load(path) def load_keys(path="url_keys.npy"): return np.load(path) def sample_table(table, num): if num >= table.shape[0]: retur...
true
86f4379f386d385ab867c9cc12568da7f184c172
jasonngai01/UR3_ROS_Control
/ur3_ai_controller/controller_gripper.py
UTF-8
520
2.59375
3
[]
no_license
#!/usr/bin/env python import sys import urx import time #import file import RG2Gripper as GripClass rob = urx.Robot("158.132.153.174") #instantiate object gripperInstance = GripClass.RG2(rob) #basic delay for script(to complete action, RG2 approximatly takes 1.3 seconds to close from completely open) time.sleep(2) #se...
true
e95adc71f59bffbb51e88e884af1b626db13e956
tloszabno/piautofan
/app.py
UTF-8
1,529
2.796875
3
[]
no_license
#!/usr/bin/env python3 import RPi.GPIO as GPIO from subprocess import check_output from time import sleep # GPIO pin where you connected base of transisotor. For reference please look at https://www.raspberrypi.org/documentation/usage/gpio/ FAN_CONTROL_PIN_NUMBER = 21 TEMP_WHEN_FAN_TURNS_ON_IN_CELSIUS = 55.0 TEMP_W...
true
d701781b90cc11663d7c48d991237cc3b78710a5
mooyeon-choi/TIL
/problemSolving/swExpertAcademy/python/sw_4837_다른방법.py
UTF-8
777
2.9375
3
[]
no_license
def subset(num, n): # k = 현재 노드의 높이, n = 단말 노드의 높이 global sum_, answer if num == 12: # 모든선택이 완료, 단말노드에 도착 sum_ = 0 for i in range(k): if bits[i]: sum_ += arr[i] if sum(bits) == n: if sum_ == k: answer += 1 ...
true
668928004d230cd51148ab1ad952acb4e5fd06f7
IAnanevich/office-room-reservation
/reservation/models.py
UTF-8
1,210
2.671875
3
[]
no_license
from django.db import models from django.core.validators import MinValueValidator, MaxValueValidator # Create your models here. class Office(models.Model): office_name = models.CharField(max_length=70) street = models.CharField(max_length=70) house_number = models.PositiveIntegerField() number_of_room...
true
4ed0948e56fdbe512b487683819af36bc67eb24a
18Badenm/Illinois_reimagined
/text_editor.py
UTF-8
1,559
2.90625
3
[]
no_license
#imports tkinter GUI import tkinter as tk from tkinter.filedialog import askopenfilename, asksaveasfilename def open_file(): #opens file to edit text filepath = askopenfilename( #opens files so file can be selected filetypes = [("Text Files", "*txt"), ("All Files", "*.*")] ) if not filepath: return...
true
9dd995536f53508359a319dda80b23db4659786f
domluna/cgt_tutorials
/0_multiply.py
UTF-8
189
2.71875
3
[ "MIT" ]
permissive
from __future__ import print_function import cgt a = cgt.scalar('a') b = cgt.scalar('b') y = a * b multiply = cgt.function([a,b], y) print(multiply(1, 2)) # 2 print(multiply(3, 3)) # 9
true
12c831239914b06c3ff39b971f75cb9044d3fc31
keynant/20190829_HW
/12.py
UTF-8
528
3.375
3
[]
no_license
import requests import json class Photo: def __init__(self,d): self.__dict__ = d def __str__(self): result = "" for k,v in self.__dict__.items(): result += f'{k} - {v}\n' return result def getPhoto(photoID): resp = requests.get('http://jsonplaceholder.typicode....
true
25274c3f855bf2987e10ee806ffef77465212a0b
jiakang1998/leetcode
/twosum/O(n).py
UTF-8
481
2.984375
3
[]
no_license
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ i = 0 n = len(nums) for i in range(n): diff = target - nums[i] if diff in nums: index = nu...
true
7e09c9084ef2c0e1aafd7ca62563e164953b1dd9
msdnqqy/detection
/CNN/室内物体检测/dataplus/DataDeal.py
UTF-8
2,999
3.203125
3
[]
no_license
""" 数据处理过程: 1.mp4转图片 2.图片resize=>56*56,112*112,224*224,448*448,996*996 3.图片转化: 1.旋转->90,180, 2.局部切分/做缺失处理随机取上某块上变0 """ import cv2 import os import numpy as np class dataDeal(object): def __init__(self,path,outpath): if path is None or outpath is None: print("...
true
eb6b06f85ce5c05d68cec11e83f68ef6f2160b94
andre-fuchs/kerning-pairs
/3H_mark_potential_pairs.py
UTF-8
5,215
2.859375
3
[ "MIT" ]
permissive
""" This script filters all kerning pairs from all counted letter pairs and lists them sorted by count. """ import json import operator from collections import defaultdict from tqdm import tqdm LANGUAGES = [ "cs", "de", "en", "es", "et", "fi", "fr", "hu", "it", "nl", "no...
true
491bf5aa8b8a4f6a2e1d8d9addb562aa5ea56419
Locour/xknx
/xknx/devices/remote_value_dpt_value_1_ucount.py
UTF-8
1,130
2.625
3
[ "MIT" ]
permissive
""" Module for managing a DTP 5010 remote value. DPT 5.010. """ from xknx.knx import DPTArray, DPTValue1Ucount from .remote_value import RemoteValue class RemoteValueDptValue1Ucount(RemoteValue): """Abstraction for remote value of KNX DPT 5.010.""" def __init__(self, xknx, ...
true
b1b9e7dc0edbba5df2a1b03bf903976a04ce3e8c
alexandrucatanescu/neural-program-comprehension
/stimuli/Python/one_file_per_item/en/3_# math_seq 3.py
UTF-8
122
3.609375
4
[ "MIT" ]
permissive
point1 = [3, 0] point2 = [6, 4] distance = (point1[0] - point2[0])**2 + (point1[1] - point2[1])**2 print(distance**0.5)
true
ed48f2493c0f2901419d880e270b2d23822adb4f
ZomkeyYe/Python-Learning
/test/test74.py
UTF-8
678
3.09375
3
[]
no_license
def zoo(lis): a1 = 0 a2flag = False a2 = 0 a3 = 0 a4 = [] a5 = [] for i in lis: if i%5 == 0 and i%2 ==0: a1 += i if i%5 == 1: if a2flag == False: a2 += i a2flag = True if a2flag == True: ...
true
3a281ec5e6b319d97d14b5431155a359cee78fd5
ryanmcg86/Euler_Answers
/035_Circular_primes.py
UTF-8
2,374
4.1875
4
[]
no_license
'''The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below one million? Link: https://projecteuler.net/problem=35''' ...
true
5017c1d0a7f7b01c22a4abdbb8b7603b6250555f
vrushti-mody/Leetcode-Solutions
/Hamming_Distance.py
UTF-8
900
3.671875
4
[]
no_license
# The Hamming distance between two integers is the number of positions at which the corresponding bits are different. # Given two integers x and y, calculate the Hamming distance. # Note: 0 ≤ x, y < 2 to the power 31. def hammingDistance(self, x: int, y: int) -> int: a=bin(x) b=bin(y) a=a[2:]...
true
e516c5f6ef635c3441a4ce922ce2733ac6122ccf
zgle-fork/OpenCV-Python-Tutorial
/ch35-BRIEF/brief.py
UTF-8
1,122
3.15625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # @Time : 2017/7/13 下午3:38 # @Author : play4fun # @File : brief.py # @Software: PyCharm """ brief.py: 算法使用的是已经平滑后的图像 非常重要的一点是 BRIEF 是一种特征描述符 它不提供查找特征的方法。 所以我们不得不使用其他特征检测器 比如 SIFT 和 SURF 等。 原始文献推荐 使用 CenSurE 特征检测器 种算法很快。而且 BRIEF 算法对 CenSurE 关键点的描述效果 比 SURF 关键点的描述更好。 简单来 BRIEF 是一种对特征点描...
true
28de98f497f222b524a77176f6fedbebddc88907
MVjimbo/stepik_tours
/data.py
UTF-8
17,478
2.765625
3
[]
no_license
title = "Stepik Travel" subtitle = "Для тех, кого отвлекают дома" description = "Лучшие направления, где никто не будет вам мешать сидеть на берегу и изучать " \ "программирование, дизайн, разработку игр и управление продуктами" departures = {"msk": "Из Москвы", "spb": "Из Петербурга", "nsk": "Из Новосиби...
true
4cee3218f4a0d91e6c56ee11386c5e188037058b
big-Bong/AlgoAndDs
/PythonPractice/LeetCode/Medium/78_Subsets.py
UTF-8
507
3.515625
4
[]
no_license
def subsets(nums): if(not nums): return [[]] output = [[]] for i in range(1,len(nums)+1): data = [0 for _ in range(i)] generateSubsets(nums,data,output,0,len(nums)-1,0) return output def generateSubsets(nums,data,output,start,end,index): if(index == len(data)): temp = [elem for elem in data] output.ap...
true
4056843d5fdb1e46f8edc1a06d39899a7f5e6af9
radotzki/aws-predictive-scaling
/create_results_summary_graphs.py
UTF-8
25,944
2.625
3
[]
no_license
""" Author: Mor Sides Purpose: Generate graphs of the machine load and number of machines after executing an attack Input: The script expects 3 files - 1. JMeter CSV that represents the response time of the requests made 2. AWS scale actions log 3. attack.py logs (start and end times) """ import json import ...
true
7dd0985924f2d67ca9d7acd4cea046fd474a5d59
Ericzyr/pythonStudy
/web30.py
UTF-8
590
3.609375
4
[]
no_license
#!/usr/bin/env python def outer(fun): def inner(): print('this is before') fun() return inner @outer def f1(): print("this is center") f1() class gohome(object): def __init__(self,name,age,number): self.name = name self.age = age self.number = number...
true
0b43a10bc58e630ecc443d5f4e25c8da4efca0b3
VICKYARIAS/ProyectoFinal
/CuentadeAhorro.py
UTF-8
489
2.921875
3
[]
no_license
#ARIAS RAMIREZ VICTORIA ANGÉLICA from Cuenta import* class CuentaDeAhorro(Cuenta): def __init__ (self,SaldoInicial,TasadeInteres,tipo): Cuenta.__init__(self,SaldoInicial) self.__TasadeInteres= TasadeInteres self.__tipo=tipo def getTipo(self): return self.__tipo def __str__(self): ...
true
64a47d3d1761017c2de13c25b81b88f61517a3ad
vc2014/nana
/app.py
UTF-8
1,390
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 26 20:41:25 2018 @author: visha """ import importlib from config import ConfigBuilder from workflow import WorkflowBuilder class AppBuilder: def __init__(self, str): print("Inside the AppBuilder constructor") self.application = str self.config...
true
7ae6068937c61a22d884d7b33c89942f68c121a4
Eshaan0112/ECE595_ML1
/Homework1/Homework1-Exercise1.py
UTF-8
2,746
3.5625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 1 15:45:15 2021 @author: mnagara Homework 1: Exercise 1 Histogram and Cross-Validation """ import scipy.stats import numpy as np import matplotlib.pyplot as plt # Let µ = 0 and sigma = 1 so that X ~ N (0, 1). Plot fX(x) using matplotlib.pyplot...
true
661e592b4016adfbe815710f9ca6c6f65a57138e
nowaycomputer/autofactcheck
/app.py
UTF-8
1,261
2.6875
3
[]
no_license
# main access point for fact checker import wikipedia as wiki import twitter_trawling as twitter import google_kt as google import text_analysis as text_an import csv ta=text_an.Text_Analyser() # Very basic identification of claim types with open('sampledata.csv', 'rb') as csvfile: reader = csv.reader(csvfile, delim...
true
4686e3c5a73f975771db9668204f316d2965aa8b
chrisayoub/WUPHF
/Backend/emailApi.py
UTF-8
809
2.59375
3
[]
no_license
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText MY_ADDRESS = '' PASSWORD = '' # https://medium.freecodecamp.org/send-emails-using-code-4fcea9df63f def sendEmail(text, targetEmail, subject): # set up the SMTP server s = smtplib.SMTP(host='smtp.gmail.com', por...
true
344f3a8f2ade317af2412035b43b2314d503d80f
nileshC-ghub/pytest_Framework
/sample_functions_123456.py
UTF-8
262
3.875
4
[]
no_license
#Factorial Function by 123456 def factorial(n): return 1 if (n<=1) else n * factorial(n - 1) #Reverse Function by 123456 def reverse(n): rev = 0 while n > 0: rem = n % 10 rev = (rev*10) + rem n = n//10 return rev
true
88795d640b6e685c8a2bf43accd9ac3fc50f06a5
adarsh-ravi/BlindnessDetection
/BlindnessDetection.py
UTF-8
746
2.953125
3
[]
no_license
import numpy as np import pandas as pd from PIL import Image import seaborn as sns import matplotlib.pyplot as plt df_train = pd.read_csv('train.csv') df_test = pd.read_csv('test.csv') df_train['diagnosis'].value_counts().plot(kind='bar') plt.show() image_list = [] for idx, row in df_train.iterrows(): img = Ima...
true
9b7c8533662ae45df2dd108f11bfa142e390a458
dlmuljj/scrapy
/test/getData/get_title_bs_all.py
UTF-8
2,716
2.921875
3
[]
no_license
# -*- coding = utf-8 -*- # @Time :21/4/4 21:16 # @Author: 吕佳杰 # @File :get_title_string.py # @Software:PyCharm import re from bs4 import BeautifulSoup def get_content(): with open('demo_html.html', mode='r', encoding='utf-8') as f: html = f.read() soup = BeautifulSoup(html, features='html.parser') ...
true
79bd63d188fcc8e70f10ad3d9874c00262fdf0a0
raspibox/from_git
/garage/licht.py
UTF-8
1,021
2.734375
3
[]
no_license
#!/usr/bin/python # coding=utf-8 # # Skript um die Aussenbeleuchtung zu steuern # die Relais sind LOW-aktiv # # RPi,B Rev2 GPIO: 26-pin header # -------------------------------- # +3V3 1 2 +5V # GPIO2 SDA1 3 4 +5V # GPIO3 SCL1 5 6 GND # GPIO4 GCLK 7 8 TXD0 GPIO14 # GND 9...
true
da94d47d9920825eafcb178466f1f566c9d3c649
bansalr/building-permits-survey
/bps/base.py
UTF-8
4,528
2.765625
3
[]
no_license
from __future__ import annotations from typing import TYPE_CHECKING import pandas as pd import itertools import requests from typing_extensions import Literal from urllib.parse import quote from io import StringIO if TYPE_CHECKING: from typing import List, Optional Region = Literal['west', 'midwest', 'south', 'n...
true
30f4029a46c57d6a6013743c60f4a23081584462
aalouaoui/smart-interface-arduino
/serialHost.py
UTF-8
622
2.65625
3
[]
no_license
from graph_data import get_graph_data import psutil import serial import time port = "COM3" if(psutil.WINDOWS) else "/dev/ttyACM0" baud_rate = 19200 init_wait = 4 send_deltatime = 0.2 ser = serial.Serial(port, baud_rate) if(ser.is_open): ser.close() ser.open() time.sleep(init_wait) try: whil...
true
9cca20f5ad13926b7e74d306f2209a8ebbe958ea
googlefonts/fontmake
/Lib/fontmake/errors.py
UTF-8
1,439
3.203125
3
[ "Apache-2.0" ]
permissive
import os def _try_relative_path(path): # Try to return 'path' relative to the current working directory, or # return input 'path' if we can't make a relative path. # E.g. on Windows, os.path.relpath fails when path and "." are on # different mount points, C: or D: etc. try: return os.path...
true
2e922005a0410c7543510a620e16d9f072996dd3
Muslum10cel/HackerRankPY
/com/hackengine/implementation/ChocolateFeast.py
UTF-8
454
3.296875
3
[]
no_license
list = [] test_case = int(input()) for _ in range(test_case): n, c, m = input().strip().split(' ') n, c, m = int(n), int(c), int(m) if n / c < m: list.append(n / c) elif n / c == m: list.append(n / c + 1) else: count = 0 temp = n / c while temp >= m: ...
true
f849469a43deb3ecb62530d636fd10223328ab4c
adrienlucca/Light_Transformer_Setup
/linearInterpolation.py
UTF-8
351
2.578125
3
[]
no_license
''' Created on 30 janv. 2014 @author: gary ''' import cv2 #load all .xyz files struct: x, y, colors(X,Y,Z) # for each color needed img = cv2.imread("MAP.tif", -1) # load as-is: this allows for 16-bit images to import correctly height, width = img.shape XYZ=(y*width-x*y)*D+x*y*C+(x*height-x*y)*B+(A*width-x*A)*he...
true
c603f2787f989ee092b4b4106203185ab55d6853
koking0/Algorithm
/算法与数据结构之美/Algorithm/Greedy/01.找零问题.py
UTF-8
660
3.671875
4
[]
no_license
# 假设商店老板需要找零 n 元钱,钱币的面额有:100元、50元、20元、5元、1元,如何找零使得所需钱币的数量最少? def changeMoney(Denomination: list, amountOfMoney: int): """ :param Denomination: 钱币的所有面额 :param amountOfMoney: 找零的目标金额 :return: 不同面额钱币的张数和找不开的金额 """ count = [0 for _ in range(len(Denomination))] for index, value in enumerate(Denomination): count[i...
true
081a718c5936f38d20629ceace0e4f6dbdead0b0
MateuszBelczowski/warsztaty-python-snake
/slajdy/dict3.py
UTF-8
252
3.640625
4
[]
no_license
slownik = {'jeden': 1, 'dwa': 2, 'slon': True} print(slownik) print(slownik['jeden']) print(slownik['slon']) print('dwa' in slownik) for element in slownik: print(element) for klucz, wartosc in slownik.items(): print(f'{klucz}: {wartosc}')
true
e4f9b5cb9406d3bef5268eec0d660cbca1612bf8
ethankruse/exoplots
/scripts/utils.py
UTF-8
100,996
2.90625
3
[ "MIT" ]
permissive
""" Utility functions needed for every figure. Load and process the data in a uniform way as well as run tests to ensure sensible results. """ from bokeh.models import ColorPicker # order is green, salmon, gold, purple, blue, cyan palette = {'C0': '#228833', 'C1': '#ee6677', 'C2': '#ccbb44', 'C3': '#aa3377', ...
true
6ba0f98df42883d63b2f72484be909283080fd56
leiregonzalez11/EHU-SW-20-21
/P1-ClienteIoT/Cliente_IoT_LGonzalez.py
UTF-8
4,076
2.734375
3
[]
no_license
import signal import sys import psutil import requests import urllib import json from signal import SIGINT import time def clienteIoT(): while True: #Obtención de los porcentajes de CPU y Ram cpu = psutil.cpu_percent() ram = psutil.virtual_memory().percent print("CPU: %" + str(cpu...
true
1304c2c0c002f94e7083c06d977008ae31b905ae
scdekov/hackbg_exam
/tic-tac-toe/game.py
UTF-8
9,195
3.75
4
[]
no_license
#!/usr/bin/env python import os clear = lambda: os.system('clear') class Game: first_player_symbol = 'O' second_player_symbol = 'X' def __init__(self): self.board = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] def _print_board(self): print("Your symbol is {}, the computers symbol ...
true
b7d0fa9d158bb213eb45005cc561707a6c638780
saurabhgrade2010/PolynomialRegression_model
/polynomial_regression.py
UTF-8
876
3.25
3
[]
no_license
#import import numpy as np import pandas as pd import matplotlib.pyplot as plt dataset =pd.read_csv("Position_Salaries.csv") X=dataset.iloc[:,1:2].values Y=dataset.iloc[:,2].values from sklearn.linear_model import LinearRegression r1=LinearRegression() r1.fit(X,Y) from sklearn.preprocessing import PolynomialFeatur...
true
f031acf3875acae97cc9bf7571ae08eb696b191b
Bjarturblaer/M
/skilaverkefni/verkefni2_solution.py
UTF-8
1,640
4.03125
4
[]
no_license
age = int(input("Please enter your age: ")) name = input("Please enter your name: ") option = int(input("Please choose an option:\n1.School package\n2.Regular package\n3.Flex package\n4.Retirement package\nEnter the number in front of the package you wish to choose: ")) error = "" if age <= 1 or age > 124: error ...
true
d1ee23b76272127a4d4b4e1d85cb1e23c99cdf10
dashan124/ITLabs
/Data_Structure_Lab/MergeSortandDFS/DFS.py
UTF-8
995
3.296875
3
[ "MIT" ]
permissive
class Graph: def __init__(self): self.color="white" self.distance=None self.pred=None self.time=[] def dfs(graph,s,t): a[s].dis = 0 a[s].color = "grey" t += 1 a[s].time.append(t) for v in graph[s]: if a[v].color == "white": t = dfs(graph, v, t)...
true
20c5542b9b971eaf29f646234a39fdf22b803e6b
rodrigokl/Arch-E
/Arch - E (.exe)/exe.win-amd64-2.7/teste2.py
UTF-8
8,543
3.1875
3
[]
no_license
import tkinter import tkinter.filedialog as fd import hashlib import logging title = "PyGest" class View(): """ The main view class for the PyGest tkinter interface. """ def __init__(self, root_object): self.root = root_object self.mainframe = None self.filePath = None ...
true
7aaa77f29b69337993145e2ebf3cb178f93dbb7b
skrolikowski/PyBox
/math/transform.py
UTF-8
1,514
3.3125
3
[ "MIT" ]
permissive
from pybox.math.matrix import Matrix class Transform: def __init__(self, x=0, y=0, z=1, angle=0, sx=1, sy=1, sz=1, kx=0, ky=0): self._matrix = Matrix() \ .translate(x, y, z) \ .rotate(angle) \ .scale(sx, sy, sz) \ .shear(kx, ky) @property def matrix(...
true
f4b55c1eef7afe9815d823a3f77cc037e0527338
AleksandraSudareva/Bot.WeatherBot.
/BotSignalExitter.py
UTF-8
383
2.859375
3
[]
no_license
import threading import signal class SignalExitter: def __init__(self): self.event = threading.Event() signal.signal(signal.SIGINT, self._exit_by_signal) signal.signal(signal.SIGTERM, self._exit_by_signal) def _exit_by_signal(self, signum, frame): self.event.set() def wai...
true
e6c37aefabd7a678fea1e0943b77aeabd2ddeb2a
kaktyzzz/MedCarboxiPnevmoStat
/classification.py
UTF-8
9,785
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- #https://habrahabr.ru/post/202090/ #http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html from pandas import read_csv, DataFrame, Series from sklearn import cross_validation, svm from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestCla...
true
e000ab7a8a9c9e9d84395cf1c7672a82b3c173a1
sajafleming/insta_search
/model.py
UTF-8
2,733
2.984375
3
[]
no_license
"""Models and database functions. Database named picturesdb""" from flask_sqlalchemy import SQLAlchemy import os # create instance of sqlalchemy db db = SQLAlchemy() ############################################################################## # Define data model class Pic(db.Model): """Picture class for how t...
true
e9fe5bcd5add31f6ff82a1b3e2c9f926c1daaba4
vicuna96/Binary_Tweets_Sklearn_Tf
/data_preprocess.py
UTF-8
4,762
2.78125
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas import read_csv from helper_functions import * from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from scipy.sparse import hstack import spacy def clean_df(dataset,te...
true
8d41bba4d11959fd6de95c69abc5e81fd44aad10
matthannan1/csvTest
/take4.py
UTF-8
3,293
2.90625
3
[]
no_license
import csv import sys import Tkinter import tkFileDialog import pprint import os edgeList = [] nodeDict = {} edgeDict = {} def openFile(fileType): ## create a root Tk widget (so we can destroy it later) root = Tkinter.Tk() if fileType == 'm': select = "Match" elif fileType == 'i': sel...
true
7c7b9192f157133750b925df68c060b1f29b7387
shunyaorad/EE209AS-Project-Scratchpad
/Create2_controller/basic_follower.py
UTF-8
3,936
2.765625
3
[]
no_license
# 1st version of tag following robot # working prototype. However can't locate tag once its lost. import cv2 import sys import time import create2api bot = create2api.Create2() bot.start() bot.safe() faceCascade = cv2.CascadeClassifier('classifier_3.xml') video_capture = cv2.VideoCapture(0) # Last time that tag is f...
true
13b2be09a5916c5be1403f264562a9d80cad1f9e
olga3n/adventofcode
/2022/day_22_monkey_map_2.py
UTF-8
6,226
3.0625
3
[]
no_license
#!/usr/bin/env python3 import sys from dataclasses import dataclass from typing import List, Tuple, Optional WALK_DIFFS = { '>': (0, 1), '<': (0, -1), 'v': (1, 0), '^': (-1, 0) } TURNS = { ('>', 'L'): '^', ('>', 'R'): 'v', ('<', 'L'): 'v', ('<', 'R'): '^', ('v', 'L'): '>', ('v...
true
625fa82bc2823456c3317a806d44540f6b61b288
geogubd/xformers
/xformers/triton/activations.py
UTF-8
2,858
2.96875
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import math from typing import Optional import triton import triton.language as tl from xformers.components import Acti...
true
fa6bfe06977263e2f6f6df69fb9c9318a90925c2
Bodia2cat/tchat
/clieant.py
UTF-8
268
2.765625
3
[]
no_license
import socket #first client ip = input("Enter server ip: ") port = input("Port: ") #first socket sock = socket.socket() sock.connect((ip, int(port))) a = "t" data = sock.recv(1024) while True: data = sock.recv(1024) print(data) if a == "q": exit() sock.close()
true
ce7e32165638277ccbe42c6ab727320fd2a53790
ku3i/evolution
/frames2image.py
UTF-8
4,156
3.234375
3
[]
no_license
#!/usr/bin/python """ This script draws the recorded frames from the 'path' folder into a single sequence image. example: ./frames2image.py -p ./data/ -s frame0791.ppm -n 10 -x 2 -c 250 -v + folder: ./data/ + starting at specific frame + 10 images + take only every 2n...
true
ea87a5f01e2326712182319d2cf7f39aff812b06
lgchang27/TSA-Seq-2020v2
/Changed_Region/residual_4datasets_compare_TSA2.0.py
UTF-8
16,662
2.6875
3
[]
no_license
#!/usr/bin/python # Programmer : Liguo Zhang # Date: 20190307 # Last-modified: '''This code will compare two cell lines with two biological replicates each, identify all 20 kb bins above a input threshold (always cell type 2 - cell type 1). It will take a second threshold of domain size and return merged segments whe...
true
ac4ab00370604c5add4f16748043d5b26f7c6c70
DmytroSytnyk/sweet
/mule/platforms/50_coolmuc_mpp2_gnu/JobPlatformAutodetect.py
UTF-8
264
2.734375
3
[ "MIT" ]
permissive
import platform def autodetect(): """ Returns ------- bool True if current platform matches, otherwise False """ if platform.node()[:10] == 'mpp2-login': return True return False if __name__ == "__main__": print("Autodetect: "+str(autodetect()))
true
c8acd2a15dd69cf5a00c870304c8637cf06eca87
Jingjin-Du/techflow
/5.kmeans/test.py
UTF-8
3,131
2.828125
3
[]
no_license
from sklearn import datasets import numpy as np import matplotlib.pyplot as plt import time import math import random import copy def createData(): X, y = datasets.make_blobs(n_samples=10000, n_features=2, centers=[[-1, -1], [1, 1], [2, 2]], cluster_std=[0.4, 0.5, 0.6]) return X, y def calculateDistance(vecA...
true
14d264c4f973c8a61428ad373e94a50825a4171f
SKutayKilic/Decision-Tree-Implementation
/decision_tree.py
UTF-8
11,981
3.28125
3
[ "MIT" ]
permissive
# Cmpe 480 - Introduction to Artificial Intelligence # Project 3 - Decision Tree Implementation # Seyfi Kutay Kılıç import sys import collections import random import math import statistics import matplotlib.pyplot as plt DATA_FILE = sys.argv[1] # it should be taken as a command line parameter ITERATION_COUNT = 10 #...
true
772492752c5d9b99e9887427f7ce09f03a47ce6b
diazadha/Prak-ALPROG
/Lab 3/latihan8.py
UTF-8
200
3.390625
3
[]
no_license
answer = int(input("Masukkan angka : ")) while answer != 7: print ("Jawabanya salah, silahkan coba lagi!") answer = int(input("Masukkan angka : ")) else: print ("Jawabanya benar!!")
true
44c4120275b32f1b197decd6e65526c42d067a08
VectorInstitute/vector_cv_tools
/examples/covid_lung_ultrasound/covid_dataset.py
UTF-8
2,742
2.546875
3
[ "MIT" ]
permissive
import os import csv from collections import OrderedDict import torch import numpy as np from torch.utils.data import Dataset from torchvision.io import read_video from experiment_utils import read_csv from vector_cv_tools.utils.misc import np_to_tensor, tensor_to_np from vector_cv_tools.utils import VideoReader clas...
true
a688bc67e4dc140c229a42730014f926bdaf581a
GZ-Alinx/Six_Star
/day5-列表与循环遍历/lx_01列表操作.py
UTF-8
825
4.3125
4
[]
no_license
# 定义 l = [1, 2, 3, 4, 5] l1 = [ 11, 22, 33] # 1. 增加 # l.insert(索引,数据) 指定位置添加数据 l.insert(2, '123') # l.append(数据) 在末尾添加数据 l.append('888') # l.extend(列表2) 将列表2中的数据追加到原列表 l.extend(l1) # 2. 修改 # 列表[ 索引 ] = 数据 l[2] = 33 # 3. 删除 # del 列表[索引] 删除指定索引的数据 del l[3] # l.remove(数据) 删除列表中第一次出现的数据 # pop 删除数据 还可以拿出来继续使用 ...
true
aaeb384909e5fb7180f3edf919065d49c34520d5
m1dlace/Labs_Python
/1 Лаба/14..py
UTF-8
376
3.03125
3
[]
no_license
def non_empty(listRetFunction): def wrapper(): returned = listRetFunction() deleted = 0 for i in returned: if i is None or i == '': returned.pop(deleted) deleted += 1 return returned return wrapper @non_empty def getList(): return ['c...
true
030a744783de55a00d5f9d44b3a32ad2c51527e5
trolleway/train_diagrams
/Sakhalin/sakhalin.py
UTF-8
13,237
2.671875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.dates as mdates import dateutil from matplotlib.ticker import (MultipleLocator, FormatStrFormatter, AutoMinorLocator) import datetime # Template code for ...
true
081d1ac453e22b1a0644c3d77eaa6ee75bc4fabf
dgr1992/gap_navigation_tree
/src/graph_visualisation.py
UTF-8
2,925
3.375
3
[]
no_license
import networkx as nx import matplotlib.pyplot as plt from tree_node import TreeNode class GraphVisualisation: def __init__(self): self.G = nx.Graph() self.G.add_node('r') self.redraw = False self.fig = None def add_node_to_root(self, node): if node == None: ...
true
2e187a46c8747e857efff755a7b176ac2550b884
ivartanian/learn
/learn/test1.py
UTF-8
137
3.453125
3
[]
no_license
def say(message, times = 1): times = 7 print(message * times) say('Привет', 2) say('Мир', 5) hi_ = "Hi" * 5 print(hi_)
true
d3467c4ed78363c58552ea258c4825d75f9265f0
RomDa00/Python-Text-Manager
/GUI.py
UTF-8
2,141
2.6875
3
[]
no_license
''' Created on Nov 26, 2017 @author: Romain ''' from tkinter import * import FileFunction import inputGUI import sys class Interface(object): ''' Main interface for application ''' def __init__(self, params): ''' Constructor ''' #Create main GUI ...
true
acbd431cee24bb61e9a2af7ea411c1e1dbeb3daf
realmyth/image-depixelizer
/src/datagen.py
UTF-8
1,692
2.828125
3
[ "MIT" ]
permissive
import os import re import numpy as np from PIL import Image, ImageFile import random from glob import glob def datagen(path, source_rescale, target_size, batch_size=32, shuffle=True): files = glob(os.path.join(path, '*.jpg')) if shuffle: random.shuffle(files) i = len(files) while True: source = np.ndarray((...
true
ed3c5577bb480bb5aef55a268f56adbd0c97417a
Indielly/Lista1PO
/exercicio4po.py
UTF-8
473
4.21875
4
[]
no_license
# -*- coding: utf -8 -*- """Faça um programa que leia 10 números e calcule imprima o maior valor, o menor valor e a média.""" minha_lista = [] for i in range(10): num = float(input(" Informe um número: ")) minha_lista.append(num) maior = max(minha_lista) # verificando o maior menor = min(minha_lista) # verificando ...
true
cb4991ebdeeaca457611fea1d4e2827c3a4518cd
nad2000/Use-python-toolkit-to-convert-data-stored-in-CSV-files-to-new-schema
/convert.py
UTF-8
3,651
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from utils import * from collections import defaultdict def conver_file(file_name): data = [] headings = [] phases = [] name, ext = os.path.splitext(file_name) output_name = name + ".p" output_json = name + ".json" affiliations = [] process...
true
012766da73ccdafc7aca709bdb8d5d705cb73bca
MinhVu88/PythonCC_2ndEd_Matthes
/try_it_yourself/ch8/8_12.py
UTF-8
603
4.625
5
[]
no_license
''' Sandwiches: - Write a function that accepts a list of items a person wants on a sandwich. - The function should have 1 parameter that collects as many items as the function call provides and it should print a summary of the sandwich that’s being ordered. - Call the function 3 times, using a different number of...
true
05fad6d10ba8b6d09451451d9c4f485816b96de8
Julian/Ivoire
/ivoire/result.py
UTF-8
7,099
2.984375
3
[ "MIT" ]
permissive
from textwrap import indent from unittest import TestResult import sys import time class ExampleResult(TestResult): """ Track the outcomes of example runs. """ def __init__(self, formatter): super().__init__() self.formatter = formatter def startTestRun(self): super().st...
true
2222bd0616d927c31675d59013644a5f997bae7a
smanjo/freenas
/src/middlewared/middlewared/plugins/catalogs_linux/items.py
UTF-8
5,897
2.515625
3
[]
no_license
import itertools import markdown import os import yaml from pkg_resources import parse_version from middlewared.schema import Bool, Dict, Str from middlewared.service import accepts, private, Service ITEM_KEYS = ['icon_url'] class CatalogService(Service): @accepts( Str('label'), Dict( ...
true
9114394c773c770dc87e07568435b9d68ac12386
woorimlee/LectureDB
/python_lecture/hot.py
UTF-8
628
2.65625
3
[]
no_license
import requests from bs4 import BeautifulSoup from datetime import datetime import keyboard while True : try: if keyboard.is_pressed('q'): now = datetime.now() print(datetime.today().strftime("%Y/%m/%d %H:%M:%S"), "\n실시간 인기 검색어\n") html = requests.get('http://www.naver.c...
true
0b25b1f4a8f3dd8c8e0b645e913566471005a57d
chifeng111/python_demo
/src/day12二叉树问题/04_二叉树序列化和反序列化.py
UTF-8
1,069
3.453125
3
[]
no_license
# coding: utf-8 from collections import deque class Node(object): def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def serialByPre(head): if head == None: return "#!" res = str(head.value) + "!" res += serialByPr...
true
fa5394f40960d6c425c3dd8c75d9e3ae393871d1
rodrigocruz13/holbertonschool-machine_learning
/supervised_learning/0x0A-object_detection/0-main.py
UTF-8
737
2.53125
3
[]
no_license
#!/usr/bin/env python3 if __name__ == '__main__': import numpy as np Yolo = __import__('0-yolo').Yolo np.random.seed(0) anchors = np.array([[[116, 90], [156, 198], [373, 326]], [[30, 61], [62, 45], [59, 119]], [[10, 13], [16, 30], [33, 23]]]) # size ...
true
92f875032c0abd7f65a3965f820c3feb927ea82f
Maydaytyh/PGame
/interface/start.py
GB18030
987
2.734375
3
[]
no_license
import sys import pygame def start(screen,image_paths): BeginImages=[pygame.image.load(image_paths[0]),pygame.image.load(image_paths[1])] BeginImage=BeginImages[0] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit()#رտ⣿ ...
true
af943e497df1ac2e90f3356fe6ab75a69cfd7979
SoniaSanchezSoto/Python-practice
/factorial.py
UTF-8
286
4.375
4
[]
no_license
def factorial(n): """Función que calcula el factorial de un número entero positivo. Parámetros n: Es un entero positivo. Devuelve el factorial de n. """ tmp = 1 for i in range(n): tmp *= i+1 return tmp print(factorial(4)) print(factorial(20))
true
41e2cf2b2cb01cadf8e884e4b6c80b48456e89e0
xjcai18/LeetcodeSolution
/code/530.二叉搜索树的最小绝对差.py
UTF-8
2,099
3.640625
4
[]
no_license
# # @lc app=leetcode.cn id=530 lang=python3 # # [530] 二叉搜索树的最小绝对差 # # https://leetcode-cn.com/problems/minimum-absolute-difference-in-bst/description/ # # algorithms # Easy (54.72%) # Likes: 81 # Dislikes: 0 # Total Accepted: 8.3K # Total Submissions: 15.2K # Testcase Example: '[1,null,3,2]' # # 给定一个所有节点为非负值的二叉搜...
true
2107f302ac79abc2340d60bf9380db014847b6e1
alisever/WebCrawling
/testscraper/link_cleaner_threading.py
UTF-8
1,619
2.734375
3
[]
no_license
import csv import multiprocessing from json import load, dumps import requests import codecs with codecs.open('yenisafakhaberleri.json', encoding='utf-8') as json_file: news_pages = load(json_file) with open('yenisafak_cleaned.csv', 'r') as file: # fixed = "".join(line for line in file if line.startswith('htt...
true
bee9c9964ae65d743426fe48ab1cb9fc13592961
sjsabuda/Project1
/project1-206.py
UTF-8
5,293
3.4375
3
[]
no_license
import os import filecmp from dateutil.relativedelta import * from datetime import date import csv import collections from collections import Counter from datetime import datetime def getData(file): # get a list of dictionary objects from the file #Input: file name #Ouput: return a list of dictionary objects where #t...
true
cba300426129c147ec6ac8a9fb8e6dd063975dce
2105-may24-devops/eric-project0
/sockets/client.py
UTF-8
2,665
2.78125
3
[]
no_license
from .connection_initializer import Initializer from progressbar import ProgressBar from .encryption import encrypt import socket import logging class Client: out = True # response codes success = b'0' bad_password = b'1' failed_on_unpacking = b'2' bad_initializer_msg = b'3' ...
true
ab360a3532ef3dc9c2678ca453a89e44fe286081
pyDANDIA/pyDANDIA
/pyDANDIA/pipeline_setup.py
UTF-8
3,659
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Oct 13 13:56:46 2017 @author: rstreet """ from os import getcwd, path from sys import path as systempath class PipelineSetup: """Class describing the fundamental parameters needed to identify a single-dataset reduction and trigger its reduction """ def __in...
true
1f268ab6f0d4183ce3e724bd2d41ee2811544f3c
crzysdrs/CS594IRC
/src/IRC/Client.py
UTF-8
27,402
2.875
3
[]
no_license
#!/usr/bin/env python """ An IRC Client Implementation Provides all the tools to process user input commands and handle IRC messages using the IRCHandler. """ import socket as sockmod import sys import argparse import re from more_itertools import unique_everseen import IRC import curses from collections import defaul...
true
d50853df8ffda5ff9cfb2333415430f8a28e565f
SuperMartinYang/learning_algorithm
/leetcode/medium/StringEnDecode.py
UTF-8
462
3.5625
4
[]
no_license
class Solution(object): def encode(self, strs): res = '' for s in strs: l = len(s) res += str(l) + '/' + s return res def decode(self, s): res = [] i, l = 0, 0 while i < len(s): l = int(s[i]) res.append(s[i + 2:i + ...
true
6cf2d7ec3f80fabda6b1864c1517dc28018d9e19
rubensmabueno/babel
/models/column.py
UTF-8
1,114
2.921875
3
[]
no_license
class Column: def __init__(self, name, type, length=None, numeric_precision=None, precision_radix=None, scale=None, default=None, nullable=None, fields=None): self.name = name self.type = type self.length = length self.numeric_precision = numeric_precision self.precision_radi...
true
ef29720462e640496c9091d50a26d5b6c25a0a72
avs-abhishek123/V-REP
/components/differentialrobotVREP/src/toolkit.py
UTF-8
1,338
2.796875
3
[]
no_license
def parse_error(error_num): """ Put the errors in a list given the result number """ error_list = [] if error_num & 0x01: # simx_return_novalue_flag error_list.append("no value returned") if error_num & 0x02: # simx_return_timeout_flag error_list.append("function...
true
b5104b17a4e130be8a9063877a4fcfb22b7088ec
RaymodLam/Unicorn-UIC--Spider
/Data_Output.py
UTF-8
1,150
2.90625
3
[ "MIT" ]
permissive
# coding:utf-8 import codecs import time import os import csv class DataOutput(object): def creat_new_file(self,filename,index_row): try: with open(filename,'w',newline='') as ff_csv: ff_writer = csv.writer(ff_csv) ff_writer.writerows(index_row) ...
true
af127debaa69dee20edf578241cef26fcf075ac3
sabaizzz/PGNN.pytorch
/main.py
UTF-8
5,797
2.5625
3
[]
no_license
__author__ = 'YuxuanXiu' import torch from torch import optim from torch.autograd import Variable from experimental_design import train_batch_size, learning_rate, num_epoches, patience from physical_guided_neural_network import PhysicalGuidedNeuralNetwork from loss_function import empirical_error,structural_error,physi...
true
961d36f70cd3b028e770036fea1a4f6d7c1a671f
Kontowicz/Daily-Interview-Pro
/solutions/day_148.py
UTF-8
197
3.484375
3
[]
no_license
def transpose(mat): return [list(row) for row in zip(*mat)] mat = [ [1, 2, 3], [4, 5, 6], ] assert transpose(mat) == [[1, 4], [2, 5], [3, 6]] print(transpose(mat)) print('Test pass.')
true
b9402edb85c28410a97a02f0a16cddd13abea3fe
Kirize14/PCA-2018
/Lab-1.py
UTF-8
785
3.65625
4
[]
no_license
def ator(number): convert = [[1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'],[ 100, 'C'], [ 90, 'XC'], [ 50, 'L'], [ 40, 'XL'],[ 10, 'X'], [ 9, 'IX'], [ 5, 'V'], [ 4, 'IV'],[ 1, 'I']] result = '' for denominator, roman_digit in convert: result += roman_digit*(number/denominator) numb...
true
5daa3c9d9e7ffcd742c1017685d467458dcbcd63
izmailovpavel/Practicum
/1. Vectorization/Final_file_set/problem_7_testing.py
UTF-8
1,709
2.59375
3
[]
no_license
import unittest import numpy as np import numpy.testing as npt import scipy.spatial.distance as spd from problem_7 import find_pairwise_distances, vec_find_pairwise_distances, \ fun_find_pairwise_distances class TestMyFunctions(unittest.TestCase): def test_small_data(self): d, m, n = 2, 5, 10 ...
true