New beta. Remove pack() in extras (no longer needed)

main
none 1 year ago
parent 3bf33f9d30
commit edcaf98b42

@ -2,19 +2,17 @@ from listwork import *
from random import randint as ri from random import randint as ri
# pas2( fill(...) ) -> 1/2 # pas2( fill(...) ) -> 1/2
def pas2(packed): def pas2(pxls):
unpacked = unpack(packed["main"])
new_pxls = [] new_pxls = []
pas = False pas = False
for i in unpacked: for i in pxls:
if not pas: if not pas:
new_pxls.append(i) new_pxls.append(i)
pas = True pas = True
else: else:
pas = False pas = False
packed = {"main": pack(new_pxls)} return new_pxls
return packed
# rand(x1,y1, x2,y2) -> draw() or pas2() # rand(x1,y1, x2,y2) -> draw() or pas2()
def rand(x1,y1, x2,y2): def rand(x1,y1, x2,y2):
@ -22,5 +20,4 @@ def rand(x1,y1, x2,y2):
for x in range(x1, x2 +1): for x in range(x1, x2 +1):
for y in range(y1, y2 +1): for y in range(y1, y2 +1):
pxls.append([x,y, ri(0,255), ri(0,255), ri(0,255)]) pxls.append([x,y, ri(0,255), ri(0,255), ri(0,255)])
packed = {"main": pack(pxls)} return pxls
return packed

@ -1,4 +1,6 @@
import requests import requests
from time import sleep
# Progress-bar
from tqdm import tqdm from tqdm import tqdm
# Work with list-like objects # Work with list-like objects
from listwork import * from listwork import *
@ -22,6 +24,7 @@ def fill(x1,y1, x2,y2, color):
# draw( fill(...) ) # draw( fill(...) )
def draw(pxls): def draw(pxls):
global server global server
ic(pxls)
push = [] # Push %limit% items push = [] # Push %limit% items
limit = 300 limit = 300
@ -34,11 +37,13 @@ def draw(pxls):
push.append({"main": pack(packs)}) push.append({"main": pack(packs)})
push.append({"main": pack(pxls)}) # Pack last push.append({"main": pack(pxls)}) # Pack last
ic(push)
for i in tqdm(push): for i in tqdm(push):
response = requests.post(server, i) response = requests.post(server, i)
while not response.status_code == 200: while not response.status_code == 200:
print("Error, retrying...") print("Error, retrying...")
response = requests.post(server, i) response = requests.post(server, i)
sleep(0.1)
# cfill(0,0, 10,10) # cfill(0,0, 10,10)
def cfill(x1,y1, x2,y2): def cfill(x1,y1, x2,y2):
@ -57,10 +62,11 @@ def ccheck(packed):
return out return out
from random import randint as ri from random import randint as ri
draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) ) #draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) )
#draw( [[0,0, 100,100, 255,255,255]] )
#print(ccheck(pack([[0,0]]) )) #print(ccheck(pack([[0,0]]) ))
#print(ccheck(cfill(0,0, 10,10))) #print(ccheck(cfill(0,0, 10,10)))
#from bot_extras import * from bot_extras import *
#print( draw(pas2( rand(0,0, 100,100) )) ) draw(pas2( rand(0,0, 100,100) ))

Loading…
Cancel
Save