<commit_before>
import time
import datetime
import requests
import json


class NEO:

    des = 0
    orbit_id = 1
    jd = 2
    cd = 3
    dist = 4
    dist_min = 5
    dist_max = 6
    v_rel = 7
    v_inf = 8
    t_signma_F = 9
    body = 10
    h = 11

    json_data_url = requests.get("https://ssd-api.jpl.nasa.gov/cad.api?body=Earth&dist-max=20LD")
    json_data = json.loads(json_data_url.text)

    neo_data = []

    def estimated_diameter(self):
        # todo

    def flyby_data(self):

    unix = time.time()
    datestamp = datetime.datetime.fromtimestamp(unix).strftime("%Y-%b-%d")

    for i in range(len(json_data["data"])):
        neo_date = json_data["data"][i][cd][:11]
        neo_time = json_data["data"][i][cd][11:]
        neo_des = json_data["data"][i][des]

        if neo_date == datestamp:
            neo_data.append((neo_des, neo_time,))







        
        # sorte lieber per magnitude und nimm nur das größte objekt, sonst ist der tweet zu lang



# TODO: Iterate over data and return tuple


<commit_msg>Update 0.3.0 - imported log10 from math - fixed indention - commented number reference out - addef missing self parameter return list with tuples of data<commit_after>
import time
import datetime
import requests
import json
from math import log10


class NEO:
    """
    For accesing the data, corresponding numbers:
    des = 0
    orbit_id = 1
    jd = 2
    cd = 3
    dist = 4
    dist_min = 5
    dist_max = 6
    v_rel = 7
    v_inf = 8
    t_signma_F = 9
    body = 10
    h = 11
    """
    json_data_url = requests.get("https://ssd-api.jpl.nasa.gov/cad.api?body=Earth&dist-max=20LD")
    json_data = json.loads(json_data_url.text)

    neo_data = []

    def flyby_data(self):

        unix = time.time()
        datestamp = datetime.datetime.fromtimestamp(unix).strftime("%Y-%b-%d")

        for i in range(len(self.json_data["data"])):
            neo_date = self.json_data["data"][i][3][:11]
            neo_time = self.json_data["data"][i][3][11:]
            neo_des = self.json_data["data"][i][0]
            diameter_min = 10 ** 0.5*(6.259 - log10(0.05) - 0.4 * self.json_data["data"][i][11])
            diameter_max = 10 ** 0.5*(6.259 - log10(0.25) - 0.4 * self.json_data["data"][i][11])

            if neo_date == datestamp:
                self.neo_data.append((neo_des, neo_time, diameter_min, diameter_max))
                
        return self.neo_data

{'fraction_non_alphanumeric': 0.12933884297520662, 'fraction_numerical': 0.03471074380165289, 'mean_word_length': 2.3907563025210083, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3566973', 'n_tokens_mistral': 950, 'n_tokens_neox': 850, 'n_words': 195}