Skip to content

Commit

Permalink
Merge pull request #1 from bosondata/upgrade/v0.2
Browse files Browse the repository at this point in the history
更新行政区域代码201801
  • Loading branch information
cockcrow committed Apr 17, 2019
2 parents e8abb37 + f6b6378 commit 8e2490e
Show file tree
Hide file tree
Showing 30 changed files with 918 additions and 342 deletions.
5 changes: 2 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[bumpversion]
files = setup.py gb2260/__init__.py
files = setup.py gb2260_v2/__init__.py
commit = True
tag = True
current_version = 0.4.1

current_version = 0.2.0
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = gb2260_v2/data/*
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ __pycache__
/build
/dist
/htmlcov
/gb2260/data.py
/.idea
/.python-version
.pytest_cache/
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "data"]
path = data
url = https://github.com/cn/GB2260.git
path = data
url = https://github.com/cn/GB2260.git
branch = develop
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ python:
- "2.7"
- "3.3"
- "3.4"
- "3.7"
- "pypy"
install:
- "pip install pytest pytest-cov pytest-pep8 coveralls"
- "pip install pytest pytest-cov pytest-pep8 pytest-mock coveralls"
script: "make clean test"
after_success: "coveralls"
branches:
Expand Down
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ TOX := tox

all: build

build: gb2260/data.py
build: gb2260_v2/data/__init__.py
$(PYTHON) setup.py sdist bdist_wheel

test: gb2260/data.py
test: gb2260_v2/data/__init__.py
$(PYTEST)

test-all: gb2260/data.py
test-all: gb2260_v2/data/__init__.py
$(TOX)

clean:
rm -rf dist build gb2260/data.py
rm -rf dist build *.egg-info gb2260_v2/data/

gb2260/data.py: data/GB2260*.txt
$(PYTHON) generate.py $? $@

data/GB2260*.txt:
git submodule init
git submodule update
gb2260_v2/data/__init__.py: data/revisions.json
$(PYTHON) generate.py $?
2 changes: 1 addition & 1 deletion data
Submodule data updated 118 files
6 changes: 6 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-e.

pytest
pytest-cov
pytest-pep8
pytest-mock
1 change: 0 additions & 1 deletion gb2260/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions gb2260/__init__.py

This file was deleted.

25 changes: 0 additions & 25 deletions gb2260/_compat.py

This file was deleted.

128 changes: 0 additions & 128 deletions gb2260/division.py

This file was deleted.

1 change: 1 addition & 0 deletions gb2260_v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/
19 changes: 19 additions & 0 deletions gb2260_v2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import, unicode_literals

from gb2260_v2.exceptions import (
GB2260Exception,
InvalidCode,
RevisionNotFound,
SourceNotFound,
)
from gb2260_v2.gb2260 import GB2260

__all__ = [
'GB2260',
'GB2260Exception',
'InvalidCode',
'RevisionNotFound',
'SourceNotFound',
]
35 changes: 35 additions & 0 deletions gb2260_v2/_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import, unicode_literals

import sys

PY2 = sys.version_info[0] == 2

if PY2:
text_type = unicode
binary_type = str

def iteritems(d):
return d.iteritems()
else:
text_type = str
binary_type = bytes

def iteritems(d):
return d.items()


def ensure_text(value, encoding):
if isinstance(value, text_type):
return value
return value.decode(encoding)


def ensure_str(value, encoding):
if isinstance(value, str):
return value
if PY2:
return value.encode(encoding)
else:
return value.decode(encoding)
Loading

0 comments on commit 8e2490e

Please sign in to comment.