Example #1
0
    def on_button(self, button_id):
        # get the clicked button.
        try:
            level = self.levels[button_id]
        except KeyError:
            return

        # remove any other description box.
        self.kill_desc()

        # get a unique name to register to close the description box.
        unique = Unique()
        close_name = unique.generate(level.name)
        self.active_desc = close_name

        # should now create a co-menu with the description.
        child = self.parent.add_child(DescriptionBox, text=level.description,
                closename=close_name)
        child.resume()
Example #2
0
from field import field

from unique import Unique

from gen_random import gen_random

goods = [{
    'title': 'Ковер',
    'price': 2000,
    'color': 'green'
}, {
    'title': 'Диван для отдыха',
    'color': 'black'
}]

data = [
    1, 1, 11, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2
]

if __name__ == "__main__":
    print(list(gen_random(20, 1, 100)))
    print(list(field(goods, 'title')))
    print(list(Unique(data)))
Example #3
0
def f1(arg):
    return sorted(list(Unique(field(arg, 'job-name'), ignore_case=True)),
                  key=lambda x: str.casefold(x))
Example #4
0
def f1(arg):
    return Unique(field(data, "job-name"), ignore_case=True)
Example #5
0
def f1(arg):
    return sorted(Unique([x for x in field(arg, "job-name")], ignore_case=True))
Example #6
0
 def __init__(self, *args, **kwargs):
     super(Shareable, self).__init__(*args, **kwargs)
     if not self.hash:
         index = Unique.new(Shareable.__name__, config.SHARE_INDEX_GENERATOR, 10)
         self.hash = config.SHARE_HASH_GENERATOR(index)
Example #7
0
def f1(arg):
    return sorted(Unique([elem['job-name'] for elem in arg]))
Example #8
0
def f1(arg):
    return sorted(list(Unique(field(arg, 'job-name'), ignore_case=True)))
Example #9
0
def unique(forth):
    forth.stack.push(Unique())
Example #10
0
 def unique(self):
     _unique = Unique()
     _unique.set_working_directory(self._working_directory)
     return _unique