diff options
author | Joseph Pyott <joseph@pyott.me> | 2019-07-26 14:06:25 -0400 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-07-26 11:06:25 -0700 |
commit | 9fa8245e81a2fd8ad19f9ae8f3da3a00e796e462 (patch) | |
tree | cc64e4a10c55c94fa7be0e81ac08abe08d4984fa /tests/MyGame/Example | |
parent | a5ca8bee4d56df1588b21d667135be351d6c0e75 (diff) | |
download | flatbuffers-9fa8245e81a2fd8ad19f9ae8f3da3a00e796e462.tar.gz flatbuffers-9fa8245e81a2fd8ad19f9ae8f3da3a00e796e462.tar.bz2 flatbuffers-9fa8245e81a2fd8ad19f9ae8f3da3a00e796e462.zip |
Python: Added support for file_identifiers (#5123)
* Python: Added support for file_identifiers
* Added tests. Fixed file_identifier code.
* Python: Fixed excessive padding of file_identifier. Repaired tests.
* Python: Made code compatible with python2.7
* Python: Typo fix in @endcond
* whitespace normaalization
* Stylistic change from if(not X is None) to if(X is not None). Added comment to type string.
* Python: Added support for automatic code generation of file_identifiers. Added tests for said code generation.
* converted sprintf to snprintf
* Bugfix, added snprint deffinition for MSVC
* changed snprint deffinition for MSVC to sprint_s
* changed scanf to IntToStringHex. Renamed HasFileIdentifier to GenHasFileIdentifier.
* Added updated genereated code to commit
* Python bugix: flatc no longer produces HasFileIdentfier for shcemas with no file identifier
* Added tests to verify `MonsterBufferHasIdentifier` returns false on no Identifier
* Python: added tests for GetBufferIdentifier and BufferHasIdentifier
Python: removed unessasary parenethesis in if statements
Minor format changes.
* Python : correceted instances of keyword arguments being called as positional arguments
* fixed typos and grammer in comments
* Minor style fixes
* Indentation fix
* Equals style changes
* Python: Fixed Alignment Issues. Changed test code to test against atual output
* Ran make(forgot to run make last commit)
* Python: Style changes
* Style changes
* indentation and style
* readded CONTRIBUTING.md
* Formatting tweak
Mostly to make CI run again
* More formatting fixes
* More formatting fixes
* More formatting fixes
* More formatting fixes
* Formatting fix
* More formatting fixes
* Formatting
* ran generate_code.sh
Diffstat (limited to 'tests/MyGame/Example')
-rw-r--r-- | tests/MyGame/Example/ArrayTable.py | 4 | ||||
-rw-r--r-- | tests/MyGame/Example/Monster.py | 4 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.py | 4 | ||||
-rw-r--r-- | tests/MyGame/Example/Stat.py | 4 | ||||
-rw-r--r-- | tests/MyGame/Example/TestSimpleTableWithEnum.py | 4 | ||||
-rw-r--r-- | tests/MyGame/Example/TypeAliases.py | 4 |
6 files changed, 24 insertions, 0 deletions
diff --git a/tests/MyGame/Example/ArrayTable.py b/tests/MyGame/Example/ArrayTable.py index 12eefd31..6d583f92 100644 --- a/tests/MyGame/Example/ArrayTable.py +++ b/tests/MyGame/Example/ArrayTable.py @@ -14,6 +14,10 @@ class ArrayTable(object): x.Init(buf, n + offset) return x + @classmethod + def ArrayTableBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x41\x52\x52\x54", size_prefixed=size_prefixed) + # ArrayTable def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) diff --git a/tests/MyGame/Example/Monster.py b/tests/MyGame/Example/Monster.py index e83b9af4..5baf64d4 100644 --- a/tests/MyGame/Example/Monster.py +++ b/tests/MyGame/Example/Monster.py @@ -15,6 +15,10 @@ class Monster(object): x.Init(buf, n + offset) return x + @classmethod + def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) + # Monster def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) diff --git a/tests/MyGame/Example/Referrable.py b/tests/MyGame/Example/Referrable.py index 897b4ac4..eaec09bb 100644 --- a/tests/MyGame/Example/Referrable.py +++ b/tests/MyGame/Example/Referrable.py @@ -14,6 +14,10 @@ class Referrable(object): x.Init(buf, n + offset) return x + @classmethod + def ReferrableBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) + # Referrable def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) diff --git a/tests/MyGame/Example/Stat.py b/tests/MyGame/Example/Stat.py index ae33aef3..0fbd2a7a 100644 --- a/tests/MyGame/Example/Stat.py +++ b/tests/MyGame/Example/Stat.py @@ -14,6 +14,10 @@ class Stat(object): x.Init(buf, n + offset) return x + @classmethod + def StatBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) + # Stat def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.py b/tests/MyGame/Example/TestSimpleTableWithEnum.py index 70a3c1d5..cb9c631a 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.py +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.py @@ -14,6 +14,10 @@ class TestSimpleTableWithEnum(object): x.Init(buf, n + offset) return x + @classmethod + def TestSimpleTableWithEnumBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) + # TestSimpleTableWithEnum def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) diff --git a/tests/MyGame/Example/TypeAliases.py b/tests/MyGame/Example/TypeAliases.py index 707e53f1..81e9b064 100644 --- a/tests/MyGame/Example/TypeAliases.py +++ b/tests/MyGame/Example/TypeAliases.py @@ -14,6 +14,10 @@ class TypeAliases(object): x.Init(buf, n + offset) return x + @classmethod + def TypeAliasesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) + # TypeAliases def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) |