Debug a thing experiment given a logFile
969876
def debugExperiment(logFile):
  

  exp = rerunExperimentFromLogfile(logFile)
  exp.logCalls = False

  L2Representations = exp.objectL2Representations
  print "Learned object representations:"
  pprint.pprint(L2Representations, width=400)
  print "=========================="

  print "\nRun inference with a point on the capsule"
  sensationList = [
    {0: getObjectPair("Capsule", 0)},
  ]
  exp.infer(sensationList, reset= False)
  print "Output for capsule:", exp.getL2Representations()
  print "Intersection with sphere:", len(
    exp.getL2Representations()[0] & L2Representations["Sphere"][0])
  print "Intersection with capsule:", len(
    exp.getL2Representations()[0] & L2Representations["Capsule"][0])
  print "Intersection with cube:", len(
    exp.getL2Representations()[0] & L2Representations["Cube"][0])
  exp.sendReset()

  print "\nRun inference with a point on the sphere"
  sensationList = [
    {0: getObjectPair("Sphere", 0)},
  ]
  exp.infer(sensationList, reset= False)
  print "Output for sphere:", exp.getL2Representations()
  print "Intersection with sphere:", len(
    exp.getL2Representations()[0] & L2Representations["Sphere"][0])
  print "Intersection with Capsule:", len(
    exp.getL2Representations()[0] & L2Representations["Capsule"][0])
  print "Intersection with cube:", len(
    exp.getL2Representations()[0] & L2Representations["Cube"][0])
  exp.sendReset()

  print "\nRun inference with two points on the sphere"
  sensationList = [
    {0: getObjectPair("Sphere", 0)},
    {0: getObjectPair("Sphere", 2)},
  ]
  exp.infer(sensationList, reset= False)
  print "Output for sphere:", exp.getL2Representations()
  print "Intersection with sphere:", len(
    exp.getL2Representations()[0] & L2Representations["Sphere"][0])
  print "Intersection with Capsule:", len(
    exp.getL2Representations()[0] & L2Representations["Capsule"][0])
  print "Intersection with cube:", len(
    exp.getL2Representations()[0] & L2Representations["Cube"][0])
  exp.sendReset()


  print "\nRun inference with a point on the cube"
  sensationList = [
    {0: getObjectPair("Cube", 2)},
  ]
  exp.infer(sensationList, reset= False)
  print "Output for cube:", exp.getL2Representations()
  print "Intersection with sphere:", len(
    exp.getL2Representations()[0] & L2Representations["Sphere"][0])
  print "Intersection with Capsule:", len(
    exp.getL2Representations()[0] & L2Representations["Capsule"][0])
  print "Intersection with cube:", len(
    exp.getL2Representations()[0] & L2Representations["Cube"][0])
  exp.sendReset()
706417
def debug(self, msg, indent=0, **kwargs):
        """"""
        return self.logger.debug(self._indent(msg, indent), **kwargs)
212433
def debug(self, *args):
        """"""
        if _canShortcutLogging(self.logCategory, DEBUG):
            return
        debugObject(self.logObjectName(), self.logCategory,
            *self.logFunction(*args))
95389
public final static void debug(Logger log, String msg, IoBuffer buf) {
        if (log.isDebugEnabled()) {
            log.debug(msg);
            log.debug("Size: {}", buf.remaining());
            log.debug("Data:\n{}", HexDump.formatHexDump(buf.getHexDump()));
            log.debug("\n{}\n", toString(buf));
        }
    }
449386
def debug(ftn, txt):
    """"""
    if debug_p:
        sys.stdout.write("{0}.{1}:{2}\n".format(modname, ftn, txt))
        sys.stdout.flush()
1007065
public static void debug(Log log, String format, Object... arguments) {
		if (false == log(log, Level.DEBUG, null, format, arguments)) {
			log.debug(format, arguments);
		}
	}
46681
def debug(self,onOff,level='DEBUG'):
		'''
		
		'''
		if onOff:
			if level == 'DEBUG':
				self.log.setLevel(logging.DEBUG)
				self._ch.setLevel(logging.DEBUG)
				self.log.debug("Debugging level DEBUG enabled")
			elif level == "INFO":
				self.log.setLevel(logging.INFO)
				self._ch.setLevel(logging.INFO)
				self.log.info("Debugging level INFO enabled")
			elif level == "WARN":
				self.log.setLevel(logging.WARN)
				self._ch.setLevel(logging.WARN)
				self.log.warn("Debugging level WARN enabled")
			elif level == "ERROR":
				self.log.setLevel(logging.ERROR)
				self._ch.setLevel(logging.ERROR)
				self.log.error("Debugging level ERROR enabled")
		else:
			self.log.setLevel(logging.ERROR)
			self._ch.setLevel(logging.ERROR)
			self.log.error("Unrecognized debug level `%s`, set to default level `ERROR` instead",level)
