示例#1
0
 def convert(self, string):
     string = location.Location.resolve_alias(string,
                                              constants.location_aliases)
     if string == constants.country:
         return location.Location(string, 'stato')
     elif string in constants.regions:
         return location.Location(string, 'regione')
     elif string in constants.provinces:
         return location.Location(string, 'provincia')
     else:
         raise Parser.ConversionError(string)
示例#2
0
 def __init__(self, area_in_square_meters = 0, price_in_USD = 0, location = location.Location(),\
     district = "Shwadchack", balcony_count = 0, area_of_land_in_squareMeters = 0, entrance_door_count = 0, other_buildings_in_area = False):
     super().__init__(area_in_square_meters, price_in_USD, location, district, balcony_count)
     self.area_of_land_in_squareMeters = area_of_land_in_squareMeters
     self.entrance_door_count = entrance_door_count
     self.other_buildings_in_area = other_buildings_in_area
     
示例#3
0
    def get(self, *args, **kwargs):
        """
        Retrieve information about a city.
        :param args:
        :param kwargs:
        :return:
        """

        # retrieve city name from URL
        url_components = [x for x in self.request.path.split("/") if x]
        city_name = url_components[-1]

        # create a location object for the specified city
        try:
            city = location.Location(city_name)
            response = {
                'city_name': city.name,
                'current_temperature': city.temp,
                'current_weather_description': city.weather_desc,
                'population': city.population,
                'bars': city.num_bars,
                'public_transport': city.public_transport,
                'city_score': city.score
            }
            self.set_status(HTTPStatus.OK)
            self.write(json.dumps(response))
        except (csv.Error, tornado.httpclient.HTTPError, socket.gaierror,
                TypeError, IndexError, KeyError, ValueError):
            response = {
                'error': 'Unable to retrieve details for your specified city.'
            }
            self.set_status(HTTPStatus.INTERNAL_SERVER_ERROR)
            self.write(json.dumps(response))
