Exemplo n.º 1
0
    def search_wifi(self, query):
        results = self.result_list()

        now = util.utcnow()
        regions = defaultdict(int)
        wifis = query_macs(query, query.wifi, self.raven_client, WifiShard)
        for wifi in wifis:
            regions[wifi.region] += station_score(wifi, now)

        for code, score in regions.items():
            region = GEOCODER.region_for_code(code)
            if region:
                results.add(self.result_type(
                    region_code=code,
                    region_name=region.name,
                    accuracy=region.radius,
                    score=score))

        return results
Exemplo n.º 2
0
    def search_blue(self, query):
        results = self.result_list()

        now = util.utcnow()
        regions = defaultdict(int)
        blues = query_macs(query, query.blue, self.raven_client, BlueShard)
        for blue in blues:
            regions[blue.region] += blue.score(now)

        for code, score in regions.items():
            region = GEOCODER.region_for_code(code)
            if region:
                results.add(
                    self.result_type(region_code=code,
                                     region_name=region.name,
                                     accuracy=region.radius,
                                     score=score))

        return results
Exemplo n.º 3
0
    def search_wifi(self, query):
        results = self.result_list()

        now = util.utcnow()
        regions = defaultdict(int)
        wifis = query_macs(query, query.wifi, self.raven_client, WifiShard)
        for wifi in wifis:
            regions[wifi.region] += station_score(wifi, now)

        for code, score in regions.items():
            region = GEOCODER.region_for_code(code)
            if region:
                results.add(
                    self.result_type(region_code=code,
                                     region_name=region.name,
                                     accuracy=region.radius,
                                     score=score))

        return results
Exemplo n.º 4
0
    def search_blue(self, query):
        results = self.result_list()

        now = util.utcnow()
        regions = defaultdict(int)
        blues = query_macs(query, query.blue, self.raven_client, BlueShard)
        for blue in blues:
            regions[blue.region] += station_score(blue, now)

        for code, score in regions.items():
            region = GEOCODER.region_for_code(code)
            if region:
                results.add(self.result_type(
                    region_code=code,
                    region_name=region.name,
                    accuracy=region.radius,
                    score=score))

        return results