Beispiel #1
0
 def test_parse_sec(self):
     td = parse_time_delta('10-seconds')
     assert_equal(timedelta(seconds=10), td)
Beispiel #2
0
 def test_parse_hour(self):
     td = parse_time_delta('2-hours')
     assert_equal(timedelta(hours=2), td)
Beispiel #3
0
 def test_parse_day(self):
     td = parse_time_delta('1-days')
     assert_equal(timedelta(days=1), td)
Beispiel #4
0
    distance_weights = {}
    if args.weight_for_topics > 0:
        distance_weights['topics'] = args.weight_for_topics
    if args.weight_for_bow > 0:
        distance_weights['bow'] = args.weight_for_bow
    if args.weight_for_hashtag_bow > 0:
        distance_weights['hashtag_bow'] = args.weight_for_hashtag_bow

    if args.event_param_pickle_path:
        params = pickle.load(open(args.event_param_pickle_path))[0]  # take the first one
        timespan = params['preprune_secs']
        U = params['U']
        roots = params['roots']
        raise Exception("things change")
    else:
        max_time_distance = parse_time_delta(args.max_time_distance)
        max_time_span = parse_time_delta(args.max_time_span)
        # `seconds` of higher priority
        # if args.seconds:
        #     logger.info('using `seconds` as timespan unit')
        #     timespan = args.seconds
        # elif args.hours:
        #     logger.info('using `hours` as timespan unit')
        #     timespan = timedelta(hours=args.hours)
        # elif args.days:
        #     logger.info('using `days` as timespan unit')
        #     timespan = timedelta(days=args.days)
        # elif args.years:
        #     logger.info('using `years` as timespan unit')
        #     timespan = timedelta(days=args.years*365)
        # else:
Beispiel #5
0
 def test_parse_min(self):
     td = parse_time_delta('2-minutes')
     assert_equal(timedelta(minutes=2), td)
 def test_parse_sec(self):
     td = parse_time_delta('10-seconds')
     assert_equal(timedelta(seconds=10), td)
 def test_parse_day(self):
     td = parse_time_delta('1-days')
     assert_equal(timedelta(days=1), td)
 def test_parse_hour(self):
     td = parse_time_delta('2-hours')
     assert_equal(timedelta(hours=2), td)
 def test_parse_min(self):
     td = parse_time_delta('2-minutes')
     assert_equal(timedelta(minutes=2), td)
    if args.weight_for_topics > 0:
        distance_weights['topics'] = args.weight_for_topics
    if args.weight_for_bow > 0:
        distance_weights['bow'] = args.weight_for_bow
    if args.weight_for_hashtag_bow > 0:
        distance_weights['hashtag_bow'] = args.weight_for_hashtag_bow

    if args.event_param_pickle_path:
        params = pickle.load(open(
            args.event_param_pickle_path))[0]  # take the first one
        timespan = params['preprune_secs']
        U = params['U']
        roots = params['roots']
        raise Exception("things change")
    else:
        max_time_distance = parse_time_delta(args.max_time_distance)
        max_time_span = parse_time_delta(args.max_time_span)
        # `seconds` of higher priority
        # if args.seconds:
        #     logger.info('using `seconds` as timespan unit')
        #     timespan = args.seconds
        # elif args.hours:
        #     logger.info('using `hours` as timespan unit')
        #     timespan = timedelta(hours=args.hours)
        # elif args.days:
        #     logger.info('using `days` as timespan unit')
        #     timespan = timedelta(days=args.days)
        # elif args.years:
        #     logger.info('using `years` as timespan unit')
        #     timespan = timedelta(days=args.years*365)
        # else: