default to returning a name with `.service`
767475
def _name_helper(name: str):
    
    name = name.rstrip()
    if name.endswith(('.service', '.socket', '.target')):
        return name
    return name + '.service'
11796
function basename(s) {
			if ( s == null ) {
				return "";
			}
			s = String(s);
			return s.slice(1 + s.lastIndexOf('.'));
		}
871813
def param(self, name, default=None):
        ''''''
        if not name in self.params:
            return default
        return self.params[name]
170548
function (service, data) {
  switch (service) {
  case 'gh':
    return data[0].tag_name.replace(/^v/, '');
  case 'npm':
    return data.version;
  case 'gem':
    return data.version;
  case 'bower':
    return data[0].tag_name.replace(/^v/, '');
  default:
    console.log(service + 'not found!');
    break;
  }
}
364291
def service_start(name):
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
    return r['dict']
314422
function getService (name) {
    // get service from global register
    var service = getGlobal().services[name]
    // require service to be defined
    assert(defined(service), `service ${name} not defined`)
    // return service
    return service
}
855382
function(services) {

    return _.map(services, function(service) {

      // Start with a hostnames collector
      var hostnames = [];

      // Handle 'default' key
      if (service.default) {
        hostnames.push(app.name);
      }

      // Handle legacy 'hostname' key
      if (service.hostname) {
        hostnames.push([service.hostname, app.name].join('.'));
      }

      // Handle 'subdomains'
      if (service.subdomains) {
        _.forEach(service.subdomains, function(subdomain) {
          hostnames.push([subdomain, app.name].join('.'));
        });
      }

      // Handle 'custom'
      if (service.custom) {
        _.forEach(service.custom, function(url) {
          hostnames.push(url);
        });
      }

      // Determine whether the protocol is http or https
      var protocol = (service.secure) ? 'https://' : 'http://';

      // Return an array of parsed hostnames
      return _.map(hostnames, function(hostname) {
        return protocol + [hostname, app.domain].join('.');
      });

    });

  }
398317
def load_name(self, load):
        '''
        
        '''
        if 'eauth' not in load:
            return ''
        fstr = '{0}.auth'.format(load['eauth'])
        if fstr not in self.auth:
            return ''
        try:
            pname_arg = salt.utils.args.arg_lookup(self.auth[fstr])['args'][0]
            return load[pname_arg]
        except IndexError:
            return ''
752346
def service(self, name: str = None):
        
        if self._services_initialized:
            from warnings import warn
            warn('Services have already been initialized. Please register '
                 f'{name} sooner.')
            return lambda x: x

        def wrapper(service):
            self.register_service(name, service)
            return service
        return wrapper
1316272
def friendly_name(self):
        """"""
        if len(self._client.get('config').get('name')):
            return self._client.get('config').get('name')
        return self._client.get('host').get('name')
779937
def _generate_name(self, space, service_name, plan_name):
        
        return str.join('-', [space, service_name, plan_name]).lower()
859635
def name(self):
        """"""
        if self._path:
            # follow h5py convention: add leading slash
            name = self._path
            if name[0] != '/':
                name = '/' + name
            return name
        return '/'
819380
function(service) {
      return {
        compose: _.uniq(app.composeCore),
        project: app.name,
        opts: {
          app: app,
          services: [service]
        }
      };
    }
493346
def FieldName(self, name):
        """"""
        # TODO(craigcitro): We shouldn't need to strip this name, but some
        # of the service names here are excessive. Fix the API and then
        # remove this.
        name = self.__StripName(name)
        if self.__name_convention == 'LOWER_CAMEL':
            name = Names.__ToLowerCamel(name)
        elif self.__name_convention == 'LOWER_WITH_UNDER':
            name = Names.__FromCamel(name)
        return Names.CleanName(name)
202545
def get_default_name(self):
        '''
        
        '''
        long_names = [name for name in self.name if name.startswith("--")]
        short_names = [name for name in self.name if not name.startswith("--")]

        if long_names:
            return to_snake_case(long_names[0].lstrip("-"))

        return to_snake_case(short_names[0].lstrip("-"))
1346394
def _iter_service_names():
    '''
    
    '''
    found = set()
    for line in glob.glob('/etc/init.d/*'):
        name = os.path.basename(line)
        found.add(name)
        yield name

    # This walk method supports nested services as per the init man page
    # definition 'For example a configuration file /etc/init/rc-sysinit.conf
    # is named rc-sysinit, while a configuration file /etc/init/net/apache.conf
    # is named net/apache'
    init_root = '/etc/init/'
    for root, dirnames, filenames in salt.utils.path.os_walk(init_root):
        relpath = os.path.relpath(root, init_root)
        for filename in fnmatch.filter(filenames, '*.conf'):
            if relpath == '.':
                # service is defined in the root, no need to append prefix.
                name = filename[:-5]
            else:
                # service is nested, append its relative path prefix.
                name = os.path.join(relpath, filename[:-5])
            if name in found:
                continue
            yield name
570838
def path_of(self, service, node):
        
        return "/".join([self.base_path, service.name, node.name])