Skip to content

Commit 3290ab2

Browse files
authored
Merge pull request #4 from martindurant/update_versions
bump version and deps
2 parents 943d6b1 + ed1d81d commit 3290ab2

File tree

3 files changed

+44
-49
lines changed

3 files changed

+44
-49
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "akimbo-ip"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
edition = "2021"
55

66
[lib]
77
name = "akimbo_ip"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
pyo3 = { version = "0.21.0", features = ["extension-module"] }
12-
numpy = "0.21.0"
11+
pyo3 = { version = "0.24.0", features = ["extension-module"] }
12+
numpy = "0.24.0"
1313
ipnet = "2.9.0"
1414
byteorder = { version = "1.5.0", features = ["i128"] }

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "akimbo-ip"
7-
requires-python = ">=3.9"
7+
requires-python = ">=3.10"
88
description = "IP-specific methods for akimbo"
99
readme = "README.md"
1010
license = { file = "LICENSE" }
@@ -13,9 +13,7 @@ classifiers = [
1313
"Programming Language :: Python :: Implementation :: CPython",
1414
"Programming Language :: Python :: Implementation :: PyPy",
1515
]
16-
dependencies = [
17-
"akimbo"
18-
]
16+
dependencies = ["akimbo"]
1917

2018
[tool.maturin]
2119
features = ["pyo3/extension-module"]

src/lib.rs

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn to_text4<'py>(
2828
data.extend(Ipv4Addr::new(a, b, c, d).to_string().as_bytes());
2929
offsets.push(data.len() as u32);
3030
}
31-
Ok((data.into_pyarray_bound(py), offsets.into_pyarray_bound(py)))
31+
Ok((data.into_pyarray(py), offsets.into_pyarray(py)))
3232
}
3333

3434
/// Parse strings into IP4 addresses (length 4 bytestrings)
@@ -51,7 +51,7 @@ fn parse4<'py>(
5151
},
5252
)
5353
.unzip();
54-
Ok((out.into_pyarray_bound(py), valid.into_pyarray_bound(py)))
54+
Ok((out.into_pyarray(py), valid.into_pyarray(py)))
5555
}
5656

5757
#[pyfunction]
@@ -69,7 +69,7 @@ fn to_text6<'py>(
6969
);
7070
offsets.push(data.len() as u32);
7171
}
72-
Ok((data.into_pyarray_bound(py), offsets.into_pyarray_bound(py)))
72+
Ok((data.into_pyarray(py), offsets.into_pyarray(py)))
7373
}
7474

7575
#[pyfunction]
@@ -90,7 +90,7 @@ fn parse6<'py>(
9090
.octets(),
9191
)
9292
}
93-
Ok(out.into_pyarray_bound(py))
93+
Ok(out.into_pyarray(py))
9494
}
9595

9696
/// Parse strings into IP4 networks (length 4 bytestring and 1-byte prefix value)
@@ -112,10 +112,7 @@ fn parsenet4<'py>(
112112
outaddr.push(u32::from_ne_bytes(net.addr().octets()));
113113
outpref.push(net.prefix_len());
114114
}
115-
Ok((
116-
outaddr.into_pyarray_bound(py),
117-
outpref.into_pyarray_bound(py),
118-
))
115+
Ok((outaddr.into_pyarray(py), outpref.into_pyarray(py)))
119116
}
120117

121118
/// Is `other` contained in the address/prefix pairs of the input array?
@@ -136,7 +133,7 @@ fn contains_one4<'py>(
136133
.contains(&Ipv4Addr::from_bits(other))
137134
})
138135
.collect();
139-
Ok(out.into_pyarray_bound(py))
136+
Ok(out.into_pyarray(py))
140137
}
141138

142139
// list of IP4 addresses indicated by each network
@@ -161,7 +158,7 @@ fn hosts4<'py>(
161158
out.extend(hosts.map(|ip| u32::from_ne_bytes(ip.octets())));
162159
offsets.push(out.len() as u64);
163160
}
164-
Ok((out.into_pyarray_bound(py), offsets.into_pyarray_bound(py)))
161+
Ok((out.into_pyarray(py), offsets.into_pyarray(py)))
165162
}
166163

167164
/// the hostmask implied by the given network prefix
@@ -182,7 +179,7 @@ fn hostmask4<'py>(
182179
)
183180
})
184181
.collect();
185-
Ok(out.into_pyarray_bound(py))
182+
Ok(out.into_pyarray(py))
186183
}
187184

188185
/// the netmask implied by the given network prefix
@@ -203,7 +200,7 @@ fn netmask4<'py>(
203200
)
204201
})
205202
.collect();
206-
Ok(out.into_pyarray_bound(py))
203+
Ok(out.into_pyarray(py))
207204
}
208205

