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
aea0baf9817489c292f1d44a027ed73d74e132bb
bibhore/CodingProblems
/Code/Problem5.py
UTF-8
895
3.03125
3
[]
no_license
import sys import json class Problem5: # solve the problem using map reduce @staticmethod def problem5(): if sys.argv.__len__() is 0: return else: if sys.argv.__len__() is not 3: print('Invalid arguments') return jsonfile = s...
true
592509280258a28f1e1ae113fceaf9dc19c567fa
maaario/persistent-store
/tests.py
UTF-8
9,853
2.53125
3
[]
no_license
import unittest import random import logging from time import sleep from datetime import datetime, timedelta from pyrsistent import m, v, freeze from db_functions import create_product, modify_product, delete_product, buy, create_summary from db_core import Database, FunctionsTestingDatabase, Product, Transaction, Su...
true
b506ce9d9a7cb65bc30de38a455378548e938db0
anthony-khong/anki_scrape
/japanese/download_katakana_csv.py
UTF-8
718
2.921875
3
[]
no_license
import pandas as pd from anki_scrape import scrape if __name__ == '__main__': url = 'https://en.wikipedia.org/wiki/List_of_gairaigo_and_wasei-eigo_terms' soup = scrape.get_soup(url) is_valid_row = lambda cells: len(cells) == 5 filtered_rows = scrape.filter_rows(soup, is_valid_row) flashcard = {'...
true
8150d26675bfecc65fb920b83979150ad35bbe66
Bukacha88/softuni_python_advanced
/exam/problem_two.py
UTF-8
1,519
3.71875
4
[]
no_license
from math import floor def find_santa(matrix_1): for i in range(len(matrix_1)): for j in range(len(matrix_1[i])): if matrix_1[i][j] == "P": row = i col = j return row, col def is_valid(r, c, matrix_1): if 0 <= r < len(matrix_1) and 0 <= c <...
true
70c18bf5c2df7ec19c2a8495624e3499f2e75b4f
bala8/OS-BenchMarking
/graph_gen.py
UTF-8
502
2.8125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np x = [1, 2, 3, 4, 5, 6, 6.2, 6.5, 7] y = [0.000001090712761, 0.000001095024412, 0.000001087331639, 0.000001077682041, 0.000001065563301, 0.000001114876344, 0.000001363838836, 0.000005959040155, 0.000009076444945] for i,yy in enumerate(y): y[i] = yy * 10**7 plt.p...
true
414a0521d5d14c3b1754e5b74fbf76fe5dc73981
alen-adiyev/issai_projects
/khabar.py
UTF-8
1,848
2.65625
3
[]
no_license
import requests from bs4 import BeautifulSoup import codecs import os import sys from pytube import YouTube from pytube import Playlist END = 3540 for i in range(3540, 3560, 20): url = 'https://khabar.kz/kk/news?start=' print('page',i) url = url + str(i) print(url) r1 = reques...
true
3be30475bb452a4dbd9c1102639d2e4936e7bba0
mixxuss/4_json
/pprint_json.py
UTF-8
627
2.984375
3
[]
no_license
import json, argparse def create_parser(): parser = argparse.ArgumentParser() parser.add_argument('filepath', nargs='?') return parser def load_data(filepath): parsed_json = json.loads(open(filepath).read(), encoding='utf-8') return parsed_json def pretty_print_json(data): form_json = json...
true
2f6643ac778502c8b1f9bcbcfd4798712dc74407
willle3456/CircuitBuilder
/FeedForwardNeuralNet/ffnn.py
UTF-8
6,436
3.140625
3
[]
no_license
import tensorflow as tf import numpy as np class FFNN(object): def __init__(self, layers, activation=tf.tanh, output_activation=tf.identity, post_function=tf.identity, input_vector=None, session=None): """ An implementation of a simple feed-forward neural network using the low-level tensorflow...
true
5bb82e3e50c614cb131254d1e1b72d07f562fc1e
shakeyapants/MyRuns
/test/test_myruns.py
UTF-8
2,090
2.8125
3
[]
no_license
import pytest # from MyRuns import * from MyRuns.config_operations import ConfigFile import tempfile import os from pathlib import Path class TestCore: def setup_class(self): self.workdir = tempfile.mkdtemp() def setup_method(self, method): print("method setup : ", method.__name__) def s...
true
3d59c8f73b559cf24161bf558e220c84cce52e84
aditepDev/data_science_101
/ThotthoiLogistic.py
UTF-8
2,398
2.78125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as plt np.random.seed(7) X = np.random.normal(0, 0.5, [40, 2]) X[:20] += 1.5 z = np.zeros(40) z[20:] += 1 plt.gca(aspect=1) plt.scatter(X[:, 0], X[:, 1], 100, c=z, edgecolor='k', alpha=0.6, cmap='coolwarm') plt.show() def...
true
aaff4affde68ea64efa4cf130fcfaa7546900a3b
Ttibsi/AutomateTheBoringStuff
/PracticeProjects/Ch18-ControlComputerViaEmail.py
UTF-8
5,602
2.921875
3
[]
no_license
# Chapter 18 - Control computer via emails ''' Write a program that checks an email account every 15 minutes for any instructions you email it and executes those instructions automatically. For example, BitTorrent is a peer-to-peer downloading system. Using free BitTorrent software such as qBittorrent, you can downlo...
true
1b921486e069d09870b2a88def55e55be65cb47c
keqi-jj/selfteaching-python-camp
/exercises/1901090043/d13/gret.py
UTF-8
120
3.3125
3
[]
no_license
# coding:utf-8 def say_hi(name): print('Hello ' + name) def self_introd(self_name): print("i am " + self_name)
true
875cb28e2ff850d7b3ba25b6fba1dfa4a3edcb85
dfioravanti/copula_vae
/models/VAE.py
UTF-8
5,890
2.890625
3
[ "MIT" ]
permissive
import numpy as np import torch from torch import nn from models.BaseVAE import BaseVAE from utils.distributions import log_density_bernoulli, log_density_normal, log_density_standard_normal class VAE(BaseVAE): def __init__(self, dimension_latent_space, input_shape, ...
true
5a2909e84c81bca442c68310d305a6e543a86702
gzsolt11/MeresekKeylog
/preprocess.py
UTF-8
5,986
2.609375
3
[]
no_license
# Call python file as # python preprocess.py dataset processed_data import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import pathlib import re import numpy as np from sklearn import metrics import os import shutil import hashlib import argparse KEYS = ["0","1","2","3","4","5","6...
true
3d13056657a3951e8de1d2529b9126e48d7c7e70
Aasthaengg/IBMdataset
/Python_codes/p03993/s192753117.py
UTF-8
292
2.875
3
[]
no_license
import sys rs = lambda: sys.stdin.readline().rstrip() ri = lambda: int(rs()) rs_ = lambda: [_ for _ in rs().split()] ri_ = lambda: [int(_) for _ in rs().split()] N = ri() a = [int(_) - 1 for _ in rs().split()] ans = 0 for i in range(N): if a[a[i]] == i: ans += 1 print(ans // 2)
true
e294e1a72aba23e223aeed2cd3754fe43e556532
kgleijm/djangoNoos
/djangoNoos/Backend/webAdapter.py
UTF-8
6,132
2.671875
3
[]
no_license
import json from threading import * from socket import * import copy from djangoNoos.Backend import dataManager zoneSeperationMatrix = [ [], [0], [0,4], [0,3,5], [0,2,4,6] ] def getZone(x, calibrationDict): zoneSeperationList = zoneSeperationMatrix[len(calibrationDict)] if x == 0: ...
true
b7d0133d70b2854cf6c9ef9da1d6ab7e0a913bf0
atulkumar-mittal/cp
/codeforces/ladder1/16_puzzle.py
UTF-8
342
2.640625
3
[]
no_license
nm = input().split(' ') m = int(nm[1]) n = int(nm[0]) sizes = input().split(' ') pz = [] for s in sizes: pz.append(int(s)) pz = sorted(pz) #print(pz) res = pz[n-1] - pz[0] i = 1 while i < len(pz)-n+1: #print('index {} and index{} , diff {}'. format(i, n+i-1, pz[n+i-1]-pz[i])) res = min(pz[n+i-1]-pz[i], res)...
true
7ced46063b5a59770ab6d0f7735e8aca6a20ad3b
kookoowaa/Repository
/SNU/Python/BigData_Programming/170623/t3(for).py
UTF-8
72
3.078125
3
[]
no_license
test = [1,2,3,4,5] for index, v in enumerate(test): print(index,v)
true
0f14c0d678173d6793bdc4b9c3754b550a6c8fe1
Fabio101/Sanic_Auth-API
/lib/database.py
UTF-8
2,008
2.609375
3
[]
no_license
# # Imports # import os import yaml import pymysql.cursors from lib import logger from sanic.exceptions import ServerError ################################################## # # # Description: Main Database class used for all # # DB Interaction ...
true
3225445e88a692773924a29901b28706374acf16
05sjha/facial-expression-detector
/facial_expp_train.py
UTF-8
5,191
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jul 4 15:21:39 2020 @author: DELL """ from __future__ import print_function import tensorflow.keras from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense,Dropou...
true
7407f5e78df27f06d281acabe363b077bbd5be31
srinivasgadi77/JCMate
/parrel_execute.py
UTF-8
4,774
2.5625
3
[]
no_license
#!/root/python27 from threading import Thread import shlex from subprocess import Popen, PIPE import os, sys import time import logging import argparse import platform import socket success_execution=[] failure_execution=[] not_reachable=[] #chekcing whether the host is live def check_host_alive(hosts,timeout=5): ...
true
0cf969cdd055ca9c25a9a20aac267645fd900ef5
keyko-io/xain-fl
/python/sdk/xain_sdk/participant.py
UTF-8
8,791
2.515625
3
[ "Apache-2.0" ]
permissive
from abc import ABC, abstractmethod from copy import deepcopy import enum import logging import sys import threading from typing import Any, Optional, Tuple, TypeVar from requests.exceptions import ConnectionError from .http import ( AggregatorClient, AnonymousCoordinatorClient, CoordinatorClient, Sta...
true
445b9ae7bb7a7df160a6419ac543d2b54ed03448
jacquarPL/Python-learn
/letnia_szkola_13072020.py
UTF-8
3,987
4.09375
4
[]
no_license
# # Operatory i ich kolejnosc: # 1. + - (unary - jedno-argumentowe) # 2. ** # 3. * / // % # 4. + - (binary - dwu-argumentowe) # Python keywords: # ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', # 'finally', 'for', 'from', 'global', 'if', ...
true
6ce12f5334b257f198552c9cdc82f420d6eaf121
ankitpriyarup/online-judge
/codeforces/1028/b.py
UTF-8
303
3.09375
3
[]
no_license
n, m = map(int, input().split()) a = [9] b = [1] asum = 9 bsum = 1 while min(asum, bsum) < n: asum += 9 bsum += 9 a.append(0) a.append(9) b.append(9) b.append(0) if b[-1] == 0: b.pop() print(''.join(str(x) for x in reversed(a))) print(''.join(str(x) for x in reversed(b)))
true
66f924b0fac250bfdd2981f733e794e3e4b25c1f
gowthamrang/Keywordtagger
/eval.py
UTF-8
482
3.078125
3
[]
no_license
#Evaluation metric def arrange(x): y=[]; for each in x: y.append(set(each)); return y; def precision_recall(gold,pred): n=0.0,d1=0.0,d2=0.0; for x,y in zip(gold,pred): n+=len(x.intersection(y)) d1+= len(y); d2+=len(x) return n//d1,n//d2; def Fscore(gold,predicted): assert(len(gold) ==len(pred)); pri...
true
27aba2175e3a51780455f9664e5a54ce88d96c8a
Phaust94/energy-bot
/energy_bot.py
UTF-8
3,530
2.625
3
[]
no_license
from telegram import Update from telegram.ext import Updater, CommandHandler, CallbackContext, MessageHandler, Filters import os os.chdir(os.path.join(*os.path.split(__file__)[:-1])) from db_api import ElectricityDB from version import __version__ with open("api_key.txt", 'r') as f: API_KEY = f.readline().strip(...
true
d954bcb011dcad67ba2ef00eb571906b6ca142fb
TheusZer0/ctf-archives
/Hero/2021/steg/RansomWTF/scramble.py
UTF-8
848
3.15625
3
[ "MIT" ]
permissive
import numpy as np import cv2 import sys """ EGGMAN'S RANSOMWARE. I LIKE EGGS, ESPECIALLY SCRAMBLED ONES. LET'S SEE HOW YOU LIKE YOUR SCRAMBLED PICTURES ! """ def scramble(image): # 420 EGGS ! np.random.seed(420) # Image dimensions : 1280x720 to_hide = cv2.imread(image) to_hide_a...
true
5aae3951c49300554e6366ad19b4450b856b06f8
HaiboNi/Linux_env
/time_date.py
UTF-8
765
2.6875
3
[]
no_license
### # time date plugin used in sublime text to record time of change, # add key binding by : # adding: { "keys": ["f5"], "command": "insert_datetime"} # to user defined key bindings. # #### import sublime, sublime_plugin, time class InsertDatetimeCommand(sublime_plugin.TextCommand): def run(self, edit): ...
true
e25fb06b342f6bc25c93888c8eba4da4f2419ea6
9masha/MenuApp
/app.py
UTF-8
2,635
3.28125
3
[]
no_license
from db import * from restaurant import * food = load('food') order = { "items": [], "total": { "amount": 0.00, "currency": "MDL" }, "client": { "client_name": ' ', "address": '', "phone number": ' ' }, "delivery" : { ...
true
47bbe5ce8e1745f66ac9eb0042de775565f2b9df
ATDAWN908/AIssistant
/ZORA.py
UTF-8
2,138
2.796875
3
[]
no_license
import pyttsx3 as pt import datetime as dt import speech_recognition as sr import wikipedia as wp import webbrowser as wb import os import random engine=pt.init('sapi5') voices=engine.getProperty('voices') print(voices[1].id) engine.setProperty('voices',voices[1].id) def speak(audio): engine.say(audio) ...
true
7faa4a61e6cd918e7127dc39f270b037305d13fb
BereniceAlexiaJocteur/Euler
/pb14.py
UTF-8
1,200
3.578125
4
[]
no_license
# ------------------------------------------------------------------------------- # Name: # Purpose: # Created: # ------------------------------------------------------------------------------- import time import sys class Problem(): def __init__(self, n): self.lim = n + 1 self...
true
4f5449e1dad4da44131af0cbb0283a420985121d
momoenomoto/ChatRobotsForKids
/cam/utils/objcenter.py
UTF-8
1,246
2.890625
3
[ "MIT" ]
permissive
import imutils import cv2 class ObjCenter: def __init__(self, haarPath): # load OpenCV's Haar cascade face detector self.facedetector = cv2.CascadeClassifier(haarPath) #self.eyedetector = cv2.CascadeClassifier(eyehaarPath) def update(self, frame, frameCenter): # convert the frame to grayscale gray = cv2.cv...
true
d380cd97f0267fe8c9a96601c8e3f883da1c6d4d
lxdv/hse-rl
/rl_2/value_iteration_template.py
UTF-8
6,963
2.890625
3
[]
no_license
from mdp import MDP import matplotlib.pyplot as plt import numpy as np def check_generate_session_func(mdp, get_action_value_func): test_Vs = {s: i for i, s in enumerate(sorted(mdp.get_all_states()))} assert np.allclose(get_action_value_func(mdp, test_Vs, 's2', 'a1', 0.9), 0.69) assert np.allclose(get_act...
true
e14e79790a5ff980b719cb08064d9a219c75ef9f
JacksonWang99/Spark
/Project/submission2.py
UTF-8
1,353
3.25
3
[]
no_license
# Build the function to calculate counter #The function of this function is: dataHashCode, queryHashCode, which is the #initial value of the offset data 0,1,2,3 to continuously relax the conditions # q 1 1 1 1 1 1 1 1 1 1 # o1 1 0 2 -1 1 2 4 -3 0 -1 #Check whether the corresponding positions of the two ...
true
d5edd05e080a7d6183832fb92d3dd05b13319d34
lyh20093867/venus-python
/gomeo2o_dev/src/gomeo2o_pro/venus_script/check_dubbo_version/tarutils.py
UTF-8
2,676
2.609375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import urllib import os import urllib2 import tarfile import zipfile import shutil import re import config class TarUtil: def __init__(self): self.tmp_dir = config.configs['tmp_dir'] self.nginx_path = config.configs['nginx_url'] def get_project(self,...
true
843e7af4044c797859fa3c614b404494b37e43f3
Aasthaengg/IBMdataset
/Python_codes/p03786/s420085853.py
UTF-8
220
3.078125
3
[]
no_license
n = int(input()) a = list(map(int, input().split())) a.sort() cum_a = [a[0]] for i in range(1, n): cum_a.append(cum_a[i-1]+a[i]) res = 0 for i in range(1, n): if cum_a[i-1]*2 < a[i]: res = i print(n-res)
true
8bef1ee0bf15278c16fd07f4826dc45504e05d95
HopeCheung/leetcode
/leetcode-first_time/leetcode211(Trie, defaultdict).py
UTF-8
1,489
4
4
[]
no_license
from collections import defaultdict class TrieNode(object): def __init__(self): self.children = defaultdict(TrieNode) self.is_leaf = False class WordDictionary(object): def __init__(self): """ Initialize your data structure here. """ self.root = TrieNode() ...
true
a6e9994e705253a15a82e5e08b58faa0fbcedf09
VolatileDream/advent-of-code
/2019/day-16/main.py
UTF-8
1,967
2.875
3
[]
no_license
#!/usr/bin/env python3 import argparse import collections import itertools import math import sys def take(c, iterable): out = [] for x in iterable: out.append(x) if len(out) == c: return out return out def skip(c, iterable): iterable = iter(iterable) for x in iterable: if c > 0: c ...
true
7ec4e376b221e46a96cd817db7518cdd82d4acc7
ljdursi/dask-sparse-mtx
/dask_sparse_mtx/dask_array_mult.py
UTF-8
1,850
3.3125
3
[ "MIT" ]
permissive
"""Multiply two sparse matrices in the database by constructing a dask array from the tiles Pros: Makes better use of the scheduler, esp for large numbers of tiles Don't have to think about de-tiling final result Cons: Less control of tiling in intermediate and final stages .. moduleauthor:: Jonatha...
true
5e89e66661db5bc626d5379b2f3d28e5175041d5
sswest/leetcode
/227_basic_calculator_ii/basic_calculator_ii.py
UTF-8
783
3.09375
3
[]
no_license
class Solution: def calculate(self, s): stack = [] sign = '+' num = 0 for i, c in enumerate(s): if c.isdigit(): num = 10 * num + int(c) if i == len(s) - 1 or c in '+-*/': if sign == '+': stack.append(num) ...
true
d0037bf09783d1bbf691fe66caf265ef48496558
popov95s/HumanCable
/HumanCable.py
UTF-8
5,797
2.703125
3
[]
no_license
import serial import Analysis.ringbuffer as ringbuffer import numpy as np import time import threading import matplotlib #matplotlib.use('TKAgg') # need to use this on OSX for animate w/ blit=True from matplotlib import pyplot as plt from matplotlib import animation from matplotlib.lines import Line2D import Analysis....
true
d9ee225321fc54f53f9e6ade8306e6bf1608f55f
wuemily2/goozebot
/user_dm.py
UTF-8
4,627
2.765625
3
[]
no_license
from __future__ import unicode_literals, annotations import discord from discord.ext.commands import Bot import random import asyncio def load_dm_capabilities(bot: Bot) -> str: help_string = "The Messenger Goose: \n" ''' command = ("timed_message", "Send a timed message with 'gooze " + "tim...
true
03d55329562f069de8f7a8dbd01195732535f784
yangdikun/gpgLabs
/gpgLabs/GPR/Attenuation.py
UTF-8
3,399
2.703125
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt from scipy.constants import mu_0, epsilon_0 from ipywidgets import interact, interactive, IntSlider, widget, FloatText, FloatSlider ############################## # FUNCTIONS ############################## def WaveVelSkind(frequency, epsr, sigma): ome...
true
f01743ddd787687127b68335a3af3ef6b9454b98
anobhama/Intern-Pie-Infocomm-Pvt-Lmt
/open CV/RGBImgDisplay.py
UTF-8
237
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 28 01:44:38 2020 @author: Anobhama """ #displaying image in rgb colour format import cv2 img = cv2.imread('cat.jpg',-1) cv2.imshow("Image",img) cv2.waitKey(0) cv2.destroyAllWindows()
true
08a70a845264b70049c2d4d93016318c4c0ccee7
picaindahouse/Code-Wars-Projects
/Just Practice- 40 to 99/Side Project 83 (4 Kyu) (Connect 4)/Side Project 83.py
UTF-8
1,425
2.734375
3
[]
no_license
from numpy import diagonal def who_is_winner (tom): tim = [[x for x in str(0)*7] for x in range(6)] for x in tom: count, tum, master = 5, [], [] loc = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6}[x[0]] while tim[count][loc] != '0': count -= 1 tim[count][loc] = x[2:] ...
true
fd73f9097c0f87e94aad09e70a390af6d0136bc0
ChandniThumar/CurrencyConverter
/CurencyCoverter.py
UTF-8
469
3.59375
4
[]
no_license
with open("Currency.txt") as f: lines = f.readlines() currencyDict = {} for line in lines: parsed = line.split("\t") currencyDict[parsed[0]] = parsed[1] print(currencyDict) amount = int(input("Enter amount:\n")) print("Enter the name of currency you want to convert ?") [print(item)for item in currencyDic...
true
eb683bedc9861d8c2bc694066d688e35a3cc9927
liuluyang/miller
/August/directory-8-3/空.py
UTF-8
440
3.3125
3
[]
no_license
# name = None # age = None # weight = None # height = None # # print(name, age, weight, height) # # li = [] # li1 = [1, 2] # li2 = [1, 2] # # # print(id(li1)) # # print(id(li2)) # # print(li1 is not li2) # li = list('abskjdkasd') # print(li) # print(chr(97)) # print(chr(98)) # print(chr(99)) # print(chr(100)) # pr...
true
5bbad6f3902fa5117f64c59ced1c247d24457622
ionicTK/5143-OpSys-Madyara
/Assignments/cmd_pkg/history.py
UTF-8
198
2.59375
3
[]
no_license
#!/usr/bin/env python def history(args): file = open("/tempHistory/.history", 'r') counter = 0 for line in file: print(str(counter) + " " + line) counter += 1
true
59b510225ce4237e4f4a2f901d61d00d43a4c05b
ExpanseLLC/identityexchange
/identityexchange/provider.py
UTF-8
5,193
2.53125
3
[]
no_license
import logging import os from pathlib import Path import httplib2 from oauth2client.client import flow_from_clientsecrets from oauth2client.file import Storage from oauth2client.tools import run_flow from identityexchange.config import Config logger = logging.getLogger(__name__) class Google: def __init__(self...
true
09a8472c356fad3f0e1e956cd9997f030f6314e5
zhenggang587/code
/leetcode/maxProfit.py
UTF-8
481
3.53125
4
[]
no_license
class Solution: # @param prices, a list of integer # @return an integer def maxProfit(self, prices): min_price = (1 << 31) - 1 max_profit = 0 for price in prices: if price < min_price: min_price = price if price - min_price > max_profit: ...
true
ec143f77a8e586955c436caa347b9ae37ff95f09
prodigyoff/algoLab3
/model/graph.py
UTF-8
539
3.765625
4
[]
no_license
from model.node import Node class Graph: def __init__(self, number_of_vertexes, edges): self.adjacency_list = [[] for _ in range(number_of_vertexes)] for edge in edges: node = Node(edge.destination, edge.weight) self.adjacency_list[edge.starting_point].append(node) def...
true
e84c095be043cbb7b6978d5c4b7b9e63096b734e
pynadath/psychsim
/psychsim/probability.py
UTF-8
11,201
3.46875
3
[ "MIT" ]
permissive
import math from xml.dom.minidom import Document,Node class Distribution(dict): """ A probability distribution over hashable objects .. warning:: If you make the domain values mutable types, try not to change their values while they are inside the distribution. If you must change a domain value, it i...
true
25f92d216a64cbacec80956cd6bc993edeb46e13
MDaalder/MIT6.00.1x_Intro_CompSci
/W02_Simple_Programs/Recursion on non numberics - Palindrome.py
UTF-8
1,047
4.4375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Feb 12 22:49:25 2019 @author: Matt """ def isPalindrome(s): def toChars(s): #converts strings to characters, removes all punctuation, spaces and uppercase s = s.lower() ans = '' for c in s: # iteration of string if c in 'abcdefghi...
true
daea3ff04e6c81bdeb3e6c6eb57dd9dbd42eb118
Gr3atJes/pythonweek2
/test/test_article.py
UTF-8
538
3.171875
3
[]
no_license
import unittest from app.models import Article class TestArticle(unittest.TestCase): """ Test class to test the behaviour of the movie class """ self.new_article = Article("Bob","Random Title", "Short","random.com","random.jpg","12/12/12","None") def test_instance(self): """ Tests if ins...
true
84da899937bd0a9a0ba26417f46fda4a185dd520
courtney-rosenthal/python-examples
/dogyears.py
UTF-8
123
3.9375
4
[ "Unlicense" ]
permissive
people_age = input("How old are you? ") dog_age = int(people_age) / 7 print("Your age in dog years is:", round(dog_age, 1))
true
351524fdb3b25504722da8ab7e644b01a7df6eb3
ohahohah/basketball-chatbot
/practice/chatbot/chatbotmodel.py
UTF-8
1,317
2.609375
3
[ "MIT" ]
permissive
import telegram from telegram.ext import Updater, CommandHandler import json with open('../../config.json', 'r') as f: config = json.load(f) # config.json 이라는 파일의 내용을 가져온다. class TelegramBot: def __init__(self, name, token): self.core = telegram.Bot(token) self.updater = Updater(token, use_c...
true
e5852dd7e1cc60b7e768f1b083462caf5d6dd102
andrecouto/Projeto-jogo-dados
/jogo_de_dados.py
UTF-8
1,219
3.921875
4
[]
no_license
from random import * def deseja_jogar(): jogar = input("Deseja jogar o jogo? (digite sim, caso queira jogar/ nao, caso não queira jogar)") while jogar != 'sim' and jogar != 'nao': jogar = input("Deseja jogar o jogo? (digite sim, caso queira jogar/ nao, caso não queira jogar)") return jogar def al...
true
36ae931e31cb7b8bc2a45df202ef42e9017fa42b
4hiziri/nlp-100
/5.py
UTF-8
900
3.125
3
[]
no_license
import re nlp = '' with open('resource/nlp.txt', 'r') as f: nlp = f.read() # 50 def split_sentence(string): sentence_list = [] pile = 0 for pos in re.finditer(r'(\.|;|:|\?|!) [A-Z]', string): pos = pos.span() start = pos[0] end = pos[1] tmp = string[pile:start] ...
true
ed96f0c300ba9e3f2c6985db0c63e463764efe76
AshayAswale/CoupledOscillators-fireflies
/ex1.py
UTF-8
1,442
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import random fig = plt.figure() first = True T = 100 size = 10 counters = np.random.rand(size,size) counters *= T k=0.5 def neighborFlashed(x,y): east = counters[max(x-1,0),y] >= T west = counters[min(x+1,size-1),y]...
true
70ca7b6fbee317fd8f2c8332316b499925dc1fe9
ferocemarcello/bookinganalyzer
/wordwriter.py
UTF-8
5,799
2.546875
3
[]
no_license
import csv import nltk from nltk.tokenize import word_tokenize class wordwriter: @classmethod def write(cls,originfile): keywords = [] f = open("booking_keywords.txt", "r") for line in f: keywords.append(line[:-1]) # important to have last line with \n f.close() ...
true
c7bf2d867fe31acf7c8649225583cfda0b49fa04
jaroldwong/pyp-w1-gw-extensible-calculator
/calculator/operations.py
UTF-8
508
2.828125
3
[ "MIT" ]
permissive
from __future__ import division def add(*args): return sum(args) def subtract(*args): result = args[0] for n in args[1:]: result -= n return result def multiply(*args): result = 1 for n in args: result *= n return result def divide(*args): result = args[0] ...
true
50c629eb00dcf847b874080882cab78d4aaadc62
greg-hellings/s3manage
/src/s3manage/index.py
UTF-8
8,234
2.96875
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
# -*- coding: UTF-8 -*- from __future__ import print_function from __future__ import unicode_literals import posixpath as webpath from builtins import str import humanfriendly import six from munch import munchify HTML_BASE = """<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <style type=...
true
c61779c32a1a120320be12b6dc004a01616c6af5
quangloan17/hocThayTung
/1.T6/12-06-vong-lap4/bai_tap_ve_nha.py
UTF-8
617
2.8125
3
[]
no_license
sales = [ {'qty': 2, 'time': '2019-01-01 08:45'}, {'qty': 3, 'time': '2019-01-01 09:33'}, {'qty': 4, 'time': '2019-01-01 16:35'}, {'qty': 5, 'time': '2019-01-02 10:40'}, {'qty': 1, 'time': '2019-01-02 13:55'}, {'qty': 2, 'time': '2019-01-02 17:20'}, {'qty': 5, 'time': '2019-01-02 09:42'}, {'qty': 3, 'time': '20...
true
d9ee0a2423f1a68f6b610a865e5a883fa2aa501c
DaniyarML/Algorithms_and_Data_Structures
/DynamicProgramming/1_sum_of_n.py
UTF-8
260
3.90625
4
[]
no_license
# Find the sum of the first n numbers # What is the sum of 1 to n: n = 5: 1+2+3+4+5=15 def sum_of_n(n: int) -> int: dp = [0]*(n+1) dp[1] = 1 for i in range(2, n+1): dp[i] = dp[i-1]+i return dp[-1] n = int(input()) print(sum_of_n(n))
true
2df031f4f288817a751ec7d2c8c09b8efcdd1baa
StevenCostiou/reflectivipy
/reflectivipy/wrappers/cflow_flatwrapper.py
UTF-8
2,023
2.75
3
[ "MIT" ]
permissive
from .flatwrapper import FlatWrapper class CFlowConditionExtractor(object): def __init__(self): self.flattened_condition = [] self.preambles = [] self.body_supplements = [] def visit_node(self, rf_node): visit_method = "visit_" + rf_node.__class__.__name__ getattr(self...
true
e3adea36f6a60bdc7e15e405b8a2e15f12827d4b
TimRock23/Algorithms
/typical_tasks_from_interview/L.py
UTF-8
568
3.515625
4
[]
no_license
def l(first_str, second_str): letter_dict = {} for letter in first_str: if letter not in letter_dict: letter_dict[letter] = 1 else: letter_dict[letter] += 1 for letter in second_str: if letter not in letter_dict: letter_dict[letter] = 1 el...
true
4150c659bf3c1b6d12317b3e0871e9a9b3bf8172
meshack-mbuvi/ride-my-way-api
/tests/testUserProfile.py
UTF-8
1,604
2.625
3
[ "MIT" ]
permissive
import json import unittest from baseUserAccountSetUp import BaseUserAccount class UserProfileTests(BaseUserAccount): def setUp(self): """Prepare testing environment.""" super().setUp() userData = { "firstname":"mbuvi", "secondname":"kamila", "email": ...
true
f61aa5a0fab28c5ff83d7c7de0846299175da4d3
Daniel-M/german-traffic-signs-detector
/lenet_model.py
UTF-8
10,881
2.921875
3
[]
no_license
import os import cv2 import imageio import numpy as np from sklearn.utils import shuffle import tensorflow as tf from tensorflow.contrib.layers import flatten # Set parameters learning_rate = 0.0035 training_iteration = 100 batch_size = 121 display_step = 10 test_size = 0.2 input_image_shape = (32,32) def annota...
true
ee6b7ec8608711b655adbe9b82dc760f2d40fe4b
vimmoos/NN
/project/expander/expander.py
UTF-8
3,804
2.609375
3
[]
no_license
import copy import pickle import signal import project.esn.core as c import project.esn.matrix as m import project.esn.transformer as t from project.esn.utils import * from itertools import product,tee @mydataclass(init=True, repr=True, check=True) class Expander(): """Class that performs a cartesian product o...
true
6308b9884e6546fcbf63ad794206a59cc6cbd3da
dbravender/websocket_tictactoe
/server.py
UTF-8
5,145
2.71875
3
[]
no_license
import sys, os sys.path.append('tornado') import tornado.websocket import tornado.httpserver import tornado.ioloop import tornado.template import traceback from itertools import cycle loader = tornado.template.Loader(os.path.join(os.path.join(os.path.realpath(__file__) + '/../'), 'templates')) class Game(object): ...
true
c64bdebe27c3db76b311d74bc80d04a35e8a13ee
jy247/IRDM_SLAY
/crawl-pr/PreProcess.py
UTF-8
1,227
3.1875
3
[]
no_license
from collections import defaultdict import re import nltk class PreProcess(): regex = re.compile('[^a-zA-Z ]') stop_words = defaultdict() # stemmer = nltk.PorterStemmer() # tokenizer = nltk.LineTokenizer() with open("./stop_words.txt") as f: all_lines = f.read().splitlines() for l...
true
0bd46e99f80116524a0f8b2e4875247b3c6734c4
MichelleZ/leetcode
/algorithms/python/dailyTemperatures/dailyTemperatures.py
UTF-8
501
3.0625
3
[]
no_license
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Source: https://leetcode.com/problems/daily-temperatures/ # Author: Miao Zhang # Date: 2021-03-05 class Solution: def dailyTemperatures(self, T: List[int]) -> List[int]: n = len(T) stack = [] res = [0 for _ in range(n)] for i in r...
true
97896ff98deb1fb849f5ae291032fdb7b0d87686
pranaymate/PythonExercises
/ex052.py
UTF-8
435
4.1875
4
[]
no_license
number = int(input('Type a number: ')) count = 0 if number % 2 == 0: print('Number {} is not a prime number! Because it is even.'.format(number)) count += 1 else: for c in range(3, (number-1)): if number % c == 0: print('NO,this number {} is not a prime number, it is divisible by {}'.for...
true
1460741a0d16d809bebc61fef79701f136030c34
alexachu/python
/pythoncycle1/P10.py
UTF-8
371
4.0625
4
[]
no_license
#Program to find largest among three numbers a=int(input("Enter the first number:")) b=int(input("Enter the second numer:")) c=int(input("Enter the third number:")) if a>b: if a>c: print("The largest is:", a) else: print("The largest is:", c) elif b>c: print("The largest is:", b) ...
true
05968e05b2622f3aa519dcc45c1c4fba3f10e5a3
johnlee888888/Pycent
/Python_network/create_datetime_files/创建带有时间戳的文件.py
UTF-8
485
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on 2019/6/16 20:50 File name 创建带有时间戳的文件.py @author: john lee """ import datetime import os fiveday = (datetime.datetime.now() + datetime.timedelta(days=5)) five_date = (fiveday.strftime("%Y-%m-%d")) five_time = (fiveday.strftime("%H-%M-%S")) print(five_date) print(five_time) fil...
true
aa698b86762ec08b38ad0842ee2875272254c691
FeedTheMind/exercise_playground
/python/rna_transcription/rna_transcription.py
UTF-8
583
3.625
4
[]
no_license
def to_rna(DNA): '''Converts a DNA strand to its RNA complement Args: DNA = string Returns: RNA complement ''' trans = {'G': 'C', 'C': 'G', 'T': 'A', 'A': 'U'} # Comment out this block of code if you want question # marks (?) to substitute incorrect characters ...
true
24b6bb306cfe2cfc572ef9c72b7f0a9dbfd89f70
Dragoncell/jmx_rosproject
/src/consoleNode.py
UTF-8
375
2.921875
3
[]
no_license
#!/usr/bin/env python import rospy from std_msgs.msg import String ### node init rospy.init_node('ConsoleNode') ### publich to a topic pub = rospy.Publisher('/demo/command', String ,queue_size=10) rate = rospy.Rate(2) while not rospy.is_shutdown(): ### get command from screen string = raw_input("input comm...
true
e51ffe99006b5a4e01ddd0336c63786bb7c63de2
daniel-reich/ubiquitous-fiesta
/qLMZ2hEvrhRSSSnQw_24.py
UTF-8
125
2.5625
3
[]
no_license
def make_grlex(lst): def custom_key(string): return len(string), string.lower() return sorted(lst, key=custom_key)
true
0d0ac8a419b3c0fc4d508170f1ca95d7de9c3f9e
SLClayton/WarpDetective
/tweet_scheduler.py
UTF-8
2,902
2.6875
3
[]
no_license
import json import random import traceback from pprint import pprint as pp from tools import * from variables import * import twitter from twitter.twitter_utils import enf_type from twitter.error import TwitterError def getTwitterApi(login): # If a string is passed, then its filename, get the JSON it refers to....
true
cafbf8502e8064942dd5e153a8a130d7b756e7a7
tonyechen/python-codes
/tuple/main.py
UTF-8
258
3.90625
4
[]
no_license
# tuple = collection which is ordered and unchangeable used to group together related data student = ("Bro", 21, "male") print(student.count("Bro")) print(student.index("male")) for x in student: print(x) if "Bro" in student: print("Bro is here")
true
339e17b4bbd122d27e4edaf534411fbf54f6e375
yadavpooja/My-projects
/students_data.py
UTF-8
853
3.515625
4
[]
no_license
class Student(): def __init__(self,name,mother_name,father_name,dob,roll_no,fees,status=False): self.name = name self.mother_name = mother_name self.father_name = father_name self.dob = dob self.roll_no = roll_no self.fees = fees self.status = status def ...
true
da562da75896ab544067ef2ed89c12650cf48274
Reece323/coding_solutions
/coding_solutions/BinaryTreeInvert.py
UTF-8
555
3.625
4
[]
no_license
""" Given a binary tree, write a function that inverts the tree. """ # # Binary trees are already defined with this interface: # class Tree(object): # def __init__(self, x): # self.value = x # self.left = None # self.right = None def csBinaryTreeInvert(root): if root is None: return ro...
true
8767a2acf7790761f163b27d417898ed9c7fa2f2
gylu/khan_coding_challenge
/webserver/app/views.py
UTF-8
13,535
2.59375
3
[]
no_license
import os import sys import pdb import time import json import sqlite3 from flask import Flask, render_template, request, redirect, url_for, Response, jsonify, g from app import app import random import string import pdb import math DATABASE = '../ka_challenge.db' #assuming we are running from khan_coding_challenge/we...
true
11bdd4770705b8713c201327377207fd915ca9fd
kaust-cs249-2020/fernando-zhapa
/chapter3/_351_deBruijnFromPatterns.py
UTF-8
848
3.15625
3
[]
no_license
import sys sys.path.append("..") from lib import printGraphAdjList def deBruijn(patterns): # Input: A collection of k-mers Patterns. # Output: The adjacency list of the de Bruijn graph DeBruijn(Patterns). adjacencyList = {} for pattern in patterns: preffix = pattern[:-1] suffix = patte...
true
c58c00d181a8ee2d39151a16098b16cd9c184783
supermakc/Domain-Pan
/main/management/commands/importstatic.py
UTF-8
2,794
2.75
3
[ "Apache-2.0" ]
permissive
""" Imports static data into the database. This command will not overwrite values that already exist. Relies on the presence of the following files in the root repository directory: - tld_list.txt (top-level domains) - exclusion_domains.txt (domains to exclude) - clean_admin.txt (initial admin settings) ...
true
1a975d7b91970d1dc59b7dd4f2584b8b9ad3f387
xiaoxue11/machine_learning
/ex6/preEmail.py
UTF-8
1,353
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jan 10 23:58:45 2019 @author: 29132 """ from getVocList import getVocabList import re from nltk.stem.porter import PorterStemmer def processEmail(email_contents): vocablist = getVocabList() word_indices = [] email_contents=email_contents.lower() e...
true
16ef868461c0d26d7b9387eb6226ab362a7aa958
ngocdang1999/project_euler
/LT/bai-2.2.py
UTF-8
134
3.140625
3
[]
no_license
x=int(input("nhap:")) def facttdang(x): if x == 0: return 1 else: return x * facttdang(x - 1) print (facttdang(x))
true
189613ad97077ecacb18ce9564d874c7c4645431
LeloGualda/metodos_numericos
/python/Component/Simpson.py
UTF-8
373
3.953125
4
[]
no_license
def simpson(f,x0,x1,n): area = -f(x0) h = (x1-x0)/n for i in range(0,n+1): if(i%2): area += 4 * f(x0 + (h*i)) else: area += 2 * f(x0 + (h*i)) area = (area-f(x1))*h/3 return area def myfunction(x): return (x*x) - x 'f(x)= x²-x ∫ 2 a 3 | n = 4' ' resul...
true
ac139fb2cdef6bedf595dfca4def7a052b514fa4
NicolasAudepin/Interactive_Art_v1
/Experience/Modules/Video_Loop_module.py
UTF-8
1,714
3.015625
3
[]
no_license
import threading import random import sys import time from .Base_module import Threaded_Module import numpy as np import cv2 class Video_Loop_Mod (Threaded_Module): """A module that reads a video and gives to the experience easy ways to overlay it. The loop can be stopped at its end with the looping value. ...
true
f86a4a76ada416b2465b84bc5a0c18736b5fce7b
gregtampa/cgc-release-documentation
/scripts/cqe_verify_solution_package.py
UTF-8
9,871
2.65625
3
[]
no_license
#!/usr/bin/env python import subprocess import sys import argparse import re import os import json import tempfile import hashlib import shutil CSID_PATTERN = r"[0-9a-f]{8}" HASH_PATTERN = r"[0-9a-f]{64}" RB_NAME_PATTERN = r"RB_" + CSID_PATTERN + r"_[0-9a-f]{2}" POV_NAME_PATTERN = r"POV_" + CSID_PATTERN + r".xml" te...
true
267f488583b5f03fdd100d3678c6c2edc26b1e19
Fondamenti18/fondamenti-di-programmazione
/students/1757012/homework04/program02.py
UTF-8
10,033
3.84375
4
[]
no_license
''' Il tris e' un popolarissimo gioco. Si gioca su una griglia quadrata di 3×3 caselle. A turno, i due giocatori scelgono una cella vuota e vi disegnano il proprio simbolo (un giocatore ha come simbolo una "o" e l'avversario una 'x'). Vince il giocatore che riesce a disporre tre dei propri simboli in linea retta ori...
true
797de8703bde3acfb636762064538ddbdae320c6
onionzhou/Note
/decorator-example/decorator-example3.py
UTF-8
1,506
3.78125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: zhouey @file: decorator-example1.py @time: 2022/3/29 10:14 """ class Decorator: def __init__(self, arg1, arg2): print('执行类Decorator的__init__()方法') self.arg1 = arg1 self.arg2 = arg2 def __call__(self, f): print('执行类Dec...
true
508c55e64a8d931b12a82b77807f8db87d731004
angel-robinson/carrion.chancafe.trabajo7
/para05.py
UTF-8
289
3.640625
4
[]
no_license
#la suma de los numeros que hay entre x e y import os #input nota1=int(os.sys.argv[1]) nota2=int(os.sys.argv[2]) promedio=(nota1+nota2)/2 i=promedio suma=0 while(i<=promedio): suma+=i i+=1 #fin_while print("el promedio que hay entre la nota1 y la nota2 es:",suma)
true
095c41fe1fd607f2fcdd8824bbe9de4909f06752
PROGAVANZA24/EQUIPO_9
/E9TEMA.py
UTF-8
863
3.4375
3
[]
no_license
class TEMA: def __init__(self, id_tema, nombre): self.id_tema=id_tema self.nombre=nombre def guardar (id_tema, nombre): archivo = open ("TEMA.txt", "w", enconding="63da2cf") id_tema=input(int("Escribe el id del tema que deasea guardar: /n")) nombre=input("Escribe el ...
true
f84357adffa552c3f27bac37e0a308d69eaf2649
marvuo/reservartionbeta
/lab/lab01.py
UTF-8
407
3.21875
3
[]
no_license
months = 12 arpu = float(raw_input("ARPU?: ")) saledays = int(raw_input("Sales Days per month? ")) totalmrc = [] revenuetotal = 0 while months > 0: months -= 1 revenuetotal += saledays * arpu totalmrc.append(revenuetotal) print revenuetotal for id_num, mrc in enumerate(totalmrc): revenuetotal += mrc...
true
9f53fc22e9c9dacfbae8a21a336d8dfd43da1796
hchauvet/pyCalliper
/LibPyCalliper/PlotGSWindows.py
UTF-8
3,229
2.75
3
[]
no_license
# -*- coding: utf-8 -*- #/usr/bin/python """ Created on Thu Aug 30 18:05:34 2012 @author: chauvet wx interface for display de grain size distribution plot Part of pyCalliper project """ import wx from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import \ FigureCanvasWxAgg as FigCanvas...
true
47d55cfa2e97fe399f0d55ca0cfafc6a184f10e3
andrewtatham/LightyPi
/misc/train_check.py
UTF-8
675
2.828125
3
[]
no_license
import json import pprint import requests url = "http://andrewtathamtraincheck.azurewebsites.net/api/traincheck/ismytreainontime" # url = "http://localhost:53322/api/TrainCheck/IsMyTrainOnTime" class TrainResult(object): def __init__(self, response): self._response = json.loads(response.text) se...
true
51c6833f1bd58e01f90b0caf80a718ff4ed4c0c7
vxed/aioesl
/aioesl/helpers.py
UTF-8
4,292
2.5625
3
[]
no_license
from lxml import etree from .log import aioesl_log import json def print_event(event, filter=None, print_func=None): if event is None or event == {}: return if print_func is None: outer = print else: outer = print_func for k in sorted(event.keys()): if filter is None:...
true
5153afe4e17450e313233063762941b6569e1792
HediaTnani/rosalind.info
/bioinformatics_stronghold/splc.py
UTF-8
649
2.546875
3
[]
no_license
#!/usr/bin/env python from Bio.Seq import Seq from Bio import SeqIO from Bio.Alphabet import IUPAC def translate_dna(dna): """ Return protein sequence using given DNA sequence and NCBI table code """ return translate(dna, stop_symbol="") def splc(fasta_file): l = [x.seq for x in SeqIO.parse(ope...
true
acc8f46c2b8b8675907217d86ae748e1b63e7a99
Mguysin/PythonProjects
/Week 4/json_basic/json_basic.py
UTF-8
202
2.828125
3
[]
no_license
import json car = {'engine': 'electric', 'brand': 'Tesla'} s_car = json.dumps(car) print(s_car) print(type(s_car)) with open('new_json_car_file', 'w') as jsonfile: json.dump(car, jsonfile)
true