Skip to content

Instantly share code, notes, and snippets.

@andrewcunnin
Last active April 14, 2023 16:05
Show Gist options
  • Save andrewcunnin/802f4d8fa779c181e2272b5219b52a07 to your computer and use it in GitHub Desktop.
Save andrewcunnin/802f4d8fa779c181e2272b5219b52a07 to your computer and use it in GitHub Desktop.
Binary files master/.DS_Store and patched/.DS_Store differ
diff -r master/gen-py/ThriftTest/ttypes.py patched/gen-py/ThriftTest/ttypes.py
2579a2580,2636
>
>
> class OptionalEnum(object):
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = iprot.readI32()
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(self.e)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
6789a6847,6851
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-default/ThriftTest/ttypes.py patched/gen-py-default/ThriftTest/ttypes.py
2579a2580,2636
>
>
> class OptionalEnum(object):
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = iprot.readI32()
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(self.e)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
6789a6847,6851
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-dynamic/ThriftTest/ttypes.py patched/gen-py-dynamic/ThriftTest/ttypes.py
829a830,852
>
>
> class OptionalEnum(TBase):
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
5039a5063,5067
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-dynamicslots/ThriftTest/ttypes.py patched/gen-py-dynamicslots/ThriftTest/ttypes.py
681a682,697
>
>
> class OptionalEnum(TBase):
> """
> Attributes:
> - e
>
> """
>
> __slots__ = (
> 'e',
> )
>
>
> def __init__(self, e= 5,):
> self.e = e
4891a4908,4912
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
Only in patched/gen-py-enum: .DS_Store
diff -r master/gen-py-enum/DebugProtoTest/ttypes.py patched/gen-py-enum/DebugProtoTest/ttypes.py
2800c2800
< self.blah = SomeEnum(iprot.readI32()).name
---
> self.blah = SomeEnum(iprot.readI32()).value
2815c2815
< oprot.writeI32(SomeEnum[self.blah].value)
---
> oprot.writeI32(SomeEnum(self.blah).value)
2903c2903
< self.enum_field = SomeEnum(iprot.readI32()).name
---
> self.enum_field = SomeEnum(iprot.readI32()).value
2962c2962
< oprot.writeI32(SomeEnum[self.enum_field].value)
---
> oprot.writeI32(SomeEnum(self.enum_field).value)
3058c3058
< self.enum_field = SomeEnum(iprot.readI32()).name
---
> self.enum_field = SomeEnum(iprot.readI32()).value
3113c3113
< oprot.writeI32(SomeEnum[self.enum_field].value)
---
> oprot.writeI32(SomeEnum(self.enum_field).value)
diff -r master/gen-py-enum/ThriftTest/ThriftTest.py patched/gen-py-enum/ThriftTest/ThriftTest.py
3466c3466
< self.thing = Numberz(iprot.readI32()).name
---
> self.thing = Numberz(iprot.readI32()).value
3481c3481
< oprot.writeI32(Numberz[self.thing].value)
---
> oprot.writeI32(Numberz(self.thing).value)
3528c3528
< self.success = Numberz(iprot.readI32()).name
---
> self.success = Numberz(iprot.readI32()).value
3543c3543
< oprot.writeI32(Numberz[self.success].value)
---
> oprot.writeI32(Numberz(self.success).value)
3924c3924
< _key380 = Numberz(iprot.readI32()).name
---
> _key380 = Numberz(iprot.readI32()).value
3949c3949
< oprot.writeI32(Numberz[kiter384].value)
---
> oprot.writeI32(Numberz(kiter384).value)
4034c4034
< self.arg4 = Numberz(iprot.readI32()).name
---
> self.arg4 = Numberz(iprot.readI32()).value
4074c4074
< oprot.writeI32(Numberz[self.arg4].value)
---
> oprot.writeI32(Numberz(self.arg4).value)
diff -r master/gen-py-enum/ThriftTest/ttypes.py patched/gen-py-enum/ThriftTest/ttypes.py
468c468
< _key5 = Numberz(iprot.readI32()).name
---
> _key5 = Numberz(iprot.readI32()).value
503c503
< oprot.writeI32(Numberz[kiter13].value)
---
> oprot.writeI32(Numberz(kiter13).value)
730c730
< _key83 = Numberz(iprot.readI32()).name
---
> _key83 = Numberz(iprot.readI32()).value
771c771
< oprot.writeI32(Numberz[kiter85].value)
---
> oprot.writeI32(Numberz(kiter85).value)
2563a2564,2620
>
>
> class OptionalEnum(object):
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e=5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = Numberz(iprot.readI32()).value
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(Numberz(self.e).value)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
6773a6831,6835
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-no_utf8strings/ThriftTest/ttypes.py patched/gen-py-no_utf8strings/ThriftTest/ttypes.py
2578a2579,2635
>
>
> class OptionalEnum(object):
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = iprot.readI32()
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(self.e)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
6788a6846,6850
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-oldstyle/ThriftTest/ttypes.py patched/gen-py-oldstyle/ThriftTest/ttypes.py
2579a2580,2636
>
>
> class OptionalEnum:
> """
> Attributes:
> - e
>
> """
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = iprot.readI32()
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(self.e)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, value)
> for key, value in self.__dict__.items()]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
>
> def __ne__(self, other):
> return not (self == other)
6789a6847,6851
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
diff -r master/gen-py-slots/ThriftTest/ttypes.py patched/gen-py-slots/ThriftTest/ttypes.py
2935a2936,3003
>
>
> class OptionalEnum(object):
> """
> Attributes:
> - e
>
> """
>
> __slots__ = (
> 'e',
> )
>
>
> def __init__(self, e= 5,):
> self.e = e
>
> def read(self, iprot):
> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
> iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
> return
> iprot.readStructBegin()
> while True:
> (fname, ftype, fid) = iprot.readFieldBegin()
> if ftype == TType.STOP:
> break
> if fid == 1:
> if ftype == TType.I32:
> self.e = iprot.readI32()
> else:
> iprot.skip(ftype)
> else:
> iprot.skip(ftype)
> iprot.readFieldEnd()
> iprot.readStructEnd()
>
> def write(self, oprot):
> if oprot._fast_encode is not None and self.thrift_spec is not None:
> oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
> return
> oprot.writeStructBegin('OptionalEnum')
> if self.e is not None:
> oprot.writeFieldBegin('e', TType.I32, 1)
> oprot.writeI32(self.e)
> oprot.writeFieldEnd()
> oprot.writeFieldStop()
> oprot.writeStructEnd()
>
> def validate(self):
> return
>
> def __repr__(self):
> L = ['%s=%r' % (key, getattr(self, key))
> for key in self.__slots__]
> return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
>
> def __eq__(self, other):
> if not isinstance(other, self.__class__):
> return False
> for attr in self.__slots__:
> my_val = getattr(self, attr)
> other_val = getattr(other, attr)
> if my_val != other_val:
> return False
> return True
>
> def __ne__(self, other):
> return not (self == other)
7145a7214,7218
> all_structs.append(OptionalEnum)
> OptionalEnum.thrift_spec = (
> None, # 0
> (1, TType.I32, 'e', None, 5, ), # 1
> )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment