Repository navigation
Fix undefined names in serverside AppData and ExtendedDeviceInfo - #1178
Open
ZainnQureshii wants to merge 1 commit into
Open
ZainnQureshii wants to merge 1 commit into
ZainnQureshii wants to merge 1 commit into
Conversation
AppData.to_dict() and ExtendedDeviceInfo.to_dict() use six.iteritems and both classes' to_str() use pprint.pformat, but neither module was imported, so to_dict() and repr() raised NameError. ExtendedDeviceInfo's __eq__ also checked isinstance(other, Event), a name this file never defines, so comparing two instances raised NameError too. Fixes meta#708 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #708
facebook_business/adobjects/serverside/app_data.pyandextended_device_info.pycallsix.iteritems(into_dict()) andpprint.pformat(into_str(), used by__repr__) but import neither module, so:AppData(..., extinfo=ExtendedDeviceInfo(...)).to_dict()raisesNameError: name 'six' is not definedrepr(AppData(...))andrepr(ExtendedDeviceInfo(...))raiseNameError: name 'pprint' is not definedThis adds
import pprintandimport sixto both files, the same two imports the other serverside classes already have (sixis already inrequirements.txt). While there I also fixedExtendedDeviceInfo.__eq__(extended_device_info.py:320), which checkedisinstance(other, Event), a name this file never defines, soExtendedDeviceInfo(...) == ExtendedDeviceInfo(...)raisedNameError: name 'Event' is not defined; it now checksExtendedDeviceInfo, likeAppData.__eq__checksAppData.These classes look generated, so if they come from an internal template, the template may need the same two imports.
Test plan
A short script calling
AppData.to_dict(),repr(AppData(...)),repr(ExtendedDeviceInfo(...))andExtendedDeviceInfo(...) == ExtendedDeviceInfo(...)on Python 3.12 withrequirements.txtinstalled:main: each raises theNameErroraboveTruefor equal objects andFalsefor different onesI kept a test out since the change is two imports per file and one class name; I can add one to
facebook_business/test/unit.pyif you'd like it.Prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.
🤖 Generated with Claude Code