summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-10-10 02:54:41 -0700
committeryo mama <pepper@scannerjammer.com>2015-10-10 02:54:41 -0700
commitb02cc8d49513cdcc54f4421e71db3512354d4e2e (patch)
tree2a3a83e1f99a1108eedb703d2cf8ed43613b2c22
parent52d85ddcb9c934ec4dc0e890633762bfa2ff51f5 (diff)
renamed options to selections
-rw-r--r--ricky/imbreak/params.py24
-rw-r--r--ricky/imgradient/params.py42
-rw-r--r--ricky/imgradient/selections.py (renamed from ricky/imgradient/options.py)44
-rw-r--r--ricky/imgrid/params.py52
-rwxr-xr-xricky/imgrid/selections.py (renamed from ricky/imgrid/options.py)28
-rw-r--r--ricky/impattern/params.py18
-rw-r--r--ricky/param/color.py4
-rw-r--r--ricky/param/multiselect.py6
-rw-r--r--ricky/param/numberrange.py8
-rw-r--r--ricky/param/param.py22
-rw-r--r--ricky/param/selection.py (renamed from ricky/param/option.py)4
-rw-r--r--ricky/param/selections.py (renamed from ricky/param/options.py)8
12 files changed, 130 insertions, 130 deletions
diff --git a/ricky/imbreak/params.py b/ricky/imbreak/params.py
index 01a46e4..9d8b356 100644
--- a/ricky/imbreak/params.py
+++ b/ricky/imbreak/params.py
@@ -1,7 +1,7 @@
import re, random
from ricky.params import Params
-from ricky.param.option import Option
-from ricky.param.options import Options
+from ricky.param.option import Selection
+from ricky.param.selections import Selections
from ricky.param.username import Username
from ricky.param.imageurl import ImageUrl
from ricky.param.multiselect import MultiSelect
@@ -10,7 +10,7 @@ from ricky.param.color import Color
from ricky.config import PATTERN_BASE_URL
-breaktype_options = Options.from_dict(
+breaktype_selections = Selections.from_dict(
{"value":"CLASSIC", "weight": 1},
{"value":"REDUX", "weight": 1},
{"value":"BLURRY_BREAK", "weight": 1},
@@ -24,22 +24,22 @@ breaktype_options = Options.from_dict(
{"value":"STRIPES", "weight": 1},
{"value":"PHOTOCOPY", "weight": 1},
)
-breakmode_options = Options.from_dict(
+breakmode_selections = Selections.from_dict(
{"value":"extreme", "weight": 1},
{"value":"subtle", "weight": 1},
)
-finalformat_options = Options.from_dict(
+finalformat_selections = Selections.from_dict(
{"value":"png", "weight": 5},
{"value":"jpg", "weight": 2},
{"value":"gif", "weight": 2},
)
-breakangle_options = Options.from_dict(
+breakangle_selections = Selections.from_dict(
{"value":0, "weight": 9},
{"value":90, "weight": 2},
{"value":-180, "weight": 2},
{"value":180, "weight": 2},
)
-expanded_options = Options.from_dict(
+expanded_selections = Selections.from_dict(
{"value": "" , "weight": 11 },
{"value": 1, "weight": 2}
)
@@ -49,9 +49,9 @@ class ImBreakParams(Params):
self._params = [
Username(name="username", required=0),
ImageUrl(name="url", required=1),
- MultiSelect(name="finalformat", required=0, options=finalformat_options),
- MultiSelect(name="breaktype", required=1, options=breaktype_options),
- NumberRange(name="breakangle", required=0, options=breakangle_options, min=-180, max=180),
- MultiSelect(name="breakmode", required=1, options=breakmode_options),
- MultiSelect(name="expanded", required=0, options=expanded_options),
+ MultiSelect(name="finalformat", required=0, selections=finalformat_selections),
+ MultiSelect(name="breaktype", required=1, selections=breaktype_selections),
+ NumberRange(name="breakangle", required=0, selections=breakangle_selections, min=-180, max=180),
+ MultiSelect(name="breakmode", required=1, selections=breakmode_selections),
+ MultiSelect(name="expanded", required=0, selections=expanded_selections),
]
diff --git a/ricky/imgradient/params.py b/ricky/imgradient/params.py
index f950429..373a9a1 100644
--- a/ricky/imgradient/params.py
+++ b/ricky/imgradient/params.py
@@ -4,7 +4,7 @@ from ricky.param.username import Username
from ricky.param.multiselect import MultiSelect
from ricky.param.numberrange import NumberRange
from ricky.param.color import Color
-from ricky.imgradient.options import *
+from ricky.imgradient.selections import *
class Params(_Params):
@@ -14,47 +14,47 @@ class Params(_Params):
NumberRange(
name="width",
required=1,
- options=width_options,
+ selections=width_selections,
min=10,
max=800
),
NumberRange(
name="height",
required=1,
- options=height_options,
+ selections=height_selections,
min=10,
max=800
),
- Color(name="color1", required=1, options=color1_options),
- Color(name="color2", required=1, options=color2_options),
+ Color(name="color1", required=1, selections=color1_selections),
+ Color(name="color2", required=1, selections=color2_selections),
MultiSelect(
name="filetype",
required=0,
- options=filetype_options
+ selections=filetype_selections
),
MultiSelect(
name="gradienttype",
required=1,
- options=gradienttype_options
+ selections=gradienttype_selections
),
MultiSelect(
name="halftone",
required=0,
- options=halftone_options
+ selections=halftone_selections
),
- MultiSelect(name="bevel", required=0, options=bevel_options),
+ MultiSelect(name="bevel", required=0, selections=bevel_selections),
NumberRange(
name="stripenumber",
required=0,
- options=stripenumber_options,
+ selections=stripenumber_selections,
min=0,
max=400
),
NumberRange(
name="stripeintensity",
required=0,
- options=stripeintensity_options,
+ selections=stripeintensity_selections,
min=0,
max=5000
),
@@ -62,59 +62,59 @@ class Params(_Params):
NumberRange(
name="blurriness",
required=0,
- options=blurriness_options,
+ selections=blurriness_selections,
min=0,
max=200
),
# NumberRange(
# name="contrast",
# required=0,
- # options=contrast_options,
+ # selections=contrast_selections,
# min=0,
# max=200
# ),
NumberRange(
name="brightness",
required=0,
- options=brightness_options,
+ selections=brightness_selections,
min=0,
max=200
),
NumberRange(
name="saturation",
required=0,
- options=saturation_options,
+ selections=saturation_selections,
min=0,
max=200
),
NumberRange(
name="hue",
required=0,
- options=hue_options,
+ selections=hue_selections,
min=0,
max=200
),
NumberRange(
name="percentbeveled",
required=0,
- options=percentbeveled_options,
+ selections=percentbeveled_selections,
min=0,
max=100
),
NumberRange(
name="rotate",
required=0,
- options=rotate_options,
+ selections=rotate_selections,
min=0,
max=360
),
NumberRange(
name="tilt",
required=0,
- options=tilt_options,
+ selections=tilt_selections,
min=0,
max=360
),
- MultiSelect(name="flop", required=0, options=flop_options),
- MultiSelect(name="flip", required=0, options=flip_options),
+ MultiSelect(name="flop", required=0, selections=flop_selections),
+ MultiSelect(name="flip", required=0, selections=flip_selections),
)
diff --git a/ricky/imgradient/options.py b/ricky/imgradient/selections.py
index dd14cba..d5eda16 100644
--- a/ricky/imgradient/options.py
+++ b/ricky/imgradient/selections.py
@@ -1,29 +1,29 @@
-from ricky.param.options import Options
+from ricky.param.selections import Selections
-width_options = Options.from_dict(
+width_selections = Selections.from_dict(
{"value": 40, "weight": 60},
{"value": 20, "weight": 60},
{"value": 60, "weight": 60},
{"value": 80, "weight": 60},
)
-height_options = Options.from_dict(
+height_selections = Selections.from_dict(
{"value": 400, "weight": 900},
)
-color1_options = Options.from_dict(
+color1_selections = Selections.from_dict(
{"value": "", "weight": 0},
# {"value": "black", "weight": 1},
# {"value": "white", "weight": 2},
)
-color2_options = Options.from_dict(
+color2_selections = Selections.from_dict(
{"value": "", "weight": 0},
# {"value": "black", "weight": 2},
# {"value": "white", "weight": 1},
)
-stripes_options = Options.from_dict(
+stripes_selections = Selections.from_dict(
{"value": "true", "weight": 3},
{"value": "false", "weight": 1},
)
-stripenumber_options = Options.from_dict(
+stripenumber_selections = Selections.from_dict(
{"value": 3, "weight": 10},
{"value": 10, "weight": 10},
{"value": 20, "weight": 10},
@@ -34,19 +34,19 @@ stripenumber_options = Options.from_dict(
# {"value": 2, "weight": 50},
)
-stripeintensity_options = Options.from_dict(
+stripeintensity_selections = Selections.from_dict(
{"value": 1000, "weight": 10},
{"value": 4, "weight": 10},
)
-# contrast_options = \
-brightness_options = \
- saturation_options = \
- hue_options = \
- Options.from_dict(
+# contrast_selections = \
+brightness_selections = \
+ saturation_selections = \
+ hue_selections = \
+ Selections.from_dict(
{"value": "", "weight": 0},
# {"value": "", "weight": 300},
)
-halftone_options = Options.from_dict(
+halftone_selections = Selections.from_dict(
{"value": "", "weight": 60},
{"value": "checkeredfade", "weight": 10},
{"value": "etchedtransition", "weight": 10},
@@ -55,7 +55,7 @@ halftone_options = Options.from_dict(
{"value": "smallerdots2", "weight": 10},
{"value": "flatstripes", "weight": 10},
)
-bevel_options = Options.from_dict(
+bevel_selections = Selections.from_dict(
{"value": "", "weight": 4},
{"value": "flatout", "weight": 1},
{"value": "flatinner", "weight": 0},
@@ -66,30 +66,30 @@ bevel_options = Options.from_dict(
# {"value": "dramaticflatinner", "weight": 1},
)
-blurriness_options = \
- percentbeveled_options = Options.from_dict(
+blurriness_selections = \
+ percentbeveled_selections = Selections.from_dict(
{"value": 30, "weight": 20},
{"value": 10, "weight": 2},
{"value": "", "weight": 1},
)
-rotate_options = \
- tilt_options = Options.from_dict(
+rotate_selections = \
+ tilt_selections = Selections.from_dict(
{"value": 0, "weight": 200},
{"value": 90, "weight": 2},
{"value": 180, "weight": 2},
{"value": 270, "weight": 2},
)
-flop_options = flip_options = Options.from_dict(
+flop_selections = flip_selections = Selections.from_dict(
{"value": "", "weight": 1},
{"value": "true", "weight": 1},
)
-filetype_options = Options.from_dict(
+filetype_selections = Selections.from_dict(
{"value": "png", "weight": 10},
{"value": "jpg", "weight": 2},
{"value": "gif", "weight": 2},
)
-gradienttype_options = Options.from_dict(
+gradienttype_selections = Selections.from_dict(
{"value": "canvas", "weight": 1},
{"value": "gradient", "weight": 5},
{"value": "radial", "weight": 1},
diff --git a/ricky/imgrid/params.py b/ricky/imgrid/params.py
index 2bcb367..b541e84 100644
--- a/ricky/imgrid/params.py
+++ b/ricky/imgrid/params.py
@@ -1,15 +1,15 @@
import re, random
from ricky.params import Params
from ricky.param import Param
-from ricky.param.option import Option
-from ricky.param.options import Options
+from ricky.param.option import Selection
+from ricky.param.selections import Selections
from ricky.param.username import Username
from ricky.param.imageurl import ImageUrl
from ricky.param.multiselect import MultiSelect
from ricky.param.numberrange import NumberRange
from ricky.param.color import Color
-from ricky.imgrid.options import *
+from ricky.imgrid.selections import *
class Param_Zoom(NumberRange):
def __init__(self, **kwargs):
@@ -18,10 +18,10 @@ class Param_Zoom(NumberRange):
def test_value(self):
return not ((self.value > self.exclusion_range[0]) and (self.value < self.exclusion_range[1]))
def randomize(self):
- weights_total = sum(map(lambda x: x["weight"], self.options())) + 10
+ weights_total = sum(map(lambda x: x["weight"], self.selections())) + 10
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
@@ -47,10 +47,10 @@ class Param_Opacity(NumberRange):
def __init__(self, **kwargs):
super(Param_Opacity, self).__init__(**kwargs)
def randomize(self):
- weights_total = sum(map(lambda x: x["weight"], self.options()) + self.range_max - self.range_min)
+ weights_total = sum(map(lambda x: x["weight"], self.selections()) + self.range_max - self.range_min)
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
@@ -64,25 +64,25 @@ class ImGridParams(Params):
ImageUrl(name="bgimage", required=0),
ImageUrl(name="imageinstead", required=0),
ImageUrl(name="planebgimage", required=0),
- MultiSelect(name="format", required=0, options=format_options),
- MultiSelect(name="transition", required=1, options=transition_options),
- Color(name="skycolor", required=0, options=skycolor_colors),
- Color(name="planebgcolor", required=0, options=planebgcolor_colors),
- Color(name="bgcolor", required=0, options=bgcolor_colors),
- Color(name="linecolor", required=0, options=linecolor_colors),
- NumberRange(name="swing", required=0, options=swing_options, min=-170, max=170),
- NumberRange(name="tilt", required=0, options=tilt_options, min=-170, max=170),
- NumberRange(name="roll", required=0, options=roll_options, min=-170, max=170),
- NumberRange(name="width", required=0, options=width_options, min=100, max=800),
- NumberRange(name="height", required=0, options=height_options, min=100, max=800),
- NumberRange(name="linethickness", required=0, options=linethickness_options, min=1, max=30),
- NumberRange(name="opacity", required=0, options=opacity_options, min=0, max=1),
- NumberRange(name="spacing", required=0, options=spacing_options, min=2, max=100),
- MultiSelect(name="vlines", required=0, options=vlines_options),
- MultiSelect(name="hlines", required=0, options=hlines_options),
- MultiSelect(name="trim", required=0, options=trim_options),
- MultiSelect(name="shadow", required=0, options=shadow_options),
- Param_Zoom(name="zoom", required=0, options=zoom_options, min=-12, max=12, exclusion_range=[-1.1, 1.1]),
+ MultiSelect(name="format", required=0, selections=format_selections),
+ MultiSelect(name="transition", required=1, selections=transition_selections),
+ Color(name="skycolor", required=0, selections=skycolor_colors),
+ Color(name="planebgcolor", required=0, selections=planebgcolor_colors),
+ Color(name="bgcolor", required=0, selections=bgcolor_colors),
+ Color(name="linecolor", required=0, selections=linecolor_colors),
+ NumberRange(name="swing", required=0, selections=swing_selections, min=-170, max=170),
+ NumberRange(name="tilt", required=0, selections=tilt_selections, min=-170, max=170),
+ NumberRange(name="roll", required=0, selections=roll_selections, min=-170, max=170),
+ NumberRange(name="width", required=0, selections=width_selections, min=100, max=800),
+ NumberRange(name="height", required=0, selections=height_selections, min=100, max=800),
+ NumberRange(name="linethickness", required=0, selections=linethickness_selections, min=1, max=30),
+ NumberRange(name="opacity", required=0, selections=opacity_selections, min=0, max=1),
+ NumberRange(name="spacing", required=0, selections=spacing_selections, min=2, max=100),
+ MultiSelect(name="vlines", required=0, selections=vlines_selections),
+ MultiSelect(name="hlines", required=0, selections=hlines_selections),
+ MultiSelect(name="trim", required=0, selections=trim_selections),
+ MultiSelect(name="shadow", required=0, selections=shadow_selections),
+ Param_Zoom(name="zoom", required=0, selections=zoom_selections, min=-12, max=12, exclusion_range=[-1.1, 1.1]),
]
def test_values(self):
p = self.params
diff --git a/ricky/imgrid/options.py b/ricky/imgrid/selections.py
index 8ada475..7338709 100755
--- a/ricky/imgrid/options.py
+++ b/ricky/imgrid/selections.py
@@ -1,10 +1,10 @@
-from ricky.param.options import Options
-format_options = Options.from_dict(
+from ricky.param.selections import Selections
+format_selections = Selections.from_dict(
{ 'weight': 20, 'value': 'png' },
{ 'weight': 0, 'value': 'gif' },
{ 'weight': 0, 'value': 'jpg' },
)
-transition_options = Options.from_dict(
+transition_selections = Selections.from_dict(
{ "value" : "background", "weight": 1 },
{ "value" : "dither", "weight": 1 },
{ "value" : "random", "weight": 1 },
@@ -12,52 +12,52 @@ transition_options = Options.from_dict(
{ "value" : "edge", "weight": 1 },
)
skycolor_colors = \
- bgcolor_colors = planebgcolor_colors = Options.from_dict(
+ bgcolor_colors = planebgcolor_colors = Selections.from_dict(
{ "value" : "white", "weight" : 1 },
{ "value" : "silver", "weight" : 1 },
{ "value" : None, "weight" : 10 },
)
-linecolor_colors = Options.from_dict(
+linecolor_colors = Selections.from_dict(
{ "value" : "black", "weight" : 1 },
{ "value" : "white", "weight" : 1 },
{ "value" : "silver", "weight" : 1 },
)
-swing_options = tilt_options = roll_options = Options.from_dict(
+swing_selections = tilt_selections = roll_selections = Selections.from_dict(
{"value": "", "weight": 2},
{"value": 30, "weight": 1},
{"value": -30, "weight": 1},
)
-width_options = height_options = Options.from_dict(
+width_selections = height_selections = Selections.from_dict(
{ "value" : 400, "weight" : 1 },
{ "value" : 600, "weight" : 1 },
)
-linethickness_options = Options.from_dict(
+linethickness_selections = Selections.from_dict(
{"value":1, "weight": 2},
{"value":2, "weight": 1},
)
-opacity_options = Options.from_dict(
+opacity_selections = Selections.from_dict(
{"value":1, "weight": 2},
{"value":0.5, "weight": 1},
)
-spacing_options = Options.from_dict(
+spacing_selections = Selections.from_dict(
{"value":10, "weight": 1},
{"value":15, "weight": 1},
)
-vlines_options = hlines_options = Options.from_dict(
+vlines_selections = hlines_selections = Selections.from_dict(
{"value":"", "weight": 2},
{"value":"true", "weight": 1},
)
-shadow_options = Options.from_dict(
+shadow_selections = Selections.from_dict(
{"value":"", "weight": 1},
{"value":"true", "weight": 1},
)
-zoom_options = Options.from_dict(
+zoom_selections = Selections.from_dict(
{"value": 0, "weight": 3},
{"value": 1.2, "weight": 1},
{"value": -1.2, "weight": 1},
)
-trim_options = Options.from_dict(
+trim_selections = Selections.from_dict(
{"value":"", "weight": 1},
{"value":"true", "weight": 1},
)
diff --git a/ricky/impattern/params.py b/ricky/impattern/params.py
index 833bed1..73c6fb2 100644
--- a/ricky/impattern/params.py
+++ b/ricky/impattern/params.py
@@ -1,17 +1,17 @@
import re
from ricky.params import Params
from ricky.param import Param
-from ricky.param.option import Option
-from ricky.param.options import Options
+from ricky.param.option import Selection
+from ricky.param.selections import Selections
from ricky.param.username import Username
from ricky.param.imageurl import ImageUrl
from ricky.param.multiselect import MultiSelect
from ricky.config import PATTERN_BASE_URL
-class Pattern_UrlOption(Option):
+class Pattern_UrlSelection(Selection):
def __init__(self, **kwargs):
- super(Pattern_UrlOption, self).__init__(**kwargs)
+ super(Pattern_UrlSelection, self).__init__(**kwargs)
@classmethod
def from_name(cls, **kwargs):
formatted = "{}/{}.png".format(PATTERN_BASE_URL, kwargs["value"])
@@ -22,12 +22,12 @@ class ImPatternParams(Params):
self._params = [
Username(name="username", required=0),
ImageUrl(name="image_url", required=1),
- MultiSelect(name="pattern_url", required=1, options=pattern_url_options)
+ MultiSelect(name="pattern_url", required=1, selections=pattern_url_selections)
]
-pattern_url_options = Options(*[
- Pattern_UrlOption.from_name(weight=0, value=i) for i in range(1,100) ] + [
- Pattern_UrlOption.from_name(weight=0, value="a{}".format(i)) for i in range(0, 42)
+pattern_url_selections = Selections(*[
+ Pattern_UrlSelection.from_name(weight=0, value=i) for i in range(1,100) ] + [
+ Pattern_UrlSelection.from_name(weight=0, value="a{}".format(i)) for i in range(0, 42)
])
-pattern_url_options.search("a10").weight = 20;
+pattern_url_selections.search("a10").weight = 20;
diff --git a/ricky/param/color.py b/ricky/param/color.py
index ecec79c..4d9f4d5 100644
--- a/ricky/param/color.py
+++ b/ricky/param/color.py
@@ -23,11 +23,11 @@ class Color(Param):
def randomize(self):
weights_total = sum(
- map(lambda x: x["weight"], self.options())
+ map(lambda x: x["weight"], self.selections())
) + (255 * 255 * 255)
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
diff --git a/ricky/param/multiselect.py b/ricky/param/multiselect.py
index 68df161..21eca78 100644
--- a/ricky/param/multiselect.py
+++ b/ricky/param/multiselect.py
@@ -10,7 +10,7 @@ class MultiSelect(Param):
return super(MultiSelect, self).value_get()
def value_set(self, value):
- if not any([value == i['value'] for i in self._options]) and \
+ if not any([value == i['value'] for i in self._selections]) and \
value is not None:
raise ValueError
super(MultiSelect, self).value_set(value)
@@ -18,10 +18,10 @@ class MultiSelect(Param):
value = property(value_get, value_set)
def randomize(self):
- weights_total = sum(map(lambda x: x["weight"], self.options()))
+ weights_total = sum(map(lambda x: x["weight"], self.selections()))
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
diff --git a/ricky/param/numberrange.py b/ricky/param/numberrange.py
index 8fe517b..626d128 100644
--- a/ricky/param/numberrange.py
+++ b/ricky/param/numberrange.py
@@ -10,18 +10,18 @@ class NumberRange(Param):
def randomize(self):
weights_total = sum(
- map(lambda x: x["weight"], self.options())
+ map(lambda x: x["weight"], self.selections())
)# + self.range_max - self.range_min
if weights_total < 100:
weights_total = 100;
choice = random.randint(0, weights_total)
import sys
- sys.stderr.write("choosing %s: random_int: %s, options: %s\n" % (
+ sys.stderr.write("choosing %s: random_int: %s, selections: %s\n" % (
self.name,
choice,
- self.options()))
+ self.selections()))
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
diff --git a/ricky/param/param.py b/ricky/param/param.py
index 57c801a..6f7e2a7 100644
--- a/ricky/param/param.py
+++ b/ricky/param/param.py
@@ -15,19 +15,19 @@ class Param(object):
self.is_ready = 0
self._value = value
self.set_by_user = set_by_user
- self._options = kwargs.get('options') or []
- if len(self._options):
- self._validate_options()
+ self._selections = kwargs.get('selections') or []
+ if len(self._selections):
+ self._validate_selections()
"""default value is the option with the heaviest weight"""
self.default(self._choose_heaviest())
- def options(self):
- return self._options
+ def selections(self):
+ return self._selections
- def _validate_options(self):
+ def _validate_selections(self):
try:
- int(self._options[0]['weight'])
- self._options[0]['value']
+ int(self._selections[0]['weight'])
+ self._selections[0]['value']
except Exception:
raise ValueError('Unable to validate %s\n:' % self.name)
@@ -72,13 +72,13 @@ class Param(object):
heaviest_idx = 0
heaviest_weight = 0
idx = 0
- if (len(self.options())):
- for elem in self.options():
+ if (len(self.selections())):
+ for elem in self.selections():
if elem["weight"] > heaviest_weight:
heaviest_weight = elem["weight"]
heaviest_idx = idx
idx += 1
- return self.options()[heaviest_idx]["value"]
+ return self.selections()[heaviest_idx]["value"]
else:
self.randomize()
diff --git a/ricky/param/option.py b/ricky/param/selection.py
index 89bd5db..93a8388 100644
--- a/ricky/param/option.py
+++ b/ricky/param/selection.py
@@ -1,6 +1,6 @@
-class Option(dict):
+class Selection(dict):
def __init__(self, **kwargs):
- super(Option, self).__init__(**kwargs)
+ super(Selection, self).__init__(**kwargs)
self.value = kwargs["value"]
self.weight = kwargs["weight"]
def __getattr__(self, attr):
diff --git a/ricky/param/options.py b/ricky/param/selections.py
index 2a21cce..303c92e 100644
--- a/ricky/param/options.py
+++ b/ricky/param/selections.py
@@ -1,6 +1,6 @@
-from ricky.param.option import Option
+from ricky.param.option import Selection
import sys
-class Options:
+class Selections:
def __init__(self, *args):
self._values = args
def __iter__(self):
@@ -17,5 +17,5 @@ class Options:
return i
@classmethod
def from_dict(cls, *args):
- options = map(lambda x: Option(**x), args);
- return cls(*options);
+ selections = map(lambda x: Selection(**x), args);
+ return cls(*selections);