<commit_before>#!/usr/bin/python

# Export solar information as JSON

from datetime import date
from solartime import SolarTime
from location import longitude, latitude, localtz

import json

today = date.today()
solar_utc = SolarTime().sun_utc(date.today(), latitude, longitude)
daylight = solar_utc['sunset'] - solar_utc['sunrise']

solar_local = {
  'sunrise':  int(solar_utc['sunrise'].astimezone(localtz).strftime('%s')),
  'sunset':   int(solar_utc['sunset'].astimezone(localtz).strftime('%s')),
  'peak':     int(solar_utc['noon'].astimezone(localtz).strftime('%s')),
  'daylight': daylight.seconds,
}

print json.dumps(solar_local)
<commit_msg>accept argument for solar stats day<commit_after>#!/usr/bin/python

# Export solar information as JSON

from datetime import date
from solartime import SolarTime
from location import longitude, latitude, localtz

import json
import sys

target_day = date.fromtimestamp(float(sys.argv[1])) if len(sys.argv) > 1 else date.today()
solar_utc = SolarTime().sun_utc(target_day, latitude, longitude)
daylight = solar_utc['sunset'] - solar_utc['sunrise']

solar_local = {
  'sunrise':  int(solar_utc['sunrise'].astimezone(localtz).strftime('%s')),
  'sunset':   int(solar_utc['sunset'].astimezone(localtz).strftime('%s')),
  'peak':     int(solar_utc['noon'].astimezone(localtz).strftime('%s')),
  'daylight': daylight.seconds,
}

print json.dumps(solar_local)

{'fraction_non_alphanumeric': 0.15444839857651246, 'fraction_numerical': 0.0014234875444839859, 'mean_word_length': 6.4787234042553195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, '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': '3332955', 'n_tokens_mistral': 529, 'n_tokens_neox': 501, 'n_words': 96}