Checks format of probe ids and transform it to something API
        understands.
559442
def clean_probes(self, probe_ids):
        
        if isinstance(probe_ids, (tuple, list)):  # tuples & lists > x,y,z
            probe_ids = ",".join([str(_) for _ in probe_ids])

        return probe_ids
504297
def _raw_hex_id(obj):
    """"""
    # interpret as a pointer since that's what really what id returns
    packed = struct.pack('@P', id(obj))
    return ''.join(map(_replacer, packed))
536026
def prepare_check(data):
    
    if not data:
        return None, {}

    if isinstance(data, str):
        return data, {}

    result = {}
    if "ID" in data:
        result["CheckID"] = data["ID"]
    for k in ("Node", "CheckID", "Name", "Notes", "Status", "ServiceID"):
        if k in data:
            result[k] = data[k]
    if list(result) == ["CheckID"]:
        return result["CheckID"], {}
    return result.get("CheckID"), result
1189078
def identify_id(id: str) -> bool:
    
    return re.match(r'^https?://', id, flags=re.IGNORECASE) is not None
1036048
def _validate(self):
        ''''''

        self._validate_fasta_vs_seqres()
        self._validate_mapping_signature()
        self._validate_id_types()
        self._validate_residue_types()
377767
def probe_sync(self):
        """"""

        done = threading.Event()
        result = {}

        def probe_done(adapter_id, status, reason):
            result['success'] = status
            result['failure_reason'] = reason
            done.set()

        self.probe_async(probe_done)
        done.wait()

        return result
707482
def _compare_probes(configured_probes, expected_probes):

    '''
    
    '''

    new_probes = {}
    update_probes = {}
    remove_probes = {}

    # noth configured => configure with expected probes
    if not configured_probes:
        return {
            'add': expected_probes
        }

    # noting expected => remove everything
    if not expected_probes:
        return {
            'remove': configured_probes
        }

    configured_probes_keys_set = set(configured_probes.keys())
    expected_probes_keys_set = set(expected_probes.keys())
    new_probes_keys_set = expected_probes_keys_set - configured_probes_keys_set
    remove_probes_keys_set = configured_probes_keys_set - expected_probes_keys_set

    # new probes
    for probe_name in new_probes_keys_set:
        new_probes[probe_name] = expected_probes.pop(probe_name)

    # old probes, to be removed
    for probe_name in remove_probes_keys_set:
        remove_probes[probe_name] = configured_probes.pop(probe_name)

    # common probes
    for probe_name, probe_tests in six.iteritems(expected_probes):
        configured_probe_tests = configured_probes.get(probe_name, {})
        configured_tests_keys_set = set(configured_probe_tests.keys())
        expected_tests_keys_set = set(probe_tests.keys())
        new_tests_keys_set = expected_tests_keys_set - configured_tests_keys_set
        remove_tests_keys_set = configured_tests_keys_set - expected_tests_keys_set

        # new tests for common probes
        for test_name in new_tests_keys_set:
            if probe_name not in new_probes.keys():
                new_probes[probe_name] = {}
            new_probes[probe_name].update({
                test_name: probe_tests.pop(test_name)
            })
        # old tests for common probes
        for test_name in remove_tests_keys_set:
            if probe_name not in remove_probes.keys():
                remove_probes[probe_name] = {}
            remove_probes[probe_name].update({
                test_name: configured_probe_tests.pop(test_name)
            })
        # common tests for common probes
        for test_name, test_params in six.iteritems(probe_tests):
            configured_test_params = configured_probe_tests.get(test_name, {})
            # if test params are different, probe goes to update probes dict!
            if test_params != configured_test_params:
                if probe_name not in update_probes.keys():
                    update_probes[probe_name] = {}
                update_probes[probe_name].update({
                    test_name: test_params
                })

    return {
        'add': new_probes,
        'update': update_probes,
        'remove': remove_probes
    }
258218
def convert_ids_to_object_ids(obj_map):
    """"""
    converted_map = {}
    for key, value in obj_map.items():
        if key == '_id':
            # hacky, but using alias sends back the whole ID string, like
            #   assessment.Item%3A5758326b4a40452d6eee1fa1%40ODL.MIT.EDU
            # so we have to preserve it
            try:
                converted_map[key] = ObjectId(value)
            except InvalidId:
                converted_map[key] = value
        elif isinstance(value, dict):
            converted_map[key] = convert_ids_to_object_ids(value)
        elif isinstance(value, list):
            new_list = []
            for internal_item in value:
                if isinstance(internal_item, dict):
                    new_list.append(convert_ids_to_object_ids(internal_item))
                else:
                    new_list.append(internal_item)
            converted_map[key] = new_list
        else:
            converted_map[key] = value
    return converted_map
761007
def resolve_id(marked_id):
    """"""
    if marked_id >= 0:
        return marked_id, types.PeerUser

    # There have been report of chat IDs being 10000xyz, which means their
    # marked version is -10000xyz, which in turn looks like a channel but
    # it becomes 00xyz (= xyz). Hence, we must assert that there are only
    # two zeroes.
    m = re.match(r'-100([^0]\d*)', str(marked_id))
    if m:
        return int(m.group(1)), types.PeerChannel

    return -marked_id, types.PeerChat