213761
public static void debug(String msg, Object... args) {
		String tag = generateTag();
		if (!"".equals(tag)) {
			if (args.length > 0) {
				Log.d(tag, String.format(msg, args));
			} else {
				Log.d(tag, msg);

			}
		}
	}
324680
def upload_debug(self):
        """"""
        if os.path.exists(self.log_fname):
            api = InternalApi()
            api.set_current_run_id(self.id)
            pusher = FilePusher(api)
            pusher.update_file("wandb-debug.log", self.log_fname)
            pusher.file_changed("wandb-debug.log", self.log_fname)
            pusher.finish()
627300
def debug(dbg=True):
    """"""
    global _debug_handler
    if dbg and _debug_handler is None:
        _debug_handler = logging.StreamHandler()
        logger.addHandler(_debug_handler)
        logger.setLevel(logging.DEBUG)
    elif not dbg and _debug_handler is not None:
        logger.removeHandler(_debug_handler)
        _debug_handler = None
        logger.setLevel(logging.WARNING)
140651
def log_debug(func, *args, **kwargs):
    '''  '''
    logging.debug('Starting "%s" in thread %s...', func.__name__, current_thread())
    results = func(*args, **kwargs)
    logging.debug('Successfully finished "%s" in thread %s.', func.__name__, current_thread())
    return results
506871
def logdebug(logger, msg, *args, **kwargs):
    '''
    
    '''
    if esgfpid.defaults.LOG_DEBUG_TO_INFO:
        logger.info('DEBUG %s ' % msg, *args, **kwargs)
    else:
        logger.debug(msg, *args, **kwargs)
759849
def _pydevd_log(level, msg, *args):
    '''
    
    '''
    if level <= DebugInfoHolder.DEBUG_TRACE_LEVEL:
        # yes, we can have errors printing if the console of the program has been finished (and we're still trying to print something)
        try:
            try:
                if args:
                    msg = msg % args
            except:
                msg = '%s - %s' % (msg, args)
            DebugInfoHolder.DEBUG_STREAM.write('%s\n' % (msg,))
            DebugInfoHolder.DEBUG_STREAM.flush()
        except:
            pass
        return True
387023
def start_logging(log_file='', log_level='INFO', verbose=False):
    
    if not log_file:
        # create log directory if it doesn't exist
        log_dir = os.path.abspath('log') + '/'
        if not os.path.isdir(log_dir):
            os.mkdir(log_dir)

        # path to new log file
        log_file = log_dir + 'log.run.' + str(datetime.datetime.now()).replace(':', '.') + '.txt'

    # logger options
    lvl = logging.DEBUG if log_level.upper() == 'DEBUG' else logging.INFO

    # ignore warnings if not in debug
    if log_level.upper() != 'DEBUG':
        warnings.filterwarnings('ignore')

    # define logging format
    if verbose:
        myformat = '%(asctime)s - %(name)s - %(levelname)s \n>>>  %(message)s'
    else:
        myformat = '%(message)s'

    # create logger
    if not log_file == 'stdout':
        # normal logging to a regular file
        logging.basicConfig(level=lvl,
                            format=myformat,
                            filename=log_file,
                            filemode='w')
    else:
        # logging to stdout
        root = logging.getLogger()
        root.setLevel(lvl)
        stdout_stream = logging.StreamHandler(sys.stdout)
        stdout_stream.setLevel(lvl)
        formatter = logging.Formatter(myformat)
        stdout_stream.setFormatter(formatter)
        root.addHandler(stdout_stream)
        root.propagate = True
219206
def debug_object(obj, log_level: int = logging.DEBUG) -> None:
    
    msgs = ["For {o!r}:".format(o=obj)]
    for attrname in dir(obj):
        attribute = getattr(obj, attrname)
        msgs.append("- {an!r}: {at!r}, of type {t!r}".format(
            an=attrname, at=attribute, t=type(attribute)))
    log.log(log_level, "{}", "\n".join(msgs))
975390
def debug(self, message, *args, **kwargs):
        
        self._log(logging.DEBUG, message, *args, **kwargs)
87727
def debug_flag():
    """"""
    logging.basicConfig(format=consts.LOGGING_FORMAT)

    parser = argparse.ArgumentParser(description=debug_flag.__doc__)
    add_debug(parser)
    args, _extra_args = parser.parse_known_args()

    package, *_ = __package__.split('.')
    logging.getLogger(package).setLevel(args.debug)