Extract all non-duplicate association ids from the given list of devices,
adding an assocationIds field to each device when absent.
@param {Object} devices The given devices.
@return {Array} Non-duplicate association identifiers.
336867
function extractAssociationIds(devices) {
  var associationIds = [];

  for(var deviceId in devices) {
    var device = devices[deviceId];
    var hasAssociationIds = device.hasOwnProperty("associationIds");
    if(!hasAssociationIds) {
      device.associationIds = reelib.tiraid.getAssociationIds(device);
    }
    for(var cId = 0; cId < device.associationIds.length; cId++) {
      if(associationIds.indexOf(device.associationIds[cId]) < 0) {
        associationIds.push(device.associationIds[cId]);
      }
    }
  }

  return associationIds;
}
601039
def devices
      response = get('/listDevices')
      devices = []
      response.body['devices'].each do |d|
        devices << Device.from_json(d, @token, @logger)
      end
      devices
    end
909957
def get_xid_devices():
    
    devices = []
    scanner = XidScanner()
    for i in range(scanner.device_count()):
        com = scanner.device_at_index(i)
        com.open()
        device = XidDevice(com)
        devices.append(device)
    return devices
281919
function getDeviceId(req) {

        // NOTE: client_id and client_secret are deprecated so eventually remove
        var deviceId = req.headers['x-device-id'];
        var deviceSecret = req.headers['x-device-secret'];

        // if client ID and secret don't exist, then no device
        if (!deviceId || !deviceSecret) { return null; }

        // else we have a device, so check the sha hash
        var shasum = crypto.createHash('md5').update(deviceId + config.security.device.salt);
        var digest = shasum.digest('hex');

        // if the digest is not the same as the secret, request is unauthorized
        if (digest !== deviceSecret) {
            log.error('Invalid device ' + deviceId + ' with secret ' + deviceSecret, null);
            return null;
        }
        // else the device is valid, so set it and move on
        else {
            return deviceId;
        }
    }
989187
def map_aliases_to_device_objects(self):
        
        all_devices = self.get_all_devices_in_portal()
        for dev_o in all_devices:
            dev_o['portals_aliases'] = self.get_portal_by_name(
                                                        self.portal_name()
                                                )[2][1]['info']['aliases'][ dev_o['rid'] ]
        return all_devices
1227282
def list_devices():
    
    output = {}
    for device_id, device in devices.items():
        output[device_id] = {
            'host': device.host,
            'state': device.state
        }
    return jsonify(devices=output)
690489
public void setDevices(java.util.Collection<DeviceSummary> devices) {
        if (devices == null) {
            this.devices = null;
            return;
        }

        this.devices = new java.util.ArrayList<DeviceSummary>(devices);
    }
660022
function extractRadioDecoders(devices) {
  var radioDecoders = {};

  for(var deviceId in devices) {
    var radioDecodings = devices[deviceId].radioDecodings || [];
    for(var cDecoding = 0; cDecoding < radioDecodings.length; cDecoding++) {
      var radioDecoder = radioDecodings[cDecoding].identifier;
      var radioDecoderId = radioDecoder.value;
      radioDecoders[radioDecoderId] = { identifier: radioDecoder };
    }
  }

  return radioDecoders;
}
232111
function Device(apple_id, password, display_name) {
  if (!(this instanceof Device)) return new Device(apple_id, password, display_name);
  this.apple_id = apple_id;
  this.password = password;
  this.display_name = display_name;
  this.devices = [];
  this.authenticated = false;
}
883123
def devices(self):
        ''
        return self.fs is not None and [JFSDevice(d, self, parentpath=self.rootpath) for d in self.fs.devices.iterchildren()] or [x for x in []]
