Skip to content

Instantly share code, notes, and snippets.

View smerritt's full-sized avatar

Sam Merritt smerritt

View GitHub Profile
@smerritt
smerritt / gist:7605771
Last active June 17, 2017 21:23
OpenStack Swift code review checklist
* Are there tests? Do the new tests fail if the code is reverted?
* Does it work? There's no such thing as obviously correct, as I've had to learn again and again.
* Check the coverage report; is any new code uncovered? (This might be okay, but take a look.)
* How's the logging?
* Read all the tests; any leftover debugging cruft? Print statements seem particularly common.
@smerritt
smerritt / results
Created September 19, 2013 20:06
bench more queue stuff, now with differences between sleeps and full queues
#!/usr/bin/env python
import benchmark
import Queue
import os
import subprocess
import tempfile
import time
import threading
#!/usr/bin/env python
import benchmark
import Queue
import threading
import os
class BenchQueueStuff(benchmark.Benchmark):
def setUp(self):
@smerritt
smerritt / flake8-check
Created September 17, 2013 21:46
Pre-commit hooks for python development
#!/usr/bin/env python
#
# flake8-checks the staged versions of any changed python files
import os.path
import subprocess
import tempfile
import shutil
import atexit
tempdir = tempfile.mkdtemp()
#!/usr/bin/env python
#
# Make some big rings for testing. Doesn't do command-line arg parsing or
# anything fancy; just go change the hard-coded constants. It's not like
# you're going to run this more than a few times before tossing it out.
import os
import subprocess
# clean up from previous runs, if any
@smerritt
smerritt / pre-commit.py
Created August 30, 2013 20:01
pre-commit hook I use to prevent trailing commas in JSON test files
#!/usr/bin/env python
import sys
import os.path
import subprocess
import tempfile
import re
import json
import shutil
import atexit
@smerritt
smerritt / jsonbench.py
Created July 25, 2013 21:13
benchmarking various python json libraries
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Benchmark the relative performance of stdlib's json, simplejson, ujson, and
# a wrapped simplejson that gives the same API as stdlib's json.
import benchmark
import hashlib
import json as stdjson
import simplejson
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Benchmark the relative performance of stdlib's json, simplejson, and a
# wrapped simplejson that gives the same API as stdlib's json.
import benchmark
import hashlib
import json as stdjson
import simplejson
@smerritt
smerritt / jsons.py
Created July 23, 2013 23:16
shows differences in JSON decoding between simplejson and stdlib json
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import simplejson
data = {'hello': 'world', u'ok': u'✓',
'nested': {'array': [1, 2, 3, {'potato': 'potato',
'tomato': 'tomato'}],
"that's": 'Numberwäng!'}}
diff --git a/swift/obj/auditor.py b/swift/obj/auditor.py
index c672928..4ffb98e 100644
--- a/swift/obj/auditor.py
+++ b/swift/obj/auditor.py
@@ -158,7 +158,8 @@ class AuditorWorker(object):
:param partition: the partition the path is on
"""
try:
- assert isinstance(path, basestring)
+ if not path: