本文整理汇总了Python中shove.Shove类的典型用法代码示例。如果您正苦于以下问题:Python Shove类的具体用法?Python Shove怎么用?Python Shove使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shove类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: TestCassandraStore
class TestCassandraStore(Store, Spawn, unittest.TestCase):
cmd = ['cassandra', '-f']
@classmethod
def setUpClass(cls):
super(TestCassandraStore, cls).setUpClass()
import time
time.sleep(5.0)
def setUp(self):
from shove import Shove
from pycassa.system_manager import SystemManager # @UnresolvedImport @IgnorePep8
system_manager = SystemManager('localhost:9160')
try:
system_manager.create_column_family('Murk', 'shove')
except:
pass
self.store = Shove('cassandra://localhost:9160/Murk/shove')
def tearDown(self):
if self.store._store is not None:
self.store.clear()
self.store.close()
from pycassa.system_manager import SystemManager # @UnresolvedImport @IgnorePep8
system_manager = SystemManager('localhost:9160')
system_manager.drop_column_family('Murk', 'shove')
@classmethod
def tearDownClass(cls):
from fabric.api import local
local('killall java')
开发者ID:hansent,项目名称:shove,代码行数:32,代码来源:test_store.py
示例2: test_execute_invalid_command
def test_execute_invalid_command(self):
"""If the given command could not be found for the given project, return an error tuple."""
shove = Shove({"myproject": path("test_project")}, Mock())
order = Order(project="myproject", command="foo", log_key=5, log_queue="asdf")
procfile_path = path("test_project", "bin", "commands.procfile")
eq_(shove.execute(order), (1, "No command `foo` found in {0}".format(procfile_path)))
开发者ID:uberj,项目名称:shove,代码行数:7,代码来源:test_base.py
示例3: __init__
def __init__(self, port, link_db_uri, user_db_uri, use_auth=True):
self.port = port
self.link_db = Shove(link_db_uri)
self.user_db = Shove(user_db_uri)
self.use_auth = use_auth
if not self.use_auth and 'null' not in self.user_db:
self.user_db['null'] = {'token': '', 'username':'null', 'links': []}
开发者ID:mayowa,项目名称:helix.ly,代码行数:7,代码来源:helixly.py
示例4: test_execute_invalid_command
def test_execute_invalid_command(self):
"""If the given command could not be found for the given project, return an error tuple."""
shove = Shove({'myproject': path('test_project')})
order = Order(project='myproject', command='foo', log_key=5, log_queue='asdf')
procfile_path = path('test_project', 'bin', 'commands.procfile')
eq_(shove.execute(order), (1, 'No command `foo` found in {0}'.format(procfile_path)))
开发者ID:mozilla,项目名称:shove,代码行数:7,代码来源:test_base.py
示例5: test__cmp__
def test__cmp__(self):
tstore = Shove()
self.store['max'] = 3
tstore['max'] = 3
self.store.sync()
tstore.sync()
self.assertEqual(self.store, tstore)
开发者ID:ddofborg,项目名称:shove,代码行数:7,代码来源:test_file_store.py
示例6: getRSSFeed
def getRSSFeed(self, url, post_data=None):
# create provider storaqe cache
storage = Shove('sqlite:///' + ek.ek(os.path.join, sickbeard.CACHE_DIR, self.provider.name) + '.db')
fc = cache.Cache(storage)
parsed = list(urlparse.urlparse(url))
parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one
if post_data:
url = url + 'api?' + urllib.urlencode(post_data)
f = fc.fetch(url)
if not f:
logger.log(u"Error loading " + self.providerID + " URL: " + url, logger.ERROR)
return None
elif 'error' in f.feed:
logger.log(u"Newznab ERROR:[%s] CODE:[%s]" % (f.feed['error']['description'], f.feed['error']['code']),
logger.DEBUG)
return None
elif not f.entries:
logger.log(u"No items found on " + self.providerID + " using URL: " + url, logger.WARNING)
return None
storage.close()
return f
开发者ID:3ne,项目名称:SickRage,代码行数:27,代码来源:tvcache.py
示例7: test__cmp__
def test__cmp__(self):
from shove import Shove
tstore = Shove()
self.store['max'] = 3
tstore['max'] = 3
self.store.sync()
tstore.sync()
self.assertEqual(self.store, tstore)
开发者ID:h4ck3rm1k3,项目名称:pywikipediabot,代码行数:8,代码来源:test_svn_store.py
示例8: test_parse_order_valid
def test_parse_order_valid(self):
"""If the given order is valid, return an Order namedtuple with the correct values."""
shove = Shove({}, Mock())
order = shove.parse_order('{"project": "asdf", "command": "qwer", "log_key": 77, ' '"log_queue": "zxcv"}')
eq_(order.project, "asdf")
eq_(order.command, "qwer")
eq_(order.log_key, 77)
eq_(order.log_queue, "zxcv")
开发者ID:uberj,项目名称:shove,代码行数:8,代码来源:test_base.py
示例9: test_parse_procfile
def test_parse_procfile(self):
shove = Shove({})
commands = shove.parse_procfile(path('test_procfile.procfile'))
eq_(commands, {
'cmd': ['test'],
'valid_underscore': ['homer'],
'valid03': ['foo', 'bar' ,'--baz']
})
开发者ID:mozilla,项目名称:shove,代码行数:8,代码来源:test_base.py
示例10: test_process_order_invalid
def test_process_order_invalid(self):
"""If parse_order returns None, do not execute the order."""
shove = Shove({})
shove.parse_order = Mock(return_value=None)
shove.execute = Mock()
eq_(shove.process_order('{"project": "asdf"}'), None)
ok_(not shove.execute.called)
开发者ID:mozilla,项目名称:shove,代码行数:8,代码来源:test_base.py
示例11: _ShoveWrapper
class _ShoveWrapper(object):
def __init__(self, loc):
self._loc = loc
self._shove = Shove(self._loc)
def __enter__(self):
return self._shove
def __exit__(self, type, value, traceback):
self._shove.close()
开发者ID:rjw57,项目名称:foldbeam,代码行数:10,代码来源:model.py
示例12: TestFTPStore
class TestFTPStore(Store, unittest.TestCase):
initstring = 'ftp://127.0.0.1/'
def setUp(self):
from shove import Shove
self.store = Shove(self.initstring, compress=True)
def tearDown(self):
self.store.clear()
self.store.close()
开发者ID:hansent,项目名称:shove,代码行数:11,代码来源:test_store.py
示例13: primary_file_name
def primary_file_name(self):
"""The file name for the 'primary' file in the bucket. It is this file from which data is loaded. Other files
within the bucket should be auxiliary to this file. (E.g. they should contain projection information.)
"""
shove = Shove(self._shove_url)
try:
return shove['primary_file_name']
except KeyError:
return None
finally:
shove.close()
开发者ID:rjw57,项目名称:foldbeam,代码行数:11,代码来源:bucket.py
示例14: load_facts
def load_facts(config):
import requests
from bs4 import BeautifulSoup
db = Shove(config['dburi'])
db['facts'] = []
url1 = 'http://www.cats.alpha.pl/facts.htm'
raw = requests.get(url1).text
soup = BeautifulSoup(raw).findAll('ul')[1]
for string in soup.stripped_strings:
if string:
db['facts'].append(string)
db.sync()
开发者ID:decause,项目名称:catfacts,代码行数:12,代码来源:__init__.py
示例15: test_process_order_valid
def test_process_order_valid(self):
"""If parse_order returns a valid order, execute it and send logs back to Captain."""
shove = Shove({}, Mock())
order = Order(project="asdf", command="qwer", log_key=23, log_queue="zxcv")
shove.parse_order = Mock(return_value=order)
shove.execute = Mock(return_value=(0, "output"))
shove.process_order('{"project": "asdf"}')
shove.execute.assert_called_with(order)
shove.adapter.send_log.assert_called_with(
"zxcv", JSON({"version": "1.0", "log_key": 23, "return_code": 0, "output": "output"})
)
开发者ID:uberj,项目名称:shove,代码行数:12,代码来源:test_base.py
示例16: load_facts
def load_facts(config):
import requests
import re
db = Shove(config['dburi'])
db['facts'] = []
url1 = 'http://www.cats.alpha.pl/facts.htm'
raw = requests.get(url1).text
filtered = filter(
lambda l: l.startswith('<li>'),
map(lambda l: l.strip(), raw.split('\n')))
stripped = map(lambda l: re.sub('<[^<]+?>', '', l), filtered)
db['facts'].extend(stripped)
db.sync()
开发者ID:oddshocks,项目名称:catfacts,代码行数:13,代码来源:__init__.py
示例17: __init__
def __init__(self, modeldir=None, adminsfile=None, oauthconfig=None):
self.modeldir = modeldir
self.admins = yaml.load(file(adminsfile,'r'))
self.oauth_clients = Shove('sqlite:///oauth_clients.dat')
self.users = Shove('sqlite:///oauth_users.dat')
self.bearers = Shove('sqlite:///oauth_bearers.dat')
self.oauthconf = yaml.load(file(oauthconfig,'r'))
def stopper():
print 'saving persistant data'
self.oauth_clients.close()
self.users.close()
self.bearers.close()
cherrypy.engine.subscribe('stop', stopper)
开发者ID:dbarua,项目名称:personis,代码行数:14,代码来源:Personis_server.py
示例18: test_process_order_valid
def test_process_order_valid(self):
"""If parse_order returns a valid order, execute it and send logs back to Captain."""
shove = Shove({})
order = Order(project='asdf', command='qwer', log_key=23, log_queue='zxcv')
shove.parse_order = Mock(return_value=order)
shove.execute = Mock(return_value=(0, 'output'))
eq_(shove.process_order('{"project": "asdf"}'), ('zxcv', JSON({
'version': '1.0',
'log_key': 23,
'return_code': 0,
'output': 'output'
})))
shove.execute.assert_called_with(order)
开发者ID:mozilla,项目名称:shove,代码行数:14,代码来源:test_base.py
示例19: TestHDF5Store
class TestHDF5Store(Store, unittest.TestCase):
initstring = 'hdf5://test.hdf5/test'
def setUp(self):
from shove import Shove
self.store = Shove()
def tearDown(self):
import os
self.store.close()
try:
os.remove('test.hdf5')
except OSError:
pass
开发者ID:hansent,项目名称:shove,代码行数:15,代码来源:test_store.py
示例20: test_execute_valid_order
def test_execute_valid_order(self):
shove = Shove({'myproject': path('test_project')})
order = Order(project='myproject', command='pwd', log_key=5, log_queue='asdf')
with patch('shove.base.Popen') as Popen:
p = Popen.return_value
p.communicate.return_value = 'command output', None
p.returncode = 0
return_code, output = shove.execute(order)
Popen.assert_called_with(['pwd'], cwd=path('test_project'), stdout=PIPE, stderr=STDOUT)
p.communicate.assert_called_with()
eq_(return_code, 0)
eq_(output, 'command output')
开发者ID:mozilla,项目名称:shove,代码行数:15,代码来源:test_base.py
注:本文中的shove.Shove类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论