Code Monkey home page Code Monkey logo

pyszn's Introduction

Python package for SZN

A Python package for the Simplified Zone Notation standard.

Documentation

https://pyszn.readthedocs.org/

Changelog

1.6.0 (2022-06-07)

New

  • Add the capability to specify subnodes by using ´node>subnode´ syntax.
  • Add the capability to specify a multiline text as value of an attribute by using ``` [Sergio Salazar]

1.5.0 (2021-11-04)

Changes

  • Up to a 10x speedup when parsing attribute injection [Max Nedorezov]

1.4.0 (2021-05-21)

New

  • Support parse topology from a 'TOPOLOGY_ID' [Jose Martinez]

1.3.0 (2020-10-05)

New

  • Allow user to skip paths using fnmatch [David Diaz]

1.2.0 (2019-06-11)

New

  • Support for lists and floats types [Eduardo Mora]

1.1.1 (2018-11-21)

Changes

  • Parser supports multiline attributes. [Javier Peralta]

1.1.0 (2018-11-09)

Changes

  • Dropped support for Python 2.7. [Carlos Jenkins]

Fix

  • Fix grammar description for pyparsing > 2.2.2. [Carlos Jenkins]

1.0.0 (2017-11-02)

Initial public release.

New

  • Inject support links ports and env. [Javier Peralta]

License

Copyright (C) 2016-2021 Hewlett Packard Enterprise Development LP

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

pyszn's People

Contributors

carlos-jenkins avatar dajose avatar eduar-m avatar jpmh1309 avatar ocelotl avatar sergeniushpe 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.