iptocc 3.3.45__tar.gz → 3.3.47__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iptocc-3.3.45 → iptocc-3.3.47}/Cargo.lock +13 -14
- {iptocc-3.3.45 → iptocc-3.3.47}/PKG-INFO +1 -1
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/Cargo.toml +2 -2
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/src/lib.rs +2 -4
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/Cargo.toml +1 -1
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/README.md +5 -6
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/data/v4.bin +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/data/v6.bin +80 -78
- {iptocc-3.3.45 → iptocc-3.3.47}/pyproject.toml +1 -1
- {iptocc-3.3.45 → iptocc-3.3.47}/Cargo.toml +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/LICENSE-APACHE +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/LICENSE-MIT +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/README.md +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/LICENSE-APACHE +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/LICENSE-MIT +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/README.md +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/benchmarks/bench_lookup.py +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/tests/test_api.py +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/bindings/python/uv.lock +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/LICENSE-APACHE +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/LICENSE-MIT +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/benches/lookup.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/bin/generate-data.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/format.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/lib.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/src/main.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/crate/tests/api.rs +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/python/iptocc/__init__.py +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/python/iptocc/cli.py +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/python/iptocc/iptocc.pyi +0 -0
- {iptocc-3.3.45 → iptocc-3.3.47}/python/iptocc/py.typed +0 -0
|
@@ -350,7 +350,7 @@ dependencies = [
|
|
|
350
350
|
|
|
351
351
|
[[package]]
|
|
352
352
|
name = "iptocc"
|
|
353
|
-
version = "1.4.
|
|
353
|
+
version = "1.4.47"
|
|
354
354
|
dependencies = [
|
|
355
355
|
"clap",
|
|
356
356
|
"criterion",
|
|
@@ -359,7 +359,7 @@ dependencies = [
|
|
|
359
359
|
|
|
360
360
|
[[package]]
|
|
361
361
|
name = "iptocc-py"
|
|
362
|
-
version = "3.3.
|
|
362
|
+
version = "3.3.47"
|
|
363
363
|
dependencies = [
|
|
364
364
|
"iptocc",
|
|
365
365
|
"pyo3",
|
|
@@ -367,7 +367,7 @@ dependencies = [
|
|
|
367
367
|
|
|
368
368
|
[[package]]
|
|
369
369
|
name = "iptocc-wasm"
|
|
370
|
-
version = "1.3.
|
|
370
|
+
version = "1.3.47"
|
|
371
371
|
dependencies = [
|
|
372
372
|
"iptocc",
|
|
373
373
|
"js-sys",
|
|
@@ -514,9 +514,9 @@ dependencies = [
|
|
|
514
514
|
|
|
515
515
|
[[package]]
|
|
516
516
|
name = "pyo3"
|
|
517
|
-
version = "0.
|
|
517
|
+
version = "0.29.0"
|
|
518
518
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
519
|
-
checksum = "
|
|
519
|
+
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
|
520
520
|
dependencies = [
|
|
521
521
|
"libc",
|
|
522
522
|
"once_cell",
|
|
@@ -528,18 +528,18 @@ dependencies = [
|
|
|
528
528
|
|
|
529
529
|
[[package]]
|
|
530
530
|
name = "pyo3-build-config"
|
|
531
|
-
version = "0.
|
|
531
|
+
version = "0.29.0"
|
|
532
532
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
533
|
-
checksum = "
|
|
533
|
+
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
|
534
534
|
dependencies = [
|
|
535
535
|
"target-lexicon",
|
|
536
536
|
]
|
|
537
537
|
|
|
538
538
|
[[package]]
|
|
539
539
|
name = "pyo3-ffi"
|
|
540
|
-
version = "0.
|
|
540
|
+
version = "0.29.0"
|
|
541
541
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
542
|
-
checksum = "
|
|
542
|
+
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
|
543
543
|
dependencies = [
|
|
544
544
|
"libc",
|
|
545
545
|
"pyo3-build-config",
|
|
@@ -547,9 +547,9 @@ dependencies = [
|
|
|
547
547
|
|
|
548
548
|
[[package]]
|
|
549
549
|
name = "pyo3-macros"
|
|
550
|
-
version = "0.
|
|
550
|
+
version = "0.29.0"
|
|
551
551
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
552
|
-
checksum = "
|
|
552
|
+
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
|
553
553
|
dependencies = [
|
|
554
554
|
"proc-macro2",
|
|
555
555
|
"pyo3-macros-backend",
|
|
@@ -559,13 +559,12 @@ dependencies = [
|
|
|
559
559
|
|
|
560
560
|
[[package]]
|
|
561
561
|
name = "pyo3-macros-backend"
|
|
562
|
-
version = "0.
|
|
562
|
+
version = "0.29.0"
|
|
563
563
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
564
|
-
checksum = "
|
|
564
|
+
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
|
565
565
|
dependencies = [
|
|
566
566
|
"heck",
|
|
567
567
|
"proc-macro2",
|
|
568
|
-
"pyo3-build-config",
|
|
569
568
|
"quote",
|
|
570
569
|
"syn",
|
|
571
570
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "iptocc-py"
|
|
3
3
|
description = "Python bindings for iptocc, a fast IP-to-country lookup library written in Rust"
|
|
4
|
-
version = "3.3.
|
|
4
|
+
version = "3.3.47"
|
|
5
5
|
edition.workspace = true
|
|
6
6
|
license.workspace = true
|
|
7
7
|
repository.workspace = true
|
|
@@ -16,4 +16,4 @@ crate-type = ["cdylib"]
|
|
|
16
16
|
|
|
17
17
|
[dependencies]
|
|
18
18
|
iptocc = { path = "../../crate" }
|
|
19
|
-
pyo3 = { version = "=0.
|
|
19
|
+
pyo3 = { version = "=0.29.0", features = ["extension-module", "abi3-py310"] }
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
#![allow(deprecated)]
|
|
2
|
-
|
|
3
1
|
use pyo3::prelude::*;
|
|
4
2
|
use pyo3::types::PyString;
|
|
5
3
|
|
|
@@ -10,14 +8,14 @@ use pyo3::types::PyString;
|
|
|
10
8
|
/// of `str | None` with one entry per input in order.
|
|
11
9
|
#[pyfunction]
|
|
12
10
|
fn country_code<'py>(py: Python<'py>, input: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyAny>> {
|
|
13
|
-
if let Ok(pystr) = input.
|
|
11
|
+
if let Ok(pystr) = input.cast::<PyString>() {
|
|
14
12
|
return Ok(::iptocc::country_code(pystr.to_str()?).into_pyobject(py)?.into_any());
|
|
15
13
|
}
|
|
16
14
|
let len_hint = input.len().unwrap_or(0);
|
|
17
15
|
let mut results: Vec<Option<&'static str>> = Vec::with_capacity(len_hint);
|
|
18
16
|
for item in input.try_iter()? {
|
|
19
17
|
let item = item?;
|
|
20
|
-
let s = item.
|
|
18
|
+
let s = item.cast::<PyString>()?.to_str()?;
|
|
21
19
|
results.push(::iptocc::country_code(s));
|
|
22
20
|
}
|
|
23
21
|
Ok(results.into_pyobject(py)?.into_any())
|
|
@@ -34,12 +34,11 @@ cargo add iptocc
|
|
|
34
34
|
```rust
|
|
35
35
|
use iptocc::{country_code, country_codes};
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
country_code("8.8.8.8"); // Some("US")
|
|
38
|
+
country_code("2001:4860:4860::8888"); // Some("US")
|
|
39
|
+
country_code("10.0.0.0"); // None
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
assert_eq!(codes, vec![Some("US"), Some("JP")]);
|
|
41
|
+
country_codes(["8.8.8.8", "1.0.16.1"]); // vec![Some("US"), Some("JP")]
|
|
43
42
|
```
|
|
44
43
|
|
|
45
44
|
Typed inputs are also accepted and skip the string parsing step:
|
|
@@ -48,7 +47,7 @@ Typed inputs are also accepted and skip the string parsing step:
|
|
|
48
47
|
use std::net::Ipv4Addr;
|
|
49
48
|
use iptocc::country_code;
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
country_code(Ipv4Addr::new(8, 8, 8, 8)); // Some("US")
|
|
52
51
|
```
|
|
53
52
|
|
|
54
53
|
A CLI is installed by `cargo install iptocc`:
|
|
Binary file
|