greedo/python-xbrl: xbrl parser written in Python - GitHub

文章推薦指數: 80 %
投票人數:10人

Installation. The easiest way to install python-xbrl is with pip · Requirements. Python >= 2.6 or >= 3.3 · Initialization. To start using the library, first ... Skiptocontent {{message}} greedo / python-xbrl Public Notifications Fork 68 Star 198 xbrlparserwritteninPython💡 pypi.python.org/pypi/python-xbrl License Apache-2.0license 198 stars 68 forks Star Notifications Code Issues 15 Pullrequests 1 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights greedo/python-xbrl Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 2 branches 7 tags Code Clone HTTPS GitHubCLI UseGitorcheckoutwithSVNusingthewebURL. WorkfastwithourofficialCLI. Learnmore. OpenwithGitHubDesktop DownloadZIP LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingXcode Ifnothinghappens,downloadXcodeandtryagain. LaunchingVisualStudioCode Yourcodespacewillopenonceready. Therewasaproblempreparingyourcodespace,pleasetryagain. Latestcommit greedo Mergepullrequest#54fromyosukesan/53_fix_test … 882a34f Jun20,2022 Mergepullrequest#54fromyosukesan/53_fix_test issue53:fixtest 882a34f Gitstats 223 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime examples add( Jan18,2018 tests issue53:fixtest Apr16,2021 xbrl PEP8cleanup Jan3,2017 .gitignore updatedparser Aug5,2014 .travis.yml removingpypisupportfornow Dec3,2015 AUTHORS.rst -FixesissuesdescribedinIssue#39 Jan3,2017 LICENSE UpdateLICENSE Aug13,2014 README.rst TheexampleintheREADMEhasbeenupdatedtoreflectthefactthat Dec31,2016 requirements.txt Bumplxmlfrom4.6.2to4.6.5 Dec13,2021 setup.cfg addingdeiparsing,relaxE501abit Jul19,2015 setup.py bumptoversion1.1.1 Dec27,2016 Viewcode Installation Requirements Initialization SimpleParsingWorkflow Testing Bugs Contribute License README.rst python-xbrlisalibraryforparsing xbrl documentsprovidingoutputasbothabasicmodelobjectandserialized objectsthur marshmallowfor renderingintostandardsformatslikeJSONorHTTPAPI Installation Theeasiestwaytoinstallpython-xbrliswithpip pipinstallpython-xbrl Orinstallthelatestdevversionfromgithub(orreplace@masterwitha [email protected]) pipinstallgit+https://github.com/greedo/python-xbrl.git@master Or gitclonehttps://github.com/greedo/python-xbrl.git Or Copythepython-xbrldirectoryintoyourpythonpath.Zip here Madesureyoursys.pathiscorrect. Requirements Python>=2.6or>=3.3 python-xbrlreliesonbeautifulsoup4 whichsitsontopofthepythonXMLparserlxml.Italsorequires marshmallowforserializingobjects. Formoredetailsseerequirements.txt ForPyPIsupportitisrecommendedyouusehttps://github.com/amauryfa/lxmlforlxmlasthisisaforkthatusescffiinsteadofthepythoncapi. Initialization Tostartusingthelibrary,firstimporttheXBRLParser fromxbrlimportXBRLParser,GAAP,GAAPSerializer SimpleParsingWorkflow FirstparsetheincomingXRBLfileintoanewXBRLbasicobject xbrl_parser=XBRLParser() xbrl=xbrl_parser.parse(open("sam-20131228.xml")) Thenyoucanparsethedocumentusingdifferentparsers gaap_obj=xbrl_parser.parseGAAP(xbrl,doc_date="20131228",context="current",ignore_errors=0) NowwehaveaGAAPmodelobjectthathastheGAAPparsedelements fromthedocument. Thismodelobjectsupportstheseveraldifferentfeaturesincluding: contextcurrent,year,andinstantcontextsaresupported.Ifavailableyoucanalsogetpreviousquarterinformationbynumberofdaysfromdocdate.Example:90,180,etc. Errorhandling.0raiseexceptionforallparsingerrorsandhaltparsing,1Supressallparsingerrorsandcontinueparsing,2Logallparsingerrorsandcontinueparsing YoucanserializetheGAAPmodelobjectintoaserializedobject acceptableforrendingintoastandardformatsuchasJSONorHTTPAPI. serializer=GAAPSerializer() result=serializer.dump(gaap_obj) Youcanalsojustviewthedataintheserializedobject printresult.data YoucanapplyvariousparserstothebaseXBRLParserobjecttoget differentdatathanjustGAAPdatafromthedocument.Inadditionas expectedyoucanalsocreatedifferentserializedobjectsonthe resultingparseddataobject. ExtractingDEIData dei_obj=xbrl_parser.parseDEI(xbrl) serializer=DEISerializer() result=serializer.dump(dei_obj) ExtractingCustomData custom_obj=xbrl_parser.parseCustom(xbrl) printcustom_obj() Testing Toruntheunittests,youneedpytest pipinstallpytest Onceyouhavethat,cdintotherootdirectoryofthisrepoand py.test--tb=line-vs Bugs ForanybugsyouencounterpleaseopenaGithub issue Contribute Checkforopenissuesoropenafreshissuetostartadiscussionaroundafeatureideaorabug. Ifyoufeeluncomfortableoruncertainaboutanissueoryourchanges,feelfreetoemail@greedoandhewillhappilyhelpyouviaemail,Skype,remotepairingorwhateveryouarecomfortablewith. ForktherepositoryonGitHubtostartmakingyourchangestothemasterbranch(orbranchoffofit). Writeatestwhichshowsthatthebugwasfixedorthatthefeatureworksasexpected. Sendapullrequestandbugthemaintaineruntilitgetsmergedandpublished.:)MakesuretoaddyourselftoAUTHORS. License LicensedtotheApacheSoftwareFoundation(ASF)underone ormorecontributorlicenseagreements.SeetheNOTICEfile distributedwiththisworkforadditionalinformation regardingcopyrightownership.TheASFlicensesthisfile toyouundertheApacheLicense,Version2.0(the "License");youmaynotusethisfileexceptincompliance withtheLicense.YoumayobtainacopyoftheLicenseat http://www.apache.org/licenses/LICENSE-2.0 Unlessrequiredbyapplicablelaworagreedtoinwriting, softwaredistributedundertheLicenseisdistributedonan "ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANY KIND,eitherexpressorimplied.SeetheLicenseforthe specificlanguagegoverningpermissionsandlimitations underthelicense. About xbrlparserwritteninPython💡 pypi.python.org/pypi/python-xbrl Resources Readme License Apache-2.0license Stars 198 stars Watchers 18 watching Forks 68 forks Releases 5 Hoth Latest Dec27,2016 +4releases Packages0 Nopackagespublished Usedby52 +44 Contributors7 Languages Python 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?