معرفی شرکت ها


duckt-0.1.1


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Python package facilitating duck typing through attribute traverse utilities
ویژگی مقدار
سیستم عامل -
نام فایل duckt-0.1.1
نام duckt
نسخه کتابخانه 0.1.1
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Vladyslav Halchenko
ایمیل نویسنده valh@tuta.io
آدرس صفحه اصلی https://github.com/monomonedula/duckt
آدرس اینترنتی https://pypi.org/project/duckt/
مجوز MIT
# duckt [![Travis CI build status](https://travis-ci.org/monomonedula/duck.svg?branch=master)](https://travis-ci.org/monomonedula/duck.svg?branch=master) [![codecov](https://codecov.io/gh/monomonedula/duck/branch/master/graph/badge.svg)](https://codecov.io/gh/monomonedula/duck) [![PyPI version](https://badge.fury.io/py/duckt.svg)](https://badge.fury.io/py/duckt) A small Python package facilitating duck typing through attribute traverse utilities This replaces try/except chains when trying to call different methods: ```python from duckt import Duck, DuckCall class Lion: def roar(self): return "roar!" creature = Lion() assert Duck(creature).attr_call( DuckCall("make_sound", ["woof"]), # tries to call creature.make_sound("woof") DuckCall("make_sound", ["buzz", 100]), # tries to call creature.buzz("buzz", 100) DuckCall("bark"), # creature.bark() DuckCall("roar"), # creature.roar() DuckCall("speak", ["Hello "], {"times": 3}) # creature.speak("Hello ", times=3) ) == "roar!" # returns the output of the first successfull call # if none of the call attempts was successful then the last raised error will be thrown ``` **DuckCall** class is fully replacable here with any custom callable accepting single argument. This argument is the **Duck**-wrapped object, so you can implement custom attribute extracting and/or calling behavior here. **AttributeError**s and **TypeError**s thrown from this callable is handled by the **Duck** instance. Simplified interface for property extraction: ```python from duckt import Duck class Person: full_name = "John Doe" some_person = Person() name = Duck(some_person).attr('first_name', 'name', 'full_name') # name now is equal to the first present attribute # otherwise AttributeError is thrown ``` You may also use **Duck** as wrapper to a callable: ```python from duckt import Duck def foo(some_string): print(some_string) duck = Duck(foo) duck.call( ["hello", "world"], # foo("hello", "world") ["hello world"], # foo("hello world") [[], {"hello": "world"}] # foo(hello="world") ) ``` # Installation ```shell script pip install duckt ``` That's it.


زبان مورد نیاز

مقدار نام
>=3.6,<4.0 Python


نحوه نصب


نصب پکیج whl duckt-0.1.1:

    pip install duckt-0.1.1.whl


نصب پکیج tar.gz duckt-0.1.1:

    pip install duckt-0.1.1.tar.gz