04c9fc8971508cccc526718fefdf4fde99580356,app/grandchallenge/publications/forms.py,PublicationForm,clean,#PublicationForm#,14

Before Change



        doi = self.cleaned_data.get("doi", self.instance.doi)

        response = requests.get(
            f"https://doi.org/{doi}",
            headers={"Accept": "application/vnd.citationstyles.csl+json"},
        )

        if response.status_code != 200:
            self.add_error("doi", "This DOI could not be found.")
        else:
            self.cleaned_data["citeproc_json"] = response.json()
            self.instance.citeproc_json = response.json()

        return self.cleaned_data

    class Meta:

After Change


            "identifier", self.instance.identifier
        )

        try:
            csl, new_identifier = get_identifier_csl(doi_or_arxiv=identifier)
        except ValueError:
            raise ValidationError("Identifier not recognised")

        if new_identifier != identifier:
            self.cleaned_data["identifier"] = new_identifier
            self.instance.identifier = new_identifier
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: comic/grand-challenge.org
Commit Name: 04c9fc8971508cccc526718fefdf4fde99580356
Time: 2020-09-18
Author: 12661555+jmsmkn@users.noreply.github.com
File Name: app/grandchallenge/publications/forms.py
Class Name: PublicationForm
Method Name: clean


Project Name: mozilla/bugbug
Commit Name: 9fa3a3aa065802d552413190650adebfffe96c7c
Time: 2020-03-05
Author: mcastelluccio@mozilla.com
File Name: http_service/bugbug_http/models.py
Class Name:
Method Name: schedule_tests


Project Name: mlflow/mlflow
Commit Name: e2f830e34ff5ce508d4bcddf6e251a0da7654fbd
Time: 2018-09-25
Author: 39497902+dbczumar@users.noreply.github.com
File Name: mlflow/mleap.py
Class Name:
Method Name: add_to_model