aboutsummaryrefslogtreecommitdiff
path: root/py11/attributes.py
diff options
context:
space:
mode:
Diffstat (limited to 'py11/attributes.py')
-rw-r--r--py11/attributes.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/py11/attributes.py b/py11/attributes.py
index 00af79c..7c90768 100644
--- a/py11/attributes.py
+++ b/py11/attributes.py
@@ -48,24 +48,14 @@ class Attribute_biginteger(Attribute):
class AttributeDB(object):
- def __init__(self, initializer = None):
+ def __init__(self):
+ from .attribute_map import attribute_map
self.db = {}
- if isinstance(initializer, str):
- initializer = self.parse_yaml(initializer)
- for attribute_name, type_name in initializer:
+ for attribute_name, type_name in attribute_map.iteritems():
a = Attribute.new(attribute_name, type_name)
self.db[a.name] = a
self.db[a.code] = a
- @staticmethod
- def parse_yaml(yaml_filename):
- from yaml import safe_load
- with open(yaml_filename) as f:
- for y in safe_load(f):
- for k, v in y.iteritems():
- if k.startswith("CKA_") and "type" in v:
- yield k, v["type"]
-
def encode(self, k, v):
return self.db[k].encode(v) if k in self.db else v