Skip to content

Commit

Permalink
No maya (#175)
Browse files Browse the repository at this point in the history
* remove maya
  • Loading branch information
ddkohler authored Jan 25, 2024
1 parent 080026f commit 973c393
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- `Instrument.print_tree`
- `print_history` function

### Changed
- maya is no longer a dependency

### Fixed
- Inserted WrightTools import into _map and _offset
- Tune equality handles tunes of unequal size
Expand Down
15 changes: 12 additions & 3 deletions attune/_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


from datetime import datetime, timedelta, timezone
from dateparser import parse
import pathlib
import os
import warnings
Expand Down Expand Up @@ -49,9 +50,17 @@ def load(name: str, time=None, reverse: bool = True):
If given as False, looks forward in time from the given timestamp.
"""
if isinstance(time, str):
import maya

time = maya.when(time)
time = parse(
time,
settings=dict(
TIMEZONE="UTC",
PREFER_DATES_FROM="current_period",
TO_TIMEZONE="UTC",
RETURN_AS_TIMEZONE_AWARE=True,
),
)
if time is None:
raise ValueError("invalid datetime")
if time is None:
time = datetime.now(timezone.utc)
if hasattr(time, "datetime"):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def read(fname):
"scipy",
"matplotlib",
"appdirs",
"dateparser",
"python-dateutil",
"maya",
"click",
],
extras_require={
Expand Down

0 comments on commit 973c393

Please sign in to comment.