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
cca2269d2cb58175a0ef352f45aba6442159f2eb
Python
Tubbz-alt/docng
/documentation/tools/handbook-toc-creator.py
UTF-8
5,563
2.734375
3
[ "BSD-2-Clause" ]
permissive
# -*- coding: utf-8 -*- """ BSD 2-Clause License Copyright (c) 2020, The FreeBSD Project Copyright (c) 2020, Sergio Carlavilla This script will generate the Table of Contents of the Handbook """ #!/usr/bin/env python3 import sys, getopt import re language = 'en' # English by default def setAppendixTitle(language):...
true
9b675a758147b78cf38a29213b4448fe135243dc
Python
mingxoxo/Algorithm
/baekjoon/15657.py
UTF-8
486
2.953125
3
[]
no_license
# N과 M (8) # 백트래킹 # 22.11.01 # https://www.acmicpc.net/problem/15657 import sys input = sys.stdin.readline def backtracking(N, M, index, num, result): if M == 0: print(*result, sep=' ') return for i in range(index, N): result.append(num[i]) backtracking(N, M - 1, i, num, resu...
true
420d55d91ef2abaa3263d656eb50f6614e151bc8
Python
ADragonArmy/MadLib
/mad_lib_two.py
UTF-8
1,783
2.984375
3
[]
no_license
import colorama from colorama import init,Fore,Style init() import _main_ from _main_ import get_inputa import runpy bl = Fore.LIGHTBLACK_EX b = Fore.BLUE r = Fore.MAGENTA y = Fore.YELLOW g = Fore.GREEN c = Fore.CYAN t = Fore.LIGHTWHITE_EX rs = Style.RESET_ALL print(f"{Fore.RED}Please Separate All Inputs With A Co...
true
67b395c16b5f929889bf0d8117498b404cfa6797
Python
382982408/myPythonStudy
/pythonBase/init.py
UTF-8
506
4.1875
4
[]
no_license
''' __init__用于向class里面穿值 ''' class Human: name = "ren" gender = 'male' age = 25 __money = 5000 def __init__(self,a,b): print('#'*50) self.name = a self.age = b # Human.age = 40 print('#'*50) def say(self): print('my name is %s and I have %d' % (s...
true
c486a12d400d72bdeb9af4089312daa539d45d6c
Python
mbakker7/timml
/timml/constant.py
UTF-8
6,631
2.609375
3
[ "MIT" ]
permissive
import numpy as np import inspect # Used for storing the input from .element import Element from .equation import PotentialEquation __all__ = ['Constant', 'ConstantStar'] class ConstantBase(Element, PotentialEquation): def __init__(self, model, xr=0, yr=0, hr=0.0, layer=0, \ name='ConstantBase',...
true
5b8a8bcd7791de6a0b19584ac0f2b28098cead9a
Python
IzaakWN/TriggerChecks
/python/utils.py
UTF-8
840
2.96875
3
[]
no_license
# Author: Izaak Neutelings (July 2023) import os, shutil def ensureDirectory(*dirnames,**kwargs): """Make directory if it does not exist. If more than one path is given, it is joined into one.""" dirname = os.path.join(*dirnames) empty = kwargs.get('empty', False) verbosity = kwargs.get('verb', 0 )...
true
ade69b4d3dfb36f5f6a1c2e014272708a8de25f5
Python
hungvo304/Instance-Search
/3rd_party/vggish/matching_script.py
UTF-8
1,727
3.078125
3
[ "MIT" ]
permissive
import numpy as np import os from scipy import ndimage import sys def distance(vector_a, vector_b): l2_vector_a = np.linalg.norm(vector_a) + 0.001 l2_vector_b = np.linalg.norm(vector_b) + 0.001 return np.linalg.norm(l2_vector_a - l2_vector_b) def cosine(vector_a, vector_b): l2_vector_a = np.linal...
true
c05dcd2ca1148d857acce5addf8cd827d683195f
Python
sashapff/mcmc-scaffolding
/preprocess/get_lengths.py
UTF-8
1,585
2.625
3
[]
no_license
import h5py if __name__ == "__main__": chr_indexes = ['MT', 'X'] for i in range(1, 23): chr_indexes.append(str(i)) contigs2chr = {} output_files = {} path_layouts = "/GWSPH/groups/cbi/Users/pavdeyev/HiCProject/layouts" path_output = "/lustre/groups/cbi/Users/aeliseev/aivanova/data/cont...
true
0a4837a4db9651c9fd094c7650193fd76cc78bba
Python
tjvanderende/NSkaartautomaat
/Applicatie/api/nsAPI.py
UTF-8
1,543
2.984375
3
[]
no_license
import requests import xmltodict import threading """ De data wordt steeds overgezet naar een lokaal bestand (.xml). Zodat er eigenlijk een lokale database wordt gegenereerd en de API ook zonder internet werkt. """ class NsRequest (threading.Thread): def __init__(self, url, filename): """ init functie ...
true
0286a75a29ab2114d2b5c2863ccaea79a4cf5f18
Python
Athenagoras/quantopian_momentum
/RVI.py
UTF-8
9,401
3.03125
3
[]
no_license
""" Author: Ian Doherty Date: April 13, 2017 This algorithm trades using RVI. """ import numpy as np import pandas as pd import math import talib # Instrument Class class Stock: # Creates default Stock def __init__(self, sid): self.sid = sid self.weight = 0 self.signal_line = list() ...
true
1ad601c9f25f39033ef7bbb2efb18cc50d218597
Python
anoopch/PythonExperiments
/Lab_Ex_20_biggest_of_three_nos_set.py
UTF-8
212
3.03125
3
[]
no_license
a=float(input('Enter first number : ')) b=float(input('Enter second number : ')) c=float(input('Enter third number : ')) d=set(a,b,c) count=len(d) print('Unique numbers - ',count) # TODO - Pending error
true
c41c0369aa864e32cd2d42bc481c152d96caf39e
Python
Chandramani/learningApacheMahout
/src/python/chapter3/src/CategoricalFeatureToPercentages.py
UTF-8
549
3.125
3
[]
no_license
__author__ = 'ctiwary' import pandas as pd class CategoricalFeatureToPercentages: def __init__(self): pass df = pd.read_csv("../../../../data/chapter3/adult.data.merged.csv") # df['IncomeGreaterThan50K'] = df['IncomeGreaterThan50K'].astype('category') # df['education'] = df['education'].asty...
true
0390df1029c9d786949eb6d4aacada591e553989
Python
rikithreddy/img-to-ascii
/log.py
UTF-8
799
2.671875
3
[]
no_license
import logging from constants import ( DEFAULT_LOG_LEVEL, DEFAULT_LOG_FILE_PATH, DEFAULT_LOG_FORMAT ) def setup_logger( path_to_logfile=DEFAULT_LOG_FILE_PATH, level=DEFAULT_LOG_LEVEL, ...
true
5a1647234cd919237145280b7c5e41142430b591
Python
eqasim-org/jakarta
/data/spatial/utils.py
UTF-8
2,362
2.578125
3
[]
no_license
import shapely.geometry as geo import numpy as np from tqdm import tqdm import geopandas as gpd import pandas as pd from sklearn.neighbors import KDTree import multiprocessing as mp def to_gpd(df, x = "x", y = "y", crs = {"init" : "EPSG:5330"}): df["geometry"] = [ geo.Point(*coord) for coord in tqdm( ...
true
aeff93e74b9917894f8f6c4d1a9e81ca8ca667f2
Python
AleksTk/table-logger
/examples.py
UTF-8
1,052
3.09375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import time import random import math from datetime import datetime from table_logger import TableLogger def print_simple(): tpl = TableLogger(columns='a,b,c,d') tpl(1, 'Row1', datetime.now(), math.pi) tpl(2, 'Row2', datetime.now(...
true
9d26dfe17199458f7d5e7d009da0458215f6ded2
Python
alter4321/Goodline_test_app_dev
/pas_gen.py
UTF-8
4,023
3.65625
4
[]
no_license
import random """ Объявляется функция генерации паролей. На первом цикле добавляется по одному из необходимых символов, на втором случайно добавляются символы, пока не наберется 12. В конце получившийся пароль перемешивается. """ def generate_password(): password = '' digit = '1234567890' ...
true
d389ac339eb3ef40e8d3cb1e6cce6e8103572fa4
Python
sritchie/catenary
/catenary/symbolic.py
UTF-8
5,016
2.890625
3
[]
no_license
"""Sympy version!""" import json import pickle from functools import partial import jax as j import jax.numpy as np import sympy as s from jax.config import config from pkg_resources import resource_filename from sympy.utilities.lambdify import (MODULES, NUMPY, NUMPY_DEFAULT, NUM...
true
388f770f6c2a04335edd19866751263cdba0b7ef
Python
AgnieszkaWojno/KonwersjaTypy-Python
/venv/NaBinarny.py
UTF-8
284
3.671875
4
[]
no_license
def convert_to_bin (digit): w = [] while digit>0: w = [digit % 2] + w # % - reszta z dzielenia digit //= 2 #część całkowita t = []; t = [5] + t t=[8] + t print(t) return w print("liczba binarna 125=",convert_to_bin(125))
true
2615ed97a15e34a83459a58eb9e699ceccccb9b2
Python
TheTurtle3/Python-Mega-Course
/Section 6 - User Input/str_format.py
UTF-8
65
2.65625
3
[]
no_license
def foo(string): string = "Hi %s" % string return string
true
ed2a11b5bd5a26c3c400dd29db982c0d73e89038
Python
Aohanseven/Fql_Project
/Scrapys/yaozh/yaozh/pipelines.py
UTF-8
2,338
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql import redis import pandas as pd from scrapy.conf import settings from scrapy.exceptions import DropItem redis...
true
a8254c8fa4faec089504d9e4783f7f105ac07a92
Python
Karom45/NASAmet
/NASAmet/apps/meteorites/models.py
UTF-8
1,558
2.515625
3
[]
no_license
from django.db import models import datetime # Create your models here. class Classes(models.Model): class Meta: db_table = 'Classes' verbose_name = 'Класс метеорита' verbose_name_plural = 'Классы метеоритов' classes_id = models.AutoField('id', primary_key=True, db_column='id' ,uniqu...
true
b5521f90f54f42deba342cdfd16f6da2bb9e2b3a
Python
kyoonkwon/TTT
/parse.py
UTF-8
2,991
2.671875
3
[]
no_license
import openpyxl from urllib.request import urlopen from bs4 import BeautifulSoup c_wb = openpyxl.load_workbook('./course.xlsx') c_sheet = c_wb["Courses Offered"] ''' 과목번호 과목명 AU 강:실:학 담당교수 강의시간 강의실 시험시간 성적 널널 강의 종합 ''' courses = [] for row in c_sheet.rows: row_value = [] for cell in row: row_value.a...
true
44a4cdb8bd957dff8af976eaf0ae20fa6ec12f50
Python
falondarville/practicePython
/guessinggame.py
UTF-8
863
4.6875
5
[]
no_license
# Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. import random random_number = random.randint(1, 10) user_guesses = 0 print("Please choose a number between 1 and 9. Enter 'exit' to stop playing"...
true
e0a26975717a4560f4f184dfd94261cb0577016c
Python
ColeRichardson/CSC148
/mini-exercises/mini exercise 2/chain.py
UTF-8
4,474
4.09375
4
[]
no_license
# Exercise 2, Task 2- A Chain of People # # CSC148 Summer 2019, University of Toronto # Instructor: Sadia Sharmin # --------------------------------------------- """ This module contains the following classes to represent a chain of people -- Person: a person in the chain. PeopleChain: ordered chain consisting of peopl...
true
8324f0938243bb7c2d61e5254e1c5ba95bec5f19
Python
shengxu0518/OpenAI-Projects
/cartpole/lunarlander.py
UTF-8
10,060
2.65625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 4 14:37:41 2019 @author: supperxxxs """ import numpy as np import copy import os import pickle import sys from reinforce_lib import func_approx_library as funclib class QLearner(): # load in simulator, initialize global variables def __i...
true
756b1ff17d5f9801c108b4c1c8c51ee3565ffa36
Python
matali1/adventofcode
/day02/checksum.py
UTF-8
1,288
3.421875
3
[ "Unlicense" ]
permissive
import click @click.command() @click.option('--file', help='File to get the checksum') def provide_checksum(file): if file: matrix = [] with open(file) as myfile: for line in myfile: row = [int(val) for val in line.split("\t")] matrix.append(row) ...
true
5c9ff36d6710c334e72abc5b9b58abc8a94758bd
Python
jjspetz/digitalcrafts
/dict-exe/error_test.py
UTF-8
343
3.328125
3
[]
no_license
#!/usr/bin/env python3 def catch_error(): while 1: try: x = int(input("Enter an integer: ")) except ValueError: print("Enter an integer!") except x == 3: raise myError("This is not an integer!") else: x += 13 if __name__ == "__main...
true
2baeee1bd66fdba6de8af1758e90b31f58013b16
Python
w1nteRR/algoLabs
/Lab1/Pool.py
UTF-8
3,034
3.578125
4
[]
no_license
import time class Pool: def __init__(self, address, volume, max_number): self.address = address self.volume = volume self.max_number = max_number def print_object(pool: Pool): print("Address: " + pool.address + ", water volume: " + str(pool.volume) + ", max number: " + str(pool.max_n...
true
2956aa2adf0422794b93d301beafe0ee9dac93f3
Python
wwllong/py-design-pattern
/others/Callable.py
UTF-8
338
3.078125
3
[ "Apache-2.0" ]
permissive
def funTest(name): print("This is test function, name", name) if __name__ == "__main__": print(callable(filter)) print(callable(max)) print(callable(object)) print(callable(funTest)) var = "Test" print(callable(var)) funTest("Python") """ True True True True False This is test functio...
true
e70722c2fb60ecc50b9175b21c47db2246e60898
Python
OYuZhe/some-easy-code
/sieve_of_Eratosthenes.py
UTF-8
468
3.5
4
[]
no_license
MaxLen = 10000000 #init Array primeArray = [1]*10250000 primeArray[0]=0 primeArray[1]=0 def findPrime(): #sieve of Eratosthenes for i in range(0,3200): if primeArray[i] == 1: mul = 2 IsNotPrime = i * mul while IsNotPrime <= MaxLen: IsNotPrime = i * mul primeArray[IsNotPrime]=0 mul += 1 def p...
true
5deb4a0e5b2c9d62cae4406feb4aba1752c07a40
Python
cgarrido2412/PythonPublic
/Challenges/Advent Of Code/adventofcode2020/day15.py
UTF-8
1,268
3.609375
4
[]
no_license
#! /usr/bin/env python3 import os def memory_game(starting_sequence, n): first_time_spoken = {} most_recently_spoken = {} current_index = 0 for number in starting_sequence: current_index += 1 if number in first_time_spoken: most_recently_spoken[number] = first_time_spoken...
true
9f7d4c40cb58888265d447c7c3374536f39171b2
Python
OaklandPeters/task_logger
/task_logger/enum/enum.py
UTF-8
18,504
3.328125
3
[ "MIT" ]
permissive
""" @todo: Refactor data, name, aliases --> name: getter, setter, deleter --> aliases: getter, setter, deleter --> data: getter only - returning [name] + aliases @todo: Requires changing the way validation determines whether to extract name from 'data'. I will have to carefully think about this ...
true
faf9b6c43594848415bcf914e117c63b073caec9
Python
CollinErickson/LeetCode
/Python/9_palindrome.py
UTF-8
411
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Apr 28 23:45:29 2017 @author: cbe117 """ class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ s = list(str(abs(x))) s.reverse() return abs(x) == int(''.join(s)) sol = Solution() print...
true
bd5b45792d360bf1e28ec9ea95f6f684dd3a36c0
Python
abeagomez/nonograms_solver
/solution.py
UTF-8
5,973
3.15625
3
[ "MIT" ]
permissive
from game import Game from bitset import Bitset import numpy as np import random as rd from generator import generate_game class LocalSearchSolution: def __init__(self, game: Game, initial: str = 'random', next: str = 'random'): self.game = game self.lists = [] self.generate_initial(initia...
true
b45b7d4cf718eec5976fafc045b8fea6ff04ee42
Python
joshuastay/Login-Data-Storage
/Password.py
UTF-8
10,838
2.859375
3
[]
no_license
import tkinter as tk import tkinter.ttk as ttk import pickle import os # global variables frame = tk.Tk() user = "Username" passw = "Password" open_labs = open("label.data", "rb") open_users = open("user.data", "rb") open_passwords = open("password.data", "rb") top_button_pos = [125, 280] top_back_color =...
true
8fcddaeb5e47c0c05a89b146e91277cc7f427ca8
Python
coronafighter/coronaSEIR
/deaths_per_capita.py
UTF-8
3,338
2.9375
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import sys import numpy as np import matplotlib.pyplot as plt import population import world_data countries, provinces = world_data.get_countries_provinces() countryPopulation = population.get_all_population_data() countries.extend(['Hubei']) # todo: single loop, cleanup countryDeaths = [] for country in countries:...
true
38fc5f84127a8546ec308ca7e97d2d0e11a29522
Python
AmanoTeam/amanobot
/examples/chat/countera.py
UTF-8
960
2.609375
3
[ "MIT" ]
permissive
import sys import asyncio import amanobot from amanobot.aio.loop import MessageLoop from amanobot.aio.delegate import per_chat_id, create_open, pave_event_space """ $ python3 countera.py <token> Counts number of messages a user has sent. Starts over if silent for 10 seconds. Illustrates the basic usage of `DelegateBo...
true
8db7fccd94c8cfa0b8142f6cc74dc4902f5320d5
Python
Porkenstein/EurogameAI
/rl_mcs/explorer.py
WINDOWS-1252
9,374
2.828125
3
[]
no_license
# Wrapper for PyBrain meant for Puerto Rico simulation # http://pybrain.org/docs/tutorial/reinforcement-learning.html # # Based on examples from: # http://simontechblog.blogspot.com/2010/08/pybrain-reinforcement-learning-tutorial_15.html # and the given simons_blackjack_example.py # # actionvaluenetwork # from pybrain....
true
d40b0516376ee279ab83c6d03a1904a76a4b39ae
Python
sechours/GamestonkTerminal
/gamestonk_terminal/stocks/behavioural_analysis/ba_controller.py
UTF-8
10,568
2.703125
3
[ "MIT" ]
permissive
"""Behavioural Analysis Controller Module""" __docformat__ = "numpy" import argparse import os from typing import List from datetime import datetime from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff from gamestonk_terminal.helper_funcs import get_flair from gam...
true
7420e34457816aada823101943e308daeb8dc9d5
Python
xeroxzen/fluffy-octo-computing-scripts
/reverse.py
UTF-8
63
2.921875
3
[ "MIT" ]
permissive
#! python3 for i in range(1, 13): print('*' * (12-(i-1)))
true
fdb0654a4f1998fbcbbe7019b3150ac3db6d2d4b
Python
shiva16/BciPy
/bcipy/acquisition/datastream/tcpclient.py
UTF-8
2,294
2.640625
3
[ "MIT" ]
permissive
"""Test client for the TCP server.""" import logging import socket from bcipy.acquisition.protocols import dsi logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s',) class Signal: running = True count = 0 def tcp_client(host, port, signal): client = soc...
true
c46047ae3e5dd82e9282607e3b433d60621d935c
Python
kaydee0502/Data-Structure-and-Algorithms-using-Python
/DSA/Stack/stockspan.py
UTF-8
579
3.28125
3
[]
no_license
class Solution: def calculateSpan(self,a,n): stack = [] spans = [] for i in range(n): if not stack: spans.append(1) else: while stack: if stack[-1][0] > a[i]: spans.append(i - sta...
true
51056f963acf46627ce4b392823fad2df3bb9907
Python
LvivD/GalaxyZoo
/src/.ipynb_checkpoints/dataloader-checkpoint.py
UTF-8
8,165
2.53125
3
[]
no_license
import os import pandas as pd import torch from torch.utils.data import Dataset from skimage import io class GalaxyZooDatasetTrain(Dataset): def __init__(self, csv_file, root_dir, first_elem=0, last_elem=1): self.annotations = pd.read_csv(csv_file) self.index_shift = int(len(self.ann...
true
d5d535f6d85f413f423551543db64228a978d6b6
Python
bpontes93/exCurso120Hrs
/exercícios/4 - Funções, args, kwargs/ex 2.py
UTF-8
536
4.46875
4
[]
no_license
# Resolução referente 4 - Funções, args, kwargs """ 2 - Crie uma função1 que recebe uma função2 como parâmetro e retorne o valor da função2 executada. Faça a função1 executar duas funções que recebam um número diferente de argumentos. """ def mestre(funcao, *args, **kwargs): return funcao(*args, **kwargs) def f...
true
f24bab25c5e30aa1a6b0b19df48925f039b8af4d
Python
luoqp123456/api_autotest
/commen/readexcel.py
UTF-8
1,597
3.421875
3
[]
no_license
# -*- coding:utf8 -*- import xlrd from xlutils.copy import copy def excel_to_list(xls_name, sheet_name): #读取Excel表格sheet下的用例数据 data_list = [] worksheet = xlrd.open_workbook(xls_name) #打开表 sheet = worksheet.sheet_by_name(sheet_name) #获取表的sheet header = sheet.row_values(0) ...
true
9712341874f48b86b4e9105c58bb8b066d8b0ed3
Python
usnistgov/optbayesexpt
/optbayesexpt/obe_socket.py
UTF-8
5,688
3.265625
3
[ "NIST-PD" ]
permissive
from json import dumps, loads from socket import socket, AF_INET, SOCK_STREAM class Socket: """Handles TCP communications The :code:`Socket` can be configured either as a 'server' or a 'client'. Server sockets wait for connections, receive messages and send replies. Client sockets initiate connection...
true
3387ad7cdeb1434cb9bed7b878390ecab5f5bbd9
Python
hysl/IntroToCompProg
/assign5/assign5_problem2b.py
UTF-8
371
3.984375
4
[]
no_license
# Helen Li # March 25, 2015 # Assignment #5: Problem #2b: Find all Prime Numbers between 1 and 1000 # This code finds all prime numbers between 1 and 1000 for p in range(2,1001): # All numbers to test for i in range(2,p): # All numbers between 2 and whatever the test number is if p%i == 0: bre...
true
ff86a7857244805a39a641c59bdd5f93a63addd6
Python
stavgrossfeld/baby_name_predictor
/serving_model.py
UTF-8
1,966
2.828125
3
[]
no_license
# export FLASK_APP=serving_model.py # run flask from flask import Flask, request, render_template import pandas as pd import nltk from sklearn.tree import DecisionTreeClassifier #from sklearn.cross_validation import train_test_split import pickle f = open('feature_names.pickle', 'rb') FEATURE_NAMES = pickle.load(f...
true
c58390a68fd7531a0087462850be08d45b419633
Python
lottege/smartgrid
/main.py
UTF-8
1,610
2.9375
3
[]
no_license
from algorithms import random_and_hillclimber_batteries, cable_list, cable_list_sneller, verre_huizen_eerst, \ buiten_naar_binnen, brute_force_batterijen, batterij_allerlei_hillclimber # import visualisatie as vis print("how would you like to place the batteries? " "\nto use: " "\n - cable_list press...
true
e9cd83a2ac24770e8f5262a6683f551c3be3888c
Python
dancb10/ppscu.com
/Stuff/memorview.py
UTF-8
159
2.5625
3
[]
no_license
from array import array numbers = array.array('h', [-2, -1, 0, 1, 2]) memv = memoryview(numbers) memv_oct = memv.cast('B') memv_oct.tolist() memv_oct[5] = 4
true
cffd0917dec97cf2085926bc69775e07078915ff
Python
azetter/retailer_enterprise
/Ham - Hmart/_Useful Jupyter and Python Scripts/mysql_test.py
UTF-8
982
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/python import MySQLdb try: db = MySQLdb.connect(host="127.0.0.1", # your host, usually localhost user="root", # your username password="Hammania", # your password db="projectcoffee") # name of the data base ...
true
4ffb581772ee58aaeb9dcf7f294e95e7c94c8458
Python
PeterSzakacs/convnet_euso
/src/cmdint/cmd_interface_visualizer.py
UTF-8
2,986
2.578125
3
[]
no_license
import os import argparse import cmdint.common.argparse_types as atypes import cmdint.common.dataset_args as dargs class CmdInterface(): def __init__(self): parser = argparse.ArgumentParser(description="Visualize dataset items") # input dataset settings group = parser.add_argument_group(...
true
330c94a9a3f16502e5432e9a136c784e60baf01f
Python
yixinj/cs4417asn2
/part3/mapper.py
UTF-8
732
3.546875
4
[]
no_license
#!/usr/bin/env python import sys for line in sys.stdin: # Processes each line of the file movie_id, movie_name, movie_genres = line.split('::', 2) # Strip blank spaces movie_id = movie_id.strip() movie_name = movie_name.strip() movie_genres = movie_genres.strip() # Processes the genres ...
true
dc9bdc6484875c10528903a1263872ab4481df79
Python
Aasthaengg/IBMdataset
/Python_codes/p02555/s978207014.py
UTF-8
278
3.03125
3
[]
no_license
#!/usr/bin/env python s = int(input()) mod = 10**9+7 if s == 1 or s == 2: print(0) exit() dp = [0 for _ in range(s+1)] dp[0] = dp[1] = dp[2] = 0 for i in range(s+1): for j in range(i-3, 2, -1): dp[i] += dp[j] dp[i] += 1 ans = dp[s]%mod print(ans)
true
d7a8c4005eccdb55e28dee43413d07b51062e6ea
Python
rasul-sharifzade/LearnPython
/list/demo_list_del.py
UTF-8
62
2.625
3
[]
no_license
thislist = ["apple", "banana"] del thislist[0] print(thislist)
true
2aeb91608537d3623ec7070b2f3b5f801deea707
Python
songquanhe-gitstudy/python_spider_demo
/pythonSpider_demo/DianPing.py
UTF-8
1,448
2.84375
3
[]
no_license
#!/usr/bin/python3 #-*- coding:utf-8 -*- import requests,sys #python Http客户端库,编写爬虫和测试服务器响应数据经常会用到 import re from bs4 import BeautifulSoup import urllib.parse import urllib.request #参考网址:http://blog.csdn.net/u010154424/article/details/52273868 print("正在从豆瓣电影中抓取数据...") #Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKi...
true
21f7922b8f31e524d83df8a17847a16fe7375712
Python
YorkSu/hat
/utils/timer.py
UTF-8
884
2.984375
3
[ "Apache-2.0" ]
permissive
import time class Timer(object): def __init__(self, Log, *args, **kwargs): self.Log = Log return super().__init__(*args, **kwargs) @property def time(self): return time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime()) def mktime(self, timex): return time.mktime(time.strptime(timex, '%Y-%m-%d...
true
4d7b8fd2ab01ec7fab9912ac627a55bfa7e79c1e
Python
MMTObservatory/pyINDI
/example_clients/blob.py
UTF-8
1,788
2.6875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python3.8 from pathlib import Path from tornado.web import StaticFileHandler from pyindi.webclient import INDIWebApp, INDIHandler # Configuration WEBPORT = 5905 # The port for the web app INDIPORT = 7624 # The indiserver port INDIHOST = "localhost" # Where the indiserver is running DEVICES = ["*"] # All...
true
5f6700bce21f8e2af19b111c620c7b816e6078b8
Python
tpopenfoose/OptionSuite
/optionPrimitives/optionPrimitive.py
UTF-8
2,058
3.125
3
[ "MIT" ]
permissive
from abc import ABCMeta, abstractmethod class OptionPrimitive(object): """This class is a generic type for any primitive that can be made using a PUT or CALL option and/or stock, e.g., iron condor or strangle. """ __metaclass__ = ABCMeta @abstractmethod def getUnderlyingTicker(self): ...
true
d231971612d6b0843802dcf04b2ad9ca29cec8ce
Python
limgeonho/Algorithm
/inflearn_practice/section6/수들의 조합.py
UTF-8
455
3.078125
3
[]
no_license
#수들의 조합 #기존의 조합문제와 같다 + sum이라는 변수를 추가해서 배수인지 여부 판단만... def DFS(L, s, sum): global cnt if L == k: if sum % m == 0: cnt += 1 else: for i in range(s, n): DFS(L+1, i+1, sum + a[i]) n, k = map(int, input().split()) a = [0] * k for i in range(n): p = list(map(int,...
true
cc5ec31461ddd8a6c0fdeacd93bad9e8d6599c7d
Python
mostafa-elhaiany/blobVolleyBallAi
/ball.py
UTF-8
1,986
2.984375
3
[ "MIT" ]
permissive
import pygame import os import random ballImage= pygame.transform.scale( pygame.image.load( os.path.join( "imgs","ball.png" ) ), (50,50) ) RADIUS=10 class Ball: velocity=15 def __init__(self,x,y): self.x=x self.y=y self.r=RADIUS self.height=0 self.top=0 ...
true
356478a4639f0b28988439f5afb957adf1c425c0
Python
callanmurphy/Darkness-Game
/classes.py
UTF-8
3,496
3.296875
3
[]
no_license
# Callan Murphy # 21/11/19 # Classes File import pygame import random WIDTH = 1276 HEIGHT = 800 class Thing: """Parent class for any object on screen""" def __init__(self, img, sizex, sizey): self.img = pygame.transform.scale( pygame.image.load(img).convert_alpha(), (sizex, sizey)) ...
true
8dadd0c6b6dba647654d64ea9612c81759052d15
Python
erlendw/INF3331-erlenwe
/Assignment4/c_in_python_cython/mandelbrot_3.py
UTF-8
325
2.765625
3
[]
no_license
import m import time from PIL import Image def createMandelbrot(startx = -2.0,endx = 2.0,starty = -2.0,endy = 2.0): starttime = time.time() data = m.me(400,400, startx,endx,starty,endy) img = Image.fromarray(data, 'RGB') img.save('mandelbrotinC.png') endtime = time.time() print endtime-startt...
true
04110f3d95f4ffff0cd4d7196db4c969f198d089
Python
lemony3650/basic_python
/basic/lesson_9.py
UTF-8
820
2.65625
3
[]
no_license
# 拿json数据 # from __future__ import (absolute_import, division, print_function, unicode_literals) from urllib.request import urlopen # 1 import json import requests json_url = 'https://raw.githubusercontent.com/muxuezi/btc/master/btc_close_2017.json' response = urlopen(json_url) # 2 # 读取数据 req = response.read() # 将数...
true
cbe135e0e0017bf7031b2c2c29030747d8f32bb5
Python
TypMitSchnurrbart/SchedulerSim
/main.py
UTF-8
6,500
2.703125
3
[]
no_license
""" Main for a small scheduler sim with gui; this its mainly for testing at the moment Author: Alexander Müller Version: 0.7.1 Date: 14.02.2021 """ # Load system libraries--------------------------------------------------- import sys import time from datetime import datetime # Load PyQt5 Library Classes-...
true
1c2b75ce551e6ce7cffe1a2c8e8162b2b634580d
Python
asadalarma/python_crash_course
/print-triangle.py
UTF-8
141
3.21875
3
[]
no_license
# Print Statement print("\n---------------A simple triangle---------------\n") print(" /|") print(" / |") print(" / |") print("/___|\n")
true
8643c0d591aa18ea3bb94cdc7887df830f83418c
Python
myounus96/Network-Security-Labs
/S-Des/main.py
UTF-8
3,308
2.59375
3
[]
no_license
class Main: _IP = [2, 6, 3, 1, 4, 8, 5, 7] _EP = [4, 1, 2, 3, 2, 3, 4, 1] _P_10 = [3, 5, 2, 7, 4, 10, 1, 9, 8, 7] _P_8 = [6, 3, 7, 4, 8, 5, 10, 9] _P_4 = [2, 4, 3, 1] _IP_1 = [4, 1, 3, 5, 7, 2, 8, 6] _S0 = {"00": {"00": "01", "01": "00", "10": "11", "11": "10"}, "01": {"00": "11",...
true
4e4e93a3e8a7d3ce0c51ee5780d4fec4ef0a009c
Python
fdongyu/PCSE_final
/transport_visualization.py
UTF-8
2,835
2.828125
3
[]
no_license
from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import utm import numpy as np import pdb def convert_to_latlon(x, y): x = x.flatten() y = y.flatten() nn = len(x) lat = np.zeros_like(x) lon = np.zeros_like(y) for i in range(len(x)): ...
true
660c099c3b1f9e21b42050263f257366250fa114
Python
sunshineDrizzle/CommonTools
/commontool/algorithm/tool.py
UTF-8
12,832
3.375
3
[]
no_license
import numpy as np from scipy.spatial.distance import cdist, pdist # --------metrics-------- def _overlap(c1, c2, index='dice'): """ Calculate overlap between two collections Parameters ---------- c1, c2 : collection (list | tuple | set | 1-D array etc.) index : string ('dice' | 'percent') ...
true
5347863cac79111a29b85eeb6ccc28791f1a4c6d
Python
elinaaleksejevski/frog
/frog.py
UTF-8
2,008
3.140625
3
[]
no_license
import numpy as np import matplotlib import matplotlib.pyplot as plt fail=open(r"C:\Users\User\Documents\visualstudio\text_num.txt","r") mas1=[] mas2=[] for line in fail: n=line.find(",") mas1.append(line[0:n].strip()) mas2.append(int(line[n+1:len(line)].strip())) fail.close() plt.grid(True...
true
6038ace0521ac7b30766816fe5c17fbf8c845ffe
Python
UmasouTTT/prefetch_in_wuhao_configuration
/eval-scripts/config.py
UTF-8
602
2.609375
3
[]
no_license
#!/usr/bin/python3 import argparse, os class Config: def __init__(self): parser = argparse.ArgumentParser(description= "This script is used to evaluate results from Champsim.") parser.add_argument('-d', '--desc', required = True, help="Descriptor JSON File Path.") parser.add_ar...
true
863f546c6a6980eaea574846d4da1dad9f8fa98c
Python
xinw3/deep-learning
/hw3/code/pre_mapper.py
UTF-8
623
3.125
3
[]
no_license
#!/usr/bin/python import sys import re def mapper(): ''' Input: train ''' word_count = dict() tags = ['UNK', 'START', 'END'] for line in sys.stdin: words = line.split() words = [word.lower() for word in words] for word in words: word_count[word] = word_c...
true
80bd3e9d3cd8e0581c40a5b110ecbcef4a88646c
Python
youseop/Problem_solutions
/BAEKJOON/3197_백조의호수(미해결).py
UTF-8
2,144
2.796875
3
[]
no_license
import sys sys.stdin = open("text.txt","rt") read=sys.stdin.readline from collections import deque def find(a): if union[a] == a: return a union[a] = find(union[a]) return union[a] def merge(a,b): root_a,root_b = find(a),find(b) if root_a == root_b: return if level[root_a] >= ...
true
54a37f170245c882ef1c570ec6793764778a8311
Python
dh434/tensorflowLearning
/nn_rnn_mnist.py
UTF-8
2,345
2.734375
3
[]
no_license
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt mnist = input_data.read_data_sets("MNIST_data",one_hot=True) lr = 0.001 training_iters = 1000000 batch_size = 128 n_inputs = 28 n_steps = 28 n_hidden_units = 128 n_classes = 10 xs = tf.placeholder(tf.fl...
true
3fb922902d6f1c978d7a30e7ab63bcb2feba7f14
Python
zhangbc/ip_pools
/update_citycarrier.py
UTF-8
6,183
2.75
3
[]
no_license
# /usr/local/python2.7.11/bin/python # coding: utf-8 """ 将ip_info中归中属地和运营商信息 提取并写入对应的表,并写入日志表 author: zhangbc create_time: 2017-05-19 """ import sys import time from utils.ip_processor import IpProcessor reload(sys) sys.setdefaultencoding('utf8') class UpdateCityCarrier(IpProcessor): """ 将ip_in...
true
4603e89c5a787492da0a41ddaded0be6529ca41a
Python
yokub-sobirjonov/python-tutorial
/Hello World.py
UTF-8
494
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jan 9 19:29:50 2021 @author: User """ #print('Salom\tdunyo') #ism = input("Ismingiz nima ? ") #print("Assalomu aleykum , " + ism) #ism = input("Ismingiz nima ?") #print("Assalomu aleykum , " + ism.title()) kocha=input("kochangiz : ") mahalla=input("mahallangi...
true
7d7345e069991fa81e85641c8a50449267e471b8
Python
ishritam/python-Programming--The-hard-way-Exercises
/ex12.py
UTF-8
86
3.875
4
[]
no_license
name=input("Name?") age=input("age?") print(f"So, Mr.{name}, You are {age} years old")
true
9868a0d77d5aaae3a70d685bb637249098aaf12e
Python
jermenkoo/spoj.pl_solutions
/CANDY3.py
UTF-8
208
2.78125
3
[]
no_license
for i in range(int(input())): mlst = [] space = input for j in range(reps): mlst.append(int(input())) if sum(mlst) % len(mlst) == 0: print("YES") else: print("NO")
true
dea7af2b186902f3d2be9be3ea406644eb8c890f
Python
mglodziak/python
/02/02_python.py
UTF-8
1,523
3.46875
3
[]
no_license
import sys import getopt import turtle def print_help(): print('HELP - this script draws regulars polygons.') print('-h help') print('-n <number> -> number of sides, default is 4') print('-r <number> -> length of each side, default is 50') print('-m <number> -> move center, default is 0')...
true
0e5d0a6f57c1a8c837753ec946aafb9030b43395
Python
qtothec/pyomo
/pyomo/common/dependencies.py
UTF-8
4,413
2.515625
3
[ "BSD-3-Clause" ]
permissive
# ___________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and # Engineering Solutions of Sandia, LLC...
true
29d8180054e6284ab55e5a93a582c782f76f39f9
Python
Guangyun-Xu/Learn-Test
/PyCode/Open3d/transform_visualization.py
UTF-8
1,766
2.859375
3
[]
no_license
import transforms3d as t3d # pip install transform3d import open3d as o3d # pip install open3d-python==0.5 import numpy as np import math # compose transform matrix T = [20, 30, 40] R = [[0, -1, 0], [1, 0, 0], [0, 0, 1]] # rotation matrix Z = [1.0, 1.0, 1.0] # zooms A = t3d.affines.compose(T, R, Z) print(A) # rot...
true
a111ae4c8bb0300c38ac7ed26029e3d1c3e026d9
Python
stephendwillson/ProjectEuler
/python_solutions/problem_1.py
UTF-8
524
3.796875
4
[]
no_license
def main(): total = 0 for i in range(1, 1000): if i % 5 == 0 or i % 3 == 0: total += i return total def description(): desc = """ https://projecteuler.net/problem=1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these...
true
7dc12822b7d115d7a6dba71ebeb23ee066d21b4b
Python
eugeneALU/CECNL_RealTimeBCI
/filterbank.py
UTF-8
2,444
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 1 10:16:21 2019 @author: ALU """ import warnings import scipy.signal import numpy as np def filterbank(eeg, fs, idx_fb): if idx_fb == None: warnings.warn('stats:filterbank:MissingInput '\ +'Missing filter index. Default value (idx_f...
true
1150cb44e9d944266f0798860cb9cf4b39441857
Python
nilimapradipm/ReportComparison
/venv/Lib/site-packages/printline.py
UTF-8
441
3.578125
4
[]
no_license
'''这个函数的作用是列表(包含N个嵌套)''' #递归函数 def print_dg(the_list,indent=False,level=0,fh=sys.stdout): #sys.stdout如果没有指定文件对象则会写至屏幕 for ea_it in the_list: if isinstance(ea_it,list): print_dg(ea_it,indent,level+1,fh) else: if indent: for ta_st in range(level): print("\t",end=''...
true
48d5719a5cfa54b9a101b0eff021ca4cf650c4d3
Python
hang0522/AlgorithmQIUZHAO
/Week_05/homework/231_isPowerOfTwo.py
UTF-8
690
3.421875
3
[]
no_license
class Solution: def isPowerOfTwo(self, n: int) -> bool: #方法2 # 若 x 为 2 的幂,则它的二进制表示中只包含一个 1,则有 x & (-x) = x; # 若x 不是2 的幂,则它的二进制中不止一个1,则有x &(-x) !=x #时间复杂度:O(1) #空间复杂度:O(1) #if n==0: # return False #return n&(-n)==n #方法1 #去除二进制中最右边的 1...
true
a11504790a384f4317ed01099f7d7cb1e61e2ca6
Python
labbealexandre/dna-algorithms
/src/sparseToBND2.py
UTF-8
2,635
2.734375
3
[]
no_license
import numpy as np import networkx as nx from src import evaluate as ev from src import utils as ut from src import melhorn as ml def replaceInitialEdges(G, M, subGraphs, avgDegree): # By definition of the algorithm, a node can help at most # avgDegree / 2 n = len(M) limit = int(avgDegree/2)+1 # this is not ...
true
7ad86c5de738b7ec21bce484cb7fe45516892740
Python
shapiromatron/hawc
/hawc/apps/common/templatetags/url_replace.py
UTF-8
745
2.765625
3
[ "MIT" ]
permissive
from django import template register = template.Library() @register.simple_tag(takes_context=True) def url_replace(context, *args, **kwargs): """ Add new parameters to a get URL, or removes if None. Example usage: <a href="?{% url_replace page=paginator.next_page_number %}"> Source: http://stac...
true
63e8ddfeacbc2d6e2d678a42b0fcc2a736f9d3c5
Python
CAECOMP/provas
/S08 - Padrões de projeto/interpreter/principal.py
UTF-8
744
3.796875
4
[]
no_license
from operador import Operador from numero import Numero from soma import Somar from subtracao import Subtrair from multiplicacao import Multiplicar from divisao import Dividir if __name__ == '__main__': somar: Operador = Somar(Numero(1), Numero(4)) # 1 + 4 = 5 print(f"resultado da soma: {somar.interpretar...
true
da5bc97537218a4eddfb9d6e4a63065171c25744
Python
yongyuandelijian/mystudy
/lx20171110/com/lpc/sjk/czsjk20180531.py
UTF-8
3,400
3.359375
3
[]
no_license
import pymysql import datetime # create tables def createTable(tablename): # get connect connect=pymysql.connect(host="localhost",user="root",passwd="123456",db="test",port=3306) # get cursor cursor=connect.cursor() # execute sql cursor.execute("DROP TABLE IF EXISTS %s"%tablename...
true
8b413c3ef0f9bef812e5f73abec7af4e7778609c
Python
westgate458/LeetCode
/P0096.py
UTF-8
1,484
3.3125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 12 21:39:22 2019 @author: Tianqi Guo """ class Solution(object): def numTrees(self, n): """ :type n: int :rtype: List[TreeNode] """ # def construct(begin, end): # if (begin, end) in self.dict: # ...
true
40161165093dda1150422fc6e1e878fe51a7a19c
Python
JointEntropy/author_identification2
/extra_notebooks/logreg.py
UTF-8
1,775
2.9375
3
[]
no_license
""" Ссылки по теме: - [Работа с текстом в scikit](http://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html) """ # appendix from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder corpus = data.reset_index(drop=True) X, y = corpus['text'],corpus['a...
true
ee9055a3ee8153697794ae42924bdaea9f2fd30b
Python
PFTL/LMU_Group_2
/Model/IV_Measurement.py
UTF-8
1,667
2.625
3
[]
no_license
import numpy as np import yaml from Model.analog_daq import AnalogDaq import pint ur = pint.UnitRegistry() class Experiment: def __init__(self): self.scan_running = False def load_config(self, filename): with open(filename, 'r') as f: self.params = yaml.load(f) def load_daq(s...
true
60baacc2910e2389ae3e99638fa455b40172615b
Python
jmacdotorg/volity
/server-python/zymb/jabber/keepalive.py
UTF-8
7,480
2.796875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
import service import interface # Namespace for the <iq> packets used for keepalive queries. This can be # anything, because keepalive queries are sent only to oneself. NS_ZYMB_KEEPALIVE = 'zymb:keepalive' # If the keepalive period is 60 seconds, we wake up every 15 seconds # to check for activity. 60/4 is 15. DIVISI...
true
c7707956ff013b128a9e2d0d1bea2200213c4e03
Python
ronaldoussoren/modulegraph2
/testsuite/test_virtual_environments.py
UTF-8
3,830
2.515625
3
[ "MIT" ]
permissive
import contextlib import os import shutil import subprocess import sys import tempfile import unittest # - Create virtual environment (venv, virtualenv) # - Install minimal stuff # - Create graph with subprocess in the # virtual environment # - Verify graph structure, primarily # check that stdlib nodes refer to s...
true
0e684995994a3c14c7904dda48ec9df400ea480e
Python
jim0409/PythonLearning-DataStructureLearning
/Algorithm_Learning/chapter07_tree_algorithm/practice/funTree.py
UTF-8
1,138
4.15625
4
[]
no_license
def Btree_create(tree_deep, data): btree = [0]*pow(2, tree_deep) # 因為deep是4,所以產生2^4個0在一維array作為btree,內容:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in range(1, len(data)): # 從data的第一個值開始讀取到最後一個值 level = 1 # 設定一個level常數,控制deep的層級的初始化 while btree[leve...
true
237a170ab52673946ed8b8411f7656b1f21d0256
Python
RIMEL-UCA/RIMEL-UCA.github.io
/chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/BERT-Squad.py
UTF-8
5,238
2.59375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Running BERT-Squad model # **This tutorial shows how to run the BERT-Squad model on Onnxruntime.** # # To see how the BERT-Squad model was converted from tensorflow to onnx look at [BERTtutorial.ipynb](https://github.com/onnx/tensorflow-onnx/blob/master/tutorials/BertTutor...
true
0ac6e3b85af9beeeb7e32d80d30d79c5ecf4db83
Python
irhadSaric/Instrukcije
/pok4.2.py
UTF-8
268
3.59375
4
[]
no_license
def funkcija(): n = input("Unesi br: ") # n string nalaziSe = False while n: if int(n) == 2: nalaziSe = True n = input("Unesi broj: ") return nalaziSe if funkcija(): print("Nalazi se") else: print("Ne nalazi se")
true
1f43f194bb31c62aee8ef208a1ab1f8e40a3a549
Python
johansten/cryptopals
/set 2/16.py
UTF-8
1,252
3.078125
3
[]
no_license
import cryptopals class Api(object): def __init__(self): self.key = cryptopals.get_random_key(16) self.iv = cryptopals.get_random_key(16) def encrypt_string(self, s): raw = ("comment1=cooking%20MCs;userdata=" + s + ";comment2=%20like%20a%20pound%20of%20bacon") raw = cryptopals.pkcs7_pad(raw, 16) ...
true
6806049983fb9fe8b93121034c9c9a66d4b3b093
Python
Schulich-Ignite/spark
/spark/util/Errors.py
UTF-8
3,606
3.0625
3
[ "MIT" ]
permissive
class ArgumentError(Exception): def __init__(self, message=""): self.message = message super().__init__(self.message) class ArgumentTypeError(ArgumentError): def __init__(self, func_name, argument_name, allowed_types, actual_type, arg): if type(argument_name) == str and len(a...
true
fc8842e810a57ce3a175b3fadef2d9e000a0eba3
Python
nh273/caro-ai
/lib/test_mcts.py
UTF-8
1,431
3.4375
3
[]
no_license
import pytest from unittest.mock import MagicMock, patch from lib.mcts import MCTS @pytest.fixture def tree(): """Let's mock a game with 2 possible actions: 0 & 1 Let's construct a tree that started from state 1, took action 1 once and that led to state 2, then from state 2 take action 0 that led to s...
true