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 |
|---|---|---|---|---|---|---|---|---|---|---|
06fce83560ba56b5fbefb4f165e4f5c14133ec19 | Taylor-Paxman/Solo-Challenges | /snake_game/snake/game/food.py | UTF-8 | 1,049 | 3.609375 | 4 | [] | no_license | import random
from game import constants
from game.actor import Actor
from game.point import Point
# TODO: Define the Food class here
class Food(Actor):
"""The responsibility of Food is to keep track of its appearance and position. Food can move around randomly if asked to do so.
Stereotype:
Servic... | true |
6263c7ddcfbb91dd5b16291433662d8e509b602f | nim65s/tsid | /tests/python/generator.py | UTF-8 | 7,956 | 2.71875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | from math import pi
import hppfcl as fcl
import numpy as np
import pinocchio as pin
def create_7dof_arm(revoluteOnly=False):
"""
Create a 7 DoF robot arm (with spherical joint for shoulder and wrist and revolute joint for elbow)
Optionnal parameters:
revoluteOnly (default=False): if True, the ar... | true |
9f9aa7bf68d19188262b57efcc10e6727113e044 | GreatStephen/MyLeetcodeSolutions | /Number of Dice Rolls With Target Sum/Number of Dice Rolls With Target Sum.py | UTF-8 | 532 | 2.953125 | 3 | [] | no_license | class Solution:
def numRollsToTarget(self, d: int, f: int, target: int) -> int:
# 正常的二维dp,i是骰子数量,j是有多少种组合的sum=j
dp = [1]*f+[0]*max(0, target-f)
# print(dp)
for i in range(1,d):
tempdp = [0]*len(dp)
for j in range(i, len(dp)):
for k in range(1,f... | true |
9cc314f5c586bc69651e230df1c89f673331aa60 | keyiflerolsun/GithubAccountChecker | /_base.py | UTF-8 | 1,754 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def github(posta, sifre) -> None:
host = "github.com"
origin = "https://github.com"
referer = "https://github.com/login"
headers = {
"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Sa... | true |
f2f1725b806fd4bcfcc5b85a1ea97d38a49c316d | alexgolec/career-advice | /code/leetcode/medium/5-longest-palindromic-substring/naive.py | UTF-8 | 1,227 | 4.28125 | 4 | [
"MIT"
] | permissive | def find_palindrome(s, left, right):
'''
Scan out from the left and right positions and return the longest palindrome
that results. Returns the empty string on no palindrome.
'''
while True:
# Characters don't match
if s[left] != s[right]:
return s[left + 1:right]
... | true |
a7e786394b7e6fb08c2211e75352845123d33888 | ssebs/py-chat | /client.py | UTF-8 | 758 | 2.921875 | 3 | [
"MIT"
] | permissive | import sys
import socket
# Check args, if nothing is set, use defaults
if(len(sys.argv) == 3):
TCP_IP = sys.argv[1]
TCP_PORT = int(sys.argv[2])
elif(len(sys.argv) == 2):
if ":" in sys.argv[1]:
print(sys.argv[1])
# slice up and set vars
spl = sys.argv[1].split(":")
TCP_IP = s... | true |
e49a835fad1935360acbf608404f8f9bb42654cc | 15Galan/asignatura-303 | /Tema 3 - Esquemas, Protocolos y Mecanismos de Soporte/Prácticas/Práctica 2/Entrega/funciones_aes.py | UTF-8 | 2,348 | 3.515625 | 4 | [] | no_license | from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES
def crear_AESKey():
"""Devuelve un número aleatorio de 16 bytes - 128 bits"""
return get_random_bytes(16)
def iniciarAES_GCM(key_16):
"""Inicia el engine de cifrado AES CTR"""
nonce_16 = get_random_bytes(16)
aes... | true |
a00e22b95ac544a5d2700761e7017b5093dc9943 | lwgray/reddit_bot | /app.py | UTF-8 | 604 | 2.515625 | 3 | [] | no_license | import os
from flask import Flask, request, render_template
from flask_bootstrap import Bootstrap
# Create flask application
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
# Setup Bootstrap
Bootstrap(app)
@app.route('/')
@app.route('/index', methods=['GET', 'POST'])
def index():
''' V... | true |
d03c6f58fe2672114e22daf770a2fde77bd10827 | tomoyanp/oanda_dev | /lib/common.py | UTF-8 | 6,870 | 2.75 | 3 | [] | no_license | # coding: utf-8
import json
import time
from datetime import datetime, timedelta
import pandas as pd
import numpy as np
import logging
def instrument_init(instrument, base_path, config_name):
config_path = "%s/config" % base_path
config_file = open("%s/instruments.config_%s" % (config_path, config_name), "r")
... | true |
000ab957c1e5681c7d018ee9b596725c4314cf97 | Outturist/Outturist-Selenium-Practice | /pages/base_page.py | UTF-8 | 235 | 2.9375 | 3 | [] | no_license | class BasePage:
def __init__(self, browser, timeout=20):
self.browser = browser
self.browser.implicitly_wait(timeout)
self.browser.maximize_window()
def open(self, link):
self.browser.get(link)
| true |
7d10f4bbbb6dde89f3505b01e4023008c93f64bf | ThiagoBorzaquel/softs-skills | /geradorsenha.py | UTF-8 | 272 | 3.515625 | 4 | [] | no_license | import random
lower = 'abcdefghijklmnopqrstuvwxyz'
upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
number = '0123456789'
symbols = '{}[]()*;/,._-'
all = lower + upper + number + symbols
lenght = 16
password = ''.join(random.sample(all, lenght))
print(f'Sua senha é {password}')
| true |
e86d54e33fdfafbd3dea6a874bb3ab33806a0e93 | tensho9408/TextKey_GenWordCloud | /text_generate.py | UTF-8 | 6,569 | 2.984375 | 3 | [] | no_license | import numpy as np
import jieba
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("ggplot")
import streamlit as st
from matplotlib.font_manager import FontProperties
from collections import Counter
from streamlit import uploaded_file_manager
from PIL import Image
from wordcloud import WordCloud
#... | true |
98292fa95ae6a1e285701f7bf09dd1d6448bf197 | barshag/LeetCodeChallenges | /30DaysAprilCHallenge/Max_wines.py | UTF-8 | 284 | 3.15625 | 3 | [] | no_license |
L= [2,4,6,2,5]
def max_wine(period,left,right):
if left==right:
return period*L[left]
return max(period*L[left]+max_wine(period+1,left+1,right), period*L[right]+ max_wine(period+1,left,right-1))
print( max_wine(1,0,len(L)-1))
#Todo:f change it to a DP instead of recursion | true |
cedad019ae57361980fc768c34c29e0f8cb629ae | tartaponei/URI | /iniciante/1160crescimento.py | UTF-8 | 530 | 3.765625 | 4 | [] | no_license | t = int(input(""))
for i in range(t):
s = input("").split()
pa = int(s[0])
pb = int(s[1])
g1 = float(s[2])
g2 = float(s[3])
contador = 1
while(pb >= pa):
a = pa * (g1/100)
pa = pa + int(a)
b = pb * (g2/100)
pb = pb + int(b)
if(pa <= pb):
... | true |
c7b34279502cd4f52264f9ee850853e5c9e4270e | ayk-dev/python-fundamentals | /lists-basics/hungry_hippos.py | UTF-8 | 134 | 3.25 | 3 | [] | no_license | n = int(input())
board = []
for i in range(n):
row = list(map(int, input().split()))
board.append(row)
print(board) | true |
c2f44eb883d8fea07ef680680e9001169e8992c1 | stefanuddenberg/Sound-Switch | /code/old/sound_switch.py | UTF-8 | 4,284 | 2.578125 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# ## Imports
# In[7]:
from pydub import AudioSegment
from pydub.generators import Sine # XXX Can learn to generate the sine wave natively
from pydub.playback import play
import copy
import random
import numpy as np
import os
# ## Cutting out sound
# In[45]:
switch_probabilities = np.linspace(0... | true |
3fc80259cae7a1507080f9f1d9c3d101fbdc8070 | thoaif/mv-bank-receipt-ocr | /src/ocr/preprocessing/polygon_manipulate.py | UTF-8 | 1,201 | 3.15625 | 3 | [
"MIT"
] | permissive | from typing import Union
import cv2
import numpy as np
def is_line(w: int, h: int, max_height, multiplier=0.01) -> bool:
"""
checks whether the dimensions match that of a line
"""
return w > h * multiplier and h < max_height
def is_approx_rect(contour: np.ndarray, confidence: int = 0.95) -> bool:
... | true |
73575d1aa79a9d74e0f96ff1987af6b9a0c96ac3 | Bertram-Liu/Note | /NOTE/15_Data_analysis/day07/demo03_svd.py | UTF-8 | 203 | 2.65625 | 3 | [] | no_license | """
demo03_svd.py 奇异值分解
"""
import numpy as np
M = np.mat('1 5 9; 6 8 1')
U, sv, V = np.linalg.svd(M, full_matrices=False)
print(U)
print(sv)
print(V)
sv[1:] = 0
print(U * np.diag(sv) * V)
| true |
15771f13fb61a4ca9bbb9a7a107cc8a10fab62a6 | Zer0xFF/DCU_Discord_Bot | /cogs/pastpapers.py | UTF-8 | 1,602 | 2.9375 | 3 | [
"MIT"
] | permissive | import discord
import aiohttp
from discord.ext import commands
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i : i + n]
class PastPapers(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.session = aiohttp.ClientSes... | true |
a36f81cca0b6764417ddcb63da81bfc967c038af | CuriousKomodo/DSML_fall_detection | /tool/Data_augumentation_all.py | UTF-8 | 5,328 | 2.65625 | 3 | [] | no_license | import numpy as np
import math
import sys
sys.path.insert(0, '/Users/kefei/Documents/mm_fall_detection/tool/')
from functions import *
#clean the dataset.
def trim_dataset(data,label,threshold=10):
used = np.sign(np.max(abs(data),axis=-1))
length = np.sum(used, axis=1)
data = data[length>=threshold,:,:]
... | true |
4f98d390fc0f4085f2143ffa9b2992652f3c572a | platereader/gathode | /platereader/parser/tecan.py | UTF-8 | 7,479 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# NOTE the coding is needed because we have to strip the ugly °C from the input
"""
This module implements a parser for files exported by the TECAN platereader, used by GATHODE.
Growth Analysis Tool for High-throughput Optical Density Experiments
(GATHODE) TECAN platereader format parser.
"""
... | true |
67b66a8c7852898b0fb117e5f10ff1c0aa911d4f | lyqtiffany/learngit | /caiNiao/wuShiLiuShi/wuShiLiuCirclePaint.py | UTF-8 | 422 | 3.515625 | 4 | [] | no_license | #56 画图,学用circle画圆形。
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from tkinter import Canvas
if __name__ == '__main__':
import tkinter
canvas = Canvas(width=800, height=600, bg='yellow')
canvas.pack()
k = 1
j = 1
for i in range(0, 26):
canvas.create_oval(310 - k, 250 - k, 310 + k, 250 + k, ... | true |
3756498ba0b8bc2728f90a9662078a7f816a7773 | Linus-H/Vertical-Integration | /debug_tools/error_tracking_tools.py | UTF-8 | 2,825 | 3.296875 | 3 | [] | no_license | import numpy as np
class TimeIterator:
def __init__(self, t0, dt):
self.dt = dt
self.t0 = t0
def __iter__(self):
self.n = 0
return self
def __next__(self):
self.n += 1
return self.t0 + self.n * self.dt
def get_time(self):
return self.t0 + self... | true |
e9907961955b1be151fdff494446ffcab8ed4e30 | Hridai/TensorFlow-Intro | /tf intro.py | UTF-8 | 3,009 | 3.40625 | 3 | [] | no_license | ''' TensorFlow programs are typically split into two parts:
1) The construction phase (builds a computation graph representing ML model, computations
required to train it)
2) The execution phase - runs a loop which evaluates a training step repeatedly (i.e. one
step per mini-batch) gradually improvi... | true |
ac2dba19177054f513b42ea6a9c0e46156cf50d1 | maltelau/SocKult-AuditoryConfidence | /confidence_audio/models.py | UTF-8 | 3,973 | 2.796875 | 3 | [] | no_license | from random import sample
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer
)
doc = """
A two player auditory discriminatory task
and chat about which was right when they didn't get it right
Audio version.
intensity:
no zero?
analysis:
slope at pse? <- wh... | true |
df32634048bb0c947d9562f5b067658862176184 | pyt3r/template-package | /template/infra/init.py | UTF-8 | 2,785 | 2.6875 | 3 | [
"MIT"
] | permissive | from io import open
import os
import yaml
import re
def get_version(dunder_file):
from pkg_resources import get_distribution, DistributionNotFound
here = os.path.dirname(dunder_file)
package = os.path.basename(here)
try:
version = get_distribution(package).version
except DistributionNotFo... | true |
66b4e2d9cf8b316b10dbb4d4f8b04ff5aa581837 | edponce/papas | /papas/graphs/graph.py | UTF-8 | 1,553 | 3.140625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import networkx as nx
import json
from networkx.readwrite import json_graph
import re
# Tree operations
# https://networkx.github.io/documentation/stable/_modules/networkx/algorithms/tree/operations.html
gstr = '''
A::Requires = ""
B::Requires = A
C::Requires = B
D::Requires = C
H::Requires ... | true |
c630928dea32ba48f745b944dc5c30bd2a4f85c9 | Aasthaengg/IBMdataset | /Python_codes/p02854/s417888790.py | UTF-8 | 203 | 2.625 | 3 | [] | no_license | N=int(input())
A=list(map(int,input().split()))
ans=20202020200
sum_A=0
sum_B=sum(A)
for i in range(N):
sum_A+=A[i]
sum_B-=A[i]
tmp=abs(sum_A-sum_B)
if tmp<ans:
ans=tmp
print(ans) | true |
e8a331fa1da5d3a68fdc70a2346ee5117e580119 | StonERMax/adversarial_relighting | /classifiers/FaceNet/Facenet.py | UTF-8 | 6,255 | 2.84375 | 3 | [
"MIT"
] | permissive | from facenet_pytorch import MTCNN, InceptionResnetV1
import numpy as np
from torch.utils.data import DataLoader
from torchvision import datasets
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
import torch
class FaceNet:
"""
Instantiate InceptionResnet and simple classifie... | true |
680a50decaf8ca33e5aff11843485ce1763da29f | MrRoboots/-excel- | /test2.py | UTF-8 | 5,575 | 2.640625 | 3 | [] | no_license | # coding=utf-8
import openpyxl
import os
class data(object) :
yearweek = 0
cd = 0
storyname = 0
Last_year_sales_tax_withdrawal_amount = 0
Sales_tax_withdrawal_amount = 0
Execution_of_the_estimated_amount = 0
Last_year_budget_amount = 0
zone = ''
area = ''
total_budget = 0
la... | true |
dcf880e892a91a95db6845ab81df80a93cd9937f | jamsidedown/adventofcode2019 | /day_07/test_part_02.py | UTF-8 | 761 | 3.0625 | 3 | [] | no_license | import unittest
from part_02 import run_thrusters
class Part01Tests(unittest.TestCase):
def test_first_example(self):
program = '3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5'.split(',')
phase_settings = [9, 8, 7, 6, 5]
result = run_thrusters(progra... | true |
25a23fd5ecad4d5046b3258fd8a9bf5193dbf318 | hrenod/stacker | /stacker/exceptions.py | UTF-8 | 3,723 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | class InvalidLookupCombination(Exception):
def __init__(self, lookup, lookups, value, *args, **kwargs):
message = (
"Lookup: \"{}\" has non-string return value, must be only lookup "
"present (not {}) in \"{}\""
).format(lookup.raw, len(lookups), value)
super(Invalid... | true |
6fb66c5f6a6aa2f6a461e596ccb63e7539908524 | karolinanikolova/SoftUni-Software-Engineering | /3-Python-Advanced (May 2021)/05-Functions/02_Exercises/04-Negative-vs-Positive.py | UTF-8 | 1,063 | 4.71875 | 5 | [
"MIT"
] | permissive | # 4. Negative vs Positive
# You will receive a sequence of numbers (integers), separated by a single space. Separate the negative numbers from the positive.
# Find the total sum of the negatives and positives, replace the negative number with its absolute value and print the following:
# • On the first line print the s... | true |
76100ae5ca8411f7060f3d7979f17dd16c0063fa | shairamore/Hailstone-Sequence | /Hailstone-Sequence.py | UTF-8 | 628 | 4.46875 | 4 | [] | no_license | """
User inputs a number and the computer shows
the hailstone sequence of that number.
"""
def main():
steps = 0
user_number = int(input("Enter a number: "))
while user_number != 1:
if user_number % 2 == 0:
print(str(user_number), "is even, so I take half:", str(user_number // 2))
... | true |
dfb632aeec60065f20dc0bf35125bc3c6998e757 | OktaAlliance/SCIM-Connectors | /flask/SCIM/classes/generic/ListResponse.py | UTF-8 | 1,084 | 2.515625 | 3 | [] | no_license | from typing import List, Union
from SCIM.classes.generic.SCIMUser import SCIMUser
from SCIM.classes.generic.SCIMGroup import SCIMGroup
class ListResponse:
def __init__(self, list: Union[List[SCIMUser], List[dict], List[SCIMGroup]], start_index:int=1, count:int=None, total_results:int=0):
self.list = list
... | true |
e99effa219a5e13bb78647ef97bb451c6e1b788c | sheelabhadra/LeetCode-Python | /986_Interval_List_Intersections.py | UTF-8 | 1,162 | 3.859375 | 4 | [] | no_license | """PROBLEM:
Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order.
Return the intersection of these two interval lists.
(Formally, a closed interval [a, b] (with a <= b) denotes the set of real numbers x with a <= x <= b.
The intersection of two closed intervals is a s... | true |
6d4c803115d02e5fc8e7ffa8e32ef840958e96b4 | itsallvoodoo/csci-school | /CSCI220/Week 12 - APR02-06/selection.py | UTF-8 | 870 | 4.5 | 4 | [
"Apache-2.0"
] | permissive | # selection.py
# This is an selection sort example
# <Chad Hobbs>
def selection_sort(list2):
for i in range(0, len (list2)): # Step through entire list
min = i # Minimum value equals outside range
for j in range(i + 1, len(list2)): ... | true |
c92f5f332c2cf9271c998f8d2d3f9be971690329 | miracle2k/android2po | /android2po/config.py | UTF-8 | 6,304 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | from os import path
import argparse
__all__ = ('Config',)
def percentage(string):
errstr = "must be a float between 0 and 1, not %r" % string
try:
value = float(string)
except ValueError:
raise argparse.ArgumentTypeError(errstr)
if value < 0 or value > 1:
raise argparse.Argum... | true |
d6a08084efd663ccc8acf95dc1f0a7b35cb45d44 | DomesanSampath/codechallenges | /Str_Int_Mul.py | UTF-8 | 133 | 3.875 | 4 | [] | no_license | #String_to_Int Multiplication
x=int(input("Enter 1st Number"))
y=int(input("Enter 2nd Number"))
print('The Multiplication %r'%(x*y))
| true |
3503436fc0e28cb2700e64af729b91292739944b | Krejnerw/WizDanych | /L3_cw/zad10.py | UTF-8 | 142 | 2.546875 | 3 | [] | no_license | def zlicz(**produkty):
suma=0
for x in produkty:
suma+=produkty[x]
return suma
print(zlicz(marchew=4,cos=2,inne=6))
| true |
6eb90ae716afe3357086228ac36d17887916f45f | gfYaya/yayaPython | /tutorial/brief tour of standard library/mathematics.py | UTF-8 | 538 | 3.90625 | 4 | [] | no_license | # coding=utf-8
import math
print(math.pi)
print(math.cos(math.pi / 4))
print(math.log(1024, 2)) # 对数
import random
print(random.choice(['apple', 'pear', 'banana']))
print(random.sample(range(100), 10)) # sampling without replacement
print(random.random()) # random float
print(random.randrange(6)) # random integ... | true |
ea5a7b8a055ffecded89e00896ca9febbfdaab43 | jinningli/dancinglines | /popurity.py | UTF-8 | 7,748 | 2.59375 | 3 | [] | no_license | # ===================================================== #
# Calculate, normalize and format EPTS of the time span #
# ===================================================== #
import path
import json
import os
import re
import math
def pop_accu():
with open(path.event_dir + 'popularity_' + path.data_... | true |
c7db51880c2b96cfc703ed5a5f490e5df2c29249 | Aasthaengg/IBMdataset | /Python_codes/p03796/s742819579.py | UTF-8 | 322 | 3.140625 | 3 | [] | no_license |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N = read_int()
answer = 1
modulo = 10**9+7
for i in range(1, N+1):
answer = (answer*i)%modulo
return answer
if __name__ == '__main__':
print(solve()... | true |
fe612cc409761a2b6aa5ffb21c4d740405a35f0a | degamus/dota2-predictor | /visualizing/hero_combinations.py | UTF-8 | 2,439 | 2.578125 | 3 | [
"MIT"
] | permissive | """ Module responsible with plotting of hero synergies and counters """
import numpy as np
import plotly.graph_objs as go
import plotly.plotly as py
from tools.metadata import get_hero_dict
def plot_synergies():
synergies = np.loadtxt('pretrained/synergies_all.csv')
for i in range(114):
synergies[i... | true |
483497dfeee14833d4484384ed60d4477efacf72 | srimani-programmer/Python-Specialization | /Course_03/Regular Expressions/Assignment02.py | UTF-8 | 314 | 3.34375 | 3 | [] | no_license | import re
file_handle = open('Sampledata.txt')
number_list = list()
for data in file_handle:
data = data.strip()
temp = re.findall('[0-9]+',data)
for i in temp:
number_list.append(i)
sum_value = 0
for i in number_list:
sum_value += int(i)
# Printing the Final Result
print(sum_value)
| true |
33f15c21b813157771243dde5161d7dc88841452 | paras1810/Hackeam-18 | /Application.py | UTF-8 | 2,902 | 3.25 | 3 | [] | no_license | import speech_recognition as sr
def func():
r = sr.Recognizer()
with sr.Microphone() as source:
print("what to print?")
audio = r.listen(source)
try:
# for testing purposes, we're just using the default API key
# to use another API key, use `r.recognize_google(audio... | true |
b0d6ca5b6c5913cf8342ac84f0aba3c243b16854 | sook-sinsa/web | /modules/crawlWeather.py | UTF-8 | 495 | 3.140625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
def crawlWeather():
html = requests.get('https://search.naver.com/search.naver?query=날씨')
soup = BeautifulSoup(html.text, 'html.parser')
container = soup.find('div', {'class': 'weather_box'})
address = container.find('span', {'class':'btn_select'}).text
... | true |
01c7cbe1159054be24f63dffa747e48c6c662dcd | kingsdigitallab/dprr-django | /promrep/scripts/import_priester_data.py | UTF-8 | 14,238 | 2.578125 | 3 | [
"MIT"
] | permissive | import unicodecsv as csv
from promrep.models import (DateInformation, DateType, NoteType, Office,
Person, PersonNote, PostAssertion, Praenomen,
SecondarySource, Sex)
def clean_field(field, a_string):
"""cleans uncertain chars from a string, outputs a diction... | true |
d825fd6ab3cc908eb69a24ea09270413fa06ad3c | gakkistyle/comp9021 | /Lecture_8_Material/L2/Quadratic_equations/quadratic_equation_v4.py | UTF-8 | 4,555 | 4.21875 | 4 | [] | no_license | # COMP9021 Term 3 2019
'''
Represents a quadratic equation as a class with a, b, c, root_1 and
root_2 as data. By default, a is set to 1 and b and c are set to 0.
The parameters can be changed with the update() function.
Whether the parameters are changed when the equation is created or by a
call to the update() fu... | true |
a4ad44202ff0c5c5580a958535c3c876f3554286 | guisesterheim/devops | /python/slack_integration2.py | UTF-8 | 1,475 | 2.515625 | 3 | [] | no_license | #python3
import requests
import json
import logging
import traceback
from contextlib import closing
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)
SLACK_DEBUG_URL = "https://hooks.slack.com/services/xxx/yyy/zzz"
SLACK_DEBUG_CHANNEL = "aprox_messages"
SLACK_AUTHOR = "AproxSniffer"
app_name ... | true |
9e55f6e6b7bdceca1facd25a35ddb0562651dd61 | homg93/PS | /workbook Edition pt.1/2293.py | UTF-8 | 421 | 2.53125 | 3 | [] | no_license | import sys
def coin(n,k):
a =[]
dp = [0 for i in range(n)]
cnt = 0
for _ in range(n):
a.append(int(sys.stdin.readline()))
for i in range(n):
if k % a[i] == 0:
cnt +=1
# for j in range(i+1,n):
# k - a[i]
# (lambda x: x%a[j] == 0,a)
tsum = a[i]
j = i+1
while(tsum <= k):
if tsum ==k:
cnt ... | true |
1b53f2256b800f22e1a84953cbd1227a48b67021 | AbhiSingam/Markov-Decision-Processes | /submission_part2/find_diff.py | UTF-8 | 1,600 | 2.625 | 3 | [] | no_license | import numpy as np
import json
import pickle
from part_2 import positionMap
import pandas as pd
dict = {
"state":[],
"policy1":[],
"policy2":[],
"policy3":[],
"policy4": [],
}
file1 = "a.pkl"
file2 = "a1.pkl"
file3 = "a2.pkl"
file4 = "a3.pkl"
pos = [-1] * 5
for idx, i in enumerate(positionMap):
... | true |
4208d12a1fbf1f1ee04267a77dd4a7b6e1eb2f64 | Hankfirst/AA203_Optimal_and_Learning_Based_Control | /HW02/problem1_q_learning_starter.py | UTF-8 | 4,325 | 2.8125 | 3 | [] | no_license | from problem1_q_learning_env import *
import numpy as np
import matplotlib.pyplot as plt
import copy
import pandas as pd
sim = simulator()
T = 5*365 # simulation duration
gamma = 0.95 # discount factor
epsilon = 0.1
alpha = 0.2
# get historical data
data = generate_historical_data(sim)
# historical dataset:
# shape ... | true |
fd42d6bc681e48963907ba3b5c0eb65092d4f632 | Azazel5/Personal-Website | /blog/serializers.py | UTF-8 | 975 | 2.53125 | 3 | [] | no_license | from rest_framework import serializers
from .models import BlogModel, Categories
class CategorySerializer(serializers.ModelSerializer):
category_id = serializers.IntegerField(source='id', read_only=True)
class Meta:
model = Categories
fields = ['category_id', 'category_name']
class BlogSeria... | true |
07729135c033d44658857bd629b2fe0b33c2629e | Maissacrement/blockchain | /B1/main.py | UTF-8 | 438 | 2.640625 | 3 | [] | no_license | from Obj.Blockchain import *
from Obj.Block import *
def main():
# Init my Blockchain
yanaCoin=Blockchain()
# Create a block
newBlock = Block(1, datetime.datetime.now().isoformat(), 100)
yanaCoin.addBlock(newBlock)
print(yanaCoin.chain[0].__dict__)
print(yanaCoin.chain[1].__dict__)
f... | true |
87147e2450d5485da6b746e439c552c2a6dfc5b9 | darkfour/gate | /tornado_conn.py | UTF-8 | 2,875 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import time
from traceback import format_exc
import msgpack
from tornado.iostream import StreamClosedError
from tornado import gen
import util
class Conn(util.LogObject):
"""连接"""
# 包边界字符串
MAGIC = b"\r\rBi&g0\n\n"
def __init__(self, address... | true |
9da8beda7abb7d9d818f1f2f0789ae845833664c | Arman-Deghoyan/aim | /examples/tf_profiler_test.py | UTF-8 | 1,701 | 2.59375 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
from examples.tf_profiler_model import neural_net
tf.reset_default_graph()
learning_rate = 0.1
num_steps = 500
batch_size = 128
display_step = 100
# Network Parameters
n_... | true |
13eebffb851421a3ea22d23f8fcd63de80c23e4e | DS-BootCamp-DSI-Columbia/AY2019-2020-Winter-Collaboratory-Faculty | /Bootcamp-materials/Day1-Machine-Learning/notebooks/solutions/load_adult.py | UTF-8 | 1,483 | 3.390625 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.preprocessing import MinMaxScaler
# We use display so that we can do multiple nice renderings of dataframes
# in Jupyter
from IPython.display import display
# Exercise 1
data = pd.re... | true |
451a5a113e26670a8b2bab394dab13eb3806baa0 | FroshTheFrog/life_logger | /data_types/if_yes.py | UTF-8 | 3,110 | 3.1875 | 3 | [
"MIT"
] | permissive | from config_utils import user_enter, function_maker, is_type, get_command_type, get_command_definition, on_not_valid_type, type_to_input_functions
import constants
import data_types.did_do as bool_lib
def build_if_yes_function(definition):
"""
Builds a function given a conditional bool response to a question t... | true |
199f43adfaba4a38d27fd65015c8f95f38aafe73 | chenjiasheng/leetcode_practice | /users/chenjiasheng/42.接雨水.py | UTF-8 | 730 | 3.375 | 3 | [] | no_license | from typing import List
class Solution:
def trap(self, height: List[int]) -> int:
if len(height) <= 1:
return 0
max_index = max(range(len(height)), key=height.__getitem__)
result = 0
i = 0
for j in range(1, max_index + 1):
if height[j]... | true |
6e0ccbd1bf001364845df00a37e07d08f940c16b | bidivermaak/Advanced-Python-Programming-Second-Edition | /Chapter07/example9.py | UTF-8 | 238 | 3.390625 | 3 | [
"MIT"
] | permissive | def parrot():
while True:
message = yield
print("Parrot says: {}".format(message))
if __name__ == "__main__":
generator = parrot()
generator.send(None)
generator.send("Hello")
generator.send("World")
| true |
e60302714d5549c2930893eb832dc8bdee86d4e6 | YannisZa/bayesian-hydrological-modeling | /simulators/hymod_simulation.py | UTF-8 | 9,668 | 2.609375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sympy as sy
from scipy.integrate import odeint
from sympy.solvers.ode import dsolve
from scipy.interpolate import interp1d
from types import SimpleNamespace
from tqdm import tqdm
import argparse
import random
import json
import math
import sys
import os
''' HYMOD model
C(... | true |
44ffe7aa3e6fbe3141cc33682ed991d388b59083 | bimri/django | /chapter02/Juggler/projectp/models.py | UTF-8 | 891 | 2.609375 | 3 | [] | no_license | from django.db import models
class Project(models.Model):
title = models.CharField(max_length=40, help_text="Project title")
creation_time = models.DateTimeField(auto_now_add=True, help_text="Start time")
completion_time = models.DateTimeField(null=True, help_text="End time")
def __str__(self):
... | true |
08475f4f9b5e6a777ff55521edf1ea0f92b69183 | Joaopmonteleone/Deep_Learning_Liver_Prediction | /api.py | UTF-8 | 17,356 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 1 17:33:34 2020
@author: Maria
"""
from algorithms import importDataset, splitAndScale, ANNregression, randomForest, svr
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import pandas as pd
import tensorflow as tf
import joblib
########################... | true |
e1e39b8b13ff9f9f7dfa6d6bd508e41298a0cc6a | anonymous-iclr-3518/code-for-submission | /clustering/layers/inn/reshape.py | UTF-8 | 5,013 | 2.84375 | 3 | [] | no_license | from typing import Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from . import Bijector
class SqueezeLayer(Bijector):
downscale_factor: int
def __init__(self, downscale_factor: int) -> None:
super().__init__()
... | true |
4b955a17edc98f772c093331e4f37ab41e9b65c4 | Eshchock1/CCC | /CCC'16S2-TandemBicycle.py | UTF-8 | 498 | 3.203125 | 3 | [] | no_license | question = int(input())
N = int(input())
city1 = list(map(int, input().split(" ")))
city2 = list(map(int, input().split(" ")))
city1.sort()
city2.sort()
groups = []
def maxVal(l1, l2):
l2 = city2[::-1]
for i in range(N):
groups.append(max([l1[i], l2[i]]))
return sum(groups)
def minVal(l1, l2):
... | true |
90e727e033abdbbb2db6b31cb446a6fc4c57ec3a | top-notch07/TwoWaits | /Task1/Python Basics/Program2.py | UTF-8 | 202 | 3.484375 | 3 | [] | no_license | n=5
for i in range(1,6):
for j in range(1,(2*n-1)+1):
if(j>=(n-(i-1)) and j<=(n+(i-1))):
print("*",end="")
else:
print(" ",end="")
print("\n")
| true |
5712baeffa2055795cfc45a8c4ffc5381871d30a | MattWear21/Exoplanets | /LinePlot.py | UTF-8 | 3,809 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 11:58:49 2020
@author: mattwear
"""
###Line plot of total exoplanets discovered
#nasa_df = pd.read_csv("Data/nasa_archive.csv", skiprows=126)
phl_df = pd.read_csv("Data/phl_exoplanet_catalog.csv")
#Bar chart of number of exoplanets discovered... | true |
9ee907ca008ecb31a7a7b0dfbcdb256e4db5fdc5 | wtianyi/RoBERTaABSA | /Perturbed-Masking/dependency/dep_parsing.py | UTF-8 | 11,920 | 2.515625 | 3 | [
"MIT"
] | permissive | import argparse
from tqdm import tqdm
import numpy as np
import pickle
from .eisner import Eisner, decode_mst, _mst
from .standfordMST import chuliu_edmonds
from .evaluation import _evaluation
import unicodedata
def softmax(x, axis=1):
"""Compute softmax values for each sets of scores in x."""
e_x = np.exp(x ... | true |
d7cdf7509202bf58c3b3c2c79e9edd615db3181d | a1618708/TypeSpeedTest | /main.py | UTF-8 | 3,197 | 3.328125 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from article import article_list
import random
timer = None
FONT = "MS UI Gothic"
TITLECOLOR = "#31112C"
ARTICLECOLOR = "#0A1D37"
class TypeSpeed():
def __init__(self):
#____parameters_________#
self.window = Tk()
self.window.title("Typi... | true |
5041ff2bcabfc1efc92eb125407cd8fc575903da | jeanpaulpitman/cp1404_pracs | /prac_08/unreliable_car.py | UTF-8 | 696 | 3.921875 | 4 | [] | no_license | """Module."""
from prac_08.car import Car
from random import randint
class UnreliableCar(Car):
"""Class."""
def __init__(self, name, fuel, reliability):
"""Initialize the UnreliableCar."""
super().__init__(name, fuel)
self.reliability = reliability
def drive(self, distance):
... | true |
b48f836dd7ea0114208035f3bcd18afe10ada434 | NeurodataWithoutBorders/pynwb | /src/pynwb/validate.py | UTF-8 | 9,179 | 2.546875 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | """Command line tool to Validate an NWB file against a namespace."""
import sys
from argparse import ArgumentParser
from typing import Tuple, List, Dict, Optional
from hdmf.spec import NamespaceCatalog
from hdmf.build import BuildManager
from hdmf.build import TypeMap as TypeMap
from hdmf.utils import docval, getargs
... | true |
28155a340bfaa33eaf59064657be19e19bb5e217 | alf42pac/python1 | /less5_1.py | UTF-8 | 275 | 3.390625 | 3 | [] | no_license | # Lesson5_1
with open('ltext_5-1.txt', 'w', encoding='utf-8') as alf:
while True:
a = input('Введите новую строку или пустую строку для завершения - ')
if not a:
break
print(a, file=alf)
| true |
3fad11f094bf921aa7eab3ddf5580c1d65e31642 | liyan2013/hogwarts | /python02/computer.py | UTF-8 | 543 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | class Computer:
def __init__(self):
self.cpu = "Inter i7"
self.memory = "8G"
self.hard_disk = "2TB"
self.mouse = "罗技鼠标"
self.keyboard = "达尔优机械键盘"
self.display = "戴尔显示器"
def click(self):
print("单击鼠标:" + self.mouse)
def double_click(self):
pri... | true |
f00c891e75ee909239f0b4982a77493d3927a82e | jkicmal/tsp-genetic-algorithm | /routeTester/oblicz.py | UTF-8 | 2,190 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
#-*- coding: utf-8 -*-
import sys
import string
from math import sqrt
# Wywołania: " python zmieniacz.py nazwa_pliku_we" (np.: "python zmieniacz.py berlin52.txt wyniki.txt")
def zbudujMacierz(wiersze):
macierz = [[0 for col in range(int(wiersze[0]))] for row in range(int(wiersze[0]))]
i = 0
... | true |
c05b4610acd789d6b816b2424d234bd73d74be8d | webartifex/whu-dynamic-programming | /fish.py | UTF-8 | 3,058 | 4.3125 | 4 | [] | no_license | """
fish.py
~~~~~~~
This module solves the fish homework problem.
Run with "python fish.py"
Description:
Every year (for 3 years) we decide whether to fish in a lake or not.
If we fish, the population of fish in the lake remains the same.
If we don’t fish, the population ... | true |
638188ae0ad614c7b9ea796b9fc4ce8f59692462 | rahuljngr/My-Python | /OOPs(teach by codewithharry)/tut8.py | UTF-8 | 967 | 3.734375 | 4 | [] | no_license | class Employee:
increment = 1.5
no_of_employees =0
def __init__(self,fname,lname,salary):
self.fname = fname
self.lname = lname
self.salary = salary
Employee.no_of_employees +=1
#self.increment = 1.4
def increase(self):
self.salary = int(self.salary * Empl... | true |
a4ca2c5e60cd1af66e8043483e42fe02b6aa8875 | hazelbain/MCpredict | /untitled0.py | UTF-8 | 4,307 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 22 14:13:45 2017
@author: hazel.bain
This module investigates the adaptive kernel smoothing widths to be used
when smoothing data for input into the
Chen geoeffective magnetic cloud prediction Bayesian formulation.
Due to a relatively small smaple of ge... | true |
041d472dc119df06fa2794f1e156d6c46f05e305 | iQuHACK/2021_MI-P-T-ex-AU | /transfer_data.py | UTF-8 | 1,555 | 2.90625 | 3 | [] | no_license | from quantum_logic import *
def get_ships(string):
ships = []
first = string.split(', ')
for i in first:
coords = []
shape, sets = i.split('. ')
shape = int(shape)
coordinates = sets.split('; ')
for j in coordinates:
tup = [int(k) for k in j.split(' ')]
... | true |
b7973561c98188c0e8e9f73d46524945468aab18 | sergebb/cxi_tools | /cxi_print.py | UTF-8 | 792 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import h5py
import sys
def printBranch(group, prepend):
for i,g in enumerate(group.keys()):
if i < len(group.keys())-1:
#not last
connection = ' ├─'
next_prepend = prepend + ' │'
else:
connection = ' └─'
... | true |
49a884da4350c57e9823a7b5f864e8de6f65500d | brucehzhai/Python-JiangHong | /源码/Pythonpa/ch13/create_oval.py | UTF-8 | 421 | 3.4375 | 3 | [] | no_license | from tkinter import *
root = Tk()
c = Canvas(root,bg = 'white', width=280, height=70); c.pack() #创建并显示Canvas
c.create_oval(10,10,60,60,fill='red') #红色填充椭圆
c.create_oval(70,10,120,60,fill='red',outline='blue',width=5) #红色填充蓝色边框宽度5的椭圆
c.create_oval(130,25,180,45,dash=(4,)) #虚线椭圆
c.create_oval(190,10,270,50,da... | true |
c096f70e16a0ba7fbb0a968b69ee610d975f29c3 | fazlikeles/RACLAB | /Yapay Zeka/machine learning examples/polinom_regresyon.py | UTF-8 | 408 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures as pf
from sklearn.linear_model import Perceptron
from sklearn import linear_model
data=pd.read_csv("data/linear.csv")
x=data["metrekare"]
y=data["fiyat"]
x=np.array(x)
y=np.array(y)
a,b,c=np.... | true |
32b1915dc54f87bf0eb7978f64a8a9fbe22cd1f7 | AlbaranezJavier/AIVA_2021_AJ | /tools/Analyzer.py | UTF-8 | 792 | 2.953125 | 3 | [] | no_license | from abc import ABC, abstractmethod
import numpy as np
class AbstractAnalyzer(ABC):
@abstractmethod
def do_quantification(self, quantifiable, non_quantifiable):
pass
class MaskQuantificator(AbstractAnalyzer):
def do_quantification(self, quantifiable, non_quantifiable):
"""
Perfor... | true |
10f8e6a82964700f1f5e2709bc9ab7b3819cdfe2 | jianghualuo/python_selenium | /QQ_mail_auto_test/mail_auto_test/test_case/models/function.py | UTF-8 | 2,132 | 2.625 | 3 | [] | no_license | import os
import time
import win32gui
import win32api
import win32con
import pyautogui
from ctypes import *
from selenium.webdriver import ActionChains
def qq_login():
# TODO: 可以将密码账户作为参数传入
# 运行QQ
os.system('"C:\Program Files (x86)\Tencent\QQLite\Bin\QQScLauncher.exe"')
time.sleep(5)
a = win32gui.... | true |
9a93d87de58ac5b8456251a381b92d3299fa4309 | thenanosoft/download-pinterest-videos | /Download Pinterest Video.py | UTF-8 | 1,508 | 3.28125 | 3 | [] | no_license | '''
Developer: Farhan Ellahi
Organization: Nanosoft
Date: 5-Apr-2021, Monday
Website: thenanosoft.com
Email: support@thenanosoft.com
'''
import requests
from bs4 import BeautifulSoup
# function for download video
def download_file(url):
# local file name for video after last slash "/"
local_filename = ... | true |
b649c5438275d11ca5f46bd5dd874b31075e73c5 | xxao/pero | /unittests/scales/test_continuous.py | UTF-8 | 6,025 | 2.921875 | 3 | [
"LicenseRef-scancode-philippe-de-muyter",
"LicenseRef-scancode-commercial-license",
"AGPL-3.0-or-later",
"MIT"
] | permissive | # Created byMartin.cz
# Copyright (c) Martin Strohalm. All rights reserved.
import unittest
import pero
class TestCase(unittest.TestCase):
"""Test case for Linear scale class."""
def test_scale(self):
"""Tests whether scale function works correctly."""
scale = pero.LinSca... | true |
0c237f78e2550b140194b330f3bc75b962117b15 | supermariobros2/Operations-Research | /Operations Research/2. Integer Programming/Integer Programming Lecture Material/XO.py | UTF-8 | 725 | 2.875 | 3 | [] | no_license | import math
import random
from gurobipy import *
N = range(9)
Lines = [
[0,1,2],
[3,4,5],
[6,7,8],
[0,3,6],
[1,4,7],
[2,5,8],
[0,4,8],
[2,4,6]
]
L = range(len(Lines))
m = Model('XO')
X = [m.addVar(vtype=GRB.BINARY) for i in N]
Y = [m.addVar() for l in L]
m.update()
m.setObject... | true |
c98d3840a85df49be430c2aaed553000a74f3d60 | junbinding/algorithm-notes | /cache.lru-cache.py | UTF-8 | 2,165 | 4.1875 | 4 | [] | no_license | class Node:
def __init__(self,key,val):
self.key=key
self.val=val
self.next=None
self.prev=None
class LRUCache:
"""
146. LRU 缓存机制
https://leetcode-cn.com/problems/lru-cache
运用你所掌握的数据结构,设计和实现一个 LRU (最近最少使用) 缓存机制 。
实现 LRUCache 类:
1. LRUCache(int capacity) 以正整数... | true |
398abe28bb623d6b7c7076f61e7d2c004cb0fff4 | theadamsacademy/python_tutorial_for_beginners | /08_operators/rule_2_associativity.py | UTF-8 | 214 | 3.796875 | 4 | [] | no_license | # ()
# *, /
# +, -
# <, <=, >, >=, !=, ==
# not
# and
# or
# Highest precedence at top, lowest at bottom.
# Operators in the same line evaluate left to right.
a = 3
b = 5
c = 5
print("a < b < c is ", a < b <= c) | true |
060d29d248e796bf30ae86586a748b64b5835e5b | chenlsmr/PycharmProjects | /PythonCore/Core/Print solid diamond1.py | UTF-8 | 372 | 3.703125 | 4 | [] | no_license | a = int(input("请输入菱形每条边星星的个数:"))
b = a
c = a
for i in range(1, a + 1): # 先打印正三角,由空格和*根据规律组成
print(" " * (b - 1), "*" * (2 * i - 1))
b -= 1
if i == a: # 临界点,当打印到此,开始打印倒三角
for y in range(1, a):
print(" " * y, "*" * (2*c-3))
c -= 1
| true |
d5d469a67ad5dcf69d649cb8bd45f06fab90b914 | peteresculley/WebLinkExtractor | /tests/consumer_tests.py | UTF-8 | 1,443 | 3.09375 | 3 | [] | no_license | import unittest
import queue
from consumer import Consumer
class ConsumerTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.q = queue.Queue(10)
cls.consumer = Consumer(name='consumer', queue=cls.q)
def test_create_file_name(self):
file_name = Consumer.create_file_name... | true |
7c4797aa3ba5bcf5217a3ece59d9889a24afd15f | OmAbdelBaky/Walk_Tunes | /Dist.py | UTF-8 | 483 | 3.34375 | 3 | [] | no_license | import math
def dist (lat1,lon1,lat2,lon2):
radius = 6371000
lat1_rad = lat1 * math.pi / 180
lat2_rad = lat2 * math.pi / 180
lon1_rad = lon1 * math.pi / 180
lon2_rad = lon2 * math.pi / 180
de_lat = lat1_rad - lat2_rad
de_lon = lon1_rad - lon2_rad
a = math.pow(math.sin(de_lat / 2... | true |
d14423a8c858da684373c68df01dbd3090461d24 | slzatz/mylistmanager3 | /task_display2.py | UTF-8 | 3,575 | 2.71875 | 3 | [] | no_license | #!bin/python
'''
A version of task_display that doesn't require calling a separate script but just imports this script
Runs curses-based script until it returns and tears everything down so cmd can continue running
'''
import sys
import curses
import textwrap
from datetime import datetime
import time
import json
import... | true |
3e1b2344016ab9591349974293ea65f768c0cbcd | huangr/cipher | /mcmc.py | UTF-8 | 7,708 | 3 | 3 | [] | no_license | import random
import matplotlib.pyplot as plt
import math
from collections import deque
from multiprocessing.dummy import Pool as ThreadPool
epochs = 10
bag_num = 7
iterations = 4000
borderline = 0.0001
alphabet = []
alphabet_to_num = {}
probs = []
text = ""
real_text = ""
pool = ThreadPool(6)
# transition[i][j] mean... | true |
eac8d1f9695db5f9326001c7e00fc4ff0467253c | AdrianPratama/AdrianSuharto_ITP2017_FinalProject | /maze.py | UTF-8 | 6,864 | 3.453125 | 3 | [] | no_license | import random
from pygame import *
from pygame.sprite import *
from template import receive
#import modules
#create Box Class for the Box player
class Box(Sprite):
def __init__(self):#initialize the sprite
Sprite.__init__(self)
self.image= pygame.image.load("RedBox.png")#load the image
self.... | true |
d8dd5a9cdff519b230dca778895ea98c4b2d44c1 | yingnn/tushare_easy | /tushare_easy/utils.py | UTF-8 | 8,903 | 2.78125 | 3 | [
"MIT"
] | permissive | """tushare_easy utils
"""
from __future__ import print_function
import os
from warnings import warn
import arrow
import pandas as pd
import tushare as ts
from unipath import Path
from . import consts as CONSTS
def get_codes(index=False):
if index:
return CONSTS.index_prefix + \
ts.get_index()... | true |
999dfe02c606617b3916ebc9c0bae159a78be768 | kibriaislam/Problem-solving-with-Python | /binaryseacrch_recursion.py | UTF-8 | 605 | 3.609375 | 4 | [] | no_license | def recursive_binary_search(arr,low,high,x):
mid = (low+high)//2
if low<=high:
if x==arr[mid]:
return mid
if x>arr[mid]:
return recursive_binary_search(arr,mid+1,high,x)
if x<arr[mid]:
return recursive_binary_search(arr,low,mid-1,x)
return -1
i... | true |
9bb2d222ca9aeb64e3453162e915ecdb8d495bdc | rajgopav/Algorithms | /Strings/PalindromeIndex.py | UTF-8 | 915 | 3.484375 | 3 | [] | no_license | import sys
def parseInt(stream):
return int(stream.readline().rstrip())
def parseString(stream):
return stream.readline().rstrip()
def isPalindrome(s):
return s == s[::-1]
def makePalindrome(s):
s = list(s)
indices = []
for i in range(len(s)/2 + 1):
if(s[i] != s[len(s) - 1 - i]):
... | true |
8a1c3cd8737d9480a5db007ac8f9ff5d7c1acb8e | sbsreedh/Coding-Practise | /suggestedProducts.py | UTF-8 | 1,618 | 3.546875 | 4 | [] | no_license |
#Trie implementation
class TrieNode:
def __init__(self):
self.children={}
self.wordList=[]
class Trie:
def __init__(self):
self.root=TrieNode()
def insert(self,word):
curr=self.root
for c in word:
if c not in curr.children:
curr.children[... | true |
c9bb1df1634da1a2792b69a7e8aed95e30427687 | bern/lunch-bot | /tests/lib/handlers/test_make_plan.py | UTF-8 | 2,165 | 2.5625 | 3 | [
"MIT"
] | permissive | import uuid
from lib.handlers.make_plan import handle_make_plan
from lib.models.plan import Plan
from lib.models.user import User
def test_handle_make_plan_bad_args(
mock_send_reply, make_handler_params,
):
"""
Ensures that, when we provide handle_make_plan with an improper number of
arugments, it do... | true |