SHARE
TWEET

Untitled

a guest Feb 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. declare -A birthdays=(["${year}0120"]="GG")
  2.  
  3. gap_string=`/home/roach/.config/argos/LunarSolarConverter.py ${!birthdays[@]}`
  4. if [ $? -eq 0 ]; then
  5.     `$gap_string`
  6. fi
  7.      
  8. if __name__ == '__main__':
  9.     converter = LunarSolarConverter()
  10.     gaps_string = ["declare -A gaps=("]
  11.     today = datetime.datetime.today()
  12.     today_date = today.date()
  13.     year = today.year
  14.     isleap = (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0))
  15.     days_this_year = 366 if isleap else 365
  16.     for i in range(1, len(sys.argv)):
  17.         year, month, day = int(sys.argv[i][:-4]), int(sys.argv[i][-4:-2]), int(sys.argv[i][-2:])
  18.         lunar = Lunar(year, month, day, isleap)
  19.         solar = converter.LunarToSolar(lunar)
  20.         gap = (datetime.date(solar.solarYear, solar.solarMonth, solar.solarDay) - today_date).days % days_this_year
  21.         if gap <= 4:
  22.             gaps_string.append(f"[{solar.solarYear}-{solar.solarMonth}-{solar.solarDay}]={gap}")
  23.     gaps_string.append(")")
  24.     if len(gaps_string) == 2:
  25.         sys.exit(1)
  26.     else:
  27.         print(" ".join(gaps_string))
  28.         sys.exit(0)
  29.      
  30. gaps=$( your_python_command )
  31. eval "$gaps"
  32. # or, the variable is unnecessary:
  33. eval "$( your_python_command )"
  34.      
  35. source <( your_python_command )
  36.      
  37. set -x
  38. declare -A gaps=( [2017-02-11]=4 )
  39.      
  40. + gaps=([2017-02-11]=4)
  41. + declare -A gaps
  42.      
  43. s="declare -A gaps=( [2017-02-11]=4 )"
  44. $s
  45.      
  46. + declare -A 'gaps=(' '[2017-02-11]=4' ')'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top