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
ef06b7419f927a533c8c12f2dd2a2266265b914a
SagruH/P3PHYSIK
/hyperfeinstruktur/hyperfein.py
UTF-8
10,028
3.015625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy import stats from scipy import constants as const from scipy.optimize import curve_fit from scipy import interpolate as ip import uncertainties as uc def uc_lin_reg(x,xerr,y,yerr): #Tests and clean up if(len(x) != len(y)): print("ERROR: un...
true
f4b17cab2290e91a790c6e0609cc1b9224c2e024
Gvence/pythonHW
/2-22_dynamic_plot/2222.py
UTF-8
8,028
2.671875
3
[]
no_license
import numpy as np import os import time import matplotlib.pyplot as plt import tensorflow as tf import re import urllib.request import zipfile import lxml.etree from collections import Counter from random import shuffle from gensim.models import KeyedVectors # Download the dataset if it's not already there if not os....
true
129b9b43374ba1766c5aa771580924059ecfb8c0
D4rkdev1987/CodeWars
/Sum-Of-The-First-Nth-Term-Of-Series-7KYU.py
UTF-8
994
4.28125
4
[]
no_license
def series_sum(n): return '{:.2f}'.format(sum(1.0/(3 * i + 1) for i in range(n))) ''' before refactoring def series_sum(n): if n == 0: return ("%.2f" % 0) else: n = n-1 sum_list = [1] while n > 0: x = 1/float(n *3 +1) sum_list.append(x) ...
true
bc9a9de41f037cb3e165bd28631f4cf8ab0bed77
Libardo1/Physics
/Code/Run308_WIMP_searches/Run308_Analyse_ERA/Scripts_ERA/plots_for_lowmass_ppt.py
UTF-8
4,725
2.515625
3
[]
no_license
#!/usr/bin/env python from ROOT import * import script_utils as script_utils import PyROOTPlots as PyRPl import Analysis_utilities as Ana_ut import numpy as np def get_KTH_plot(bolo_name, data_dir, tree_name): """ Do the plot of KTH vs time Also estimate the mean KTH Detail: Arguments: bolo...
true
91fb0057e713716f38deb89725ef6fcdb402f53b
KonstantinosAng/CodeWars
/Python/[6 kyu] unique in order.py
UTF-8
452
3.6875
4
[ "MIT" ]
permissive
# see https://www.codewars.com/kata/54e6533c92449cc251001667/train/python from TestFunction import Test def unique_in_order(iterable): pointer = 0 iterable = [x for x in iterable] while pointer < len(iterable) - 1: if iterable[pointer] == iterable[pointer+1]: iterable.pop(pointer + 1) else: ...
true
d348072eb58162fe1c3ea11d293eed47293dcec6
johnaparker/stoked
/tests/uniform_force.py
UTF-8
1,311
2.59375
3
[ "MIT" ]
permissive
import stoked from stoked import brownian_dynamics, drag_sphere from functools import partial import matplotlib.pyplot as plt from tqdm import tqdm import numpy as np def uniform_force(t, rvec, orient, Fx): F = np.zeros_like(rvec) F[:,0] = Fx return F def test_uniform_motion(): position = [[0,0,0]] ...
true
d8dadcc548480071a65c94755768c30866c6b60d
SoftwareGift/efficientnet-pytorch
/efficientnet/metrics/accuracy.py
UTF-8
801
2.6875
3
[ "MIT" ]
permissive
from __future__ import division import torch class Accuracy(object): def __init__(self, top_k=1): self.top_k = top_k self.correct = 0 self.count = 0 def update(self, output: torch.Tensor, target: torch.Tensor): assert output.size(0) == target.size(0) with torch.no_g...
true
4a140b60f4f58ea75c3d99eb1b5a1f3948ee34c3
retarf/webshop
/django/shop/tests/model_objects_examples.py
UTF-8
239
2.546875
3
[]
no_license
from shop.models import Product n = 20 def add_products(n): for i in range(n): name = 'product{0}'.format(str(i)) Product.objects.create( name=name, description=name )
true
b5d1dad666a6bf09bf73fa31b6e5d8fb60322a2b
dyarmak/ForecastReportBuilder
/InvoicedManipulations.py
UTF-8
1,804
2.53125
3
[]
no_license
#************************************************************************ # This script performs the excel manipulations on the qry_Invoiced data #************************************************************************ # Currently broken # Need to add 'Type' Column in correct loaction import os import datetime impor...
true
32fae495edca8e07e7b26f841ff1d44c104df42a
santiagoom/leetcode
/solution/python/110_BalancedBinaryTree_1.py
UTF-8
898
3.421875
3
[]
no_license
from typing import List from utils import * class Solution { private: // Recursively obtain the height of a tree. An empty tree has -1 height int height(TreeNode* root) { // An empty tree has height -1 if (root == NULL) { return -1; } return 1 + max(height(root->left),...
true
6b98aa997c96a0591e61284128b70b9ff985d727
MattiaBosio/meetup-generative-models
/WGAN.py
UTF-8
7,668
2.625
3
[]
no_license
import os import numpy as np import torch import torch.nn as nn import torch.optim as optim from VAE import mnist_loader, Reshape from VQ_VAE import _init from GAN import model_parameters from matplotlib import pyplot as plt class Generator(nn.Sequential): def __init__(self, hidden_dims=16, c=16): super()...
true
5916ff59977862d93e530a96adc8190526ecaabf
nishanthegde/bitesofpy
/205/speaker.py
UTF-8
1,906
3.125
3
[]
no_license
from urllib.request import urlretrieve from pathlib import Path import os from os import path import gender_guesser.detector as gender from bs4 import BeautifulSoup as Soup # TMP = Path(os.getcwd()) TMP = Path('/tmp') # print(type(TMP)) PYCON_HTML = TMP / "pycon2019.html" # PYCON_HTML = os.path.join(TMP, ...
true
5e37eb0726f081f934bcda8223f3a8218f2333d6
yzj-again/CS181
/bayes_nets/inference.py
UTF-8
10,305
3.328125
3
[ "MIT" ]
permissive
# inference.py # ------------ # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. ...
true
6d1215c7a4dc842d2c273aff8d764d8d50145ea0
Cameron-D/munin-mybb
/mybb_threads
UTF-8
652
3
3
[ "Unlicense" ]
permissive
#!/usr/bin/env python import sys, urllib2, re, os # Check for configuration board_url = os.environ.get('board_url') if(board_url == None): exit(0) if(len(sys.argv) > 1 and sys.argv[1] == "config"): print """ graph_title Total Threads graph_vlabel threads graph_category mybb threads.label Threads """ exit(...
true
3529cb046a1f0f4c02f0f2daa626123d7a593331
prathamtandon/g4gproblems
/Sorting and Searching/sorted_search_no_size.py
UTF-8
1,238
4.3125
4
[ "MIT" ]
permissive
""" You are given an array-like data structure Listy which lacks a size method. It does, however, have an elementAt(i) method that returns the element at index i in O(1) time. If i is beyond the bounds of the data structure, it returns -1. Given a Listy which contains sorted, positive integers, find the index at which ...
true
0dfcb5abc8ba1dc1cfc1e9e77b03bb2686870728
Skeletonboi/Graphs-CSC190
/graph.py
UTF-8
2,552
2.9375
3
[]
no_license
from queuelib import * from stacklib import * class graph: def __init__(self): graph = [] def addVertex(self, n): if n < 0: return -1 for i in range(0, n): self.graph.append([]) return len(self.graph) def addEdge(self, from_idx, to_i...
true
ab0570f0ba3a28a6497b38895cada7a45768d2c5
freebz/High-Performance-Python
/ch11/ex11-4.py
UTF-8
304
3.3125
3
[]
no_license
# 예제 11-4 760MB의 RAM을 사용해 1억 개의 정수로 이뤄진 배열 만들기 In [1]: %load_ext memory_profiler In [2]: import array In [3]: %memit array.array('l', xrange(int(1e8))) peak memory: 781.03 MiB, increment: 760.98 MiB In [4]: arr = array.array('l') In [5]: arr.itemsize Out[5]: 8
true
83dc5edb3fb8ef83ea97ecb5fbf890c5c39575c9
Borchevkin/ws_iotstarter
/lab03/lab03.py
UTF-8
1,525
3.03125
3
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/python ''' Lab 03 In this lab you will connect to MediaTek LinkIt Smart a button and send button's data to the cloud backend - dweet.io and see this data at the freeboard.io. Button should be connected as following Actuator --> LinkIt Smart ----------------------------------- VCC (Red) -->...
true
fcb85062e73c958399403f82102e347cdf9794a1
DrWala/advent-of-code-2020
/day-06/customs.py
UTF-8
859
3.5
4
[]
no_license
# Part 1 def count_valid_one(entry_str): entry_str = entry_str.replace('\n', '') return len(set(list(entry_str))) def convert_file_to_group_forms(content): return content.split("\n\n") def solve_one(content): group_forms = forms = convert_file_to_group_forms(content) count = 0 for form in grou...
true
8a555112eac9da9fc83622cae9e0d931eab02743
lomayka/PythonProjects
/NAlab2/LQ.py
UTF-8
1,839
3
3
[]
no_license
import copy import numpy as np class LQ: arr = [[]] def __init__(self, array): self.arr = array def solve(self, arguments): length = len(self.arr) A = copy.deepcopy(self.arr) Q = [] y = [0] * length for i in range(length-1): sum = 0 ...
true
36b8106498d3b56a45446bbbec430495b49f0412
bflaven/BlogArticlesExamples
/migrate_create_parse_website_testing_front_apps_api_cypress/004_cypress_fov_suite_2e2/004_2_fov_html_js_python/decode_encode_javascript/001_example_js_decode_encode_javascript_chatgpt_fov.py
UTF-8
4,002
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- """ [env] # Conda Environment # NO CONDA ENV conda create --name po_launcher_e2e_cypress python=3.9.13 conda info --envs source activate po_launcher_e2e_cypress source activate parse_website conda deactivate # if needed to remove conda env remove -n [NAME_OF_THE_CONDA_ENVIR...
true
3807016ed672917df96312c928fe15f7e923bb2b
mrgrant/LeetCode
/449.serialize-and-deserialize-bst.py
UTF-8
1,693
3.515625
4
[]
no_license
# # @lc app=leetcode id=449 lang=python # # [449] Serialize and Deserialize BST # # @lc code=start # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def serialize(self, root): ...
true
1be0e94584e651e33d7d496d2cdff8909891def3
krangan2587/algorithms-master
/dietproblem.py
UTF-8
3,284
3.390625
3
[]
no_license
#import pandas and pulp packages from pulp import * import pandas as pd #read all data from excelsheet food_data = pd.read_excel("C:/Users/kastu/Documents/R Scripts/HW11/diet.xls",header = 0) #This is a list of all foods that will form the diet food = food_data[0:64] #Now food is a pandas dataframe. But we will nee...
true
fa081e6cebcb971e4e769771a4d2dd6cb6d422bd
Sillhouette/tic_tac
/src/player_builder.py
UTF-8
975
2.9375
3
[ "MIT" ]
permissive
import src.constants as constants from src.human_player import HumanPlayer from src.computer_player import ComputerPlayer class PlayerBuilder(): def __init__(self, processor, cli): self.processor = processor self.cli = cli def build_players(self, player_tokens, choice): player_1 = sel...
true
9d7754a1709cffea327c57863922be22a09d4759
neilwithdata/aoc2019
/day02a.py
UTF-8
440
3.265625
3
[]
no_license
with open('day02_input.txt') as file: contents = file.read() program = [int(x) for x in contents.split(',')] for i in range(0, len(program), 4): opcode = program[i] if opcode == 99: break p1 = program[i + 1] p2 = program[i + 2] loc = program[i + 3] if opcode == 1: program[...
true
d83783a582553d861815dc95892a7dc0033b36cd
andyzhu/python-DIP
/test_plotly_plot.py
UTF-8
710
2.8125
3
[]
no_license
import datetime from unittest.mock import MagicMock import plotly.graph_objects from plotly_plot import Plot def test_draw(monkeypatch): figure_mock = MagicMock() monkeypatch.setattr(plotly.graph_objects, 'Figure', figure_mock) scatter_mock = MagicMock() monkeypatch.setattr(plotly.graph_objects, 'Sc...
true
641cb05d3ea1b3391dd3c2b7c8629a01a4fe2457
Yuanguo-notebook/eyetracking_data_analyze
/compare_eye_anno.py
UTF-8
7,008
2.96875
3
[]
no_license
################################################ ## 2. analyze hitting points ## get data of which object they are looking at ## ## we need: ## 1. eye tracking data file end with csv that we ## previously got(only has timestamp and 2d ## hitting points ## 2. folder contains image sequence and json files ## ## In ...
true
e3b226d3fa8904bd08e983752c04abe4961e2f25
naowal/prog-eval
/graphsage/main-redacted.py
UTF-8
3,784
2.953125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ graphsage/main-redacted.py Simple skeleton for the implementation, showing how data should be read, and how the evaluation metrics are computed. """ import sys import argparse import numpy as np import pandas as pd from scipy.io import mmread # -- # Helpers def ...
true
ceb206145fd30c0ccee08de258414cee9f67b4ed
ajgon/archives
/pigit/parser/__init__.py
UTF-8
12,556
2.765625
3
[]
no_license
import os.path import zlib import re from datetime import datetime from pigit.common import Timezone from math import ceil import binascii import ConfigParser from io import StringIO from pigit.common import Configuration from pigit.common import GitCache from pigit.gitobjects import * class Parser(object): """...
true
6361843c333bc5c0ff6f5193c1e37dc56ce5cbeb
antikytheraton/gamers_api
/Games/views.py
UTF-8
738
2.59375
3
[]
no_license
from django.shortcuts import render from django.http import JsonResponse import requests from bs4 import BeautifulSoup # Create your views here. def play(request): ''' Ejemplo de como se Scrappear pagina de Gamers y so obtener solo el precio de los videojuegos lo el precio" ''' req = requests.get("h...
true
6ea3f96aeb03e547300ab90d343f24328b1dabd4
originx/DiscreteMath_class
/sve.py
UTF-8
9,062
3.140625
3
[]
no_license
import random; import gmpy; from gmpy import mpz; from gmpy import gcd; import math; from math import sqrt #zad1 #nzm q=[]; def NZM(a,b): if(b==0): return a; else: d=a%b; if d!=0: q.append((a-d)/b); return NZM(b,d); def rjesiKongruenciju(a,b,n): mjera=NZM(n,a)...
true
1e27f29f53f279c057779de8846a4b08d5db9bb1
Robotcook/Python
/functions_test.py
UTF-8
102
2.84375
3
[]
no_license
from lecture10 import numbers_sum if numbers_sum(2, 3) == 5: print("ok") else: print("error")
true
95e3fd0b07e1f4f0d95dd28e6bdd86839d1a5f70
vutuancong/MachineLearning-ComputerVision
/icecream/Neural Netework/data_iris.py
UTF-8
2,165
2.921875
3
[]
no_license
# import data_helpers from sknn.mlp import Layer, Classifier from sklearn import datasets import random import numpy as np # __global_map = map # lmap = lambda func,*iterable:list(__global_map(func,iterable)) # map = lmap def load_train_data(split_percent = 0.9): data_iris = datasets.load_iris() feature_data = da...
true
24d0cad9bbeb99f87415ff3db089f683504c4baf
aaronsaliba/test
/Exe.py
UTF-8
935
2.734375
3
[]
no_license
import openpyxl as xl import openpyxl.styles as xlst import requests as req import datetime as dt import json import excel_writer_reader as ex import coinmarketcap_data_parser as cmc # Timestamping ex.today_in_cell("testing.xlsx", "Table", "G4") # Filling in data in top-part reading_set = ["A4", "A5", "A6", "A7", "A8...
true
9b40fb92d386e1969882223d071f3f6b885fe39a
quintus2020intern/PM_Basic_Python
/dictionary/store_dict_json.py
UTF-8
579
3
3
[]
no_license
# import json # # d = {"students": [{"firstName": "Nikki", "lastName": "Roysden"}, # {"firstName": "Mervin", "lastName": "Friedland"}, # {"firstName": "Aron ", "lastName": "Wilkins"}], # "teachers": [{"firstName": "Amberly", "lastName": "Calico"}, # {"firstName...
true
6bcb544649e8564cd67129e04840c52804556ddd
cheyennebiolsi/HackerRank
/Algorithms/GraphTheory/roadsAndLibraries.py
UTF-8
1,526
3.375
3
[]
no_license
#!/bin/python3 import sys import copy class Node: def __init__(self, id): self.id = id self.neighbors = [] self.visited = False def addNeighbor(self, other): self.neighbors.append(other) other.neighbors.append(self) class Solution: def solve(self, c_lib, c...
true
6b92971e843385d2fa59ff1df7b339bda2349bd1
RupinderjitKaur/OpenSpeech-master
/NewAdmin.py
UTF-8
2,784
2.546875
3
[]
no_license
from tkinter import * from PIL import Image, ImageTk import main import admin_options as ao from tkinter import messagebox class AddAdmin: def __init__(self, admin_id): self.panel=Tk() self.ad_id=admin_id self.w = int(self.panel.winfo_screenwidth()*0.6) self.h = int(self.panel.w...
true
932fa7baeee3066add1e9e8212cc7e81034c8d0e
3than0ls/drawer
/interface.py
UTF-8
10,777
2.875
3
[]
no_license
from tkinter import filedialog import tkinter as tk import math import os from PIL import Image, ImageTk from settings_manager import update_settings, get_settings from statistics import mean import json def split(list, n): k, m = divmod(len(list), n) return (list[i * k + min(i, m):(i + 1) * k + min(i + 1, m)]...
true
d8633229a2da96577d44cd4f6aaf288ff620401f
fullerharrison/afs505_u1
/practice/ex13.py
UTF-8
407
3.234375
3
[]
no_license
# From terminal import arguments from sys import argv #Read the WYSS section for how to run this # the name of the file or script is the first arguement # then input by user is the 2nd 3rd and 4th arguements script, first, second, third = argv print("The script is called:", script) print("Your first variable is:", fi...
true
08f509c76a49f002d50a72eaf5f6f2f8f56710ad
IngLuisZambrano/Teleoperacion_falcon
/proyecto_delta/src/falconsubpos.py
UTF-8
3,818
2.53125
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python # coding: utf-8 import rospy from ik import * import tkMessageBox from Tkinter import * from dynamixel_sdk import * from ros_falcon.msg import * from dxl.dxlchain import DxlChain from proyecto_delta.msg import posicion global x,y,z, data, td1 def callback_funct...
true
c118cf1790f09a846310c22f6c7875fa266e890a
kibernetika-ai/fastmri-tf
/realsense/demo.py
UTF-8
2,259
2.5625
3
[]
no_license
import argparse import cv2 import numpy as np import pyrealsense2 as rs def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('input', help='.bag file path') return parser.parse_args() def main(args): # Create a context object. This object owns the # handles to all connected ...
true
2b62872467577e0d4ae1b5cdda1e7098f0762215
tjking24/recipe-app-api
/app/core/management/commands/wait_for_db.py
UTF-8
944
2.65625
3
[ "MIT" ]
permissive
import time from django.db import connections from django.db.utils import OperationalError from django.core.management.base import BaseCommand class Command(BaseCommand): """Django command to pause execution untill database is available""" def handle(self, *args, **options): self.stdout.write('Waiti...
true
9ee4a7901d0e04e99ab850dc3d136614f8202431
xerprobe/LeetCodeAnswer
/面试题56 - I. 数组中数字出现的次数/pythonCode.py
UTF-8
1,096
3.703125
4
[]
no_license
from typing import List class Solution: def singleNumbers(self, nums: List[int]) -> List[int]: numsSum = 0 for i in nums: numsSum ^= i flag = (-numsSum)&numsSum result1 = [] result2 = [] for i in nums: if((flag&i) == 0): result1...
true
43814c0dd4ad54962952cc86103e595c5b7996ad
ah-khalil/PatriotDiscordBot
/bot/cogs/Billboard.py
UTF-8
7,146
2.53125
3
[ "MIT" ]
permissive
import re import threading from bot.core.PatriotCog import PatriotCog from bs4 import BeautifulSoup as soup from discord import Embed, Color from discord.ext import commands from urllib.request import (Request, urlopen) from bot.cogs.billboard import ( hot_url, bill200_url, hdr ) from bot.core.models impo...
true
64d544b28a3f2ec1c6cd0da7c2c99d79943574bf
KeerthipriyaJawahar/Python-Programming
/Beginner Level/LeapYearOrNot.py
UTF-8
174
3.71875
4
[]
no_license
a = raw_input("Enter the Year: ") if(a != "" and a.isdigit()): b=int(a) if(b%4==0): print "Yes" else: print "No" else: print("Invalid Input")
true
af6522dfa9e5ce6c8c8293ff7323fc51b822b1b4
dockerizeme/dockerizeme
/hard-gists/1610922/snippet.py
UTF-8
1,270
3.0625
3
[ "Apache-2.0" ]
permissive
"""Example of adaptive Lasso to produce event sparser solutions Adaptive lasso consists in computing many Lasso with feature reweighting. It's also known as iterated L1. """ # Authors: Alexandre Gramfort <firstname.lastname@inria.fr> # # License: BSD (3-clause) import numpy as np from sklearn.datasets import make_reg...
true
9040b379c4ed30a0ec840952060f4d95841fe769
FREAC/PyUTM
/pyutm/locate.py
UTF-8
10,700
3.1875
3
[ "MIT" ]
permissive
# For compatibility between Python 2.x and 3.x try: from builtins import range except ImportError: import __builtin__ as builtins import pyproj class Point: def __init__(self, longitude, latitude, precision=1): """ Implements the methods for reporting a UTM or UPS grid location as descri...
true
970d207fb9a0cd4c1abaeb1d9095d2be7d66cfb3
cnmodel/cnmodel
/cnmodel/morphology/hoc_reader.py
UTF-8
21,323
2.765625
3
[ "BSD-3-Clause" ]
permissive
from __future__ import print_function import os import re from pathlib import Path import collections import numpy as np from neuron import h import neuron import pyqtgraph as pg try: basestring except NameError: basestring = str class HocReader(object): def __init__(self, hoc): """ Pr...
true
28f67de2e1e5ae54790db62807e578580f85981c
bli735/airflow3
/src/get_sensor_data.py
UTF-8
1,247
2.578125
3
[]
no_license
import requests import logging import json from datetime import datetime import gzip def get_sensor_data(): # purpleair api endpoint # documentation @ https://docs.google.com/document/d/15ijz94dXJ-YAZLi9iZ_RaBwrZ4KtYeCy08goGBwnbCU/edit?usp=sharing url = 'https://www.purpleair.com/json' # logging.ba...
true
d06651126745e352cacc9e8c06287163e237f6df
sivajilucky/My-SystemAssistant
/Implementation.py
UTF-8
3,202
2.71875
3
[]
no_license
import webbrowser import pyttsx3 import speech_recognition as sr import datetime import wikipedia import webbrowser import os import smtplib engine=pyttsx3.init('sapi5') voices=engine.getProperty('voices') #print(voices[0].id) engine.setProperty('voice',voices[0].id) def speak(audio): engine.say(audio) engine....
true
abae490eb48e30c92a4c06c6abcfd324cf048d3c
yassataiseer/inkfactory
/user_fetcher.py
UTF-8
472
2.625
3
[]
no_license
import sqlite3 import time import datetime import random conn = sqlite3.connect('employees.db', check_same_thread=False) c = conn.cursor() class static: def data(): send_data=[] c.execute('SELECT * FROM stuffToPlot') data = c.fetchall() #print(data) send_data = [] ...
true
012a0dbf0aae35b27d5133636605456c3d5c48bd
riya36512/ML-Projects
/Tx2Sp.py
UTF-8
439
3.078125
3
[]
no_license
import pyttsx3 import tkinter window = tkinter.Tk() text = tkinter.StringVar() window.title("Talk to me") entry = tkinter.Entry(window,textvariable = text,width = 50, bd =4, font =15,).pack() def play(): speaker = pyttsx3.init() txt = text.get() speaker.say(txt) speaker.runAndWait() btn =...
true
92afe6bf70c42dabc2ab96bfe5aade09f84d9ab6
ArnaudGuibert/GrosData
/scripts/Hadoop/script.py
UTF-8
946
2.609375
3
[]
no_license
import bucket_utils import sqs_utils queue_url = 'https://sqs.us-east-1.amazonaws.com/838549581352/StartPredicting.fifo' file_name = 'predict.csv' target_file_name = 'predict.csv' bucket_name = 'predict-bucket-big-data-6' print('[START]') print() print("Uploading '" + file_name + "' file on '" + bucket_name + "' buck...
true
96fc289f4386e0747db719d42857df0893524bf5
hypothesis/lms
/lms/product/product.py
UTF-8
2,357
2.53125
3
[ "BSD-2-Clause" ]
permissive
"""Core models of the product.""" from dataclasses import InitVar, dataclass from enum import Enum from typing import Dict, Optional from lms.product.plugin import PluginConfig, Plugins class Family(str, Enum): """Enum for which product this relates to.""" BLACKBAUD = "BlackbaudK12" BLACKBOARD = "Black...
true
3940e4475d189cc738fee47f947007c06dab63ff
bitwisely/iotic
/app/ntpd.py
UTF-8
1,259
2.765625
3
[ "MIT" ]
permissive
import logging import subprocess import datetime """ Class implementation for updating time with ntpd servers with big jump """ class Ntpd(): def __init__(self): time_ok = False try_cnt = 0 while not time_ok and try_cnt < 5: try_cnt += 1 time_ok = self.test() ...
true
da9808cfdcc829cc30beeebf621cf95f60630bf0
IBMStreams/streamsx.topology
/samples/python/topology/games/fizz_buzz.py
UTF-8
1,590
3.484375
3
[ "Apache-2.0" ]
permissive
# Licensed Materials - Property of IBM # Copyright IBM Corp. 2016,2019 from __future__ import print_function from streamsx.topology.topology import Topology import streamsx.topology.context import fizz_buzz_functions def main(): """ Plays Fizz Buzz (https://en.wikipedia.org/wiki/Fizz_buzz) Example: ...
true
53d0d8ef6ce00f171f2bead44d8c69f2713dbf35
stopmosk/homework-2019
/hw4/task4/class_animal_bear_fish_test.py
UTF-8
2,837
2.640625
3
[]
no_license
import unittest from class_animal_bear_fish import * class MyTestCase(unittest.TestCase): def test_set_bounds(self): self.assertRaises(ValueError, Animal.set_bounds, -1, 5) self.assertRaises(ValueError, Animal.set_bounds, 5, -1) self.assertRaises(ValueError, Animal.set_bounds, -5, -1) ...
true
2c08ae29615e2054214bf84f616ef7930404a237
jlhg/rosalind-solution
/revp/revp.py
UTF-8
819
3.3125
3
[]
no_license
#!/usr/bin/env python # # revp - Locating Restriction Sites # # http://rosalind.info/problems/revp/ # # Created: 2013.10.10 import sys def main(): with open(sys.argv[1], 'r') as fi: fi.readline() seqlist = [] for line in fi: seqlist.append(line.strip()) seq = ''.join(...
true
de971e856c2f3699dfdfba62026a90df0bd53be9
raja21068/Machine-Learning-Toturials
/1_IdentityOperators.py
UTF-8
137
3.21875
3
[]
no_license
var1=5 var1=5 var2='Hello' var2='Hello' var3=[1,2,3] var3=[1,2,3] print(var1 is not var1) print(var2 is var2) print(var3 is var3)
true
0459741f5c58237cfdcb45855ea8633d617f1f50
huynhtritaiml2/Python_Basic_Summary
/Open_CV/tutorial_Self_Driving_Test_Simulation.py
UTF-8
2,299
2.6875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 27 21:20:12 2021 @author: tai """ print('Setting UP') ''' pip install python-socketio==4.2.1 # python-socketio 4.2.1 pip install eventlet pip install Flask Run 1. Run this code 2. Run simulator: /home/tai/Downloads/Python_basic_summary/Open_C...
true
567a72434f1de38e818b3d832da2575dfd8e12ba
esevillano1/386_Pong
/ball.py
UTF-8
632
3.390625
3
[]
no_license
import pygame from pygame.sprite import Sprite class Ball(Sprite): def __init__(self, settings): # Initialize the location of the ball super().__init__() self.settings = settings self.radius = self.settings.radius self.x = self.settings.horizontalPosition self.y =...
true
4f42af2c7e393f859e1d13f6b5e46dd07d44e7ee
josecarlosgomezt/nonconformist
/examples/icp_regression_tree.py
UTF-8
1,571
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Example: inductive conformal regression using DecisionTreeRegressor """ # Authors: Henrik Linusson import numpy as np import pandas as pd from sklearn.tree import DecisionTreeRegressor from sklearn.datasets import load_boston from nonconformist.base import RegressorAdapter from nonconform...
true
181a7d23d0b41aa7e8292cb182186026484a5add
JoeyLwq/zhihu_spider
/login.py
UTF-8
2,046
2.953125
3
[]
no_license
#__author: Joey #date: 2018/6/15 from selenium import webdriver import requests class ZhiHu_login(object): #模拟登陆知乎获取cookie def __init__(self,user,pwd): self.cookie = {} self.headers = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome...
true
3433a82f841c4f03510bf1cf5c8db826361befe8
ivanovmg/approx
/tests/test_basic.py
UTF-8
440
2.578125
3
[ "MIT" ]
permissive
import approx import unittest class BasicTestCase(unittest.TestCase): """ Basic test cases """ def test_basic(self): """ check True is True """ self.assertTrue(True) def test_version(self): """ check approx exposes a version attribute """ self.assertTrue(hasattr(approx, ...
true
f728fdefb17186563c1a86001093608e11fcbef0
anders-ahsman/advent-of-code
/2016/day04/main.py
UTF-8
2,035
3.171875
3
[]
no_license
from collections import defaultdict import re from typing import List def read_input(filename): with open(filename, 'r') as f: lines = [line.rstrip() for line in f.readlines()] return lines def is_real_room(room: str) -> bool: return calculate_checksum(room) == read_checksum(room) def calculate_c...
true
995a543efd4b58ec6bbe347ad19959146612491f
MIKEOSORIO/Proyecto-Analizador-Sintactico
/analizador_sintactico.py
UTF-8
10,096
2.734375
3
[]
no_license
# importacion de librerias necesarias + el archivo en donde se encuentran los tokens import sys import ply.yacc as yacc from analizador_lexico import tokens VERBOSE = 1 #------------------------------------- Apartado en donde se llama al archivo del analizador lexico como procedencia de la¿os tokens a usar precedence ...
true
648160ab88e3e3997a39afc3e4611991c2f2a546
russellw/ml
/crossentropy.py
UTF-8
405
2.875
3
[ "MIT" ]
permissive
#https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html import torch from torch import nn # Example of target with class indices loss = nn.CrossEntropyLoss() input = torch.randn(3, 5, requires_grad=True) target = torch.empty(3, dtype=torch.long).random_(5) output = loss(input, target) print(input) pr...
true
d590dda90868b81c43bcea61b2ae2b3a97df8d9d
afigar/ecg-mqtt
/live_ecg.py
UTF-8
1,718
2.9375
3
[]
no_license
# # this script subscribe to MQTT server, receive messages and then # put data into MySQL/ECG/live_ecg # # need to install MySQLdb: # $ sudo apt-get install python-mysqldb # import MySQLdb as mysql class ecg_mysql: def __init__(self): self.cnx = None self.cursor = None self.sql_ins...
true
4a28e32bfc78f03f0904b70a7e958c55c3365fa8
Ganesh2611/guvi_python
/integer.py
UTF-8
64
3.328125
3
[]
no_license
a=int(input("")) c=0 while(a>0): c=c+1 a=a//10 print(c)
true
ba1880b47eff24e43ce68fbe85788c897cff512d
pmurena/distSys
/project_01/01/results/clean.py
UTF-8
278
2.84375
3
[]
no_license
import glob files = glob.glob("./*.txt") newFile = "" for file in files: with open(file, 'r') as inputFile: for line in inputFile: newFile += line newFile += "\n\n" with open('allFiles.txt', 'w') as outPutFile: outPutFile.write(newFile)
true
e97844af4901e83627aa2fdf1bd67be924a0cbc0
cblanks/market-data
/package/yahooFinance/returns.py
UTF-8
6,141
3.328125
3
[]
no_license
#!/usr/bin/python # Filename : returnsAnalysis.py # docstrings ---------------------------------------------------- """ The returns analysis classes of the Yahoo! Finance systematic trading package. These classes evaluate strategy returns and drawdowns with daily or monthly granularity. """ # dependencies from timeS...
true
8d447ec36f046aed19d56c1366e4f3d5399dbce0
pwildenhain/Complete-Python-3-Bootcamp
/13-Advanced Python Modules/counter.py
UTF-8
494
3.921875
4
[]
no_license
# counter = dictionary subclass, used to count hashable objects from collections import Counter l = [1, 1, 1, 2, 3, 4, 4, 5, 6, 5, 5, 5] # Values = distinct objects in 1 # Key = # of occurences Counter(l) # Works similarly with strings s = 'jslidjfisjfnjsdnvlursnun' Counter(s) # What about the words in a sentence? sen...
true
249193ee13365ad9924de8b4bfe4e2937b8e672f
lorenz-h/DataRepresentationLearning
/Old Experiments/Juli/Cifar10/Spawn_Nodes.py
UTF-8
1,235
2.90625
3
[]
no_license
import os import time import subprocess n_gpus = 4 system_gpus = 7 points = [[("batch_size", 256), ("n_epochs", 300)], [("batch_size", 128), ("n_epochs", 200)]] def spawn_network(point, gpu): cmd_list = ["python3", "CF10_CNN_V01.py"] for option in point: cmd_list.append("--" + str(option[0])) ...
true
570d9043e8cea4c2cc1344e44ec0c6e8c5e2a560
824zzy/Leetcode
/I_Searching/DFS/Tree/L0_314_Binary_Tree_Vertical_Order_Traversal.py
UTF-8
816
3.203125
3
[]
no_license
""" https://leetcode.com/problems/binary-tree-vertical-order-traversal/ lots of edge cases, carefully sort the tree by vertical order and depth! """ from header import * class Solution: def verticalOrder(self, root: Optional[TreeNode]) -> List[List[int]]: ans = defaultdict(list) def dfs(no...
true
b5c03a027d53cf3e42db8bed3697c6221ad72ddd
Labyrinth108/RecommenderSystemAssignment
/Assignment2/__init__.py
UTF-8
518
2.71875
3
[]
no_license
import csv from Problem import Problem reader=csv.reader(file("Assignment 2.csv","rb"))#xls format has problem problem=Problem() index=-1 for row in reader: problem.loadLine(index,row) index+=1 # print(problem.matrix) # print problem.user1 # print problem.user2 # print problem.attributes # #Part1 # problem.com...
true
07128ad2388bc5ae794592b936bc88b773f39771
threedworld-mit/tdw
/Python/tdw/replicant/actions/move_to.py
UTF-8
10,608
2.765625
3
[ "BSD-2-Clause" ]
permissive
from typing import List, Optional, Dict import numpy as np from tdw.tdw_utils import TDWUtils from tdw.type_aliases import TARGET from tdw.output_data import OutputData, Bounds from tdw.replicant.actions.action import Action from tdw.replicant.actions.turn_to import TurnTo from tdw.replicant.actions.move_by import Move...
true
2fda26cc85885a5d2b0685c6c56b463cf714baa5
anony-account/outlier-interpretation
/model_coin/COIN.py
UTF-8
10,260
2.671875
3
[ "Apache-2.0" ]
permissive
import os import copy import math import time import numpy as np from sklearn.neighbors import NearestNeighbors from sklearn.cluster import KMeans from sklearn import svm from model_coin.prediction_strength import optimalK from tqdm import tqdm class COIN(object): def __init__(self, data, inds_otlr, nbrs_ratio, ...
true
91e559db83160d36f63d413e459cca854bd5831e
gymgeek/buttons-ESP8266
/pygame_stopwatch.py
UTF-8
2,465
2.890625
3
[]
no_license
from threading import Thread import time, sys, glob, pygame screen = None myfont = None height = 0 width = 0 fontsize = 0 pygame.init() screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) pygame.display.toggle_fullscreen() width = screen.get_width() height = screen.get_height() fontsize = int((width / 8) * 2....
true
18e23c129d42685a452d4c6d10572b1195358394
fullera8/Algorithms
/Call Stack/SimpleCallStack.py
UTF-8
217
3.828125
4
[]
no_license
def greet(name): print(f"Hello {name}!") greet2(name) print(f"getting ready to say bye...") bye() def greet2(name): print(f"How are you {name}?") def bye(): print("Okay, bye!") greet("Alex")
true
ca2812ff7f887a2d9c2592f1c6f897d12bb1f603
dajima/purepythontest
/com/kute/file/simpletest.py
UTF-8
887
2.515625
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = 'kute' # __mtime__ = '16/8/17 20:42' """ """ import os _resources_dir = os.path.join(os.path.dirname(__file__), "resources") def getfilepath(filename): return os.path.join(_resources_dir, filename) # 读文件内容 def read_file(): filepath = getfile...
true
58fc2420521e20e06231cd6d99770c7230c8ee11
UntwistedApple/Algorithms
/Level/Line.py
UTF-8
730
3.5
4
[]
no_license
# -*- coding: UTF-8 -*- from numpy.ma import sqrt class Line(object): def __init__(self, start, end): self.start = start self.end = end self.length = sqrt((self.start[0]-self.end[0])**2 + (self.start[1]-self.end[1])**2) self.path = 0 try: self.m = (self.end[1]...
true
13d72e345a5a446a22324c296d3da11bee1a7a1a
mahavivo/deep-learning
/26-minimal-custom-rnn.py
UTF-8
12,026
2.796875
3
[]
no_license
# from https://github.com/ankurhanda/minimal-char-rnn import tensorflow as tf import numpy as np class Vocab(object): def __init__(self, text): self.text = text self.vocab_index_dict, self.index_vocab_dict, self.vocab_size\ = self.create_vocab(self.text) def create_vocab(self, t...
true
631dda71e1cc4e3c5e1705b9bd1a71e8aa551835
ebdekock/StaffSlackBot
/sql.py
UTF-8
2,523
2.90625
3
[ "Apache-2.0" ]
permissive
import sqlite3 from typing import Any, Iterable, List, Optional, Tuple # Local import settings as s # Sqlite3 does not currently support path objects database = str(s.DATABASE_LOCATION) def basic_sql_query(sql: str, data: Iterable) -> None: """ Basic SQL query that connects, commits and closes off the c...
true
f5010b546d7044c8fb2894eb129edbbcce4de755
HermiteBai/UIUC
/2017FA/CS412/HW/assignment_1/Question4.lbai5.py
UTF-8
539
2.75
3
[]
no_license
import numpy as np import numpy.linalg as la import sys import utils import scipy.stats as stat def chisquare(data): n = sum(data.flatten()) e = np.zeros(data.shape) for i in range(e.shape[0]): for j in range(e.shape[1]): e[i, j] = (sum(data[i,:].flatten()) * sum(data[:,j].flatten())) ...
true
edf0a835d61f77ba4009d65a457739235240a496
lgl90pro/colloquium2
/25.py
UTF-8
775
4.1875
4
[]
no_license
'''25. Знайти добуток елементів лінійного масиву цілих чисел, які кратні 5. Розмірність масиву - 10. Заповнення масиву здійснити випадковими числами від 10 до 100. Виконав: Лещенко В. О.''' import numpy as np A = np.random.randint(10, 100, 10) print(f'Вихідний масив: {A}.\n') prod = 1 for i in A: if ...
true
b5bdcd31c701ea7aaa5d0edd1f6782147175fc55
IshpreetKGulati/MLModels
/db_scan.py
UTF-8
2,186
3.1875
3
[]
no_license
from sklearn.datasets import make_blobs, make_moons,make_circles from matplotlib import pyplot as plt from pandas import DataFrame import numpy as np def plot_graph(X, y): df = DataFrame(dict(x=X[:, 0], x1=X[:, 1], label=y)) colors = {0: 'red', 1: 'blue', 2: 'green', 3: 'cyan', 4: 'pink'} fig, ax = plt.s...
true
9305dc9c99b3a81f345a4e6bac0f73dc0d1e5f90
srinjoyray/Competitive
/Contests/Codeforces/Educational92DIV2/B.py
UTF-8
555
2.9375
3
[]
no_license
import sys # For getting input from input.txt file sys.stdin = open('input.txt', 'r') # Printing the Output to output.txt file sys.stdout = open('output.txt', 'w') for _ in range(int(input())): n, k, z = map(int, input().split()) a = [int(x) for x in input().split()] ans = 0 s = 0 mx = 0 for t in range(...
true
1a96620269900f406dc5d39f76ce1957b081d121
dianekaplan/BIOT_E-100
/Assignment 5/align.py
UTF-8
2,646
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- #align.py #Introduction to Bioinformatics #Python Assignment 5, Problem 2 #Purpose: Compare a sequence to mouse mRNA: get 20mers and identify the one with the best score #Your Name: Diane Kaplan #Date: December 5, 2014 import Bio from Bio import Entrez from Bio import SeqIO from Bio import pair...
true
a4ed866718f7914e693065e1643c0e3d233059f8
rajesh95cs/cracking-the-coding-interview
/Arrays and Strings/Is_rotated/Is_rotated.py
UTF-8
780
3.765625
4
[]
no_license
#function to check whether the given string s2 is a rotated version of the #string s1 eg erbottlewat is a rotated version of waterbottle def is_rotate(s1,s2): #the string s1 and its rotated version should have the same length if not it is #s2 is certainly not a rotated version of s1 if len(s1) != len(s2) : ...
true
a15139e4a80641a41c99abe75f7eba64c25be02d
ndburger/Ruan-Python-User-Group
/Class Notes/IA/Completed IA/IA03/predictive_models.py
UTF-8
433
3.234375
3
[]
no_license
print("Not for human consumption") #Returns a function defines linear model identified my too parameters intercept(m), and slope(b) def lm(i, m): global y1 global y2 y1 = i y2 = m def lm1(x): global y y = i+m*x return (y) return (lm1) #Returns a function defied as a power transformation of the predictive v...
true
63adcb34e284cca41361d61b150b7aa535462595
spitfire4040/Packet-Injector
/s1.py
UTF-8
1,415
3.484375
3
[]
no_license
# imports import socket import sys import os import datetime # function: send tcp message to target def send(ip, port, mesg, outfile): # get timestamp ct = datetime.datetime.now() # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server...
true
c552f61a0f730cb4c9bd2c7b7cca820ebdaf9822
manangoel99/MiniSQLEngine
/main.py
UTF-8
7,706
2.859375
3
[]
no_license
import csv from Table import Table from Database import Database from moz_sql_parser import parse import json from itertools import product from collections import defaultdict, OrderedDict aggregate_functions = { 'max' : max, 'min' : min, 'sum' : sum, 'average' : lambda x : sum(x) / len(x), 'count'...
true
9c8ff6541f50bbede6f2ec546a11fb9caaa5e4a9
Coloboros/Uroboros2021
/source/sensers/out_data.py
UTF-8
2,232
2.9375
3
[]
no_license
import os import json from source.sensers.figure import Figure from source.settings import BASE_DIR class OutData: """ Класс хранящий в себе путь до изображения и сопутствующею ей метаданные """ def __init__(self, f_name: str): assert os.path.isfile(f_name) self.f_name = f_name ...
true
1d6bb61753697ed917ef02257e3ab94764ffcfd1
PenpenLi/abcabcabc.mg
/GameCR/Assets/StreamingAssets/genMD5.py
UTF-8
2,879
2.640625
3
[]
no_license
#!/usr/bin/python import os import sys import getopt import string import shutil from hashlib import md5 def Usage(): print "Usage: GenAssets.py [options]" print "\n" print "Options:" print "-h, --help show help info" print "-m, --md5 gen MD5 Assets list" def GenMD5ForString(str): ...
true
e38ef4588035e389085d5688c2f784220b894813
russelltsherman/python
/tests/challenges/hashmaps/test_sherlockAndAnagrams.py
UTF-8
485
2.828125
3
[]
no_license
from unittest import TestCase from challenges.hashmaps import sherlockAndAnagrams class TestChallengesHashmapsSherlockAndAnagrams(TestCase): def test_sherlockAndAnagrams1(self): needle = "abcd" result = sherlockAndAnagrams(needle) expect = 0 self.assertEqual(result, expect) d...
true
fd54bc55f2a07ae23c24b0b2e675a5a45b2c9e44
vicwuht/pl-hd
/turtleworld/pie1.py
UTF-8
1,055
3.1875
3
[]
no_license
from math import * <<<<<<< HEAD:turtleworld/pie.py from turtleworld import * from flower import move ======= from TurtleWorld import * from turtleworld.flower1 import move >>>>>>> origin/master:turtleworld/pie.py # fd(bob, 50) # lt(bob, 120.0) # fd(bob, 50) # lt(bob, 120.0) # fd(bob, 50) def draw_triangle(t, angle, r...
true
743150107ee93da756c73e7027197da86ec0414d
Ikhan24/Py4e
/Course 1 - Programming for Everybody (Getting Started)/random/Avgloop.py
UTF-8
199
3.5
4
[]
no_license
count = 0 sum = 0 print("Before", count , sum) for value in [9,41,12,3,74,15] : count = count + 1 sum = sum + value print(count,sum,value) print("After", count , sum , sum/count)
true
d552cc7a7b5eac00cf6290c2442a8c498d0a3c6d
KarrLab/datanator_rest_api
/datanator_rest_api/util/taxon_distance.py
UTF-8
2,908
2.65625
3
[ "MIT" ]
permissive
from datanator_query_python.config import query_manager from collections import deque class TaxonDist: def __init__(self, debugging=False): self.debugging = debugging def get_dist_object(self, doc, queried_species, distance_obj, target_species, org_format='tax_id', ...
true
51f3be9bf54f286090c0ede86f972ddb13163a2a
djaychela/100daysofpythoncode
/day13_15/rps.py
UTF-8
2,505
4.09375
4
[]
no_license
import random class Player(): def __init__(self, name): self.name = name self.roll = None self.score = 0 def generate_roll(self): roll_choices = ['rock', 'paper', 'scissors'] self.roll = random.choice(roll_choices) print(f'{self.name} rolls {self.roll.capitaliz...
true
e018906349e7c3ce01e4008ac958a0aef5e943b3
manojm64/5590Python-and-Deep-Learning-Programming
/ICP4/Source/ICP4_3.py
UTF-8
1,058
3.875
4
[]
no_license
""" 3 use the SVM with RBF kernel on the same dataset. How the result changed? """ import pandas as pd from sklearn.model_selection import train_test_split from sklearn.svm import SVC # Use the same dataset above iris = pd.read_csv('iris.csv') x = iris[['sepal length', 'sepal width', 'petal length', 'petal width']] y...
true