Skip to content

Commit

Permalink
Merge pull request collective#690 from c0d33ngr/add-all-attribute
Browse files Browse the repository at this point in the history
docs: add __all__ variables to some modules
  • Loading branch information
niccokunzmann committed Jul 9, 2024
2 parents 7fb1567 + 94af1de commit 3f20966
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 2 deletions.
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"]

0 comments on commit 3f20966

Please sign in to comment.