prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add automated check for licenses
                Did someone carefully check the repository? It says there the data is licensed under CC BY 4.0-SA, which is not acceptable for OBO Foundry: https://github.com/Dalalghamdi/NGBO
  
  _Originally posted by @cthoyt in https://github.com/OBOFoundry/OBOFoundry.github.io/issues/2214#issuecomment-1399241788_
              
  
  What happened in NGBO is that the author had a different license in the metadata they submitted to the OBO Foundry than what the LICENSE file said inside their repository. Further, this wasn't carefully checked by reviewers. We should add an automated check for the future to make sure this doesn't happen again.
  
  </issue>
  <code>
  [start of src/obofoundry/utils.py]
  1 """Test data integrity, beyond what's possible with the JSON schema."""
  2 
  3 import requests
  4 import yaml
  5 
  6 from obofoundry.constants import ONTOLOGY_DIRECTORY
  7 
  8 __all__ = [
  9     "get_data",
  10     "query_wikidata",
  11 ]
  12 
  13 
  14 def get_data():
  15     """Get ontology data."""
  16     ontologies = {}
  17     for path in ONTOLOGY_DIRECTORY.glob("*.md"):
  18         with open(path) as file:
  19             lines = [line.rstrip("\n") for line in file]
  20 
  21         assert lines[0] == "---"
  22         idx = min(i for i, line in enumerate(lines[1:], start=1) if line == "---")
  23 
  24         # Load the data like it is YAML
  25         data = yaml.safe_load("\n".join(lines[1:idx]))
  26         data["long_description"] = "".join(lines[idx:])
  27         ontologies[data["id"]] = data
  28     return ontologies
  29 
  30 
  31 #: WikiData SPARQL endpoint. See https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service#Interfacing
  32 WIKIDATA_SPARQL = "https://query.wikidata.org/bigdata/namespace/wdq/sparql"
  33 
  34 
  35 def query_wikidata(query: str):
  36     """Query the Wikidata SPARQL endpoint and return JSON."""
  37     headers = {"User-Agent": "obofoundry/1.0 (https://obofoundry.org)"}
  38     res = requests.get(
  39         WIKIDATA_SPARQL, params={"query": query, "format": "json"}, headers=headers
  40     )
  41     res.raise_for_status()
  42     res_json = res.json()
  43     return res_json["results"]["bindings"]
  44
  [end of src/obofoundry/utils.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/obofoundry/utils.py b/src/obofoundry/utils.py
  --- a/src/obofoundry/utils.py
  +++ b/src/obofoundry/utils.py
  @@ -3,11 +3,12 @@
   import requests
   import yaml
   
  -from obofoundry.constants import ONTOLOGY_DIRECTORY
  +from obofoundry.constants import ONTOLOGY_DIRECTORY, ROOT
   
   __all__ = [
       "get_data",
       "query_wikidata",
  +    "get_new_data",
   ]
   
   
  @@ -41,3 +42,20 @@
       res.raise_for_status()
       res_json = res.json()
       return res_json["results"]["bindings"]
  +
  +
  +def get_new_data():
  +    """Get records for ontologies that have additional checks.
  +
  +    So far, this applies in the following scenarios:
  +
  +    1. New ontologies, i.e., there's a markdown file for the ontology in the ``/ontologies`` directory
  +       but has it not yet been published and does not appear in the config.yml
  +    """
  +    data = get_data()
  +    config_path = ROOT.joinpath("_config.yml")
  +    config_data = yaml.safe_load(config_path.read_text())
  +    published = {record["id"] for record in config_data["ontologies"]}
  +    return {
  +        prefix: record for prefix, record in data.items() if prefix not in published
  +    }
  
verification_info: {"golden_diff": "diff --git a/src/obofoundry/utils.py b/src/obofoundry/utils.py\n--- a/src/obofoundry/utils.py\n+++ b/src/obofoundry/utils.py\n@@ -3,11 +3,12 @@\n import requests\n import yaml\n \n-from obofoundry.constants import ONTOLOGY_DIRECTORY\n+from obofoundry.constants import ONTOLOGY_DIRECTORY, ROOT\n \n __all__ = [\n     \"get_data\",\n     \"query_wikidata\",\n+    \"get_new_data\",\n ]\n \n \n@@ -41,3 +42,20 @@\n     res.raise_for_status()\n     res_json = res.json()\n     return res_json[\"results\"][\"bindings\"]\n+\n+\n+def get_new_data():\n+    \"\"\"Get records for ontologies that have additional checks.\n+\n+    So far, this applies in the following scenarios:\n+\n+    1. New ontologies, i.e., there's a markdown file for the ontology in the ``/ontologies`` directory\n+       but has it not yet been published and does not appear in the config.yml\n+    \"\"\"\n+    data = get_data()\n+    config_path = ROOT.joinpath(\"_config.yml\")\n+    config_data = yaml.safe_load(config_path.read_text())\n+    published = {record[\"id\"] for record in config_data[\"ontologies\"]}\n+    return {\n+        prefix: record for prefix, record in data.items() if prefix not in published\n+    }\n", "issue": "Add automated check for licenses\n              Did someone carefully check the repository? It says there the data is licensed under CC BY 4.0-SA, which is not acceptable for OBO Foundry: https://github.com/Dalalghamdi/NGBO\r\n\r\n_Originally posted by @cthoyt in https://github.com/OBOFoundry/OBOFoundry.github.io/issues/2214#issuecomment-1399241788_\r\n            \r\n\r\nWhat happened in NGBO is that the author had a different license in the metadata they submitted to the OBO Foundry than what the LICENSE file said inside their repository. Further, this wasn't carefully checked by reviewers. We should add an automated check for the future to make sure this doesn't happen again.\n", "before_files": [{"content": "\"\"\"Test data integrity, beyond what's possible with the JSON schema.\"\"\"\n\nimport requests\nimport yaml\n\nfrom obofoundry.constants import ONTOLOGY_DIRECTORY\n\n__all__ = [\n    \"get_data\",\n    \"query_wikidata\",\n]\n\n\ndef get_data():\n    \"\"\"Get ontology data.\"\"\"\n    ontologies = {}\n    for path in ONTOLOGY_DIRECTORY.glob(\"*.md\"):\n        with open(path) as file:\n            lines = [line.rstrip(\"\\n\") for line in file]\n\n        assert lines[0] == \"---\"\n        idx = min(i for i, line in enumerate(lines[1:], start=1) if line == \"---\")\n\n        # Load the data like it is YAML\n        data = yaml.safe_load(\"\\n\".join(lines[1:idx]))\n        data[\"long_description\"] = \"\".join(lines[idx:])\n        ontologies[data[\"id\"]] = data\n    return ontologies\n\n\n#: WikiData SPARQL endpoint. See https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service#Interfacing\nWIKIDATA_SPARQL = \"https://query.wikidata.org/bigdata/namespace/wdq/sparql\"\n\n\ndef query_wikidata(query: str):\n    \"\"\"Query the Wikidata SPARQL endpoint and return JSON.\"\"\"\n    headers = {\"User-Agent\": \"obofoundry/1.0 (https://obofoundry.org)\"}\n    res = requests.get(\n        WIKIDATA_SPARQL, params={\"query\": query, \"format\": \"json\"}, headers=headers\n    )\n    res.raise_for_status()\n    res_json = res.json()\n    return res_json[\"results\"][\"bindings\"]\n", "path": "src/obofoundry/utils.py"}]}