René's URL Explorer Experiment


Title: Custom transformer - create_instance invoked incorrectly? · Issue #54 · tcalmant/python-javaobj · GitHub

Open Graph Title: Custom transformer - create_instance invoked incorrectly? · Issue #54 · tcalmant/python-javaobj

X Title: Custom transformer - create_instance invoked incorrectly? · Issue #54 · tcalmant/python-javaobj

Description: Hello! I'm trying to parse a file serializing an ArrayList of custom functions -- and I cannot even get the basics going... Below is my entire script. Without the default value (such as None) for the class_desc, I get an error: File "/ho...

Open Graph Description: Hello! I'm trying to parse a file serializing an ArrayList of custom functions -- and I cannot even get the basics going... Below is my entire script. Without the default value (such as None) for t...

X Description: Hello! I'm trying to parse a file serializing an ArrayList of custom functions -- and I cannot even get the basics going... Below is my entire script. Without the default value (such as None) f...

Opengraph URL: https://github.com/tcalmant/python-javaobj/issues/54

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Custom transformer - create_instance invoked incorrectly?","articleBody":"Hello!\r\n\r\nI'm trying to parse a file serializing an `ArrayList` of custom functions -- and I cannot even get the basics going...\r\n\r\nBelow is my entire script. Without the default value (such as `None`) for the `class_desc`, I get an error:\r\n```\r\n  File \"/home/mi/.local/lib/python3.9/site-packages/javaobj/v2/core.py\", line 528, in _do_object\r\n    instance = self._create_instance(class_desc)\r\n  File \"/home/mi/.local/lib/python3.9/site-packages/javaobj/v2/core.py\", line 503, in _create_instance\r\n    instance = transformer.create_instance(class_desc)\r\nTypeError: create_instance() missing 1 required positional argument: 'class_desc'\r\n```\r\n\r\nIf I put the default value, the call to `create_instance` goes through, and the method prints the value of `self`, which indicates, that it is the `class_desc` -- instead of referring to the transformer:\r\n```\r\nINFO:javaobj.parser:Reading next content\r\nDEBUG:javaobj.parser:Reading new object: handle 7e0001, classdesc [classdesc 0x7e0000: name java.util.ArrayList, uid 8683452581122892189]\r\nSelf is [classdesc 0x7e0000: name java.util.ArrayList, uid 8683452581122892189], class_desc is None\r\nTraceback ...\r\n```\r\n\r\nPlease, advise. Thank you!\r\n\r\n```python\r\nimport javaobj.v2 as javaobj\r\nimport sys\r\nimport os\r\nimport json\r\nimport pprint\r\nimport logging\r\n\r\nlogging.basicConfig(level = logging.DEBUG)\r\n\r\nclass odrnavsFunctionInstance(javaobj.beans.JavaInstance):\r\n\tdef __init__(self):\r\n\t\tjavaobj.beans.JavaInstance.__init__(self)\r\n\r\n\tdef load_from_instance(self):\r\n\t\tif not self.classdesc or self.classdesc not in self.field_data:\r\n\t\t\treturn False\r\n\r\n\t\tfields = self.classdesc.fields_names\r\n\t\tvalues = [\r\n\t\t\tself.field_data[self.classdesc][self.classdesc.fields[i]]\r\n\t\t\tfor i in range(len(fields))\r\n\t\t]\r\n\t\tself.field_data = dict(zip(fields, values))\r\n\t\tif not self.classdesc.super_class or \\\r\n\t\t    self.classdesc.super_class not in self.annotations:\r\n\t\t\treturn True\r\n\t\tsuper_class = self.annotations[self.classdesc.super_class][0]\r\n\t\tself.annotations = dict(zip(super_class.fields_names, super_class.field_data))\r\n\t\treturn True\r\n\r\nclass odrnavsTransformer(javaobj.transformers.ObjectTransformer):\r\n\r\n\tdef __init__(self, handled_classes = {\r\n\t\t'my.apps.datalayer.client.navs.shared.api.Function':\r\n\t\t    odrnavsFunctionInstance\r\n\t}):\r\n\t\tsuper(JavaRandomTransformer, self).__init__()\r\n\t\tself.instance = None\r\n\t\tself.handled_classes = handled_classes or {}\r\n\r\n\tdef create_instance(self, class_desc = None):\r\n\t\tprint('Self is %s, class_desc is %s' % (self, class_desc))\r\n\t\tif class_desc.name not in self.handled_classes:\r\n\t\t\treturn None\r\n\t\tself.instance = self.handled_classes[class_desc.name]()\r\n\t\treturn self.instance\r\n\r\nif sys.argv[1].endswith('.gz'):\r\n\timport gzip\r\n\topener = gzip.open\r\nelse:\r\n\topener = open\r\n\r\nobj = None\r\nwith opener(sys.argv[1], 'rb') as inp:\r\n\t\tobj = javaobj.load(inp, odrnavsTransformer)\r\n\r\npprint.pprint(obj)\r\n```\r\n","author":{"url":"https://github.com/UnitedMarsupials","@type":"Person","name":"UnitedMarsupials"},"datePublished":"2023-08-02T23:40:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/54/python-javaobj/issues/54"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:357c040c-ffb7-fcf6-8cad-ee4e297ed272
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id98C6:21FEDA:51D829:724157:696A78AF
html-safe-nonce5aaac845199d837c94f0fe4bf7ba4b32e461b47482757cb227cef6b0f907b891
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEM2OjIxRkVEQTo1MUQ4Mjk6NzI0MTU3OjY5NkE3OEFGIiwidmlzaXRvcl9pZCI6IjY5NzUwODc3MjAwOTQzOTg2MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace2e78cfa926a61aa4fe658bf47a28b20cb3b20eee5cdefe325527c2525a485c3
hovercard-subject-tagissue:1834028583
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tcalmant/python-javaobj/54/issue_layout
twitter:imagehttps://opengraph.githubassets.com/239a87eb80a8b968ea0e0b58d8b38353f19abf804414074e815e0d634424c196/tcalmant/python-javaobj/issues/54
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/239a87eb80a8b968ea0e0b58d8b38353f19abf804414074e815e0d634424c196/tcalmant/python-javaobj/issues/54
og:image:altHello! I'm trying to parse a file serializing an ArrayList of custom functions -- and I cannot even get the basics going... Below is my entire script. Without the default value (such as None) for t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameUnitedMarsupials
hostnamegithub.com
expected-hostnamegithub.com
None5b774e44f85c14a75886edd04ddda4e5a25ddebbb241bcbb590b08a3048730e8
turbo-cache-controlno-preview
go-importgithub.com/tcalmant/python-javaobj git https://github.com/tcalmant/python-javaobj.git
octolytics-dimension-user_id1540582
octolytics-dimension-user_logintcalmant
octolytics-dimension-repository_id15333794
octolytics-dimension-repository_nwotcalmant/python-javaobj
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id15333794
octolytics-dimension-repository_network_root_nwotcalmant/python-javaobj
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecc5f4eee261b3601c1e98e217ceaf28508b9567e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/tcalmant/python-javaobj/issues/54#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftcalmant%2Fpython-javaobj%2Fissues%2F54
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftcalmant%2Fpython-javaobj%2Fissues%2F54
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=tcalmant%2Fpython-javaobj
Reloadhttps://github.com/tcalmant/python-javaobj/issues/54
Reloadhttps://github.com/tcalmant/python-javaobj/issues/54
Reloadhttps://github.com/tcalmant/python-javaobj/issues/54
tcalmant https://github.com/tcalmant
python-javaobjhttps://github.com/tcalmant/python-javaobj
Notifications https://github.com/login?return_to=%2Ftcalmant%2Fpython-javaobj
Fork 20 https://github.com/login?return_to=%2Ftcalmant%2Fpython-javaobj
Star 86 https://github.com/login?return_to=%2Ftcalmant%2Fpython-javaobj
Code https://github.com/tcalmant/python-javaobj
Issues 9 https://github.com/tcalmant/python-javaobj/issues
Pull requests 1 https://github.com/tcalmant/python-javaobj/pulls
Actions https://github.com/tcalmant/python-javaobj/actions
Wiki https://github.com/tcalmant/python-javaobj/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/tcalmant/python-javaobj/security
Please reload this pagehttps://github.com/tcalmant/python-javaobj/issues/54
Insights https://github.com/tcalmant/python-javaobj/pulse
Code https://github.com/tcalmant/python-javaobj
Issues https://github.com/tcalmant/python-javaobj/issues
Pull requests https://github.com/tcalmant/python-javaobj/pulls
Actions https://github.com/tcalmant/python-javaobj/actions
Wiki https://github.com/tcalmant/python-javaobj/wiki
Security https://github.com/tcalmant/python-javaobj/security
Insights https://github.com/tcalmant/python-javaobj/pulse
New issuehttps://github.com/login?return_to=https://github.com/tcalmant/python-javaobj/issues/54
New issuehttps://github.com/login?return_to=https://github.com/tcalmant/python-javaobj/issues/54
Custom transformer - create_instance invoked incorrectly?https://github.com/tcalmant/python-javaobj/issues/54#top
https://github.com/UnitedMarsupials
https://github.com/UnitedMarsupials
UnitedMarsupialshttps://github.com/UnitedMarsupials
on Aug 2, 2023https://github.com/tcalmant/python-javaobj/issues/54#issue-1834028583
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.