bd334ef20fdccb74d310ca00b1134388645ba0a5,vendor/readability/encoding.py,,get_encoding,#Any#,4

Before Change


    if not text.strip() or len(text) < 10:
        return enc // can"t guess
    try:
        diff = text.decode(enc, "ignore").encode(enc)
        sizes = len(diff), len(text)
        if abs(len(text) - len(diff)) < max(sizes) * 0.01: // 99% of utf-8
            return enc
    except UnicodeDecodeError:
        pass

After Change


            xml_re.findall(page))

    // Try any declared encodings
    if len(declared_encodings) > 0:
        for declared_encoding in declared_encodings:
            try:
                page.decode(custom_decode(declared_encoding))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 3

Instances


Project Name: samuelclay/NewsBlur
Commit Name: bd334ef20fdccb74d310ca00b1134388645ba0a5
Time: 2014-07-21
Author: samuel@ofbrooklyn.com
File Name: vendor/readability/encoding.py
Class Name:
Method Name: get_encoding


Project Name: biotite-dev/biotite
Commit Name: 2bc5d43310eeca5c0d00b115b6f73d464f9c5576
Time: 2017-08-10
Author: patrick.kunzm@gmail.com
File Name: src/biopython/sequence/align/matrix.py
Class Name: SubstitutionMatrix
Method Name: __init__


Project Name: Qiskit/qiskit-aqua
Commit Name: 7735260c7da1eea7afb9dd629ddd17bea9cd8b74
Time: 2020-08-04
Author: jules.gacon@googlemail.com
File Name: qiskit/optimization/algorithms/grover_optimizer.py
Class Name: GroverOptimizer
Method Name: solve


Project Name: dmlc/gluon-nlp
Commit Name: 601c75234db64889f9edf8975ab975bd42dfe295
Time: 2021-02-02
Author: szha@users.noreply.github.com
File Name: scripts/generation/calculate_metrics.py
Class Name:
Method Name: calculate_metrics


Project Name: tensorflow/magenta
Commit Name: ac45b5a02c24f0e5d3b0c5b4a446febffc2df753
Time: 2017-10-30
Author: iansimon@users.noreply.github.com
File Name: magenta/models/performance_rnn/performance_rnn_create_dataset.py
Class Name: EncoderPipeline
Method Name: transform