(self)
Compute and set the module(s) which this API belongs under.
Compute and set the module(s) which this API belongs under.
Compute and set the module ( s ) which this API belongs under .
def _SetupModules(self):
    """Compute and set the module(s) which this API belongs under."""
    # The containing module is based on the owner information.
    path = self.values.get('modulePath') or self.values.get('packagePath')
    self._containing_module = template_objects.Module(
        package_path=path,
        owner_name=self.values.get('owner'),
        owner_domain=self.values.get('ownerDomain'))
    self.SetTemplateValue('containingModule', self._containing_module)

    # The API is a child of the containing_module
    base = self.values['name']
    # TODO(user): Introduce a breaking change where we always prefer
    # canonicalName.
    if self.values.get('packagePath'):
      # Lowercase the canonical name only for non-cloud-endpoints Google APIs.
      # This is to avoid breaking changes to existing Google-owned Cloud
      # Endpoints APIs.
      if self.values.get('rootUrl').find('.googleapis.com') > 0:
        base = self.values.get('canonicalName').lower() or base
      else:
        base = self.values.get('canonicalName') or base
    if self.values.get('version_module'):
      base = '%s/%s' % (base, self.values['versionNoDots'])
    self._module = template_objects.Module(package_path=base,
                                           parent=self._containing_module)
    self.SetTemplateValue('module', self._module)

    # The default module for data models defined by this API.
    self._model_module = template_objects.Module(package_path=None,
                                                 parent=self._module)
def _SetupModules ( self ) : # The containing module is based on the owner information. path = self . values . get ( 'modulePath' ) or self . values . get ( 'packagePath' ) self . _containing_module = template_objects . Module ( package_path = path , owner_name = self . values . get ( 'owner' ) , owner_domain = self . values . get ( 'ownerDomain' ) ) self . SetTemplateValue ( 'containingModule' , self . _containing_module ) # The API is a child of the containing_module base = self . values [ 'name' ] # TODO(user): Introduce a breaking change where we always prefer # canonicalName. if self . values . get ( 'packagePath' ) : # Lowercase the canonical name only for non-cloud-endpoints Google APIs. # This is to avoid breaking changes to existing Google-owned Cloud # Endpoints APIs. if self . values . get ( 'rootUrl' ) . find ( '.googleapis.com' ) > 0 : base = self . values . get ( 'canonicalName' ) . lower ( ) or base else : base = self . values . get ( 'canonicalName' ) or base if self . values . get ( 'version_module' ) : base = '%s/%s' % ( base , self . values [ 'versionNoDots' ] ) self . _module = template_objects . Module ( package_path = base , parent = self . _containing_module ) self . SetTemplateValue ( 'module' , self . _module ) # The default module for data models defined by this API. self . _model_module = template_objects . Module ( package_path = None , parent = self . _module )