1919def get_python_script (script_url : str ) -> MappingSpecification :
2020 """Get a mapping specification from a package."""
2121 owner , repo = _get_repository (script_url )
22- data = _get_pyproject_toml (owner , repo )
23- project = data ["project" ]
24- urls = data .get ("urls" , {})
22+ pyproject_toml_data = _get_pyproject_toml (owner , repo )
23+ project = pyproject_toml_data ["project" ]
24+ urls = pyproject_toml_data .get ("urls" , {})
2525 documentation = urls .get ("documentation" ) or urls .get ("Documentation" )
26- xxx = dict (
26+ mapping_specification_dict = dict (
2727 content_url = script_url ,
2828 # TODO add explicit way of saying it's code
2929 type = MappingSpecificationTypeEnum .other ,
@@ -35,8 +35,8 @@ def get_python_script(script_url: str) -> MappingSpecification:
3535 author = _get_person (project , "authors" ),
3636 documentation = documentation ,
3737 )
38- xxx .update (_get_script_data (script_url ))
39- return MappingSpecification .model_validate (xxx )
38+ mapping_specification_dict .update (_get_script_data (script_url ))
39+ return MappingSpecification .model_validate (mapping_specification_dict )
4040
4141
4242def _get_script_data (script_url : str ) -> dict [str , Any ]:
@@ -109,9 +109,13 @@ def extract_script_toml(source: str) -> dict[str, Any] | None:
109109
110110def _main ():
111111 # TODO make function that fixes URL to be raw
112- better_url = "https://github.com/data-literacy-alliance/oerbservatory/raw/refs/heads/main/src/oerbservatory/sources/dalia.py"
113- model = get_python_script (better_url )
114- click .echo (model_dump_yaml (model , exclude_none = True , exclude = {"author.type" }))
112+ urls = [
113+ "https://github.com/data-literacy-alliance/oerbservatory/raw/refs/heads/main/src/oerbservatory/sources/dalia.py" ,
114+ "https://github.com/data-literacy-alliance/oerbservatory/raw/refs/heads/main/src/oerbservatory/sources/tess.py" ,
115+ ]
116+ for url in urls :
117+ model = get_python_script (url )
118+ click .echo (model_dump_yaml (model , exclude_none = True , exclude = {"author.type" }) + "\n " )
115119
116120
117121if __name__ == "__main__" :
0 commit comments