Map gender to correct value.
543001
def map_gender(gender):
        

        if gender == 'male':
            return issuers.Gender.MALE
        elif gender == 'female':
            return issuers.Gender.FEMALE
        else:
            return issuers.Gender.UNKNOWN
678245
private int calculateSexCode(Person.Sex sex) {
		return SEX_FIELDS[baseProducer.randomInt(SEX_FIELDS.length - 1)] + (sex == Person.Sex.MALE ? 1 : 0);
	}
729154
public function genderIcon($value) {
		$value = (int)$value;
		if ($value == static::GENDER_FEMALE) {
			$icon = $this->icon('female');
		} elseif ($value == static::GENDER_MALE) {
			$icon = $this->icon('male');
		} else {
			$icon = $this->icon('genderless', [], ['title' => __d('tools', 'Unknown')]);
		}
		return $icon;
	}
356821
private void countGender(EntityIdValue gender, SiteRecord siteRecord) {
		Integer curValue = siteRecord.genderCounts.get(gender);
		if (curValue == null) {
			siteRecord.genderCounts.put(gender, 1);
		} else {
			siteRecord.genderCounts.put(gender, curValue + 1);
		}
	}
1021993
static public function getGenderValue($value=null)
    {
        return $value ? ($value == 1 || $value == '男' ? 1 : ($value == 2 || $value == '女' ? 2 : 0)) : 0;
    }
77396
public void setGender(String v) {
    if (PronounFeats_Type.featOkTst && ((PronounFeats_Type)jcasType).casFeat_gender == null)
      jcasType.jcas.throwFeatMissing("gender", "de.julielab.jules.types.PronounFeats");
    jcasType.ll_cas.ll_setStringValue(addr, ((PronounFeats_Type)jcasType).casFeatCode_gender, v);}
158337
def set_value(self, value):
        """"""

        if self.data_type == self.BOOLEAN_TYPE:
            self.value_boolean = bool(value)
        elif self.data_type == self.NUMBER_TYPE:
            self.value_number = float(value)
        else:
            self.value = value
362724
function inflect(gender, name, gcase, nametype) {
        var nametype_rulesets = rules[nametype],
            parts = name.split('-'),
            result = [];
        for (var i = 0; i < parts.length; i++) {
            var part = parts[i], first_word = i === 0 && parts.size > 1,
                rule = find_rule_global(gender, part,
                    nametype_rulesets, {first_word: first_word});
            if (rule) result.push(apply_rule(part, gcase, rule));
            else result.push(part);
        }
        return result.join('-');
    }
751780
function runProgramLogic() {
  var users = db.getCollection("users");
  var ov500 = users.getDynamicView("over 500");

  // generate random number between 1-1000
  // since our view is 'over500' there is 50% change it will be
  // in our dynamic view results
  var randomAge = Math.floor(Math.random() * 1000) + 1;
  // another 50% chance of being male
  var randomGender = Math.floor(Math.random() * 2);

  var newUser = {
    name : "user #" + users.count(),
    age : randomAge,
    gender : (randomGender?"m":"f")
  }

  console.log("");
  console.log("adding user : ");
  console.log(newUser);
  console.log("");

  users.insert(newUser);

  let result = ov500.data();
  console.log("'over 500' dynamic view results : ");
  console.log(result);
  console.log("");

  // now let's take our 'generic' bulk filtering dynamic view and further query its 'current' results
  // to find only the gender 'm' users in the dynamic view results.
  result = ov500.branchResultset().find({gender: 'm'}).data();
  console.log("over 500 males : ");
  console.log(result);
  console.log("");
  
  // branchResultset can also take transforms if you want to craft frequently used transformations
  // on view results... see the wiki page on collection transforms for examples of that if interested.

  console.log("press ctrl-c to quit");

}
24452
def t(self, value):
        """"""
        assert (isinstance(value, scipy.ndarray) and (value.dtype ==
                'float') and (value.shape == self.t.shape))
        if (self._t != value).any():
            self._t = value.copy()
            self._updateInternals()
1079017
def reflect_right(self, value):
        """"""
        if value < self:
            value = self.reflect(value)
        return value
587279
def green(self, value):
        """"""
        if value != self._green and \
           isinstance(value, int):
            self._green = value
575424
async def get_gender(self) -> User.Gender:
        
        u = await self._get_user()

        try:
            return User.Gender(u.get('gender'))
        except ValueError:
            return User.Gender.unknown
314132
function (name_type, gender, style) {
		let name = '';
		
		if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') {
			// randomize a type...
			name_type = randomizer.rollRandom(Object.keys(namedata.options));
		}
		if (typeof gender === 'undefined' || gender === 'random') {
			// randomize a gender...
			gender = randomizer.rollRandom(['male', 'female']);
		}
		if (typeof style === 'undefined' || style !== 'first') {
			style = '';
		}
		
		switch (name_type) {
			case 'holmesian':
				name = holmesname();
				break;
			case 'demonic':
				name = demonname();
				break;
			case 'cornish':
			case 'flemish':
			case 'dutch':
			case 'turkish':
			default:
				name = randomizer.rollRandom(namedata[name_type][gender]);
				if (style !== 'first' && typeof namedata[name_type]['surname'] !== 'undefined' && !r_helpers.isEmpty(namedata[name_type]['surname'])) {
					name += ' ' + randomizer.rollRandom(namedata[name_type]['surname']);
				}
				name = randomizer.findToken(name).trim();
				break;
		}
		return capitalizeName(name);
	}
1248375
def middlename(self, value, case, gender=None):
        
        """
        if not value:
            raise ValueError('Middlename cannot be empty.')

        return self.__inflect(value, case, 'middlename', gender)
884569
def pesel(self, birth_date: DateTime = None,
              gender: Gender = None) -> str:
        
        date_object = birth_date
        if not date_object:
            date_object = Datetime().datetime(1940, 2018)

        year = date_object.date().year
        month = date_object.date().month
        day = date_object.date().day
        pesel_digits = [int(d) for d in str(year)][-2:]

        if 1800 <= year <= 1899:
            month += 80
        elif 2000 <= year <= 2099:
            month += 20
        elif 2100 <= year <= 2199:
            month += 40
        elif 2200 <= year <= 2299:
            month += 60

        pesel_digits += [int(d) for d in '{:02d}'.format(month)]
        pesel_digits += [int(d) for d in '{:02d}'.format(day)]
        series_number = self.random.randint(0, 999)
        pesel_digits += [int(d) for d in '{:03d}'.format(series_number)]

        if gender == Gender.MALE:
            gender_digit = self.random.choice((1, 3, 5, 7, 9))
        elif gender == Gender.FEMALE:
            gender_digit = self.random.choice((0, 2, 4, 6, 8))
        else:
            gender_digit = self.random.choice(range(10))

        pesel_digits.append(gender_digit)
        pesel_coeffs = (9, 7, 3, 1, 9, 7, 3, 1, 9, 7)
        sum_v = sum([nc * nd for nc, nd in
                     zip(pesel_coeffs, pesel_digits)])
        checksum_digit = sum_v % 10
        pesel_digits.append(checksum_digit)
        return ''.join(str(d) for d in pesel_digits)
668203
function getGenderNsText( $index, $gender ) {
		$ns = self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
		return isset( $ns[$index][$gender] ) ? $ns[$index][$gender] : $this->getNsText( $index );
	}