示例#4
0
def getTheSilentForest():
    def enter():
        output.proclaim(
            "The Silent Forest: Great oaks sway endlessly to the southerly winds. The air's oppression is lifted but briefly at the occasional rustle. Trees obscure the view to Trainee Valley."
        )

    def exit():
        output.proclaim("You have left the Silent Forest.")

    monsters = fList.FrequencyList([[ProwlingFox(), 0.4], [Owl(), 0.35],
                                    [SorcererOutcast(), 0.2],
                                    [SkeletonScout(), 0.04],
                                    [DoomPanda(), 0.01]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    theSilentForestActions = [
        actions.RestHeal(player),
        actions.Scavenge(
            player,
            [
                [actions.ScavengeGold(player, 0, 4), 0.99],
                # health, armor, strength, spirit, criticalChance, criticalStrike, dodge
                [shrine.StatShrine([20, 10, 10, 10, 0.1, 1, 0.2], 50), 0.01]
            ])
    ]
    theSilentForestInteractions = [[actions.Nothing(), 0.8],
                                   [fight.Fight(getMonster), 0.2]]
    return location.Location("The Silent Forest", enter, exit,
                             theSilentForestActions,
                             theSilentForestInteractions)
示例#5
0
 def __init__ (self, area_in_square_meters = 0, price_in_USD = 0, location = location.Location(),\
     district = "Shwadchack", balcony_count = 0):
     self.area_in_square_meters = area_in_square_meters
     self.price_in_USD = price_in_USD
     self.location = location
     self.district = district
     self.balcony_count = balcony_count
示例#6
0
    def add_location(self, path):
        r = location.Location(path)

        if path == self.base:
            #r.inventory.append(inventory.FuryArmor(location = r))
            r.inventory.append(inventory.ChainArmor(location=r))
            r.inventory.append(inventory.LongSword(location=r))
            #r.inventory.append(inventory.GreatAxe(location = r))
            # r.inventory.append(inventory.BeltOfGiants(location = r))
            r.inventory.append(inventory.HelmOfContinency(location=r))
            r.inventory.append(inventory.JacksonHelm(location=r))
            r.inventory.append(inventory.JacksonBelt(location=r))
            r.inventory.append(inventory.JacksonBoots(location=r))
            r.dream_stone = True
            r.dimensional_warp = True
        else:  #here everything should be folder dependent: monsters are file, depending on the type you get different monsters, maybe objects as well. size of files give monsters strength. should make more allies and passive monsters.
            r.dream_stone = random.randint(0, 1)
            r.dimensional_warp = random.randint(0, 1)
            for i in xrange(random.randint(0, 2)):
                v = self.quick_villain()
                v.location = r
                v.master_location_path = v.location.path
                v.world = self
                r.characters.append(v)

        self.locations.append(r)
def generate_points_gauss(num_points, k):
    print(
        f"Randomly generating {k} gaussian clusters with {num_points} total points:"
    )

    group_num = float(num_points) / k
    locations = []
    for i in range(k):
        c = (random.uniform(-90, 90), random.uniform(-180, 180))
        s = random.uniform(3.0, 18.0)
        x = []
        print(f"Randomly Generated Center {i}: [{c[0]}, {c[1]}]")

        while len(x) < group_num:
            a, b = np.array(
                [np.random.normal(c[0], s),
                 np.random.normal(c[1], s)])
            if b < -180:
                b += 360
            elif b > 180:
                b -= 360

            row = {
                "Name": f"TestPoint [{i}]",
                "Latitude": a,
                "Longitude": b,
                "Attribute1": random.random() > 0.999,
                "Attribute2": random.random() > 0.999
            }
            x.append(location.Location(row))
        locations.extend(x)

    return locations
示例#8
0
    def load_pages(self):
        # misc.set_cursor(Gdk.CursorType.WATCH)
        self.pages["location"] = location.Location(self.params)
        self.pages["check"] = check.Check(self.params)
        self.pages["keymap"] = keymap.Keymap(self.params)
        self.pages["timezone"] = timezone.Timezone(self.params)
        self.pages["installation_ask"] = installation_ask.InstallationAsk(self.params)
        self.pages["installation_automatic"] = installation_automatic.InstallationAutomatic(self.params)

        if self.settings.get("enable_alongside"):
            self.pages["installation_alongside"] = installation_alongside.InstallationAlongside(self.params)
        else:
            self.pages["installation_alongside"] = None

        self.pages["installation_advanced"] = installation_advanced.InstallationAdvanced(self.params)
        self.pages["user_info"] = user_info.UserInfo(self.params)
        self.pages["slides"] = slides.Slides(self.params)
        # misc.set_cursor(Gdk.CursorType.ARROW)

        diff = 2

        num_pages = len(self.pages) - diff

        if num_pages > 0:
            self.progressbar_step = 1.0 / num_pages
示例#9
0
def read_location_csv(filename, header):
    """
    Converts every row in the file into a location object and appends all objects
    to the _locations list.

    :param filename: str, the name of the csv with all the necessary stops. File 
        columns need to be in the following order: 
        location_name, address (doesn't need to be populated), latitude, longitude.
    :param header: boolean, True if the file has a header. Columns still need to
        be in the above prescribed order.

    :return: list, a list of every location object that was created, including 
        origin if add_origin() was run.
    """
    with open(filename, newline='') as csvfile:
        if header == True:
            next(csvfile)

        file_reader = csv.reader(csvfile, delimiter=',', quotechar='"')
        for row in file_reader:
            name = row[0]
            lat = row[2]
            lon = row[3]
            place = location.Location(name, lat, lon)
            _locations.append(place)

    return _locations
示例#10
0
def getFortMorning():
    def enter():
        output.proclaim(
            "Fort Morning: Rough cobblestones pattern the streets of Fort Morning. The din of the market carries loudly to the Southern gate, whose wall protrudes ten feet from the earth below. Merchants frequent the fort, but the eastern wizards rarely visit."
        )

    def exit():
        output.proclaim("You have left the Fort Morning.")

    monsters = fList.FrequencyList([[GiantSewerRat(), 0.8],
                                    [UnholyOoze(), 0.2]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    fortMorningActions = [
        actions.RestHeal(player),
        actions.Scavenge(player, [[actions.ScavengeGold(player, 0, 3), 1]]),
        actions.Talk(player, [captainJorna]),
        actions.Shop(player, [morningWares, villageArmory])
    ]
    fortMorningInteractions = [[actions.Nothing(), 0.93],
                               [fight.Fight(getMonster), 0.07]]
    return location.Location("Fort Morning", enter, exit, fortMorningActions,
                             fortMorningInteractions)
示例#11
0
def getTraineeValley():
    def enter():
        output.proclaim(
            "Trainee Valley: Sparse trees occupy rolling expanses of lush grass. Fort Morning is barely visible in the distant north, while the Silent Forest looms to the east."
        )

    def exit():
        output.proclaim("You have left Trainee Valley.")

    monsters = fList.FrequencyList([[Wolf(), 0.8], [DrunkenTrainee(), 0.2],
                                    [GraglisTheGremlin(), 0.008]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    traineeValleyActions = [
        actions.RestHeal(player),
        actions.Scavenge(
            player,
            [
                [actions.ScavengeGold(player, 0, 2), 0.98],
                # health, armor, strength, spirit, criticalChance, criticalStrike, dodge
                [shrine.StatShrine([20, 10, 10, 10, 0.1, 1, 0.2], 50), 0.02]
            ]),
        actions.Talk(player, [oldHermit])
    ]
    traineeValleyInteractions = [[actions.Nothing(), 0.8],
                                 [fight.Fight(getMonster), 0.2]]
    return location.Location("Trainee Valley", enter, exit,
                             traineeValleyActions, traineeValleyInteractions)
示例#12
0
def walk(currentLocation, facing, numberOfBlocks, locationSet, repeatFound):
    locationToReturn = location.Location(currentLocation.getx(),
                                         currentLocation.gety())

    if (facing == Facing.NORTH):
        locationToReturn.moveYAxis(numberOfBlocks)
    elif (facing == Facing.SOUTH):
        locationToReturn.moveYAxis(numberOfBlocks * -1)
    elif (facing == Facing.WEST):
        locationToReturn.moveXAxis(numberOfBlocks * -1)
    elif (facing == Facing.EAST):
        locationToReturn.moveXAxis(numberOfBlocks)
    else:
        raise ValueError('Incorrect Facing seen.')
    locationsVisited = location.Location.getAllMidpoints(
        currentLocation, locationToReturn)
    for locationVisited in locationsVisited:
        if not locationVisited in locationSet:
            locationSet.add(locationVisited)
        elif (locationVisited in locationSet
              and repeatFound.getrepeatFound() == False):
            repeatFound.setrepeatFound(True)
            print "First Repeat Distance from Origin: %i" % distanceFromOrigin(
                locationVisited)
    #print "locationSet"
    #for l in locationSet:
    #    print l.display()
    return locationToReturn
 def test_creation(self):
     raised = False
     try:
         loc = location.Location(0, 0)
     except:
         raised = True
     self.assertFalse(raised, 'Exception raised')
 def __init__(self):
     self.url = ""
     self.location = location.Location()
     self.units = {}
     self.forecasts = []
     self.numfcasts = 0
     self.jsondata = {}
示例#15
0
def set_student(job):
    """
    This function sets a job to the preset values of student occupation.

    * fixed shift of 08:00 - 15:00
    * Monday through Friday
    * wage of $0
    * 30 minute commute to school
    * 60 minute commute from school
    
    :param occupation.Occupation job: the job to set
     
    :return: None 
    """

    # the number of minutes in 1 day, the number of minutes in 1 hour
    DAY_2_MIN, HOUR_2_MIN = temporal.DAY_2_MIN, temporal.HOUR_2_MIN

    # job identifier
    job.id = STUDENT

    # set the occupation type to a fixed shift
    job.category = FIXED_SHIFT

    job.t_start = START_MEAN_SCHOOl
    job.t_end = END_MEAN_SCHOOL

    # occupation duration 8:00 hours
    job.dt = (job.t_end - job.t_start) % DAY_2_MIN

    # set the end time
    job.set_t_end()

    # set the flag indicating that the job starts and ends on the same day
    job.set_is_same_day()

    # set the work days
    job.work_days = (temporal.MONDAY, temporal.TUESDAY, temporal.WEDNESDAY,
                     temporal.THURSDAY, temporal.FRIDAY)

    # set the wage in U.S. dollars
    job.wage = 0.0

    # set the is_employed flag
    job.is_employed = True

    # set the job location
    job.location = location.Location(location.NORTH, location.OFF_SITE)

    # set the commute
    job.commute_to_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN
    job.commute_from_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN

    job.commute_to_work_dt = job.commute_to_work_dt_mean
    job.commute_from_work_dt = job.commute_from_work_dt_mean

    job.set_commute_distribution()
    job.set_work_distribution()

    return
示例#16
0
def set_standard_job(job):
    """
    This function sets the Occupation to the standard job.

    * fixed shift of 9:00 - 17:00
    * Monday through Friday 
    * wage $40,000 
    * 30 minute commute to work
    * 60 minute commute from work

    :param occupation.Occupation job: the job of which to set the attributes

    :return: None
    """

    DAY_2_MIN, HOUR_2_MIN = temporal.DAY_2_MIN, temporal.HOUR_2_MIN

    # identifier
    job.id = STANDARD_JOB

    # set the occupation type to a fixed shift
    job.category = FIXED_SHIFT

    # start at 9:00
    job.t_start = 9 * HOUR_2_MIN
    job.t_end = 17 * HOUR_2_MIN

    # occupation duration 8:00 hours
    job.dt = (job.t_end - job.t_start) % DAY_2_MIN

    # set the end time
    job.set_t_end()

    # set the flag indicating that the job starts and ends on the same day
    job.set_is_same_day()

    # set the work days
    job.work_days = (temporal.MONDAY, temporal.TUESDAY, temporal.WEDNESDAY,
                     temporal.THURSDAY, temporal.FRIDAY)

    # set the wage in U.S. dollars
    job.wage = 40000.0

    # set the is_employed flag
    job.is_employed = True

    # set the job location
    job.location = location.Location(location.NORTH, location.OFF_SITE)

    # set the commute
    job.commute_to_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN
    job.commute_from_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN

    job.commute_to_work_dt = job.commute_to_work_dt_mean
    job.commute_from_work_dt = job.commute_from_work_dt_mean

    job.set_commute_distribution()
    job.set_work_distribution()

    return
示例#17
0
def getDampLair():
    monsters = fList.FrequencyList([[AricneaTheSly(), 1]])

    def enter():
        sequel = ""
        if monsters[0].canRespawn():  # if Aricnea is alive...
            sequel = "A faint light glows in distance. A huge skeleton turns to face you."
        else:  # if Aricnea is dead...
            sequel = "Aricnea's bones lie untouched, scattered across the floor."
        output.proclaim(
            "Damp Lair: Cave moss grows on the arched ceiling of the cavern. "
            + sequel)

    def exit():
        output.proclaim("You have left Damp Lair.")

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    skeletonCaveActions = [actions.RestHeal(player)]
    skeletonCaveInteractions = [
        [fight.Fight(getMonster), 1],
    ]
    return location.Location("Damp Lair", enter, exit, skeletonCaveActions,
                             skeletonCaveInteractions)
示例#18
0
    def _add_location(self, event=None):
        '''Make the user's input a Location and add to the list of locations

        '''
        # The details of the new location
        user_input = self.entry_box.get()
        new_location = location.Location(user_input)
        self.locations.append(new_location)
        precise = new_location.location

        # goompy loading a new tile as per the location
        self.goompy.lat = float(precise[:precise.find(",")])
        self.goompy.lon = float(precise[precise.find(",")+1:])
        self._reload()


        # Differnt actions depending on how many locations currently exist
        if len(self.locations) > self.VIEW_SIZE:

            # Configure the movement buttons is not configured
            if not self.showing_movement_buttons:
                self.up_button.grid(row=1, column=0, columnspan=2, sticky="w")
                self.down_button.grid(
                    row=self.VIEW_SIZE+10,
                    column=0,
                    columnspan=2,
                    sticky="w"
                    )
            # Ensures the latest location is displayed at the bottom
            while len(self.locations)-self.location_view > self.VIEW_SIZE:
                self._move_boxes(1)
        else:
            # Move the entry box, and its button, down on space
            self.entry_box.grid_configure(
                row=self.entry_box.grid_info()["row"]+1
                )
            self.entry_button.grid_configure(
                row=self.entry_box.grid_info()["row"]
                )
            
            # The row the the entry box moved from
            row = self.entry_box.grid_info()["row"]-1

            # Create a Label and a Button for the new location
            tk.Label(
                self.frame,
                text=user_input,
                bg="white",
                anchor="w"
                ).grid(row=row, column=0, sticky="ew", columnspan=4)
            tk.Button(
                self.frame,
                text="X",
                bg="red",
                command=lambda: self._remove_location(len(self.locations))
                ).grid(row=row, column=4, sticky="ew")

        # Reset the text in the entry box
        self.entry_box.delete(0, "end")
        self.entry_box.insert("end", "Add Location")
示例#19
0
 def location(cls):
     """Return 'location.Location' of a web page related to the test.
     """
     if cls._url:
         loc = location.Location(cls._url)
     else:
         loc = None
     return loc
示例#20
0
def add_distance(mLocation, distance, angle):
    y = distance * math.sin(angle)
    x = distance * math.cos(angle)
    new_latitude = mLocation.latitude + (y / EATRH_RADIUS) * (180 / math.pi)
    new_longitude = mLocation.longitude + (x / EATRH_RADIUS) * (
        180 / math.pi) / math.cos(mLocation.latitude * math.pi / 180)
    # print("Location: %f, %f" % (new_latitude, new_longitude))
    return location.Location(float(new_longitude), float(new_latitude))
示例#21
0
    def set_no_job(self):

        """
        Set the Occupation to having no job.

        :param occupation.Occupation job: the job of which to set the attributes

        :return: None
        """

        self.id = NO_JOB

        # set the job category
        self.category = NO_TIME

        self.commute_to_work_dt_mean = 0
        self.commute_to_work_dt_std = 0
        self.commute_to_work_dt = 0

        self.commute_from_work_dt_mean = 0
        self.commute_from_work_dt_std = 0
        self.commute_from_work_dt = 0

        self.set_commute_distribution()

        # the start time of the job [time of day, minutes]
        self.t_start_mean = 0
        self.t_start_std = 0
        self.t_start = 0

        self.t_end_mean = 0
        self.t_end_std = 0
        self.t_end = 0

        self.set_work_distribution()

        # for easy recall
        self.commute_to_work_start = 0

        # set job duration
        self.dt = 0

        # set the flag indicating whether or not the job starts and end on the same day
        self.is_same_day = True

        # set work days to none
        self.work_days = ()

        # set to no wage
        self.wage = 0.0

        # set employment flag
        self.is_employed = False

        # set the location to home
        self.location = location.Location(location.NORTH, location.HOME)

        return
示例#22
0
def set_grave_shift(job):
    """
    This function sets the Occupation to a grave shift.

    * shift job from  22:00 to 6:00 
    * Monday through Friday
    * 30 minute commute to work
    * 60 minute commute from work
    * wage of $40,0000.

    :param occupation.Occupation job: the job of which to set the attributes

    :return: None
    """

    HOUR_2_MIN = temporal.HOUR_2_MIN

    # identifier
    job.id = GRAVE_SHIFT

    # set the job category
    job.category = FIXED_SHIFT

    # set the start time to be 22:00
    job.t_start = 22 * HOUR_2_MIN

    # set the job duration
    job.dt = 8 * HOUR_2_MIN

    # set the end time
    job.set_t_end()

    # set the flag indicating whether or not the job starts and ends on the same day
    job.set_is_same_day()

    # set the work days
    job.work_days = (temporal.MONDAY, temporal.TUESDAY, temporal.WEDNESDAY,
                     temporal.THURSDAY, temporal.FRIDAY)

    # set the wage in U.S dollars
    job.wage = 40000.0

    # set the employment flag
    job.is_employed = True

    # set the location
    job.location = location.Location(location.NORTH, location.OFF_SITE)

    # set the commute
    job.commute_to_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN
    job.commute_from_work_dt_mean = COMMUTE_TO_WORK_DT_MEAN

    job.commute_to_work_dt = job.commute_to_work_dt_mean
    job.commute_from_work_dt = job.commute_from_work_dt_mean

    job.set_commute_distribution()
    job.set_work_distribution()
    return
示例#23
0
 def max_reachable_location(self, heading):
     ttfh = self.time_to_face_heading(heading)
     max_reachable_dist = self.get_reachable_distance(ttfh)
     rad_angle = math.pi/2.0 - math.radians(heading)
     l = self.get_location()
     retLoc = loc.Location(l.x + 5.0*max_reachable_dist*math.cos(rad_angle),
                           l.y + 5.0*max_reachable_dist*math.sin(rad_angle),
                           l.z)
     return retLoc
示例#24
0
 def get_az_el(self, utc_date, lat, lon, alt):
     s = sun.Sun()
     loc = location.Location(lat, lon, alt=alt)
     ra, decl = s.radec(utc_date)
     _el, _az = loc.equatorial_to_horizontal(utc_date, ra,decl)
     el, az = np.round([_el.to_degrees(), _az.to_degrees()], decimals=6)
     ret = []
     ret.append({'name': 'sun', 'r': 1e10, 'el':el, 'az':az, 'jy':10000.0})
     return ret
    def get(self, *args, **kwargs):
        """
        Retrieves information about multiple cities, rates them and returns a ranking and score for each city.
        :param args:
        :param kwargs:
        :return:
        """

        # retrieve URL "cities" param
        city_names = args[0].split(",")

        # check that more than one city has been specified
        if (len(city_names) == 1):
            response = {'error': 'At least two cities must be specified.'}
            self.set_status(HTTPStatus.INTERNAL_SERVER_ERROR)
            self.write(json.dumps(response))

        else:
            found_cities = []
            not_found = []

            # attempt to source data for each city
            for city_name in city_names:
                try:
                    city = location.Location(city_name)
                    found_cities.append({
                        'city_name': city.name,
                        'city_score': city.score
                    })
                except (csv.Error, tornado.httpclient.HTTPError,
                        socket.gaierror, TypeError, IndexError, KeyError,
                        ValueError):
                    not_found.append(city_name)

            # if all cities are found, compare them
            if len(found_cities) == len(city_names):
                response = self.compare(found_cities)
                self.set_status(HTTPStatus.OK)
                self.write(json.dumps(response))

            # if one or more cities have not been found, let the user know which ones
            elif len(found_cities) > 0:
                response = {
                    'error':
                    'Unable to retrieve details for the following cities: ' +
                    (' ,'.join(not_found))
                }
                self.set_status(HTTPStatus.INTERNAL_SERVER_ERROR)
                self.write(json.dumps(response))

            else:
                response = {
                    'error':
                    'Unable to retrieve details for any of the cities specified.'
                }
                self.set_status(HTTPStatus.INTERNAL_SERVER_ERROR)
                self.write(json.dumps(response))
示例#26
0
    def record_wall(self, loc, direction):
        "We bumped into a wall"

        # 1. If we don't have the current location, create it
        if loc not in self.area:
            self.area[loc] = location.Location(loc=loc)

        # 2. Record  the wall
        self.area[loc].set_dir(direction, location.IS_WALL)
示例#27
0
 def __init__(self, origin, path, json):
     """
     初始化Route和Location
     """
     self.route = route.Route(origin, path, json)
     self.name = path.split('/')[-1]
     self.destination_loc = self.route.next_loc()
     self.next_destination_loc = self.route.next_loc()
     self.location = location.Location()
示例#28
0
    def record_move(self, loc, direction, new_loc, oxygen):
        "We managed to move"

        # 1. If we don't have the current location, create it
        if loc not in self.area:
            self.area[loc] = location.Location(loc=loc)
        if new_loc not in self.area:
            self.area[new_loc] = location.Location(loc=new_loc)

        # 2. Move forward
        if oxygen:
            at_fwd = location.IS_OXYGEN
        else:
            at_fwd = location.IS_FWD
        self.area[loc].set_dir(direction, at_fwd)

        # 3. Record the reverse movement
        self.area[new_loc].set_back(direction)
示例#29
0
def read_csv(csv_path):
    locs = []

    with open(csv_path, newline='') as csv_file:
        csv_reader = csv.DictReader(csv_file)
        for row in csv_reader:
            locs.append(location.Location(row))

    return locs
示例#30
0
def add_origin():
    """
    Adds the origin as a location that needs to be included in the distance 
    matrix.
    """
    place = location.Location(_origin_name, _origin_lat, _origin_lon)
    place.origin = True
    _locations.append(place)

    return place