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
c395afdd364683925bc697ee1323e395cbdb8a86
Python
lonely7yk/LeetCode_py
/LeetCode787CheapestFlightsWithinKStops.py
UTF-8
3,489
3.921875
4
[]
no_license
""" There are n cities connected by m flights. Each flight starts from city u and arrives at v with a price w. Now given all the cities and flights, together with starting city src and the destination dst, your task is to find the cheapest price from src to dst with up to k stops. If there is no such route, output -1...
true
98d0b924be3adda1955c310bad640c0f252d70b7
Python
luocanfeng/projecteuler
/src001_050/P002.py
UTF-8
542
4.21875
4
[]
no_license
''' Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. '...
true
6d68b25269f68996e012464776d67a0ca3c9356f
Python
khoehlein/fV-SRN-Ensemble-Compression
/common/priors.py
UTF-8
1,161
3.234375
3
[ "MIT" ]
permissive
import torch from typing import Union, Sequence class SmoothnessPrior(torch.nn.Module): """ n-dimensional smoothness prior loss. For each dimension i, the value $\int (f'_i(x))^2 dx$ is computed, i.e. the first derivative along dimension i, squared and summed/averaged over the image """ def __init__(se...
true
1dd42578b34650ef497d19439268d4195382e036
Python
weileanjs/weigit
/jsl_fenji/duanzhu.py
UTF-8
2,188
2.984375
3
[]
no_license
from bs4 import BeautifulSoup import requests import time import pymongo client = pymongo.MongoClient('localhost',27017) duanzhu = client['duanzhu'] bnb_info = duanzhu['sheet_tab'] def get_single_datas(link): wb_data = requests.get(link) soup = BeautifulSoup(wb_data.text,'lxml') # 因为是单页面,使用 select 方法获得的元素...
true
d2a4bc615c063d74351d5127ce9d2f5162748be8
Python
linukc/2D-3D-Line-Correspondences
/lines.py
UTF-8
1,140
2.65625
3
[]
no_license
#!/usr/bin/env python # Lines Publisher import rospy from visualization_msgs.msg import Marker from geometry_msgs.msg import Point rospy.init_node('line_pub') pub_line = rospy.Publisher('~lines', Marker, queue_size=1) rospy.loginfo('Publishing example lines') marker = Marker() marker.header.frame_id = "map" marker.t...
true
7c3e8682149b26b258a270efcfc805888b303570
Python
shaharyar2021skipq/Andromeda_Devops
/shaharyar/infra/cdk.out/asset.97b5f247b9ce218da8fdcd63c8b182f8d44162156f2541400a88ff316937ab94/handler.py
UTF-8
632
2.640625
3
[]
no_license
# def lambda_handler(event,context): # message = 'Hello {} {}!'.format(event['first_name'],event['last_name']) # return { # 'message':message # } import urllib3 import constants def health_web(event,context): url = constants.URLs availability = get_availability(url) # latency = get_laten...
true
046d29fa8498fe5ffd1c85b3bd9ced3188652482
Python
alih552/assembler
/assembler.py
UTF-8
7,603
2.609375
3
[]
no_license
import sys code = open('input.txt', 'r').readlines() out_symbol_table = open('out_symbol_table.txt', 'w') out_symbol_table_HEXA = open('out_symbol_table_HEXA.txt', 'w') out_symbol_table_BIN = open('out_symbol_table_BIN.txt', 'w') out_symbol_table_total = open('out_symbol_table_total.txt', 'w') out_symbol_table_to...
true
d244cb341a8d342e2e4447295da461f8b7d4c51a
Python
analkumar2/Thesis-work
/2019-12-04-Parallelprocessing/num_in_rows.py
UTF-8
1,699
3.625
4
[]
no_license
# exec(open('num_in_rows.py').read()) ## To find out the number of elements between minimum and maximum in each row of a matrix ## Since, loading and uloading takes a lot of time, in this case parrallelization leads to a decline in performance. Lets try sorting in another program import concurrent.futures import time ...
true
89ec0c6ed031f60fe32c98291e6fa6268c8454da
Python
Prashant47/algorithms
/tree/check_balanced_tree.py
UTF-8
784
4.1875
4
[ "MIT" ]
permissive
# balanced tree is defined to be a tree such that the heights of the two subtrees of any # node never differ by more than one. class Node: def __init__(self,val): self.left = None self.right = None self.val = val def height(root): if root is None: return 0 h = 1 + max ( hei...
true
dd99222dd2f75fb685ccb099ec324734319af12a
Python
Schnikonos/pythonSandbox
/module/my_classes/h_inheritance.py
UTF-8
601
4.125
4
[]
no_license
class Rectangle: def __init__(self, length: int, width: int): self.width = width self.length = length def area(self) -> int: return self.length * self.width @staticmethod def name() -> str: return 'rectangle' class Square(Rectangle): def __init__(self, length: in...
true
c321aecc484eb62d5683c939711e8a77fd69dbaf
Python
knightowl2704/Machine_Learning_Models
/Iris Classification problem/iris. svcpy.py
UTF-8
1,260
3.09375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset = pd.read_csv("iris.csv") print(dataset) X = dataset.iloc[:,:-1].values y = dataset.iloc[:,-1].values from sklearn.preprocessing import LabelEncoder, OneHotEncoder labelencoder_y = LabelEncoder() y = labelencoder_y.fit_tran...
true
a19ef9572fc0e9d2d9bf37a435e174ef548c45f9
Python
sharadbhat/Competitive-Coding
/HackerRank/W37/Simple_Language.py
UTF-8
629
3.375
3
[]
no_license
# HACKERRANK # https://www.hackerrank.com/contests/w37/challenges/simple-language import os import sys def maximumProgramValue(n): val = 0 for i in range(n): i = input() do = i.split()[0] amount = i.split()[1] if do == 'set': if int(amount) > val: va...
true
ba8f92251b5c4bc8fcefcd85ee7557d324b82949
Python
Th0mz/BattleSimulator
/projecto2.py
UTF-8
29,706
4.09375
4
[]
no_license
# Tomas de Araujo Tavares Numero: 95680 # ----------------------- : Posicao : ----------------------- # # Construtores: def cria_posicao(x, y): """- Construtor: A funcao recebe dois argumentos (x, y) que correspondem as coordenadas x e y de uma posicao e devolve essa mesma posicao ...
true
9b0dc705e07e116f38d57b4eb1cdd2b1954caacd
Python
Kannute/Python
/lab11/zad1.py
UTF-8
2,354
4.21875
4
[]
no_license
from abc import ABC from abc import abstractmethod class Calka(ABC): '''Klasa bazowa dla roznych metod calkowania''' def __init__(self, mini, maxi, steps, function): self.start = mini self.end = maxi self.steps = steps self.fun = function @property d...
true
a5af8b89e00e7b38565b680d3c733adea6f6f075
Python
genwarhunter/python
/Game testing/Cube.py
UTF-8
4,661
3
3
[]
no_license
import random class CUBE(list): def __init__(self): self.FORWARD=[[ random.randint(1, 6) for i in range(3)] for i in range(3) ] self.BACK= [[ random.randint(1, 6) for i in range(3)] for i in range(3) ] self.UP= [[ random.randint(1, 6) for i in range(3)] for i in range(3) ] self.D...
true
26d0b8208f70070d238753b18d106fed0e08e870
Python
JMaio/ct-19-20
/tests-py-tester/grapher.py
UTF-8
1,994
2.53125
3
[]
no_license
import os from anytree import Node, RenderTree from anytree.exporter import UniqueDotExporter as dot_exp p = os.path.dirname(os.path.realpath(__file__)) f = "ast.c-ast" filepath = os.path.join(p, "..", "tests", f) ast_string = "" with open(filepath) as file: ast_string = file.read() # sample command for ast: # ...
true
f9a9b37f644441ca1a5220fa91eb28442f306120
Python
ritterliu/torcs_train
/train/KerasTrainer.py
UTF-8
3,514
2.515625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- import time import gc import glob from keras.models import Sequential from keras.layers import Dense, Flatten from keras.layers import Conv2D from keras.callbacks import ModelCheckpoint from Config import * from DataProcessor import DataProcessor import numpy as np import json class CNNTrainer...
true
641adb8b1c291f19fc82ca22f09386162b9ed2b7
Python
arlin13/LearningPython
/LearningPython/strings.py
UTF-8
982
4.34375
4
[]
no_license
# strings # CHECK WHY STRING UTILITY METHODS ARE NOT WORKING AS I EXPECTED first_name = "Arlin" last_name = "Grijalba" print(first_name, last_name) first_name_capitalized = first_name.capitalize() print(first_name_capitalized) first_name_letter_a_replaced = first_name.replace("a", "e") print(first_name_letter_a_re...
true
ed666acdf9849d4d21717284c6d552f55ea452f9
Python
fritzo/kazoo
/test/synthesis.py
UTF-8
4,320
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/python import kazoo.transforms as K from numpy import * from matplotlib import pyplot import main # ----( wide bandpass filter )------------------------------------------------- @main.command def plot_fourier(width=0.5): "Plots fourier energy envelopes for octave-pass filter" width = float(width)...
true
84d47e1e7530d5758afc22625be33a3404ddfdd5
Python
sas1531/Tic-Tac-Toe
/ITP_tic_tac_toe.py
UTF-8
9,051
4.0625
4
[]
no_license
from graphics import * import sys from time import sleep # input and assign each player's name and color Player_1 = input('Player 1 print your name: ') color_1 = input('Player 1 pick a color: ') Player_2 = input('Player 2 Print your name: ') color_2 = input('Player 2 pick a color: ') # input the board size, must be a...
true
d6aeeefbcc05dcc99b37ba4129498ed928d43c5a
Python
zcrwind/DeepLearningFromScratch
/ResNet50_with_Stochastic_Depth/ResNet50_with_Stochastic_Depth.py
UTF-8
5,614
2.609375
3
[]
no_license
class BottleNeck(nn.Module): def __init__(self, in_channels, out_channels, stride, active, prob): super(BottleNeck, self).__init__() self.conv1 = nn.Sequential( nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1), nn.BatchNorm2d(out_channels), ...
true
280c8094a2136362bb7c0c4d8d43249ca4b5f033
Python
Kryzdeg/FilmRatePredictAI
/filmweb_scrapper.py
UTF-8
2,116
2.953125
3
[]
no_license
from requests_html import HTMLSession import re session = HTMLSession() def get_movie_info(link): r = session.get(link) film = dict() rate = r.html.find(".filmRating__rateValue", first=True) count_rate = r.html.find(".filmRating__count", first=True) film["rate"] = rate.text film["count_rate"...
true
50fe03fd0b10c4b60f1622c679e773beb11ba9bb
Python
bhoomit/ID
/wav.py
UTF-8
436
2.53125
3
[]
no_license
import requests import numpy as np from io import StringIO import scipy.io.wavfile rate = 500 channels = 3 seconds = 3 url = "https://www.random.org/integers/?num={0}&min=100000&max=1000000000&col=1&base=10&format=plain&rnd=new" response = requests.get(url.format(rate * seconds * channels)) data = np.loadtxt(StringIO(...
true
8d8c2372bbac0f6a7b52ad5d69a7839fcb09e76c
Python
technomaniac/asyncrawl
/crawler.py
UTF-8
5,109
2.640625
3
[]
no_license
import asyncio import cgi import csv import time import logging import re import urllib.parse import aiohttp try: # Python 3.4. from asyncio import JoinableQueue as Queue except ImportError: # Python 3.5. from asyncio import Queue LOGGER = logging.getLogger(__name__) CSV_HEADER = ['URL', 'Status Cod...
true
545926730b0ba13a284dee6e10de5adb432f65bb
Python
MojmirDocekal/cryptography_101_python
/caesar_crypt.py
UTF-8
2,518
3.640625
4
[]
no_license
# Crypt shift = 3 # defining the shift count text = "BEZI LISKA K TABORU" encryption = "" for c in text: # check if character is an uppercase letter if c.isupper(): # find the position in 0-25 c_unicode = ord(c) c_index = ord(c) - ord("A") # perform the shift new_...
true
b6228b677ca686fc832305a245def8db37b463ac
Python
TeamINTERACT/code_fragments
/jPPA/in_ellipse.py
UTF-8
4,305
3.59375
4
[]
no_license
""" Author: Antoniu Vadan Description: contains function which, given any two points in a grid (with timestamp), the grid's resolution, an upper bound on speed, and stationary activity time, returns points inside the ellipse as described by Miller, 2005, A Measurement Theory for Time Geography """ import matpl...
true
df932d8b2df44d3c01411e4d589c0e5e2999bb43
Python
Kennard123661/action-recognition
/src/utils/segment_txt_checker.py
UTF-8
544
2.734375
3
[]
no_license
import os import numpy as np filepath = '/home/kennardngpoolhua/Downloads/segment.txt' N_GT_SEGMENTS = 1284 def check_segment_txt(): with open(filepath, 'r') as f: segments = f.readlines() # remove first line segments = [segment.strip().split(' ') for segment in segments] n_video_segments =...
true
c6c4d2f4fd645da7e7b0bb8ba56bf868d71eaffa
Python
Arjunpujari96/Python-Programms
/sum_of_all_even_and_odd_in_list.py
UTF-8
471
4.03125
4
[]
no_license
# program to calculate sum of all even and all odd in list , list are given by user list = [] e = 0 o = 0 number = int(input("Enter the length of the list")) print("Enter the list value") for i in range(number): data = int(input()) if data%2==0: e = e+data else: ...
true
254173824d0e1a7b9dd23ac2413e8ad53ef02183
Python
zhanjw/leetcode
/codes_auto/72.edit-distance.py
UTF-8
631
2.71875
3
[]
no_license
# # @lc app=leetcode.cn id=72 lang=python3 # # [72] edit-distance # class Solution: def minDistance(self, word1: str, word2: str) -> int: dp = [[0 for _ in range(len(word2)+1)] for i in range(len(word1)+1)] for i in range(len(word1)+1): dp[i][0]=i for j in range(len(word2)+1): ...
true
f32d4ea583083cece027e897a835793a424b1d9f
Python
mihil555/pp88
/file/text.py
UTF-8
157
2.75
3
[]
no_license
o = input ('внесите имя файла каторый хотите прочитать:') o = ('') p = open(o, 'r') l = p.readline() print (l)
true
42e9e89631717203d544b532dca9818c25f4e780
Python
amirkhan1092/gla_section_e
/chocolate_order_making.py
UTF-8
873
3.40625
3
[]
no_license
# customer requirements total_amount = int(input('enter the total amount ')) # seller storage bar_1kg = int(input('enter the number of bar of 1kg ')) bar_5kg = int(input('enter the number of bar of 5kg')) bar_use_5kg = 0 bar_use_1kg = 0 if total_amount >= 5: bt5 = (total_amount//5)-bar_5kg if bt5 >= 0: ...
true
22379aca1b95294ee15bd012e5a675c2a0d31ef5
Python
all1m-algorithm-study/2021-1-Algorithm-Study
/week4/Group1/boj11728_rxdcxdrnine.py
UTF-8
526
2.984375
3
[]
no_license
n, m = list(map(int, input().split())) list1 = list(map(int, input().split())) list2 = list(map(int, input().split())) list_added = list1 + list2 i = 0 j = 0 result = [] while i < n and j < m: if list1[i] < list2[j]: result.append(list1[i]) i += 1 else: result.append(list2[j]) ...
true
ac6de1efac4c623fc6505367edc2e348b7dce82f
Python
jjwindow/Complexity
/working_model_04-02.py
UTF-8
8,038
3.484375
3
[]
no_license
""" First attempt at implementation of the Oslo model, 22/1/2020 -Alternative using OOP J. J. Window """ import numpy as np from random import choice from random import random import copy import matplotlib.pyplot as plt class Datalog: """ Object class to save all iterations of the ricepile in arrays which can ...
true
fd3ec27266cf4c3da23280112bd4b323a0c9b895
Python
jastner109/GameOfLife
/game_of_life.py
UTF-8
5,261
3.234375
3
[]
no_license
import numpy as np from itertools import product import matplotlib.pyplot as plt import matplotlib.colors as color import os import time def showgame(generation, color_scheme): # creates image of a particular generation if color_scheme == 0: fig = plt.imshow(generation, interpolation = None, cma...
true
629b0353583c21dffcfc6a03458f99a3328af08b
Python
kayfour/learn_opencv
/image_processing/AffinePerspectiveTransformations.py
UTF-8
777
2.703125
3
[]
no_license
from cv2 import cv2 as cv import numpy as np from matplotlib import pyplot as plt img = cv.imread('datas/images/sudoku.jpg') rows,cols,ch = img.shape pts1 = np.float32([[50,50],[200,50],[50,200]]) pts2 = np.float32([[10,100],[200,50],[100,250]]) M = cv.getAffineTransform(pts1,pts2) dst = cv.warpAffine(img,M,(cols,row...
true
33b01fac7e0623321b47eae29f673d3972f6ae28
Python
masenov9607/Genetic-algorithm
/ga.py
UTF-8
4,723
3.09375
3
[]
no_license
import numpy as np import pandas as pd class GA(object): def __init__(self,chromosome_size,population_size,constraint,prop_crossover,prob_mutation,max_generations): self.pc = prop_crossover self.pm = prob_mutation self.max_generations = max_generations self.population_size =...
true
af1305cf3b5e6cb8eff4a836875d9d651b487893
Python
kbadova/Programming101-Python
/week01/100sms.py
UTF-8
1,365
3.671875
4
[]
no_license
def dictionary(number, count): dictionary = {} dictionary[0] = [" "] dictionary[2] = ["a", "b", "c"] dictionary[3] = ["d", "e", "f"] dictionary[4] = ["g", "h", "i"] dictionary[5] = ["j", "k", "l"] dictionary[6] = ["m", "n", "o"] dictionary[7] = ["p", "q", "r", "s"] dictionary[8] = ["...
true
b6c98ce4d11cc8c415d709a9d6d93a28ac944866
Python
yevgeniy-voloshin/pyneng-online-jun-jul-2017
/exercises/13_jinja2/task_13_1b.py
UTF-8
572
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ Задание 13.1b Дополнить функцию generate_cfg_from_template из задания 13.1 или 13.1a: * добавить поддержку аргументов окружения (Environment) Функция generate_cfg_from_template должна принимать любые аргументы, которые принимает класс Environment и просто передавать их ему. Проверить фун...
true
17fe2ef306db44ab69c88b2704b221e0182db72b
Python
kaancceylan/ApzivaDemo
/costumerSatisfaction.py
UTF-8
2,026
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 20 12:42:32 2020 @author: Kaan """ import pandas as pd import numpy as np from sklearn.model_selection import train_test_split #I will be using the decisiontreeclassifier since this will be #a binary classification and we have a considerably small amount o...
true
16b55fcebdfe3fbf86320a5daaceb9044eec6fa4
Python
SCcagg5/DialogFlowSentimentAnalyser
/back-end/src/users.py
UTF-8
1,116
2.828125
3
[]
no_license
import uuid class user: def __init__(self, lang, tok = None): self.id = str(uuid.uuid4()).replace('-', '') self.sen = 0.0 self.pow = 0 self.lang = lang if tok is not None: tok = tok.split('_') if len(tok) == 3: ...
true
b93db10a0bbebed9fc5aab388c9c37aabb4a83e2
Python
RLBot/RLBotPack
/RLBotPack/Rocketnoodles/src/strategy/coaches/triple_rotations.py
UTF-8
3,976
2.984375
3
[ "MIT" ]
permissive
from gosling.utils import side from strategy.base_ccp import BaseCoach from strategy.captains import * from physics.math import Vec3 class State: KICKOFF = 0 ATTACKING = 1 DEFENDING = 2 state = ["Kickoff", "Attacking", "Defending"] class InGameConstants: MAX_BALL_VELOCITY = 6000 # According to ...
true
1b0fe04d9cc6542f030e4f0f6f8e82f269472fcd
Python
IgorIgss/TP1-Distribuidos
/Produtor.py
UTF-8
4,984
2.890625
3
[]
no_license
import platform import Pyro4 import datetime import multiprocessing import subprocess import os import random SenhaNoLinux = "senhasenha" manager = multiprocessing.Manager() consumidores = manager.list() IP = "192.168.2.2" def log(logString): log = open("logProdutor.txt", "a") log.write(logString) @Pyro4.ex...
true
cc4a6347b1d96dc55f434ae39204231dff069642
Python
jhajagos/CensusGeographyTools
/acs_math/acs_variable.py
UTF-8
6,563
2.75
3
[]
no_license
import pandas as pd import sqlalchemy as sa class ACSScope(object): def __init__(self, connection, estimate_type="e", estimate_year="2016", estimate_time="5", geo_scope="us", schema=None): self.connection = connection self.meta_data = sa.MetaData(connection, schema=schema) ...
true
c97763316871ff59792a0fad68efdf6d15dec8bc
Python
allan0703/SpaceFillingCurveConv
/sem_seg/model/weighted_conv.py
UTF-8
5,499
2.578125
3
[]
no_license
import torch from torch import nn from torch.nn import functional as F import time __all__ = ['WeightedConv1D', 'SeparableWeightedConv1D'] class WeightedConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, dilation, padding, stride): super(WeightedConv, self).__init__() sel...
true
9359825d1cfd351ac92188ed28bc56dd3c538443
Python
fnsne/crawl_learning
/ptt_one_piece_crawl.py
UTF-8
496
2.796875
3
[]
no_license
import json, requests, pyprind from bs4 import BeautifulSoup data = [] for i in pyprind.prog_bar(range(1290, 1305-1), track_time=False): response = requests.get('https://www.ptt.cc/bbs/ONE_PIECE/index{}.html'.format(i)) soup = BeautifulSoup(response.text) for j in soup.select('.title a'): ...
true
fe278145a81520708e117909de96c90c98e06f76
Python
dvanderwood/ks_prediction_via_acp
/python_scripts/acp_validator.py
UTF-8
3,853
2.625
3
[]
no_license
''' Use on the top_acp_*_hits.fa from top_acp_hits_finder.py along with the the unaligned fasta of ACPs used to build the hmm profile which was used to search UniProtKB to get the list of ACPs. Gaps are removed during the fasta reading. This will output a fasta identical to the first with a |original_name*** at the ...
true
5534c7dff738e8a9e414f44998d599f1a9c18d76
Python
chencen2000/aviapy
/BZ_avia.py
UTF-8
5,804
2.515625
3
[]
no_license
import xml.etree.ElementTree as ET import json import os import re from pathlib import Path def defect_xml_to_json(filename = 'BZ_defect.xml'): xml = ET.parse(filename) data = {} defects = [] for c in list(xml.getroot()): if c.tag != 'station': data[c.tag] = c.text else: ...
true
e5c9c9feb42b47f97d3e4dc9e45fa49eb391d588
Python
ZihengZZH/LeetCode
/py/ConstructStringBinaryTree.py
UTF-8
1,784
4.28125
4
[]
no_license
''' You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be represented by empty parenthesis pair "()". And you need to omit all the empty parenthesis pairs that don't affect the one-to-one mapping relationship between the st...
true
87883b97eb61df26cc428afb1b4c6cb4f8457c3f
Python
oraocp/pystu
/primitive/base/lambda_expr.py
UTF-8
726
4.09375
4
[]
no_license
""" 文档目的:演示Python中lambda表达式的概念和用法 创建日期:2017/11/14 演示内容包括: 1. lambda表达式的概念 lambda只是一个表达式,函数体比def简单很多。 lambda表达式是起到一个函数速写的作用。允许在代码内嵌入一个函数的定义。 lambda的主体是一个表达式,而不是一个代码块。仅仅能在lambda表达式中封装有限的逻辑进去。 2.lambda表达式的用法 """ from functools import reduce def factorial(n): ''' 求数n的阶乘 :param n: 数n :return: 数n的阶乘 ...
true
869c9dfdb841ee55472c6ff6ea43bba1493edd20
Python
pro-pedropaulo/estudo_python
/executaveis/21_else_alistamento.py
UTF-8
640
3.21875
3
[ "MIT" ]
permissive
ano_atual = 2021 ano_nascimento = int(input('Digite o ano de nascimento ')) calcular_ano = ano_atual - ano_nascimento if calcular_ano > 18: print('você tem {} anos'.format(calcular_ano)) atrasado = calcular_ano - 18 print('Você está {} anos atrasados'.format(atrasado)) elif calcular_ano>17 and calcular_ano ...
true
d1b143cdf4e905c813d35f87af84c7e02d09f816
Python
markub3327/Space-Game-2D
/test.py
UTF-8
2,244
2.75
3
[ "MIT" ]
permissive
import numpy as np import matplotlib import matplotlib.pyplot as plt from tensorflow.keras.layers import Dense, Input from tensorflow.keras import Model import tensorflow as tf state_input = Input(shape=(1,)) l1 = Dense(128, activation='swish', kernel_initializer='he_uniform')(state_input) l2 = Dense(128, activation=...
true
b299bada6005a547eb69ddd8c420451053fc2064
Python
SABS-R3-Epidemiology/pkmodelling-g3
/pkmodel/protocol.py
UTF-8
4,377
3.5
4
[ "MIT" ]
permissive
# # Protocol class # import numpy as np class Protocol: """A Pharmokinetic (PK) protocol Parameters ---------- dosing_type: str type of dosing, either intravenous or subcutaneous dosing_pattern: str dosing protocol, either instanteneous or continuous dose: numeric or list ...
true
16759641cbf78296f5dfe47ee0eda77392b7aa84
Python
aclytle/samsung_tv_ip_remote
/samsung-client.py
UTF-8
1,101
2.640625
3
[]
no_license
#!/usr/bin/env python3 import websocket import urllib.request import payloads import time from sys import argv, exit #ip = "192.168.88.156" def get_key(ip): try: u = urllib.request.urlopen('http://'+ip+':8000/socket.io/1/') s = u.read() print(s) key = s.split(b':')[0] retu...
true
6256db664a02b5513b8b9d62d2707d3d06f6242c
Python
bcrafton/summer18
/yellow_plot/make_plot_brian.py
UTF-8
822
2.875
3
[]
no_license
import numpy as np import matplotlib.cm as cmap import brian as b def plot_2d_input_weights(weights): fig = b.figure(0, figsize = (18, 18)) im2 = b.imshow(weights, interpolation = "nearest", vmin = 0, vmax = 1.0, cmap = cmap.get_cmap('hot_r')) b.colorbar(im2) fig.canvas.draw() return im2, fig def...
true
8b01c6f76756e72e717298e4d64a59deeda1d7b0
Python
Raja-mishra1/30Days-Leetcode-Challenge-Apr
/Day6.py
UTF-8
315
3.078125
3
[]
no_license
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: result = defaultdict(list) for s in strs: count = [0] * 26 for i in s: count[ord(i) - ord('a')] += 1 result[tuple(count)].append(s) return result.values()
true
0066fe0db417ff7eab0013044d47256c16009def
Python
mtharanya/python-programming-
/power2.py
UTF-8
188
3.484375
3
[]
no_license
n=int(input("enter the number:")) if (n == 0): print("False") elif(n % 2)==0: print("the number is power two") else: print("the number is not power two")
true
8b5c17dcb7eb5d2b1b96f4277877da132022f44f
Python
TeunKoenders/aoc2020
/aoc6/puzzle1.py
UTF-8
192
2.984375
3
[]
no_license
FILE_IN = "input.txt" total = 0 with open(FILE_IN, 'r') as f: data = f.read().split("\n\n") for group in data: total += len(set(group.replace('\n', ''))) print(total)
true
bd40c9943537c9e22538f98490abbd9f4bd7bf5a
Python
zetechmoy/PagesChecker
/test.py
UTF-8
307
2.515625
3
[]
no_license
from pageschecker import PagesChecker def onPageChangeEvent(url): print("onPageChangeEvent("+str(url)+")") #call onPageChangeEvent each time a webpage has changed urls = ["https://tiptap.pro", "https://www.lemonde.fr", "https://appcom.xyz"] pc = PagesChecker(urls, onchange=onPageChangeEvent) pc.run()
true
6274cbf21cb784c136ad8dce4a10bcc432c84d3d
Python
kbr1009/PeakValueEstimation
/soucefile/Tuning/wavDump.py
UTF-8
872
3.046875
3
[]
no_license
import wave from scipy import fromstring, int16 import sys args = sys.argv wavfile = args[1] # WAVファイルを開く wr = wave.open(wavfile, "rb") # WAVファイルの情報を表示(別にいらん) print ("Channel num : ", wr.getnchannels()) print ("Sample size : ", wr.getsampwidth()) print ("Sampling rate : ", wr.getframerate()) print ("Frame num : "...
true
ba6ea6be743f5f972b8d6ac9aecdfb31c0913faa
Python
kulkarniachyut/Machine-Learning
/ML/Assignments/a2/cvtest.py
UTF-8
5,260
2.703125
3
[]
no_license
import numpy as np import pandas as pd from sklearn.datasets import load_boston from sklearn import cross_validation boston = load_boston() data = boston.data trueOutput = boston.target testData = [] trainData = [] dataFrame = pd.DataFrame(data) dataFrame.columns = boston.feature_names dataFrame.insert(0,'X0',1.0); da...
true
91a4a0e4dc308b80f52ca8e1b9b237ed5ca3396a
Python
dogcomplex/projecteuler
/src/MillerRabin.py
UTF-8
1,823
3.234375
3
[]
no_license
import math import sys import random def toBinary(n): r = [] while (n > 0): r.append(n % 2) n = n / 2 return r def test(a, n): """ test(a, n) -> bool Tests whether n is complex. Returns: - True, if n is complex. - False, if n is probably prime. """ b = toBinary(n - 1) d = 1 fo...
true
a3bbeee25fb13552a0c8dfbc9172a5586f3a2d00
Python
tankersleyj/algorithms
/python/src/search.py
UTF-8
556
3.546875
4
[ "MIT" ]
permissive
# MIT (c) jtankersley 2019-05-18 def binary_search(orderedList, value): def _search(orderedList, value, low, high): if (high - low) > 1: mid = (low + high) // 2 if value == orderedList[mid]: return mid elif value < orderedList[mid]: ...
true
453ae5c12d493f9b6aad41d51992f53304bb0381
Python
nosolobots/algo
/varios/heap/Heap.py
UTF-8
3,240
3.953125
4
[]
no_license
import math class Heap: def __init__(self): self.data = [] def empty(self): return len(self.data) == 0 def size(self): return len(self.data) def insert(self, value): '''abstract.''' pass def heapify(self, arr): for n in arr: self.inser...
true
b42a8c856fb03bdaa467c9ae15904392cbc88361
Python
crowblack/Scripts
/grades_ca.py
UTF-8
973
4.0625
4
[]
no_license
#! python3 grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5] def print_grades(grades): for grade in grades: print (grade) def grades_sum(grades): total = 0 for grade in grades: total += grade return total def grades_average(grades): sum_of_grades = grades_su...
true
38be8b241ddcae45d528aaea14f057818c418d9b
Python
won960613/Data-Driven-HR
/지원/app.py
UTF-8
9,817
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- # Run this app with `python app.py` and # visit http://127.0.0.1:8050/ in your web browser. # Import Libraries import dash import dash_core_components as dcc import dash_html_components as html import dash_cytoscape as cyto from dash.dependencies import Input, Output import plotly.express as p...
true
df430d13827766075181314b22e46e879953fd73
Python
wangcunxin/wespark
/bblink/demo/python/basic/string_test.py
UTF-8
5,011
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- import random import types import datetime from hanzi2pinyin import hanzi2pinyin def test_hanzi2pinyin(): py = hanzi2pinyin(u"上海第一妇婴保健院(东院)") print(py) py = hanzi2pinyin(u"贝联科技WiFi事业部(寰创)") print(py) def stringSplit(): s1 ="portal 242 660BF82AFD 0 1598167...
true
4b47542c7eaef70f9112073f83bf2d9437b8d06f
Python
gimquokka/problem-solving
/이코테 (동빈북)/Part2/10_graph/boj_1647_도시 분할 계획(2).py
UTF-8
766
3.203125
3
[]
no_license
import heapq import sys input = sys.stdin.readline def find_parent(parent, x): if parent[x] != x: parent[x] = find_parent(parent, parent[x]) return parent[x] def union_parent(parent, a, b): a = find_parent(parent, a) b = find_parent(parent, b) if a > b: parent[a] = b else: ...
true
b847875a223aecd371c2c8294628b0b7e166b1d2
Python
sSPGs/Introduction_to_programming_Hillel
/Homework/Homework_10/Homework_10.py
UTF-8
2,160
3.453125
3
[]
no_license
''' ''' import json import re """ data.json - файл с данными о некоторых математиках прошлого. 1. Необходимо написать функцию, которая считает эти данные из файла. Параметр функции - имя файла. 2. Написать функцию сортировки данных по ФАМИЛИИ в поле "name" (у тех у кого она есть). Например для Rene Descartes фамилия э...
true
520e3ca448f64c71e7ed5724036dfdb40fda3c34
Python
F-Kazuyuki/FirstNeuralNetwork
/mnist_NN.py
UTF-8
3,691
3.015625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Thu Oct 3 18:13:01 2019 @author: Funato """ # -*- coding: utf-8 -*- """ Created on Thu Aug 15 13:48:14 2019 @author: Funato Kazuyuki """ #このプログラムは自由に使用、改変していただけますが、それにより生じた、またそれを利用したことにより生じたいかなる損害についても責任を負いません。 import numpy as np import mnist def sigmoid(x): #シグモイド関数の定義 ...
true
8bdc17a8787a9479e3ad9f4b179f63f936a7c620
Python
anon4review/MOGAN
/code/zdt.py
UTF-8
4,893
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Dec 19 10:34:41 2018 @author: Founder """ import math import numpy as np import copy def pareto(x): x = x.tolist() l = copy.copy(x) list_del = [] for i in range(len(l)): for j in x: if j[len(j)-2] < l[i][len(j)-2] and j[len(j)-1] < l[i][...
true
085f713ad9c4eea57a76f0732d183a44f4dc0186
Python
hello-starry/MotionExplorer
/scripts/tri_create/create_tri_room_sequential.py
UTF-8
2,155
2.53125
3
[]
no_license
import numpy as np from shutil import copyfile import subprocess from tri_primitives import MetaMesh import os, sys, re def CreateTriRoomSequential(alpha): mesh = MetaMesh() length_passage = 0.2 Z_height = 0.1 width_wall = 0.2 length_wall = 4 length_bttm = 1 x_max = 8 width_mid = 0.5*(x_max - length...
true
1dea5fb89d26f7506e57e698200f8a9514b0f773
Python
d1makov/py_tasktracker
/tasks.py
UTF-8
2,839
3.78125
4
[]
no_license
""" In this program we can update hourly/fixed tasks with a new ones with a special price per each task """ class Task: """ Parent object define Task object """ def __init__(self, task_name): self._tasks = {**Hourly.tasks, **Fixed.tasks} self.task_name = task_name self._pri...
true
79580d62b0450ef562a4462cde33c327409014bc
Python
dhh1128/indy-agent
/python/post_message_handler.py
UTF-8
582
2.828125
3
[ "Apache-2.0" ]
permissive
""" Message receiver handlers. """ # pylint: disable=import-error from aiohttp import web import asyncio class PostMessageHandler(): """ Simple message queue interface for receiving messages. """ def __init__(self, queue): self.msg_queue = queue async def handle_message(self, request): ...
true
6d8aa97fdd65ccb05a6a7f4c7953a98cf06062fb
Python
ZhouPan1998/DataStructures_Algorithms
/3-基本数据结构/01-匹配括号.py
UTF-8
783
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- from pythonds.basic import Stack def par_checker(symbol_string): stack = Stack() index, length, balanced = 0, len(symbol_string), True while index < length and balanced: symbol = symbol_string[index] if symbol == '(': stack.push(symbol) else: ...
true
d213c9bcf3f1e34aec78cf044ad85973bdd9ba9b
Python
mrmyothet/ipnd
/ProgrammingBasicWithPython-KCL/Chapter-9/NoteTree.py
UTF-8
709
3.640625
4
[ "MIT" ]
permissive
class Node: def __init__(self,value): self.value = value self.child = [] def __repr__(self): return "Value is " + self.value def insert_child(self,node): self.child.append(node) def get_child(self): return self.child root = Node("A") b = Node("B") c = Node("C") d ...
true
d33f7eaa50e32ac0ba4d48e5163019aefc3081b4
Python
theDreamer911/codewars
/kyu 8/mergeTwoSortedArrays.py
UTF-8
478
3.46875
3
[]
no_license
# def merge_arrays(arr1, arr2): # for i in arr2: # arr1.append(i) # print(arr1) # return arr1.sort() # def merge_arrays(arr1, arr2): # arr = arr1 + arr2 # arr.sort() # return list(dict.fromkeys(arr)) # def merge_arrays(arr1, arr2): # return sorted(set(arr1+arr2)) def merge_arrays...
true
6b0ed25a31b41df4d9f1e5216fc1acfb26223feb
Python
harsha444/toppr_training
/day_wise_work_done/22nd_june/python_prac/class_methods.py
UTF-8
1,265
4.125
4
[]
no_license
# Class methods # Methods that are not concerned with instances, but class itself # (with the @classmethod decorator) class User: active_users = 0 @classmethod def display_active_users(cls): return ("There are currently "+ {cls.active_users} + " active users") @classmethod def from_string(cls, data_str): fi...
true
3eb1ccfbeb272fec6c4e2033f7b5ad2fbd7eded1
Python
kinnskogr/EuleurPython
/tools.py
UTF-8
2,740
3.59375
4
[]
no_license
def gcd(a,b): """Greatest Common Denominator""" while b != 0: a, b = b, a % b return a def lcm(a,b): """Least Common Multiple""" return a * b / gcd(a, b) def factorize(num): """Return all the factors for a number""" from math import ceil powers = [] limit = int(ceil(float...
true
5056c1b724818fce5e7239423754826d97dd932d
Python
frlnx/melee
/engine/tests/test_polygon.py
UTF-8
2,474
3.15625
3
[ "CC0-1.0" ]
permissive
from itertools import product import pytest from engine.physics.polygon import Polygon, ClosedPolygon class TestPolygonManufacture(object): def setup(self): self.target = Polygon.manufacture([(-5, 0), (-2, -3), (1, 0), (-2, 3)]) def test_polygon_has_four_lines(self): assert len(self.target...
true
ca91a030a45fa6f433d1341e40912462734ca4c2
Python
leeinae/algorithm-python
/Programmers/49993.py
UTF-8
448
3.328125
3
[]
no_license
from collections import deque # for - else: for 중간에 break에 걸리는 것 없이 수행되었을 때 else 실행 def solution(skill, skill_trees): answer = 0 for skills in skill_trees: skill_q = deque(skill) for s in skills: if s in skill_q and s != skill_q.popleft(): break else: ...
true
c3e78fb5552289e1ab7ac1be6c80680eee51479f
Python
yudi-alvin/PythonDailyPractice
/distanceMaxheap.py
UTF-8
894
3.46875
3
[]
no_license
import heapq k=3 res=[] d= {18:(3,4), 42:(6,7), 37:(4,7), 8:(2,1), 2:(2,2), 23:(4,5), 7:(2,3), -4:(2,-2)} #using sort l=sorted(d) #complexity: O(nlogn) for i in range(k): res.append(d.get(l[i])) print(res) #USING HEAP O(k + (n-k)logk) l=list(d.keys()) heapq.heapify(l)#must be a list # print(heapq.nlargest(3, l))...
true
0c5448eefd80fc9f8f424cdf532300a15007199d
Python
veratsurkis/infa_2020_postnikov
/lab2_1/ex13.py
UTF-8
805
3.609375
4
[]
no_license
import turtle as tr import numpy as np tr.shape("turtle") def circle(x,y,r): tr.penup() tr.goto(x+r,y) tr.pendown() for i in range(361): tr.goto(x+r*np.cos(i*np.pi/180),y+r*np.sin(i*np.pi/180)) def arc(x,y,r,angle_1,angle_2): tr.penup() tr.goto(x+r*np.cos(angle_1*np.pi/180),y+r*np.sin(...
true
7ba76ecef9722466927df39656e03f61a9ac9694
Python
Beardocracy/holbertonschool-web_back_end
/0x00-python_variable_annotations/3-to_str.py
UTF-8
255
3.609375
4
[]
no_license
#!/usr/bin/env python3 ''' This module contains a type-annotated function takes a float n as argument and returns the string representation of the float ''' def to_str(n: float) -> str: ''' Converts a float to a string ''' return str(n)
true
b57e07ce489cf46158ed880c9a66f085a1255177
Python
krishnajaV/luminarPythonpgm-
/flowcontroll/age.py
UTF-8
101
3.421875
3
[]
no_license
age=int(input("enter the age")) if(age>18): print("u can vote") else: print("you can't vote")
true
308b97af40980348d588d7eaaade8e38b15335cd
Python
eembees/adv_app_stat
/lib/lib_math.py
UTF-8
4,341
2.84375
3
[]
no_license
import scipy.stats import numpy as np from scipy.interpolate import interp1d, PchipInterpolator def critical_chi_sq(sigma, ndof): return scipy.stats.chi2.isf(1 - (0.5 - scipy.stats.norm.sf(sigma)) * 2, ndof) def chisq(exp, data, unc): return ( np.power(exp - data,2) / np.power(unc,2) ) def llh(data, pdf): ...
true
f73100dbd518f443dd243d06939a2db6f3786823
Python
zuza3012/MN
/lab6/zad6.py
UTF-8
1,068
3.140625
3
[ "MIT" ]
permissive
# rysuje atraktor lorentza - metoda RK4 import numpy as np import matplotlib.pyplot as plt def attractor(x): sigma = 10 b = 8 / 3 r = 28 return np.array([sigma * (x[1] - x[0]), -x[0] * x[2] + r * x[0] - x[1], x[0] * x[1] - b * x[2]]) def rungekutta4(f, x0, t0, tf, dt): t = np.arange(t0, tf, dt) ...
true
ce9ffa06fd90ddb62c03b5490e9667f66da39c57
Python
AjinkyaZ/QA682
/src/prepro.py
UTF-8
2,359
2.59375
3
[]
no_license
import json from collections import Counter from pprint import pprint from random import random import numpy as np from sklearn.model_selection import train_test_split from tqdm import tqdm import _pickle as pkl from utils import clean def main(): with open('../data/train-v1.1.json', 'r') as f: train_da...
true
05309c4d3d7b2910becd5c422fa74c9d29a68d2d
Python
carsonkahn-external/foreshadow
/foreshadow/utils/validation.py
UTF-8
5,684
2.78125
3
[ "Apache-2.0" ]
permissive
"""Common module utilities.""" import warnings import numpy as np import pandas as pd from sklearn.feature_extraction.text import VectorizerMixin from foreshadow.base import BaseEstimator, TransformerMixin PipelineStep = {"NAME": 0, "CLASS": 1, "COLS": 2} def check_series(input_data): """Convert non series i...
true
d09496387724878e964bd55b4f29e16c0668fd37
Python
MouadBH/coronapy-cli
/coronapy/lib/get_continets.py
UTF-8
746
2.65625
3
[ "MIT" ]
permissive
import requests def get_continents(sort_by, limit): url = f"https://corona.lmao.ninja/v2/continents?sort={sort_by}" response = requests.get(url) response = response.json()[:limit] if limit > 0 else response.json() return [[ index + 1, continent["continent"], ...
true
07c5d42ec38637ec4ad3ed7182e5581aedd09bf1
Python
jameygronewald/python_challenges
/rock_paper_scissors.py
UTF-8
789
3.875
4
[]
no_license
import random def init(): user_choice = input(f"Rock, paper, scissors, SHOOT!\n(Select 'r', 'p', or 's' on your keyboard.) ") potential_computer_responses = ['r', 'p', 's'] computer_choice = random.choice(potential_computer_responses) print(f"\nYou choose {user_choice} and computer chooses {computer_...
true
ec81a4c34f423122dbf1426b0efe3e2d57a34c55
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2533/60776/287957.py
UTF-8
253
2.96875
3
[]
no_license
a = input() a = a.replace("[", "") a = a.replace("]", "") b = a.split(',') for i in range(0, len(b)): b[i] = int(b[i]) c=[] d=[] for i in range(0,len(b)): if b[i]%2==1: d.append(b[i]) else: c.append(b[i]) c.extend(d) print(c)
true
bb5db0c18b6a46571486d930b44eff71e34f1115
Python
eraldovicente/Estrutura_de_dados_em_Python
/aula-12.py
UTF-8
355
3.53125
4
[]
no_license
class Pessoa: # def __init__(self, nome): # self.__nome = nome def __init__(self): self.__nome = None # def getNome(self): # return self.__nome @property def nome(self): return self._nome @nome.setter def nome(self, nome): self.__nome = nome p = Pessoa('Marcos') # print(p.nome) # print(p.getNome...
true
55c8a38fba15543bdd27212bd2fbb5699d8284f8
Python
witness97/computationalphysics_N2015301020062
/untitled0.py
UTF-8
819
2.796875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import math a0 = 0.2 FD = float(input('FD=')) gl = 1.0 q = 0.5 dt = 0.04 m = math.pi Ωd = 0.2*m list1 = [0] list2 = [a0] list5 = [0] list6 = [0] list7 = [0] list8 = [0] i = 0 j = 0 while i < 1000000: t = list1[i] wx1 = list5[i] ax = list2[i] Fx ...
true
da53f3d0b67bb1e9b67491eb9261889f2e4c5edd
Python
dangding/python
/src/var.py
UTF-8
237
3.46875
3
[ "Apache-2.0" ]
permissive
# 模块内有效 v1 = 0 print (v1) def fun(): # 控制单元内有效 v2 = 1 print(v2) # 由于v1作用于模块内,因此,也可以访问 print(v1) # 不能访问,v2无效 #print(v2) fun()
true
9f44ea48af7a7bc5e3cf0efdff79b3e09f708e61
Python
bedilbek/store_management
/models/staff.py
UTF-8
984
3.1875
3
[]
no_license
from models.citizen import Citizen class Staff(Citizen): def __init__(self, name, address, ssn, id, jobTitle, salary): super().__init__(ssn, name, address) self.id = id self.jobTitle = jobTitle self.salary = salary def __str__(self): out = f"{self.jobTitle}:\ ...
true
edb2238584d4bb8788bab10e426d4db55052de14
Python
kyle-richardson/Adventure-game
/src/room.py
UTF-8
587
3.609375
4
[]
no_license
class Room: def __init__(self, name, desc, items=[]): self.name = name self.desc = desc self.n_to = "" self.s_to = "" self.e_to = "" self.w_to = "" self.items = items def removeItem(self, item): self.items.remove(item) def addItem(self, item...
true
c8f0443a258e6f147e148bdb251df123b45ed721
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2365/60722/245379.py
UTF-8
338
2.953125
3
[]
no_license
T=int(input()) for t in range(T): N=int(input()) nums=input().split(" ") nums.sort() nums.reverse() for i in range(N-1): if nums[i]==nums[i+1]+"0": index=nums[i] nums[i]=nums[i+1] nums[i+1]=index result="" for i in range(N): result+=nums[i]...
true
d230d727c01fdc519a4700204263b603573e7ec6
Python
Govi01/PythonCrypto
/Qmath/SS_Prime.py
UTF-8
1,865
3.3125
3
[]
no_license
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*- from random import randint from math import sqrt #一下两个函数在求快速幂 def BCD_TO_BIN(a): l1=[] while(a): l1.append(a%2) a//=2 return l1 def pow_new(a,b,n): a=a%n l1=BCD_TO_BIN(b) l2=[a] for i in range(1,len(l1)): ...
true
ae03bdcf3e1b3878745fb5180e96ff5364ff91af
Python
gerrardjenner/pyrl
/item_functions.py
UTF-8
6,841
2.734375
3
[]
no_license
import libtcodpy as libtcod from components.ai import ConfusedMonster from game_messages import Message def acquire_gold(*args, **kwargs): entity = args[0] amount = kwargs.get('amount') results = [] entity.fighter.addgold(amount) results.append({'gold_added': False, 'message': Message('You pick...
true
50986f80c09963032ce0e0856a3d233a8fef9c92
Python
stelzch/diploid-cellular-automata
/density_calc.py
UTF-8
1,562
3.296875
3
[]
no_license
from time import sleep from random import random,seed from math import inf from time import time f1 = 22 f2 = 110 n_cells = 10_000 timesteps = 5_000 initial_prob = 0.5 mlambda = 0.2 def local_f(rule, x, y, z): return (rule >> (x * 4 + y * 2 + z) & 1) def f(state, oldstate): for cell_num in range(n_cells): ...
true