@@ 546-558 (lines=13) @@ | ||
543 | @classmethod |
|
544 | def gds_parse_time(cls, input_data): |
|
545 | tz = None |
|
546 | if input_data[-1] == 'Z': |
|
547 | tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') |
|
548 | input_data = input_data[:-1] |
|
549 | else: |
|
550 | results = GeneratedsSuper.tzoff_pattern.search(input_data) |
|
551 | if results is not None: |
|
552 | tzoff_parts = results.group(2).split(':') |
|
553 | tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) |
|
554 | if results.group(1) == '-': |
|
555 | tzoff *= -1 |
|
556 | tz = GeneratedsSuper._FixedOffsetTZ( |
|
557 | tzoff, results.group(0)) |
|
558 | input_data = input_data[:-6] |
|
559 | if len(input_data.split('.')) > 1: |
|
560 | dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') |
|
561 | else: |
|
@@ 478-490 (lines=13) @@ | ||
475 | @classmethod |
|
476 | def gds_parse_date(cls, input_data): |
|
477 | tz = None |
|
478 | if input_data[-1] == 'Z': |
|
479 | tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') |
|
480 | input_data = input_data[:-1] |
|
481 | else: |
|
482 | results = GeneratedsSuper.tzoff_pattern.search(input_data) |
|
483 | if results is not None: |
|
484 | tzoff_parts = results.group(2).split(':') |
|
485 | tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) |
|
486 | if results.group(1) == '-': |
|
487 | tzoff *= -1 |
|
488 | tz = GeneratedsSuper._FixedOffsetTZ( |
|
489 | tzoff, results.group(0)) |
|
490 | input_data = input_data[:-6] |
|
491 | dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') |
|
492 | dt = dt.replace(tzinfo=tz) |
|
493 | return dt.date() |
|
@@ 422-434 (lines=13) @@ | ||
419 | @classmethod |
|
420 | def gds_parse_datetime(cls, input_data): |
|
421 | tz = None |
|
422 | if input_data[-1] == 'Z': |
|
423 | tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') |
|
424 | input_data = input_data[:-1] |
|
425 | else: |
|
426 | results = GeneratedsSuper.tzoff_pattern.search(input_data) |
|
427 | if results is not None: |
|
428 | tzoff_parts = results.group(2).split(':') |
|
429 | tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) |
|
430 | if results.group(1) == '-': |
|
431 | tzoff *= -1 |
|
432 | tz = GeneratedsSuper._FixedOffsetTZ( |
|
433 | tzoff, results.group(0)) |
|
434 | input_data = input_data[:-6] |
|
435 | time_parts = input_data.split('.') |
|
436 | if len(time_parts) > 1: |
|
437 | micro_seconds = int(float('0.' + time_parts[1]) * 1000000) |