Python typing.KeysView() Examples

The following are 14 code examples of typing.KeysView(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module typing , or try the search function .
Example #1
Source File: main.py    From brownie with MIT License 5 votes vote down vote up
def keys(self) -> KeysView[Any]:
        return self._containers.keys() 
Example #2
Source File: datatypes.py    From brownie with MIT License 5 votes vote down vote up
def keys(self) -> KeysView:
        """ReturnValue.keys() -> a set-like object providing a view on ReturnValue's keys"""
        return self._dict.keys()  # type: ignore 
Example #3
Source File: dag_processing.py    From airflow with Apache License 2.0 5 votes vote down vote up
def dag_ids(self) -> KeysView[str]:
        """
        :return: IDs of all the DAGs in this
        :rtype: list[unicode]
        """
        return self.dag_id_to_simple_dag.keys() 
Example #4
Source File: chunkstore.py    From xcube with MIT License 5 votes vote down vote up
def keys(self) -> KeysView[str]:
        if self._trace_store_calls:
            print(f'{self._class_name}.keys()')
        return self._vfs.keys() 
Example #5
Source File: tracker_store.py    From rasa_core with Apache License 2.0 5 votes vote down vote up
def keys(self) -> KeysView[Text]:
        return self.store.keys() 
Example #6
Source File: views.py    From anndata with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def keys(self) -> KeysView[str]:
        # it’s a structured array
        return self.dtype.names 
Example #7
Source File: base.py    From Neuraxle with Apache License 2.0 5 votes vote down vote up
def keys(self) -> KeysView:
        """
        Returns the step names.

        :return: list of step names
        """
        return self.steps.keys() 
Example #8
Source File: header.py    From ezdxf with MIT License 5 votes vote down vote up
def varnames(self) -> KeysView:
        """ Returns an iterable of all header variable names. """
        return self.hdrvars.keys() 
Example #9
Source File: dictionary.py    From ezdxf with MIT License 5 votes vote down vote up
def keys(self) -> KeysView:
        """ Returns :class:`KeysView` of all dictionary keys. """
        return self._data.keys() 
Example #10
Source File: attributes.py    From ezdxf with MIT License 5 votes vote down vote up
def keys(self) -> KeysView[str]:
        return self._attribs.keys() 
Example #11
Source File: mtgjson_card.py    From mtgjson with MIT License 5 votes vote down vote up
def keys(self) -> KeysView:
        """
        Return internal dictionary keys
        :return: Keys
        """
        return self.get_all().keys() 
Example #12
Source File: hashing_tfidf_vectorizer.py    From DeepPavlov with Apache License 2.0 5 votes vote down vote up
def get_counts(self, docs: List[str], doc_ids: List[Any]) \
            -> Generator[Tuple[KeysView, ValuesView, List[int]], Any, None]:
        """Get term counts for a list of documents.

        Args:
            docs: a list of input documents
            doc_ids: a list of document ids corresponding to input documents

        Yields:
            a tuple of term hashes, count values and column ids

        Returns:
            None

        """
        logger.info("Tokenizing batch...")
        batch_ngrams = list(self.tokenizer(docs))
        logger.info("Counting hash...")
        doc_id = iter(doc_ids)
        for ngrams in batch_ngrams:
            counts = Counter([hash_(gram, self.hash_size) for gram in ngrams])
            hashes = counts.keys()
            values = counts.values()
            _id = self.doc_index[next(doc_id)]
            if values:
                col_id = [_id] * len(values)
            else:
                col_id = []
            yield hashes, values, col_id 
Example #13
Source File: test_typing_annotations.py    From typecheck-decorator with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def foo_KeysView_to_Sequence(v: tg.KeysView[Tc]) -> tg.Sequence[Tc]:
    result = [item for item in v]
    result.sort()
    assert len([item for item in v]) == len(result)  # iterable not exhausted
    return result 
Example #14
Source File: common.py    From VxWireguard-Generator with MIT License 5 votes vote down vote up
def keys(self) -> KeysView[KT]:
        return cast(KeysView[KT], sorted(super().keys()))