Giter VIP home page Giter VIP logo

pyszn's People

Contributors

carlos-jenkins avatar dajose avatar eduar-m avatar jpmh1309 avatar ocelotl avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyszn's Issues

PyParsing 2.3.0 issue

Latest working version of PyParsing for PySZN was version 2.2.2. Then, the next release, 2.3.0, released 9 days ago, breaks the parsing of SZN.

The issue is located at line 188 of the file parser.py:

            parsed = statement.parseString(line)

With PyParsing 2.2.2 the output is the following:

ipdb> parsed
(
    ['hs1', ':', '1', '--', 'sw1', ':', '1'],
    {
        'endpoint_a': [
            ((['hs1', ':', '1'], {'node': [('hs1', 0)], 'port': [('1', 2)]}), 0),
        ],
        'endpoint_b': [
            ((['sw1', ':', '1'], {'node': [('sw1', 0)], 'port': [('1', 2)]}), 4),
        ],
        'link': [
            (
                (
                    ['hs1', ':', '1', '--', 'sw1', ':', '1'],
                    {
                        'endpoint_a': [
                            (
                                (
                                    ['hs1', ':', '1'],
                                    {'node': [('hs1', 0)], 'port': [('1', 2)]},
                                ),
                                0,
                            ),
                        ],
                        'endpoint_b': [
                            (
                                (
                                    ['sw1', ':', '1'],
                                    {'node': [('sw1', 0)], 'port': [('1', 2)]},
                                ),
                                4,
                            ),
                        ],
                        'node': [('hs1', 0), ('sw1', 4)],
                        'port': [('1', 2), ('1', 6)],
                    },
                ),
                0,
            ),
        ],
        'node': [('hs1', 0), ('sw1', 4)],
        'port': [('1', 2), ('1', 6)],
    },
)

With PyParsing 2.3.0, the following is returned:

ipdb> parsed
(
    ['hs1', ':', '1', '--', 'sw1', ':', '1'],
    {
        'endpoint_a': [(['hs1', ':', '1'], {})],
        'endpoint_b': [(['sw1', ':', '1'], {})],
        'link': [(['hs1', ':', '1', '--', 'sw1', ':', '1'], {})],
        'node': ['hs1', 'sw1'],
        'port': ['1', '1'],
    },
)

This makes that the later calls parsed.link.endpoint_a.node fail because the element doesn't exists. Because of the broad way the try/catch is set, this result in an really unrelated ParseException , but it is really not.

The solution is to review why the parser is returning such different and wrong data, as the semantics of the grammar isn't respected in the newer version.

I checked the release notes, but nothing really enlightening is said:

https://github.com/pyparsing/pyparsing/releases/tag/pyparsing_2.3.0

What is not a solution is to pin the pyparsing package in a public library, that will impose on the version users of this library may have and break their system. If you need a specific version in your environment pin it there, either before or after the pyszn requirement itself.

I started some work on the refresh branch, and still investigating the issue in depth.

Regards

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.