(self, path_replacements)
Build the set of path replacements used for template tree walking.

    Augments a default list of path replacements with a caller provided set.
    Side effects: Sets self._path_replacements.

    Args:
      path_replacements: (dict) caller provided dict holding elements which
        should be replaced if found in a path.
Build the set of path replacements used for template tree walking.
Build the set of path replacements used for template tree walking .
def _BuildPathReplacements(self, path_replacements):
    """Build the set of path replacements used for template tree walking.

    Augments a default list of path replacements with a caller provided set.
    Side effects: Sets self._path_replacements.

    Args:
      path_replacements: (dict) caller provided dict holding elements which
        should be replaced if found in a path.
    """
    self._path_replacements = {
        '___package___': self._api.module.path,
        '___package_name___': self._api.module.name,
        '___language___': self._language,
        # language version will in practice be set, because it
        # comes from features, but may not be in some unit tests.
        '___language_version___': self.language_version or '',
        }

    for key, value in self.features.iteritems():
      if isinstance(value, (unicode, str)):
        self._path_replacements['___features_%s___' % key] = value

    if not isinstance(self._api.values['revision'], (unicode, str)):
        # Make sure revision is a string
      self._path_replacements['___api_revision___'] = str(
          self._api.values['revision'])

    for key, value in self._api.values.iteritems():
      if isinstance(value, (unicode, str)):
        self._path_replacements['___api_%s___' % key] = value

    self._path_replacements.update(path_replacements or {})
def _BuildPathReplacements ( self , path_replacements ) : self . _path_replacements = { '___package___' : self . _api . module . path , '___package_name___' : self . _api . module . name , '___language___' : self . _language , # language version will in practice be set, because it # comes from features, but may not be in some unit tests. '___language_version___' : self . language_version or '' , } for key , value in self . features . iteritems ( ) : if isinstance ( value , ( unicode , str ) ) : self . _path_replacements [ '___features_%s___' % key ] = value if not isinstance ( self . _api . values [ 'revision' ] , ( unicode , str ) ) : # Make sure revision is a string self . _path_replacements [ '___api_revision___' ] = str ( self . _api . values [ 'revision' ] ) for key , value in self . _api . values . iteritems ( ) : if isinstance ( value , ( unicode , str ) ) : self . _path_replacements [ '___api_%s___' % key ] = value self . _path_replacements . update ( path_replacements or { } )