Squashed 'third_party/flatbuffers/' changes from bc44fad35..8aa8b9139

8aa8b9139 Fix handling of +/-inf defaults in TS/rust/go/dart codegen (#7588)
001adf782 Add support for parsing proto map fields (#7613)
dbc58ab77 Fix help output for --gen-includes (#7611)
2facfeec7 Fix missing spaces in flatc help text (#7612)
4de2814c7 Fix: arduino platform build (#7625)
37b1acdaf Fix current official name of macOS (#7627)
a22434e2a Add missing #include <algorithm> for std::min/std::max uses, and #include <limits> for std::numeric_limits<> (#7624)
214cc9468 Bump Rust version to 22.10.26 before publication (#7622)
a4ff275d9 Added option to not requires an EoF token when parsing JSON (#7620)
15f32c690 python: object generation prefix and suffix (#7565)
051afd882 Add CreateSharedString to python builder (#7608)
728c033ad Add check for presence of realpath to CMakeLists.txt to support more platforms (#7603)
4c514483d Update DartTest.sh golden files (#7606)
c2d9c2080 [TS] Add support for fixed length arrays on Typescript (#5864) (#7021) (#7581)
e34ae4c6b `build.yml`: Fix missing 'v' in version
e54536127 `build.yml` Update to Kotlin Wrapper 1.0.5
49d9f941c `release.yml` Use env var for passphrase
cefc21c1f `release.yml` Add GPG key for Maven
3e64fa724 `release.yml`: Add Maven Steps
b15f3c57e `release_yml` Use new dotnet version
ff802c680 `release.yml` Use NuGet Key directly
b401957d5 `release.yml` Changed Push to follow examples
8c8151f8f `release.yml` Fix nuget push command
ebb7c203d `release.yml` Add Nuget support
203241ed3 FlatBuffers Version 22.10.26 (#7607)
ac485609c `setup.py`: Define version directly
de5b85aa6 `release.yml`: Switch to `python` directory
de3df2d88 `release.yml`: Add publishing to PyPi
043a24f2e [Python] Fixed the issue with nested unions relying on InitFromBuf. (#7576)
5a48b0d7d release.yml: Typo
ce307556f release.yml: Remove `npm ci`
cb616e27c Create release.yml (#7605)
a54ca1e75 FlatBuffers Version 22.10.25 (#7604)
5b3fadcc1 [vector] Allow to iterate with mutables (#7586)
872a49746 [Nim] Bfbs Nim Generator (#7534)
e30170296 Make type conversions explicit. (#7595)
f7b734438 Fix LongEnum definitions (#7596)
5792623df Rust fix compilation for no_std targets #2 (#7553)
0edb27528 Update Rust version (#7574)
acc6a20d3 tests/test.cpp contains a couple of tests that are only executed (#7571)
04cd037ba Fix #7580 by documenting union schema evolution rules (#7585)
e1c5db988 Turn on clippy for Rust and fix lints for non-generated code (#7575)
b80142b90 Update documentation to mention enum value attributes (#7570)
54418f371 Add support for metadata attributes for enum values (#7567) (#7568)
c92e78a9f FlatBuffers Version 22.9.29 (#7557)
d243b904c [TS] Make strict compliant and improve typings (#7549)
374f8fb5f Rust soundness fixes (#7518)
dadbff571 Moves swift package to root of repository so it can be used directly … (#7548)
76ddae006 FlatBuffers Version 22.9.24 (#7547)
cfe157ec5 Emit internal enums when swift_implementation_only (#7545)
413115858 [Python] Python fixed size array (#7529)
88046190e Upgrade grpc to 1.49.0 and make sure it builds (#7538)
72aa85a75 [C++] Rare bad buffer content alignment if sizeof(T) != alignof(T) (#7520)
bfceebb7f Fix conform (#7532)

git-subtree-dir: third_party/flatbuffers
git-subtree-split: 8aa8b9139eb330f27816a5b8b5bbef402fbe3632
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
Change-Id: I943faba499baf58e9f561b1e4734922188ba8626
diff --git a/python/flatbuffers/_version.py b/python/flatbuffers/_version.py
index 7812791..bcc6af3 100644
--- a/python/flatbuffers/_version.py
+++ b/python/flatbuffers/_version.py
@@ -14,4 +14,4 @@
 
 # Placeholder, to be updated during the release process
 # by the setup.py
-__version__ = u"2.0.8"
+__version__ = u"22.10.26"
diff --git a/python/flatbuffers/builder.py b/python/flatbuffers/builder.py
index 9bdf116..f3b901b 100644
--- a/python/flatbuffers/builder.py
+++ b/python/flatbuffers/builder.py
@@ -112,7 +112,8 @@
 
     ## @cond FLATBUFFERS_INTENRAL
     __slots__ = ("Bytes", "current_vtable", "head", "minalign", "objectEnd",
-                 "vtables", "nested", "forceDefaults", "finished", "vectorNumElems")
+                 "vtables", "nested", "forceDefaults", "finished", "vectorNumElems",
+                 "sharedStrings")
 
     """Maximum buffer size constant, in bytes.
 
@@ -141,6 +142,7 @@
         self.vtables = {}
         self.nested = False
         self.forceDefaults = False
+        self.sharedStrings = {}
         ## @endcond
         self.finished = False
 
@@ -405,6 +407,20 @@
         self.vectorNumElems = None
         return self.Offset()
 
+    def CreateSharedString(self, s, encoding='utf-8', errors='strict'):
+        """
+        CreateSharedString checks if the string is already written to the buffer
+        before calling CreateString.
+        """
+
+        if s in self.sharedStrings:
+            return self.sharedStrings[s]
+
+        off = self.CreateString(s, encoding, errors)
+        self.sharedStrings[s] = off
+
+        return off
+
     def CreateString(self, s, encoding='utf-8', errors='strict'):
         """CreateString writes a null-terminated byte string as a vector."""
 
diff --git a/python/flatbuffers/reflection/EnumVal.py b/python/flatbuffers/reflection/EnumVal.py
index 62a32dc..3592de0 100644
--- a/python/flatbuffers/reflection/EnumVal.py
+++ b/python/flatbuffers/reflection/EnumVal.py
@@ -73,7 +73,32 @@
         o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
         return o == 0
 
-def EnumValStart(builder): builder.StartObject(5)
+    # EnumVal
+    def Attributes(self, j):
+        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+        if o != 0:
+            x = self._tab.Vector(o)
+            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
+            x = self._tab.Indirect(x)
+            from reflection.KeyValue import KeyValue
+            obj = KeyValue()
+            obj.Init(self._tab.Bytes, x)
+            return obj
+        return None
+
+    # EnumVal
+    def AttributesLength(self):
+        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+        if o != 0:
+            return self._tab.VectorLen(o)
+        return 0
+
+    # EnumVal
+    def AttributesIsNone(self):
+        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+        return o == 0
+
+def EnumValStart(builder): builder.StartObject(6)
 def Start(builder):
     return EnumValStart(builder)
 def EnumValAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
@@ -91,6 +116,12 @@
 def EnumValStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
 def StartDocumentationVector(builder, numElems):
     return EnumValStartDocumentationVector(builder, numElems)
+def EnumValAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
+def AddAttributes(builder, attributes):
+    return EnumValAddAttributes(builder, attributes)
+def EnumValStartAttributesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def StartAttributesVector(builder, numElems):
+    return EnumValStartAttributesVector(builder, numElems)
 def EnumValEnd(builder): return builder.EndObject()
 def End(builder):
     return EnumValEnd(builder)
\ No newline at end of file
diff --git a/python/flatbuffers/table.py b/python/flatbuffers/table.py
index adc76ca..d5336ca 100644
--- a/python/flatbuffers/table.py
+++ b/python/flatbuffers/table.py
@@ -113,6 +113,15 @@
         numpy_dtype = N.to_numpy_type(flags)
         return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, offset)
 
+    def GetArrayAsNumpy(self, flags, off, length):
+        """
+        GetArrayAsNumpy returns the array with fixed width that starts at `Vector(offset)`
+        with length `length` as a numpy array with the type specified by `flags`. The
+        array is a `view` into Bytes so modifying the returned will modify Bytes in place.
+        """
+        numpy_dtype = N.to_numpy_type(flags)
+        return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, off)
+
     def GetVOffsetTSlot(self, slot, d):
         """
         GetVOffsetTSlot retrieves the VOffsetT that the given vtable location
@@ -125,5 +134,5 @@
 
         off = self.Offset(slot)
         if off == 0:
-                return d
+            return d
         return off
diff --git a/python/setup.py b/python/setup.py
index 0615f2b..c351b01 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -12,54 +12,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import fileinput
-import os
-import re
-import sys
-from datetime import datetime
 from setuptools import setup
 
-
-def _update_version_attr(new_version):
-    for line in fileinput.input('flatbuffers/_version.py', inplace=True):
-        if line.startswith('__version__'):
-            line = re.sub(r'".*"', '"{}"'.format(new_version), line)
-        sys.stdout.write(line)
-
-
-def version():
-    version = os.getenv('VERSION', None)
-    if version:
-        # Most git tags are prefixed with 'v' (example: v1.2.3) this is
-        # never desirable for artifact repositories, so we strip the
-        # leading 'v' if it's present.
-        version = version[1:] if version.startswith('v') else version
-    else:
-        # Default version is an ISO8601 compiliant datetime. PyPI doesn't allow
-        # the colon ':' character in its versions, and time is required to allow
-        # for multiple publications to master in one day. This datetime string
-        # uses the "basic" ISO8601 format for both its date and time components
-        # to avoid issues with the colon character (ISO requires that date and
-        # time components of a date-time string must be uniformly basic or
-        # extended, which is why the date component does not have dashes.
-        #
-        # Publications using datetime versions should only be made from master
-        # to represent the HEAD moving forward.
-        version = datetime.utcnow().strftime('%Y%m%d%H%M%S')
-        print("VERSION environment variable not set, using datetime instead: {}"
-              .format(version))
-
-    _update_version_attr(version)
-
-    return version
-
-
 setup(
     name='flatbuffers',
-    version=version(),
+    version='22.10.26',
     license='Apache 2.0',
-    author='FlatBuffers Contributors',
-    author_email='me@rwinslow.com',
+    author='Derek Bailey',
+    author_email='derekbailey@google.com',
     url='https://google.github.io/flatbuffers/',
     long_description=('Python runtime library for use with the '
                       '`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
@@ -81,4 +41,4 @@
         'Documentation': 'https://google.github.io/flatbuffers/',
         'Source': 'https://github.com/google/flatbuffers',
     },
-)
\ No newline at end of file
+)