que/util.py
def factory(
        obj: Union[Dict, Sequence[Tuple[Hashable, Any]]],
        exclude: Optional[Any] = Nothing,
    ) -> Dict:
        """Produce a dictionary from a supplied object. Optionally exclude a specific value or type from the output

        Examples
        --------
        >>> DictFactory.factory({'x': 0, 'y': None}, exclude=None)
        {'x': 0}
        >>> DictFactory.factory([('x', 0), ('y', None)], exclude=int)
        {'y': None}
        """
        if isinstance(obj, Dict) and exclude is Nothing:
            # Don't do anything if we don't have to
            return obj
        # coerce Dict to simplify transformation
        obj = obj.items() if isinstance(obj, Dict) else obj

        def _cmp(val):
            """Set the comparator"""
            return (
                isinstance(val, exclude)
                if isinstance(exclude, type)
                else val == exclude
            )

        return dict(((x, y) for x, y in obj if _cmp(y) is False))
Produce a dictionary from a supplied object. Optionally exclude a specific value or type from the output

        Examples
        --------
        >>> DictFactory.factory({'x': 0, 'y': None}, exclude=None)
        {'x': 0}
        >>> DictFactory.factory([('x', 0), ('y', None)], exclude=int)
        {'y': None}
        
Produce a dictionary from a supplied object. Optionally exclude a specific value or type from the output
Examples


Produce a dictionary from a supplied object . Optionally exclude a specific value or type from the output Examples
def factory(
        obj: Union[Dict, Sequence[Tuple[Hashable, Any]]],
        exclude: Optional[Any] = Nothing,
    ) -> Dict:
        if isinstance(obj, Dict) and exclude is Nothing:
            return obj
        obj = obj.items() if isinstance(obj, Dict) else obj
        def _cmp(val):
            return (
                isinstance(val, exclude)
                if isinstance(exclude, type)
                else val == exclude
            )
        return dict(((x, y) for x, y in obj if _cmp(y) is False))
def factory ( obj : Union [ Dict , Sequence [ Tuple [ Hashable , Any ] ] ] , exclude : Optional [ Any ] = Nothing , ) -> Dict : if isinstance ( obj , Dict ) and exclude is Nothing : return obj obj = obj . items ( ) if isinstance ( obj , Dict ) else obj def _cmp ( val ) : """Set the comparator""" return ( isinstance ( val , exclude ) if isinstance ( exclude , type ) else val == exclude ) return dict ( ( ( x , y ) for x , y in obj if _cmp ( y ) is False ) )
Produce a dictionary from a supplied object.
Produce a dictionary from a supplied object .
"""Produce a dictionary from a supplied object. Optionally exclude a specific value or type from the output

        Examples
        --------
        >>> DictFactory.factory({'x': 0, 'y': None}, exclude=None)
        {'x': 0}
        >>> DictFactory.factory([('x', 0), ('y', None)], exclude=int)
        {'y': None}
        """ # Don't do anything if we don't have to # coerce Dict to simplify transformation """Set the comparator"""
obj
Union[Dict, Sequence[Tuple[Hashable, Any]]]
exclude
Optional[Any]