Lichen

Changeset

85:a31283db845b
2016-10-06 Paul Boddie raw files shortlog changelog graph Moved a general path-making function to the common module.
common.py (file) deducer.py (file)
     1.1 --- a/common.py	Fri Oct 07 21:18:06 2016 +0200
     1.2 +++ b/common.py	Thu Oct 06 14:29:02 2016 +0200
     1.3 @@ -802,6 +802,15 @@
     1.4      path, name, attrnames, access = location
     1.5      return get_attrnames(attrnames)[0]
     1.6  
     1.7 +def get_name_path(path, name):
     1.8 +
     1.9 +    "Return a suitable qualified name from the given 'path' and 'name'."
    1.10 +
    1.11 +    if "." in name:
    1.12 +        return name
    1.13 +    else:
    1.14 +        return "%s.%s" % (path, name)
    1.15 +
    1.16  # Useful data.
    1.17  
    1.18  predefined_constants = "False", "None", "NotImplemented", "True"
     2.1 --- a/deducer.py	Fri Oct 07 21:18:06 2016 +0200
     2.2 +++ b/deducer.py	Thu Oct 06 14:29:02 2016 +0200
     2.3 @@ -20,7 +20,7 @@
     2.4  """
     2.5  
     2.6  from common import first, get_attrname_from_location, get_attrnames, \
     2.7 -                   init_item, make_key, sorted_output, \
     2.8 +                   get_name_path, init_item, make_key, sorted_output, \
     2.9                     CommonOutput
    2.10  from encoders import encode_attrnames, encode_access_location, \
    2.11                       encode_constrained, encode_location, encode_usage, \
    2.12 @@ -1271,7 +1271,7 @@
    2.13  
    2.14          # Obtain references to known objects.
    2.15  
    2.16 -        path = self.get_name_path(unit_path, name)
    2.17 +        path = get_name_path(unit_path, name)
    2.18  
    2.19          class_types, only_instance_types, module_types, constrained_specific = \
    2.20              self.constrain_types(path, class_types, only_instance_types, module_types)
    2.21 @@ -1547,7 +1547,7 @@
    2.22          """
    2.23  
    2.24          location, name, attrnames, version = access_location
    2.25 -        path = self.get_name_path(location, name)
    2.26 +        path = get_name_path(location, name)
    2.27  
    2.28          # Use initialiser information, if available.
    2.29  
    2.30 @@ -1557,15 +1557,6 @@
    2.31          else:
    2.32              return None
    2.33  
    2.34 -    def get_name_path(self, path, name):
    2.35 -
    2.36 -        "Return a suitable qualified name from the given 'path' and 'name'."
    2.37 -
    2.38 -        if "." in name:
    2.39 -            return name
    2.40 -        else:
    2.41 -            return "%s.%s" % (path, name)
    2.42 -
    2.43      def record_reference_types(self, location, class_types, instance_types,
    2.44          module_types, constrained, constrained_specific=False):
    2.45