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
5ab233af1341c08be9db499fc2c0b89a48354f5d
handabo/web-spider
/代码/41-requests-gongjiao.py
UTF-8
3,446
3.03125
3
[]
no_license
import requests from bs4 import BeautifulSoup import json headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) \ AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' } def main(): # 打开文件 fp = open('成都公交.txt', 'w', encoding='utf8') url = 'http://chengdu.8684.cn/'...
true
195bc6b685d62289f8a46fcca0ce1317ead1e4c7
brumar/WPsolving
/lib/schemas.py
UTF-8
4,497
2.890625
3
[ "MIT" ]
permissive
import operations class ProblemStructure:#fields : schemas,objectSet def __init__(self): self.objectSet=set() self.schemas=[] def addSchema(self,schema): self.schemas.append(schema) def addBridgingSchemas(self,schema1,schema2,names=[]):#Create all the schemas and objects related to ...
true
f51628ee1d598b5009ba117c1217a7c071c6aefa
VovaMax/letsGo
/xdb/xdb2ram.py
UTF-8
12,271
2.828125
3
[]
no_license
import xml.dom.minidom as dom from RamModel import Domain, Table, Field, Index, Constraint, Schema, ConstraintDetail, IndexDetail from source.exception import ParseError class Parser: """ Create Ram representation from xml file """ def __init__(self, xml_file_path): self.xml = dom.parse(xml_fil...
true
345fcb3aec4dc22ab434170a9ce79e4e6cc668cc
SandUniHH/ML
/Exercise5/ex5.py
UTF-8
1,793
3.203125
3
[]
no_license
#!/usr/bin/python3 # import re # regex import matplotlib.pyplot as plotter def readfile(): filename = './dataCircle.txt' f = open(filename, 'r') l = f.readlines() points = [[i for i in range(3)] for j in range(len(l))] for i, line in enumerate(l): s = line.split() if s: poi...
true
3772446935358b841371740d231fe077cb2a4537
ABGEO/GenEUI64
/v0.9/GenEUI64.py
UTF-8
1,181
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/python3 print() print("Welcome to") print(" ____ _____ _ _ ___ __ _ _ ") print(" / ___| ___ _ __ | ____| | | |_ _/ /_ | || | ") print("| | _ / _ \ '_ \| _| | | | || | '_ \| || |_ ") print("| |_| | __/ | | | |___| |_| || | (_) |__ _|") print(" \____|\___|_| |_|_____|\___/|___\___/ ...
true
8e05cf2c3859038dc85fb27626219fe851c84a7c
JiMinwoo/Algorithm
/이코테/G.다이나믹 프로그래밍(DP)/02.1로 만들기.py
UTF-8
531
2.625
3
[]
no_license
def solution(x): # dp[N] : N이 되기까지의 최소 연산 수 dp = [30000] * 30001 dp[1] = 0 dp[2] = 1 dp[3] = 1 dp[4] = 2 dp[5] = 1 i = 6 while True: if i%5 == 0: dp[i] = min(dp[i],dp[i//5]+1) if i%3 == 0: dp[i] = min(dp[i],dp[i//3]+1) if i%2 == 0: ...
true
fd799ffcb328d5fc3c503635f7f014283ca785b0
djordon/queueing-tool
/queueing_tool/graph/graph_functions.py
UTF-8
2,649
3.359375
3
[ "MIT" ]
permissive
import networkx as nx import numpy as np from queueing_tool.graph.graph_wrapper import QueueNetworkDiGraph def _calculate_distance(latlon1, latlon2): """Calculates the distance between two points on earth. """ lat1, lon1 = latlon1 lat2, lon2 = latlon2 dlon = lon2 - lon1 dlat = lat2 - lat1 ...
true
53280375c49f4049857101ec2c3dcf2a55f8cdd6
BlazZupan/uozp-zapiski
/gradivo/gradient-descent-many.py
UTF-8
1,538
3.359375
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt from inspect import signature def J(a, b): """a function with three arguments""" return (a - 1)**2 + (b + 1.5)**2 - 0.1*a*b def dJ(a, b): """function's derivative""" return np.array([2*(a - 1) - 0.1*b, 2*(b + 1.5) - 0.1*a]) def grad(f, point,...
true
fb2725a3ec167c70c22d508c361ff0f4c454a603
elizabethdaly/pands-problem-set
/problem8.py
UTF-8
2,171
3.890625
4
[ "Apache-2.0" ]
permissive
# Elizabeth Daly # HDip Data Analytics 2019 pands-problem-set # # problem8.py # # Output today's date and time in the format # "Monday, January 10th 2019 at 1.15pm" # # ########################################################### # # Describe the program to the user. print("Program to output today's date in a particula...
true
50aaaf371bdc3ce08d1cf5d24914a604bfa70ed9
erlosshex/tmp
/crossin/lesson65.py
UTF-8
181
2.53125
3
[]
no_license
import pickle test_data=['save me',123.456,True] f=file('test.data','w') pickle.dump(test_data,f) f.close() f=file('test.data') tes_data=pickle.load(f) f.close() print tes_data
true
c135426f0ae423d00653150f4e33a2cb94efe1dd
lakshaysinghal/Leetcode
/98_Validate_Binary_Search_Tree.py
UTF-8
630
3.3125
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isValidBST(self, root: TreeNode) -> bool: return self.isValidBSTUtil(root,-(2**32),2**32-1) ...
true
1f444a16d94b86f083a713d0f97bae761473aaab
MetDev2/Python_programmes
/Project_Euler/Multiples of 3 and 5.py
UTF-8
383
3.84375
4
[]
no_license
"""Найдите сумму всех чисел меньше 1000, кратных 3 или 5.""" def sum_of_muliples(upper_limit): summary = 0 for i in range(3, upper_limit, 3): summary += i for j in range(5, 1000, 5): if j % 3 != 0: summary += j return summary if __name__ == "__main__": prin...
true
ea32fa97df41fe4731e4b2c4f6512030dd1e2bc4
GdoongMathew/HandWritting-Digit-Recognition
/LSTM_testing_dynamic.py
UTF-8
6,876
2.5625
3
[]
no_license
import tensorflow as tf from tensorflow.contrib import rnn import numpy as np import csv import math import cv2 with open("RNN_ori.csv") as csvfile: spamreader = csv.reader(csvfile, delimiter=',', quoting=csv.QUOTE_MINIMAL) data = list(spamreader) # import testing data set for further prediction with open("R...
true
ff347c9a5fe14e131e82c519d104f114cfec9965
Xilinx/Vitis-AI
/docsrc/source/doxygen/pydoc/get_inputs.py
UTF-8
350
2.921875
3
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "BSD-3-Clause-Open-MPI", "LicenseRef-scancode-free-unknown", "Libtool-exception", "GCC-exception-3.1", "LicenseRef-scancode-mit-old-style", "OFL-1.1", "JSON", "LGPL-2.1-only", "LGPL-2.0-or-later", "ICU", "LicenseRef-scancode-other-permissive...
permissive
"""! @brief Get all input tensor buffers of runner. @return : List[vart.TensorBuffer]. All input tensors. A vector of raw pointer to the input tensor. Sample code: @code input_tensor_buffers = runner.get_inputs() input_dim = tuple(input_tensor_buffers[0].get_tensor().dims) @endcode ""...
true
49bb0fb7bf368e887b44abadad2f3193dda7ea7e
PDominguezM/JobFind
/infojobs.py
UTF-8
3,045
2.703125
3
[]
no_license
import requests import oferta_class from nltk.stem.porter import * from nltk.tokenize import * def __tokenization_and_stemmer(line): tokenized_words = [PorterStemmer().stem(word) for word in word_tokenize(line.lower().decode('utf-8'), 'spanish')] tokenized_words = tokenized_words.__str__() return tokenize...
true
e9f489b4eff8b3df2677871f795df13508220a45
ryanfisher/fantasybaseball
/scripts/baseball.py
UTF-8
8,402
2.671875
3
[]
no_license
import csv DEFAULT_TEAMLIST = '../teamdata/2014/KeeperList.csv' DEFAULT_PROJECTIONS = '../projections/2014/FanGraphsBatters.csv' DEFAULT_PITCHER_PROJECTIONS = '../projections/2014/FanGraphsPitchers.csv' DEFAULT_FARMLIST = '../teamdata/2014/FarmList.csv' DEFAULT_DRAFTEDLIST = '../teamdata/2014/DraftedList.csv' DEFAULT_...
true
cff397b218d8c4f6580754125e706f471ff043f8
kbmajeed/McKinsey-Analytics-Online-Hackathon-2018
/solution_xgboost.py
UTF-8
13,149
2.75
3
[]
no_license
import pandas as pd import numpy as np from sklearn.preprocessing import OneHotEncoder,LabelEncoder,StandardScaler,MinMaxScaler from sklearn.model_selection import train_test_split,StratifiedKFold,GridSearchCV from sklearn.metrics import roc_auc_score,accuracy_score from sklearn.linear_model import LogisticRegress...
true
0f52d80b8f4c048452e4fce81a4d63d9b86fd897
MertTurkoglu/Python_Projects
/Python.projects/faktöriyel.py
UTF-8
443
4.09375
4
[]
no_license
print("faktöriyel bulma programı") while(True): sayi = int(input("faktöriyeli öğrenmek istediğiniz sayi(cıkmak icin-1 e bas")) if(sayi==0 or sayi == 1): print("{}! = {}".format(sayi, 1)) continue elif(sayi==-1): print("programdan cıkıldı") break i = 1 carpim = 1 w...
true
ea7279c835b5f92359db8155631be423189cac33
HectorMontes10/PropertiesPriceApp
/app/customized_class/create_geodf.py
UTF-8
2,356
3.109375
3
[ "MIT" ]
permissive
def construct_geodf(df, properties_types,col_to_plot, path_shape): ''' This function builds a geopandas dataframe with all the information needed for mapping. Implement missing value filters and cleanups for lon and lat features. Parameters: ----------- df(pandas DataFrame): C...
true
0f09952fe29ed67585a8c6558a8769326162ee19
FabricioMessa/ExamenPracticoDBP
/application.py
UTF-8
1,265
2.5625
3
[]
no_license
from flask import ( Flask, redirect, render_template, request, session, url_for ) from werkzeug.utils import redirect app = Flask(__name__) app.secret_key = 'somesecretkeythatonlyisshouldknow' class User: def __init__(self, id, username, password): self.id = id self.usern...
true
20f9562fcc62d07526e3ec38d85c2e7cf5480819
slott56/HamCalc-2.1
/python/hamcalc/stdio/chain.py
UTF-8
5,374
3.296875
3
[]
no_license
"""Chain "DRIVES",", chain","","\HAMCALC\MECHCALC\MECHMENU" "CHAIN DRIVES","","","MECHMENU" """ import hamcalc.construction.chain as chain from hamcalc.stdio import * def chain_design( X=None, Y=None, A=None, B=None, M=None ): if A is None: A= input_int( "No. of teeth in sprocket A ..........? " ) if ...
true
d55e4e179f09f3f807f2dcf9b0bd273ad889cdd5
saintamh/tdds
/tdds/utils/codegen.py
UTF-8
11,170
2.921875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A toolset for building and evaluating strings of Python code. """ #---------------------------------------------------------------------------------------------------------------------------------- # includes # 2+3 compat from __future__ import absolute_import, divis...
true
5371bfd707fe2e2b75220328bb444262d33dbad9
AruulmozhivarmanS/Drone-Tracking
/drone_track.py
UTF-8
4,412
2.5625
3
[ "MIT" ]
permissive
import os import cv2 import numpy as np import darknet import time from ctypes import * class droneDetector: def __init__(self, configPath, weightPath, metaPath): self.configPath = configPath self.weightPath = weightPath self.metaPath = metaPath self.netMain = None self.meta...
true
085e5b8f959be1adf656b09984388e03fb3aa3f1
sashi0034/lets_use_pillow
/Replace_the_specified_color_with_2colors.py
UTF-8
767
2.90625
3
[]
no_license
from PIL import Image load_path = r"test.png" #save_path = load_path save_path = r"test.png"; def hex_to_rgb(value): return ((value & 0xff0000) >>16, (value & 0x00ff00) >>8, (value & 0x0000ff) >>0, 255) replace_rgba = hex_to_rgb(0x4c9cdc) print(hex_to_rgb(0x4c9cdc)); new_rgba = [0,0]; new_rgba[0] = h...
true
9bad6217dfb965b188cfa8ca8cae585532d6b7f4
daniel12fsp/RTDM
/rtdm/file.py
UTF-8
3,469
2.921875
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf8 -*- import fnmatch import os import re import sys import random import glob #TODO """ Fazer um merge com o modulo utils so tem duas funcoes! """ def list_random_pages(path_dir): pages = glob.glob(path_dir + "*.html*") random.shuffle(pages) return pages def list_sorted_page...
true
08d6d732b26eaada9d554e9c0a8ba19d6fa01315
DorotheaF/Sentiment-Analysis
/French-Dorothea-assgn2.py
UTF-8
8,862
3.15625
3
[]
no_license
# for review in reviews # ID -- 0 # count positive words -- 1 # count negative words -- 2 # if has no then 1 else 0 -- 3 # count pronouns.txt -- 4 # if ! then 1 else 0 -- 5 # ln word count -- 6 # review class -- 7 # read in revie...
true
5abb0907b718102a384a39bac11378ce05b9c861
hsaliak/advent
/day2.py
UTF-8
2,853
3.5
4
[ "Apache-2.0" ]
permissive
# 1212 program alarm # magic smoke escaped # Intcode programs like gravity assist. # Intcode == List of Integers separated by commas. # 1) Look at first integer == is it an opcode 1, 2 or 99 # 2) 99 means program should halt. # 1 adds together numbers from 2 positions and stores it in the third # opcode 2 multiplies....
true
15b14d7018634cd37f1aca5afe0cf1325ea6c284
JTvandergeest/HU-projects
/SP/formatief 6.py
UTF-8
365
3.578125
4
[]
no_license
def gemiddeldeEnkeleLijst(): lijstMetCijfers = [5, 4, 5, 8, 5, 3, 9, 13, 14, 8, 17, 16, 5] print(sum(lijstMetCijfers)//len(lijstMetCijfers)) gemiddeldeEnkeleLijst() def gemiddeldeMeerdereLijsten(): lijstMetLijsten = [[6, 5, 4], [9, 8, 1], [5, 2, 3]] for lijst in lijstMetLijsten: print(sum(lij...
true
9d6109004bc4c44e2ee4a138e47b2e8b29b4d201
markgijsbrechts/iplookup
/ip-lookup.py
UTF-8
4,406
2.921875
3
[]
no_license
import os import sys import ipaddress import requests from pprint import pprint as pp INFOBLOX_API_URL = os.environ.get('INFOBLOX_API_URL') INFOBLOX_API_USER = os.environ.get('INFOBLOX_API_USER') INFOBLOX_API_PASSWORD = os.environ.get('INFOBLOX_API_PASSWORD') USAGE_MSG = """ Usage: \t ip-lookup.py 192....
true
ea6f4945b4a70b7c9d6da76cf4ce264be6880fa0
artkpv/code-dojo
/_algos/ds/queue.py
UTF-8
927
4.03125
4
[]
no_license
#!python3 class Queue: def __init__(self, capacity=10): self.first = 0 self.count = 0 self.capacity = capacity self.array = [None] * self.capacity def enqueue(self, e): if self.count == self.capacity: raise Exception('Queue is full') self.array[(self...
true
cf1a36b4bc500675859825b5a6005422fa5c2d3a
Mohan110594/Code-Breakers-Code
/6.Recursion/Binary_tree_maxPathsum.py
UTF-8
1,208
3.53125
4
[]
no_license
#DFS #Time comp --> o(n) #space comp --> o(h) # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def __init__(self): self.out=float('-i...
true
1ec3ae64ef5ba64d34adf6350208e82ba9b26524
Sunaaaa/TIL
/Python/Dictionary/d3_1.py
UTF-8
529
3.875
4
[]
no_license
# 3. 도시별 최근 3일의 온도입니다. cities = { '서울': [-6, -10, 5], '대전': [-3, -5, 2], '광주': [0, -2, 10], '부산': [2, -2, 9], } # 3-1. 도시별 최근 3일의 온도 평균은? # 아래에 코드를 작성해 주세요. print('==== Q3-1 ====') ''' 출력 예시) 서울 : 평균온도 대전 : 평균온도 광주 : 평균온도 부산 : 평균온도 ''' for key, values in cities.items(): # print(key, ':', sum(valu...
true
ae97a0164a799d7aa08f54a96b50dabb83ba7c41
isurusathsara98/wumpus-world-agent
/Stimulatingagent.py
UTF-8
52,673
2.90625
3
[]
no_license
''' ----- MINI PROJECT 01----- Name : D.L.I.Sathsara Index_No: 17/ENG/099 Course : CO3205 Intelligent Systems Submission Date : 13/5/2021 ''' #global variables declared Agent_loc=[] Agent_view=[['0']*5 for _ in range(5)] Environement=[] percived=[] mov_check=False moves=[] pervious_dir='up' wumpus_loc=Fa...
true
b9c27f7c7949f6d699af6a580f30f405bc1c926a
thebestday/python
/L4/home/file.py
UTF-8
2,537
3.28125
3
[ "MIT" ]
permissive
import random import functools import datetime print("Задача 1") # 20 имен names = 'Vlad Ksenia Ilya Ivan Kostya Kosmos Katya Darya Valya Nikita Serezha Vitya Sarah Petya Victor Seva Ludmila Maksim Vova Raya'.split() list_random_names = [] newName = '' def NameList(names, n): ''' :param names: список имен ...
true
8b9498c499ee31f39f3e409f59364956f75d64fc
AnJoie/MultipurposeRobots
/Scripts/main.py
UTF-8
2,966
2.828125
3
[]
no_license
import numpy as np from scipy.integrate import odeint from scipy.optimize import minimize from dataclasses import dataclass mLs = [3.0, 2.9, 3.1, 3.2, 2.8, 1.5, 2.5] mRs = [3.0, 3.1, 2.9, 2.8, 3.0, 3.0, 2.0] @dataclass class Velocities: mLmR3: np.array mL29mR31: np.array mL31mr29: np.array mL32mr28...
true
8743dc5e3afa089cf5659769eae86acdae3d0597
DaMSL/K3-Benchstack
/launcher/src/entities/result.py
UTF-8
662
2.921875
3
[]
no_license
# Results of an exeriment. # 3 Possibilities: # Failure => Query failed to run. # Skipped => The system can't run the query, so it was skipped. # Success => Query ran successfully, elapsed time was captured # The Result class represents a single row in the results table. class Result: def __init__(self, tri...
true
ced4e201339d224ba4f381621e37572807de088c
ramsakal/python_guided_project
/q01_create_class/build.py
UTF-8
1,542
3.140625
3
[]
no_license
# %load q01_create_class/build.py import pandas as pd import numpy as np import math 'write your solution here' class complex_number: '''The complex number class. Attributes: attr1 (x): Real part of complex number. attr2 (y): Imaginary part of complex number. ''' def __init__(self, r...
true
2567dfa102fcb11dad62489ee3f5b133217d8c52
linkseed18612254945/cs231n
/lecture4.py
UTF-8
2,238
2.828125
3
[]
no_license
import numpy as np from lecture3 import softmax_loss_batch, predict_by_weight import seaborn from matplotlib import pyplot as plt from data_utils import cifar10_datasets import tqdm def random_optimize(X_train, Y_train): best_loss = np.inf best_w = None all_losses = [] for _ in tqdm.tqdm(range(1000)): ...
true
8eb0f8012d63d902a8a3e6bfe4398ee280d91ef9
filipefilardi/SDV-Summary
/sdv/playerInfo.py
UTF-8
7,923
2.53125
3
[ "MIT" ]
permissive
import json from sdv import validate from sdv.savefile import get_location ns = "{http://www.w3.org/2001/XMLSchema-instance}" animal_habitable_buildings = ['Coop', 'Barn', 'SlimeHutch'] class player: """docstring for player""" def __init__(self, saveFile): # super(player, self).__init__() sel...
true
5fb237e93243a01b1618a1cc0a577c2a4196ba28
SinaPourSoltani/EV3_Sokoban
/Python/MapGenerator.py
UTF-8
3,632
3.28125
3
[]
no_license
from defines import * import random import numpy as np from utilities import Pos class MapGenerator: def __init__(self, row, col): self.rows = row self.cols = col self.environment = np.chararray((self.rows, self.cols), unicode=True) self.moves = [Pos(-1, 0), Pos(0, -1), Pos(1, 0), ...
true
c2dac9e92ec61e62ed388cc6cea242d0c7dba98d
yukinarit/pyserde
/examples/variable_length_tuple.py
UTF-8
378
3.046875
3
[ "MIT" ]
permissive
from dataclasses import dataclass from typing import Tuple from serde import serde from serde.json import from_json, to_json @serde @dataclass class Foo: v: Tuple[int, ...] def main() -> None: f = Foo(v=(1, 2, 3)) print(f"Into Json: {to_json(f)}") s = '{"v": [1, 2, 3]}' print(f"From Json: {fro...
true
ea945d9b3f469a1f5316990705f1b6cbf14f78ed
vdorbala/ENPM661
/Project2/rigid_robot_rodrigo.py
UTF-8
17,081
2.8125
3
[]
no_license
import numpy as np import sys import cv2 import time import math # Defining the workspace def new_rec_coeff(distance): coeff1=np.array(np.polyfit([95,100],[30,39],1)) coeff2=np.array(np.polyfit([100,35],[39,77],1)) coeff3=np.array(np.polyfit([35,30],[77,68],1)) coeff4=np.array(np.polyfit([30,95],[68,30...
true
0cebeb7e830ead1c5477501eef85e304622bda71
Vicky-hackego/playground-3pi58ybu
/test.py
UTF-8
2,385
2.734375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np max_t = 360 #durée de la simulation sub = 1 #subdvision integrator = 'RK4'#Methode d'intégration : Euler ou RK4 R0 = 4.0 #R0 : taux de reproduction initial Rc = 0.8 #Rc : taux de reproduction en confinement Rd = 1.2 #Rd : taux de reproduction en déconfinement tc = ...
true
07162c299b56e9546733028d4275a5f524a29e38
MasMat2/Math
/roots.py
UTF-8
669
2.96875
3
[]
no_license
import re def complex_root(a, b): s = root([[1,a],[1,a]])[0] s[-1] += float(b)**2 return s def root(r): if len(r) == 1: return r dev = [0 for i in range(len(r[0]) + len(r[1]) - 1)] for i in range(len(r[0])): for j in range(len(r[1])): dev[i + j] += r[0][i] * r[1][j...
true
93fb4ea09237e56d7537eb635c601596bcf0263e
xxllea/DouBan-Spider
/book/book_person_page_parse.py
UTF-8
4,516
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- import re import json import requests from lxml import etree class PersonPageParse: def __init__(self, person_id, person_info_html): """ 初始化 :param person_url: :param person_info_html: """ self.person_id = person_id self.person_info_...
true
89520cb3dbfb9b81d35d71f9ff99603fef95878f
Nguyenjimmy101/CompilerDesign
/compiler/compiler.py
UTF-8
7,761
2.984375
3
[]
no_license
def switch_arith_token(token): if token == '+': return 'add' elif token == '-': return 'sub' elif token == '*': return 'mult' elif token == '/': return 'div' else: raise SyntaxError('"%s" is not a valid arithmetic token' % token) class Compiler(object): ...
true
5b6278c62a749cbdefa2e0774543d843d9b323ea
ez4lionky/Leetcode-practices
/2022/2022-04/04-01/954.py
UTF-8
512
3.296875
3
[]
no_license
from typing import List from collections import Counter class Solution: def canReorderDoubled(self, arr: List[int]) -> bool: c = Counter(arr) if c[0] % 2 != 0: return False for v in sorted(c.keys(), key=abs): # print(v) if c[2*v] < c[v]: ...
true
a047ef6ab9f8793096d028947050b7120e67b10e
mattjhussey/pemjh
/tests/challenge4/test_challenge4.py
UTF-8
558
2.546875
3
[]
no_license
""" Tests for challenge4 """ import pytest from robber import expect from pemjh.challenge4 import main @pytest.mark.parametrize('test_input, expected', [ pytest.param(2, 9009, marks=pytest.mark.example), pytest.param(3, 906609...
true
e13f184e7f27ad006b8520694105e1c87a3155f7
jh-jeong/euler-project
/p30_dig_5th.py
UTF-8
379
3.0625
3
[]
no_license
''' Created on 2015. 5. 12. @author: biscuit ''' # problem 30 # Digit fifth powers def main(): res = [] for i in range(360000): n = i p = 0 while n != 0: p += (n % 10) ** 5 n /= 10 if i == p: res.append(i) res = res[2:] print sum...
true
4b97af557fbe6b70ac970627af90194642c80755
jpennors/local_password_manager
/modules/menu/menu_launcher.py
UTF-8
1,657
3.109375
3
[]
no_license
from modules.utils.screen_manager import ScreenManager from modules.menu.menu_option import MenuOption from modules.menu.menu_actions import MenuAction from modules.utils.input.input import Input from modules.utils.input.input_type import InputType class MenuLauncher: menu_options = { "0": MenuOption("Di...
true
03b4ba2d0118d5e0d7d08ef01e4ed6a6624f481f
samvram/eigen_faces
/main.py
UTF-8
4,013
2.6875
3
[]
no_license
# part a import matplotlib.cm as cm import numpy as np from matplotlib import pylab as plt from matplotlib import pyplot as plt1 from scipy import misc from sklearn.linear_model import LogisticRegression def get_feature_matrix(path, num, average_face, eigen_face): testing_labels, testing_data = [],[] with o...
true
0046fcbfa491126cb8cd4926cdd3250585f8aa83
xanderd123/Palette_Import
/palette_import_lib.py
UTF-8
308
2.609375
3
[]
no_license
""" functions to read the a CSV file and put it into a dictionary """ def read_palette_from_file(palette_filename): """ read the palette from the csv file. Each row is a key and an RGB triple. Make that RGB triple into a TUPLE and then put into a dictionary with the key. """ pass
true
edf48ddbf8125f238ac83444aca508fc0ef48cfc
DavidXie99/TruthTableAutomation
/connective_statements.py
UTF-8
200
2.9375
3
[]
no_license
def imp(prop1,prop2): if prop1: return prop2 return True def inf(prop1,prop2): if prop1: return True return not prop2 def iff(prop1,prop2): return prop1 == prop2
true
5a5b84484ade92f5c2b9d883459b705ab71f012d
Chabannes/CatClassification_FromScratch
/helper.py
UTF-8
11,754
3.21875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import h5py def get_training_testing_data(train, test): train_file = h5py.File(train, 'r') test_file = h5py.File(test, 'r') x_train = train_file['train_set_x'].value y_train = train_file['train_set_y'].value x_test = test_file['test_set_x'].valu...
true
dce626b5e6542672ecb539aec026cb9ca6fec9ea
mvwicky/NotesMiscellanea
/pythonSource/mlb_gameday/mlb_gameday/retrosheet/models.py
UTF-8
438
2.578125
3
[ "BSD-2-Clause-Views" ]
permissive
from django.db import models # Create your models here. class Team(models.Model): year = models.SmallIntegerField() abbreviation = models.CharField(max_length=10) league = models.CharField(max_length=2) city = models.CharField(max_length=200) name = models.CharField(max_length=200) def __str...
true
31b8b3c3d1fc95e64504c956b698da870ef9cb08
butterkaffee/uplift
/logistic_uplift.py
UTF-8
692
2.875
3
[]
no_license
""" Uplift-Modeling with Logistic Regression """ # Author: Michael Fitzke <m.fitzke@gmail.com> from sklearn import linear_model import numpy as np class LogisticUplift(linear_model.LogisticRegression): def fit(self,X,T,y): #setting up Treatment Variables X*T X_T = X*T X = np.concatenate((X,X_T), axis...
true
d4477dc7df52a1093f8ae0690a123eb92c5ef497
camohe90/-mision_tic_G1
/s16/16.4_es_par.py
UTF-8
169
3.296875
3
[]
no_license
def es_par(numero): if numero % 2 == 0: return "Es par" else: return "No es par" print(es_par(23123123123123121)) print(es_par(4))
true
4cb818708712987ce0a0dcfa1fc2310e182c6c5a
pandrey2003/Kinomonster-backended
/app/mod_db/news.py
UTF-8
296
2.625
3
[ "MIT" ]
permissive
# session is for interacting with the db # News is the table of the db from app.mod_db import session, News def return_last_piece_of_news(): # The function which returns the last piece of news all_pieces = session.query(News).all() last_piece = all_pieces[-1] return last_piece
true
02287aa9c85afaf9093c77f412a63870a6fda245
kishan-py/tsb
/backtesting/train.py
UTF-8
1,514
2.984375
3
[]
no_license
# Takes train data and give it to model_knn to train ML model and saves trained ML model # Importing required modules import pickle import pandas as pd import datetime #from app import symbol,s_year,e_year,amount from backtesting.model_knn import Model from backtesting.fetch_stock_data import FetchData # fi...
true
dc9b56aded6d0ecd13191eb53f824dca5c6b5029
bencoster/Deepfake-faces
/preprocess_face/augment_data.py
UTF-8
10,439
2.625
3
[]
no_license
import os import cv2 as cv def make_augmentation(): src_augmented_path = 'data/training_data/src/src_augmented/' dst_augmented_path = 'data/training_data/dst/dst_augmented/' mask_src_augmented_path = 'data/training_data/binary_masks/mask_src_augmented/' mask_dst_augmented_path = 'data/training_data/b...
true
566875071a9f70a9de8402defc9af8d7acaeb35e
Arthanadftz/Codeacademy_ex
/calendar.py
UTF-8
3,127
4.0625
4
[]
no_license
"""This is calender witch gives can view all the data, add/delete/update events from it by your comand""" from time import sleep, strftime USER_FIRST_NAME = 'Nikita' calendar = {} def welcome(): print('Welcome, %s.' %(USER_FIRST_NAME)) print('Calendar starting...') sleep(1) print "Today is: " + strftime("%A %B...
true
0d51b87e4be0e5f59c07e68aa866d721ad5d890c
Servillian/Python_Prob
/Problems/Capital City.py
UTF-8
335
3.78125
4
[]
no_license
def is_capital(state, city): dict = {"New South Wales": "Sydney", "Queensland": "Brisbane", "South Australia": "Adelaide", "Tasmania": "Hobart", "Victoria": "Melbourne", "Western Australia": "Perth"} if dict.get(state) == city: return "True" else: return "False" print(is_capital("Queensland...
true
3fe1a9f1594f61640e1d2b43b6a385a499e59cc7
kazuyaujihara/kmol
/src/mila/aggregators.py
UTF-8
3,769
2.546875
3
[ "MIT" ]
permissive
import importlib from collections import OrderedDict from copy import deepcopy from typing import List, Dict, Type, Any import numpy as np import torch from .factories import AbstractAggregator, AbstractConfiguration, AbstractExecutor class PlainTorchAggregator(AbstractAggregator): def run(self, checkpoint_pat...
true
584a79387e71858b6ff75ed9496ae6fb6244a363
belomita/testbed
/javascript/douban/robot.py
UTF-8
2,082
2.515625
3
[]
no_license
#encoding: utf-8 import re, urllib, urllib2, cookielib class DoubanRobot: email = '' password = '' login_path = 'https://www.douban.com/accounts/login' def __init__(self, debuglevel=1): self.cookiejar = cookielib.LWPCookieJar() self.opener = urllib2.build_opener(urllib2.HTTPCooki...
true
744f45b7c2b20bda488d11a29c32ae07313e640b
gilboab/PoolSafetySystem
/pool_detect_edge.py
UTF-8
608
2.609375
3
[]
no_license
# CS231A Homework 0, Problem 3 import numpy as np import matplotlib.pyplot as plt from scipy import misc import cv2 def main(): # img = cv2.imread("outdoor-pool_lines.jpg") img = cv2.imread('./Pool_Images/pool4.jpg') # img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) # img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)...
true
8dd347f86b0e06a42d4443df12c85b993056fe7c
marceljahnke/adaptive-fairness
/obtainMetrics2.py
UTF-8
5,280
2.625
3
[]
no_license
import numpy as np import sklearn as sk from Utils import compareMatrixWithScalar def obtainMetrics2(classifier, x, y, sensitive, objectiveWeights=None): objectiveWeights = np.zeros(5, 1) if objectiveWeights is None else objectiveWeights decisionThreshold = 0.5 nonSensitive = np.logical_not(sensitive) ...
true
15484740069ae33bcb5d19681bd02d6ba3c651c8
whiteh/code-kata
/sorting.py
UTF-8
1,170
3.875
4
[]
no_license
## Sorting balls class Rack: def __init__(self): self.balls = [] def getPosition(self, item): for a in list(range(len(self.balls))): if (self.balls[a]>=item): return a return len(self.balls) def add(self, item): pos = self.getPosition(item) self.balls.insert(pos, item) def as...
true
bffee9fb62857c4b220a8297bd60e5ee8263fd7f
inthebackofmymind/ocr_on_a_pdf
/get_word_freq
UTF-8
444
3.203125
3
[]
no_license
#!/usr/bin/python import re from collections import Counter inFile = 'eng.txt' outFile = 'word_frequency.txt' book = [] with open(inFile, mode="r") as f: x = f.read() book = Counter(re.split(r"\W+", x.lower())) common = book.most_common() with open(outFile, mode='w') as f: y = str(common).replace('),',...
true
590883be401f71024cc825c19b99e42d1d861f61
ANUGU-ARAVIND-REDDY/movie-recomendation-engine-python-tkinter
/movie_recommender.py
UTF-8
3,344
3.421875
3
[]
no_license
import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics.pairwise import cosine_similarity #these are the helping functions def get_title_from_index(index): return df[df.index == index]["title"].values[0] def get_index_from_title(title): return df[df.title == t...
true
a4bc3244e8d11c8636ef0654eb224f2d5ec10cf4
Viarus213/python
/wielomiany/wielomiany.py
UTF-8
3,788
3.328125
3
[]
no_license
import numpy as np import random import matplotlib.pyplot as plt import copy import math import time class Wielomian(list): """ Add two polynomials """ def add_poly(poly_a, poly_b): max_len = len(poly_a) if len(poly_b) > len(poly_a): max_len = len(poly_b) poly_c = np.zero...
true
4a9a61f899850477920159b3c2b88e5beb0d0058
SolbiatiAlessandro/CLRS
/Chapter22/graph.py
UTF-8
2,075
3.6875
4
[]
no_license
"""implementation of Graph class for BFS/DFS""" class Graph(object): """ implementation of a non-weighed non-directed graph Args: color: dict of char, where key is the node and value is the color distance: dict of int, key is the node and value is the distance from root ...
true
edfe8de67e4ba70f26f51a5f4774810d859068b3
Suraj7860/aidemo
/bin/diaman/utils/doccano_interaction.py
UTF-8
3,595
3
3
[]
no_license
import collections import jsonlines import copy import re def doccano_file_to_word_dict(filepath): """Extract the word dictionnary after doccano labelling. Parameters ---------- filepath : str path to the doccano output file. """ word_dict = {} with jsonlines.open(filepath, 'r') ...
true
76a3aad8337b0b9268e2bf3ad499bffda37de1ce
pedromateussc/codigos-do-pc-de-casa
/testerev.py
UTF-8
734
3.75
4
[]
no_license
print(" == Valor do imposto ==") salario = (float) (input("Qual o valor do seu salario? ")) if salario <= 1556.61: print("Nao ha imposto") elif salario >= 1556.62 and salario <= 2347.85: imposto = 0.075* salario print("Valor de imposto retido: R${:.2f} ".format (imposto), "reais") elif salario >= ...
true
be9f5670cacf6d4329e3818c9005c21f392c0371
minghaoM/pytest_demo
/sut/mouse_gesture.py
UTF-8
574
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ @description: """ __author__ = "sa" from browser_base import BrowserBase GESTURE_VAL_FORWARD = 1 GESTURE_VAL_BACK = 2 GESTURE_TYPE_1 = 1 GESTURE_TYPE_2 = 2 class MouseGestureBrowser(BrowserBase): def do_gesture(self, gesture_type): """ 模拟打开新标签 """ p...
true
1d66789c1c5c53b04ac8bcc3b4b8f0f4aa35a28c
ericcai9907/Routing
/json_pathfinder.py
UTF-8
5,297
2.71875
3
[]
no_license
''' Mapping stuff for Wing ETA/Routing Engine ''' ''' ALSO NEED SOMETHING THAT GIVES THE NEAREST NODE TO A GIVEN LAT LONG... ''' from updatedGraph import haversine #import pymongo import json from collections import deque def Get_Nearest_Node(lat,lon, nodes): node_list = list(nodes.items()) nea...
true
844fb1ef1a23576805f82811e98ca2905213256d
qader1/pathfind-and-sort-visualizer
/sort_algorithms.py
UTF-8
5,883
2.828125
3
[]
no_license
import pygame import time from cell import allow_quit def v_bubble_sort(lst, w, screen, delay): delay = delay/100 comparisons = 0 swaps = 0 font = pygame.font.Font('freesansbold.ttf', 15) for i in range(len(lst)): for j in range(len(lst)-i-1): comparisons += 1 ...
true
f5187af398d8118ed88806d53499b54dd93a3b1e
joey79424/20190704
/demo27.py
UTF-8
812
2.875
3
[]
no_license
l1 = ['sunday', 'monday', 'tuesday'] t1 = ('sunday', 'monday', 'tuesday') print type(l1), type(t1), len(l1), len(t1) print [len(e) for e in l1] print [len(e) for e in t1] # l1 += 'wedwsday' print "before add list:", hex(id(l1)) l1.append('wedesday') print l1 print "before add list:", hex(id(l1)) print "\n" print "befor...
true
57e885dc384fa7a8c174046d96315fcb22cd2db7
Alegarse/Python-Exercises
/Ejercicio1_2.py
UTF-8
471
4.4375
4
[]
no_license
#! /usr/bin/python3 # Ejercicio 2. Escribir un algoritmo que imprima el mínimo, el máximo y la media de tres números. lista=[0,0,0] lista[0]=int(input("Introduce el primer numero: ")) lista[1]=int(input("Introduce el segundo numero: ")) lista[2]=int(input("Introduce el tercer numero: ")) print("El minimo es el numero...
true
296894d8ca4e2242203292a0b1bad8edcbf05a66
collmanxhu/Python-Books
/Python Crash Course/Chap 2 Variable and Data Type/string_manipulate.py
UTF-8
3,489
4.40625
4
[]
no_license
# escape character \ lets you use characters that are otherwise impossible to put into a string. spam = 'Say hi to Bob\'s mother.' print(spam) print("Hello there!\nHow are you?\nI\'m doing fine.") # Raw Strings r completely ignores all escape characters and prints any backslash that appears in the string print...
true
be6e28ac1bc55ae2a35764bba5664b2ee7c2a6b7
pie-boy/what
/Astro Pi alert.py
UTF-8
2,032
3.03125
3
[]
no_license
from sense_hat import SenseHat sense = SenseHat() sense.clear ## finding the temp :success: #temp = sense.get_temperature() #print(temp) ## ## finding pressure :success: #pressure = sense.get_pressure() #print(pressure) ## #interacting with sensor reuslts: red = (255,0,0) green = (0,255,0) #take reading f...
true
d40170b26e3efa868b1626cff9c63b7e83a83145
xxxnoxisxxx/PITE-llinear_solver
/matrix.py
UTF-8
1,506
3.25
3
[]
no_license
#!/usr/bin/env python import logging #Klasa przechowujaca nasz uklad rownan class Matrix(object): #Konstruktor podstawowy def __init__(self): #Przechowuje parametry naszego ukladu rownan self.eqParams = [] #Przechowuje rozwiazanie naszego ukladu rownan self.solution = () ...
true
7d418b4ba96c47c744a2f7eacb116dbcc2184711
CrownClown24/Compu-blanda
/Tercer previa/Logica Difusa/Aplicacion futbol/futbol.py
UTF-8
707
2.828125
3
[]
no_license
import numpy as np import skfuzzy as fuzz import matplotlib.pyplot as plt x = np.arange(30,80,0.1) lento= fuzz.trimf(x,[30,30,50]) medio= fuzz.trimf(x,[30,50,70]) medio_rapido= fuzz.trimf(x,[50,60,80]) rapido= fuzz.trimf(x,[60,80,80]) plt.figure() plt.plot(x,rapido,'b',linewidth=1.5,label='Rapido')...
true
d385f4df47e4f9463316fa94462e1b1d7301ecb2
Pheeck/bitmex
/frontend/orderframes.py
UTF-8
10,588
2.765625
3
[]
no_license
""" Frames for order windows. """ import tkinter import tkinter.messagebox import tkinter.ttk import backend.accounts as accounts import backend.core as core # # Constants # SPINBOX_LIMIT = 1000000000 # # Classes # class Main(tkinter.Frame): """ Frame present in every order window. Requires parent to ha...
true
eecdff0852ab8c994531aead9c07aaf8e08d89d7
Arbalestrille/DubinsAirplane
/examples.py
UTF-8
3,762
2.875
3
[]
no_license
""" This is the file to execute examples of the Dubins Airplane mode that supports 16 cases of possible trajectories @author: Kostas Alexis (konstantinos.alexis@mavt.ethz.ch) """ import numpy as np import pylab from mpl_toolkits.mplot3d import Axes3D from dubins_airplane.path import dubins class Vehicle(object): ...
true
35dbb11a1deb1d7a9f2079065dcada78893a00a9
igorventorim/rava
/virtual_class/model/domain/simulado.py
UTF-8
1,050
2.515625
3
[]
no_license
# from app import db from config.configuration import Configuration class Simulado(Configuration.db.Model): __tablename__ = "simulado" id = Configuration.db.Column(Configuration.db.BIGINT, autoincrement=True, primary_key=True) questao = Configuration.db.Column(Configuration.db.String(1000), nullable=False...
true
5702ba31f6126cdc96eeb1ecda5ca1b00961c1fa
jAchillus/pythontools
/tools/getwebresource/WebRequest.py
UTF-8
879
3
3
[ "Apache-2.0" ]
permissive
# -*- coding:utf-8 -*- import urllib.request class WebRequest(object): """网页数据对象""" def __init__(self, url, type='GET', headers={}): super(WebRequest, self).__init__() self.req = urllib.request.Request(url) self.headers = headers for key, value in headers.items(): ...
true
f24067395550b6d8044e288db3be9b90208b4020
emorgan00/Advent2019
/day03.py
UTF-8
682
3.09375
3
[]
no_license
with open("input.txt", "r") as f: A = f.readline().split(",") B = f.readline().split(",") pos = {} x, y, d = 0, 0, 0 dx, dy = 0, 0 for line in A: c = line[0] if c == 'U': dx, dy = 0, -1 if c == 'D': dx, dy = 0, 1 if c == 'R': dx, dy = 1, 0 if c == 'L': dx, dy = -1, 0 for _ in range(int(line[1:])): d ...
true
a51a9002f65af946b3cd57d391cde650c60df2cd
kataya1/Snippets
/modules/moduleimporting.py
UTF-8
299
2.65625
3
[]
no_license
import sys ''' sys.path is a list sys.path is where the python searches for the module you're importing in the order of the list since it's a list you can append to it append to it a path where you want the interpreter to look ''' # print(sys.path) sys.path.insert(1,'F:\\usbfiles') print(sys.path.)
true
709ee5415cc6ba074e87dac2b627b4bb49af1b9e
chaparalaanvesh/assignments
/copyfile_newfile.py
UTF-8
566
4.0625
4
[]
no_license
"""Write a program that given a text file will create a new text file in which all the lines from the original file are numbered from 1 to n (where n is the number of lines in the file).""" def copyfile_newfile(f): old_file = open('C:\Python27\len_of_words.txt') new_file = open('C:\Python27\ newfile.txt', 'wt'...
true
402b97c82588789f57780e82e7b92eae008b4016
alvaropp/AdventOfCode
/2016/day23-1.py
UTF-8
1,358
2.78125
3
[ "MIT" ]
permissive
def parse_instruction(idx, inst): inst = inst.split() command = inst[0] arg1 = inst[1] try: arg2 = inst[2] except: arg2 = None jump = None if command == "cpy": try: arg1 = int(arg1) except: arg1 = regs[arg1] regs[arg2] = arg1 ...
true
b3499ae0385899ecc0001fbf1a635ffcae314d96
nikhilasm/ecse4850
/project5/data_builder.py
UTF-8
3,062
3.296875
3
[]
no_license
# Nikhilas Murthy # ECSE 4850 Final Project # Data Conversion and Splitting Code import numpy as np import pickle as pkl ############################################################################### # Parameter to determine the ratio of training sample count to testing sample # count, i.e. a VALID_SPLIT_RATIO of 0....
true
8168f80290766a03c282b8a98cc8927d649a1ca4
Gloom-er/training_numpy
/6.py
UTF-8
143
2.8125
3
[]
no_license
import numpy as np print(np.zeros((2, 3))) print(np.ones((3, 3))) print(np.eye(5)) print(np.full((3, 3), 9)) print(np.empty((3, 2)))
true
e51259bebc1f327f61b3d35c44706916d162f92e
eliassundvoll/Yatzy
/Yatzy.py
UTF-8
6,458
3.5625
4
[]
no_license
import random def roll_dice(dice_number): dice_number = random.randint(1,6) return dice_number def roll(roll_dice, dices): #first roll:roll1 = [] for i in range(0, len(dices)): dices[i] = roll_dice(dices[i]) print ("First roll: " + str(dices)) #second roll:roll2 = [] roll2 = [int...
true
b1c599d4401a1805c4878adea96be0f3f45e19a4
Farzana-Kabir/PersonalScheduler
/logger_util_func.py
UTF-8
1,002
2.546875
3
[]
no_license
import inspect import os import pickle import time import notify2 def check_screen_on(): x = os.popen("xset -q").read() return "Monitor is On" in x def send_notification(name, message, icon_path='stat.png'): n = notify2.Notification(None, icon=icon_path) n.set_urgency(notify2.URGENCY_NORMAL) n....
true
9f0f161f58bd1b63465af10ae606a6ae11fd016c
koudyk/PyMARE
/pymare/tests/test_estimators.py
UTF-8
3,292
2.671875
3
[ "MIT" ]
permissive
import numpy as np from pymare.estimators import (WeightedLeastSquares, DerSimonianLaird, VarianceBasedLikelihoodEstimator, SampleSizeBasedLikelihoodEstimator, StanMetaRegression, Hedges) def test_weighted_least_squares_esti...
true
a1c7912c9c510d2ba1b3390d9ca52575178acda7
lazybones1/Python_study
/Books/파이썬과 OpenCv를 이용한 컴퓨터 비전 학습/1장 입출력과 GUI/resizeAndFlip.py
UTF-8
950
2.890625
3
[]
no_license
import cv2 img = cv2.imread('data/Lena.png') print ('original image shape: ', img.shape) cv2.imshow('original', img) width, height = 128, 256 resized_img = cv2.resize(img, (width, height)) print('resized to 128*256 image shape: ', resized_img.shape) cv2.imshow('resized_img', resized_img) w_mult, h_mult = 0.25, 0.5 r...
true
0e8fc2311ed8f8a350bb6aef73e236022a7ec76c
daporter/datacube-wms
/docker/auxiliary/index/assets/update_ranges.py
UTF-8
861
2.5625
3
[ "Apache-2.0" ]
permissive
from datacube_wms.product_ranges import update_all_ranges, update_range from datacube import Datacube import click @click.command() @click.option("--product", default=None) def main(product): dc = Datacube(app="wms_update_ranges") if (product is not None): print("Updating range for: ", product) ...
true
2352f6a9c2301bc5f46905cb9bfe7a3390b74bdf
zomblzum/DailyCoding
/task_9/sum_searcher.py
UTF-8
184
3.078125
3
[]
no_license
def find_max_sum_of_non_adjacent(array): previous, largest = 0, 0 for item in array: previous, largest = largest, max(largest, previous + item) return largest
true
a6c213efa1f10a76864a7d4e149f3a5fa2542102
dshuhler/codility_lessons
/codility/6_sorting/distinct.py
UTF-8
493
3.609375
4
[]
no_license
import unittest # You COULD solve this by sorting, but using a set has the same time complexity and is cleaner def solution(A): unique_values = set(A) return len(unique_values) class TestDistinct(unittest.TestCase): def test_sample(self): self.assertEqual(3, solution([2, 1, 1, 2, 3, 1])) ...
true
5b0583cf281d812d6bcd9a0d4eced7078d7a0099
ray075hl/RL_classic_algorithms
/Q_Learning/cartpole_keras.py
UTF-8
3,386
2.875
3
[ "MIT" ]
permissive
import gym import numpy as np import random from keras.layers import Dense, InputLayer from keras.models import Sequential from collections import deque from keras.optimizers import Adam, SGD model = Sequential() model.add(InputLayer(batch_input_shape=(None, 4))) model.add(Dense(10, activation='relu')) model.add(Den...
true