Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Coder committed Apr 11, 2020
1 parent aab3444 commit c7f193d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/event-cmp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ timezone specified:
>>> dt_ny = dt(2020, 2, 20, 20, 20, tzinfo=gettz("America/New York"))
>>> dt_utc = dt(2020, 2, 20, 20, 20, tzinfo=tzutc())
>>> dt_local = dt(2020, 2, 20, 20, 20, tzinfo=tzlocal())
>>> dt_local.tzinfo.tzname(dt_local), dt_local.tzinfo.utcoffset(dt_local)
('+02', datetime.timedelta(seconds=7200))
>>> dt_local.tzinfo.tzname(dt_local), dt_local.tzinfo.utcoffset(dt_local).total_seconds()
('+02', 7200.0)
>>> dt_utc < dt_ny
True
>>> dt_local < dt_utc # this always holds as tzlocal is +2:00 (i.e. European Summer Time)
Expand Down
2 changes: 1 addition & 1 deletion src/ics/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AudioAlarm(BaseAlarm):
A calendar event VALARM with AUDIO option.
"""

attach: Union[URL, bytes] = attr.ib(default="") # type: ignore
attach: Union[URL, bytes, None] = attr.ib(default=None)

@property
def action(self):
Expand Down
3 changes: 1 addition & 2 deletions src/ics/converter/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def populate(self, component: "Component", item: ContainerItem, context: Context

item = item.clone([
line for line in item if
not line.name.startswith("X-") and
not line.name == "SEQUENCE"
not line.name.startswith("X-") and not line.name == "SEQUENCE"
])

fake_file = StringIO()
Expand Down
1 change: 1 addition & 0 deletions src/ics/timespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def normalize(self, value): # noqa
return value


# using datetime.min might lead to problems when doing timezone conversions / comparisions (e.g. by substracting an 1 hour offset)
CMP_DATETIME_NONE_DEFAULT = datetime(1900, 1, 1, 0, 0)
CMP_NORMALIZATION = Normalization(normalize_floating=True, normalize_with_tz=False, replacement=tzlocal)

Expand Down
7 changes: 4 additions & 3 deletions src/ics/valuetype/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
T = TypeVar('T')


class ValueConverter(abc.ABC, Generic[T]):
class ValueConverter(Generic[T], abc.ABC):
BY_NAME: Dict[str, "ValueConverter"] = {}
BY_TYPE: Dict[Type, "ValueConverter"] = {}
INST: "ValueConverter"

def __init_subclass__(cls) -> None:
super().__init_subclass__()
if not inspect.isabstract(cls):
super(ValueConverter, cls).__init_subclass__()
# isabstract(ValueConverter) == False on python 3.6
if not inspect.isabstract(cls) and cls.parse is not ValueConverter.parse:
cls.INST = cls()
ValueConverter.BY_NAME[cls.INST.ics_type] = cls.INST
ValueConverter.BY_TYPE.setdefault(cls.INST.python_type, cls.INST)
Expand Down

0 comments on commit c7f193d

Please sign in to comment.