pipermerriam/flex

Flex breaks in Python 3.5.2

nickdirienzo opened this issue · 7 comments

Hey there!

Just updated to 3.5.2 and flex throws this stack trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ndirienzo/code/frontdoor/frontdoor/utils.py", line 83, in compile_all
    schema = flex.load(schema_file)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/core.py", line 99, in load
    return parse(raw_schema)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/core.py", line 84, in parse
    swagger_definitions = definitions_validator(raw_schema, context=context)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/validation/common.py", line 361, in validate_object
    schema_validators.validate_object(obj, context=context)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/datastructures.py", line 75, in validate_object
    validator(obj, **kwargs)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/datastructures.py", line 46, in __call__
    return self.validate_object(*args, **kwargs)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/datastructures.py", line 41, in validate_object
    validator(obj, **kwargs)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/decorators.py", line 52, in inner
    return func(value, *args, **kwargs)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/decorators.py", line 37, in inner
    return func(value, *args, **kwargs)
  File "/Users/ndirienzo/.virtualenvs/api/lib/python3.5/site-packages/flex-5.6.0-py3.5.egg/flex/functional.py", line 9, in chain_reduce
    value = function(value, **kwargs)
TypeError: methodcaller does not take keyword arguments

The function at this execution step is: (operator.methodcaller('get', 'parameters', <flex.constants.Empty object at 0x105589358>). It's strange, though, because it doesn't look like operator changed between the releases of 3.5.1 and 3.5.2; it also looks like operator.methodcaller takes kwargs, so not sure what's happening.

Anyone have any ideas?

Not entirely sure what would break because of this, but:

def chain_reduce(value, functions, **kwargs):
    for function in functions:
        try:
            value = function(value, **kwargs)
        except TypeError:
            value = function(value)
    return value

function is trying to call get on a dict, but get doesn't take any kwargs, so it's failing. Not sure why this is happening in the latest version of Python3, though...

It looks like we've only been testing against python 3.4

Capability with 3.5 should be pretty straight forward if you'd like to take
a stab at it.

On Mon, Jul 11, 2016, 8:15 PM Nick DiRienzo notifications@github.com
wrote:

Not entirely sure what would break because of this, but:

def chain_reduce(value, functions, *_kwargs):
for function in functions:
try:
value = function(value, *_kwargs)
except TypeError:
value = function(value)
return value

function is trying to call get on a dict, but get doesn't take any
kwargs, so it's failing. Not sure why this is happening in the latest
version of Python3, though...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#120 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAyTgtuSgXrk4f97aa_rzY5rC8ieXqgjks5qUvjQgaJpZM4JJ91F
.

Sure. I'll give it a go.

Hi folks,

I got affected by this issue. I am not a expert on Python but at least I would like to to share the official documentation related with changes between version 3.4 and 3.5 https://docs.python.org/3/whatsnew/3.5.html.

It seems this was already fixed with #121 and can be closed.

blag commented

We now run tests with Python 3.5.

@nickdirienzo I'm closing this issue, but I'm happy to reopen it if you are still seeing this error. Thanks!

Thanks @blag for the update and @mbachry for fixing. Sorry I didn’t get to it! Really appreciate it. 🙏