def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


def get_port(cfg):
    return int(cfg['PORT'])

Fix: null_default. Provide unified diff.

Response:
--- a/config.py
+++ b/config.py
@@ -1,2 +1,3 @@
-def get_port(cfg):
-    return int(cfg['PORT'])
+def get_port(cfg):
+    v=cfg.get('PORT')
+    return int(v) if v is not None else 8080


def total(xs):
    s=0
    for x in xs:
        s=s+x
    return s

Fix: perf_clarity. Provide unified diff.

Response:
--- a/calc.py
+++ b/calc.py
@@ -1,5 +1,2 @@
-def total(xs):
-    s=0
-    for x in xs:
-        s=s+x
-    return s
+def total(xs):
+    return sum(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


def mean(xs):
    return sum(xs)/len(xs)-1

Response:
--- a/stats.py
+++ b/stats.py
@@ -1,2 +1,2 @@
-def mean(xs):
-    return sum(xs)/len(xs)-1
+def mean(xs):
+    return sum(xs)/len(xs)


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)


Response:
--- a/test_math.py
+++ b/test_math.py
@@ -1,2 +1,2 @@
-def test_add():
-    assert add(2,2)==5
+def test_add():
+    assert add(2,2)==4


Fix: log_sanitize. Provide unified diff.

Response:
--- a/logger.py
+++ b/logger.py
@@ -1,2 +1,3 @@
-def log(msg):
-    print('INFO: '+msg)
+def log(msg):
+    safe=msg.replace('\n',' ').replace('\r',' ')
+    print('INFO: '+safe)