somef_core 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- somef_core/__init__.py +3 -0
- somef_core/__main__.py +293 -0
- somef_core/configuration.py +177 -0
- somef_core/export/__init__.py +0 -0
- somef_core/export/google_codemeta_export.py +171 -0
- somef_core/export/json_export.py +1197 -0
- somef_core/extract_software_type.py +408 -0
- somef_core/extract_workflows.py +74 -0
- somef_core/header_analysis.py +712 -0
- somef_core/parser/__init__.py +0 -0
- somef_core/parser/authors_parser.py +121 -0
- somef_core/parser/bower_parser.py +185 -0
- somef_core/parser/cabal_parser.py +222 -0
- somef_core/parser/codemeta_parser.py +926 -0
- somef_core/parser/codeowners_parser.py +198 -0
- somef_core/parser/composer_parser.py +218 -0
- somef_core/parser/conda_environment_parser.py +91 -0
- somef_core/parser/create_excerpts.py +71 -0
- somef_core/parser/description_parser.py +228 -0
- somef_core/parser/dockerfile_parser.py +227 -0
- somef_core/parser/gemspec_parser.py +224 -0
- somef_core/parser/mardown_parser.py +536 -0
- somef_core/parser/package_json_parser.py +270 -0
- somef_core/parser/pom_xml_parser.py +405 -0
- somef_core/parser/publiccode_parser.py +385 -0
- somef_core/parser/python_parser.py +432 -0
- somef_core/parser/setupcfg_parser.py +192 -0
- somef_core/parser/toml_parser.py +717 -0
- somef_core/process_files.py +893 -0
- somef_core/process_repository.py +1793 -0
- somef_core/process_results.py +87 -0
- somef_core/regular_expressions.py +1333 -0
- somef_core/somef_cli.py +446 -0
- somef_core/test/__init__.py +1 -0
- somef_core/test/conftest.py +7 -0
- somef_core/test/test_JSON_export.py +1177 -0
- somef_core/test/test_bitbucket.py +137 -0
- somef_core/test/test_bower_parser.py +113 -0
- somef_core/test/test_cabal_parser.py +94 -0
- somef_core/test/test_cli.py +816 -0
- somef_core/test/test_codeberg.py +183 -0
- somef_core/test/test_codemeta_export.py +1135 -0
- somef_core/test/test_codemeta_gitlab_export.py +64 -0
- somef_core/test/test_codemeta_parser.py +167 -0
- somef_core/test/test_composer_parser.py +59 -0
- somef_core/test/test_conda_environment_parser.py +58 -0
- somef_core/test/test_configuration.py +40 -0
- somef_core/test/test_data/README-EUVpy.md +166 -0
- somef_core/test/test_data/README-FTR.md +50 -0
- somef_core/test/test_data/README-GENI.md +109 -0
- somef_core/test/test_data/README-MEL-TNNT.md +112 -0
- somef_core/test/test_data/README-OBA-SPARQL.md +87 -0
- somef_core/test/test_data/README-OWL-To-OAS.md +6 -0
- somef_core/test/test_data/README-PPool.md +26 -0
- somef_core/test/test_data/README-TINTO.md +213 -0
- somef_core/test/test_data/README-agora.md +511 -0
- somef_core/test/test_data/README-almost-empty.md +1 -0
- somef_core/test/test_data/README-base-images.md +1 -0
- somef_core/test/test_data/README-ci-sample-project.md +102 -0
- somef_core/test/test_data/README-citation-file-format.md +158 -0
- somef_core/test/test_data/README-componentinstaller.md +139 -0
- somef_core/test/test_data/README-csl-editor.md +57 -0
- somef_core/test/test_data/README-devilog.md +99 -0
- somef_core/test/test_data/README-easytv-annotator.md +74 -0
- somef_core/test/test_data/README-epw2rdf-contents.md +13 -0
- somef_core/test/test_data/README-epw2rdf.md +10 -0
- somef_core/test/test_data/README-fair-ontologies.md +53 -0
- somef_core/test/test_data/README-fastify.md +420 -0
- somef_core/test/test_data/README-gammalearn.md +193 -0
- somef_core/test/test_data/README-gammapy.rst +103 -0
- somef_core/test/test_data/README-kgtk-notebooks.md +81 -0
- somef_core/test/test_data/README-laueNN.md +123 -0
- somef_core/test/test_data/README-licensius.md +59 -0
- somef_core/test/test_data/README-lighttwin.md +234 -0
- somef_core/test/test_data/README-loupe-api.md +13 -0
- somef_core/test/test_data/README-manim.md +117 -0
- somef_core/test/test_data/README-mapeathor.md +45 -0
- somef_core/test/test_data/README-mapshaper.md +101 -0
- somef_core/test/test_data/README-menty.md +94 -0
- somef_core/test/test_data/README-os-platforms.md +196 -0
- somef_core/test/test_data/README-panda.md +16 -0
- somef_core/test/test_data/README-pylops.md +229 -0
- somef_core/test/test_data/README-pytorch.md +424 -0
- somef_core/test/test_data/README-raidologist.md +60 -0
- somef_core/test/test_data/README-reggae.md +95 -0
- somef_core/test/test_data/README-stract.md +66 -0
- somef_core/test/test_data/README-sunpy.rst +115 -0
- somef_core/test/test_data/README-tada-gam.md +130 -0
- somef_core/test/test_data/README-tensorflow-2.6.0.md +156 -0
- somef_core/test/test_data/README-tokei.md +85 -0
- somef_core/test/test_data/README-tpronk.md +75 -0
- somef_core/test/test_data/README-unboundedsystems.md +86 -0
- somef_core/test/test_data/README-uncbiag.md +91 -0
- somef_core/test/test_data/README-urllib3.md +110 -0
- somef_core/test/test_data/README-widoco-duplicate-dois.md +198 -0
- somef_core/test/test_data/README-widoco-swh.md +233 -0
- somef_core/test/test_data/README-widoco.md +187 -0
- somef_core/test/test_data/README-wothive.md +111 -0
- somef_core/test/test_data/README-ya2o.md +372 -0
- somef_core/test/test_data/SimulatedReads2Map.wdl +80 -0
- somef_core/test/test_data/api_responses/bitbucket/bitbucket_response.json +127 -0
- somef_core/test/test_data/api_responses/bitbucket/bitbucket_tags.json +85 -0
- somef_core/test/test_data/api_responses/codeberg/codeberg_forgejo.json +104 -0
- somef_core/test/test_data/api_responses/codeberg/codeberg_forgejo_languages.json +16 -0
- somef_core/test/test_data/api_responses/codeberg/codeberg_forgejo_releases.json +261 -0
- somef_core/test/test_data/api_responses/somef-demo.json +648 -0
- somef_core/test/test_data/api_responses/widoco_api_response.json +2779 -0
- somef_core/test/test_data/authors_files/docker_AUTHORS.txt +718 -0
- somef_core/test/test_data/authors_files/ireeOrg_AUTHORS.txt +13 -0
- somef_core/test/test_data/authors_files/jetBrain_AUTHORS.txt +10 -0
- somef_core/test/test_data/authors_files/pluginsGLPI_AUTHORS.txt +9 -0
- somef_core/test/test_data/authors_files/tensorFlow_AUTHORS.txt +11 -0
- somef_core/test/test_data/expected/Widoco.yaml +29 -0
- somef_core/test/test_data/expected/aladin-lite.yaml +22 -0
- somef_core/test/test_data/expected/gammapy.yaml +31 -0
- somef_core/test/test_data/expected/r3broot2.yaml +44 -0
- somef_core/test/test_data/expected/runtime_platform_repo.yaml +9 -0
- somef_core/test/test_data/export_test.json +142 -0
- somef_core/test/test_data/extract_bash_code.txt +37 -0
- somef_core/test/test_data/input-test.txt +2 -0
- somef_core/test/test_data/package_neors.json +29 -0
- somef_core/test/test_data/package_npm.json +258 -0
- somef_core/test/test_data/pyansys-README.rst +222 -0
- somef_core/test/test_data/rasterio-README.md +360 -0
- somef_core/test/test_data/repositories/A-Dynamic-E-Commerce-Website-master/README.md +12 -0
- somef_core/test/test_data/repositories/A-Dynamic-E-Commerce-Website-master/admin.php +75 -0
- somef_core/test/test_data/repositories/A-Dynamic-E-Commerce-Website-master/admin_orders.php +53 -0
- somef_core/test/test_data/repositories/A-Dynamic-E-Commerce-Website-master/delete_from_cart.php +20 -0
- somef_core/test/test_data/repositories/A-Dynamic-E-Commerce-Website-master/mangola.sql +327 -0
- somef_core/test/test_data/repositories/Clamp/README.md +222 -0
- somef_core/test/test_data/repositories/Fairwinds/Dockerfile +14 -0
- somef_core/test/test_data/repositories/Fermi/README.md +164 -0
- somef_core/test/test_data/repositories/Flux.jl/Project.toml +71 -0
- somef_core/test/test_data/repositories/JAFFA-master/README +9 -0
- somef_core/test/test_data/repositories/JAFFA-master/README.md +4 -0
- somef_core/test/test_data/repositories/JAFFA-master/cwl/converter.cwl +33 -0
- somef_core/test/test_data/repositories/JAFFA-master/cwl/smcFusion-jaffa-workflow.cwl +62 -0
- somef_core/test/test_data/repositories/JAFFA-master/cwl/tar.cwl +23 -0
- somef_core/test/test_data/repositories/JAFFA-master/cwl/twoBitToFa.cwl +37 -0
- somef_core/test/test_data/repositories/OWL-To-OAS-Specification-master/README.md +6 -0
- somef_core/test/test_data/repositories/OWL-To-OAS-Specification-master/mkdocs.yml +13 -0
- somef_core/test/test_data/repositories/OWL-To-OAS-Specification-master/requirements.txt +1 -0
- somef_core/test/test_data/repositories/Pluto.jl/Project.toml +84 -0
- somef_core/test/test_data/repositories/Prometeus/Dockerfile +31 -0
- somef_core/test/test_data/repositories/RDFChess/.gitignore +1 -0
- somef_core/test/test_data/repositories/RDFChess/README.md +20 -0
- somef_core/test/test_data/repositories/RDFChess/pom.xml +202 -0
- somef_core/test/test_data/repositories/RDFChess/rdfchess.config +0 -0
- somef_core/test/test_data/repositories/RDFChess/run.bat +1 -0
- somef_core/test/test_data/repositories/Widoco/CITATION.cff +20 -0
- somef_core/test/test_data/repositories/Widoco/CONTRIBUTING.md +2 -0
- somef_core/test/test_data/repositories/Widoco/Dockerfile +18 -0
- somef_core/test/test_data/repositories/Widoco/LICENSE +202 -0
- somef_core/test/test_data/repositories/Widoco/README.md +187 -0
- somef_core/test/test_data/repositories/Widoco/codemeta.json +62 -0
- somef_core/test/test_data/repositories/Widoco/docs/pom.sml +167 -0
- somef_core/test/test_data/repositories/Widoco/docs/pom.xml +167 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/CITATION.cff +20 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/README.md +188 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/license.md +14 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/ontology.nt +153 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/ontology.ttl +159 -0
- somef_core/test/test_data/repositories/Widoco/example_onto/test.ttl +9 -0
- somef_core/test/test_data/repositories/Widoco/pom.xml +172 -0
- somef_core/test/test_data/repositories/Widoco/target/maven-archiver/pom.properties +3 -0
- somef_core/test/test_data/repositories/Widoco/test/CITATION.cff +20 -0
- somef_core/test/test_data/repositories/Widoco/test/test/CITATION.cff +20 -0
- somef_core/test/test_data/repositories/Widoco/test/test/test/CITATION.cff +20 -0
- somef_core/test/test_data/repositories/ack/ACKNOWLEDGMENT.md +1 -0
- somef_core/test/test_data/repositories/ack/README.md +4 -0
- somef_core/test/test_data/repositories/aladin-lite/codemeta.json +83 -0
- somef_core/test/test_data/repositories/auroral-ontology-core/ontology.rdf +2306 -0
- somef_core/test/test_data/repositories/auroral-ontology-core/ontology.xml +981 -0
- somef_core/test/test_data/repositories/auroral-ontology-core/readme.md +34 -0
- somef_core/test/test_data/repositories/basis_functions_approach_to_GP-master/BF_1D_notebook.Rmd +1041 -0
- somef_core/test/test_data/repositories/basis_functions_approach_to_GP-master/Diagnosis_HSGP_v2.Rmd +938 -0
- somef_core/test/test_data/repositories/basis_functions_approach_to_GP-master/Rnb_case3D_diagnosis.Rmd +1082 -0
- somef_core/test/test_data/repositories/bimerr-epw/LICENSE +201 -0
- somef_core/test/test_data/repositories/bimerr-epw/README.md +23 -0
- somef_core/test/test_data/repositories/bootstrap-datepicker-rails/bootstrap-datepicker-rails-2.gemspec +22 -0
- somef_core/test/test_data/repositories/bootstrap-datepicker-rails/bootstrap-datepicker-rails.gemspec +22 -0
- somef_core/test/test_data/repositories/captum/.gitattributes +2 -0
- somef_core/test/test_data/repositories/captum/.gitignore +117 -0
- somef_core/test/test_data/repositories/captum/AWESOME_LIST.md +28 -0
- somef_core/test/test_data/repositories/captum/CITATION +8 -0
- somef_core/test/test_data/repositories/captum/CODE_OF_CONDUCT.md +76 -0
- somef_core/test/test_data/repositories/captum/CONTRIBUTING.md +134 -0
- somef_core/test/test_data/repositories/captum/LICENSE +29 -0
- somef_core/test/test_data/repositories/captum/README.md +494 -0
- somef_core/test/test_data/repositories/captum/environment.yml +6 -0
- somef_core/test/test_data/repositories/captum/pyproject.toml +2 -0
- somef_core/test/test_data/repositories/captum/setup.cfg +12 -0
- somef_core/test/test_data/repositories/captum/setup.py +171 -0
- somef_core/test/test_data/repositories/chosen/bower.json +42 -0
- somef_core/test/test_data/repositories/codecov/composer.json +25 -0
- somef_core/test/test_data/repositories/codemeta_repo/codemeta.json +214 -0
- somef_core/test/test_data/repositories/componentInstaller/CITATION.cff +23 -0
- somef_core/test/test_data/repositories/componentInstaller/LICENSE +674 -0
- somef_core/test/test_data/repositories/componentInstaller/README.md +138 -0
- somef_core/test/test_data/repositories/composer/composer.json +110 -0
- somef_core/test/test_data/repositories/corpuser/README.md +38 -0
- somef_core/test/test_data/repositories/cropwater/DESCRIPTION +61 -0
- somef_core/test/test_data/repositories/cropwater/LICENSE.md +21 -0
- somef_core/test/test_data/repositories/cropwater/README.md +649 -0
- somef_core/test/test_data/repositories/cropwater/codemeta.json +159 -0
- somef_core/test/test_data/repositories/fair-ontologies/README.md +117 -0
- somef_core/test/test_data/repositories/fair-ontologies/citation.cff +23 -0
- somef_core/test/test_data/repositories/fair-ontologies/codemeta.json +133 -0
- somef_core/test/test_data/repositories/fair-ontologies/pom.xml +186 -0
- somef_core/test/test_data/repositories/fuji/AUTHORS +19 -0
- somef_core/test/test_data/repositories/fuji/CITATION.cff +35 -0
- somef_core/test/test_data/repositories/fuji/README.md +265 -0
- somef_core/test/test_data/repositories/fuji/pyproject.toml +169 -0
- somef_core/test/test_data/repositories/gammalearn/pyproject.toml +79 -0
- somef_core/test/test_data/repositories/gammapy/codemeta.json +376 -0
- somef_core/test/test_data/repositories/ggplot2/DESCRIPTION +132 -0
- somef_core/test/test_data/repositories/ggstatsplot/DESCRIPTION +86 -0
- somef_core/test/test_data/repositories/ggstatsplot/codemeta.json +638 -0
- somef_core/test/test_data/repositories/haskell/cabal.cabal +419 -0
- somef_core/test/test_data/repositories/inspect4py/CITATION.cff +25 -0
- somef_core/test/test_data/repositories/inspect4py/README.md +255 -0
- somef_core/test/test_data/repositories/inspect4py/docs/requirements.txt +1 -0
- somef_core/test/test_data/repositories/inspect4py/pyproject.toml +15 -0
- somef_core/test/test_data/repositories/inspect4py/requirements.txt +12 -0
- somef_core/test/test_data/repositories/inspect4py/setup.py +51 -0
- somef_core/test/test_data/repositories/ipynb-master/__init__.py +29 -0
- somef_core/test/test_data/repositories/ipynb-master/bogus_ipynb.ipynb +2 -0
- somef_core/test/test_data/repositories/ipynb-master/r_notebook.ipynb +40 -0
- somef_core/test/test_data/repositories/js-template/bower.json +26 -0
- somef_core/test/test_data/repositories/js-template/package.json +25 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/LICENSE +21 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/README.md +81 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/01-kgtk-introduction.ipynb +2455 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/02-kg-profiling.ipynb +4924 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/03-kg-graph-embeddings.ipynb +819 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/04-kg-enrichment-with-csv.ipynb +3570 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/05-kg-enrichment-with-lod.ipynb +3297 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/06-kg-network-analysis.ipynb +2363 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/07-kg-constraint-validation.ipynb +1423 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/tutorial/kgtk-browser.ipynb +308 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/use-cases/Visualize-force-graph-example.ipynb +937 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/use-cases/browser-profiling.ipynb +1583 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/use-cases/class-visualization.ipynb +7509 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/use-cases/ontology-examples.ipynb +2002 -0
- somef_core/test/test_data/repositories/kgtk-notebooks/use-cases/properties-for-this-type.ipynb +1474 -0
- somef_core/test/test_data/repositories/maven/pom.xml +1275 -0
- somef_core/test/test_data/repositories/maykinMedia/publiccode.yaml +112 -0
- somef_core/test/test_data/repositories/mir_eval/LICENSE.txt +21 -0
- somef_core/test/test_data/repositories/mir_eval/README.rst +25 -0
- somef_core/test/test_data/repositories/mir_eval/setup.py +37 -0
- somef_core/test/test_data/repositories/mira/LICENSE +201 -0
- somef_core/test/test_data/repositories/mira/README.md +124 -0
- somef_core/test/test_data/repositories/nemo/CITATION.cff +23 -0
- somef_core/test/test_data/repositories/nemo/README.md +185 -0
- somef_core/test/test_data/repositories/pcake/README.md +4 -0
- somef_core/test/test_data/repositories/pcake/setup.py +28 -0
- somef_core/test/test_data/repositories/probot-12.1.1/.editorconfig +9 -0
- somef_core/test/test_data/repositories/probot-12.1.1/.gitignore +12 -0
- somef_core/test/test_data/repositories/probot-12.1.1/CODE_OF_CONDUCT.md +132 -0
- somef_core/test/test_data/repositories/probot-12.1.1/CONTRIBUTING.md +63 -0
- somef_core/test/test_data/repositories/probot-12.1.1/LICENSE +15 -0
- somef_core/test/test_data/repositories/probot-12.1.1/README.md +51 -0
- somef_core/test/test_data/repositories/probot-12.1.1/README.pt-br.md +40 -0
- somef_core/test/test_data/repositories/probot-12.1.1/codecov.yml +11 -0
- somef_core/test/test_data/repositories/publicCode-Example/publiccode.yml +131 -0
- somef_core/test/test_data/repositories/r3broot2/codemeta.json +437 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/CHANGELOG.md +2255 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/CONTRIBUTORS +57 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/LICENSE +29 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/MANIFEST.in +13 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/Makefile +20 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/README.md +226 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/black.toml +31 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/docker-compose.tests.yml +24 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/pull_request_template.md +7 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/requirements.dev.txt +12 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/requirements.txt +3 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/run_tests.py +92 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/run_tests.sh +9 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/run_tests_with_coverage_report.sh +9 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/setup.cfg +38 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/setup.py +90 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/skiptests.list +59 -0
- somef_core/test/test_data/repositories/rdflib-6.0.2/tox.ini +35 -0
- somef_core/test/test_data/repositories/repos_oeg/bimerr-core/README.md +1 -0
- somef_core/test/test_data/repositories/resolver_deco/LICENSE.txt +12 -0
- somef_core/test/test_data/repositories/resolver_deco/README.txt +56 -0
- somef_core/test/test_data/repositories/resolver_deco/resolver_deco.py +49 -0
- somef_core/test/test_data/repositories/resolver_deco/setup.py +20 -0
- somef_core/test/test_data/repositories/runtime_platform_repo/codemeta.json +6 -0
- somef_core/test/test_data/repositories/rustdesk/Cargo.toml +223 -0
- somef_core/test/test_data/repositories/soca/README.md +301 -0
- somef_core/test/test_data/repositories/soca/codemeta.json +75 -0
- somef_core/test/test_data/repositories/soca/pyproject.toml +6 -0
- somef_core/test/test_data/repositories/soca/setup.cfg +45 -0
- somef_core/test/test_data/repositories/software_catalog/LICENSE +201 -0
- somef_core/test/test_data/repositories/software_catalog/README.md +21 -0
- somef_core/test/test_data/repositories/software_catalog/repo_icons/acknowledgement.png +0 -0
- somef_core/test/test_data/repositories/software_catalog/repo_icons/citation.png +0 -0
- somef_core/test/test_data/repositories/somef_repo/CITATION.cff +43 -0
- somef_core/test/test_data/repositories/somef_repo/README.md +361 -0
- somef_core/test/test_data/repositories/somef_repo/lib/python/pip-24.2.dist-info/AUTHORS.txt +796 -0
- somef_core/test/test_data/repositories/somef_repo/pyproject.toml +55 -0
- somef_core/test/test_data/repositories/sprint-main/netex_accounting_version.xsd.rdf +425 -0
- somef_core/test/test_data/repositories/sprint-main/setup.sh +2 -0
- somef_core/test/test_data/repositories/stable-diffusion/README.md +214 -0
- somef_core/test/test_data/repositories/stable-diffusion/environment.yaml +31 -0
- somef_core/test/test_data/repositories/sunpy/CITATION.cff +79 -0
- somef_core/test/test_data/repositories/sunpy/pyproject.toml +256 -0
- somef_core/test/test_data/repositories/sunpy_short_desc/README.rst +82 -0
- somef_core/test/test_data/repositories/sunpy_short_desc/pyproject.toml +256 -0
- somef_core/test/test_data/repositories/tensorflow/CODEOWNERS +18 -0
- somef_core/test/test_data/repositories/tensorflow/README.md +173 -0
- somef_core/test/test_data/repositories/termlex-main/README.md +14 -0
- somef_core/test/test_data/repositories/termlex-main/ontology/termlex.ttl +2150 -0
- somef_core/test/test_data/repositories/termlex-main/termlex_core.png +0 -0
- somef_core/test/test_data/repositories/tidyverse/DESCRIPTION +63 -0
- somef_core/test/test_data/repositories/unused/unused.cabal +127 -0
- somef_core/test/test_data/repositories/wav2letter/CMakeLists.txt +168 -0
- somef_core/test/test_data/repositories/wav2letter/CODE_OF_CONDUCT.md +5 -0
- somef_core/test/test_data/repositories/wav2letter/CONTRIBUTING.md +27 -0
- somef_core/test/test_data/repositories/wav2letter/Decode.cpp +440 -0
- somef_core/test/test_data/repositories/wav2letter/LICENSE +30 -0
- somef_core/test/test_data/repositories/wav2letter/README.md +39 -0
- somef_core/test/test_data/repositories/wav2letter/Test.cpp +184 -0
- somef_core/test/test_data/repositories/wav2letter/Train.cpp +564 -0
- somef_core/test/test_data/repositories/wav2letter/docs/DecoderSketch.png +0 -0
- somef_core/test/test_data/repositories/wav2letter/docs/arch.md +68 -0
- somef_core/test/test_data/repositories/wav2letter/docs/decoder.md +80 -0
- somef_core/test/test_data/repositories/wav2letter/docs/installation.md +50 -0
- somef_core/test/test_data/repositories/wav2letter/docs/train.md +86 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/OptimizeSortParams.cpp +156 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/Seq2SeqAnalysis.cpp +215 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/arrayfire_parser.py +65 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/fair_cluster/w2l_fair_cluster_build.sh +37 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/fair_cluster/w2l_fair_cluster_decode.sh +34 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/fair_cluster/w2l_fair_cluster_distributed_training_benchmarks.sh +59 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/fair_cluster/w2l_fair_cluster_train.sh +48 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/imgcat +118 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/launch_distributed_chronos.sh +60 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/tensorboard.py +206 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/wavdiff +53 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/wavextract +180 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/wavplot +170 -0
- somef_core/test/test_data/repositories/wav2letter/scripts/wavstatus +94 -0
- somef_core/test/test_data/repositories/website-static-master/fonts.css +15 -0
- somef_core/test/test_data/repositories/website-static-master/header.js +32 -0
- somef_core/test/test_data/repositories/website-static-master/image.js +32 -0
- somef_core/test/test_data/repositories/website-static-master/index.html +1 -0
- somef_core/test/test_data/repositories/website-static-master/index.js +126 -0
- somef_core/test/test_data/repositories/website-static-master/layout.js +102 -0
- somef_core/test/test_data/repositories/website-static-master/privacy.js +47 -0
- somef_core/test/test_data/repositories/website-static-master/terms.js +119 -0
- somef_core/test/test_data/repositories/workloopr/LICENSE +674 -0
- somef_core/test/test_data/repositories/workloopr/README.md +172 -0
- somef_core/test/test_data/repositories/workloopr/codemeta.json +144 -0
- somef_core/test/test_data/repositories/wot-hive/README.md +111 -0
- somef_core/test/test_data/repositories/wot-hive/docker/auroral-hive/Dockerfile +15 -0
- somef_core/test/test_data/repositories/wot-hive/docker/docker-compose.yml +26 -0
- somef_core/test/test_data/repositories/wot-hive/docker/fuseki/Dockerfile +9 -0
- somef_core/test/test_data/repostatus-README-2.md +50 -0
- somef_core/test/test_data/repostatus-README.md +50 -0
- somef_core/test/test_data/test_465.md +388 -0
- somef_core/test/test_data/test_arxiv_links.txt +95 -0
- somef_core/test/test_data/test_extract_bibtex.txt +17 -0
- somef_core/test/test_data/test_extract_binder_links.txt +4 -0
- somef_core/test/test_data/test_extract_dois.txt +8 -0
- somef_core/test/test_data/test_extract_gitter_chat.txt +2 -0
- somef_core/test/test_data/test_extract_header_content_hash.txt +13 -0
- somef_core/test/test_data/test_extract_header_content_hash_complex.txt +11 -0
- somef_core/test/test_data/test_extract_header_content_underline.txt +18 -0
- somef_core/test/test_data/test_extract_readthedocs_1.txt +2 -0
- somef_core/test/test_data/test_extract_readthedocs_2.txt +6 -0
- somef_core/test/test_data/test_extract_readthedocs_3.txt +6 -0
- somef_core/test/test_data/test_extract_title_hash.txt +6 -0
- somef_core/test/test_data/test_extract_title_underline.txt +6 -0
- somef_core/test/test_data/test_extract_title_with_md.txt +2 -0
- somef_core/test/test_data/test_images.txt +68 -0
- somef_core/test/test_data/test_issue_181.txt +16 -0
- somef_core/test/test_data/test_issue_181_2.txt +135 -0
- somef_core/test/test_data/test_issue_181_3.txt +110 -0
- somef_core/test/test_data/test_issue_270.txt +15 -0
- somef_core/test/test_data/test_issue_images.txt +9 -0
- somef_core/test/test_data/test_logo.txt +5 -0
- somef_core/test/test_data/test_logo2.txt +5 -0
- somef_core/test/test_data/test_logo_tensorflow.txt +157 -0
- somef_core/test/test_data/test_logo_uscisii2.txt +95 -0
- somef_core/test/test_data/test_pypi.md +26 -0
- somef_core/test/test_data/test_repo_status.txt +10 -0
- somef_core/test/test_data/test_wiki.md +46 -0
- somef_core/test/test_data/widoco_readme.md +152 -0
- somef_core/test/test_description_parser.py +116 -0
- somef_core/test/test_dockerfile_parser.py +190 -0
- somef_core/test/test_enrichment.py +169 -0
- somef_core/test/test_extract_authors.py +71 -0
- somef_core/test/test_extract_workflows.py +18 -0
- somef_core/test/test_gemspec_parser.py +77 -0
- somef_core/test/test_gitlab_selfhosted.py +26 -0
- somef_core/test/test_gitlab_token_handling.py +118 -0
- somef_core/test/test_google_compliant_export.py +50 -0
- somef_core/test/test_header_analysis.py +284 -0
- somef_core/test/test_package_json_parser.py +124 -0
- somef_core/test/test_parser_somef.py +95 -0
- somef_core/test/test_pom_parser.py +118 -0
- somef_core/test/test_process_repository.py +1350 -0
- somef_core/test/test_process_results.py +23 -0
- somef_core/test/test_publiccode_parser.py +144 -0
- somef_core/test/test_python_parser.py +56 -0
- somef_core/test/test_regular_expressions.py +677 -0
- somef_core/test/test_setupcfg_parser.py +53 -0
- somef_core/test/test_software_type.py +139 -0
- somef_core/test/test_toml_parser.py +375 -0
- somef_core/test/test_verify_token.py +62 -0
- somef_core/test/test_wiki.py +69 -0
- somef_core/utils/__init__.py +0 -0
- somef_core/utils/constants.py +794 -0
- somef_core/utils/enrichment.py +223 -0
- somef_core/utils/markdown_utils.py +79 -0
- somef_core-0.0.1.dist-info/METADATA +545 -0
- somef_core-0.0.1.dist-info/RECORD +423 -0
- somef_core-0.0.1.dist-info/WHEEL +4 -0
- somef_core-0.0.1.dist-info/entry_points.txt +3 -0
- somef_core-0.0.1.dist-info/licenses/LICENSE +19 -0
somef_core/__init__.py
ADDED
somef_core/__main__.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup, RequiredAnyOptionGroup
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
from . import configuration
|
|
8
|
+
from .utils import constants
|
|
9
|
+
from . import __version__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class URLParamType(click.types.StringParamType):
|
|
13
|
+
name = "url"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@click.group(context_settings={'help_option_names': ['-h', '--help']})
|
|
17
|
+
@click.version_option(__version__)
|
|
18
|
+
def cli():
|
|
19
|
+
click.echo("SOftware Metadata Extraction Framework (SOMEF) Command Line Interface")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@cli.group(help="Configure repository credentials and classifiers file path", invoke_without_command=True)
|
|
23
|
+
@click.option('-a', '--auto', help="Automatically configure SOMEF", is_flag=True, default=False)
|
|
24
|
+
@click.option('-b', '--base_uri', type=URLParamType(), help="Base URI for somef transformations",
|
|
25
|
+
default=constants.CONF_DEFAULT_BASE_URI)
|
|
26
|
+
@click.pass_context
|
|
27
|
+
def configure(ctx, auto, base_uri):
|
|
28
|
+
if ctx.invoked_subcommand is not None:
|
|
29
|
+
return
|
|
30
|
+
if auto:
|
|
31
|
+
click.echo(
|
|
32
|
+
"Configuring SOMEF automatically. To assign credentials edit the configuration file or run "
|
|
33
|
+
"the interactive mode")
|
|
34
|
+
configuration.configure()
|
|
35
|
+
elif base_uri is not constants.CONF_DEFAULT_BASE_URI:
|
|
36
|
+
configuration.update_base_uri(base_uri)
|
|
37
|
+
else:
|
|
38
|
+
# authorization = click.prompt("Authorization", default="")
|
|
39
|
+
github_authorization = click.prompt("GitHub Authorization token (leave blank to skip)", default="")
|
|
40
|
+
gitlab_authorization = click.prompt(
|
|
41
|
+
"GitLab Authorization token (leave blank to skip; works for gitlab.com and self-hosted instances)",
|
|
42
|
+
default="",
|
|
43
|
+
)
|
|
44
|
+
codeberg_authorization = click.prompt("Codeberg Authorization token (leave blank to skip)", default="")
|
|
45
|
+
|
|
46
|
+
bitbucket_authorization = click.prompt("Bitbucket Authorization token (leave blank to skip)", default="")
|
|
47
|
+
bitbucket_email = click.prompt("Bitbucket Atlassian account email (for API token auth)", default="")
|
|
48
|
+
|
|
49
|
+
# description = click.prompt(... model file ...)
|
|
50
|
+
# invocation = click.prompt(...)
|
|
51
|
+
# installation = click.prompt(...)
|
|
52
|
+
# citation = click.prompt(...)
|
|
53
|
+
base_uri = click.prompt("Base URI for RDF generation", default=base_uri)
|
|
54
|
+
download_limit = click.prompt("Download size limit in MB",
|
|
55
|
+
default=constants.SIZE_DOWNLOAD_LIMIT_MB, type=int)
|
|
56
|
+
# configuration.configure()
|
|
57
|
+
configuration.configure(github_authorization, gitlab_authorization, codeberg_authorization, bitbucket_authorization, bitbucket_email, description=None, invocation=None, installation=None, citation=None, base_uri=base_uri, download_limit_mb=download_limit)
|
|
58
|
+
|
|
59
|
+
click.secho(f"Success", fg="green")
|
|
60
|
+
|
|
61
|
+
@configure.command(
|
|
62
|
+
help="Test the configured API tokens")
|
|
63
|
+
def test():
|
|
64
|
+
"""Checks the configured tokens against each provider."""
|
|
65
|
+
results = configuration.test_configuration_tokens()
|
|
66
|
+
for label, res in results.items():
|
|
67
|
+
if res["ok"] is None:
|
|
68
|
+
click.secho(f"{label}: {res['message']}", fg="yellow")
|
|
69
|
+
elif res["ok"]:
|
|
70
|
+
click.secho(f"{label}: {res['message']}", fg="green")
|
|
71
|
+
else:
|
|
72
|
+
click.secho(f"{label}: {res['message']}", fg="red")
|
|
73
|
+
if any(not res['ok'] for res in results.values()):
|
|
74
|
+
raise SystemExit(1)
|
|
75
|
+
|
|
76
|
+
@cli.command(help="Running SOMEF Command Line Interface")
|
|
77
|
+
@click.option(
|
|
78
|
+
"--threshold",
|
|
79
|
+
"-t",
|
|
80
|
+
type=float,
|
|
81
|
+
help="Threshold to classify the text",
|
|
82
|
+
required=True,
|
|
83
|
+
default=0.8,
|
|
84
|
+
)
|
|
85
|
+
@click.option(
|
|
86
|
+
"--ignore_classifiers",
|
|
87
|
+
"-ic",
|
|
88
|
+
is_flag=True,
|
|
89
|
+
default=False,
|
|
90
|
+
help="Flag to ignore running the classifiers (by default False)"
|
|
91
|
+
)
|
|
92
|
+
@click.option(
|
|
93
|
+
"--ignore_github_metadata",
|
|
94
|
+
"-igm",
|
|
95
|
+
is_flag=True,
|
|
96
|
+
default=False,
|
|
97
|
+
help="Flag to ignore Github Metadata (by default False)"
|
|
98
|
+
)
|
|
99
|
+
@click.option(
|
|
100
|
+
"--readme_only",
|
|
101
|
+
"-ro",
|
|
102
|
+
is_flag=True,
|
|
103
|
+
default=False,
|
|
104
|
+
help="Flag to retrieve only the README.md file from the Github/Gitlab Repository URL. If such file does not exist, "
|
|
105
|
+
"no metadata will be retrieved (by default False)"
|
|
106
|
+
)
|
|
107
|
+
@optgroup.group('Input', cls=RequiredMutuallyExclusiveOptionGroup)
|
|
108
|
+
@optgroup.option(
|
|
109
|
+
"--repo_url",
|
|
110
|
+
"-r",
|
|
111
|
+
type=URLParamType(),
|
|
112
|
+
help="Github/Gitlab Repository URL",
|
|
113
|
+
)
|
|
114
|
+
@optgroup.option(
|
|
115
|
+
"--doc_src",
|
|
116
|
+
"-d",
|
|
117
|
+
type=click.Path(exists=True),
|
|
118
|
+
help="Path to the README file source"
|
|
119
|
+
)
|
|
120
|
+
@optgroup.option(
|
|
121
|
+
"--local_repo",
|
|
122
|
+
"-l",
|
|
123
|
+
type=click.Path(exists=True),
|
|
124
|
+
help="Path to local repository"
|
|
125
|
+
)
|
|
126
|
+
@optgroup.option(
|
|
127
|
+
"--in_file",
|
|
128
|
+
"-i",
|
|
129
|
+
type=click.Path(exists=True),
|
|
130
|
+
help=""""A file of newline separated links to GitHub/Gitlab repositories to process in bulk. Each repository will be
|
|
131
|
+
stored in a different file called $out_$url.json where $out is the name selected as out file and $url is the
|
|
132
|
+
url of the target repository (url encoded)"""
|
|
133
|
+
)
|
|
134
|
+
@optgroup.group('Output', cls=RequiredAnyOptionGroup)
|
|
135
|
+
@optgroup.option(
|
|
136
|
+
"--output",
|
|
137
|
+
"-o",
|
|
138
|
+
type=click.Path(),
|
|
139
|
+
help="Path to the output file. If supplied, the output will be in JSON",
|
|
140
|
+
)
|
|
141
|
+
@optgroup.option(
|
|
142
|
+
"--codemeta_out",
|
|
143
|
+
"-c",
|
|
144
|
+
type=click.Path(),
|
|
145
|
+
help="Path to an output codemeta file"
|
|
146
|
+
)
|
|
147
|
+
@optgroup.option(
|
|
148
|
+
"--google_codemeta_out",
|
|
149
|
+
"-gc",
|
|
150
|
+
type=click.Path(),
|
|
151
|
+
help="Path to an output Google-compliant codemeta file"
|
|
152
|
+
)
|
|
153
|
+
@optgroup.option(
|
|
154
|
+
"--graph_out",
|
|
155
|
+
"-g",
|
|
156
|
+
type=click.Path(),
|
|
157
|
+
help="""Path to the output Knowledge Graph export file. If supplied, the output will be a Knowledge Graph,
|
|
158
|
+
in the format given in the --format option chosen (turtle, json-ld)"""
|
|
159
|
+
)
|
|
160
|
+
@click.option(
|
|
161
|
+
"--graph_format",
|
|
162
|
+
"-f",
|
|
163
|
+
type=click.Choice(["turtle", "json-ld"]),
|
|
164
|
+
default="turtle",
|
|
165
|
+
help="""If the --graph_out option is given, this is the format that the graph will be stored in"""
|
|
166
|
+
)
|
|
167
|
+
@click.option(
|
|
168
|
+
"--pretty",
|
|
169
|
+
"-p",
|
|
170
|
+
is_flag=True,
|
|
171
|
+
default=False,
|
|
172
|
+
help="""Pretty print the JSON output file so that it is easy to compare to another JSON output file."""
|
|
173
|
+
)
|
|
174
|
+
@click.option(
|
|
175
|
+
"--missing",
|
|
176
|
+
"-m",
|
|
177
|
+
is_flag=True,
|
|
178
|
+
default=False,
|
|
179
|
+
help="""The JSON will include a field missing_categories to report with the missing metadata fields SOMEF was not
|
|
180
|
+
able to find. """
|
|
181
|
+
)
|
|
182
|
+
@click.option(
|
|
183
|
+
"--keep_tmp",
|
|
184
|
+
"-kt",
|
|
185
|
+
type=click.Path(),
|
|
186
|
+
help="""SOMEF will NOT delete the temporary folder where files are stored for analysis. Files will be stored at the
|
|
187
|
+
desired path"""
|
|
188
|
+
)
|
|
189
|
+
@click.option(
|
|
190
|
+
"--ignore_test_folder",
|
|
191
|
+
"-itf",
|
|
192
|
+
is_flag=True,
|
|
193
|
+
default=True,
|
|
194
|
+
help="""SOMEF will ignore the contents of all files within folders named test (True by default)"""
|
|
195
|
+
)
|
|
196
|
+
@click.option(
|
|
197
|
+
"--requirements_all",
|
|
198
|
+
"-all",
|
|
199
|
+
is_flag=True,
|
|
200
|
+
default=False,
|
|
201
|
+
help="Export all detected requirements, including text and libraries (default)."
|
|
202
|
+
)
|
|
203
|
+
@click.option(
|
|
204
|
+
"--requirements_v",
|
|
205
|
+
"-v",
|
|
206
|
+
is_flag=True,
|
|
207
|
+
default=False,
|
|
208
|
+
help="Export only requirements from structured sources (pom.xml, requirements.txt, etc.)"
|
|
209
|
+
)
|
|
210
|
+
@click.option(
|
|
211
|
+
"--reconcile_authors",
|
|
212
|
+
"-ra",
|
|
213
|
+
is_flag=True,
|
|
214
|
+
default=False,
|
|
215
|
+
help="""SOMEF will extract additional information from certain files like CODEOWNERS, etc."""
|
|
216
|
+
)
|
|
217
|
+
@click.option(
|
|
218
|
+
"--branch",
|
|
219
|
+
"-b",
|
|
220
|
+
type=str,
|
|
221
|
+
default=None,
|
|
222
|
+
help="Branch of the repository to analyze. Overrides the default branch."
|
|
223
|
+
)
|
|
224
|
+
@click.option(
|
|
225
|
+
"--tag",
|
|
226
|
+
type=str,
|
|
227
|
+
default=None,
|
|
228
|
+
help="Tag of the repository to analyze. Incompatible with --branch"
|
|
229
|
+
)
|
|
230
|
+
@click.option(
|
|
231
|
+
"--commit",
|
|
232
|
+
type=str,
|
|
233
|
+
default=None,
|
|
234
|
+
help="Commit SHA of the repository to analyze. Incompatible with --branch and --tag"
|
|
235
|
+
)
|
|
236
|
+
@click.option(
|
|
237
|
+
"--enrich",
|
|
238
|
+
"-e",
|
|
239
|
+
is_flag=True,
|
|
240
|
+
default=False,
|
|
241
|
+
help="Enrich metadata with external APIs (OpenAlex, OpenAIRE, Zenodo)"
|
|
242
|
+
)
|
|
243
|
+
@click.option(
|
|
244
|
+
"--github-token",
|
|
245
|
+
type=str,
|
|
246
|
+
default=None,
|
|
247
|
+
help="GitHub personal access token (if invalid, stored config is used instead)"
|
|
248
|
+
)
|
|
249
|
+
@click.option(
|
|
250
|
+
"--gitlab-token",
|
|
251
|
+
"-gt",
|
|
252
|
+
type=str,
|
|
253
|
+
default=None,
|
|
254
|
+
help="GitLab personal access token (if invalid, stored config is used instead)"
|
|
255
|
+
)
|
|
256
|
+
@click.option(
|
|
257
|
+
"--codeberg-token",
|
|
258
|
+
type=str,
|
|
259
|
+
default=None,
|
|
260
|
+
help="Codeberg personal access token (if invalid, stored config is used instead)"
|
|
261
|
+
)
|
|
262
|
+
@click.option(
|
|
263
|
+
"--bitbucket-token",
|
|
264
|
+
type=str,
|
|
265
|
+
default=None,
|
|
266
|
+
help="Bitbucket API token (if invalid, stored config is used instead)"
|
|
267
|
+
)
|
|
268
|
+
@click.option(
|
|
269
|
+
"--bitbucket-email",
|
|
270
|
+
type=str,
|
|
271
|
+
default=None,
|
|
272
|
+
help="Bitbucket Atlassian account email (required with --bitbucket-token)"
|
|
273
|
+
)
|
|
274
|
+
@click.option(
|
|
275
|
+
"--download-limit",
|
|
276
|
+
type=int,
|
|
277
|
+
default=None,
|
|
278
|
+
help="Download size limit in MB (overrides config file value)"
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
def describe(requirements_v, requirements_all, **kwargs):
|
|
282
|
+
# import so missing packages get installed when appropriate
|
|
283
|
+
if requirements_v:
|
|
284
|
+
kwargs["requirements_mode"] = "v"
|
|
285
|
+
elif requirements_all:
|
|
286
|
+
kwargs["requirements_mode"] = "all"
|
|
287
|
+
else:
|
|
288
|
+
kwargs["requirements_mode"] = "all"
|
|
289
|
+
|
|
290
|
+
from . import somef_cli
|
|
291
|
+
somef_cli.run_cli(**kwargs)
|
|
292
|
+
click.secho(f"Success", fg="green")
|
|
293
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
import logging
|
|
6
|
+
import base64
|
|
7
|
+
import requests
|
|
8
|
+
import nltk
|
|
9
|
+
from .utils import constants
|
|
10
|
+
|
|
11
|
+
path = Path(__file__).parent.absolute()
|
|
12
|
+
# default_description = os.path.join(str(path), "models", "description.p")
|
|
13
|
+
# default_invocation = os.path.join(str(path), "models", "invocation.p")
|
|
14
|
+
# default_installation = os.path.join(str(path), "models", "installation.p")
|
|
15
|
+
# default_citation = os.path.join(str(path), "models", "citation.p")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_configuration_file():
|
|
19
|
+
"""
|
|
20
|
+
Function that retrieves the configuration file
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
The configuration object in JSON format
|
|
24
|
+
"""
|
|
25
|
+
credentials_file = Path(
|
|
26
|
+
os.getenv("SOMEF_CONFIGURATION_FILE", '~/.somef_core/config.json')
|
|
27
|
+
).expanduser()
|
|
28
|
+
if credentials_file.exists():
|
|
29
|
+
with credentials_file.open("r") as fh:
|
|
30
|
+
file_paths = json.load(fh)
|
|
31
|
+
if constants.CONF_SIMILARITY_THRESHOLD not in file_paths:
|
|
32
|
+
file_paths[constants.CONF_SIMILARITY_THRESHOLD] = constants.CONF_DEFAULT_SIMILARITY_THRESHOLD
|
|
33
|
+
if constants.CONF_DOWNLOAD_LIMIT_MB not in file_paths:
|
|
34
|
+
file_paths[constants.CONF_DOWNLOAD_LIMIT_MB] = constants.SIZE_DOWNLOAD_LIMIT_MB
|
|
35
|
+
else:
|
|
36
|
+
sys.exit("Error: Please provide a config.json file or run somef configure.")
|
|
37
|
+
return file_paths
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def update_base_uri(base_uri):
|
|
41
|
+
credentials_file = Path(
|
|
42
|
+
os.getenv("SOMEF_CONFIGURATION_FILE", constants.__DEFAULT_SOMEF_CONFIGURATION_FILE__)
|
|
43
|
+
).expanduser()
|
|
44
|
+
os.makedirs(str(credentials_file.parent), exist_ok=True)
|
|
45
|
+
|
|
46
|
+
if credentials_file.exists():
|
|
47
|
+
with credentials_file.open("r") as fh:
|
|
48
|
+
data = json.load(fh)
|
|
49
|
+
data[constants.CONF_BASE_URI] = base_uri
|
|
50
|
+
|
|
51
|
+
with credentials_file.open("w") as fh:
|
|
52
|
+
credentials_file.parent.chmod(0o700)
|
|
53
|
+
credentials_file.chmod(0o600)
|
|
54
|
+
json.dump(data, fh)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def configure(
|
|
58
|
+
# authorization="",
|
|
59
|
+
github_authorization="",
|
|
60
|
+
gitlab_authorization="",
|
|
61
|
+
codeberg_authorization="",
|
|
62
|
+
bitbucket_authorization="",
|
|
63
|
+
bitbucket_email="",
|
|
64
|
+
description=None,
|
|
65
|
+
invocation=None,
|
|
66
|
+
installation=None,
|
|
67
|
+
citation=None,
|
|
68
|
+
base_uri=constants.CONF_DEFAULT_BASE_URI,
|
|
69
|
+
similarity_threshold=constants.CONF_DEFAULT_SIMILARITY_THRESHOLD,
|
|
70
|
+
download_limit_mb=constants.SIZE_DOWNLOAD_LIMIT_MB):
|
|
71
|
+
|
|
72
|
+
""" Function to configure the main program"""
|
|
73
|
+
|
|
74
|
+
nltk.download('wordnet')
|
|
75
|
+
nltk.download('omw-1.4')
|
|
76
|
+
nltk.download('punkt')
|
|
77
|
+
nltk.download('punkt_tab')
|
|
78
|
+
nltk.download('stopwords')
|
|
79
|
+
|
|
80
|
+
credentials_file = Path(
|
|
81
|
+
os.getenv("SOMEF_CONFIGURATION_FILE", constants.__DEFAULT_SOMEF_CONFIGURATION_FILE__)
|
|
82
|
+
).expanduser()
|
|
83
|
+
os.makedirs(str(credentials_file.parent), exist_ok=True)
|
|
84
|
+
|
|
85
|
+
# if credentials_file.exists():
|
|
86
|
+
# with credentials_file.open("r") as fh:
|
|
87
|
+
# data = json.load(fh)
|
|
88
|
+
# else:
|
|
89
|
+
data = {
|
|
90
|
+
# constants.CONF_AUTHORIZATION: "token " + authorization,
|
|
91
|
+
constants.CONF_BASE_URI: base_uri,
|
|
92
|
+
constants.CONF_SIMILARITY_THRESHOLD: similarity_threshold,
|
|
93
|
+
constants.CONF_DOWNLOAD_LIMIT_MB: download_limit_mb
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
# if data[constants.CONF_AUTHORIZATION] == "token ":
|
|
97
|
+
# del data[constants.CONF_AUTHORIZATION]
|
|
98
|
+
|
|
99
|
+
if github_authorization:
|
|
100
|
+
data[constants.CONF_GITHUB_AUTHORIZATION] = "token " + github_authorization
|
|
101
|
+
|
|
102
|
+
if gitlab_authorization:
|
|
103
|
+
token = gitlab_authorization
|
|
104
|
+
if not token.lower().startswith("bearer "):
|
|
105
|
+
token = "Bearer " + token
|
|
106
|
+
data[constants.CONF_GITLAB_AUTHORIZATION] = token
|
|
107
|
+
|
|
108
|
+
if codeberg_authorization:
|
|
109
|
+
token = codeberg_authorization
|
|
110
|
+
if not token.lower().startswith("token "):
|
|
111
|
+
token = "token " + token
|
|
112
|
+
data[constants.CONF_CODEBERG_AUTHORIZATION] = token
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if bitbucket_authorization:
|
|
116
|
+
token = bitbucket_authorization
|
|
117
|
+
email = bitbucket_email
|
|
118
|
+
if not token.lower().startswith("basic "):
|
|
119
|
+
raw = f"{email}:{token}"
|
|
120
|
+
token = "Basic " + base64.b64encode(raw.encode()).decode()
|
|
121
|
+
data[constants.CONF_BITBUCKET_AUTHORIZATION] = token
|
|
122
|
+
|
|
123
|
+
with credentials_file.open("w") as fh:
|
|
124
|
+
credentials_file.parent.chmod(0o700)
|
|
125
|
+
credentials_file.chmod(0o600)
|
|
126
|
+
json.dump(data, fh)
|
|
127
|
+
logging.info("Configuration file saved at "+os.path.dirname(credentials_file))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_configuration_tokens():
|
|
131
|
+
"""
|
|
132
|
+
Checks the API tokens stored in the configuration file against each
|
|
133
|
+
provider without running SOMEF.
|
|
134
|
+
|
|
135
|
+
Returns
|
|
136
|
+
-------
|
|
137
|
+
dict
|
|
138
|
+
Mapping of provider name to {"ok": bool, "message": str}. Providers
|
|
139
|
+
without a configured token are omitted.
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
file_paths = get_configuration_file()
|
|
143
|
+
providers = [
|
|
144
|
+
("GitHub", constants.CONF_GITHUB_AUTHORIZATION, "https://api.github.com/user"),
|
|
145
|
+
("GitLab", constants.CONF_GITLAB_AUTHORIZATION, "https://gitlab.com/api/v4/user"),
|
|
146
|
+
("Codeberg", constants.CONF_CODEBERG_AUTHORIZATION, "https://codeberg.org/api/v1/user"),
|
|
147
|
+
("Bitbucket", constants.CONF_BITBUCKET_AUTHORIZATION, "https://api.bitbucket.org/2.0/user"),
|
|
148
|
+
]
|
|
149
|
+
results = {}
|
|
150
|
+
for label, key, url in providers:
|
|
151
|
+
if key not in file_paths:
|
|
152
|
+
results[label] = {"ok": None, "message": "token not configured"}
|
|
153
|
+
continue
|
|
154
|
+
|
|
155
|
+
stored = file_paths[key]
|
|
156
|
+
if label == "Bitbucket" and not stored.lower().startswith("basic "):
|
|
157
|
+
results[label] = {
|
|
158
|
+
"ok": False,
|
|
159
|
+
"message": "Bitbucket token has an incorrect format (expected a 'Basic ' prefix). "
|
|
160
|
+
"Run 'somef configure' to set it correctly.",
|
|
161
|
+
}
|
|
162
|
+
continue
|
|
163
|
+
|
|
164
|
+
try:
|
|
165
|
+
resp = requests.get(url, headers={constants.PROP_AUTHORIZATION: file_paths[key]}, timeout=10)
|
|
166
|
+
except requests.RequestException as e:
|
|
167
|
+
results[label] = {"ok": False, "message": f"Could not reach the api: {e}"}
|
|
168
|
+
continue
|
|
169
|
+
if resp.status_code == 200:
|
|
170
|
+
results[label] = {"ok": True, "message": "token valid"}
|
|
171
|
+
elif resp.status_code == 401:
|
|
172
|
+
results[label] = {"ok": False, "message": "token invalid (401)"}
|
|
173
|
+
elif resp.status_code == 403:
|
|
174
|
+
results[label] = {"ok": True, "message": "token valid but with limited permissions (403)"}
|
|
175
|
+
else:
|
|
176
|
+
results[label] = {"ok": False, "message": f"unexpected response ({resp.status_code})"}
|
|
177
|
+
return results
|
|
File without changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import copy
|
|
3
|
+
from . import json_export
|
|
4
|
+
from ..utils import constants
|
|
5
|
+
|
|
6
|
+
def save_google_codemeta_output(repo_data, output_path, pretty=False, requirements_mode="all"):
|
|
7
|
+
"""
|
|
8
|
+
Generate a Google-compliant Codemeta JSON-LD file from repo_data.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# Generate base codemeta using SOMEF. It is basically a codemeta file with a few changes.
|
|
12
|
+
# This way we have the core in the codemeta export and changes about content go just in the first method.
|
|
13
|
+
|
|
14
|
+
json_export.save_codemeta_output(
|
|
15
|
+
repo_data,
|
|
16
|
+
output_path,
|
|
17
|
+
pretty=pretty,
|
|
18
|
+
requirements_mode=requirements_mode
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Load the generated codemeta
|
|
22
|
+
with open(output_path, "r") as f:
|
|
23
|
+
codemeta = json.load(f)
|
|
24
|
+
|
|
25
|
+
# Apply google-compliant transformations
|
|
26
|
+
codemeta = make_google_compliant(codemeta)
|
|
27
|
+
|
|
28
|
+
# Overwrite the same file (no tmp file)
|
|
29
|
+
with open(output_path, "w") as f:
|
|
30
|
+
if pretty:
|
|
31
|
+
json.dump(codemeta, f, indent=2, sort_keys=True)
|
|
32
|
+
else:
|
|
33
|
+
json.dump(codemeta, f)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# SCHEMA_ORG_PROPERTIES = {
|
|
37
|
+
# "@type",
|
|
38
|
+
# "name",
|
|
39
|
+
# "description",
|
|
40
|
+
# "author",
|
|
41
|
+
# "keywords",
|
|
42
|
+
# "license",
|
|
43
|
+
# "url",
|
|
44
|
+
# "identifier",
|
|
45
|
+
# "programmingLanguage",
|
|
46
|
+
# "releaseNotes",
|
|
47
|
+
# "releaseDate"
|
|
48
|
+
# }
|
|
49
|
+
|
|
50
|
+
def make_google_compliant(codemeta):
|
|
51
|
+
codemeta = copy.deepcopy(codemeta)
|
|
52
|
+
|
|
53
|
+
# context is different from codemeta
|
|
54
|
+
codemeta["@context"] = {
|
|
55
|
+
"@vocab": "https://schema.org/",
|
|
56
|
+
"codemeta": "https://w3id.org/codemeta/3.0/"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Some categories must be in a @list even if only one value is present. Required order
|
|
60
|
+
for prop in ["author", "contributor", "editor"]:
|
|
61
|
+
if prop in codemeta:
|
|
62
|
+
codemeta[prop] = wrap_list(codemeta[prop])
|
|
63
|
+
|
|
64
|
+
# referencePublication.author is also a list
|
|
65
|
+
if "referencePublication" in codemeta:
|
|
66
|
+
for pub in codemeta["referencePublication"]:
|
|
67
|
+
if "author" in pub:
|
|
68
|
+
pub["author"] = wrap_list(pub["author"])
|
|
69
|
+
|
|
70
|
+
if isinstance(codemeta.get("softwareRequirements"), list):
|
|
71
|
+
codemeta["softwareRequirements"] = [
|
|
72
|
+
r for r in codemeta["softwareRequirements"] if isinstance(r, dict)
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
if isinstance(codemeta.get("developmentStatus"), str):
|
|
76
|
+
codemeta["developmentStatus"] = codemeta["developmentStatus"].capitalize()
|
|
77
|
+
|
|
78
|
+
codemeta = prefix_all_codemeta_properties(codemeta)
|
|
79
|
+
for key, value in codemeta.items():
|
|
80
|
+
codemeta[key] = normalize_value(value, key)
|
|
81
|
+
|
|
82
|
+
# No mappings. No normalizations. No cleaning.
|
|
83
|
+
# The PR only requires @context and @list wrapping.
|
|
84
|
+
|
|
85
|
+
return codemeta
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# ------------------------------------------------------------
|
|
89
|
+
# UTILITIES
|
|
90
|
+
# ------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
def wrap_list(value):
|
|
93
|
+
"""
|
|
94
|
+
Always wrap lists in @list, even if only one element.
|
|
95
|
+
"""
|
|
96
|
+
if isinstance(value, list):
|
|
97
|
+
return {"@list": value}
|
|
98
|
+
return value
|
|
99
|
+
|
|
100
|
+
def prefix_all_codemeta_properties(codemeta):
|
|
101
|
+
""" Add codemeta: prefix to all properties that are NOT in Schema.org. """
|
|
102
|
+
new = {}
|
|
103
|
+
|
|
104
|
+
for key, value in codemeta.items():
|
|
105
|
+
if key in constants.SCHEMA_ORG_PROPERTIES or key == "@context":
|
|
106
|
+
new[key] = value
|
|
107
|
+
else:
|
|
108
|
+
new[f"codemeta:{key}"] = value
|
|
109
|
+
|
|
110
|
+
return new
|
|
111
|
+
|
|
112
|
+
def normalize_value(value, key=None):
|
|
113
|
+
"""
|
|
114
|
+
Minimal normalization:
|
|
115
|
+
- Only normalize keywords (CSV -> list)
|
|
116
|
+
- Only filter softwareRequirements (remove strings)
|
|
117
|
+
- Do NOT touch any other property
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
# keywords: convert CSV to list
|
|
121
|
+
if key == "keywords" and isinstance(value, str):
|
|
122
|
+
parts = [p.strip() for p in value.split(",") if p.strip()]
|
|
123
|
+
return parts
|
|
124
|
+
|
|
125
|
+
# softwareRequirements: keep only dicts
|
|
126
|
+
if key == "softwareRequirements" and isinstance(value, list):
|
|
127
|
+
return [v for v in value if isinstance(v, dict)]
|
|
128
|
+
|
|
129
|
+
return value
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# def apply_schemaorg_mappings(c):
|
|
133
|
+
# """
|
|
134
|
+
# Apply mappings from Codemeta to Schema.org for Google compliance.
|
|
135
|
+
# """
|
|
136
|
+
|
|
137
|
+
# # referencePublication -> citation
|
|
138
|
+
# if "referencePublication" in c:
|
|
139
|
+
# c["citation"] = c.pop("referencePublication")
|
|
140
|
+
|
|
141
|
+
# # buildInstructions -> installUrl (if URL) or softwareHelp
|
|
142
|
+
# if "buildInstructions" in c:
|
|
143
|
+
# bi = c.pop("buildInstructions")
|
|
144
|
+
# if isinstance(bi, list) and len(bi) == 1 and is_url(bi[0]):
|
|
145
|
+
# c["installUrl"] = bi[0]
|
|
146
|
+
# else:
|
|
147
|
+
# c.setdefault("softwareHelp", [])
|
|
148
|
+
# c["softwareHelp"].append({"@type": "CreativeWork", "text": bi})
|
|
149
|
+
|
|
150
|
+
# # continuousIntegration -> softwareHelp
|
|
151
|
+
# if "continuousIntegration" in c:
|
|
152
|
+
# ci = c.pop("continuousIntegration")
|
|
153
|
+
# c.setdefault("softwareHelp", [])
|
|
154
|
+
# c["softwareHelp"].append({"@type": "CreativeWork", "url": ci})
|
|
155
|
+
|
|
156
|
+
# # readme -> softwareHelp
|
|
157
|
+
# if "readme" in c:
|
|
158
|
+
# rd = c.pop("readme")
|
|
159
|
+
# c.setdefault("softwareHelp", [])
|
|
160
|
+
# c["softwareHelp"].append({"@type": "CreativeWork", "url": rd})
|
|
161
|
+
|
|
162
|
+
# # developmentStatus normalization
|
|
163
|
+
# if "developmentStatus" in c:
|
|
164
|
+
# status = c["developmentStatus"]
|
|
165
|
+
# if isinstance(status, str):
|
|
166
|
+
# c["developmentStatus"] = status.capitalize()
|
|
167
|
+
|
|
168
|
+
# return c
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|