Skip to content

Commit

Permalink
Merge pull request #27 from lindera/lint
Browse files Browse the repository at this point in the history
Fix lint
  • Loading branch information
mosuka authored Nov 23, 2024
2 parents 6680cb6 + c1e54e1 commit 94beaef
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- runner: windows-latest
target: x86_64-pc-windows-msvc
toolchain: [stable, beta, nightly]
features: ["ipadic", "ko-dic", "cc-cedict"]
features: [cjk]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- runner: ubuntu-latest
target: x86_64
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
features: [cjk]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
Expand All @@ -40,7 +40,7 @@ jobs:
- runner: ubuntu-latest
target: x86_64
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
features: [cjk]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
- runner: windows-latest
target: x86_64-pc-windows-msvc
toolchain: [stable]
features: ["ipadic", "ko-dic", "cc-cedict"]
features: [cjk]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Run checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter --features=ipadic,ko-dic,cc-cedict
args: --release --out dist --find-interpreter --features=cjk
sccache: 'true'

- name: Upload wheels
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ unidic = ["lindera/unidic"] # Include UniDic dictionary (Japanese)
ko-dic = ["lindera/ko-dic"] # Include ko-dic dictionary (Korean)
cc-cedict = ["lindera/cc-cedict"] # Include CC-CEDICT dictionary (Chinese)
compress = ["lindera/compress"] # Compress dictionaries
cjk = ["ipadic", "ko-dic", "cc-cedict", "compress"] # Include CJK dictionary (Chinese, Japanese, Korean)

[dependencies]
pyo3 = { version = "0.23.1", features = ["extension-module"] }
Expand Down
8 changes: 4 additions & 4 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn pydict_to_value(pydict: &Bound<'_, PyDict>) -> PyResult<Value> {
pub fn value_to_pydict(py: Python, value: &Value) -> PyResult<PyObject> {
match value {
Value::Null => Ok(py.None()),
Value::Bool(b) => Ok(PyBool::new_bound(py, *b).into_py(py)),
Value::Bool(b) => Ok(PyBool::new(py, *b).into_py(py)),
Value::Number(num) => {
if let Some(i) = num.as_i64() {
Ok(i.into_py(py))
Expand All @@ -57,16 +57,16 @@ pub fn value_to_pydict(py: Python, value: &Value) -> PyResult<PyObject> {
Err(PyTypeError::new_err("Unsupported number type"))
}
}
Value::String(s) => Ok(PyString::new_bound(py, s).into_py(py)),
Value::String(s) => Ok(PyString::new(py, s).into_py(py)),
Value::Array(arr) => {
let py_list = PyList::empty_bound(py);
let py_list = PyList::empty(py);
for item in arr {
py_list.append(value_to_pydict(py, item)?)?;
}
Ok(py_list.into())
}
Value::Object(obj) => {
let py_dict = PyDict::new_bound(py);
let py_dict = PyDict::new(py);
for (key, val) in obj {
py_dict.set_item(key, value_to_pydict(py, val)?)?;
}
Expand Down

0 comments on commit 94beaef

Please sign in to comment.