コード例 #1
0
ファイル: sgs.py プロジェクト: Artimi/ukko
 def get_schedule(self, activity_list):
     S = Schedule(self.problem)
     self.al_iter = activity_list.__iter__()
     for i in xrange(self.problem.num_activities):
         activity = self._select_activity()
         precedence_feasible_start = S.earliest_precedence_start(activity)
         real_start = self._compute_real_start(S, activity, precedence_feasible_start)
         S.add(activity, real_start, force=True)
     return S
コード例 #2
0
ファイル: manager.py プロジェクト: bombpersons/MYOT
class Manager(Object, threading.Thread):
	# INIT -------------------------------------------------------------
	def __init__(self):
		threading.Thread.__init__(self)
		Object.__init__(self)
		
		# OBJECTS
		self.scheduler = Schedule() # The schedule object
		self.series = [] # List of series
	
	# LOAD -------------------------------------------------------------
	# Loads schedule from a file (schedule_settings.py).
	def load(self):
		# Add blocks
		for block in schedule_settings.BLOCKS:
			# Calculate the day
			start_day = str(getDate(block[1].split()[0]))
			end_day = str(getDate(block[2].split()[0]))
			
			self.scheduler.add(start_day + " " + block[1].split()[1], end_day + " " + block[2].split()[1], "%j %H:%M", block[0])
		
		# Start the scheduler (if it isn't already)
		if not self.scheduler.running:
			self.scheduler.start()
	
	# NEXT -------------------------------------------------------------
	# Picks the next show (will still obey schedule times, even if
	# something is skipped)
	def next(self):
		pass
		
	# BACK -------------------------------------------------------------
	# Picks the previous show played.
	def back(self):
		pass
		
	# THREADING --------------------------------------------------------
	def run(self):
		while self.scheduler.running:
			time.sleep(settings.MANAGER_SLEEP)
コード例 #3
0
from weekday import Weekday
from station import Station
from schedule import Schedule

# 测试代码
if __name__ == "__main__":
    sun_schedule = Schedule()
    sun_schedule.add('2019-06-23 16:00', '2019-06-23 17:00', '大国风云')
    sun_schedule.add('2019-06-23 17:05', '2019-06-23 17:50', '新闻30分')
    station = Station("CCTV1")
    station.add(Weekday.Sun, sun_schedule)
    print('Test is done.')
コード例 #4
0
        print(teacher.name)
        print("   Courses---")
        for course in teacher.courses:
            print(course)
        print("   Room Preferences---")
        for preference in teacher.room_preferences:
            print(preference)

    print('')

    schedule = Schedule()

    for room in rooms:
        print("Debating room:", room)
        room_path = out_path.child('{}.{}.{}-{}'.format(
            room.day, room.name, room.start_time, room.end_time))
        course, agent = debateRoom(room, teachers, room_path)
        print("Winning course:", course)
        if course:
            schedule.add(room, course, agent)

    print('========')
    tex = schedule.as_tex_multi_table()
    with open('/tmp/schedule.tex', 'w') as f:
        f.write(tex)
    print(tex)
    print(schedule.as_plain())

    print('========')
    print_not_scheduled(teachers)