7419eacac2dfa909b280881524e685d7ea4d7ec7,bin/add_attachments.py,,add_attachment,#Any#Any#Any#Any#,50

Before Change


        input_file_path = path

    detected = filetype.guess(input_file_path)
    if detected is None or not detected.mime.endswith(detected.extension):
        mime_type = "UNKNOWN" if detected is None else detected.mime
        raise Exception(f"{anthology_id} file {path} has MIME type {mime_type}")

    if paper_extension not in ALLOWED_TYPES:
        raise Exception(f"-> Unknown file extension {paper_extension} for {path}")

    // Update XML
    xml_file = os.path.join(
        os.path.dirname(sys.argv[0]), "..", "data", "xml", f"{collection_id}.xml"

After Change


                input_file_fh.write(url.read())
        except ssl.SSLError:
            raise Exception(f"Could not download {path}")
        except Exception as e:
            raise e
    else:
        input_file_path = path

    file_extension = path.replace("?dl=1", "").split(".")[-1]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: acl-org/acl-anthology
Commit Name: 7419eacac2dfa909b280881524e685d7ea4d7ec7
Time: 2020-04-24
Author: post@cs.jhu.edu
File Name: bin/add_attachments.py
Class Name:
Method Name: add_attachment


Project Name: pysb/pysb
Commit Name: eab2da81c65974e08b8245bbf8a052093f972df3
Time: 2009-08-09
Author: jmuhlich@bitflood.org
File Name: Pysb.py
Class Name: Model
Method Name: observe


Project Name: elfi-dev/elfi
Commit Name: b19e3080dba989e2e7e08c74877f8396790f83d2
Time: 2016-12-05
Author: jarno.lintusaari@aalto.fi
File Name: elfi/graph.py
Class Name: Node
Method Name: remove_parent