<commit_before>#!coding:utf-8

import serial
import math
import pynmea2
from pyproj import Geod
import logging


class gpsparser(object):

    def __init__(self, portname=None, baudrate=9600, goal=[[138.75665666666666, 35.68582166666667]], debugmode=False):
        self.debugmode = debugmode
        self.goal = goal
        if portname is not None:
            self.ser = serial.Serial(port=portname, baudrate=baudrate)
            logging.info("open SerialPort")
            self.ser.flushInput()
            self.ser.flushOutput()
            read = self.ser.readline()

    def gpsupdate(self, debuggpsvalue=None):
        if debuggpsvalue is None:
            self.ser.flushInput()
            self.ser.flushOutput()
            readline = str(self.ser.readline(), 'utf-8').split('\r')[0]
            self.ser.flushInput()
            self.ser.flushOutput()
        else:
            readline = debuggpsvalue
        logging.info(readline)
        self.gpsdata = self.NMEAanAlysis(readline)
        logging.info("gpsupdate")

    def NMEAanAlysis(self, data):
        return pynmea2.parse(data)

    def timestamp(self):
        return self.gpsdata.timestamp

    def lat(self):
        logging.info(str(self.gpsdata.lat))
        return float(self.gpsdata.lat)

    def latitude(self):
        logging.info(str(self.gpsdata.latitude))
        return float(self.gpsdata.latitude)

    def lon(self):
        logging.info(str(self.gpsdata.lon))
        return float(self.gpsdata.lon)

    def longitude(self):
        logging.info(str(self.gpsdata.longitude))
        return float(self.gpsdata.longitude)

    def sat_receivejudge(self):
        if int(self.gpsdata.num_sats) >= 3:
            logging.info("OKGpsnum:"+str(self.gpsdata.num_sats))
            print("OKGpsnum:"+str(self.gpsdata.num_sats))<commit_msg>fixgps<commit_after>#!coding:utf-8

import serial
import math
import pynmea2
from pyproj import Geod
import logging
import logging


class gpsparser(object):

    def __init__(self, portname=None, baudrate=9600, goal=[[138.75665666666666, 35.68582166666667]], debugmode=False):
        self.debugmode = debugmode
        self.goal = goal
        if portname is not None:
            self.ser = serial.Serial(port=portname, baudrate=baudrate)
            logging.info("open SerialPort")

    def gpsupdate(self, debuggpsvalue=None):
        readline = ""
        if debuggpsvalue is None:
            while True:
                self.ser.flushInput()
                self.ser.flushOutput()
                readline = str(self.ser.readline(), 'utf-8').split('\r')[0]
                self.ser.flushInput()
                self.ser.flushOutput()
                self.gpsdata = self.NMEAanAlysis(readline)
                if self.gpsdata is not None:
                    break
        else:
            readline = debuggpsvalue
        logging.info(readline)
        logging.info("gpsupdate")

    def NMEAanAlysis(self, data):
        try:
            parsedata = pynmea2.parse(data)
            return parsedata
        except:
            return None

    def timestamp(self):
        return self.gpsdata.timestamp

    def lat(self):
        logging.info(str(self.gpsdata.lat))
        return float(self.gpsdata.lat)

    def latitude(self):
        logging.info(str(self.gpsdata.latitude))
        return float(self.gpsdata.latitude)

    def lon(self):
        logging.info(str(self.gpsdata.lon))
        return float(self.gpsdata.lon)

    def longitude(self):
        logging.info(str(self.gpsdata.longitude))
        return float(self.gpsdata.longitude)

    def sat_receivejudge(self):
        if int(self.gpsdata.num_sats) >= 3:
            logging.info("OKGpsnum:"+str(self.gpsdata.num_sats))
            print("OKGpsnum:"+str(self.gpsdata.num_sats))
{'fraction_non_alphanumeric': 0.11222869242985707, 'fraction_numerical': 0.022763366860772894, 'mean_word_length': 2.3004366812227075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3267695', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1206, 'n_words': 206}