41573
def ids(self):
        """"""
        as_list = [seq.description.split()[0] for seq in self]
        as_set = frozenset(as_list)
        assert len(as_set) == len(as_list)
        return as_set
171427
def probe_disable(cls, resource):
        
        oper = cls.call('hosting.rproxy.probe.disable',
                        cls.usable_id(resource))
        cls.echo('Desactivating probe on %s' % resource)
        cls.display_progress(oper)
        cls.echo('The probe have been desactivated')
        return oper
593245
def probes(self, fromtime, totime=None):
        """"""

        args = {'from': fromtime}
        if totime:
            args['to'] = totime

        response = self.pingdom.request('GET', 'summary.probes/%s' % self.id,
                                        args)

        return response.json()['probes']
127055
def change_analysis_requests_id_formatting(portal, p_type="AnalysisRequest"):
    
    ar_id_format = dict(
        form='{sampleType}-{seq:04d}',
        portal_type='AnalysisRequest',
        prefix='analysisrequest',
        sequence_type='generated',
        counter_type='',
        split_length=1)

    bs = portal.bika_setup
    id_formatting = bs.getIDFormatting()
    ar_format = filter(lambda id: id["portal_type"] == p_type, id_formatting)
    if p_type=="AnalysisRequest":
        logger.info("Set ID Format for Analysis Request portal_type ...")
        if not ar_format or "sample" in ar_format[0]["form"]:
            # Copy the ID formatting set for Sample
            change_analysis_requests_id_formatting(portal, p_type="Sample")
            return
        else:
            logger.info("ID Format for Analysis Request already set: {} [SKIP]"
                        .format(ar_format[0]["form"]))
            return
    else:
        ar_format = ar_format and ar_format[0].copy() or ar_id_format

    # Set the Analysis Request ID Format
    ar_id_format.update(ar_format)
    ar_id_format["portal_type"] ="AnalysisRequest"
    ar_id_format["prefix"] = "analysisrequest"
    set_id_format(portal, ar_id_format)

    # Find out the last ID for Sample and reseed AR to prevent ID already taken
    # errors on AR creation
    if p_type == "Sample":
        number_generator = getUtility(INumberGenerator)
        ar_keys = dict()
        ar_keys_prev = dict()
        for key, value in number_generator.storage.items():
            if "sample-" in key:
                ar_key = key.replace("sample-", "analysisrequest-")
                ar_keys[ar_key] = api.to_int(value, 0)
            elif "analysisrequest-" in key:
                ar_keys_prev[key] = api.to_int(value, 0)

        for key, value in ar_keys.items():
            if key in ar_keys_prev:
                # Maybe this upgrade step has already been run, so we don't
                # want the ar IDs to be reseeded again!
                if value <= ar_keys_prev[key]:
                    logger.info("ID for '{}' already seeded to '{}' [SKIP]"
                                .format(key, ar_keys_prev[key]))
                    continue
            logger.info("Seeding {} to {}".format(key, value))
            number_generator.set_number(key, value)
687469
def _validate_id_types(self):
        ''''''

        for sequences in [self.uniparc_sequences, self.fasta_sequences, self.seqres_sequences, self.rosetta_sequences]:
            for chain_id, sequence in sequences.iteritems():
                sequence_id_types = set(map(type, sequence.ids()))
                if sequence_id_types:
                    assert(len(sequence_id_types) == 1)
                    assert(sequence_id_types.pop() == types.IntType)

        for chain_id, sequence in self.atom_sequences.iteritems():
            sequence_id_types = set(map(type, sequence.ids()))
            assert(len(sequence_id_types) == 1)
            sequence_id_type = sequence_id_types.pop()
            assert(sequence_id_type == types.StringType or sequence_id_type == types.UnicodeType)
294847
private StringBuilder idProcessing(final TmdbParameters params) {
        StringBuilder urlString = new StringBuilder();

        // Append the ID
        if (params.has(Param.ID)) {
            urlString.append("/").append(params.get(Param.ID));
        }

        if (params.has(Param.SEASON_NUMBER)) {
            urlString.append("/season/").append(params.get(Param.SEASON_NUMBER));
        }

        if (params.has(Param.EPISODE_NUMBER)) {
            urlString.append("/episode/").append(params.get(Param.EPISODE_NUMBER));
        }

        if (submethod != MethodSub.NONE) {
            urlString.append("/").append(submethod.getValue());
        }

        // Append the key information
        urlString.append(DELIMITER_FIRST)
                .append(Param.API_KEY.getValue())
                .append(apiKey);

        return urlString;
    }
476828
def decode_cpu_id(self, cpuid):
        """"""
        ret = ()
        for i in cpuid.split(':'):
            ret += (eval('0x' + i),)

        return ret
381389
def get_formats(self, id, **data):
        
        
        return self.get("/formats/{0}/".format(id), data=data)