{"payload":{"allShortcutsEnabled":false,"fileTree":{"qiskit/result":{"items":[{"name":"distributions","path":"qiskit/result/distributions","contentType":"directory"},{"name":"mitigation","path":"qiskit/result/mitigation","contentType":"directory"},{"name":"__init__.py","path":"qiskit/result/__init__.py","contentType":"file"},{"name":"counts.py","path":"qiskit/result/counts.py","contentType":"file"},{"name":"exceptions.py","path":"qiskit/result/exceptions.py","contentType":"file"},{"name":"models.py","path":"qiskit/result/models.py","contentType":"file"},{"name":"postprocess.py","path":"qiskit/result/postprocess.py","contentType":"file"},{"name":"result.py","path":"qiskit/result/result.py","contentType":"file"},{"name":"sampled_expval.py","path":"qiskit/result/sampled_expval.py","contentType":"file"},{"name":"utils.py","path":"qiskit/result/utils.py","contentType":"file"}],"totalCount":10},"qiskit":{"items":[{"name":"assembler","path":"qiskit/assembler","contentType":"directory"},{"name":"circuit","path":"qiskit/circuit","contentType":"directory"},{"name":"compiler","path":"qiskit/compiler","contentType":"directory"},{"name":"converters","path":"qiskit/converters","contentType":"directory"},{"name":"dagcircuit","path":"qiskit/dagcircuit","contentType":"directory"},{"name":"passmanager","path":"qiskit/passmanager","contentType":"directory"},{"name":"primitives","path":"qiskit/primitives","contentType":"directory"},{"name":"providers","path":"qiskit/providers","contentType":"directory"},{"name":"pulse","path":"qiskit/pulse","contentType":"directory"},{"name":"qasm","path":"qiskit/qasm","contentType":"directory"},{"name":"qasm2","path":"qiskit/qasm2","contentType":"directory"},{"name":"qasm3","path":"qiskit/qasm3","contentType":"directory"},{"name":"qobj","path":"qiskit/qobj","contentType":"directory"},{"name":"qpy","path":"qiskit/qpy","contentType":"directory"},{"name":"quantum_info","path":"qiskit/quantum_info","contentType":"directory"},{"name":"result","path":"qiskit/result","contentType":"directory"},{"name":"scheduler","path":"qiskit/scheduler","contentType":"directory"},{"name":"synthesis","path":"qiskit/synthesis","contentType":"directory"},{"name":"transpiler","path":"qiskit/transpiler","contentType":"directory"},{"name":"utils","path":"qiskit/utils","contentType":"directory"},{"name":"visualization","path":"qiskit/visualization","contentType":"directory"},{"name":"VERSION.txt","path":"qiskit/VERSION.txt","contentType":"file"},{"name":"__init__.py","path":"qiskit/__init__.py","contentType":"file"},{"name":"exceptions.py","path":"qiskit/exceptions.py","contentType":"file"},{"name":"user_config.py","path":"qiskit/user_config.py","contentType":"file"},{"name":"version.py","path":"qiskit/version.py","contentType":"file"}],"totalCount":26},"":{"items":[{"name":".azure","path":".azure","contentType":"directory"},{"name":".binder","path":".binder","contentType":"directory"},{"name":".cargo","path":".cargo","contentType":"directory"},{"name":".github","path":".github","contentType":"directory"},{"name":"crates","path":"crates","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"qiskit","path":"qiskit","contentType":"directory"},{"name":"releasenotes","path":"releasenotes","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"tools","path":"tools","contentType":"directory"},{"name":".editorconfig","path":".editorconfig","contentType":"file"},{"name":".git-blame-ignore-revs","path":".git-blame-ignore-revs","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".local-spellings","path":".local-spellings","contentType":"file"},{"name":".mailmap","path":".mailmap","contentType":"file"},{"name":".mergify.yml","path":".mergify.yml","contentType":"file"},{"name":".stestr.conf","path":".stestr.conf","contentType":"file"},{"name":"CITATION.bib","path":"CITATION.bib","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"Cargo.lock","path":"Cargo.lock","contentType":"file"},{"name":"Cargo.toml","path":"Cargo.toml","contentType":"file"},{"name":"DEPRECATION.md","path":"DEPRECATION.md","contentType":"file"},{"name":"LICENSE.txt","path":"LICENSE.txt","contentType":"file"},{"name":"MAINTAINING.md","path":"MAINTAINING.md","contentType":"file"},{"name":"MANIFEST.in","path":"MANIFEST.in","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SECURITY.md","path":"SECURITY.md","contentType":"file"},{"name":"asv.conf.json","path":"asv.conf.json","contentType":"file"},{"name":"azure-pipelines.yml","path":"azure-pipelines.yml","contentType":"file"},{"name":"constraints.txt","path":"constraints.txt","contentType":"file"},{"name":"pyproject.toml","path":"pyproject.toml","contentType":"file"},{"name":"qiskit_bot.yaml","path":"qiskit_bot.yaml","contentType":"file"},{"name":"requirements-dev.txt","path":"requirements-dev.txt","contentType":"file"},{"name":"requirements-optional.txt","path":"requirements-optional.txt","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"},{"name":"rust-toolchain.toml","path":"rust-toolchain.toml","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"},{"name":"tox.ini","path":"tox.ini","contentType":"file"}],"totalCount":41}},"fileTreeProcessingTime":14.52604,"foldersToFetch":[],"repo":{"id":83821669,"defaultBranch":"main","name":"qiskit","ownerLogin":"Qiskit","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2017-03-03T17:02:42.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/30696987?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1710848862.0","canEdit":false,"refType":"branch","currentOid":"c26e25cddb3bae79a9d0547c25339d3307769e67"},"path":"qiskit/result/counts.py","currentUser":null,"blob":{"rawLines":["# This code is part of Qiskit.","#","# (C) Copyright IBM 2020.","#","# This code is licensed under the Apache License, Version 2.0. You may","# obtain a copy of this license in the LICENSE.txt file in the root directory","# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.","#","# Any modifications or derivative works of this code must retain this","# copyright notice, and modified files need to carry a notice indicating","# that they have been altered from the originals.","","\"\"\"A container class for counts from a circuit execution.\"\"\"","","import re","","from qiskit.result import postprocess","from qiskit import exceptions","","","# NOTE: A dict subclass should not overload any dunder methods like __getitem__","# this can cause unexpected behavior and issues as the cPython dict","# implementation has many standard methods in C for performance and the dunder","# methods are not always used as expected. For example, update() doesn't call","# __setitem__ so overloading __setitem__ would not always provide the expected","# result","class Counts(dict):"," \"\"\"A class to store a counts result from a circuit execution.\"\"\"",""," bitstring_regex = re.compile(r\"^[01\\s]+$\")",""," def __init__(self, data, time_taken=None, creg_sizes=None, memory_slots=None):"," \"\"\"Build a counts object",""," Args:"," data (dict): The dictionary input for the counts. Where the keys"," represent a measured classical value and the value is an"," integer the number of shots with that result."," The keys can be one of several formats:",""," * A hexadecimal string of the form ``'0x4a'``"," * A bit string prefixed with ``0b`` for example ``'0b1011'``"," * A bit string formatted across register and memory slots."," For example, ``'00 10'``."," * A dit string, for example ``'02'``. Note for objects created"," with dit strings the ``creg_sizes`` and ``memory_slots``"," kwargs don't work and :meth:`hex_outcomes` and"," :meth:`int_outcomes` also do not work.",""," time_taken (float): The duration of the experiment that generated"," the counts in seconds."," creg_sizes (list): a nested list where the inner element is a list"," of tuples containing both the classical register name and"," classical register size. For example,"," ``[('c_reg', 2), ('my_creg', 4)]``."," memory_slots (int): The number of total ``memory_slots`` in the"," experiment."," Raises:"," TypeError: If the input key type is not an ``int`` or ``str``."," QiskitError: If a dit string key is input with ``creg_sizes`` and/or"," ``memory_slots``."," \"\"\""," bin_data = None"," data = dict(data)"," if not data:"," self.int_raw = {}"," self.hex_raw = {}"," bin_data = {}"," else:"," first_key = next(iter(data.keys()))"," if isinstance(first_key, int):"," self.int_raw = data"," self.hex_raw = {hex(key): value for key, value in self.int_raw.items()}"," elif isinstance(first_key, str):"," if first_key.startswith(\"0x\"):"," self.hex_raw = data"," self.int_raw = {int(key, 0): value for key, value in self.hex_raw.items()}"," elif first_key.startswith(\"0b\"):"," self.int_raw = {int(key, 0): value for key, value in data.items()}"," self.hex_raw = {hex(key): value for key, value in self.int_raw.items()}"," else:"," if not creg_sizes and not memory_slots:"," self.hex_raw = None"," self.int_raw = None"," bin_data = data"," else:"," hex_dict = {}"," int_dict = {}"," for bitstring, value in data.items():"," if not self.bitstring_regex.search(bitstring):"," raise exceptions.QiskitError("," \"Counts objects with dit strings do not \""," \"currently support dit string formatting parameters \""," \"creg_sizes or memory_slots\""," )"," int_key = self._remove_space_underscore(bitstring)"," int_dict[int_key] = value"," hex_dict[hex(int_key)] = value"," self.hex_raw = hex_dict"," self.int_raw = int_dict"," else:"," raise TypeError("," \"Invalid input key type %s, must be either an int \""," \"key or string key with hexademical value or bit string\""," )"," header = {}"," self.creg_sizes = creg_sizes"," if self.creg_sizes:"," header[\"creg_sizes\"] = self.creg_sizes"," self.memory_slots = memory_slots"," if self.memory_slots:"," header[\"memory_slots\"] = self.memory_slots"," if not bin_data:"," bin_data = postprocess.format_counts(self.hex_raw, header=header)"," super().__init__(bin_data)"," self.time_taken = time_taken",""," def most_frequent(self):"," \"\"\"Return the most frequent count",""," Returns:"," str: The bit string for the most frequent result"," Raises:"," QiskitError: when there is >1 count with the same max counts, or"," an empty object."," \"\"\""," if not self:"," raise exceptions.QiskitError(\"Can not return a most frequent count on an empty object\")"," max_value = max(self.values())"," max_values_counts = [x[0] for x in self.items() if x[1] == max_value]"," if len(max_values_counts) != 1:"," raise exceptions.QiskitError("," \"Multiple values have the same maximum counts: %s\" % \",\".join(max_values_counts)"," )"," return max_values_counts[0]",""," def hex_outcomes(self):"," \"\"\"Return a counts dictionary with hexadecimal string keys",""," Returns:"," dict: A dictionary with the keys as hexadecimal strings instead of"," bitstrings"," Raises:"," QiskitError: If the Counts object contains counts for dit strings"," \"\"\""," if self.hex_raw:"," return {key.lower(): value for key, value in self.hex_raw.items()}"," else:"," out_dict = {}"," for bitstring, value in self.items():"," if not self.bitstring_regex.search(bitstring):"," raise exceptions.QiskitError("," \"Counts objects with dit strings do not \""," \"currently support conversion to hexadecimal\""," )"," int_key = self._remove_space_underscore(bitstring)"," out_dict[hex(int_key)] = value"," return out_dict",""," def int_outcomes(self):"," \"\"\"Build a counts dictionary with integer keys instead of count strings",""," Returns:"," dict: A dictionary with the keys as integers instead of bitstrings"," Raises:"," QiskitError: If the Counts object contains counts for dit strings"," \"\"\""," if self.int_raw:"," return self.int_raw"," else:"," out_dict = {}"," for bitstring, value in self.items():"," if not self.bitstring_regex.search(bitstring):"," raise exceptions.QiskitError("," \"Counts objects with dit strings do not \""," \"currently support conversion to integer\""," )"," int_key = self._remove_space_underscore(bitstring)"," out_dict[int_key] = value"," return out_dict",""," @staticmethod"," def _remove_space_underscore(bitstring):"," \"\"\"Removes all spaces and underscores from bitstring\"\"\""," return int(bitstring.replace(\" \", \"\").replace(\"_\", \"\"), 2)",""," def shots(self):"," \"\"\"Return the number of shots\"\"\""," return sum(self.values())"],"stylingDirectives":[[{"start":0,"end":30,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":25,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":70,"cssClass":"pl-c"}],[{"start":0,"end":77,"cssClass":"pl-c"}],[{"start":0,"end":71,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":69,"cssClass":"pl-c"}],[{"start":0,"end":72,"cssClass":"pl-c"}],[{"start":0,"end":49,"cssClass":"pl-c"}],[],[{"start":0,"end":60,"cssClass":"pl-s"}],[],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":9,"cssClass":"pl-s1"}],[],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":18,"cssClass":"pl-s1"},{"start":19,"end":25,"cssClass":"pl-k"},{"start":26,"end":37,"cssClass":"pl-s1"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":29,"cssClass":"pl-s1"}],[],[],[{"start":0,"end":79,"cssClass":"pl-c"}],[{"start":0,"end":67,"cssClass":"pl-c"}],[{"start":0,"end":78,"cssClass":"pl-c"}],[{"start":0,"end":77,"cssClass":"pl-c"}],[{"start":0,"end":78,"cssClass":"pl-c"}],[{"start":0,"end":8,"cssClass":"pl-c"}],[{"start":0,"end":5,"cssClass":"pl-k"},{"start":6,"end":12,"cssClass":"pl-v"},{"start":13,"end":17,"cssClass":"pl-s1"}],[{"start":4,"end":68,"cssClass":"pl-s"}],[],[{"start":4,"end":19,"cssClass":"pl-s1"},{"start":20,"end":21,"cssClass":"pl-c1"},{"start":22,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-en"},{"start":33,"end":45,"cssClass":"pl-s"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":16,"cssClass":"pl-en"},{"start":17,"end":21,"cssClass":"pl-s1"},{"start":23,"end":27,"cssClass":"pl-s1"},{"start":29,"end":39,"cssClass":"pl-s1"},{"start":39,"end":40,"cssClass":"pl-c1"},{"start":40,"end":44,"cssClass":"pl-c1"},{"start":46,"end":56,"cssClass":"pl-s1"},{"start":56,"end":57,"cssClass":"pl-c1"},{"start":57,"end":61,"cssClass":"pl-c1"},{"start":63,"end":75,"cssClass":"pl-s1"},{"start":75,"end":76,"cssClass":"pl-c1"},{"start":76,"end":80,"cssClass":"pl-c1"}],[{"start":8,"end":32,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":76,"cssClass":"pl-s"}],[{"start":0,"end":72,"cssClass":"pl-s"}],[{"start":0,"end":61,"cssClass":"pl-s"}],[{"start":0,"end":55,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":81,"cssClass":"pl-s"}],[{"start":0,"end":79,"cssClass":"pl-s"}],[{"start":0,"end":48,"cssClass":"pl-s"}],[{"start":0,"end":83,"cssClass":"pl-s"}],[{"start":0,"end":79,"cssClass":"pl-s"}],[{"start":0,"end":69,"cssClass":"pl-s"}],[{"start":0,"end":61,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":38,"cssClass":"pl-s"}],[{"start":0,"end":78,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":53,"cssClass":"pl-s"}],[{"start":0,"end":51,"cssClass":"pl-s"}],[{"start":0,"end":75,"cssClass":"pl-s"}],[{"start":0,"end":27,"cssClass":"pl-s"}],[{"start":0,"end":15,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":80,"cssClass":"pl-s"}],[{"start":0,"end":33,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-s"}],[{"start":8,"end":16,"cssClass":"pl-s1"},{"start":17,"end":18,"cssClass":"pl-c1"},{"start":19,"end":23,"cssClass":"pl-c1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":14,"cssClass":"pl-c1"},{"start":15,"end":19,"cssClass":"pl-en"},{"start":20,"end":24,"cssClass":"pl-s1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":14,"cssClass":"pl-c1"},{"start":15,"end":19,"cssClass":"pl-s1"}],[{"start":12,"end":16,"cssClass":"pl-s1"},{"start":17,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"}],[{"start":12,"end":16,"cssClass":"pl-s1"},{"start":17,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"}],[{"start":12,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"}],[{"start":8,"end":12,"cssClass":"pl-k"}],[{"start":12,"end":21,"cssClass":"pl-s1"},{"start":22,"end":23,"cssClass":"pl-c1"},{"start":24,"end":28,"cssClass":"pl-en"},{"start":29,"end":33,"cssClass":"pl-en"},{"start":34,"end":38,"cssClass":"pl-s1"},{"start":39,"end":43,"cssClass":"pl-en"}],[{"start":12,"end":14,"cssClass":"pl-k"},{"start":15,"end":25,"cssClass":"pl-en"},{"start":26,"end":35,"cssClass":"pl-s1"},{"start":37,"end":40,"cssClass":"pl-s1"}],[{"start":16,"end":20,"cssClass":"pl-s1"},{"start":21,"end":28,"cssClass":"pl-s1"},{"start":29,"end":30,"cssClass":"pl-c1"},{"start":31,"end":35,"cssClass":"pl-s1"}],[{"start":16,"end":20,"cssClass":"pl-s1"},{"start":21,"end":28,"cssClass":"pl-s1"},{"start":29,"end":30,"cssClass":"pl-c1"},{"start":32,"end":35,"cssClass":"pl-en"},{"start":36,"end":39,"cssClass":"pl-s1"},{"start":42,"end":47,"cssClass":"pl-s1"},{"start":48,"end":51,"cssClass":"pl-k"},{"start":52,"end":55,"cssClass":"pl-s1"},{"start":57,"end":62,"cssClass":"pl-s1"},{"start":63,"end":65,"cssClass":"pl-c1"},{"start":66,"end":70,"cssClass":"pl-s1"},{"start":71,"end":78,"cssClass":"pl-s1"},{"start":79,"end":84,"cssClass":"pl-en"}],[{"start":12,"end":16,"cssClass":"pl-k"},{"start":17,"end":27,"cssClass":"pl-en"},{"start":28,"end":37,"cssClass":"pl-s1"},{"start":39,"end":42,"cssClass":"pl-s1"}],[{"start":16,"end":18,"cssClass":"pl-k"},{"start":19,"end":28,"cssClass":"pl-s1"},{"start":29,"end":39,"cssClass":"pl-en"},{"start":40,"end":44,"cssClass":"pl-s"}],[{"start":20,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":35,"end":39,"cssClass":"pl-s1"}],[{"start":20,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":36,"end":39,"cssClass":"pl-en"},{"start":40,"end":43,"cssClass":"pl-s1"},{"start":45,"end":46,"cssClass":"pl-c1"},{"start":49,"end":54,"cssClass":"pl-s1"},{"start":55,"end":58,"cssClass":"pl-k"},{"start":59,"end":62,"cssClass":"pl-s1"},{"start":64,"end":69,"cssClass":"pl-s1"},{"start":70,"end":72,"cssClass":"pl-c1"},{"start":73,"end":77,"cssClass":"pl-s1"},{"start":78,"end":85,"cssClass":"pl-s1"},{"start":86,"end":91,"cssClass":"pl-en"}],[{"start":16,"end":20,"cssClass":"pl-k"},{"start":21,"end":30,"cssClass":"pl-s1"},{"start":31,"end":41,"cssClass":"pl-en"},{"start":42,"end":46,"cssClass":"pl-s"}],[{"start":20,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":36,"end":39,"cssClass":"pl-en"},{"start":40,"end":43,"cssClass":"pl-s1"},{"start":45,"end":46,"cssClass":"pl-c1"},{"start":49,"end":54,"cssClass":"pl-s1"},{"start":55,"end":58,"cssClass":"pl-k"},{"start":59,"end":62,"cssClass":"pl-s1"},{"start":64,"end":69,"cssClass":"pl-s1"},{"start":70,"end":72,"cssClass":"pl-c1"},{"start":73,"end":77,"cssClass":"pl-s1"},{"start":78,"end":83,"cssClass":"pl-en"}],[{"start":20,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":36,"end":39,"cssClass":"pl-en"},{"start":40,"end":43,"cssClass":"pl-s1"},{"start":46,"end":51,"cssClass":"pl-s1"},{"start":52,"end":55,"cssClass":"pl-k"},{"start":56,"end":59,"cssClass":"pl-s1"},{"start":61,"end":66,"cssClass":"pl-s1"},{"start":67,"end":69,"cssClass":"pl-c1"},{"start":70,"end":74,"cssClass":"pl-s1"},{"start":75,"end":82,"cssClass":"pl-s1"},{"start":83,"end":88,"cssClass":"pl-en"}],[{"start":16,"end":20,"cssClass":"pl-k"}],[{"start":20,"end":22,"cssClass":"pl-k"},{"start":23,"end":26,"cssClass":"pl-c1"},{"start":27,"end":37,"cssClass":"pl-s1"},{"start":38,"end":41,"cssClass":"pl-c1"},{"start":42,"end":45,"cssClass":"pl-c1"},{"start":46,"end":58,"cssClass":"pl-s1"}],[{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":36,"cssClass":"pl-s1"},{"start":37,"end":38,"cssClass":"pl-c1"},{"start":39,"end":43,"cssClass":"pl-c1"}],[{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":36,"cssClass":"pl-s1"},{"start":37,"end":38,"cssClass":"pl-c1"},{"start":39,"end":43,"cssClass":"pl-c1"}],[{"start":24,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":35,"end":39,"cssClass":"pl-s1"}],[{"start":20,"end":24,"cssClass":"pl-k"}],[{"start":24,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"}],[{"start":24,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"}],[{"start":24,"end":27,"cssClass":"pl-k"},{"start":28,"end":37,"cssClass":"pl-s1"},{"start":39,"end":44,"cssClass":"pl-s1"},{"start":45,"end":47,"cssClass":"pl-c1"},{"start":48,"end":52,"cssClass":"pl-s1"},{"start":53,"end":58,"cssClass":"pl-en"}],[{"start":28,"end":30,"cssClass":"pl-k"},{"start":31,"end":34,"cssClass":"pl-c1"},{"start":35,"end":39,"cssClass":"pl-s1"},{"start":40,"end":55,"cssClass":"pl-s1"},{"start":56,"end":62,"cssClass":"pl-en"},{"start":63,"end":72,"cssClass":"pl-s1"}],[{"start":32,"end":37,"cssClass":"pl-k"},{"start":38,"end":48,"cssClass":"pl-s1"},{"start":49,"end":60,"cssClass":"pl-v"}],[{"start":36,"end":77,"cssClass":"pl-s"}],[{"start":36,"end":89,"cssClass":"pl-s"}],[{"start":36,"end":64,"cssClass":"pl-s"}],[],[{"start":28,"end":35,"cssClass":"pl-s1"},{"start":36,"end":37,"cssClass":"pl-c1"},{"start":38,"end":42,"cssClass":"pl-s1"},{"start":43,"end":67,"cssClass":"pl-en"},{"start":68,"end":77,"cssClass":"pl-s1"}],[{"start":28,"end":36,"cssClass":"pl-s1"},{"start":37,"end":44,"cssClass":"pl-s1"},{"start":46,"end":47,"cssClass":"pl-c1"},{"start":48,"end":53,"cssClass":"pl-s1"}],[{"start":28,"end":36,"cssClass":"pl-s1"},{"start":37,"end":40,"cssClass":"pl-en"},{"start":41,"end":48,"cssClass":"pl-s1"},{"start":51,"end":52,"cssClass":"pl-c1"},{"start":53,"end":58,"cssClass":"pl-s1"}],[{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":36,"cssClass":"pl-s1"},{"start":37,"end":38,"cssClass":"pl-c1"},{"start":39,"end":47,"cssClass":"pl-s1"}],[{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":36,"cssClass":"pl-s1"},{"start":37,"end":38,"cssClass":"pl-c1"},{"start":39,"end":47,"cssClass":"pl-s1"}],[{"start":12,"end":16,"cssClass":"pl-k"}],[{"start":16,"end":21,"cssClass":"pl-k"},{"start":22,"end":31,"cssClass":"pl-v"}],[{"start":20,"end":71,"cssClass":"pl-s"}],[{"start":20,"end":76,"cssClass":"pl-s"}],[],[{"start":8,"end":14,"cssClass":"pl-s1"},{"start":15,"end":16,"cssClass":"pl-c1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":23,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":36,"cssClass":"pl-s1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":26,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-s1"},{"start":19,"end":31,"cssClass":"pl-s"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":35,"end":39,"cssClass":"pl-s1"},{"start":40,"end":50,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":25,"cssClass":"pl-s1"},{"start":26,"end":27,"cssClass":"pl-c1"},{"start":28,"end":40,"cssClass":"pl-s1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":28,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-s1"},{"start":19,"end":33,"cssClass":"pl-s"},{"start":35,"end":36,"cssClass":"pl-c1"},{"start":37,"end":41,"cssClass":"pl-s1"},{"start":42,"end":54,"cssClass":"pl-s1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":14,"cssClass":"pl-c1"},{"start":15,"end":23,"cssClass":"pl-s1"}],[{"start":12,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"},{"start":23,"end":34,"cssClass":"pl-s1"},{"start":35,"end":48,"cssClass":"pl-en"},{"start":49,"end":53,"cssClass":"pl-s1"},{"start":54,"end":61,"cssClass":"pl-s1"},{"start":63,"end":69,"cssClass":"pl-s1"},{"start":69,"end":70,"cssClass":"pl-c1"},{"start":70,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":13,"cssClass":"pl-en"},{"start":16,"end":24,"cssClass":"pl-en"},{"start":25,"end":33,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":23,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":36,"cssClass":"pl-s1"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":21,"cssClass":"pl-en"},{"start":22,"end":26,"cssClass":"pl-s1"}],[{"start":8,"end":41,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":16,"cssClass":"pl-s"}],[{"start":0,"end":60,"cssClass":"pl-s"}],[{"start":0,"end":15,"cssClass":"pl-s"}],[{"start":0,"end":76,"cssClass":"pl-s"}],[{"start":0,"end":32,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":14,"cssClass":"pl-c1"},{"start":15,"end":19,"cssClass":"pl-s1"}],[{"start":12,"end":17,"cssClass":"pl-k"},{"start":18,"end":28,"cssClass":"pl-s1"},{"start":29,"end":40,"cssClass":"pl-v"},{"start":41,"end":98,"cssClass":"pl-s"}],[{"start":8,"end":17,"cssClass":"pl-s1"},{"start":18,"end":19,"cssClass":"pl-c1"},{"start":20,"end":23,"cssClass":"pl-en"},{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":35,"cssClass":"pl-en"}],[{"start":8,"end":25,"cssClass":"pl-s1"},{"start":26,"end":27,"cssClass":"pl-c1"},{"start":29,"end":30,"cssClass":"pl-s1"},{"start":31,"end":32,"cssClass":"pl-c1"},{"start":34,"end":37,"cssClass":"pl-k"},{"start":38,"end":39,"cssClass":"pl-s1"},{"start":40,"end":42,"cssClass":"pl-c1"},{"start":43,"end":47,"cssClass":"pl-s1"},{"start":48,"end":53,"cssClass":"pl-en"},{"start":56,"end":58,"cssClass":"pl-k"},{"start":59,"end":60,"cssClass":"pl-s1"},{"start":61,"end":62,"cssClass":"pl-c1"},{"start":64,"end":66,"cssClass":"pl-c1"},{"start":67,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":14,"cssClass":"pl-en"},{"start":15,"end":32,"cssClass":"pl-s1"},{"start":34,"end":36,"cssClass":"pl-c1"},{"start":37,"end":38,"cssClass":"pl-c1"}],[{"start":12,"end":17,"cssClass":"pl-k"},{"start":18,"end":28,"cssClass":"pl-s1"},{"start":29,"end":40,"cssClass":"pl-v"}],[{"start":16,"end":66,"cssClass":"pl-s"},{"start":67,"end":68,"cssClass":"pl-c1"},{"start":69,"end":72,"cssClass":"pl-s"},{"start":73,"end":77,"cssClass":"pl-en"},{"start":78,"end":95,"cssClass":"pl-s1"}],[],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":32,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":20,"cssClass":"pl-en"},{"start":21,"end":25,"cssClass":"pl-s1"}],[{"start":8,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":16,"cssClass":"pl-s"}],[{"start":0,"end":78,"cssClass":"pl-s"}],[{"start":0,"end":26,"cssClass":"pl-s"}],[{"start":0,"end":15,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":20,"end":23,"cssClass":"pl-s1"},{"start":24,"end":29,"cssClass":"pl-en"},{"start":33,"end":38,"cssClass":"pl-s1"},{"start":39,"end":42,"cssClass":"pl-k"},{"start":43,"end":46,"cssClass":"pl-s1"},{"start":48,"end":53,"cssClass":"pl-s1"},{"start":54,"end":56,"cssClass":"pl-c1"},{"start":57,"end":61,"cssClass":"pl-s1"},{"start":62,"end":69,"cssClass":"pl-s1"},{"start":70,"end":75,"cssClass":"pl-en"}],[{"start":8,"end":12,"cssClass":"pl-k"}],[{"start":12,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"}],[{"start":12,"end":15,"cssClass":"pl-k"},{"start":16,"end":25,"cssClass":"pl-s1"},{"start":27,"end":32,"cssClass":"pl-s1"},{"start":33,"end":35,"cssClass":"pl-c1"},{"start":36,"end":40,"cssClass":"pl-s1"},{"start":41,"end":46,"cssClass":"pl-en"}],[{"start":16,"end":18,"cssClass":"pl-k"},{"start":19,"end":22,"cssClass":"pl-c1"},{"start":23,"end":27,"cssClass":"pl-s1"},{"start":28,"end":43,"cssClass":"pl-s1"},{"start":44,"end":50,"cssClass":"pl-en"},{"start":51,"end":60,"cssClass":"pl-s1"}],[{"start":20,"end":25,"cssClass":"pl-k"},{"start":26,"end":36,"cssClass":"pl-s1"},{"start":37,"end":48,"cssClass":"pl-v"}],[{"start":24,"end":65,"cssClass":"pl-s"}],[{"start":24,"end":69,"cssClass":"pl-s"}],[],[{"start":16,"end":23,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":30,"cssClass":"pl-s1"},{"start":31,"end":55,"cssClass":"pl-en"},{"start":56,"end":65,"cssClass":"pl-s1"}],[{"start":16,"end":24,"cssClass":"pl-s1"},{"start":25,"end":28,"cssClass":"pl-en"},{"start":29,"end":36,"cssClass":"pl-s1"},{"start":39,"end":40,"cssClass":"pl-c1"},{"start":41,"end":46,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":27,"cssClass":"pl-s1"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":20,"cssClass":"pl-en"},{"start":21,"end":25,"cssClass":"pl-s1"}],[{"start":8,"end":79,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":16,"cssClass":"pl-s"}],[{"start":0,"end":78,"cssClass":"pl-s"}],[{"start":0,"end":15,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":23,"cssClass":"pl-s1"},{"start":24,"end":31,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-k"}],[{"start":12,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"}],[{"start":12,"end":15,"cssClass":"pl-k"},{"start":16,"end":25,"cssClass":"pl-s1"},{"start":27,"end":32,"cssClass":"pl-s1"},{"start":33,"end":35,"cssClass":"pl-c1"},{"start":36,"end":40,"cssClass":"pl-s1"},{"start":41,"end":46,"cssClass":"pl-en"}],[{"start":16,"end":18,"cssClass":"pl-k"},{"start":19,"end":22,"cssClass":"pl-c1"},{"start":23,"end":27,"cssClass":"pl-s1"},{"start":28,"end":43,"cssClass":"pl-s1"},{"start":44,"end":50,"cssClass":"pl-en"},{"start":51,"end":60,"cssClass":"pl-s1"}],[{"start":20,"end":25,"cssClass":"pl-k"},{"start":26,"end":36,"cssClass":"pl-s1"},{"start":37,"end":48,"cssClass":"pl-v"}],[{"start":24,"end":65,"cssClass":"pl-s"}],[{"start":24,"end":65,"cssClass":"pl-s"}],[],[{"start":16,"end":23,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":30,"cssClass":"pl-s1"},{"start":31,"end":55,"cssClass":"pl-en"},{"start":56,"end":65,"cssClass":"pl-s1"}],[{"start":16,"end":24,"cssClass":"pl-s1"},{"start":25,"end":32,"cssClass":"pl-s1"},{"start":34,"end":35,"cssClass":"pl-c1"},{"start":36,"end":41,"cssClass":"pl-s1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":27,"cssClass":"pl-s1"}],[],[{"start":4,"end":17,"cssClass":"pl-en"},{"start":5,"end":17,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":32,"cssClass":"pl-en"},{"start":33,"end":42,"cssClass":"pl-s1"}],[{"start":8,"end":63,"cssClass":"pl-s"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":18,"cssClass":"pl-en"},{"start":19,"end":28,"cssClass":"pl-s1"},{"start":29,"end":36,"cssClass":"pl-en"},{"start":37,"end":40,"cssClass":"pl-s"},{"start":42,"end":44,"cssClass":"pl-s"},{"start":46,"end":53,"cssClass":"pl-en"},{"start":54,"end":57,"cssClass":"pl-s"},{"start":59,"end":61,"cssClass":"pl-s"},{"start":64,"end":65,"cssClass":"pl-c1"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":13,"cssClass":"pl-en"},{"start":14,"end":18,"cssClass":"pl-s1"}],[{"start":8,"end":40,"cssClass":"pl-s"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":18,"cssClass":"pl-en"},{"start":19,"end":23,"cssClass":"pl-s1"},{"start":24,"end":30,"cssClass":"pl-en"}]],"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Qiskit/qiskit/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"counts.py","displayUrl":"https://github.com/Qiskit/qiskit/blob/main/qiskit/result/counts.py?raw=true","headerInfo":{"blobSize":"8.04 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"8b90ff0","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FQiskit%2Fqiskit%2Fblob%2Fmain%2Fqiskit%2Fresult%2Fcounts.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"189","truncatedSloc":"171"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Qiskit/qiskit/blob/main/qiskit/result/counts.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/Qiskit/qiskit/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/Qiskit/qiskit/raw/main/qiskit/result/counts.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":4,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"Counts","kind":"class","ident_start":1020,"ident_end":1026,"extent_start":1014,"extent_end":8230,"fully_qualified_name":"Counts","ident_utf16":{"start":{"line_number":26,"utf16_col":6},"end":{"line_number":26,"utf16_col":12}},"extent_utf16":{"start":{"line_number":26,"utf16_col":0},"end":{"line_number":188,"utf16_col":33}}},{"name":"bitstring_regex","kind":"constant","ident_start":1108,"ident_end":1123,"extent_start":1108,"extent_end":1150,"fully_qualified_name":"Counts.bitstring_regex","ident_utf16":{"start":{"line_number":29,"utf16_col":4},"end":{"line_number":29,"utf16_col":19}},"extent_utf16":{"start":{"line_number":29,"utf16_col":4},"end":{"line_number":29,"utf16_col":46}}},{"name":"__init__","kind":"function","ident_start":1160,"ident_end":1168,"extent_start":1156,"extent_end":5386,"fully_qualified_name":"Counts.__init__","ident_utf16":{"start":{"line_number":31,"utf16_col":8},"end":{"line_number":31,"utf16_col":16}},"extent_utf16":{"start":{"line_number":31,"utf16_col":4},"end":{"line_number":115,"utf16_col":36}}},{"name":"most_frequent","kind":"function","ident_start":5396,"ident_end":5409,"extent_start":5392,"extent_end":6142,"fully_qualified_name":"Counts.most_frequent","ident_utf16":{"start":{"line_number":117,"utf16_col":8},"end":{"line_number":117,"utf16_col":21}},"extent_utf16":{"start":{"line_number":117,"utf16_col":4},"end":{"line_number":134,"utf16_col":35}}},{"name":"hex_outcomes","kind":"function","ident_start":6152,"ident_end":6164,"extent_start":6148,"extent_end":7075,"fully_qualified_name":"Counts.hex_outcomes","ident_utf16":{"start":{"line_number":136,"utf16_col":8},"end":{"line_number":136,"utf16_col":20}},"extent_utf16":{"start":{"line_number":136,"utf16_col":4},"end":{"line_number":157,"utf16_col":27}}},{"name":"int_outcomes","kind":"function","ident_start":7085,"ident_end":7097,"extent_start":7081,"extent_end":7938,"fully_qualified_name":"Counts.int_outcomes","ident_utf16":{"start":{"line_number":159,"utf16_col":8},"end":{"line_number":159,"utf16_col":20}},"extent_utf16":{"start":{"line_number":159,"utf16_col":4},"end":{"line_number":179,"utf16_col":27}}},{"name":"_remove_space_underscore","kind":"function","ident_start":7966,"ident_end":7990,"extent_start":7962,"extent_end":8133,"fully_qualified_name":"Counts._remove_space_underscore","ident_utf16":{"start":{"line_number":182,"utf16_col":8},"end":{"line_number":182,"utf16_col":32}},"extent_utf16":{"start":{"line_number":182,"utf16_col":4},"end":{"line_number":184,"utf16_col":66}}},{"name":"shots","kind":"function","ident_start":8143,"ident_end":8148,"extent_start":8139,"extent_end":8230,"fully_qualified_name":"Counts.shots","ident_utf16":{"start":{"line_number":186,"utf16_col":8},"end":{"line_number":186,"utf16_col":13}},"extent_utf16":{"start":{"line_number":186,"utf16_col":4},"end":{"line_number":188,"utf16_col":33}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/Qiskit/qiskit/branches":{"post":"Ru56EVEuoPmdj8ZAAHxUTIhT4bpPzPxVrsxW2XH9GROn2JhTGrgSc15Wu-LmJ7GCkfjm8ETRnMIBbyq1jF63JA"},"/repos/preferences":{"post":"wVzFRYoICS5jID2C3riygGPHpJMvDd-8rlfXeCIjEY_jVhSEt53j83G9GVH-1fjbUgAyn2OMy52QV3AiOa9Q0A"}}},"title":"qiskit/qiskit/result/counts.py at main ยท Qiskit/qiskit"}