remove skills. from skills module imports

This commit is contained in:
samerbam 2023-09-11 20:44:56 -04:00
parent 3e71ac6421
commit 36267c607c
13 changed files with 68 additions and 42 deletions

View File

@ -8,14 +8,14 @@ Maybe we just call timers.py from here?
import requests
if __name__ == "__main__": # Handle running this script directly vs as a project
from config import ntfy_url
from utility import parsetime
from skill import Skill
else:
from skills.config import ntfy_url
from skills.utility import parsetime
from skills.skill import Skill
# if __name__ == "__main__": # Handle running this script directly vs as a project
from config import ntfy_url
from utility import parsetime6
from skill import Skill
# else:
# from skills.config import ntfy_url
# from skills.utility import parsetime
# from skills.skill import Skill
import threading
import schedule
@ -96,7 +96,7 @@ class Alarms(Skill):
def run(self, query="", duration_string="", name=""):
if "add" in query:
# duration = time.mktime(parsetime2(duration_string).timetuple())
duration = parsetime(duration_string)
duration = parsetime6(duration_string)[0]
self._add_alarm(duration, name)
return True # Return true to indicate success
if "remove" in query:
@ -110,6 +110,6 @@ class Alarms(Skill):
if __name__ == "__main__":
dur = Alarms()
dur.run("add", "1 47 in the afternoon", "test alarm")
dur.run("add", "818 in the afternoon", "test alarm")
# dur._add_alarm(123, "123")
# dur._trigger_alarm("123")

View File

@ -11,7 +11,8 @@ Choice:
* Both would be more work, but would allow for more flexibility
"""
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Cal(Skill):
def __init__(self):

View File

@ -6,7 +6,9 @@ https://developers.google.com/gmail/api/quickstart/python
https://git.imsam.ca/sam/ThermalTodos/src/branch/main/application/sync_calendar.py (for autherizing user)
"""
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Gmail(Skill):
def __init__(self):

View File

@ -1,5 +1,7 @@
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class GPT(Skill):
def __init__(self):

View File

@ -1,11 +1,11 @@
import requests
if __name__ == '__main__':
from skill import Skill
from config import ntfy_url
else:
from skills.skill import Skill
from skills.config import ntfy_url
# if __name__ == '__main__':
from skill import Skill
from config import ntfy_url
# else:
# from skills.skill import Skill
# from skills.config import ntfy_url
class Phone(Skill):

View File

@ -63,10 +63,10 @@ import re
from datetime import datetime, timedelta
import time
if __name__ == '__main__':
from config import default_morning_time, default_afternoon_time, default_evening_time
else:
from skills.config import default_morning_time, default_afternoon_time, default_evening_time
# if __name__ == '__main__':
from config import default_morning_time, default_afternoon_time, default_evening_time
# else:
# from skills.config import default_morning_time, default_afternoon_time, default_evening_time
morning_datetime = datetime.strptime(default_morning_time, "%H:%M")
@ -187,7 +187,7 @@ class RegexTimeParser:
if matches[5]: #(monday|tuesday|wednesday|thursday|friday|saturday|sunday)
date = date + timedelta(days = (dayofweek_to_number[matches[5][0]] - date.weekday() + 7) % 7)
return [date.strftime("%d-%m-%Y %H:%M"), matches]
return [date, matches]
if __name__ == '__main__':

View File

@ -12,7 +12,9 @@ Even better, use this library: https://github.com/picklepete/pyicloud/blob/maste
(icloud reminders api, reads/writes reminders from/to ios reminders app)
"""
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Reminders(Skill): # ntfy.sh notification?
def __init__(self):

View File

@ -1,13 +1,13 @@
import requests
if __name__ == "__main__": # Handle running this script directly vs as a project
from config import ntfy_url
from utility import parsetime2
from skill import Skill
else:
from skills.config import ntfy_url
from skills.utility import parsetime2
from skills.skill import Skill
# if __name__ == "__main__": # Handle running this script directly vs as a project
from config import ntfy_url
from utility import parsetime2
from skill import Skill
# else:
# from skills.config import ntfy_url
# from skills.utility import parsetime2
# from skills.skill import Skill
import threading
import schedule

View File

@ -2,7 +2,9 @@
"""
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Todos(Skill): # Notion api? reminders app?
def __init__(self):

View File

@ -1,7 +1,10 @@
import requests
from skills.config import deepl_api_key
from skills.config import google_api_key
from skills.skill import Skill
# from skills.config import deepl_api_key
# from skills.config import google_api_key
# from skills.skill import Skill
from config import deepl_api_key
from config import google_api_key
from skill import Skill
"""
Reading material for this:

View File

@ -7,6 +7,11 @@ import natural_time
from datetime import datetime
import time
# if __name__ == '__main__':
from regexTimeParser import RegexTimeParser
# else:
# from skills.regexTimeParser import RegexTimeParser
"""
Reading Material:
@ -56,6 +61,11 @@ def parsetime5(phrase):
return natural_time.natural_time(phrase)
time_parser = RegexTimeParser()
def parsetime6(phrase):
return time_parser.parse_time(phrase)
if __name__ == "__main__":
# t = parsetime('May 5th in the afternoon')
# print(t)
@ -67,10 +77,12 @@ if __name__ == "__main__":
# print(t66)
# t67 = parsetime2('147 in the afternoon')
# print(t67)
# t68 = parsetime2('147 after noon')
# print(t68)
t88 = parsetime('one forty seven in the afternoon')
t68 = parsetime6('147 afternoon')
print(t68)
t88 = parsetime6('1 in the afternoon')
print(t88)
t89 = parsetime6('thursday at 9 pm')
print(t89)
# t89 = parsetime5('147 in the afternoon')
# print(t89)
# t90 = parsetime5('147 after noon')

View File

@ -1,5 +1,6 @@
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Weather(Skill): #open weather map api
def __init__(self):

View File

@ -1,5 +1,6 @@
from skills.skill import Skill
# from skills.skill import Skill
from skill import Skill
class Wolfram(Skill): #wolfram alpha api
def __init__(self):