Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Python fixed size array #7529

Merged
merged 13 commits into from Sep 22, 2022

Commits on Sep 8, 2022

  1. feat: Added support for fixed sized arrays to python

    Problem:
    We encountered that using fixed arrays from C++ to python that python would
    not read those arrays correctly due to no size information being encoded in the byte
    array itself.
    
    Fix:
    Encode the sizes within the generated python file during code generation.
    Specfically we add GetArrayAsNumpy to the python version of table, which takes as input
    the length of the vector. When generating the python message files we include this length
    from the VectorType().fixed_length.
    joshua-smith8 committed Sep 8, 2022
    Copy the full SHA
    9d8ca27 View commit details
    Browse the repository at this point in the history
  2. fix: added digit support for camel case to snake case conversion

    Problem:
    When including a number in the message name we would encounter cases where SnakeCase would
    not add the appropirate breaks. e.g. Int32Stamped -> int_32stamped rather than int_32_stamped.
    
    Fix:
    To fix this we can add the condition that we check if the current character is not lower and
    not a digit, that we check if the previous character was a lower or digit. If it was a lower
    or digit then we add the break.
    joshua-smith8 committed Sep 8, 2022
    Copy the full SHA
    5fd40f6 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2022

  1. fix: Array support for structures

    Problem:
    The python generated code for handling non-struct and struct vectors
    and arrays was inconsistent. The calls to populate the obj api was
    creating incorrect code.
    
    Solution:
    To fix this the VectorOfStruct and VectorOfNonStruct was rewritten
    to handle array cases and bring the two methods in line which each
    other.
    
    Testing:
    PythonTesting.sh now correctly runs and generates the code for
    array_test.fbs.
    Minor modifications were done on the test to use the new index
    accessor for struct arrays and the script correctly sources the
    location of the python code.
    joshua-smith8 committed Sep 13, 2022
    Copy the full SHA
    46299dd View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    146de9c View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2022

  1. Copy the full SHA
    0781511 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2022

  1. Added code generated by scripts/generate_code. Modified GetArrayOfNon…

    …Struct slightly
    
    to allow for function overloading allowing the user to get a single element of an array
    or the whole array.
    joshua-smith8 committed Sep 15, 2022
    Copy the full SHA
    f88247c View commit details
    Browse the repository at this point in the history
  2. Merge branch 'PythonFixedSizeArray' of github.com:ocadotechnology/fla…

    …tbuffers into PythonFixedSizeArray
    joshua-smith8 committed Sep 15, 2022
    Copy the full SHA
    348177b View commit details
    Browse the repository at this point in the history
  3. Added new_line parameter to OffsetPrefix to allow optional new lines …

    …to be added.
    
    This allows us to use the GenIndents method that automatically adds new lines instead.
    joshua-smith8 committed Sep 15, 2022
    Copy the full SHA
    f05af7a View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    26b0eb8 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    3818348 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2022

  1. Updated Array lengths to use Length methods where possible. Added fal…

    …lthrough for GenTypePointer. Added digit check to CamelToSnake method. Added and modified tests for ToSnakeCase and CamelToSnake.
    joshua-smith8 committed Sep 16, 2022
    Copy the full SHA
    93086f0 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2022

  1. Added range check on the getter methods for vector and array types. R…

    …enamed == as is for python
    joshua-smith8 committed Sep 21, 2022
    Copy the full SHA
    b627623 View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2022

  1. Copy the full SHA
    6bb6812 View commit details
    Browse the repository at this point in the history