Skip to content

Commit 5086669

Browse files
authored
refactor: Use pyclass(get_all) for cleaner code (#158)
1 parent f4e27ea commit 5086669

File tree

3 files changed

+48
-49
lines changed

3 files changed

+48
-49
lines changed

python/Cargo.lock

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/src/geo.rs

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,55 @@ use async_tiff::geo::GeoKeyDirectory;
22
use pyo3::prelude::*;
33
use pyo3::IntoPyObjectExt;
44

5-
#[pyclass(name = "GeoKeyDirectory", frozen, eq)]
5+
#[pyclass(name = "GeoKeyDirectory", frozen, eq, get_all)]
66
#[derive(PartialEq)]
77
pub(crate) struct PyGeoKeyDirectory {
8-
#[pyo3(get)]
98
model_type: Option<u16>,
10-
#[pyo3(get)]
119
raster_type: Option<u16>,
12-
#[pyo3(get)]
1310
citation: Option<String>,
14-
#[pyo3(get)]
1511
geographic_type: Option<u16>,
16-
#[pyo3(get)]
1712
geog_citation: Option<String>,
18-
#[pyo3(get)]
1913
geog_geodetic_datum: Option<u16>,
20-
#[pyo3(get)]
2114
geog_prime_meridian: Option<u16>,
22-
#[pyo3(get)]
2315
geog_linear_units: Option<u16>,
24-
#[pyo3(get)]
2516
geog_linear_unit_size: Option<f64>,
26-
#[pyo3(get)]
2717
geog_angular_units: Option<u16>,
28-
#[pyo3(get)]
2918
geog_angular_unit_size: Option<f64>,
30-
#[pyo3(get)]
3119
geog_ellipsoid: Option<u16>,
32-
#[pyo3(get)]
3320
geog_semi_major_axis: Option<f64>,
34-
#[pyo3(get)]
3521
geog_semi_minor_axis: Option<f64>,
36-
#[pyo3(get)]
3722
geog_inv_flattening: Option<f64>,
38-
#[pyo3(get)]
3923
geog_azimuth_units: Option<u16>,
40-
#[pyo3(get)]
4124
geog_prime_meridian_long: Option<f64>,
4225

43-
#[pyo3(get)]
4426
projected_type: Option<u16>,
45-
#[pyo3(get)]
4627
proj_citation: Option<String>,
47-
#[pyo3(get)]
4828
projection: Option<u16>,
49-
#[pyo3(get)]
5029
proj_coord_trans: Option<u16>,
51-
#[pyo3(get)]
5230
proj_linear_units: Option<u16>,
53-
#[pyo3(get)]
5431
proj_linear_unit_size: Option<f64>,
55-
#[pyo3(get)]
5632
proj_std_parallel1: Option<f64>,
57-
#[pyo3(get)]
5833
proj_std_parallel2: Option<f64>,
59-
#[pyo3(get)]
6034
proj_nat_origin_long: Option<f64>,
61-
#[pyo3(get)]
6235
proj_nat_origin_lat: Option<f64>,
63-
#[pyo3(get)]
6436
proj_false_easting: Option<f64>,
65-
#[pyo3(get)]
6637
proj_false_northing: Option<f64>,
67-
#[pyo3(get)]
6838
proj_false_origin_long: Option<f64>,
69-
#[pyo3(get)]
7039
proj_false_origin_lat: Option<f64>,
71-
#[pyo3(get)]
7240
proj_false_origin_easting: Option<f64>,
73-
#[pyo3(get)]
7441
proj_false_origin_northing: Option<f64>,
75-
#[pyo3(get)]
7642
proj_center_long: Option<f64>,
77-
#[pyo3(get)]
7843
proj_center_lat: Option<f64>,
79-
#[pyo3(get)]
8044
proj_center_easting: Option<f64>,
81-
#[pyo3(get)]
8245
proj_center_northing: Option<f64>,
83-
#[pyo3(get)]
8446
proj_scale_at_nat_origin: Option<f64>,
85-
#[pyo3(get)]
8647
proj_scale_at_center: Option<f64>,
87-
#[pyo3(get)]
8848
proj_azimuth_angle: Option<f64>,
89-
#[pyo3(get)]
9049
proj_straight_vert_pole_long: Option<f64>,
9150

92-
#[pyo3(get)]
9351
vertical: Option<u16>,
94-
#[pyo3(get)]
9552
vertical_citation: Option<String>,
96-
#[pyo3(get)]
9753
vertical_datum: Option<u16>,
98-
#[pyo3(get)]
9954
vertical_units: Option<u16>,
10055
}
10156

src/ifd.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ impl ImageFileDirectory {
191191

192192
let mut other_tags = HashMap::new();
193193

194-
// for x in tag_data.into_iter() {
195-
196-
// }
197194
tag_data.into_iter().try_for_each(|(tag, value)| {
198195
match tag {
199196
Tag::NewSubfileType => new_subfile_type = Some(value.into_u32()?),

0 commit comments

Comments
 (0)