소스 검색

get_label now accepts integer and has correct return-type

GammaSQ 5 년 전
부모
커밋
2e637b5631
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      qubesadmin/app.py

+ 2 - 4
qubesadmin/app.py

@@ -216,10 +216,8 @@ class QubesBase(qubesadmin.base.PropertyHolder):
             pass
 
         # then search for index
-        if label.isdigit():
-            for i in self.labels:
-                if i.index == int(label):
-                    return i
+        if type(label) == int or label.isdigit():
+            return self.labels.values[int(label)]
 
         raise KeyError(label)