209206
/// the base network address of the given network values
@@ -232,7 +229,7 @@ fn network4<'py>(
232229
)
233230
})
234231
.collect();
235-
Ok(out.into_pyarray_bound(py))
232+
Ok(out.into_pyarray(py))
236233
}
237234

238235
/// the highest address of the given network values
@@ -261,7 +258,7 @@ fn broadcast4<'py>(
261258
)
262259
})
263260
.collect();
264-
Ok(out.into_pyarray_bound(py))
261+
Ok(out.into_pyarray(py))
265262
}
266263

267264
#[pyfunction]
@@ -290,7 +287,7 @@ fn trunc4<'py>(
290287
)
291288
})
292289
.collect();
293-
Ok(out.into_pyarray_bound(py))
290+
Ok(out.into_pyarray(py))
294291
}
295292

296293
#[pyfunction]
@@ -320,7 +317,7 @@ fn supernet4<'py>(
320317
)
321318
})
322319
.collect();
323-
Ok(out.into_pyarray_bound(py))
320+
Ok(out.into_pyarray(py))
324321
}
325322

326323
#[pyfunction]
@@ -354,7 +351,7 @@ fn subnets4<'py>(
354351
});
355352
counts.push(count);
356353
});
357-
Ok((out.into_pyarray_bound(py), counts.into_pyarray_bound(py)))
354+
Ok((out.into_pyarray(py), counts.into_pyarray(py)))
358355
}
359356

360357
#[pyfunction]
@@ -398,9 +395,9 @@ fn aggregate4<'py>(
398395
counts.push(count);
399396
}
400397
Ok((
401-
out_addr.into_pyarray_bound(py),
402-
out_pref.into_pyarray_bound(py),
403-
counts.into_pyarray_bound(py),
398+
out_addr.into_pyarray(py),
399+
out_pref.into_pyarray(py),
400+
counts.into_pyarray(py),
404401
))
405402
}
406403

@@ -417,7 +414,7 @@ fn is_broadcast4<'py>(
417414
Ipv4Addr::new(a, b, c, d).is_broadcast()
418415
})
419416
.collect();
420-
Ok(out.into_pyarray_bound(py))
417+
Ok(out.into_pyarray(py))
421418
}
422419

423420
#[pyfunction]
@@ -433,7 +430,7 @@ fn is_global4<'py>(
433430
Ipv4Addr::new(a, b, c, d).is_global()
434431
})
435432
.collect();
436-
Ok(out.into_pyarray_bound(py))
433+
Ok(out.into_pyarray(py))
437434
}
438435

439436
#[pyfunction]
@@ -449,7 +446,7 @@ fn is_unspecified4<'py>(
449446
Ipv4Addr::new(a, b, c, d).is_unspecified()
450447
})
451448
.collect();
452-
Ok(out.into_pyarray_bound(py))
449+
Ok(out.into_pyarray(py))
453450
}
454451

455452
#[pyfunction]
@@ -465,7 +462,7 @@ fn is_loopback4<'py>(
465462
Ipv4Addr::new(a, b, c, d).is_loopback()
466463
})
467464
.collect();
468-
Ok(out.into_pyarray_bound(py))
465+
Ok(out.into_pyarray(py))
469466
}
470467

471468
#[pyfunction]
@@ -481,7 +478,7 @@ fn is_private4<'py>(
481478
Ipv4Addr::new(a, b, c, d).is_private()
482479
})
483480
.collect();
484-
Ok(out.into_pyarray_bound(py))
481+
Ok(out.into_pyarray(py))
485482
}
486483

487484
#[pyfunction]
@@ -497,7 +494,7 @@ fn is_link_local4<'py>(
497494
Ipv4Addr::new(a, b, c, d).is_link_local()
498495
})
499496
.collect();
500-
Ok(out.into_pyarray_bound(py))
497+
Ok(out.into_pyarray(py))
501498
}
502499

503500
#[pyfunction]
@@ -513,7 +510,7 @@ fn is_shared4<'py>(
513510
Ipv4Addr::new(a, b, c, d).is_shared()
514511
})
515512
.collect();
516-
Ok(out.into_pyarray_bound(py))
513+
Ok(out.into_pyarray(py))
517514
}
518515

519516
#[pyfunction]
@@ -529,7 +526,7 @@ fn is_benchmarking4<'py>(
529526
Ipv4Addr::new(a, b, c, d).is_benchmarking()
530527
})
531528
.collect();
532-
Ok(out.into_pyarray_bound(py))
529+
Ok(out.into_pyarray(py))
533530
}
534531

