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 |
|---|---|---|---|---|---|---|---|---|---|---|
00f7996a32adefa99795905fecb14e59f4734957 | rousseab/Point-group-Symmetry | /sites.py | UTF-8 | 2,721 | 2.84375 | 3 | [] | no_license | import numpy as N
from point_group import PointGroup
from fortran_parser import load_pickle_file
from orbital_representation import get_representation_matrix
class SymmetricSites(object):
"""
This object will represent the orbit of some generating positions, along with the orbitals decorating
these site... | true |
4da46c87f5aec240d848b9dbf21daee3a45ece74 | nikitapandey99/Python-Specialization | /scrap.py | UTF-8 | 287 | 2.953125 | 3 | [] | no_license | import urllib.parse, urllib.request, urllib.error
from bs4 import BeautifulSoup
url=input('Enter: ')
html=urllib.request.urlopen(url).read()
file=BeautifulSoup(html,'html.parser')
tags=file('span')
total=0
for tag in tags:
total=total+int(tag.contents[0])
print(total)
| true |
36b4706c685185537180897dff24fac568935c67 | Justinyu1618/python-bee | /easy/9.py | UTF-8 | 324 | 3.4375 | 3 | [] | no_license | ''' Q9: Given list x as input, reverse the elements of x and return the resulting list.
>>> f([1,4,6,2,3])
[3,2,6,4,1]
>>> f([2])
[2]
>>> f(['a','b','c'])
['c','b','a']
>>> f([[1,2],[],[2,3]])
[[2,3],[],[1,2]]
'''
def f(x):
# Your Code Here!
pass
if __name__ == '__main__':
import doctest
doctest.testm... | true |
43182d794b0fd71a0782fd0d606f8603ee3a63e0 | Rastatrevftw1538/DevOps | /devops-count.py | UTF-8 | 113 | 3.25 | 3 | [] | no_license | def main():
user_in_count = input("COUNT insert a word with I's: ")
print(user_in_count.count("i"))
| true |
7e9c73d10943f5bb8e7b02b37f5f0d8d3ee7e083 | mariaEduarda-codes/Python | /estrutura-condicional/problema_aumento.py | UTF-8 | 1,236 | 4.1875 | 4 | [] | no_license | """
Uma empresa vai conceder um aumento percentual de
salário aos seus funcionários dependendo de quanto
cada pessoa ganha, conforme tabela ao lado. Fazer
um programa para ler o salário de uma pessoa, daí
mostrar qual o novo salário desta pessoa depois do
aumento, quanto foi o aumento e qual foi a porcentagem
de... | true |
9e079fd6db5914313f4e0588321065b23256a61e | lilangbr/4th_plataforma | /modules_api/statistics.py | UTF-8 | 1,470 | 3.0625 | 3 | [] | no_license | #This program returns the count of times that values in a vector, in order,
#appear in a given bitmap image.
#The values in the vector are between 0 and 15.
#The bitmap image and vector are JSON files in the ./src folder.
#
#Author: Eliane Bresser Lang
#Date: dec/06/2020
import json
import sys
from modules.get_object... | true |
8ffa92c1deaf7198a3acd9840d13c8bcfa9b1323 | svfarande/Python-Bootcamp | /PyBootCamp/zipper.py | UTF-8 | 1,798 | 4.09375 | 4 | [] | no_license | # Python code to demonstrate the working of zip and unzip
# initializing lists
name = ["Manjeet", "Nikhil", "Shambhavi", "Astha"]
roll_no = [4, 1, 3, 2]
marks = [40, 50, 60, 70]
# using zip() to map values
mapped = zip(name, roll_no, marks)
print(mapped) # <zip object at 0x0160FE08>
print(type(mapped)) # <class '... | true |
1de3713e1bc0f6d54c448a21c17ce79a4a734833 | MrHamdulay/csc3-capstone | /examples/data/Assignment_9/dlymuh001/question3.py | UTF-8 | 1,537 | 4.40625 | 4 | [] | no_license | """program to check if a complete sudoku is valid or not
Muhammad Nabeel Dulymamode
11/05/2014"""
#function to check if sudoku grid is valid
#returns True if valid, otherwise False
def checksudoku(sudoku):
#Check if rows are valid
for row in range(0,9):
for num in range(1,10):
if ... | true |
ff584ccba4f2337c47602c171fe7eb15b42c89de | luoxu34/luoxu34.gitbook.io | /programming_notes/python/wordcloud/files/image_colored_wordcloud.py | UTF-8 | 500 | 2.71875 | 3 | [] | no_license | #! -*- coding: utf-8 -*-
from scipy.misc import imread
from wordcloud import ImageColorGenerator, WordCloud as WC
text = open('files/python_en.txt').read()
back_coloring = imread('python_logo.png')
wc = WC(background_color='white', mask=back_coloring, random_state=42, margin=2)
wc.generate(text)
image_colors = Imag... | true |
4e2d295a304a1c0daec9275310ea42ed2f6d31a4 | NizarGhandri/GDP | /src/helpers.py | UTF-8 | 5,625 | 3.015625 | 3 | [
"MIT"
] | permissive | from typing import Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from src.evaluation_metrics import R_squared
from src.feature_engineering import build_poly
from src.regressions import ridge_regression
def X_y_from_dataset(dataset: pd.DataFram... | true |
524f1982932269dcb62d3e9b19e0ce9010413a51 | lb20/stupidArtnet | /stupidArtnet/examples/tkinter_slider_to_artnet.py | UTF-8 | 1,312 | 3.53125 | 4 | [
"MIT"
] | permissive | """(Very) Simple Example of using Tkinter with StupidArtnet.
It creates a simple window with a slider of value 0-255
This value is streamed in universe 0 channel 1
Note: The example imports stupid artnet locally from
a parent folder, real use import would be simpler
"""
from stupidArtnet.StupidArtne... | true |
84d927827708cf6bf308bdf7777f69f7e26b5011 | Yoshino-master/frame_of_wing | /display/html.py | UTF-8 | 1,033 | 2.984375 | 3 | [] | no_license | '''
Created on 2019年3月12日
@author: jinglingzhiyu
'''
import os
def ToHtmlFile(path, datadict):
if os.path.exists(path):
index = open(path, 'a')
else:
index = open(path, 'w')
#写入标题栏
index.write('<html><body><table><tr>')
index.write('<th>name</th>')
len_img = -1
keys_gatho... | true |
764dcdcb3f99f6f41849af60d4ed00d3c55e8cd7 | VFermat/CamadaFisica | /Projeto5/Server.py | UTF-8 | 8,294 | 2.546875 | 3 | [] | no_license | #####################################################
# Camada Física da Computação
# Henry Rocha e Vitor Eller
# 18/08/2019
# Send and receice data using packets.
#####################################################
import time
from Common import Common
from PyCRC.CRC16 import CRC16
class Server(Common):
de... | true |
0a5868da2200c588fe931cdbb196893ba4ef41a5 | abhijeetvhotkar/CTCI | /moderate/03-intersection.py | UTF-8 | 837 | 3.859375 | 4 | [] | no_license | class point:
def __init__(self, x, y):
self.x = x
self.y = y
class line:
def __init__(self, point1, point2):
self.m = (point2.y - point1.y) / (point2.x - point1.x)
self.b = point2.y - self.m * point2.x
def intersect(line1, line2):
if line1.m == line2.m and line1.b != line2.... | true |
b5fc27d0629a92f9c122f01c6b4479660bbffec6 | linekin/rumors-analysis | /src/models/cluster.py | UTF-8 | 1,544 | 2.78125 | 3 | [
"MIT"
] | permissive | from time import time
import hdbscan
import jieba
jieba.set_dictionary('../data/dict.txt.big')
import pandas
from sklearn.cluster import DBSCAN, AffinityPropagation
from sklearn.decomposition import PCA, TruncatedSVD
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from collections impor... | true |
a72e8e2b469d623714eff1061c5f76084822af5a | Bharat-jindal/irisclassification | /test.py | UTF-8 | 623 | 2.609375 | 3 | [] | no_license | import numpy as np
def sigmoid(x):
return 1/(1+np.exp(-x))
def checkPerformance(X,Y,totalTheta):
resultY = []
for theta in totalTheta:
#print('Data',data,theta)
h = np.dot(X,theta)
vf = np.vectorize(sigmoid)
h = vf(h)
resultY.append(h)
count = 0
for i i... | true |
5ff6635d6d66045cc1c8fa56ccb4cc5a1df46101 | ISANGDEV/Algorithm_Study | /6_Dinamic_Programming/HS/[HS]Bridge_1010.py | UTF-8 | 489 | 3.09375 | 3 | [] | no_license | import sys
def fac(number):
global memory
if number in memory:
return memory[number]
elif number <= 1:
return 1
else:
memory[number] = number * fac(number -1)
return memory[number]
def bridge(m,n):
result = fac(m) / (fac(n) * fac(m-n))
return result
result = [... | true |
25ea7e068c6a80e31c83df491ec6f371b8bdf988 | KelseyYocum/Movie_Ratings | /model.py | UTF-8 | 6,366 | 2.671875 | 3 | [] | no_license | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref
import correlation
ENGINE = cr... | true |
b333fca754cc798b69d86df6b34325e6ac53f32d | Anova07/Data-Science | /MachineLearning/NaiveBayes/NaiveBayesClassifier.py | UTF-8 | 6,055 | 3.390625 | 3 | [] | no_license | from collections import defaultdict, Counter
import math
import numpy as np
class Item:
def __init__(self, className, label, posProb, negProb, i, fi):
self.className = className
self.label = label
self.posProb = posProb
self.negProb = negProb
self.i = i # Feature number Age... | true |
40c508c343f3323188f383adceb79395e22a62af | Leesidong/Python | /0619_Class.py | UTF-8 | 951 | 4.78125 | 5 | [] | no_license | # 클래스
class Person:
name = "길동"
def say_hello(self):
# 클래스 안에 선언된 변수를 사용할 때 self를 이용하여 사용
print("Hello " + self.name)
# Person 이라는 객체의 오브젝트 생성
p = Person()
# Person 클래스의 함수 사용
p.say_hello()
# 함수 호출 시 인자값을 넘겨주는 법
# __init__ 을 사용
class Test:
# 셀프를 먼저 선언하고, 사용할 값을 선언
def __init__(sel... | true |
35a47f65f03f3b6f3914c75f06753b76a97dad7f | danmac13/CardGame | /Main.py | UTF-8 | 2,465 | 3.703125 | 4 | [] | no_license | # Virtual Pong
# Dan MacDonald
import turtle
dow = turtle.Screen()
dow.title("Dan's Virtual Pong")
dow.setup(width=800, height=600)
dow.bgcolor('black')
dow.tracer(0)
# Score
s_a = 0
s_b = 0
# Player 1
pad_a = turtle.Turtle()
pad_a.speed(0)
pad_a.shape('square')
pad_a.color('lime green')
pad_a... | true |
bb0ef4b7d6df342000fdbd379785a05d055f0d4f | a1600012888/MaskGAN | /run_baseline.py | UTF-8 | 1,027 | 2.609375 | 3 | [] | no_license | import os
base_command = 'rlaunch --cpu=8 --gpu=1 --memory=8192 -- python3 train2.py --exp='
def run_tv_loss():
tv_Weights = [5e-3, 1e-4]
for tv in tv_Weights:
command = base_command + 'tv_{}'.format(tv) + ' --tv={} &'.format(tv)
os.system(command)
def run_content_loss():
content_we... | true |
e2420e0aac58cfc909029410ff1d1251f0456cab | savvysqrrl3/100Classes | /10starship.py | UTF-8 | 2,586 | 3.25 | 3 | [] | no_license | from jedi import Jedi
from stormtrooper import StormTrooper
from entity import Entity
from droid import Droid
class StarShip(object):
def __init__(self, name, classification, shields, weapons, strength, damage=0, boarded=False):
self.name = name
self.classification = classification
self.shields = shields
self... | true |
e2876fd7789ba8b81fe1834d7544880213d6b9d2 | vitorscassiano/SimpleDesignPatterns | /interface.py | UTF-8 | 284 | 3.4375 | 3 | [] | no_license | from abc import ABC, abstractmethod
from typing import List
class IHello(ABC):
@abstractmethod
def hello(self, word: str, bla: List):
pass
class Hello(IHello):
def hello(self, word):
print(f"Hello {word}!")
pass
# Main
Hello().hello("World")
| true |
b4a68cedbd7d62a7ed529fd88a947c93b5f33aeb | JaLuka98/AP_17-18 | /V308_spulen_und_magnetfelder/plot.py | UTF-8 | 6,235 | 2.65625 | 3 | [] | no_license | import numpy as np
import scipy.optimize
import uncertainties as unc
import uncertainties.unumpy as unp
from scipy import optimize
import matplotlib.pyplot as plt
from uncertainties import ufloat
n1=300 #lange spule
I1=1.4 #Strom in A für lange spule
l1=0.16 #länge in m lange spule
n2=100 #kurze spule
I2=1.2 #strom... | true |
acc546f4d6c23c0fa0f9fc2164b636e02621c2d7 | JakeDerkowski96/birdminer | /user_config.py | UTF-8 | 9,366 | 2.65625 | 3 | [] | no_license | """ user configurated search """
# import all arguments
# print configure swarch screen w few variables printed to screen
# offer more options = print out all configureable options
# offer long config where all variable are asked one after another
# orgainze the questions strategically
# the main options
# the ... | true |
75af501152fef3faaa00dd4e2ec2e674eccbc2da | goalong/lc | /v2/90.py | UTF-8 | 581 | 3.203125 | 3 | [] | no_license |
class Solution:
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
# 6 star, dfs, 多练习
# 先排序,然后dfs, 注意不能重复
nums.sort()
rs = []
self.dfs([], rs, 0, nums)
return rs
def dfs(self, path, rs, sta... | true |
5216f6162a6a0bf10008e0a2b6cff8ad06bf60ca | DarioAl/ARGoS-Kilobots-Complexity | /parse_argos_for_mathematica.py | UTF-8 | 1,890 | 2.6875 | 3 | [
"MIT"
] | permissive | # use this file to generate averages to plug in the mathematica file
from os import walk
import csv
import sys
import numpy as np
# save numpy array as csv file
from numpy import asarray
from numpy import savetxt
max_population = 1
def main(argv):
# load the datasets
data = []
# find all folders
fol... | true |
29ea04f415ff64e5e366b49a8b9440c6eb2614ed | abmohan/realtor-2.0 | /apartment_finder/test/test_utilities.py | UTF-8 | 2,706 | 2.53125 | 3 | [] | no_license | import inspect
import unittest
import datetime
from ..utilities.pgSQL_handler import pgSQL
class TestpgSQL(unittest.TestCase):
def setUp(self):
self.pgSQL = pgSQL('apartment_listings', 'an0nym1ty', default_table='test')
cursor = self.pgSQL.pg_conn.cursor()
try:
cursor.execute('... | true |
1393f0234646c4ff1f2c6a70b99b35d00180d789 | jc-chuang/Movie_project | /m4_imdb_post_budget.py | UTF-8 | 2,834 | 2.59375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
with open('./Certification_list.csv', 'r', encoding='utf-8') as e:
m_list = e.readlines()
for m_id in m_list:
m_id = m_id.replace('\n','')
url = 'https://www.imdb.com/title/{}/?ref_=adv_li_tt'.format(m_id)
res = requests.post(url)
soup = BeautifulSoup(... | true |
070bcb50ed7ee2fd3301718b735e714a86df8cad | rvenkates/HelloWorld | /shakespeare.py | UTF-8 | 206 | 2.640625 | 3 | [] | no_license | from collections import Counter
counts = Counter()
with open('notes/hamlet.txt') as f:
for line in f:
counts.update({word: counts.get(word, 0) + 1 for word in line.split()})
| true |
5ac049681d0a90fcc05b62d42037ac3878d0cd4e | radpet/team_a | /vicky/Scripts/Tokenizer.py | UTF-8 | 686 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# <nbformat>4</nbformat>
# <codecell>
from segtok.segmenter import split_single, split_multi
# <codecell>
class Tokenizer(object):
def sentence_tokenizer(self, string):
tokenized_sentences = list(split_multi(string))
return tokenized_sentences
def word_tokenizer... | true |
bde3000b8567128a9e2432cb50910cf0586385e0 | hjhjw1991/leetcode | /python/137_Single_Number_II.py | UTF-8 | 836 | 3.015625 | 3 | [] | no_license | # coding=utf-8
import unittest
class Solution:
def solve(self, nums):
return self.singleNumber(nums)
def singleNumber(self, nums):
b0=b1=0
for num in nums:
b0=(b0^num)&(~b1)
b1=(b1^num)&(~b0)
return b0
class Test(unittest.TestCase):
#... | true |
8e59f1dfca67c8221cd3a291255f076ce011c71a | kaushik-42/data_base_conn | /db2_connectiosn.py | UTF-8 | 2,976 | 3.203125 | 3 | [] | no_license | import ibm_db
"""Identify the database connection credentials
Connecting to dashDB or DB2 database requires the following information:
Driver Name
Database name
Host DNS name or IP address
Host port
Connection protocol
User ID (or username)
User Password"""
#Replace the placeholder values with your actual Db2 hostnam... | true |
f7fdfcf5f74a63a98120cc59fbabbc1d194b32f4 | connormayer/featurizer | /code/Featurizer.py | UTF-8 | 21,985 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | import argparse
from Poset import Poset
from collections import defaultdict, deque
from enum import Enum
from graphviz import render, ExecutableNotFound
from os import path, remove, rename
# This code requires boolean matrix functionality, which numpy provides
# set this value to True if you have numpy installed
# ot... | true |
cf766b29cc60d7ad0ebfaf52ba11a16e58e7e244 | zuqqhi2/my-leetcode-answers | /377-Combination-Sum-IV.py | UTF-8 | 1,348 | 3.796875 | 4 | [] | no_license | class Solution:
def combinationSum4(self, nums, target: int) -> int:
"""
:param List[int] nums: number list
:param int target: target number
:rtype: int
:return: number of combinations to make target number with sum
"""
# Corner cases
if nums is None:
... | true |
c1d54912aff4e47e7b1576bdc3325d38cead3dbe | bbqp/pysmoothlife | /integrator.py | UTF-8 | 4,753 | 3.484375 | 3 | [
"MIT"
] | permissive | """
integrator.py
A class for numerically integrating a function f(x,y)
on a circular grid.
"""
import numpy as np
class Integrator:
def __init__(self, X, Y):
"""
Integrator.__init__()
Creates an instance of an Integrator object.
Inputs:
r0 - The inner radius of ... | true |
e9656e59eda6ce8ad7a75407b0cbdf95734e08a0 | sanketd25/MI-UE18CS303 | /A3/new.py | UTF-8 | 8,521 | 3.03125 | 3 | [] | no_license | import numpy as np
import sys
class Layer:
def __init__(self, _numInputs, _numNeurons, _activFunc):
# Note, numInputs = number of neurons in the previous layer
self.activFuncName = _activFunc
self.prevShape = _numInputs + 1 # For bias
self.shape = _numNeurons
self.droprate... | true |
046dbc19439c657893c4d7508762e94a26cb5bb9 | towerjoo/CS-notes | /gae/google/appengine/api/app_logging.py | UTF-8 | 2,527 | 2.609375 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | true |
88467e37ed4d80bb92f9624cddde961610ad155b | akerlund/dotfiles | /scripts/hex_to_int.py | UTF-8 | 225 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
import sys, os
if __name__ == '__main__':
filling = 8
if len (sys.argv) < 2:
sys.exit(1)
_hex = sys.argv[1].replace('0x', '').zfill(filling)
print('0x' + _hex + ' = ' + str(int(_hex, 16)))
| true |
bcbafd0aebcb47eb00fda51723654c3db14a6b82 | sairajchintha/SimpleScripts | /gold_silver_price_scraper.py | UTF-8 | 530 | 3.015625 | 3 | [] | no_license | import bs4
import requests
link="https://economictimes.indiatimes.com/commoditysummary/symbol-SILVER.cms"
link2="https://economictimes.indiatimes.com/commoditysummary/symbol-GOLD.cms"
res2=requests.get(link2)
res=requests.get(link)
soup=bs4.BeautifulSoup(res.content, 'lxml')
soup2=bs4.BeautifulSoup(res2.content, 'lxml... | true |
f0eae4055cad14ad728b8b43316029ccf3c10ee7 | Xiaoyang-Pan/MovingSounds | /movingsound.py | UTF-8 | 4,474 | 3.203125 | 3 | [] | no_license | ########################################################################
# #
# Playing moving Sound in headphones #
# #
# 1.Imported a wave au... | true |
2315c213b2ef989393dc7144cdf3619752ee44e7 | benep98/Variables | /multiplying and dividing numbers.py | UTF-8 | 311 | 3.75 | 4 | [] | no_license | first_number = int(input("Please enter your first number"))
second_number = int(input("Please enter your second number"))
third_number = int(input("Please enter your third number"))
answer1 = first_number * second_number
answer2 = answer1 / third_number
print(answer2)
print("{0:.0f}".format(answer2))
| true |
43617271e7d57744ac3f2442d801a8da16b0bc81 | neguseatama/JapaneseCalendar | /JapaneseCalendar.py | UTF-8 | 1,325 | 3.875 | 4 | [] | no_license | # Pythonによる西暦の和暦変換
# https://neguse-atama.hatenablog.com
# coding: utf-8
print("西暦年、月、日付をスペース区切りで、1行で入力してください。")
year, month, day = map(int, input().split())
new_m = month
new_d = day
if int(month) < 10:
month = str(month)
new_m = "0" + month
if int(day) < 10:
day = str(day)
new_d = "0" + day
date ... | true |
25334b2923699426ac2f9691d1224165f0851c36 | cczeus/project-euler | /problems/problem009.py | UTF-8 | 371 | 3.421875 | 3 | [] | no_license | def isPythagoreanTriple(num1, num2, num3):
nums = [num1, num2, num3]
nums.sort()
return nums[0] ** 2 + nums[1] ** 2 == nums[2] ** 2
def main():
for a in range(1, 999):
for b in range(1, 1000 - a):
c = 1000 - a - b
#if isPythagoreanTriple(a, b, c):
if a ** 2 +... | true |
8bb7db942185415f2c881b1c879d9960413520f1 | pranaysathu/pythonTraining | /prime.py | UTF-8 | 165 | 3.5 | 4 | [] | no_license | r = 1
while(r < 100):
r = r+1
i = 0
con = 0
while(i <= r):
i = i+1
if(r%i == 0):
con=con+1
if(con ==2):
print(r,end=" ") | true |
5d08e16c1f5e0133afe50fdd92bf5c4d257780b2 | hopg/Minesweeper | /minesweeper.py | UTF-8 | 12,860 | 3.65625 | 4 | [] | no_license | import random
from IPython.display import clear_output
class Board():
'''
Superclass to create the board.
'''
def __init__(self):
if diff in (1, 2):
self.tiles = [" " for c in range(4 + 8*diff)]
def display(self):
if diff == 1:
... | true |
71b23cc8ad4f1c5a67690597fc7acaabc1875d83 | MrHamdulay/csc3-capstone | /examples/data/Assignment_5/chnjul005/question2.py | UTF-8 | 749 | 3.390625 | 3 | [] | no_license | cost = eval(input("Enter the cost (in cents):\n"))
minus =0
rem = cost
while rem > 0:
depo = eval(input("Deposit a coin or note (in cents):\n"))
minus+=depo
rem -= depo
if rem == 0:
print()
else:
tdol = 0
t25 =0
t10 =0
t5=0
t1 = 0
rem*=-1
r = (rem%100)
tdol = (rem-r)//100... | true |
ea1e6d5f49bdf160a9970f57d27a43de71cc098c | froydis98/NumeriskModellering | /Exercise4/task1.py | UTF-8 | 449 | 3 | 3 | [] | no_license | import numpy as np
n = 10
A = np.random.rand(n, n) * 10
ANormalized = A.transpose() + A
values, vectors = np.linalg.eig(ANormalized)
Orthonormal = np.zeros((n, n))
for i in range(len(vectors)):
for j in range(len(vectors)):
Orthonormal[i,j] = abs(np.around(vectors[j] @ vectors[i]))
print(Orthonormal)
P = v... | true |
85a09c5b2d39f4ee7338c929a614c55b62286e73 | iamsounoringinal/redis-ansible | /check_cluster.py | UTF-8 | 947 | 2.6875 | 3 | [] | no_license | import time
from redis.sentinel import Sentinel
sentinel = Sentinel([('192.168.11.35', 26379),('192.168.11.37', 26379),('192.168.11.37', 26379)], socket_timeout=0.1)
for i in range(1,1000):
print "ciclo " + str(i)
try:
print "master: " + str(sentinel.discover_master('mymaster'))
print "slave/s: " + str(sen... | true |
b5e1411206a71d34ffb9d3176ddfee7061340075 | ruoti/blockchain-simulation-framework | /json_endec.py | UTF-8 | 878 | 2.921875 | 3 | [] | no_license | import json
import networkx as nx
class GraphEncoder(json.JSONEncoder):
"""A JSONEncoder for serialzing networkx.Graph objects.
"""
def default(self, obj):
if isinstance(obj, nx.Graph):
return {
"_type": "nx.Graph",
"value": nx.node_link... | true |
2db0bf654937ab14a5ba01ecc4ed1be36c2e6dd0 | gbalabanov/Dungeons-Pythons | /Hero_test.py | UTF-8 | 620 | 3.15625 | 3 | [] | no_license | from Hero import Hero
import unittest
class TestHero(unittest.TestCase):
def setUp(self):
self.hero = Hero(name="Bron", title="Dragonslayer",
health=100, mana=100, mana_regen=2)
def test_init(self):
self.assertTrue(isinstance(self.hero, Hero))
def test_known_as(... | true |
8f7a00eefed218a2902d315e772593fc028d1977 | smirarab/1kp | /scripts/genealignmenttree/find-long-branches-2.py | UTF-8 | 2,006 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
'''
Created on Jun 3, 2011
@author: smirarab
'''
import dendropy
import sys
import os
import copy
import os.path
hdir=os.path.dirname(os.path.realpath(__file__))
def mean(data):
"""Return the sample arithmetic mean of data."""
n = len(data)
if n < 1:
raise ValueError('mean r... | true |
c0ecdbd27bfa65b855022eb2e5d5f9c7aaa87e53 | PlamenAngelov/Python-Fundamentals-04-Objects_and_Classes | /000-test0.py | UTF-8 | 135 | 2.609375 | 3 | [] | no_license | firstList = list([5, 6, 10])
secondList = list([5, 6, 10])
print(firstList is secondList) # False
print(firstList is firstList) # True | true |
f1a9507fe93c5ac52477b52bc4250f4ae9da74e1 | gowthamkumanduri/DEV-HL | /experiments/day2tasks/listexperiment.py | UTF-8 | 336 | 3.640625 | 4 | [] | no_license | multi_type_list = ["hi",12,13.99,"bye"]
print(multi_type_list)
for x in range(0,len(multi_type_list)):
a=type(multi_type_list[x]) is float
b=type(multi_type_list[x]) is int
c=type(multi_type_list[x]) is str
if a:
print(multi_type_list[x]+1);
if b:
print(multi_type_list[x]+1);
if c:
print(multi_type_l... | true |
628e23f96ff86b40610fd3627ca993c1abd63e56 | chrismattmann/polyfile | /polyfile/fileutils.py | UTF-8 | 7,221 | 3.09375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | import mmap
import os
import tempfile as tf
import sys
def make_stream(path_or_stream, mode='rb', close_on_exit=None):
if isinstance(path_or_stream, FileStream):
return path_or_stream
else:
return FileStream(path_or_stream, mode=mode, close_on_exit=close_on_exit)
class Tempfile:
def __in... | true |
fc22466932899ab37246b846f110db5201c4c8b1 | heyeon/838_project | /scripts/838-project-analysis.py | UTF-8 | 2,177 | 2.78125 | 3 | [] | no_license | """This script parses and analyzes data from set of `6 experiments ran on 8th Dec, 2012.
These experiments look at enabling and disabling TSO/GRO/GSO with TCP and UDP
Author: Zainab Ghadiyali (zainab@cs.wisc.edu)
"""
import os
import sys
import logging
from prettytable import PrettyTable
from collections import defaul... | true |
175eeb5a9d5851919fc0a624d661898e94377094 | ShekhRaselMasrurAhmmadNissan/URI-Online-Judge | /Beginner/1016_distance.py | UTF-8 | 224 | 3.609375 | 4 | [] | no_license | # Reading the Data...
targated_distance = int(input())
minute_per_km = 2
# Calculating Required Time...
required_time = targated_distance * minute_per_km
# Printing the results...
print('{0} minutos'.format(required_time))
| true |
16c583320b8abb4376a672538d18de1fd2ef5aed | imdeepmind/what-is-the-name-of-this-animal | /process_data.py | UTF-8 | 809 | 3 | 3 | [] | no_license | import os
from sklearn.model_selection import train_test_split
animals = ['cat', 'dog', 'lion', 'tiger', 'elephant']
for animal in animals:
images = os.listdir('data/images/{}'.format(animal))
train, test = train_test_split(images, test_size=0.3)
if not os.path.exists('data/dataset/train/{}'.for... | true |
2cd75e842582662f5e56d3639dd64f517e4f833a | momstouch/programming | /codility/lessons/lesson05_Prefix-Sums/CountDiv.py | UTF-8 | 292 | 2.953125 | 3 | [] | no_license | # https://app.codility.com/programmers/lessons/5-prefix_sums/count_div/
def solution(A, B, K):
beg = (A // K) - (1 if A % K == 0 else 0)
end = B // K
return end - beg
cases = [
((6, 11, 2), 3),
]
for (a, b, k), gt in cases:
assert solution(a, b, k) == gt
| true |
973f7f086eef4e182ae0e32a2c67750ac9e2be3c | SFPD/rlreloaded | /control4/optim/lomqc.py | UTF-8 | 1,801 | 2.796875 | 3 | [
"MIT"
] | permissive | """
Dual gradient descent
"""
import numpy as np
import scipy.optimize as opt
def line_search_armijo(f,xk,pk,gfk,old_fval,c1=.5,min_alpha=1e-10):
alpha = 1
gdotp = pk.dot(gfk)
if VERBOSE: print "%10s %10s"%("alpha","armijo")
while True:
if alpha < min_alpha:
print "WARNING: couldn... | true |
7055577336efbd4057eb60dabe1b60bc48ad34da | lbbquoc/Python-Lab | /Bai1.py | UTF-8 | 1,352 | 4.15625 | 4 | [] | no_license | def FindMax(arr):
max = arr[0]
for i in arr :
if (i > max):
max = i
return max
def Sum(arr):
sum=0
n = len(arr)
for i in range(0,n):
sum+=arr[i]
return sum
def Check_Ascending(arr):
n = len(arr)
flag = False
for i in range(0,n-1):
if(arr[i... | true |
1ebe99ca67a799ef36044ee4a72cf5f872da4346 | edran/code-exercises | /euler/from_more_than_a_decade_ago/Problem27.py | UTF-8 | 2,375 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#Problem 27
#Considering quadratics of the form:
#n² + an + b, where |a| < 1000 and |b| < 1000
#where |n| is the modulus/absolute value of n
#e.g. |11| = 11 and |4| = 4
#Find the product of the coefficients, a and b, for the
#quadratic expression that produces the maximum number of
#primes for... | true |
9d1e8abf8f1b09acf3321fcfe3260ece602016ce | Nathaniel-Rodriguez/neuralnetsim | /src/neuralnetsim/data_loader.py | UTF-8 | 1,881 | 3.171875 | 3 | [
"MIT"
] | permissive | __all__ = ['load_as_matrix', 'load_spike_times',
'save', 'load']
import numpy as np
import pickle
from scipy.io import loadmat
from pathlib import Path
from typing import List
from typing import Any
def load_as_matrix(file_path: Path, key: str) -> np.ndarray:
"""
Opens and loads a matrix from a m... | true |
6f375f950dba55b725b631adc1a802ba64a2b130 | CodeTest-StudyGroup/Code-Test-Study | /wan2good/백준/3주차_스도쿠.py | UTF-8 | 932 | 2.921875 | 3 | [] | no_license | import sys
input=sys.stdin.readline
MIS=lambda:map(int,input().rstrip().split())
board=[];find=[]
for _ in range(9):
board.append(list(MIS()))
for i in range(9):
for j in range(9):
if board[i][j]==0: find.append((i,j))
def remove(x,y):
unique=[1,2,3,4,5,6,7,8,9]
for i in range(9):
if bo... | true |
4720fef7108e2b8fb0d38908719ac049127e7960 | KujouNozom/LeetCode | /python/2020_12/Question0455.py | UTF-8 | 1,680 | 3.96875 | 4 | [] | no_license | # 455. 分发饼干
#
# 假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,每个孩子最多只能给一块饼干。
#
# 对每个孩子 i,都有一个胃口值 g[i],这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 j,都有一个尺寸 s[j] 。如果 s[j] >= g[i],
# 我们可以将这个饼干 j 分配给孩子 i ,这个孩子会得到满足。你的目标是尽可能满足越多数量的孩子,并输出这个最大数值。
#
#
# 示例 1:
#
# 输入: g = [1,2,3], s = [1,1]
# 输出: 1
# 解释:
# 你有三个孩子和两块小饼干,3个孩子的胃口值分别是:1,2,3。
# 虽然你有两块小饼干,由于他们的尺寸都是1,... | true |
8862ceb451777c6f5719703a0d1b7755e0397c43 | LouAlicegary/basketball_reference_scraper | /data_objects.py | UTF-8 | 5,485 | 3.203125 | 3 | [] | no_license | from time import mktime
from datetime import datetime
"""
This class represents a "daily record" comprising a team's win/loss record on a particular date in the season
"""
class DailyRecord(object):
teamList = [u'Los Angeles Lakers', u'Chicago Bulls', u'San Antonio Spurs', u'Philadelphia 76ers', u'Detroit P... | true |
8dac68e19c24a3b24ed02266cd63af8b195cba57 | qmpedro/MsSqlProvider | /Conecta.py | UTF-8 | 1,122 | 3.21875 | 3 | [] | no_license | import pyodbc
class Conecta:
bd = str()
banco = str()
login = str()
senha = str()
query = str()
def __init__(self):
self.inicio()
def inicio(self):
self.bd = input("Servidor: ")
self.banco = input("Banco: ")
self.login = input("Login: ")
self.senha = input("Senha: ")
self.dados()
def dados(self... | true |
c8c0672cf776f3fbe12846e869f36189c705a058 | aliakseik1993/skillbox_python_basic | /module1_13/module9_hw/task_8.py | UTF-8 | 1,763 | 4.15625 | 4 | [] | no_license | print('Задача 8. Колонтитул')
# Нам нужно написать программу для печати важных объявлений.
# Сверху объявления должен располагаться вот такой колонтитул:
# ~~~~~~~~~~!!!!!!~~~~~~~~~~
# Восклицательные знаки всегда располагаются по центру строки,
# причём в зависимости от важности объявления количество восклицательных... | true |
257a31672514dbc7a0416dab576d2ef6af969936 | Luthey-Schulten-Lab/Lattice_Microbes | /pylm-examples/example-MichaelisMenten.py | UTF-8 | 3,248 | 2.765625 | 3 | [] | no_license | from pyLM import *
from pyLM.units import *
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('-o', '--outputFile', required=True)
args = ap.parse_args()
import logging
LMLogger.setLMLogConsole(logging.WARNING)
# Create our RDME Simulation object
# Here we define an RDME simulation including the inita... | true |
6eec24a75e0304e73ea1727f1af5fb34c48b3ad7 | bt2016/ece4534_team4 | /Merged/Simulator/sensorDisplay.py | UTF-8 | 9,585 | 3.140625 | 3 | [] | no_license |
#sensorDisplay.py
#imports
import random,sys
import math
import matplotlib.pyplot as plt
def appendMap(message):
try:
r = ord(message[3])
theta = ord(message[4])
x = ord(message[5])
y = ord(message[6])
f = open("fullmap.txt", 'a')
f.write(str.format("\n{0} {1} {2} ... | true |
94be6c5f4bf1f3e9782777411b7a36eaad845e64 | clockworksspheres/ramdisk | /src/examples/menu.py | UTF-8 | 2,703 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env -S python -u
"""
@author: Roy Nielsen
"""
#--- Native python libraries
import sys
from optparse import OptionParser, SUPPRESS_HELP
sys.path.append("../")
#--- non-native python libraries in this source tree
import ramdisk
from ramdisk.lib.run_commands import RunWith
from ramdisk.lib.loggers import CyLog... | true |
14188bef21450e11e2859d9fecd9f105e8e57132 | ilov4tx/learnPython | /qiubai.py | UTF-8 | 1,009 | 2.78125 | 3 | [] | no_license | import urllib.request
import re
url = 'https://www.qiushibaike.com/'
user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64)'
headers = {'User-Agent':user_agent}
try:
request = urllib.request.Request(url,headers=headers)
respone = urllib.request.urlopen(request)
#print(respone.read())
content =... | true |
ab6b11b78eb0425d00a9d5351ed780ef4747c839 | dabini/BOJ | /2578_빙고.py | UTF-8 | 2,350 | 3.171875 | 3 | [] | no_license | #1번 문제 풀이
# def check(cnt):
# result = 0
# result += bingo.count([0, 0, 0, 0, 0])
# if result >= 3:
# print(cnt)
# return True
# for i in range(5):
# for j in range(5):
# if bingo[j][i] != 0:
# break
#
# else:
# result += 1
# ... | true |
079902cf52da2a0b3fa431cf016a9fb2c5060397 | HandsomeBrotherShuaiLi/QAGeneration | /checker.py | UTF-8 | 2,410 | 2.703125 | 3 | [] | no_license | '''
@author: Shuai Li
@license: (C) Copyright 2015-2025, Shuai Li.
@contact: li.shuai@wustl.edu
@IDE: pycharm
@file: checker.py
@time: 12/9/20 23:35
@desc:
'''
import json, tqdm
def getNumofCommonSubstr(str1, str2):
lstr1 = len(str1)
lstr2 = len(str2)
record = [[0 for i in range(lstr2 + 1)] for j in rang... | true |
c239d2341dc39126d1cd1d9ac9b32b53f406404b | rahaf19-meet/yl1201718team6 | /ball.py | UTF-8 | 790 | 3.734375 | 4 | [] | no_license | from turtle import *
class Ball(Turtle):
def __init__(self,x,y,dx,dy,r,color):
Turtle.__init__(self)
self.penup()
self.goto(x,y)
self.dx=dx
self.dy=dy
self.r=r
self.shape("circle")
self.shapesize(r/10)
self.color(color)
def move(self, screen_width, screen_height):
current_x=self.xcor()
new_x... | true |
a686f40d1adbf4318429905b583cd3ecec572333 | huyuji/garden | /foobar/l3-3.py | UTF-8 | 2,277 | 2.859375 | 3 | [] | no_license | import fractions
def solution(m):
stateCount = len(m)
totals = [0] * stateCount
A = []
I = []
for i in range (stateCount):
I.append([])
A.append([])
stateTotal = sum(m[i])
totals[i] = stateTotal
if (stateTotal == 0):
for j in range (stateCount):
... | true |
8146fc14eeeb10ce6a13f280dc4228ce14c7974c | sivanspsiva/works | /4select_frame.py | UTF-8 | 559 | 3.171875 | 3 | [] | no_license | #Importing Libraries
import cv2
import shutil
#Create a VideoCapture Object and read from input file
cap=cv2.VideoCapture("Road.mp4")
#To Conert from float to integer
frames=int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
shutil.copy("Road.mp4","/home/dell/PycharmProjects")
print("Total Frames is: ",frames)
while True:
has_... | true |
bf585171eab7089c102e721d1aba5092bfba32dc | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4377/codes/1692_1102.py | UTF-8 | 1,439 | 2.796875 | 3 | [] | no_license | #alturadotanque
al=float(input("H"))
#niveldecomb
n=float(input("n"))
#raio
r=float(input("r"))
from math import*
if(al and n and r>0):
if(2*r >= al or n> al):
print("Entradas:", al, ",", n , ",",r)
print("Entradas invalidas")
elif(n<r):
v=( pi/3 * n ** 2) * (3* r -n)
v=v*1000
print("Entradas:", al, ",", ... | true |
ffb1bf1e3c2e2fca53aa2c02941595d5813c449f | mfeliu/gelpia | /src/frontend/function_transforms/parsed_constant_lift_pass.py | UTF-8 | 2,402 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from lexed_to_parsed import *
from parsed_input_lift_pass import *
import sys
from parsed_passes import BINOPS, UNIOPS
def lift_constants(exp, inputs):
consts = list()
def make_constant(exp):
try:
i = consts.index(exp)
except ValueError:
i = l... | true |
47b3d9bae47a5463e7013175230d54c325ac99f1 | waitalone/dnn-time-series | /dnntime/tests/etl_test.py | UTF-8 | 14,386 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import pytz
import re
from typing import Dict
def validate_etl(key_name: str, config: Dict) -> None:
"""
Validate the subkeys of this particular ETL config block.
Parameters
----------
key_name : The root key that maps to this ETL config block.
config : The contents in... | true |
b263534d87de5bb70648ec3d1a276dbcb5850898 | L-Miracle/nonebot2 | /nonebot/adapters/__init__.py | UTF-8 | 11,989 | 3.0625 | 3 | [
"MIT"
] | permissive | """
协议适配基类
============
各协议请继承以下基类,并使用 ``driver.register_adapter`` 注册适配器
"""
import abc
from functools import reduce, partial
from dataclasses import dataclass, field
from nonebot.config import Config
from nonebot.typing import Driver, Message, WebSocket
from nonebot.typing import Any, Dict, Union, Optional, NoRetur... | true |
417cf50f71fc90252012066cd097747e4393d070 | rafaelperazzo/programacao-web | /moodledata/vpl_data/428/usersdata/284/87551/submittedfiles/jogoDaVelha.py | UTF-8 | 448 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from jogoDaVelha_BIB import *
# COLOQUE SEU PROGRAMA A PARTIR DAQUI
def jogadaHumana(tabuleiro):
movimento = 0,0
for x in range (0,3):
for y in range (0,3):
print('%d %d ' % (x,y))
while movimento not in '1 2 3 4 5 6 7 8 9'.split() or not vazio(tabuleiro... | true |
16b9289713f66c6e0dfc2ec38469ba61df4b78dc | apache/ctakes | /ctakes-temporal/src/user/resources/org/apache/ctakes/temporal/scripts/nn/cnn_train.py | UTF-8 | 3,128 | 2.5625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
import numpy as np
np.random.seed(1337)
import sys
import os.path
import dataset
from keras.utils.np_utils import to_categorical
from keras.optimizers import RMSprop
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
from keras.layers import Merge
from kera... | true |
a4d15155b0033fc86dba635ba966278c68589740 | happy519/cs136_project | /base_agent.py | UTF-8 | 1,530 | 3.078125 | 3 | [] | no_license | import random
class BaseAgent(object):
# BaseAgent - other agent classes should subclass this agent
def __init__(self,
id, budget, true_alpha=1, true_beta=1, noise=0., alpha=1, beta=1):
self.id = id
self.budget = budget
self.alpha = alpha # ignore true alpha and beta values
... | true |
6ea6bd8e6a7649e85a0870521c9dc6fbce37e4b0 | gitBowei/Learning-Python-Networking-Second-Edition | /chapter10/non-blocking/tcp_server_selectors.py | UTF-8 | 1,959 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import selectors
import types
import socket
selector = selectors.DefaultSelector()
def accept_connection(sock):
connection, address = sock.accept()
print('Connection accepted in {}'.format(address))
# We put the socket in non-blocking mode
connection.setblocking(False)
data... | true |
57fa44ee17719cceb1e6ffbc4588e42f59db316a | amitamola/Hackerrank-codes | /Check Strict Superset.py | UTF-8 | 316 | 3.0625 | 3 | [] | no_license | '''
https://www.hackerrank.com/challenges/py-check-strict-superset/problem
'''
setA = set(map(int , input().split()))
final = True
for a in range(int(input())):
setB = set(map(int , input().split()))
if len(setB-setA)==0 and len(setA-setB)>0:
pass
else:
final = False
print(final)
| true |
47c2aac2f49269747a58e40f5c0c84202c58dd55 | KewinEvers96/tournamentManagerNWK | /scripts/dbFiller.py | UTF-8 | 1,374 | 2.625 | 3 | [] | no_license | import json
from datetime import date, timedelta
from tournament.models import Competitor, Tournament
from django.contrib.auth.models import User
def run():
with open("scripts/users.json", "r") as json_doc:
users_json = json.load(json_doc)
competitors = []
for user in use... | true |
0b3c4f3cef6f70fc282759b6a9d5a7c14ae9d564 | nextdesusu/Learn-Python | /SICP/examples/serializer.py | UTF-8 | 1,520 | 3.046875 | 3 | [] | no_license | def clear(cell):
cell[0] = False
def test_and_set(cell):
if cell[0]:
return True
cell[0] = True
return False
def make_mutex():
class Mutex:
cell = [False]
def acquire(self):
if test_and_set(self.cell):
retu... | true |
b3bac1f9a4b0e8759cefc99120b90a76d0e5a71f | srangar/flyonthewall | /fly_on_the_wall/message_broker.py | UTF-8 | 672 | 2.8125 | 3 | [
"MIT"
] | permissive | import os
import boto3
import json
from botocore.config import Config
class MessageBroker:
def __init__(self, queue_name):
self.queue_name = queue_name
def enqueue(self, message: dict):
config = Config(retries={"max_attempts": 10, "mode": "standard"})
sqs = boto3.resource(
... | true |
4e8e373321f6edaff26cd44a22a44e3dc79ad744 | tanyacui/pdftoimage | /water_test.py | UTF-8 | 459 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
#coding: utf-8
from PIL import Image
imageSrc = Image.open("./target/page-10.jpg")
logo = Image.open("./water_logo/water_mark_test.png")
logo_mask = logo.convert("L").point(lambda x: min(x, 35))
logo.putalpha(logo_mask)
# 循环遍历水印
for i in range(0, 3):
for j in range(0, 3):
x = 33 + ... | true |
9b0d7d8a9ba5fde81ca5b2bb4a24927404d8043d | zoomie/algorithms_practise | /python/stack.py | UTF-8 | 469 | 4.40625 | 4 | [] | no_license |
class Stack:
def __init__(self, first_element):
self.data = []
self.current_min = first_element
def add(self, item: int):
if item < self.current_min:
self.current_min = item
self.data.append(item)
def pop(self) -> int:
return self.data.pop()
def mi... | true |
2a3d2cbb56e92a11add28570315ef8b21120a514 | kapitonik/panini | /panini/middleware/writer_emulator_middleware.py | UTF-8 | 3,733 | 2.765625 | 3 | [
"MIT"
] | permissive | import json
import os
import threading
import time
import collections
from datetime import datetime
from typing import Any
from panini import middleware
from panini.app import get_app
class _Writer(threading.Thread):
def __init__(self, filename: str):
threading.Thread.__init__(self)
self._array... | true |
3e4ad9b1d52fe9e0ede2fe027de0d6d6d30e1e11 | nbakh16/spot-painting-generator | /main.py | UTF-8 | 1,230 | 3.765625 | 4 | [] | no_license | import turtle
import random
my_turtle = turtle.Turtle()
my_turtle.speed("fastest")
my_turtle.penup()
my_turtle.hideturtle()
turtle.Screen().setup(width=700, height=700)
turtle.colormode(255)
# generating random color
def random_color_generator():
r = random.randint(0, 255)
g = random.randint(0, 255)
b =... | true |
d38376a35a18ea20c414463d0d36fdbfdb81cd33 | DevinduDh/Hackerrank-Problem-Solving | /Between-Two-Sets.py | UTF-8 | 609 | 3.578125 | 4 | [] | no_license | # Between two sets
a = [1]
b = [72, 48]
n = len(a)
m = len(b)
X = min(b)
Y = max(a)
X1 = []
X2 = []
for i in range(1, X + 1):
# print("i = {}".format(i))
for ele in b:
# print("ele = {}".format(ele))
if ele % i == 0:
X1.append(i)
X1_final = [k for k in X1 if X1.count(k) == m]
te... | true |
9259f2c6533153052e21a2dcdce147a048187721 | daniuniuniuniu/Optimization-on-Markowitz-Portfolio-Theory | /bin_data.py | UTF-8 | 1,641 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 13:47:07 2018
@author: Zhengqian Xu
"""
## import library
import pandas as pd
import numpy as np
## main function
def main():
#### load data
df1 = pd.read_csv("returns.csv",index_col = 0)
#### get the column name of data
... | true |
ed4b931e0456274d5679bbc9157fa1886921b66f | ynzheng/PureQuant | /purequant/trade/okexfutures.py | UTF-8 | 31,195 | 2.875 | 3 | [
"MIT"
] | permissive | """
okex交割合约
https://www.okex.com/docs/zh/#futures-README
Author: Gary-Hertel
Date: 2020/10/27
email: purequant@foxmail..com
"""
import time
from purequant.exchange.okex import futures_api as okexfutures
from purequant.config import config
from purequant.exceptions import *
from purequant.logger import logger
class... | true |
0dd0077478de0f108d4412936d9e4d9ff627db38 | BioGearsEngine/biogears_dataplayer | /converters/convert_datafile.py | UTF-8 | 3,692 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import os
import json
from math import floor
from lttb import largest_triangle_three_buckets
downsample_amounts = {
'HeartRate(1/min)': 0.01,
'HeartStrokeVolume(mL)': 0.03,
'ExtravascularFluidVolume(L)': 0.02,
'BloodVolume(mL)': 0.001,
'ArterialPressure(mmHg)': 0.1,
'MeanArterialPressure(mmHg)... | true |
11e2fee23b1bd618daeaec499bc3f24329060ee9 | foodwastemanager/RPi-GCP-Script | /hardware_interface.py | UTF-8 | 1,979 | 2.84375 | 3 | [] | no_license | import RPi.GPIO as GPIO
from picamera import PiCamera
from PIL import Image
from time import sleep
import image_forward as vision
GPIO.setmode(GPIO.BOARD)
#Establish which button is for which
confirm = 12
cancel = 16
#Setup Camera
camera = PiCamera()
camera.resolution = (640, 480)
GPIO.setup(confirm, GPIO.IN, pull_... | true |
f2f6987e9de76cad3c4cd86bb35740542ad39b56 | ehdgua01/Algorithms | /coding_test/programmers/stack_queue/stock/test.py | UTF-8 | 440 | 2.59375 | 3 | [] | no_license | import unittest
from .solution import solution
class TestCase(unittest.TestCase):
def test_solution(self):
self.assertEqual(
solution([1, 2, 3, 2, 3]),
[4, 3, 1, 1, 0],
)
self.assertEqual(solution([0, 0, 0, 0, 0]), [4, 3, 2, 1, 0])
self.assertEqual(
... | true |