Module osbot_utils.fluent.Fluent_Dict

Expand source code
from osbot_utils.fluent.Fluent_List import Fluent_List

class Fluent_Dict(dict):
    def __new__(cls, *args, **kwargs):
        first_one = args[0]
        return super().__new__(cls, first_one)

    def __init__(self,*args,**kwargs):
        self.data = args[0]
        super().__init__(*args,**kwargs)

    def keys(self):
        return Fluent_List(sorted(list(self.data.keys())))

    def size(self):
        return len(self.data)

    def type(self):
        return type(self)

Classes

class Fluent_Dict (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Expand source code
class Fluent_Dict(dict):
    def __new__(cls, *args, **kwargs):
        first_one = args[0]
        return super().__new__(cls, first_one)

    def __init__(self,*args,**kwargs):
        self.data = args[0]
        super().__init__(*args,**kwargs)

    def keys(self):
        return Fluent_List(sorted(list(self.data.keys())))

    def size(self):
        return len(self.data)

    def type(self):
        return type(self)

Ancestors

  • builtins.dict

Methods

def keys(self)

D.keys() -> a set-like object providing a view on D's keys

Expand source code
def keys(self):
    return Fluent_List(sorted(list(self.data.keys())))
def size(self)
Expand source code
def size(self):
    return len(self.data)
def type(self)
Expand source code
def type(self):
    return type(self)