Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add __all__ variables to some modules #690

Merged
merged 10 commits into from
Jul 9, 2024
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Changelog

Minor changes:

- ...
- add ``__all__`` variable to each modules in ``icalendar`` package

Breaking changes:

Expand Down
4 changes: 4 additions & 0 deletions src/icalendar/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,7 @@ def example(cls, name) -> Calendar:
# These are read only singleton, so one instance is enough for the module
types_factory = TypesFactory()
component_factory = ComponentFactory()

__all__ = ["Alarm", "Calendar", "Component", "ComponentFactory", "Event",
"FreeBusy", "INLINE", "Journal", "Timezone", "TimezoneDaylight",
"TimezoneStandard", "Todo", "component_factory", "get_example"]
3 changes: 3 additions & 0 deletions src/icalendar/caselessdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ def sorted_items(self):
Items not specified in canonical_order will appear at the end.
"""
return canonsort_items(self, self.canonical_order)


__all__ = ["canonsort_keys", "canonsort_items", "CaselessDict"]
3 changes: 3 additions & 0 deletions src/icalendar/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@ def main():
for event in calendar.walk('vevent'):
argv.output.write(view(event) + '\n\n')


__all__ = ["main", "view"]

if __name__ == '__main__':
main()
8 changes: 8 additions & 0 deletions src/icalendar/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,11 @@ def from_ical(cls, st):

# XXX: what kind of hack is this? import depends to be at end
from icalendar.prop import vText


__all__ = ["Contentline", "Contentlines", "FOLD", "NAME", "NEWLINE",
"Parameters", "QUNSAFE_CHAR", "QUOTABLE", "UNSAFE_CHAR", "dquote",
"escape_char", "escape_string", "foldline", "param_value", "q_join",
"q_split", "tzid_from_dt", "uFOLD", "unescape_char",
"unescape_list_or_string", "unescape_string", "validate_param_value",
"validate_token"]
4 changes: 4 additions & 0 deletions src/icalendar/parser_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ def data_encode(data: Union[ICAL_TYPE, dict, list], encoding=DEFAULT_ENCODING) -
return list(map(data_encode, data))
else:
return data


__all__ = ["DEFAULT_ENCODING", "SEQUENCE_TYPES", "ICAL_TYPE" "data_encode", "from_unicode",
"to_unicode"]
8 changes: 8 additions & 0 deletions src/icalendar/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,3 +1122,11 @@ def from_ical(self, name, value):
type_class = self.for_property(name)
decoded = type_class.from_ical(value)
return decoded


__all__ = ["DURATION_REGEX", "TimeBase", "TypesFactory", "WEEKDAY_RULE",
"tzid_from_dt", "vBinary", "vBoolean", "vCalAddress",
"vCategory", "vDDDLists", "vDDDTypes", "vDate", "vDatetime",
"vDuration", "vFloat", "vFrequency", "vGeo", "vInline", "vInt",
"vMonth", "vPeriod", "vRecur", "vSkip", "vText", "vTime",
"vUTCOffset", "vUri", "vWeekday"]
2 changes: 1 addition & 1 deletion src/icalendar/tests/test_equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
except ImportError:
pytz = None
from icalendar.prop import *
from datetime import datetime, date, timedelta
from datetime import datetime, date, time, timedelta
import pytest

def assert_equal(actual_value, expected_value):
Expand Down
2 changes: 2 additions & 0 deletions src/icalendar/timezone/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ def uses_pytz(self) -> bool:
@abstractmethod
def uses_zoneinfo(self) -> bool:
"""Whether we use zoneinfo."""

__all__ = ["TZProvider"]
2 changes: 2 additions & 0 deletions src/icalendar/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ def uid(host_name='example.com', unique=''):
unique = unique or UIDGenerator.rnd_string()
today = to_unicode(vDatetime(datetime.today()).to_ical())
return vText(f'{today}-{unique}@{host_name}')

__all__ = ["UIDGenerator"]
Loading