1127387
function fetchDeviceListCycle(sources) {
  const accessToken$ = accessTokenSelector$(sources.STATE);

  const request$ = sources.ACTION.filter(
    action => action.type === FETCH_DEVICE_LIST,
  ).combineLatest(accessToken$, (action, accessToken) => ({
    url: '/api/devices',
    method: 'GET',
    headers: { Authorization: `Bearer ${accessToken}` },
    category: FETCH_DEVICE_LIST,
  }));

  const response$ = sources.HTTP.select(FETCH_DEVICE_LIST).switchMap(success);

  const action$ = Observable.from([
    request$.mapTo(uiActions.setLoading()),
    response$.pluck('body', 'data').map(setDeviceList),
    response$.mapTo(uiActions.setLoaded()),
  ]).mergeAll();

  return {
    ACTION: action$,
    HTTP: request$,
  };
}
33642
def _get_device_names_in_group(self):
        '''
        '''

        device_names = []
        dg = pollster(self._get_device_group)(self.devices[0])
        members = dg.devices_s.get_collection()
        for member in members:
            member_name = member.name.replace('/%s/' % self.partition, '')
            device_names.append(member_name)
        return device_names
1127754
@Override
    public Identifiable[] checkIds(Identifiable... items) {
        for (Identifiable item : items) {
            checkId(item);
        }
        return items;
    }
1307495
function determineIfIncludesMeAndRewriteDeviceAddress(assocSignersByPath, handleResult){
	var assocMemberAddresses = {};
	var bHasMyDeviceAddress = false;
	for (var signing_path in assocSignersByPath){
		var signerInfo = assocSignersByPath[signing_path];
		if (signerInfo.device_address === device.getMyDeviceAddress())
			bHasMyDeviceAddress = true;
		if (signerInfo.address)
			assocMemberAddresses[signerInfo.address] = true;
	}
	var arrMemberAddresses = Object.keys(assocMemberAddresses);
	if (arrMemberAddresses.length === 0)
		return handleResult("no member addresses?");
	db.query(
		"SELECT address, 'my' AS type FROM my_addresses WHERE address IN(?) \n\
		UNION \n\
		SELECT shared_address AS address, 'shared' AS type FROM shared_addresses WHERE shared_address IN(?)", 
		[arrMemberAddresses, arrMemberAddresses],
		function(rows){
		//	handleResult(rows.length === arrMyMemberAddresses.length ? null : "Some of my member addresses not found");
			if (rows.length === 0)
				return handleResult("I am not a member of this shared address");
			var arrMyMemberAddresses = rows.filter(function(row){ return (row.type === 'my'); }).map(function(row){ return row.address; });
			// rewrite device address for my addresses
			if (!bHasMyDeviceAddress){
				for (var signing_path in assocSignersByPath){
					var signerInfo = assocSignersByPath[signing_path];
					if (signerInfo.address && arrMyMemberAddresses.indexOf(signerInfo.address) >= 0)
						signerInfo.device_address = device.getMyDeviceAddress();
				}
			}
			handleResult();
		}
	);
}
1205891
public function groupAdddevice($group_id,array $device_identifiers){
        $params=array(
            'group_id'=>$group_id,
            'device_identifiers'=>$device_identifiers
        );
        $rst = $this->_request->post($this->_url . 'group/adddevice', $params);
        return $this->_client->rst($rst);
    }
1257469
def devices(self):
        
        devices = []
        count = self.lib.tdGetNumberOfDevices()
        for i in range(count):
            device = DeviceFactory(self.lib.tdGetDeviceId(i), lib=self.lib)
            devices.append(device)
        return devices
1198864
function () {
      var doUniqueSlotIdsCheck = function (elementary) {
        var duplicateSlotIds = [];
        elementary.slots.forEach(function (slot) {
          var slotId = slot.slotId;

          function filterBySlotId (slot) {
            return slot.slotId === slotId;
          }

          var arrayByUniqueSlotIds = elementary.slots.filter(filterBySlotId);
          if (arrayByUniqueSlotIds.length > 1 && duplicateSlotIds.indexOf(slotId) < 0) {
            duplicateSlotIds.push(slotId);
          }
        });
        duplicateSlotIds.forEach(function (slotId) {
          errors.push('RuleViolation identified: Artifact \'' + elementary.artifactId +
            '\' contains multiple slots with \'slotId\'=\'' + slotId + '\'');
        });
      };
      //
      if (doc.artifacts && doc.artifacts.elementaryComponents) {
        doc.artifacts.elementaryComponents.forEach(function (elementary) {
          if (elementary.slots) {
            doUniqueSlotIdsCheck(elementary);
          }
        });
      }
    }