From eb156d5ab525fb20024148343574794dea4c1daa Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Mon, 27 May 2019 05:14:03 +0900 Subject: [PATCH] Update to Unicode 12.1.0 --- .travis.yml | 4 ++-- README.md | 2 +- process.py | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e4ffe8..fa2722d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: python python: "3.6" install: -- wget ftp://ftp.unicode.org/Public/11.0.0/ucd/Unihan-11.0.0d2.zip -- unzip -d Unihan Unihan-*.zip +- wget ftp://ftp.unicode.org/Public/12.1.0/ucd/Unihan.zip +- unzip -d Unihan Unihan*.zip script: - '[[ "$TRAVIS_TAG" = "" ]] || grep "$TRAVIS_TAG" README.md' - '[[ "$TRAVIS_TAG" = "" ]] || grep "${TRAVIS_TAG%-[0-9]*}" .travis.yml' diff --git a/README.md b/README.md index d204230..f68af44 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ To download JSON data files, see the [latest release]. To load them from a web page through XHR or `window.fetch()` function, request the following URI (replace `` with a property name, e.g., `kSimplifiedVariant`): - https://dahlia.github.io/unihan-json/11.0.0d2-0/.json + https://dahlia.github.io/unihan-json/12.1.0/.json Each JSON file corresponds to a property, and is an object which represents a table from Unicode characters to values for the property. For example, diff --git a/process.py b/process.py index 7d36cc8..ebd774a 100755 --- a/process.py +++ b/process.py @@ -81,7 +81,7 @@ def parse_ints(entries: str) -> List[int]: 'kOtherNumeric': int, 'kPrimaryNumeric': int, 'kSimplifiedVariant': parse_unicode_points, - 'kTaiwanTelegraph': int, + 'kTaiwanTelegraph': parse_ints, 'kTang': str.split, 'kTotalStrokes': parse_ints, 'kTraditionalVariant': parse_unicode_points, @@ -149,7 +149,14 @@ def flush(self) -> Iterator[Tuple[str, pathlib.Path]]: except ValueError as e: raise ValueError(f'{e}: {line!r}') char = parse_unicode_point(code) - parsed_value = parse_value(value) + try: + parsed_value = parse_value(value) + except Exception as e: + self.logger.exception( + 'Failed to parse %s property (%r): %s', + prop, value, e + ) + raise if first: wf('\n') first = False