GithubHelp home page GithubHelp logo

obiwan's People

Contributors

waynenilsen avatar williame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

obiwan's Issues

Noneable key in dict

Expected the following to be valid:

    template = {
        'person': [{
            'id': int,
            obiwan.noneable('name'): str
        }]
    }

    test = {'person': [{'id': 1, 'name': None}]}

    obiwan.duckable(test, template)

But seems like it isn't.

None should match NoneType

The documentation says

noneable is just a way of saying {...,None}

I would prefer to use the {...,None} syntax, as it's more concise and more convenient. However, obiwan doesn't seem to actually let None match None, objecting that None is not the same as NoneType. (And NoneType is hard to use as a literal.)

abstract base class bug?

I have a minimal working example of this bug in python 3.4

import abc
from obiwan import *; install_obiwan_runtime_check()

class Foo(metaclass=abc.ABCMeta):

    @abc.abstractmethod
    def bar(self):
        pass

class FooImpl(Foo):
    def bar(self):
        print('hi')

def do_stuff_with_a_foo_implementation(f: [Foo]):
    f.bar()

do_stuff_with_a_foo_implementation([FooImpl()])

I'm not sure what it is about the list that causes the trouble but it is required. It works fine without the list

Console dump:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\obiwan\__init__.py", line 281, in duckable

    if not isinstance(obj, collections.abc.Sequence):
AttributeError: 'module' object has no attribute 'abc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "obiwan_abc_test.py", line 17, in <module>
    do_stuff_with_a_foo_implementation([FooImpl()])
  File "obiwan_abc_test.py", line 14, in do_stuff_with_a_foo_implementation
    def do_stuff_with_a_foo_implementation(f: [Foo]):
  File "C:\Python34\lib\site-packages\obiwan\__init__.py", line 401, in _runtime
_checker
    duckable(arg, constraint, "%s(%s)" % (frame.f_code.co_name, key))
  File "C:\Python34\lib\site-packages\obiwan\__init__.py", line 318, in duckable

    raise ObiwanError("%s internal error: %s" % (ctx, e))
obiwan.ObiwanError: do_stuff_with_a_foo_implementation(f) internal error: 'modul
e' object has no attribute 'abc'

Add appropriate classifiers

setup.py is missing classifiers like

classifiers=(
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'License :: OSI Approved :: Apache Software License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',

    ),

This will help us know to try this library we need python 2 or python 3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.