Skip to content

Commit 3f7cf1d

Browse files
authored
fix formatting (#101)
1 parent 3122cd2 commit 3f7cf1d

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/lib.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use ahash::AHasher;
22
use mac_address::get_mac_address;
33
use pyo3::{
4-
prelude::*, ffi,
54
exceptions::{PyOSError, PyTypeError, PyValueError},
5+
ffi,
6+
prelude::*,
67
pyclass::CompareOp,
78
types::{PyBytes, PyDict},
8-
IntoPyObjectExt
9+
IntoPyObjectExt,
910
};
1011
use std::{
1112
hash::{Hash, Hasher},
@@ -147,10 +148,8 @@ impl UUID {
147148
fn bytes_le<'py>(&self, py: Python<'py>) -> Bound<'py, PyBytes> {
148149
let b = self.uuid.as_bytes();
149150
let bytes: [u8; 16] = [
150-
b[3], b[2], b[1], b[0],
151-
b[5], b[4],
152-
b[7], b[6],
153-
b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15],
151+
b[3], b[2], b[1], b[0], b[5], b[4], b[7], b[6], b[8], b[9], b[10], b[11], b[12], b[13],
152+
b[14], b[15],
154153
];
155154
PyBytes::new(py, &bytes)
156155
}
@@ -231,11 +230,9 @@ impl UUID {
231230
let (secs, nanos) = timestamp.to_unix();
232231
Ok(secs * 1_000 + nanos as u64 / 1_000 / 1_000)
233232
}
234-
_ => {
235-
Err(PyErr::new::<PyValueError, &str>(
236-
"UUID version should be one of (v1, v6 or v7).",
237-
))
238-
}
233+
_ => Err(PyErr::new::<PyValueError, &str>(
234+
"UUID version should be one of (v1, v6 or v7).",
235+
)),
239236
}
240237
}
241238

@@ -287,11 +284,8 @@ impl UUID {
287284
let node = fields.5 as u128;
288285
let clock_seq = clock_seq_hi_variant << 8 | clock_seq_low;
289286

290-
let value = time_low << 96
291-
| time_mid << 80
292-
| time_hi_version << 64
293-
| clock_seq << 48
294-
| node;
287+
let value =
288+
time_low << 96 | time_mid << 80 | time_hi_version << 64 | clock_seq << 48 | node;
295289

296290
Ok(UUID {
297291
uuid: Uuid::from_u128(value),

tests/test_uuid.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,15 @@ def test_uuid_comparisons() -> None:
130130

131131
assert uuid_1 < uuid_2
132132
assert uuid_1 <= uuid_2
133+
assert uuid_1 != uuid_2
134+
assert uuid_2 > uuid_1
135+
assert uuid_2 >= uuid_1
133136

134137
uuid_1 = uuid_utils.uuid8(b"1234567812345678")
135138
uuid_2 = uuid_utils.uuid8(b"1234567812345678")
136139

137140
assert uuid_1 == uuid_2
138141
assert hash(uuid_1) == hash(uuid_2)
139-
assert uuid_1 == uuid_2
140-
141-
uuid_1 = uuid_utils.uuid8(b"1234567812345678")
142-
uuid_2 = uuid_utils.uuid8(b"1234567812345677")
143-
144-
assert uuid_1 > uuid_2
145-
assert uuid_1 >= uuid_2
146142

147143

148144
@pytest.mark.parametrize("version", [1, 2, 3, 4, 5, 7, 8])

0 commit comments

Comments
 (0)