Creates poll in a group thread

        :param poll: Poll to create
        :param thread_id: User/Group ID to create poll in. See :ref:`intro_threads`
        :type poll: models.Poll
        :raises: FBchatException if request failed
434216
def createPoll(self, poll, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)

        # We're using ordered dicts, because the Facebook endpoint that parses the POST
        # parameters is badly implemented, and deals with ordering the options wrongly.
        # This also means we had to change `client._payload_default` to an ordered dict,
        # since that's being copied in between this point and the `requests` call
        #
        # If you can find a way to fix this for the endpoint, or if you find another
        # endpoint, please do suggest it ;)
        data = OrderedDict([("question_text", poll.title), ("target_id", thread_id)])

        for i, option in enumerate(poll.options):
            data["option_text_array[{}]".format(i)] = option.text
            data["option_is_selected_array[{}]".format(i)] = str(int(option.vote))

        j = self._post(self.req_url.CREATE_POLL, data, fix_request=True, as_json=True)
1249210
def createfork(self, project_id):
        

        request = requests.post(
            '{0}/fork/{1}'.format(self.projects_url, project_id),
            timeout=self.timeout, verify=self.verify_ssl)

        if request.status_code == 200:
            return True
        else:
            return False
250241
def add_thread t
    raise "duplicate" if @threads.values.member? t
    t.each { |m, *o| add_message m }
  end
272525
def __launchThreads(self, numThreads):
        
        i = 0
        while i < numThreads:
            self.__logger.debug("Launching thread number " +
                                str(i))
            i += 1
            newThr = Thread(target=self.__processUsers)
            newThr.setDaemon(True)
            self.__threads.add(newThr)
            newThr.start()
749129
def community_post_votes(self, post_id, **kwargs):
        ""
        api_path = "/api/v2/community/posts/{post_id}/votes.json"
        api_path = api_path.format(post_id=post_id)
        return self.call(api_path, **kwargs)
438221
def member_create(self, params, member_id):
        
        member_config = params.get('rsParams', {})
        server_id = params.pop('server_id', None)
        version = params.pop('version', self._version)
        proc_params = {'replSet': self.repl_id}
        proc_params.update(params.get('procParams', {}))
        if self.enable_ipv6:
            enable_ipv6_single(proc_params)
        # Make sure that auth isn't set the first time we start the servers.
        proc_params = self._strip_auth(proc_params)

        # Don't pass in auth_key the first time we start the servers.
        server_id = self._servers.create(
            name='mongod',
            procParams=proc_params,
            sslParams=self.sslParams,
            version=version,
            server_id=server_id
        )
        member_config.update({"_id": member_id,
                              "host": self._servers.hostname(server_id)})
        return member_config
256234
def create_single_poll_submission(self, poll_id, poll_session_id, poll_submissions_poll_choice_id):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - poll_id
        """ID"""
        path["poll_id"] = poll_id

        # REQUIRED - PATH - poll_session_id
        """ID"""
        path["poll_session_id"] = poll_session_id

        # REQUIRED - poll_submissions[poll_choice_id]
        """The chosen poll choice for this submission."""
        data["poll_submissions[poll_choice_id]"] = poll_submissions_poll_choice_id

        self.logger.debug("POST /api/v1/polls/{poll_id}/poll_sessions/{poll_session_id}/poll_submissions with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/polls/{poll_id}/poll_sessions/{poll_session_id}/poll_submissions".format(**path), data=data, params=params, no_data=True)
1188019
def add_threading(self, flag):
		
		threads = min(int(config.get_resource('threads')), self.max_concurrency)
		if threads > 1:
			self.args.append(flag)
			self.args.append(threads)
499402
def muteThreadMentions(self, mute=True, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)
        data = {"mentions_mute_mode": int(mute), "thread_fbid": thread_id}
        r = self._post(self.req_url.MUTE_MENTIONS, data, fix_request=True)
957949
def get_current_thread_id(thread):
    '''
    
    '''
    try:
        # Fast path without getting lock.
        tid = thread.__pydevd_id__
        if tid is None:
            # Fix for https://www.brainwy.com/tracker/PyDev/645
            # if __pydevd_id__ is None, recalculate it... also, use an heuristic
            # that gives us always the same id for the thread (using thread.ident or id(thread)).
            raise AttributeError()
    except AttributeError:
        tid = _get_or_compute_thread_id_with_lock(thread, is_current_thread=True)

    return tid
867471
def can_be_executed_by(self, thread_id):
        '''
        '''
        return self.thread_id == thread_id or self.thread_id.endswith('|' + thread_id)
1337858
def start_new_gui_thread():
    
    PyGUIThread = getattr(ROOT, 'PyGUIThread', None)

    if PyGUIThread is not None:
        assert not PyGUIThread.isAlive(), "GUI thread already running!"

    assert _processRootEvents, (
        "GUI thread wasn't started when rootwait was imported, "
        "so it can't be restarted")

    ROOT.keeppolling = 1
    ROOT.PyGUIThread = threading.Thread(
        None, _processRootEvents, None, (ROOT,))

    ROOT.PyGUIThread.finishSchedule = _finishSchedule
    ROOT.PyGUIThread.setDaemon(1)
    ROOT.PyGUIThread.start()
    log.debug("successfully started a new GUI thread")
946832
def muteThread(self, mute_time=-1, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)
        data = {"mute_settings": str(mute_time), "thread_fbid": thread_id}
        content = self._post(self.req_url.MUTE_THREAD, data, fix_request=True)
512756
def __add_created_thread(self, event):
        
        dwThreadId  = event.get_tid()
        hThread     = event.get_thread_handle()
##        if not self.has_thread(dwThreadId):   # XXX this would trigger a scan
        if not self._has_thread_id(dwThreadId):
            aThread = Thread(dwThreadId, hThread, self)
            teb_ptr = event.get_teb()   # remember the TEB pointer
            if teb_ptr:
                aThread._teb_ptr = teb_ptr
            self._add_thread(aThread)
1117485
protected void createNewThread(ChannelSelector sr, int threadType, int number) {
        StartPrivilegedThread privThread = new StartPrivilegedThread(sr, threadType, number, this.tGroup);
        AccessController.doPrivileged(privThread);
    }
224625
def deleteThreads(self, thread_ids):
        
        thread_ids = require_list(thread_ids)

        data_unpin = dict()
        data_delete = dict()
        for i, thread_id in enumerate(thread_ids):
            data_unpin["ids[{}]".format(thread_id)] = "false"
            data_delete["ids[{}]".format(i)] = thread_id
        r_unpin = self._post(self.req_url.PINNED_STATUS, data_unpin)
        r_delete = self._post(self.req_url.DELETE_THREAD, data_delete)
        return r_unpin.ok and r_delete.ok
136301
private static ThreadFactory newThreadFactory(final String id) {
    return new ThreadFactory() {
      private final AtomicInteger next = new AtomicInteger();

      @Override public Thread newThread(Runnable r) {
        final String name = "spectator-" + id + "-" + next.getAndIncrement();
        final Thread t = new Thread(r, name);
        t.setDaemon(true);
        return t;
      }
    };
  }