Set default value
Will try to retrieve phone number from device
540231
public void setDefault() {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
            String phone = telephonyManager.getLine1Number();
            if (phone != null && !phone.isEmpty()) {
                this.setNumber(phone);
            } else {
                String iso = telephonyManager.getNetworkCountryIso();
                setEmptyDefault(iso);
            }
        } catch (SecurityException e) {
            setEmptyDefault();
        }
    }
219093
def setDefaultValues(self):
        """"""
        print '%s call setDefaultValues' % self.port

        # initialize variables
        self.networkName = ModuleHelper.Default_NwkName
        self.networkKey = ModuleHelper.Default_NwkKey
        self.channel = ModuleHelper.Default_Channel
        self.channelMask = "0x7fff800" #(0xffff << 11)
        self.panId = ModuleHelper.Default_PanId
        self.xpanId = ModuleHelper.Default_XpanId
        self.meshLocalPrefix = ModuleHelper.Default_MLPrefix
        self.pskc = "00000000000000000000000000000000"  # OT only accept hex format PSKc for now
        self.securityPolicySecs = ModuleHelper.Default_SecurityPolicy
        self.securityPolicyFlags = "onrcb"
        self.activetimestamp = ModuleHelper.Default_ActiveTimestamp
        #self.sedPollingRate = ModuleHelper.Default_Harness_SED_Polling_Rate
        self.sedPollingRate = 3
        self.deviceRole = None
        self.provisioningUrl = ''
        self.hasActiveDatasetToCommit = False
        self.logThread = Queue()
        self.logThreadStatus = self.logStatus['stop']
        self.networkDataRequirement = ''      # indicate Thread device requests full or stable network data
        self.isPowerDown = False              # indicate if Thread device experiences a power down event
        self._addressfilterMode = 'disable'   # indicate AddressFilter mode ['disable', 'whitelist', 'blacklist']
        self._addressfilterSet = set()        # cache filter entries
        self.isActiveCommissioner = False     # indicate if Thread device is an active commissioner
        self._lines = None                    # buffered lines read from device

        # initialize device configuration
        try:
            self.setMAC(self.mac)
            self.__setChannelMask(self.channelMask)
            self.__setSecurityPolicy(self.securityPolicySecs, self.securityPolicyFlags)
            self.setChannel(self.channel)
            self.setPANID(self.panId)
            self.setXpanId(self.xpanId)
            self.setNetworkName(self.networkName)
            self.setNetworkKey(self.networkKey)
            self.setMLPrefix(self.meshLocalPrefix)
            self.setPSKc(self.pskc)
            self.setActiveTimestamp(self.activetimestamp)
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger('setDefaultValue() Error: ' + str(e))
866112
def set_default(self, default):
        
        # Find index of choice
        try:
            default_index = self._parameter.default_values.index(default)
            self.default_input_button_group.button(default_index).setChecked(
                True)
        except ValueError:
            last_index = len(self._parameter.default_values) - 1
            self.default_input_button_group.button(last_index).setChecked(
                True)
            self.custom_value.setValue(default)

        self.toggle_custom_value()
900566
def get_or_save_default(self, key, default_value):
        
        val = self.get_or_none(key)
        if val is None:
            self.update(key, default_value)
            val = default_value
        return val
159996
def get_prep_value(self, value):
        
        if value:
            if not isinstance(value, PhoneNumber):
                value = to_python(value)
            if value.is_valid():
                format_string = getattr(settings, "PHONENUMBER_DB_FORMAT", "E164")
                fmt = PhoneNumber.format_map[format_string]
                value = value.format_as(fmt)
            else:
                value = self.get_default()
        return super(PhoneNumberField, self).get_prep_value(value)
674808
def set_telephone(self, tel):
        

        return type(tel)(self.query(SetTelephone(tel))) == tel
481019
public void setPhoneNumber(String number) {
		String phoneNumber = number;
		if(number.startsWith("+")) {			
			phoneNumber = phoneNumber.substring(1);
		}
		try {
			basePhoneNumber(phoneNumber);		
			telUrl.setPhoneNumber(phoneNumber);
		} catch (ParseException ex) {
			logger.error("Error setting phone number " + number);
			throw new java.lang.IllegalArgumentException("phone number " + number + " is invalid", ex);
		}
	}
684588
def device_set(self, device):
		

		if device['id'].startswith('0x'):
			self.device_id = device['id'][2:]
		elif device['id'].startswith('ios:'):
			self.device_id = device['id'].replace(':', '')
		else:
			self.device_id = device['id']
1329166
def retrieve_value(self, name, default_value=None):
        """"""
        value = self.spine.send_query("retrieveSetting", self.group, name, processes=["kervi-main"])
        if value is None:
            return default_value
        elif isinstance(value, list) and len(value) == 0:
            return default_value
        elif isinstance(default_value, int):
            return int(value)
        elif isinstance(default_value, float):
            return float(value)
        else:
            return value
1216706
def get_parameter(self, name):
        """"""
        default_value = "$%!)(INVALID)(!%$"
        value = self.lib.tdGetDeviceParameter(self.id, name, default_value)
        if value == default_value:
            raise AttributeError(name)
        return value
483924
def get_default_value(self, check):
        
        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)
        if default is None:
            raise KeyError('Check "%s" has no default value.' % check)
        value = self._handle_none(default)
        if value is None:
            return value
        return self._check_value(value, fun_name, fun_args, fun_kwargs)
438217
def setDefault(self, key, value):
        
        if value is None:
            self._defaults.pop(key, None)
        else:
            self._defaults[key] = value
72035
function(type, fn) {
    if (!type || (typeof type !== 'number' &&
        typeof type !== 'string')) {
      return fn('Error getting Type. You did not specify the ' +
        'type name or id number of the type you want to retrieve.');
    }

    if (typeof type === 'string') {
      type = getTypeNumberFromString(type);
    }

    type = type.toString();
    var apiCall = 'http://pokeapi.co/api/v' + defaults.version +
      '/type/' + type;

    makeTheCall(type, 'type', apiCall, function(err, data) {
      return fn(err, data);
    });
  }
350900
def value_or_default(self, value):
        '''  '''
        if value is None:
            if callable(self.default):
                return self.default()
            else:
                return self.default

        return value
1022804
def set_default(self, key, value):
        
        k = self._real_key(key.lower())
        self._defaults[k] = value
252053
def setdefault (self, key, def_val=None):
        """"""
        if key in self:
            return self[key]
        self[key] = def_val
        return def_val
992260
private void setDefaultSimulatorPreference(String key, String value) {
    List<String> com = new ArrayList<>();
    com.add("defaults");
    com.add("write");
    com.add("com.apple.iphonesimulator");
    com.add(key);
    com.add(String.format("\"%s\"", value));

    Command updatePreference = new Command(com, true);
    updatePreference.executeAndWait();
  }