Beispiel #1
0
    def __init__(self, size):
        self.size = size
        self._observers = set()

        for index in range(size):
            f = firefly.Firefly(index, 10 * index)
            self.fireflies.append(f)
            self.whosFlashing.append(False)
            self._observers.add(f)
            f._subject = self
Beispiel #2
0
 def __init__(self, member_count):
     for i in range(member_count):
         temp_firefly = firefly.Firefly()
         self.population.append(temp_firefly)
     self.leader = self.identify_leader()
    #
    "no_connection":
    "No connection to your firefly server, sorry. Check your server and api key and try again.",
    "request_for_server":
    "Please, tell me your firefly server url (for example `http://152.12.51.224` or `http://myfirefly.com`)",
    "request_for_server_failed_validation": "Doesn't look like server url",
    "request_for_oauth_key":
    "Please, tell me firefly access token (for example `eyJ0eXAiOiJKV1QiLCJZboci9iJSUzI1NiIsImp0aSI6ImY1YWY0Yzc2ZTBkNDliNjA2ZTAwZjcyYTc0YjQ4YzM4MTc1Y2JjNWI4MjU1MWU3NDMwNTM5MWJkNGRiYmU0NDk2ODE1MGRmYThhYjg0NzM2In0`)",
    "mutual_error": "Sorry. Something went wrong. Try again!",
    #
    "rules_introduction":
    "You can send me spent money at any time (for example `123 tea`). Once a day I will ask you, how much money do you have in your pocket.",
    #
    "money_in_pocket_update_transaction": "updating amount of money"
}
firefly = firefly.Firefly()

#########################################################################################
# Basic classes
#


class ScheduledTeleBot(telebot.TeleBot):
    def __non_threaded_polling(self,
                               schedule,
                               none_stop=False,
                               interval=0,
                               timeout=3):
        logger.info('Started polling.')
        self._TeleBot__stop_polling.clear()
        error_interval = .25
Beispiel #4
0
        print 'usage: %s profile_name port' % sys.argv[0]
        sys.exit(1)

    # grab the command line args
    profile_name = sys.argv[1]
    profile_port = int(sys.argv[2])

    # turn on headless environment
    #vd = Display(visible=0, size=(640,480))
    #vd.start()

    # open a browsing window
    firefox_startup.startup_firefox(sys.argv[1])

    # getting all the classes we need
    firefly = firefly.Firefly(profile_port)

    ##############################################
    ##                                          ##
    ## Sample crawl (add desired functionality) ##
    ##                                          ##
    ##############################################    

    urls = ['www.google.com',
            'www.nytimes.com',
            'www.yahoo.com']

    errors = 0
    for url in urls:
        # collection receiving consecutive errors
        if errors > 2: