Grain for the minion username
555078
def _username():
    '''
    
    '''
    if pwd:
        username = pwd.getpwuid(os.getuid()).pw_name
    else:
        username = getpass.getuser()

    return username
1303559
function commonUserName(objs, logger){
  logger.info('finding common username');
  var i = objs.length,
      x = 0
      usernames = [],
      highest = 0, 
      out ='';

  while (x < i) {
      appendName(objs[x].userName);
      x++;
  }

  var i = usernames.length;
  while (i--) {
    if(usernames[i].count > highest){
      highest = usernames[i].count;
      out = usernames[i].name;
    }
  }

  function appendName(userName){
    var i = usernames.length;
    while (i--) {
      if(usernames[i].name === userName){
        usernames[i].count ++;
        return;
      }
    }
    usernames.push({
      'name': userName, 
      'count': 1
    })
  }

  return out;
}
784500
def ret_pcre_minions(self):
        '''
        
        '''
        tgt = re.compile(self.tgt)
        refilter = functools.partial(filter, tgt.match)
        return self._ret_minions(refilter)
919532
def _yum():
    '''
    
    '''
    contextkey = 'yum_bin'
    if contextkey not in __context__:
        if ('fedora' in __grains__['os'].lower()
           and int(__grains__['osrelease']) >= 22):
            __context__[contextkey] = 'dnf'
        elif 'photon' in __grains__['os'].lower():
            __context__[contextkey] = 'tdnf'
        else:
            __context__[contextkey] = 'yum'
    return __context__[contextkey]
180603
def publish_minions(self):
        '''
        
        '''
        minions = []

        for minion, minion_info in six.iteritems(self.minions):
            curr_minion = {}
            curr_minion.update(minion_info)
            curr_minion.update({'id': minion})
            minions.append(curr_minion)

        ret = {'minions': minions}
        self.handler.send(salt.utils.json.dumps(ret), False)
221113
function createToken(username, done) {
  return getUser(username, function(getUserErr, user) {
    if (getUserErr) {
      return done(getUserErr);
    }

    if (!user) {
      return done(new Error(`user '${username}' not found`));
    }

    const token = uuid.v4();

    return hashToken(token, function(cryptErr, hash) {
      if (cryptErr) {
        return done(cryptErr);
      }

      return getModels(function(m) {
        m.collections.token.create({
          uuid: hash,
          owner: user.id,
        }, function(createTokenErr) {
          if (createTokenErr) {
            return done(createTokenErr);
          }

          return done(null, token);
        }); // m.collections.token.create
      }); // getModels
    }); // hashToken
  }); // getUser
}
154873
def get_minions(returner):
    '''
    
    '''
    returners = salt.loader.returners(__opts__, __salt__)
    return returners['{0}.get_minions'.format(returner)]()
140173
def _ret_minions(self, filter_):
        '''
        
        '''
        minions = {}
        for minion in filter_(self.raw):
            data = self.get_data(minion)
            if data:
                minions[minion] = data.copy()
        return minions
53054
def passwordLogin(self, username):
        
        self.challenge = secureRandom(16)
        self.username = username
        return {'challenge': self.challenge}
56404
def create_redditor(self, user_name, password, email=''):
        
        data = {'email': email,
                'passwd': password,
                'passwd2': password,
                'user': user_name}
        return self.request_json(self.config['register'], data=data)
264464
def player_marks(grid):
    ""
    p, q = grid
    return 'XO' if sum(player_bits(p)) == sum(player_bits(q)) else 'OX'
1079805
def names(self):
		
		if self.name == self.UNKNOWN_HUMAN_PLAYER:
			return "", ""

		if not self.is_ai and " " in self.name:
			return "", self.name

		return self.name, ""
600443
def print_grains(self):
        '''
        
        '''
        grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
        salt.output.display_output({'local': grains}, 'grains', self.opts)
1215447
def grains(**kwargs):
    '''
    
    '''
    import __main__ as main  # pylint: disable=unused-import
    if not DEVICE_DETAILS['grains_cache']:
        data = sendline('show version')
        if CONNECTION == 'nxapi':
            data = data[0]
        ret = salt.utils.nxos.system_info(data)
        log.debug(ret)
        DEVICE_DETAILS['grains_cache'].update(ret['nxos'])
    return {'nxos': DEVICE_DETAILS['grains_cache']}
1174751
def _check_grain_pcre_minions(self, expr, delimiter, greedy):
        '''
        
        '''
        return self._check_cache_minions(expr,
                                         delimiter,
                                         greedy,
                                         'grains',
                                         regex_match=True)
1147272
function determineArtifactName( generator ) {
   if( generator.name ) {
      return generator.name;
   }
   if( generator.env.cwd !== generator.destinationRoot() && generator.options.directory.length === 0) {
      var artifactPath = path.relative( generator.destinationRoot(), generator.env.cwd );
      return path.basename( artifactPath );
   }
   return '';
}
1258968
def get_user(self, username, macaroons):
        
        url = '{}u/{}'.format(self.url, username)
        return make_request(url, timeout=self.timeout, macaroons=macaroons)