Skip to content

Instantly share code, notes, and snippets.

View pfctdayelise's full-sized avatar

Brianna Laugher pfctdayelise

View GitHub Profile
@pfctdayelise
pfctdayelise / checkBadware.py
Created February 7, 2012 13:57
something to help me detect badware. hopefully useful to run as cron.
#!/usr/bin/env python
import os
import argparse
import urllib
from BeautifulSoup import BeautifulSoup # 3.2.0
def getPagesForOnePath(path):
f = urllib.urlopen(path)
soup = BeautifulSoup(f)
import pytest
def params(n):
fn = range(n)
return {'name': 'a', 'args': fn, 'ids': ['a: {}'.format(i) for i in fn]}
named_args = params(3)
@pytest.mark.parametrize(
named_args['name'], named_args['args'], ids=named_args['ids'])
@pfctdayelise
pfctdayelise / issue4806.py
Created February 19, 2014 04:09
Demonstration and workaround of Python bug 4806
# written in python2.7
def bad(n):
if n == 1:
raise ValueError('n is 1!')
if n == 2:
raise TypeError('n is 2!')
return n, 2*n