Commit 627518a
committed
refactor: Rewrite the function
- Removed the unnecessary `refresh` argument since it wasn't used.
- Used `None` checks more idiomatically with `if mac` instead of `is not None`.
- Eliminated redundant variables and conditions to improve readability.
- Avoided using `locals()` by explicitly storing fallback results.
- Made `ifname` matching take priority before checking MAC addresses.
- Ensured that the function returns early when a definitive match is found.SysUtil.link_info_find() in a more pythonic way1 parent e890ab5 commit 627518a
1 file changed
+17
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
| 225 | + | |
| 226 | + | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | 228 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 229 | + | |
| 230 | + | |
236 | 231 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
241 | 235 | | |
242 | | - | |
243 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
244 | 239 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
248 | 246 | | |
249 | | - | |
| 247 | + | |
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
| |||
0 commit comments