def init(num_expanded_year_digits=0, custom_dump_format=None, time_zone=None, assume_utc=False, cycling_mode=None): """Initialise suite-setup-specific information.""" SuiteSpecifics.interval_parser = DurationParser() if cycling_mode in Calendar.default().MODES: Calendar.default().set_mode(cycling_mode) if time_zone is None: if assume_utc: time_zone = "Z" time_zone_hours_minutes = (0, 0) else: time_zone = get_local_time_zone_format(reduced_mode=True) time_zone_hours_minutes = get_local_time_zone() else: time_zone_hours_minutes = TimePointDumper().get_time_zone(time_zone) SuiteSpecifics.ASSUMED_TIME_ZONE = time_zone_hours_minutes SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS = num_expanded_year_digits if custom_dump_format is None: if num_expanded_year_digits > 0: SuiteSpecifics.DUMP_FORMAT = EXPANDED_DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = custom_dump_format if u"+X" not in custom_dump_format and num_expanded_year_digits: raise IllegalValueError( 'cycle point format', ('cylc', 'cycle point format'), SuiteSpecifics.DUMP_FORMAT ) SuiteSpecifics.point_parser = TimePointParser( allow_only_basic=False, allow_truncated=True, num_expanded_year_digits=SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS, dump_format=SuiteSpecifics.DUMP_FORMAT, assumed_time_zone=time_zone_hours_minutes ) custom_point_parse_function = None if SuiteSpecifics.DUMP_FORMAT == PREV_DATE_TIME_FORMAT: custom_point_parse_function = point_parse SuiteSpecifics.abbrev_util = CylcTimeParser( None, None, num_expanded_year_digits=SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS, dump_format=SuiteSpecifics.DUMP_FORMAT, custom_point_parse_function=custom_point_parse_function, assumed_time_zone=SuiteSpecifics.ASSUMED_TIME_ZONE )
def init(num_expanded_year_digits=0, custom_dump_format=None, time_zone=None, assume_utc=False, cycling_mode=None): """Initialise suite-setup-specific information.""" SuiteSpecifics.interval_parser = DurationParser() if cycling_mode in Calendar.default().MODES: Calendar.default().set_mode(cycling_mode) if time_zone is None: if assume_utc: time_zone = "Z" time_zone_hours_minutes = (0, 0) else: time_zone = get_local_time_zone_format(reduced_mode=True) time_zone_hours_minutes = get_local_time_zone() else: time_zone_hours_minutes = TimePointDumper().get_time_zone(time_zone) SuiteSpecifics.ASSUMED_TIME_ZONE = time_zone_hours_minutes SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS = num_expanded_year_digits if custom_dump_format is None: if num_expanded_year_digits > 0: SuiteSpecifics.DUMP_FORMAT = EXPANDED_DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = custom_dump_format if u"+X" not in custom_dump_format and num_expanded_year_digits: raise IllegalValueError('cycle point format', ('cylc', 'cycle point format'), SuiteSpecifics.DUMP_FORMAT) SuiteSpecifics.point_parser = TimePointParser( allow_only_basic=False, allow_truncated=True, num_expanded_year_digits=SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS, dump_format=SuiteSpecifics.DUMP_FORMAT, assumed_time_zone=time_zone_hours_minutes) custom_point_parse_function = None if SuiteSpecifics.DUMP_FORMAT == PREV_DATE_TIME_FORMAT: custom_point_parse_function = point_parse SuiteSpecifics.abbrev_util = CylcTimeParser( None, None, num_expanded_year_digits=SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS, dump_format=SuiteSpecifics.DUMP_FORMAT, custom_point_parse_function=custom_point_parse_function, assumed_time_zone=SuiteSpecifics.ASSUMED_TIME_ZONE)
def init(num_expanded_year_digits=0, custom_dump_format=None, time_zone=None, assume_utc=False, cycling_mode=None): """Initialise suite-setup-specific information.""" if cycling_mode in Calendar.default().MODES: Calendar.default().set_mode(cycling_mode) if time_zone is None: if assume_utc: time_zone = "Z" time_zone_hours_minutes = (0, 0) else: time_zone = get_local_time_zone_format(TimeZoneFormatMode.reduced) time_zone_hours_minutes = get_local_time_zone() else: time_zone_hours_minutes = TimePointDumper().get_time_zone(time_zone) SuiteSpecifics.ASSUMED_TIME_ZONE = time_zone_hours_minutes SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS = num_expanded_year_digits if custom_dump_format is None: if num_expanded_year_digits > 0: SuiteSpecifics.DUMP_FORMAT = EXPANDED_DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = custom_dump_format if u"+X" not in custom_dump_format and num_expanded_year_digits: raise IllegalValueError( 'cycle point format', ('cylc', 'cycle point format'), SuiteSpecifics.DUMP_FORMAT ) SuiteSpecifics.iso8601_parsers = CylcTimeParser.initiate_parsers( dump_format=SuiteSpecifics.DUMP_FORMAT, num_expanded_year_digits=num_expanded_year_digits, assumed_time_zone=SuiteSpecifics.ASSUMED_TIME_ZONE ) (SuiteSpecifics.point_parser, SuiteSpecifics.interval_parser, SuiteSpecifics.recurrence_parser) = SuiteSpecifics.iso8601_parsers SuiteSpecifics.abbrev_util = CylcTimeParser( None, None, SuiteSpecifics.iso8601_parsers )
def init(num_expanded_year_digits=0, custom_dump_format=None, time_zone=None, assume_utc=False, cycling_mode=None): """Initialise suite-setup-specific information.""" if cycling_mode in Calendar.default().MODES: Calendar.default().set_mode(cycling_mode) if time_zone is None: if assume_utc: time_zone = "Z" time_zone_hours_minutes = (0, 0) else: time_zone = get_local_time_zone_format(TimeZoneFormatMode.reduced) time_zone_hours_minutes = get_local_time_zone() else: time_zone_hours_minutes = TimePointDumper().get_time_zone(time_zone) SuiteSpecifics.ASSUMED_TIME_ZONE = time_zone_hours_minutes SuiteSpecifics.NUM_EXPANDED_YEAR_DIGITS = num_expanded_year_digits if custom_dump_format is None: if num_expanded_year_digits > 0: SuiteSpecifics.DUMP_FORMAT = EXPANDED_DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = DATE_TIME_FORMAT + time_zone else: SuiteSpecifics.DUMP_FORMAT = custom_dump_format if "+X" not in custom_dump_format and num_expanded_year_digits: raise IllegalValueError( 'cycle point format', ('cylc', 'cycle point format'), SuiteSpecifics.DUMP_FORMAT ) SuiteSpecifics.iso8601_parsers = CylcTimeParser.initiate_parsers( dump_format=SuiteSpecifics.DUMP_FORMAT, num_expanded_year_digits=num_expanded_year_digits, assumed_time_zone=SuiteSpecifics.ASSUMED_TIME_ZONE ) (SuiteSpecifics.point_parser, SuiteSpecifics.interval_parser, SuiteSpecifics.recurrence_parser) = SuiteSpecifics.iso8601_parsers SuiteSpecifics.abbrev_util = CylcTimeParser( None, None, SuiteSpecifics.iso8601_parsers )
get_local_time_zone) DATE_TIME_FORMAT_BASIC = "%Y%m%dT%H%M%S" DATE_TIME_FORMAT_BASIC_SUB_SECOND = "%Y%m%dT%H%M%S.%f" DATE_TIME_FORMAT_EXTENDED = "%Y-%m-%dT%H:%M:%S" DATE_TIME_FORMAT_EXTENDED_SUB_SECOND = "%Y-%m-%dT%H:%M:%S.%f" RE_DATE_TIME_FORMAT_EXTENDED = ( "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-][\d:]+)?") TIME_FORMAT_BASIC = "%H%M%S" TIME_FORMAT_BASIC_SUB_SECOND = "%H%M%S.%f" TIME_FORMAT_EXTENDED = "%H:%M:%S" TIME_FORMAT_EXTENDED_SUB_SECOND = "%H:%M:%S.%f" TIME_ZONE_STRING_LOCAL_BASIC = get_local_time_zone_format(reduced_mode=True) TIME_ZONE_STRING_LOCAL_EXTENDED = get_local_time_zone_format( extended_mode=True, reduced_mode=True) TIME_ZONE_STRING_UTC = "Z" TIME_ZONE_UTC_UTC_OFFSET = (0, 0) TIME_ZONE_LOCAL_UTC_OFFSET = get_local_time_zone() TIME_ZONE_LOCAL_UTC_OFFSET_HOURS = TIME_ZONE_LOCAL_UTC_OFFSET[0] TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES = TIME_ZONE_LOCAL_UTC_OFFSET[1] TIME_ZONE_LOCAL_INFO = { "hours": TIME_ZONE_LOCAL_UTC_OFFSET[0], "minutes": TIME_ZONE_LOCAL_UTC_OFFSET[1], "string_basic": TIME_ZONE_STRING_LOCAL_BASIC, "string_extended": TIME_ZONE_STRING_LOCAL_EXTENDED }
DATE_TIME_FORMAT_BASIC = "%Y%m%dT%H%M%S" DATE_TIME_FORMAT_BASIC_SUB_SECOND = "%Y%m%dT%H%M%S.%f" DATE_TIME_FORMAT_EXTENDED = "%Y-%m-%dT%H:%M:%S" DATE_TIME_FORMAT_EXTENDED_SUB_SECOND = "%Y-%m-%dT%H:%M:%S.%f" RE_DATE_TIME_FORMAT_EXTENDED = ( "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-][\d:]+)?") TIME_FORMAT_BASIC = "%H%M%S" TIME_FORMAT_BASIC_SUB_SECOND = "%H%M%S.%f" TIME_FORMAT_EXTENDED = "%H:%M:%S" TIME_FORMAT_EXTENDED_SUB_SECOND = "%H:%M:%S.%f" TIME_ZONE_STRING_LOCAL_BASIC = get_local_time_zone_format(reduced_mode=True) TIME_ZONE_STRING_LOCAL_EXTENDED = get_local_time_zone_format( extended_mode=True, reduced_mode=True) TIME_ZONE_STRING_UTC = "Z" TIME_ZONE_UTC_UTC_OFFSET = (0, 0) TIME_ZONE_LOCAL_UTC_OFFSET = get_local_time_zone() TIME_ZONE_LOCAL_UTC_OFFSET_HOURS = TIME_ZONE_LOCAL_UTC_OFFSET[0] TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES = TIME_ZONE_LOCAL_UTC_OFFSET[1] TIME_ZONE_LOCAL_INFO = { "hours": TIME_ZONE_LOCAL_UTC_OFFSET[0], "minutes": TIME_ZONE_LOCAL_UTC_OFFSET[1], "string_basic": TIME_ZONE_STRING_LOCAL_BASIC, "string_extended": TIME_ZONE_STRING_LOCAL_EXTENDED }
DATE_TIME_FORMAT_BASIC = "%Y%m%dT%H%M%S" DATE_TIME_FORMAT_BASIC_SUB_SECOND = "%Y%m%dT%H%M%S.%f" DATE_TIME_FORMAT_EXTENDED = "%Y-%m-%dT%H:%M:%S" DATE_TIME_FORMAT_EXTENDED_SUB_SECOND = "%Y-%m-%dT%H:%M:%S.%f" _FLAGS = {r'utc_mode': False} RE_DATE_TIME_FORMAT_EXTENDED = ( r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-][\d:]+)?") TIME_FORMAT_BASIC = "%H%M%S" TIME_FORMAT_BASIC_SUB_SECOND = "%H%M%S.%f" TIME_FORMAT_EXTENDED = "%H:%M:%S" TIME_FORMAT_EXTENDED_SUB_SECOND = "%H:%M:%S.%f" TIME_ZONE_STRING_LOCAL_BASIC = get_local_time_zone_format( TimeZoneFormatMode.reduced) TIME_ZONE_STRING_LOCAL_EXTENDED = get_local_time_zone_format( TimeZoneFormatMode.extended) TIME_ZONE_STRING_UTC = "Z" TIME_ZONE_UTC_UTC_OFFSET = (0, 0) TIME_ZONE_LOCAL_UTC_OFFSET = get_local_time_zone() TIME_ZONE_LOCAL_UTC_OFFSET_HOURS = TIME_ZONE_LOCAL_UTC_OFFSET[0] TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES = TIME_ZONE_LOCAL_UTC_OFFSET[1] TIME_ZONE_LOCAL_INFO = { "hours": TIME_ZONE_LOCAL_UTC_OFFSET[0], "minutes": TIME_ZONE_LOCAL_UTC_OFFSET[1], "string_basic": TIME_ZONE_STRING_LOCAL_BASIC, "string_extended": TIME_ZONE_STRING_LOCAL_EXTENDED }