535532
#[pyfunction]
@@ -545,7 +542,7 @@ fn is_reserved4<'py>(
545542
Ipv4Addr::new(a, b, c, d).is_reserved()
546543
})
547544
.collect();
548-
Ok(out.into_pyarray_bound(py))
545+
Ok(out.into_pyarray(py))
549546
}
550547

551548
#[pyfunction]
@@ -561,7 +558,7 @@ fn is_multicast4<'py>(
561558
Ipv4Addr::new(a, b, c, d).is_multicast()
562559
})
563560
.collect();
564-
Ok(out.into_pyarray_bound(py))
561+
Ok(out.into_pyarray(py))
565562
}
566563

567564
#[pyfunction]
@@ -577,7 +574,7 @@ fn is_documentation4<'py>(
577574
Ipv4Addr::new(a, b, c, d).is_documentation()
578575
})
579576
.collect();
580-
Ok(out.into_pyarray_bound(py))
577+
Ok(out.into_pyarray(py))
581578
}
582579

583580
#[pyfunction]
@@ -593,7 +590,7 @@ fn is_benchmarking6<'py>(
593590
Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_benchmarking()
594591
})
595592
.collect();
596-
Ok(out.into_pyarray_bound(py))
593+
Ok(out.into_pyarray(py))
597594
}
598595

599596
#[pyfunction]
@@ -609,7 +606,7 @@ fn is_documentation6<'py>(
609606
Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_documentation()
610607
})
611608
.collect();
612-
Ok(out.into_pyarray_bound(py))
609+
Ok(out.into_pyarray(py))
613610
}
614611

615612
#[pyfunction]
@@ -623,7 +620,7 @@ fn is_global6<'py>(
623620
.chunks_exact(16)
624621
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_global())
625622
.collect();
626-
Ok(out.into_pyarray_bound(py))
623+
Ok(out.into_pyarray(py))
627624
}
628625

629626
#[pyfunction]
@@ -637,7 +634,7 @@ fn is_ipv4_mapped<'py>(
637634
.chunks_exact(16)
638635
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_ipv4_mapped())
639636
.collect();
640-
Ok(out.into_pyarray_bound(py))
637+
Ok(out.into_pyarray(py))
641638
}
642639

643640
#[pyfunction]
@@ -651,7 +648,7 @@ fn is_loopback6<'py>(
651648
.chunks_exact(16)
652649
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_loopback())
653650
.collect();
654-
Ok(out.into_pyarray_bound(py))
651+
Ok(out.into_pyarray(py))
655652
}
656653

657654
#[pyfunction]
@@ -665,7 +662,7 @@ fn is_multicast6<'py>(
665662
.chunks_exact(16)
666663
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_multicast())
667664
.collect();
668-
Ok(out.into_pyarray_bound(py))
665+
Ok(out.into_pyarray(py))
669666
}
670667

671668
#[pyfunction]
@@ -679,7 +676,7 @@ fn is_unicast6<'py>(
679676
.chunks_exact(16)
680677
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_unicast())
681678
.collect();
682-
Ok(out.into_pyarray_bound(py))
679+
Ok(out.into_pyarray(py))
683680
}
684681

685682
#[pyfunction]
@@ -695,7 +692,7 @@ fn is_unicast_link_local<'py>(
695692
Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_unicast_link_local()
696693
})
697694
.collect();
698-
Ok(out.into_pyarray_bound(py))
695+
Ok(out.into_pyarray(py))
699696
}
700697

701698
#[pyfunction]
@@ -711,7 +708,7 @@ fn is_unique_local<'py>(
711708
Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_unique_local()
712709
})
713710
.collect();
714-
Ok(out.into_pyarray_bound(py))
711+
Ok(out.into_pyarray(py))
715712
}
716713

717714
#[pyfunction]
@@ -725,7 +722,7 @@ fn is_unspecified6<'py>(
725722
.chunks_exact(16)
726723
.map(|sl| Ipv6Addr::from_bits(u128::from_be_bytes(sl.try_into().unwrap())).is_unspecified())
727724
.collect();
728-
Ok(out.into_pyarray_bound(py))
725+
Ok(out.into_pyarray(py))
729726
}
730727

731728
#[pyfunction]
@@ -738,7 +735,7 @@ fn to_ipv6_mapped<'py>(
738735
let bit = Ipv4Addr::from(x).to_ipv6_mapped().octets();
739736
out.extend(bit);
740737
}
741-
Ok(out.into_pyarray_bound(py))
738+
Ok(out.into_pyarray(py))
742739
}
743740

744741
#[pymodule]

0 commit comments

Comments
 (0)