All Samples(825) | Call(815) | Derive(0) | Import(10)
Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a class that the warning must be a subclass of
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
def simplefilter(action, category=Warning, lineno=0, append=0):
"""Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a class that the warning must be a subclass of
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
"""
assert action in ("error", "ignore", "always", "default", "module",
"once"), "invalid action: %r" % (action,)
assert isinstance(lineno, int) and lineno >= 0, \
"lineno must be an int >= 0"
item = (action, None, category, None, lineno)
if append:
filters.append(item)
else:
filters.insert(0, item)
#!/usr/bin/env python # Standard libs import re from warnings import warn, simplefilter
def main(fnames, verbose=False, plot=True):
'''main(fnames): simply reads each file in fnames'''
if verbose:
simplefilter('always', UserWarning)
else:
simplefilter('ignore', UserWarning)
src/p/y/py-mlb-HEAD/py_mlb/db.py py-mlb(Download)
#!/usr/bin/env python
from warnings import simplefilter
import MySQLdb
import ConfigParser, os
from py_mlb import logger
class DB:
"""Super dumb wrapper around a MySQLdb connection object"""
def __init__(self):
config = ConfigParser.ConfigParser()
config.read(['.db.cfg', os.path.expanduser('~/.db.cfg')])
simplefilter("error", MySQLdb.Warning)
src/s/u/Sunflower-1.1.0/sunflower/hdf5.py Sunflower(Download)
from contextlib import closing
from hashlib import md5
import sys
from warnings import simplefilter
import tables
from ._utils import progress
SEP = "/" # XXX: this should be in PyTables
PREFIX = "_"
NYBBLES = 2
simplefilter("ignore", tables.NaturalNameWarning)
src/t/r/TritonScraper-HEAD/src/triton_scraper/datatypes.py TritonScraper(Download)
""" from __future__ import division from warnings import simplefilter as _simplefilter, catch_warnings as _catch_warnings from triton_scraper import config as _config from triton_scraper.locations import UnknownLocation as _UnknownLocation
def __init__(self, iterable):
"""Creates a new DaysOfWeekSet from an iterable containing strings from :attr:`DAYS_IN_ORDER`.
The ordering of the strings doesn't matter."""
with _catch_warnings(): # Suppress irrelevant DeprecationWarning
_simplefilter("ignore")
frozenset.__init__(self, iterable)
if self - self._DAYS_OF_WEEK_SET:
src/p/y/py-gameday-HEAD/lib/__init__.py py-gameday(Download)
from logging import getLogger, Handler from urllib import urlopen from warnings import simplefilter from time import sleep class NullHandler(Handler): def emit(self, record):
src/e/a/easyshop.core-0.1a1/easyshop/core/tests/base.py easyshop.core(Download)
# Suppress DeprecationWarnings, we really don't want any in these tests
from warnings import simplefilter
simplefilter('ignore', DeprecationWarning)
from transaction import commit
from AccessControl.SecurityManagement import newSecurityManager
src/e/a/easyshop.carts-0.1a1/easyshop/carts/tests/base.py easyshop.carts(Download)
# Suppress DeprecationWarnings, we really don't want any in these tests
from warnings import simplefilter
simplefilter('ignore', DeprecationWarning)
from AccessControl.SecurityManagement import newSecurityManager
from transaction import commit
from Products.Five import zcml
src/s/k/skype4py-HEAD/unittests/smstest.py skype4py(Download)
def testSeen(self):
# Writable, Type: bool
from warnings import simplefilter
self.api.enqueue('SET SMS 1234 SEEN',
'SMS 1234 STATUS READ')
simplefilter('ignore')
try:
self.obj.Seen = True
finally:
simplefilter('default')
src/s/k/skype4py-HEAD/unittests/settingstest.py skype4py(Download)
def testAvatar(self):
from warnings import simplefilter
self.api.enqueue('SET AVATAR 1 c:\\spam.jpg',
'AVATAR 1 c:\\spam.jpg')
simplefilter('ignore')
try:
self.obj.Avatar(1, 'c:\\spam.jpg')
finally:
simplefilter('default')
src/s/k/skype4py-HEAD/unittests/chattest.py skype4py(Download)
def testSeen(self):
# Writable, Type: bool
from warnings import simplefilter
self.api.enqueue('SET CHATMESSAGE 1234 SEEN',
'CHATMESSAGE 1234 STATUS READ')
try:
simplefilter('ignore')
self.obj.Seen = True
finally:
simplefilter('default')