hc package

Submodules

hc.cli module

Command line interface of hc

hc.cli.main()

hc.datatypes module

Data types definition

class hc.datatypes.MonthDayList

Bases: list

class hc.datatypes.PhData

Bases: list

hc.datatypes.fix_data_types(dataset)
hc.datatypes.fix_ph_data(dataset)

hc.defaults module

hc defaults

hc.helpers module

hc helpers

hc.helpers.get_date_from_relative_month(relative_month)
hc.helpers.get_month_number(month_name)
hc.helpers.get_relative_month(date)

hc.opening_hours_js module

OpenStreetMap opening_hours.js format. Refer to https://github.com/opening-hours/opening_hours.js/blob/master/holidays/README.md for the “spec”.

class hc.opening_hours_js.OpeningHoursJS(defs=None)

Bases: object

FIRST_LEVEL_SORTING = {'PH': '20', 'SH': '30', '_nominatim_url': '10'}
SH_DATA_SORTING = {'name': '0'}
get_school_holidays(out=None)
read(in_defs)
static update_sh_format(sh_data)
hc.opening_hours_js.find_ind(lst, key, value)

hc.schulferien_org module

schulferien.org interface

class hc.schulferien_org.SchulferienOrg(defs=None, cache=True, cache_dir=None)

Bases: object

get_month_dataset(date)
get_school_holidays(from_date, to_date)

hc.yaml module

YAML representation

class hc.yaml.PrettyHolidayYAMLDumper(stream, default_style=None, default_flow_style=None, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, block_seq_indent=None, top_level_colon_align=None, prefix_colon=None)

Bases: ruamel.yaml.dumper.RoundTripDumper

YAML dumper optimized human readability of the holiday format.

represent_dict(data)

write out tag if saved on loading

represent_list(data)
yaml_representers = {None: <unbound method SafeRepresenter.represent_undefined>, <type 'float'>: <unbound method SafeRepresenter.represent_float>, <type 'int'>: <unbound method SafeRepresenter.represent_int>, <type 'list'>: <unbound method SafeRepresenter.represent_list>, <type 'long'>: <unbound method SafeRepresenter.represent_long>, <type 'dict'>: <unbound method PrettyHolidayYAMLDumper.represent_dict>, <type 'NoneType'>: <unbound method RoundTripRepresenter.represent_none>, <type 'set'>: <unbound method SafeRepresenter.represent_set>, <type 'str'>: <unbound method SafeRepresenter.represent_str>, <type 'tuple'>: <unbound method SafeRepresenter.represent_list>, <type 'unicode'>: <unbound method SafeRepresenter.represent_unicode>, <type 'bool'>: <unbound method SafeRepresenter.represent_bool>, <class 'collections.OrderedDict'>: <unbound method PrettyHolidayYAMLDumper.represent_dict>, <class 'ruamel.yaml.comments.CommentedSet'>: <unbound method RoundTripRepresenter.represent_set>, <class 'ruamel.yaml.scalarstring.SingleQuotedScalarString'>: <unbound method RoundTripRepresenter.represent_single_quoted_scalarstring>, <class 'ruamel.yaml.scalarstring.DoubleQuotedScalarString'>: <unbound method RoundTripRepresenter.represent_double_quoted_scalarstring>, <class 'ruamel.yaml.scalarint.ScalarInt'>: <unbound method RoundTripRepresenter.represent_scalar_int>, <class 'ruamel.yaml.scalarint.BinaryInt'>: <unbound method RoundTripRepresenter.represent_binary_int>, <class 'ruamel.yaml.scalarint.OctalInt'>: <unbound method RoundTripRepresenter.represent_octal_int>, <class 'ruamel.yaml.scalarstring.PreservedScalarString'>: <unbound method RoundTripRepresenter.represent_preserved_scalarstring>, <class 'hc.datatypes.MonthDayList'>: <unbound method PrettyHolidayYAMLDumper.represent_list>, <class 'ruamel.yaml.comments.CommentedSeq'>: <unbound method RoundTripRepresenter.represent_list>, <class 'ruamel.yaml.scalarint.HexInt'>: <unbound method RoundTripRepresenter.represent_hex_int>, <class 'ruamel.yaml.scalarint.HexCapsInt'>: <unbound method RoundTripRepresenter.represent_hex_caps_int>, <class 'ruamel.yaml.timestamp.TimeStamp'>: <unbound method RoundTripRepresenter.represent_datetime>, <class 'ruamel.yaml.comments.CommentedMap'>: <unbound method RoundTripRepresenter.represent_dict>, <class 'ruamel.yaml.comments.CommentedOrderedMap'>: <unbound method RoundTripRepresenter.represent_ordereddict>, <class 'hc.datatypes.PhData'>: <unbound method PrettyHolidayYAMLDumper.represent_list>, <type '_ordereddict.ordereddict'>: <unbound method SafeRepresenter.represent_ordereddict>, <type 'datetime.datetime'>: <unbound method SafeRepresenter.represent_datetime>, <type 'datetime.date'>: <unbound method SafeRepresenter.represent_date>}
hc.yaml.dump_holidays_as_yaml(unserialized_data, add_vspacing=True)
hc.yaml.get_clean_yaml(serialized_data, add_vspacing=False)

Module contents

Holiday converter tool