semvec/pypi-packages huggingface dataset:
ya.dotdict 1.0.2
Attribute access for dictionary-like objects
Requires Python: >=3.6

.. image:: https://github.com/knowikow/ya.dotdict.py/workflows/build/badge.svg
   :target: https://github.com/knowikow/ya.dotdict.py/workflows/build/badge.svg

===================
Yet Another DotDict
===================

A Python library providing attribute access for dictionaries.
The library provides these classes:

- ``ya.dotdict.DotDict`` as a replacement for ``dict`` and ``collections.defaultdict``
- ``ya.dotdict.DotDictMixin``: a mixin class that can be used to add attribute-style access to any dict-like class.
  ``ya.dotdict.DotDict`` is implemented in terms of this mixin class

All the code examples assume::

   >>> from ya.dotdict import *

Simple use case: access dictionary items as attributes
======================================================

``DotDict`` can be used as a replacement for ``dict``::

   >>> d = DotDict()
   >>> d['spam'] = 'eggs'
   >>> d.spam
   'eggs'
   >>> d.spam = 100
   >>> d['spam']
   100

Deleting attributes also works as expected::

   >>> del d.spam
   >>> d.spam
   Traceback (most recent call last):
      ...
   AttributeError: spam


Create default values (like ``collections.defaultdict``)
========================================================

``DotDict`` can be used as a replacement for ``defaultict``::

   >>> d = DotDict(lambda: 'eggs')
   >>> d.spam
   'eggs'
   >>> d.spam = 100
   >>> d['spam']
   100
   >>> d._default_factory = lambda: 'foo'
   >>> d.bar
   'foo'

If the default value factory takes an argument, then the key is passed to it::

   >>> d._default_factory = lambda key: [key, 1000]
   >>> d.foo
   ['foo', 1000]


If the default value factory takes more than one argument, a TypeError will be raised::

   >>> d._default_factory = lambda x, y: [x, y]
   Traceback (most recent call last):
      ...
   TypeError: defult_factory can only take zero or one argument

``DotDictMixin``
================

A mixin class to provide attribute access to dict-like classes. ``DotDict`` is implemented using ``DotDictMixin`` like this::

   class DictClass(DotDictMixin, dict): pass
py-fibonacci 0.5.2
Generates Fibonacci series with an end number OR a length argument.
Requires Python: >=3.6

# Fibonacci Series

### Fibonacci Series is a list of numbers in which one number on the series is the sum of the previous two numbers.

    def fibonacci(end=None, start=0, inclusive=True, length=None):
        ...

### Installation and usage
pip install py-fibonacci

from fibonacci import fibonacci

e.g. fibonacci(39) -> returns a list, you may assign it to a variable or print it.

### This python package of fibonacci series, provides two use cases:

1. With an 'end' number argument:: so it is possible to list the fibonacci series up to that number and start (*default: 0*) number argument is optional. An optional boolean inclusive (*default: True*) argument makes the end number inclusive or exclusive.

examples: 

    fibonacci(39) 
        -> only end number is given. there are several fibonacci numbers upto 39 starting at 0.

    fibonacci(39, 3) 
        -> end and start numbers are given. there are several fibonacci numbers upto 39 starting at 3.

    fibonacci(39, 3, False) 
        -> end, start numbers and inclusive=False are given. there are several fibonacci numbers upto 39 (exclusive) starting at 3.


2. With a 'length' number argument:: so it is possible to set the length of the series and start (*default: 0*) number argument is optional. 

examples: 

    fibonacci(length=20) 
        -> only length of the series is given. there are 20 fibonacci numbers starting at 0.

    fibonacci(start=5, length=20) 
        -> start number and length of the series is given. there are 20 fibonacci numbers starting at 5.