Skip to content

Commit

Permalink
fix: Added _ to prevent exposing
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrover112 committed Sep 10, 2021
1 parent 94e39af commit f023d02
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
40 changes: 40 additions & 0 deletions final/_Flight.py
@@ -0,0 +1,40 @@
from __future__ import annotations
from datetime import datetime
import os

class Flight:
origin = None
destination = None
departure = None
arrival = None
price = None

def __init__(self,
origin: str = None,
destination: str = None,
departure: datetime.time = None,
arrival: datetime.time = None,
price: float = None):
self.origin = origin
self.destination = destination
self.departure = departure
self.arrival = arrival
self.price = price


def load_flights(flights_path) -> list[Flight]:
flights = []
for line in open(flights_path, 'r'):
split = line.split(",")
flights.append(Flight(
split[0],
split[1],
datetime.strptime(split[2], "%H:%M"),
datetime.strptime(split[3], "%H:%M"),
float(split[4])
))
return flights

if __name__ == '__main__':
pass
#print(load_flights(os.getcwd()+'/data/flights.txt'))
33 changes: 33 additions & 0 deletions final/_testbase.py
@@ -0,0 +1,33 @@
from abc import ABC, ABCMeta, abstractmethod
import random
import math


class FlightAlgorithm(metaclass=ABCMeta):
def __init__(self, domain, fitness_function, seed=random.randint(10, 100),
set_all_generators=False, init=[]):
self.domain = domain
self.fitness_function = fitness_function
self.seed = seed
self.init = init
self.init_seed(set_all_generators)

self.start_time = 0.0 # Loop starting time

def init_seed(self, set_all_generators=False):
self.r_init = random.Random(self.seed)

if set_all_generators:
random.seed(self.seed)

@abstractmethod
def get_base(self) -> str:
pass

@abstractmethod
def get_name(self) -> str:
pass

@abstractmethod
def run(self, **kwargs) -> tuple:
pass

0 comments on commit f023d02

Please sign in to comment.