blob_id
large_string
language
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
ef374502289c5bfa390c868be416d362de0ab621
Python
carlosdlfuente/PhraseDep
/python/encoder.py
UTF-8
7,264
2.90625
3
[]
no_license
""" This file implements an Encoder for lexicalized parsing. Its job is to map between lexicalized trees and the parts representation as annotated spans. """ from collections import defaultdict import pydecode from pydecode.encoder import StructuredEncoder from nltk import ImmutableTree as Tree import numpy as np from ...
true
9a6653c0c1e5d45956ead7d54da5fd2a77c7f0fb
Python
sam-rossin/auction-simulator
/auction_simulator.py
UTF-8
7,011
2.625
3
[]
no_license
#an auction simulator #Sam Rossin #fall 2015 import bidding_agent import user_interface import card import random import string import os import inspect import importlib import signal from contextlib import contextmanager #game constants NUM_ROUNDS = 10 STARTING_BUDGET = 1000 CARDS_PER_AGENT = 10 #scoring constants ...
true
c55feceeb38e72e75a06e98ac0a51f3092e411e6
Python
nasgoncalves/opentracing-tutorial
/lesson02/exercise02/__main__.py
UTF-8
1,490
2.625
3
[]
no_license
import logging import sys import time from jaeger_client import Config def init_tracer(service): logging.getLogger('').handlers = [] logging.basicConfig(format='%(message)s', level=logging.DEBUG) config = Config( config={ 'sampler': { 'type': 'const', ...
true
3c81f11042d68b9af9da5235784b0068c7b7dd83
Python
heni-l/DenseNet121
/data_load.py
UTF-8
2,728
2.609375
3
[]
no_license
import torch from PIL import Image import numpy as np import pandas as pd from torchvision import transforms from torch.utils.data import Dataset from sklearn.model_selection import train_test_split torch.manual_seed(1) transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), tra...
true
5d99371d591ae83303ace38f35e875e779a17fa6
Python
JAGANPS/ml-lab
/pgm2.py
UTF-8
903
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Sep 9 10:01:24 2019 @author: ADMIN """ from sklearn.cluster import KMeans #from sklearn import metrics import numpy as np import matplotlib.pyplot as plt import pandas as pd data=pd.read_csv("km1.csv") df1=pd.DataFrame(data) print(df1) f1=df1['Distance_Featur...
true
5daaeaf1144217886f8faca118a5ac38e3f1593d
Python
amitpanda93/MACBackup
/Data Science/Notebooks/pandas_e2.py
UTF-8
431
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 21 14:41:22 2019 @author: amit.panda03 """ import pandas as pd import numpy as np df = pd.DataFrame([[18,10,5,11,-2], [2,-2,9,-11,3], [-4,6,-19,2,1], [3,-14,1,-2,8], [...
true
84d1922cfb697edfc5f3e2d770e9082d9c74f998
Python
allen-studio/learn-python3-records
/ex38.py
UTF-8
1,194
4.125
4
[]
no_license
ten_things = "Apple Oranges Crows Telephone Light Sugar" print("Wait there are not 10 things in that list. Let's fix that.") stuff = ten_things.split(' ') # 通过split把句子的空格拆成列表 print(stuff) #打印确认已经是列表了 more_stuff = ["Day", "Night", "Song", "Frisbee", "corn", "Banana", "Girl", "Boy"] while len(stuff)!= 10:...
true
75f481715ea3e94879394c0818db06452b4d91df
Python
AllenMostafa/project-euler-
/p12_Highly_divisible_triangular_number.py
UTF-8
1,047
4.375
4
[]
no_license
# Project Euler --> https://projecteuler.net/problem=12 # Problem 12 : Highly divisible triangular number #STEP 1: We want to create a function that calculates the first 7 triangular #STEP 2: Create a function that returns the factors of each traingular #STEP 3: store the length of the factors and when reach to to 500 ...
true
56a6d188fc7c2db25959d16922a44b300140b322
Python
amadeus4dev/amadeus-python
/amadeus/client/response.py
UTF-8
1,253
3.03125
3
[ "MIT" ]
permissive
from amadeus.mixins.parser import Parser class Response(Parser, object): ''' The response object returned for every API call. :var http_response: the raw http response :var request: the original Request object used to make this call :vartype request: amadeus.Request :var result: the parsed ...
true
2c64aa987fb60710b4c1f47d0837853f3dc232fa
Python
khlidar/Concrete_Beam_Program
/Shapes.py
UTF-8
5,457
3.46875
3
[]
no_license
''' Description: Definition of shapes class and sup classes Information on authors: Name: Contribution: --------- ------------------ Jacob Original code Kristinn Hlidar Gretarsson Original code Version histo...
true
7222cb1908a1b5ef98ee5c827ad19151f97546fa
Python
tmoertel/practice
/misc/weighted_stream_selection.py
UTF-8
3,744
4.15625
4
[]
no_license
"""Write a function to generate a weighted random sample from a stream.""" import random def select_weighted_value(weighted_values): """Return a randomly selected value from a stream of weighted values. Args: weighted_values: an iterable stream of (w, x) pairs, where w is a non-negative integer...
true
e90b9efe51b16d6ffe64f9337dc516f808511d52
Python
ana-balica/nosnore
/nosnore/core/signal.py
UTF-8
1,237
2.90625
3
[]
no_license
import numpy as np import pylab as pl from scipy.io import wavfile def getwavdata(filename): return wavfile.read(filename) def savewavdata(filename, rate, data): wavfile.write(filename, rate, data) class Signal(object): def __init__(self, signal, time): self._signal = signal self._siz...
true
db1f3e3e5a8e9a322e5513fac245fe40f08c86de
Python
green-fox-academy/FulmenMinis
/week-03/day-03/purple_steps.py
UTF-8
436
3.1875
3
[]
no_license
from tkinter import * root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # reproduce this: # [https://github.com/greenfox-academy/teaching-materials/blob/master/workshop/drawing/purple-steps/r3.png] #19 db 11x11 px def drawing_function(x, y): canvas.create_rectangle(x, y, x+11, y+11, fill...
true
1bdf6aa2cba5b399f340fa47b2591d70b4452ec3
Python
Dnoniel-Ermolaev/python-deep-learning-test
/doge_class.py
UTF-8
4,960
2.578125
3
[]
no_license
""" Classification sample Command line to run: python ie_classification_sample.py -i image.jpg \ -m squeezenet1.1.xml -w squeezenet1.1.bin -c imagenet_synset_words.txt """ import os os.add_dll_directory("C:\\Program Files (x86)\\Intel\\openvino_2021.4.689\\deployment_tools\\ngraph\\lib") os.add_dll_directory("C:\\...
true
c5179166b150a9223fb60df750fbf27360af60ca
Python
3enoit3/tools
/gen/gen.py
UTF-8
1,051
2.96875
3
[]
no_license
# Input def split_lines(iInput): return [l.rstrip("\n") for l in iInput.split("\n") if l] def merge_lines(iInput, iLines = 1): l = split_lines(iInput) o = [] while l: o.append( ' '.join(l[:iLines]) ) del l[:iLines] return o # Output def as_input(): return lambda s, c: s def s...
true
69a0eee3e8f4444352d47cb1aba84b828e0eb622
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2916/58575/304882.py
UTF-8
1,317
2.625
3
[]
no_license
n=int(input()) nums=list(map(int,input().split(" "))) deleteNumber=0 i=len(nums)-1 while i>=5: if nums[i]==42: judge=False j=i-1 while j>=4 and judge==False: if nums[j]==23: k=j-1 while k>=3 and judge==False: if nums[k]==16: ...
true
5c418bbcc2250748f3191141b20399318b86e8a9
Python
jkuzm/2020repo
/pythonViaPycharm1/testDecorator.py
UTF-8
1,918
4.0625
4
[]
no_license
def fib_gen(limit): i,a,b =0,0,1 while(i < limit): yield a a,b = b,a+b i += 1 for i in fib_gen(10): print(i, end= " ") print() #simplest decorator sample from https://medium.com/@dmi3coder/pythons-decorators-vs-java-s-annotations-same-thing-2b1ef12e4dc5 def as_html(func): def ...
true
2f3ce1a3c8eb8c836d969001bd89eb41e1e882e8
Python
geverartsdev/TechnofuturTIC
/Flo et toto/Pong/components/score.py
UTF-8
1,019
2.921875
3
[ "MIT" ]
permissive
import pygame from pygame.locals import Color from Pong.constants import ECRAN class Score(pygame.sprite.Sprite): color = Color('green') def __init__(self, left): pygame.sprite.Sprite.__init__(self, self.containers) self.font = pygame.font.Font(None, 30) self.font.set_italic(1) ...
true
d65157b5d744d19af3752806b7f1049f1deadab8
Python
ahndroo/Udemy
/SupervisedML/util.py
UTF-8
1,335
3.171875
3
[]
no_license
import numpy as np import pandas as pd def get_train_data(limit = None): print('Reading in and transforming data...') df = pd.read_csv('MNISTtrain.csv') data = df.as_matrix() np.random.shuffle(data) X = data[:,1:] / 255.0 # normalize data Y = data[:,0] if limit is not None: X, Y = X...
true
035d72045751f6f3bb66094db564b5b45431446f
Python
hehaiyang111/MLAlgorithm
/apriori/analysisByapriori.py
UTF-8
564
2.59375
3
[]
no_license
import pandas as pd from apriori import * # inputFile inputFile = './menu_orders.xls' outputFile = './apriori_rules.xls' # 结果 # 读取数据 data = pd.read_excel(inputFile,header=None) # 把不为空的数据设置为1 ct = lambda x : pd.Series(1, index=x[pd.notnull(x)]) b = map(ct,data.as_matrix()) # 实现矩阵转换 空值用0补充 data = pd.DataFrame(list(b))...
true
33d5c074d7b9d862bf0b524dde91030d8efc4697
Python
rajlath/rkl_codes
/CodeForces/distance.py
UTF-8
325
3.515625
4
[]
no_license
a = 10 b = 20 weakness = 0 if abs(a - b) == 1: print(1) elif abs(a - b) == 2: print(2) elif a == b:print(0) else: weakness = 0 while True: a+=1 b-=1 weakness += 2 if a == b: break if abs(a - b) == 1: weakness += 2 break print(weakne...
true
c82d9af22d63201f54608c413d335cc0b2997f90
Python
ogosborne/fasta_alignment_filters
/cat_alns.py
UTF-8
2,499
3.15625
3
[]
no_license
#!/usr/bin/python2 from Bio import AlignIO import glob from Bio.Align import MultipleSeqAlignment from Bio.SeqRecord import SeqRecord import argparse import sys parser = argparse.ArgumentParser(usage = 'python2 cat_alns.py -o STR -t STR [-i STR -h]\n\nPython 2 only\n\nRequires: Bio, glob, argparse\n\nThis program c...
true
242a06cc55e47a16a02d345207eb79d4883539c5
Python
andrejcermak/twitter_downloader
/dat.py
UTF-8
6,750
2.625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import MySQLdb import json import oauth2 as oauth import time import re import pandas as pd from collections import defaultdict ''' Script that downloads tweets. user_timeline() downloads 200 tweets for given user my_timeline() downloads 200 tweets from clients timeline ...
true
85dfa01c7d7e90744f2d3807de29f1e91c5317eb
Python
searchlink/kr_data
/A股指数回测分析系统/H股_处理.py
UTF-8
8,576
2.53125
3
[]
no_license
import time,datetime import talib # import numpy as np import pandas as pd from KRData import CNData ,HKData # np.seterr(divide='ignore', invalid='ignore') # # pd_display_rows = 10 # pd_display_cols = 100 # pd_display_width = 1000 # pd.set_option('display.max_rows', 10000) # pd.set_option('display.max_columns', 100) #...
true
c7c49f527ad1093e5b1010060e97f6c9de63fe47
Python
cchaisson/Python-Challenge
/PyPoll/PyPoll_Hmwk.py
UTF-8
1,338
3.4375
3
[]
no_license
#Import the os module import os #Module for reading CSV files import csv csvpath = os.path.join('..','election_data.csv') #Lists to store data candidate=[] total=0 khan=0 correy=0 li=0 otooley=0 with open(csvpath,newline="") as csvfile: csvreader = csv.reader(csvfile, delimiter=",") csvheader = next(csvfile) #...
true
83917516318f1633f3cba4f3bbad639b77bc6d02
Python
gabalese/tweet-a-book
/test/test_pyepub.py
UTF-8
3,633
2.6875
3
[ "MIT" ]
permissive
import unittest import urllib2 from tempfile import NamedTemporaryFile from StringIO import StringIO from src.epub import EPUB class EpubNewTests(unittest.TestCase): def setUp(self): remotefile = urllib2.urlopen('http://dev.alese.it/book/urn:uuid:c72fb312-f83e-11e2-82c4-001cc0a62c0b/download') tes...
true
4239e00230c17a3d01c0adfc4057eac587c97da7
Python
muftring/iu-python
/module-07/Question2.py
UTF-8
1,509
4.40625
4
[]
no_license
#!/usr/bin/env python3 # # Michael Uftring, Indiana University # I590 - Python, Summer 2017 # # Assignment 7, Question 2 # # A program which promts the user for a list of numbers, then determines if # the list is ordered (ascending or descending) and displays the result. # import math # """ isAscend(nums): check whet...
true
8ef5202999de5858fe7a60427571f2d6eb1e8038
Python
kamojiro/atcoderall
/grand/025/A.py
UTF-8
199
2.921875
3
[]
no_license
def kakuwa(S): A = list(str(S)) B = [int(x) for x in A] return sum(B) N = int(input()) ans = 50 for i in range(1,N): ans = min(ans, kakuwa(i) + kakuwa(N-i)) print(ans)
true
8b80875e5f19bf27de6058bae5a936d35935918d
Python
Joselyn19/GUI-Software-Development
/main.py
UTF-8
18,885
2.671875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from tkinter.messagebox import * import tkinter.filedialog from tkinter import* import os import socket import webbrowser from ftplib import FTP import XPS_Q8_drivers import sc10 import sys import time class IPSetupPage(object):# IP地址修改页面 def __ini...
true
bc09d897c4a3111e76d9f69ff5a88cfea126b670
Python
sidazhong/leetcode
/leetcode/easy/155_minStack.py
UTF-8
2,070
4.09375
4
[]
no_license
''' # tuple push比较上一个与当前,存最小 class MinStack(object): def __init__(self): self.stack=[] def push(self, val): if(not self.stack): item=(val,val) else: item=(val,min(val,self.stack[-1][1])) self.stack.append(item) def pop(self): return self.st...
true
25ed58147387a6215a5fbf22085ecf41888a36c3
Python
rv-kesnyder/ita-challenges-2020
/python-week-1/07-for-loops.py
UTF-8
168
2.71875
3
[]
no_license
def even_nums(numbers, even_numbers): # numbers is the list of all numbers # even_numbers is the empty list, that holds only the even numbers. # Your code in here.
true
f24e496bf3636dfa141543035c2963402d87b0f0
Python
Cjkendel/Lower-Bound-Estimation
/main.py
UTF-8
601
2.59375
3
[]
no_license
from LocalVariationalBoundsVectorized import EstimateLowerBound from LogisticRegression import LogisticReg if __name__ == "__main__": #JJ Bound Estimation lower = EstimateLowerBound(batch_size=1, full_batch=False, n_batch=False) # lower.call_and_write_results(10000) # Torch Logistic Regression, get p...
true
4acf52e6238fc0108481b32f6ac9b8b6d9c84206
Python
zgmartin/minset-cover
/min_inventory_checks.py
UTF-8
627
3.234375
3
[]
no_license
from objects import Data from algorithms import greedy import sys def min_inventory_check(file_name): """Returns a list of the minimum number of inventory checks for an input file.""" #generates usable data from JSON file input_data = Data() input_data.extract_data(file_name) #runs greedy algori...
true
82601c806636d0bce3741ddffcc1094b0579dfe2
Python
kalloc/insanities-testing
/tests/utils/odict.py
UTF-8
616
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- import unittest from insanities.utils.odict import OrderedDict class OrderedDictTests(unittest.TestCase): def test_pop_with_default(self): d = OrderedDict([('a', 'a'), ('b', 'b')]) self.assertEqual(d.pop('a', ('c', 'c')), ('a', 'a')) self.assertEqual(len(d.items()...
true
3a9d17d0d764972501c6303a86f648ddae245496
Python
littlemesie/recommend-learning
/src/dssm/data_process.py
UTF-8
2,819
2.859375
3
[]
no_license
import json UNK = '[UNK]' PAD = '[PAD]' MAX_SEQ_LEN = 10 class Processor: """数据处理""" def __init__(self, vocab_path): self.vocab_path = vocab_path self.vocab_map = self.load_vocab() self.nwords = len(self.vocab_map) def load_vocab(self): """加载vocab数据""" word_dict...
true
bc48b3c5035e9b2273aefbbf5457139e43b70128
Python
chrisjluc/algorithms
/graphs/tests/test_topsort.py
UTF-8
867
3.203125
3
[]
no_license
from graphs.topological_sort import * from graphs import util from graphs.graph import Graph import unittest graph1 = Graph() for v in [0, 1, 2, 3, 4, 5]: graph1.add_node(v) graph1.add_edge(5, 2) graph1.add_edge(5, 0) graph1.add_edge(4, 0) graph1.add_edge(4, 1) graph1.add_edge(2, 3) graph1.add_edge(3, 1) graph2 =...
true
881bbf4985be61764786f67b1cd7490d724e8305
Python
ananxuan/web_crawler
/百度贴吧_spider.py
UTF-8
2,562
2.6875
3
[]
no_license
# -*- coding:utf-8 -*- import urllib import urllib2 import re #百度贴吧爬虫类 class BDTB: #初始化,传入基地址,是否只看楼主参数 #URLADDR:http://tieba.baidu.com/p/3138733512?see_lz=1&pn=1 def __init__(self,baseURL, seeLZ): self.baseURL=baseURL self.seeLZ= '?see_lz=' +str(seeLZ) #传入页码,获取该页帖子的代码 def getpage(self,pageNum...
true
33a695384b9ae8f9db030ba9f993681856d81d0b
Python
bruzecruise/Intro_Biocom_ND_319_Tutorial10
/exercise_10_B.py
UTF-8
4,031
2.703125
3
[]
no_license
#Load packages import pandas import scipy import scipy.integrate as si from plotnine import * # function def SIR (y,t0,beta,gamma): S = y[0] I = y[1] R = y[2] dS = -1*(beta*I*S) dI = (beta*I*S)-(gamma*I) dR = (gamma*I) return dS, dI, dR # initial conditions times = range(0,500) NO = [999, ...
true
3399ccffb3fa8f15d63fe0b50b6398472d9112e5
Python
ywzyl/algorithm013
/Week_01/twoSum.py
UTF-8
990
3.78125
4
[]
no_license
class Solution: def twoSum(self, nums, target): # 思路:嵌套遍历,内层遍历只遍历外层index之后的列表,排除重复,时间复杂度为O(n*2) for i in range(len(nums)): for j in range(i+1, len(nums)): if nums[i] + nums[j] == target: return [i, j] return [] def twoSumT(self, nums, tar...
true
aa24e792ae5d84148feb9fba91257416d5aedd39
Python
shen-huang/selfteaching-python-camp
/19100402/Autumn0808/1001S01E05_array.py
UTF-8
642
4.125
4
[]
no_license
mylist = [0,1,2,3,4,5,6,7,8,9] print(mylist) #将mylist数组反转 list1 = mylist[::-1] print(list1) #反转后的数组拼接成字符串 ##用map()将list1中的元素一一映射为str并拼接成新的字符串 str1 = "".join(map(str,list1)) print(str1) #用字符串切片的方式取出第三到八个字符,包含三和八 str2 = str1[2:7] print(str2) #将获得的字符串进行反转 str3 = str2[::-1] print(str3) #将结果转换为int类型 str4 = int(str3) print(s...
true
1663fb886939d93213ea426d65f00d9740476bc9
Python
sungguenja/studying
/sort/퀵정렬.py
UTF-8
710
3.59375
4
[]
no_license
def quick_sort(a,low,high): if low < high: pivot = partition(a,low,high) quick_sort(a,low,pivot-1) quick_sort(a,pivot+1,high) def partition(a,pivot,high): print("start partition",a,pivot,high) i = pivot + 1 j = high while True: while i<high and a[i] < a[pivot]: ...
true
26a6060ac8f32b1277ac8bf5cf2b3ba31d6ff938
Python
Atsuhiko/Web-App
/facial-expression/second Iisan/app/app.py
UTF-8
4,245
2.53125
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import random from flask import Flask, make_response,render_template, request, redirect, url_for, send_from_directory, g, flash, jsonify from keras.preprocessing.image import load_img import numpy as np import cv2 import matplotlib.pyplot as plt from tensorflow....
true
c85796971dddb19c55f4a959bf8a4ea62d15067a
Python
yearfunla/ML5155
/sampling.py
UTF-8
6,091
2.703125
3
[]
no_license
""" Course: CSI5155 Tiffany Nien Fang Cheng Group 33 Student ID: 300146741 """ import json import numpy as np import pandas as pd from scipy.io import arff as af import arff from sklearn.impute import SimpleImputer from imblearn.over_sampling import SMOTE, ADASYN from sklearn import svm, preprocessing from sklearn.mode...
true
967b60ef865868e98c9e1257b114f023bba8fea5
Python
ZhengJiaCode/Selection_strength_evolvability
/2020sel_Scripts/8_frequencyOfU.py
UTF-8
2,519
2.625
3
[]
no_license
#This program is used for calculating the frequency of sequences carrying both G66S and Y204 during phase II evolution import os import csv import sys import re GList=['II-1','II-2','II-3','II-4'] GSea=['phase-II_1st','phase-II_2nd','phase-II_3rd','phase-II_4th'] #the following codes are used for grouping sequences f...
true
0375f0a058ff4d9ab7ce7ff2653f1e5e13d0548f
Python
MIKOLAJW197/cityParking
/prog.py
UTF-8
3,276
2.8125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import thread import time import Adafruit_BBIO.GPIO as GPIO import Adafruit_BBIO.PWM as PWM from flask import Flask, jsonify from flask import request from flask_cors import CORS, cross_origin # Configuration czujnika odleglosci GPIO.setup("P9_12", GPIO.OUT, initial=GPIO...
true
e2c38b8d182f49f96e020ceb3d3f7a00c3a84d24
Python
1cg2cg3cg/BOJ
/1065_한수.py
UTF-8
418
3.234375
3
[]
no_license
import sys N = int(sys.stdin.readline().strip()) number = 0 if N < 100 : number = N print(N) else : number = 99 for i in range(100, N+1) : A = str(i) Dif = [] for j in range(1, len(A)) : Dif.append(int(A[j]) - int(A[j-1])) Di...
true
96418dc8f0152c90c5bb19c04f27eff92d251e83
Python
Isen-kun/Python-Programming
/Sem_3_Lab/05.01.21/asign.py
UTF-8
893
4.59375
5
[]
no_license
def rect_area(): l = int(input("Enter rectangle's length: ")) b = int(input("Enter rectangle's breadth: ")) ar = l * b print("The area of rectangle is", ar) def tri_area(): h = int(input("Enter triangle's height length: ")) b = int(input("Enter triangle's breadth length: ")) ar = 0.5 * b *...
true
72bd593fc69430dbae7ec98dbfc64e5cacc253bc
Python
sindish/unitedwelearn
/object_detection/detectron2/datasets/prepare_bdd100k.py
UTF-8
3,208
2.6875
3
[ "Apache-2.0" ]
permissive
import cv2 import json from pathlib import Path def convert_bdd_coco_format(split) -> None: data_folder = Path("/media/deepstorage01/datasets_external/BDD100K") json_file = data_folder / "bdd100k_labels_release" / f"bdd100k_labels_images_{split}.json" image_root = Path("/media/deepstorage01/datasets_exte...
true
58b367f5a0259a9ac38fde53d66fe137503aa409
Python
HardikSingh97/hebi-python-examples
/kits/arm/ex_teach_repeat_armApi_w_gripper.py
UTF-8
4,370
2.75
3
[]
no_license
#!/usr/bin/env python3 import arm import hebi from hebi.util import create_mobile_io from time import sleep # Set up arm family_name = "Arm" module_names = ["J1_base", "J2_shoulder", "J3_elbow", "J4_wrist1", "J5_wrist2", "J6_wrist3"] hrdf = "hrdf/A-2085-06G.hrdf" gripper_name = "gripperSpool" p = arm.ArmParams(fami...
true
0f6dc96354cfa59ccadadf8b57986175224132b2
Python
Menci/TuringAdvancedProgramming19A
/Task 2/evaluator-checker/expression.py
UTF-8
1,623
3.25
3
[]
no_license
from math import copysign from utils import float_to_string class Expression: def __init__(self, type, rng, value=None, operator=None, left_operand=None, right_operand=None): self.type = type self.value = value self.operator = operator self.left_operand = left_operand self....
true
f8dd9b0b915846d859f03adea7c4b10b6856b361
Python
vikpe/pydynamiccalc
/custom/calculators.py
UTF-8
368
2.953125
3
[]
no_license
from pykm.calculators import AbstractPriceCalculator class DiscountForGoblinsCalculator(AbstractPriceCalculator): GOBLIN_FACTOR: float = 0.8 @classmethod def calculate_price(cls, card_info: dict) -> float: price = card_info["price"] if "goblin" in card_info["name"].lower(): p...
true
471df3e26d733174abf4948c3a990e62fe86ac66
Python
ECE-492-W2020-Group-6/smart-blinds-rpi
/scripts/check_motor_interactive.py
UTF-8
1,712
3
3
[ "MIT" ]
permissive
""" Date: Feb 26, 2020 Author: Ishaat Chowdhury Contents: Motor test script """ from easydriver.easydriver import EasyDriver, PowerState, MicroStepResolution, StepDirection from gpiozero.pins.rpigpio import RPiGPIOFactory from gpiozero import Device import time import RPi.GPIO as rpigpio if __name__ == "__main__": ...
true
de79984049b64957e0f971ba0b116b5573913eac
Python
Hyunwoo29/keras01
/ml/m21_pickle.py
UTF-8
1,529
2.640625
3
[]
no_license
from os import scandir from xgboost import XGBRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split import numpy as np from sklearn.metrics import r2_score from sklearn.preprocessing import MinMaxScaler, StandardScaler #1.데이터 datasets = load_boston() x = datasets["data...
true
39d76b252e7c8486f008f9c9ffbe420803aa73dd
Python
fanyuguang/lstm-text-classification
/tfrecords_utils.py
UTF-8
4,770
2.5625
3
[]
no_license
#!/usr/bin/env Python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division import os import tensorflow as tf import data_utils FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string('tfrecords_path', 'data/tfrecords/', 'tfrecords directory') tf.app.flags.DEFINE_integer('batch...
true
6d89d0e082692b421ad1e8c244ab8d8c3326798f
Python
kjans123/CPS_testing
/maxDifference02.py
UTF-8
271
2.953125
3
[]
no_license
def maxFindDiff(inputList): diffList = [] for i in range(len(inputList)): if i != (len(inputList)-1): oneDiff = abs(inputList[i] - inputList[i+1]) diffList.append(oneDiff) maxxVal = round(max(diffList), 5) return maxxVal
true
444e53533bed6a74c96970699edd277373b72272
Python
croptek/sensors
/test/RHT03-tmp&hum/RHT03-tmp&hum.py
UTF-8
1,348
2.828125
3
[]
no_license
#!/usr/bin/env python import sys #import redis import Adafruit_DHT import time confDoc = open('config.txt','r') sysName = confDoc.readline().rstrip() tmpSensorName = confDoc.readline().rstrip() humSensorName = confDoc.readline().rstrip() pin = int(confDoc.readline()) updateRate = int(confDoc.readline()) redisName = ...
true
ef8e69ab6081c4db76f0af1a89b42c6f76b01673
Python
SamProkopchuk/maps20
/D.py
UTF-8
301
3.171875
3
[]
no_license
import math as m for i in range(int(input())): n, l, d, g = list(map(int, input().split())) # n = sides # l = side length # d = expansion distance # g = land grabs apothem = l/2*m.tan(m.pi*(n-2)/(2*n)) area = 0.5*n * l *apothem ds = g*d area += (ds)**2*m.pi area += n * l * ds print(area)
true
2174fc702399b702d9324ce564fc2d461bf1e208
Python
rushkock/project
/project/data/scripts/convertCSV2JSONus.py
UTF-8
1,042
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # Name: Ruchella Kock # Student number: 12460796 """ This script transforms the us csv datafiles to a JSON file """ import pandas as pd def main(): columns = ["FIPS", "State", "Substate Region", "Small Area Estimate", "95% CI (Lower)", "95% CI (Upper)"] # choose column nam...
true
4072f3124a82c0a1d17fe3c9fbeeedd0babd7eef
Python
Manon-des-sources/C003-python
/NoteBook/3001-lesson_codes/23-002-dice.py
UTF-8
942
3.859375
4
[]
no_license
# coding=utf-8 #!python3 # ======================================================================= """ 来源: 问题: 接口: 说明: """ # ======================================================================= # modules section import random # 用一个11面的骰子、代替两个6面的骰子,投出2-12 之间的数值 totals = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0] for i in rang...
true
cc083918fe768c6d0a4193a3db884590eadfc7ef
Python
drestion/leetcode
/python/ContainsDuplicate.py
UTF-8
670
3.421875
3
[]
no_license
class Solution: # def containsDuplicate(self, nums: List[int]) -> bool: # # brutal force is O(n2) as it needs to check at least two elements # # to speed up, needs memory, with hash # num_dict = {} # for n in nums: # if n in num_dict.keys(): # ret...
true
5fab2aa8384c6585fe746d079a7524cf449530a1
Python
daniellealll/rootcow
/admin/services/instituicao_service.py
UTF-8
1,350
2.578125
3
[]
no_license
from admin.models.instituicao import Instituicao from admin.dao import instituicao_dao def listar(): instituicoes = [] instituicoes_bd = instituicao_dao.listar() for instituicao_bd in instituicoes_bd: instituicoes.append(Instituicao(instituicao_bd['nome'], instituicao_bd['telefone'], instituicao_b...
true
a3008a097955b83e56ca6b7ace08373da99fdb68
Python
Pavlenkovv/e-commerce
/HW5/Task_2/fraction.py
UTF-8
1,986
3.765625
4
[]
no_license
"""Создайте класс «Правильная дробь» и реализуйте методы сравнения, сложения, вычитания и произведения для экземпляров этого класса.""" from math import gcd class Fraction: def __init__(self, a, b): if not isinstance(a, int): raise TypeError('a') if not isinstance(b, int): ...
true
15d06a5a751c33bb07ac2c767d280f2fd973bfce
Python
evershinemj/python
/songlist.py
UTF-8
592
3.703125
4
[]
no_license
#!/usr/bin/env python3 # encoding=utf-8 # from collections import Iterable # this form of import doesn't raise warning from collections.abc import Iterable class Songlist(Iterable): ''' the advantage of inheriting collections.Iterable is that is you do not implement __init__, an exception will be ra...
true
6ca7352f65a3849abdfb9bcdffb44b1f794629c0
Python
RawitSHIE/Algorithms-Training-Python
/python/Time Machine r.py
UTF-8
283
3.25
3
[]
no_license
"""calendar""" def main(): """step""" month = str(input()) step = int(input())%12 almonth = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDECJANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC" loca = almonth.find(month) pos = (loca+2)+((step*3)-2) print(almonth[pos:pos+3]) main()
true
20eda7d2c70ff03c184743d576da4260f9aea285
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_206/1219.py
UTF-8
912
2.96875
3
[]
no_license
import argparse def solve(): pass def main(f_in, f_out): t = int(f_in.readline().strip()) for case in range(1, t+1): d, n = f_in.readline().strip().split() d = int(d) n = int(n) horses = [] for r in range(n): k, s = f_in.readline().strip().split() horses.append([int(k), int(s)]) ...
true
47a3f84c74dfaa6c87e829e14b1fc0cd6a677f6a
Python
ess2/AlgoritmosBioinspirados
/Bioinspirada/MiniProjeto1/bin/8QueensAlgorithm.py
UTF-8
5,195
3.34375
3
[]
no_license
import numpy import random import time max_fitness = 28 qt_exec = 20 qt_population = 200 def main(): for f in range(qt_exec): inicio = time.time() population = list() qtFitness = 0 #Gera a população for i in range(qt_population): a = random.sample(range(1,9), 8...
true
b448ace50aa4bda118e828de85f77c0b45ec2d52
Python
DveloperY0115/texture_fields
/mesh2tex/layers.py
UTF-8
6,396
2.65625
3
[ "MIT" ]
permissive
import torch.nn as nn import numpy as np import torch.nn.functional as F class ResnetBlockFC(nn.Module): def __init__(self, size_in, size_out=None, size_h=None): super().__init__() # Attributes if size_out is None: size_out = size_in if size_h is None: size...
true
dd6b08775ffd8e91771148e3d8732a04cf6b10a5
Python
kmader/qbi-2019-py
/Exercises/06-AdvShape.py
UTF-8
4,955
3.234375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import skimage.transform import scipy from scipy import ndimage import matplotlib.pyplot as plt from skimage.morphology import medial_axis, watershed create_dist_map = lambda img, mask=None: medial_axis(img, mask, return_distance=True)[1] import os f...
true
b7651d001bb3086119389b656717604e1145ef66
Python
daydreamerli/python_study
/Dp_coinchange_error.py
UTF-8
1,984
3.53125
4
[]
no_license
import timeit # Function to create the matrix we'll use for the optimization def _change_matrix(coin_set, change_amount): matrix = [[0 for m in range(change_amount + 1)] for m in range(len(coin_set) + 1)] for i in range(change_amount + 1): matrix[0][i] = i return matrix # Function we'll use to opt...
true
5cd4fa29bef4f15a41945a739f1efe0134264549
Python
kq-li/stuy
/pclassic/2016s/PClassic2016Stubs/stubs/JediAcademy.py
UTF-8
409
2.875
3
[]
no_license
# Change the body of this method def best_grouping(scores, G): return 0 if __name__ == "__main__": with open("JediAcademyIN.txt", "r") as f: while True: s = f.readline() if s == "": break data = s.split("--") scores = [int(x) for x in data...
true
57559136d818776996ca53830a22f476507126d6
Python
maratserik/NN-clothes-classification
/learning.py
UTF-8
1,512
3.140625
3
[]
no_license
import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib.pyplot as plt fashion_mnist = keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data() class_names = np.array(['T-shirt/top', 'Trouser', 'Pullover', 'Dress', ...
true
df5f8fbe064ca1e2aa4ce17a18e0e79361c39a12
Python
ultrabug/py3status
/py3status/output.py
UTF-8
6,764
3.265625
3
[]
permissive
import sys from json import dumps class OutputFormat: """ A base class for formatting the output of py3status for various different consumers """ @classmethod def instance_for(cls, output_format): """ A factory for OutputFormat objects """ supported_output_form...
true
98c0fde4c69912b7882e5cacb02a8c2cd95d4795
Python
fyeee/reproducing-machine-learning-algorithms
/DecisionTree/DecisionTree.py
UTF-8
3,830
3.1875
3
[]
no_license
import math # for testing the algo from sklearn import datasets from sklearn.model_selection import train_test_split class DecisionTreeClassifier: def __init__(self, max_depth=None): self.max_depth = max_depth self.root = None def fit(self, X, y, node={}, depth=0): if node is None: ...
true
3036fd76a93061a8cbcadf7a6afa2f5d450725ea
Python
anshsaikia/GSSDeliverables-YesProject
/VE-Tests/tests_framework/ui_building_blocks/KSTB/fullcontent.py
UTF-8
22,773
2.546875
3
[]
no_license
from tests_framework.ui_building_blocks.screen import Screen import logging import tests_framework.ui_building_blocks.KSTB.constants as CONSTANTS from math import ceil from time import sleep class Fullcontent(Screen): def __init__(self, test): Screen.__init__(self, test, "full_content") def navigate...
true
aeb8cf183547020684e968d00a677f5cda3d1c8a
Python
PeterZhouSZ/feasible-form-parameter-design
/relational_lsplines/test_idea.py
UTF-8
4,057
2.796875
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Mar 3 13:41:20 2017 @author: luke Testing examples from Interval Constraint Logic Programming by Frederic Benhamou """ #import numpy as np from extended_interval_arithmetic import ia #from hull_inference_ob_graph import Hull as...
true
183278c0f49c3a3bf5446875008eb1e4359343dc
Python
ZoneTsuyoshi/Data_Assimilation
/phase2/source/kalman.py
UTF-8
39,204
2.609375
3
[]
no_license
''' Kalman Filter のクラス pykalman を参考にして作成する pykalman では欠測値に対応できていないので,欠測にも対応できるクラス作成がメインテーマ -> と思っていたけど,マスク処理で対応している -> 欠測値(NaN)の場合は自動でマスク処理するようなコードを追加すれば拡張の意義がある 18.03.13 行列の特定の要素を最適化できる EM Algorithm に改変 18.03.17 メモリ効率化を行う - 不要なメモリを保存しないようにする - pykalman もカルマンゲイン等でメモリが喰われているため,それらも節約する - デフォルトで np.float32 を使用してメモリ節約 ...
true
902c2a8fbb0fc2cd2eb8d4353e6e37aa2d7f7255
Python
koking0/Algorithm
/Interview/JD/JD2-抛小球/solve.py
UTF-8
166
3.203125
3
[]
no_license
class Balls: def calcDistance(self, A, B, C, D): return 3 * (A + B + C + D) if __name__ == '__main__': print(Balls().calcDistance(100, 90, 80, 70))
true
f09f97284b978dc953a9299e42b9e6466ada3a26
Python
takecap/70puzzles
/src/q07.py
UTF-8
738
3.75
4
[]
no_license
# Q07 日付の2進数変換 # 年月日をYYYYMMDDの8桁の整数で表したとき、これを2進数に変換して逆に並べ、 # さらに10進数に戻したとき、元の日付と同じ日付になるものを探してください。 # 探索する期間は19641010 〰 20200724とします。 from datetime import date from datetime import timedelta # dt: datetime.date を2進数に変換して返す def date2bin(dt): date_str = dt.strftime('%Y%m%d') return bin(int(date_str))[2:] def main()...
true
a709a5540df63fb94564aeb15a9877b634190e37
Python
bongho/codewar
/Build_Tower.py
UTF-8
415
3.34375
3
[]
no_license
def tower_builder(n_floors): floors = [] n = n_floors for i in range(n_floors): print(i) n -= 1 floors.append(' ' * n + '*' * (i * 2 + 1) + ' ' * n) return floors def tower_builder(n): return [("*" * (i*2-1)).center(n*2-1) for i in range(1, n+1)] def tower_buil...
true
51071575356ec18dd7c1052239e290b2e2015306
Python
joohyun333/programmers
/백준/투포인터/수고르기.py
UTF-8
396
3.015625
3
[]
no_license
import sys input = sys.stdin.readline num = [] N, M = map(int, input().split()) for i in range(N): num.append(int(input())) num.sort() start = end = 0 min_result = sys.maxsize while end<N and start <= end: distance = num[end] - num[start] if distance >=M : if min_result> distance: min_r...
true
cb67199473c1cbcbe8260232357653b949126b9f
Python
sijichun/MathStatsCode
/code_in_notes/MCMC_independent_mh.py
UTF-8
594
2.96875
3
[]
no_license
## mcmc_independent_mh.py ##独立的MCMC算法,输入: ## N_samples : 抽样次数 ## pai(x) : 目标密度函数 ## q(y) : 工具密度函数 ## q_sampler : 给定x,从q中抽样的函数 ## x0 : 初始值 from numpy import random as nprd def MH_independent(N_samples, pai, q, q_sampler, x0): X = [] x = x0 for i in range(N_samples): ...
true
3d7f34be3b3e8b6c86a8af1977fef8333bc7e4ef
Python
ulbergc/EQlocator
/Processing/tools.py
UTF-8
2,759
2.859375
3
[]
no_license
''' Helper tools for process_data.py Read and write datasets with Spark Filename: tools.py Cohort: Insight Data Engineering SEA '19C Name: Carl Ulberg ''' import pyspark.sql.types as T from pyspark.sql import SQLContext from pyspark.sql.functions import countDistinct import os def read_data(spark): ''' Read...
true
d95136a7973f954feae348ededae8a1f49a0c4e2
Python
loganyu/leetcode
/problems/1347_minimum_number_of_steps_to_make_two_strings_anagram.py
UTF-8
1,118
3.8125
4
[]
no_license
''' You are given two strings of the same length s and t. In one step you can choose any character of t and replace it with another character. Return the minimum number of steps to make t an anagram of s. An Anagram of a string is a string that contains the same characters with a different (or the same) ordering. ...
true
cf361a0a26de4d4cff39cfb45d53ab251a650cf3
Python
Vyalkoff/Codewars
/vowel_counter.py
UTF-8
250
3.375
3
[]
no_license
def get_count(input_str): num_vowels = 0 list_vowels = ['a', 'e', 'i', 'o', 'u'] for i in input_str: if i in list_vowels: num_vowels += 1 return num_vowels print(get_count('o a kak ushakov lil vo kashu kakao'))
true
46a485720df409b95c58a9a9924d1b8ea7e76ff1
Python
11Vladimir/algoritm
/lesson_3/task_9.py
UTF-8
647
3.90625
4
[]
no_license
#!/usr/bin/python3.8 # 9. Найти максимальный элемент среди минимальных элементов столбцов матрицы. from random import random M = 10 N = 5 def matrix(): arr = [] for _ in range(N): b = [] for _ in range(M): n = int(random() * 200) b.append(n) arr.append(b) ...
true
2f3c16f1e0f2e95d1f3f058dd4f98efd42a87035
Python
Rakshit-Bhatt/Practice_Codes
/demo_codes/HACKERRANK/itertools_product.py
UTF-8
597
3.6875
4
[]
no_license
from itertools import product #timeit() module to test the time lapse import timeit def cart_product(list1, list2): return (product(list1 , list2)) if __name__=="__main__": a=[int(item) for item in input("Enter values for first list: ").split()] b=[int(item) for item in input("Enter values fo...
true
53b19f07da4bae654cfcc6d262566f8fe5c04cb1
Python
DeadHeadRussell/iacd_projects
/interactive_map/csv_trim.py
UTF-8
479
3.0625
3
[]
no_license
#!/usr/bin/python import csv input_name = 'usa_hotels.csv' columns = ['id', 'latitude', 'longitude'] delimiter = '\t' reader = csv.reader(file(input_name), delimiter=delimiter) header = reader.next() column_ids = [] id = 0 for row in header: if row in columns: column_ids.append(id) id += 1 print delimiter...
true
0f2664fb0852800fc5bb86f8963b419bcfdd3597
Python
ChinaChenp/Knowledge
/interview/interview_python/mianshixinde/lesson2/2.2.py
UTF-8
779
4.40625
4
[]
no_license
#寻找和为定值的两个数 #输入一个数组和一个数字,在数组中查找两个数,使得它们的和正好是输入的那个数字。 #要求时间复杂度是O(N)。如果有多对数字的和等于输入的数字,输出任意一对即可。 #例如输入数组1、2、4、7、11、15和数字15。由于4+11=15,因此输出4和11。 #默认升序 def two_number(arr, need): beg, end = 0, len(arr) - 1 while beg < end: #print(beg, end, arr[beg], arr[end]) total = arr[beg] + arr[end] if to...
true
2fb01107c035ce7e13d71ff8c89cbb1d1df594d1
Python
jtbish/ppl-da
/ppl/rng.py
UTF-8
256
2.59375
3
[]
no_license
import numpy as np _rng = np.random.RandomState() _has_been_seeded = False def seed_rng(seed): seed = int(seed) _rng.seed(seed) global _has_been_seeded _has_been_seeded = True def get_rng(): assert _has_been_seeded return _rng
true
d52b78db0f093a05132c0044f7c7c41d7daf7a6a
Python
CateGitau/Python_programming
/ace_python_interview/sort_search/find_max_product.py
UTF-8
1,605
4.28125
4
[]
no_license
''' Implement a function find_max_prod(lst) that takes a list of numbers and returns a maximum product pair. ''' # Decimal library to assign infinite numbers from decimal import Decimal #brute force approach '''O(n^2)''' def find_max_prod(lst): """ Finds the pair having maximum product in a given list :pa...
true
1aaea7829d891409223664cd2ffc97281ba0a80b
Python
whistle-boy/TIL-and-TIW
/python_nado_coding/practice11-3.py
UTF-8
2,510
3.34375
3
[]
no_license
####### pip 로 패키지 설치하기 # 구글에서 pypi 검색 # beautifulsup4 4.8.2 # pip install beautifulsoup4 아래 창에 넣고 설치 from bs4 import BeautifulSoup soup = BeautifulSoup("<p>Some<b>bad<i>HTML") print(soup.prettify()) # pip list 현재 설치되어있는 리스트 확인가능 # pip show beautifulsoup4 설치되어있는 패키지 정보확인 # pip install --upgrade beautifu...
true
b41418bd45fda79cfee4042b22988f60137e434f
Python
sowrd299/SillyRobots
/localTextPlayerController.py
UTF-8
2,346
3.59375
4
[]
no_license
from playerGameController import PlayerGameController from boardTextDisplay import BoardTextDisplay class LocalTextPlayerController(PlayerGameController): ''' A player controller for local, human players playing with a text-based interface ''' card_chars_disp = "AbCdEFghIJklMNO" # characters to r...
true
cdf17767876180682da2be56aaeba4fd3c39d24b
Python
jstrasburger/Tweet_Sentiment_Analysis
/team.py
UTF-8
4,811
3.140625
3
[ "MIT" ]
permissive
import dash_html_components as html import dash_bootstrap_components as dbc import os import base64 ### IMAGES ### j_strasburger = "static/img/j_strasburger.jpg" # replace with your own image jack_image = base64.b64encode(open(j_strasburger, 'rb').read()) luis_v = "static/img/luis_v.jpeg" # replace with your own im...
true
23b8b3401a55afae68248e9bd0fe7fe0564ecc29
Python
LikeLionSCH/9th_ASSIGNMENT
/20_이예빈/session03/3.py
UTF-8
735
4.25
4
[ "MIT" ]
permissive
list=[] # 빈 리스트 생성 sum=0 # 총합 sum 초깃값 for i in range(7): # 총 7개의 상품에 대한 가격 입력 받음 print(i, end="") n=int(input("번째 상품 가격: ")) sum+=n # 입력 받은 가격을 sum에 저장 list.append(n) # 리스트의 끝에 요소 n값을 추가 print(list) # 전체 상품 구매 불가능한 경우 price=int(input("가지고 있는 돈을 입력하세요 >> ")) if price<sum: print("돈이 모자랍니다. ", end=""...
true
72b879f2a4c4d5d89d43a0d819d143f732606264
Python
rkhal101/Thesis-Test-Results
/wapiti/wavsep/configured/report/extract-urls.py
UTF-8
1,080
2.578125
3
[]
no_license
import itertools input_file_loc = "/Users/ranakhalil/Desktop/git/Thesis/results/wapiti/wavsep/configured/report/wapiti-wavsep-configured.txt" output_file_loc = "/Users/ranakhalil/Desktop/git/Thesis/results/wapiti/wavsep/wapiti-wavsep-configured.csv" lines = [] new_vuln_string = "**************************************...
true
41b33f6d91698868bb44727224c92d3d340743c6
Python
taoste/dirtysalt
/codes/leetcode/combinations.py
UTF-8
622
2.984375
3
[]
no_license
#!/usr/bin/env python # coding:utf-8 # Copyright (C) dirlt class Solution(object): def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ res = [] def f(idx, r): if len(r) == k: res.append(r[:]) ...
true
930110825171484f4635326371b7d3e0301eaf4e
Python
DruiadinMonk/OHLC_Candles
/OHLC.py
UTF-8
777
4.1875
4
[]
no_license
# Creating a cndle (OHLC) price chart. import random prices_1 = [1.0000] prices_2 = [] base_1 = 100 base_2 = 10 # Generate random prices in the 10'000's place. for x in range(100): r1 = random.randint(-5, 5) / 10000 r2 = round(r1 + prices_1[x], 4) prices_1.append(r2) # 2. For lo...
true
a90de5a7f58af22ee5a75b2bd64af7dae466d9f9
Python
pankas87/Project-Euler---Python
/Problem-6/run.py
UTF-8
252
3.21875
3
[]
no_license
edge = 100 sum = edge * (edge + 1) / 2 sum_squares = (2 * edge + 1) * (edge + 1) * edge / 6 print('sum', sum) print('sum_squared', sum * sum) print('sum_squares', sum_squares) print('sum_squared - sum_squares', sum * sum - sum_squares )
true
c375be29d567426312ab5b8c4297d9abb0549117
Python
korz/ml-in-csharp
/src/Python/xor.py
UTF-8
1,254
3.03125
3
[]
no_license
import numpy as np from keras.models import Sequential from keras.optimizers import Adam from keras.layers.core import Dense from keras.models import model_from_json from keras import backend as K def main(): #Get Training Data input = np.array([ [0, 0], [0, 1], [1, 0], [1, 1] ]) output = np.array([ 0, 1,...
true
57ef705fe19007ceb2a046933eaeb3f9ecd509ee
Python
martey/django-redis-cache
/tests/benchmark.py
UTF-8
2,779
3.015625
3
[ "BSD-3-Clause" ]
permissive
""" A quick and dirty benchmarking script. GitPython is an optional dependency which you can use to change branches via the command line. Usage:: python benchmark.py python benchmark.py master python benchamrk.py some-branch """ import os import sys from time import time from django.core import cache fr...
true