diff options
Diffstat (limited to 'lib/imgradient_params_defaults.py')
| -rw-r--r-- | lib/imgradient_params_defaults.py | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/lib/imgradient_params_defaults.py b/lib/imgradient_params_defaults.py index d0ba3ac..313c0bc 100644 --- a/lib/imgradient_params_defaults.py +++ b/lib/imgradient_params_defaults.py @@ -19,157 +19,7 @@ from lib.utils import Pb_Api_Params class ImGradientParams_FromDefaults(Pb_Api_Params): def __init__(self): - self.weighted_width = [ - { "value" : 400, "weight" : 1 }, - { "value" : 600, "weight" : 1 }, - ] - self.weighted_height = [ - { "value" : 400, "weight" : 1 }, - { "value" : 600, "weight" : 1 }, - ] - self.weighted_colors = [ - { "value" : - "rgb({},{},{})".format( - random.randint(0,255), - random.randint(0,255), - random.randint(0,255), - ), - "weight" : 1 }, - { "value" : "black", "weight" : 1 }, - { "value" : "white", "weight" : 1 }, - ] - self.weighted_stripes = [ - {"value":"true", "weight": 1}, - {"value":"false", "weight": 1}, - ] - self.weighted_stripenumber = [ - {"value":1, "weight": 1}, - {"value":2, "weight": 1}, - {"value":random.randint(0,400), "weight": 1}, - ] - self.weighted_stripeintensity = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,2000), "weight": 1}, - ] - self.weighted_blurriness = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,20), "weight": 1}, - ] - self.weighted_contrast = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,20), "weight": 1}, - ] - self.weighted_brightness = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,200), "weight": 1}, - ] - self.weighted_saturation = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,200), "weight": 1}, - ] - self.weighted_hue = [ - {"value": "", "weight": 3}, - {"value": random.randint(0,200), "weight": 1}, - ] - self.weighted_halftone = [ - { "value" : "checkeredfade", "weight": 1 }, - { "value" : "etchedtransition", "weight": 1 }, - { "value" : "bendaydots", "weight": 1 }, - { "value" : "smallerdots1", "weight": 1 }, - { "value" : "smallerdots2", "weight": 1 }, - { "value" : "flatstripes", "weight": 1 }, - ] - self.weighted_bevel = [ - { "value" : "", "weight" : 4 }, - { "value" : "flatout", "weight" : 1 }, - { "value" : "flatinner", "weight" : 1 }, - { "value" : "evenlyframed", "weight" : 1 }, - { "value" : "biginner", "weight" : 1 }, - { "value" : "bigouter", "weight" : 1 }, - { "value" : "dramaticflatout", "weight" : 1 }, - { "value" : "dramaticflatinner", "weight" : 1 }, - ] - self.weighted_percentbeveled = [ - { "value" : random.randint(0,99), "weight": 1 }, - { "value" : "", "weight": 4 }, - ] - self.weighted_rotate = [ - {"value":"", "weight": 9}, - {"value":90, "weight": 2}, - {"value":180, "weight": 2}, - {"value":270, "weight": 2}, - {"value":random.randint(0,360), "weight": 4}, - ] - self.weighted_flop = [ - {"value":"", "weight": 1}, - {"value":"true", "weight": 1}, - ] - self.weighted_flip = [ - {"value":"", "weight": 1}, - {"value":"true", "weight": 1}, - ] - self.weighted_tilt = [ - {"value":"", "weight": 9}, - {"value":90, "weight": 2}, - {"value":180, "weight": 2}, - {"value":270, "weight": 2}, - {"value":random.randint(0,360), "weight": 4}, - ] - self.weighted_filetype = [ - {"value":"png", "weight": 5}, - {"value":"jpg", "weight": 2}, - {"value":"gif", "weight": 2}, - ] - self.weighted_gradienttype = [ - { "value" : "canvas", "weight" : 1 }, - { "value" : "gradient", "weight" : 3 }, - { "value" : "radial", "weight" : 1 }, - { "value" : "colorspace", "weight" : 1 }, - { "value" : "plasmawash", "weight" : 1 }, - { "value" : "gradientwash", "weight" : 1 }, - { "value" : "mirrored", "weight" : 1 }, - { "value" : "noise", "weight" : 1 }, - ] -#I just needed a place to encapsulate the params and the weights, and methods to access them. I guess I didn't really know the right answer -#as far as the structure, so I tried to just imagine something somewhat related to what you were talking about before. -#do I need separate classes for the two methods below? -#well lets dicusss this a bit more, so services each have own param set, they are sort of original from service itself, so i guess there should be a way to get -#"fresh" copy of parameters accepted by this service, instead of rewriting code each time. do you mean just a list of the keynames? yeah and thier values -#the keys don't have default values necessarily. they just each have a range of accepted values. Basically just html forms hmm sort of like -#writing a bot that fills in some forms on the internet, like a bot to brute force a credit card form or something, funny example, but I guess a good one -#each parameter has values that are within an accepted range, like First Name would need to come from a list of frist names, and CC number would need to bevel -#intelligible ints, the first four should correspond with a known bank, etc. you understand what I mean? yeah -ok so since all services are about same, just a bunch of parameters and known values we can make base class for parameteres. it would look like: - - -class ApiParams(object): - def params(): - def randomize(): - def build(): - -class ImGradientParams(ApiParams): - def __init__(): - self.params = { - "width": # well here it's int i suppose, need somethig esle - "gradienttype": [ - { "value "...} - ] - } - -class ImGradientPb_Api(): - def params(): - return new ImGradientParams() - def call(params): - return image(); - - -api = ImGradientPb_Api() -image_params = api.params() -image_params.gradient_type("mirror") -image_params.randomize() -image = api.call(image _params) -# something like this, yeah I think so...lol I tried to do something like this def from_random(self): |
