def _on_run(self): start = time.time() xml = StringIO.StringIO() xml.write("<xml>") for (var_obj, name) in self.var_objs: current_time = time.time() if current_time - start > ASYNC_EVAL_TIMEOUT_SEC or self.cancel_event.is_set(): break xml.write(pydevd_xml.var_to_xml(var_obj, name, evaluate_full_value=True)) xml.write("</xml>") self.send_result(xml) xml.close()
def log_date_time_string(self): """Return the current time formatted for logging.""" now = time.time() year, month, day, hh, mm, ss, x, y, z = time.localtime(now) s = "%02d/%3s/%04d %02d:%02d:%02d" % (day, self.monthname[month], year, hh, mm, ss) return s
def log_date_time_string(self): """Return the current time formatted for logging.""" now = time.time() year, month, day, hh, mm, ss, x, y, z = time.localtime(now) s = "%02d/%3s/%04d %02d:%02d:%02d" % ( day, self.monthname[month], year, hh, mm, ss) return s
def date_time_string(self, timestamp=None): """Return the current date and time formatted for a message header.""" if timestamp is None: timestamp = time.time() year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( self.weekdayname[wd], day, self.monthname[month], year, hh, mm, ss) return s
def __init__(self, seq, thread_id, py_db, set_additional_thread_info, timeout=.5): InternalThreadCommand.__init__(self, thread_id) self._py_db = weakref.ref(py_db) self._timeout = time.time() + timeout self.seq = seq self._cmd = None # Note: receives set_additional_thread_info to avoid a circular import # in this module. self._set_additional_thread_info = set_additional_thread_info
def can_be_executed_by(self, _thread_id): timed_out = time.time() >= self._timeout py_db = self._py_db() t = pydevd_find_thread_by_id(self.thread_id) frame = None if t and not getattr(t, 'pydev_do_not_trace', None): additional_info = self._set_additional_thread_info(t) frame = additional_info.get_topmost_frame(t) try: self._cmd = py_db.cmd_factory.make_get_thread_stack_message( py_db, self.seq, self.thread_id, frame, must_be_suspended=not timed_out) finally: frame = None t = None return self._cmd is not None or timed_out