From cb4b733bbb6adf8b705f6820b2ca284765a3d143 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 12 Nov 2023 18:15:09 +0000 Subject: [PATCH] Remove unused code --- agenda/markets.py | 102 ---------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 agenda/markets.py diff --git a/agenda/markets.py b/agenda/markets.py deleted file mode 100644 index 3b05495..0000000 --- a/agenda/markets.py +++ /dev/null @@ -1,102 +0,0 @@ -"""Market days.""" - -from datetime import date, time, timedelta - -import pytz -from dateutil.relativedelta import SA, relativedelta - -from . import uk_time -from .types import Event - -uk_tz = pytz.timezone("Europe/London") - - -def event(title: str, d: date, start: time, end: time, url: str) -> Event: - """Build Event object for market.""" - return Event( - name="market", - title=title, - date=uk_time(d, start), - end_date=uk_time(d, end), - url=url, - ) - - -def windmill_hill(start_date: date, end_date: date) -> list[Event]: - """Windmill Hill Market days betwen start and end dates.""" - events: list[Event] = [] - current_date = start_date - url = ( - "https://www.windmillhillcityfarm.org.uk" - + "/visit-us/shops-more/windmill-hill-market-bristol-market/" - ) - start, end = time(10, 0), time(15, 0) - - while current_date < end_date: - # Skip months outside of April to December - if current_date.month < 4 or current_date.month > 12: - current_date += relativedelta(months=1) - current_date = date(current_date.year, current_date.month, 1) - continue - - # Calculate the first Saturday of the current month - first_saturday = current_date + relativedelta(day=1, weekday=SA(+1)) - - # Include it in the list only if it's on or after the start_date - if first_saturday >= start_date: - events.append( - event("Windmill Hill Market", first_saturday, start, end, url) - ) - - # Move to the next month - current_date += relativedelta(months=1) - current_date = date(current_date.year, current_date.month, 1) - - return events - - -def tobacco_factory(start_date: date, end_date: date) -> list[Event]: - """Tobacco Factory Market days for the next 12 months from a given date.""" - events: list[Event] = [] - current_date = start_date - url = "https://tobaccofactory.com/whats-on/sunday-market/" - start, end = time(10, 0), time(14, 30) - - while current_date <= end_date: - # Calculate the next Sunday from the current date - next_sunday = current_date + relativedelta(weekday=6) # Sunday is 6 - - # Include it in the list only if it's on or after the start_date - if next_sunday >= start_date: - events.append( - event("Tobacco Factory Sunday Market", next_sunday, start, end, url) - ) - - # Move to the next week - current_date += timedelta(weeks=1) - - return events - - -def nailsea_farmers(start_date: date, end_date: date) -> list[Event]: - """Nailsea Farmers Market days between start and end dates.""" - events: list[Event] = [] - current_date = start_date - start, end = time(9, 0), time(13, 0) # Times: 9am-1pm - url = "https://www.somersetfarmersmarkets.co.uk/markets/nailsea/" - - while current_date < end_date: - # Calculate the 3rd Saturday of the current month - third_saturday = current_date + relativedelta(day=1, weekday=SA(+3)) - - # Include it in the list only if it's on or after the start_date - if third_saturday >= start_date: - events.append( - event("Nailsea Farmers Market", third_saturday, start, end, url) - ) - - # Move to the next month - current_date += relativedelta(months=1) - current_date = date(current_date.year, current_date.month, 1) - - return events