Commit 24364356 authored by Nanshu Chen's avatar Nanshu Chen Committed by Facebook GitHub Bot

refactor Enum code generation

Summary:
Changed the way how enums generated in thrift-py3:

1. Use C++ map to store name to unique Enum Python instances cache
2. Dynamically find instances from cache (or create one and add to cache) instead of populating all instances at module load time
3. use `__getattr__` and `__getitem__` instead of code-gen all the getters

Reviewed By: yfeldblum

Differential Revision: D22499183

fbshipit-source-id: b2af8d94024c3591c3d7faaa15cbd026a134cc78
parent 72530db7
...@@ -3,6 +3,8 @@ cdef extern from "folly/Range.h" namespace "folly": ...@@ -3,6 +3,8 @@ cdef extern from "folly/Range.h" namespace "folly":
Range() Range()
Range(T, int) Range(T, int)
T data() T data()
T begin()
T end()
int size() int size()
ctypedef Range[const char*] StringPiece ctypedef Range[const char*] StringPiece
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment