rename 'restrictions' to the more appropriate 'permissions' in the code
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 25 May 2008 00:47:41 +0000 (02:47 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Sun, 25 May 2008 00:47:41 +0000 (02:47 +0200)
db2bin.py
dbparse.py

index 6d3b972..cda80bd 100755 (executable)
--- a/db2bin.py
+++ b/db2bin.py
@@ -11,14 +11,14 @@ VERSION = 19
 def create_rules(countries):
     result = {}
     for c in countries.itervalues():
-        for rule in c.restrictions:
+        for rule in c.permissions:
             result[rule] = 1
     return result.keys()
 
 def create_collections(countries):
     result = {}
     for c in countries.itervalues():
-        result[c.restrictions] = 1
+        result[c.permissions] = 1
     return result.keys()
 
 
@@ -48,7 +48,7 @@ countries = p.parse(file('db.txt'))
 power = {}
 bands = {}
 for c in countries.itervalues():
-    for b, p in c.restrictions:
+    for b, p in c.permissions:
         bands[b] = b
         power[p] = p
 rules = create_rules(countries)
@@ -115,7 +115,7 @@ countrynames.sort()
 for alpha2 in countrynames:
     coll = countries[alpha2]
     # struct regdb_file_reg_country
-    output.write(struct.pack('>ccxxI', str(alpha2[0]), str(alpha2[1]), reg_rules_collections[coll.restrictions]))
+    output.write(struct.pack('>ccxxI', str(alpha2[0]), str(alpha2[1]), reg_rules_collections[coll.permissions]))
 
 # Load RSA only now so people can use this script
 # without having those libraries installed to verify
index e597c16..28ea032 100644 (file)
@@ -65,27 +65,27 @@ class PowerRestriction(object):
                      s.max_ir_ptp, s.max_eirp_ptmp, s.max_eirp_ptp))
 
 class Country(object):
-    def __init__(self, restrictions=None, comments=None):
+    def __init__(self, permissions=None, comments=None):
         # tuple of (freqband, powerrestriction)
-        self._restrictions = restrictions or []
+        self._permissions = permissions or []
         self.comments = comments or []
 
     def add(self, band, power):
         assert isinstance(band, FreqBand)
         assert isinstance(power, PowerRestriction)
-        self._restrictions.append((band, power))
-        self._restrictions.sort()
+        self._permissions.append((band, power))
+        self._permissions.sort()
 
     def __contains__(self, tup):
-        return tup in self._restrictions
+        return tup in self._permissions
 
     def __str__(self):
-        r = ['(%s, %s)' % (str(b), str(p)) for b, p in self._restrictions]
+        r = ['(%s, %s)' % (str(b), str(p)) for b, p in self._permissions]
         return '<Country (%s)>' % (', '.join(r))
 
-    def _get_restrictions_tuple(self):
-        return tuple(self._restrictions)
-    restrictions = property(_get_restrictions_tuple)
+    def _get_permissions_tuple(self):
+        return tuple(self._permissions)
+    permissions = property(_get_permissions_tuple)
 
 class SyntaxError(Exception):
     pass