本文整理汇总了Python中Settings.Settings.write方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.write方法的具体用法?Python Settings.write怎么用?Python Settings.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SettingsTest
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import write [as 别名]
class SettingsTest(unittest.TestCase) :
SETTINGS_PATH = os.path.expanduser('settingstest.xml')
@classmethod
def setUpClass(self) :
Settings.loadSettings(self.SETTINGS_PATH)
self.settings = Settings("test")
def test_string(self) :
defaulttest = self.settings.get('defaulttest', 'defaulttest')
self.settings.set('gettest', 'gettest')
gettest2 = self.settings.get('gettest', 'defaulttest')
self.assertEquals(defaulttest, 'defaulttest')
self.assertEquals(gettest2, 'gettest')
def test_int(self) :
gettest1 = self.settings.get('gettest', 4)
self.settings.set('gettest', 1)
gettest2 = self.settings.get('gettest', 4)
self.assertEquals(gettest1, 4)
self.assertEquals(gettest2, 1)
def test_bool(self) :
gettest1 = self.settings.get('gettest', False)
self.settings.set('gettest2', True)
self.settings.set('gettest3', False)
gettest2 = self.settings.get('gettest2', False)
gettest3 = self.settings.get('gettest3', False)
self.assertEquals(gettest1, False)
self.assertEquals(gettest2, True)
self.assertEquals(gettest3, False)
def test_write(self) :
self.settings.write()
self.assertTrue(os.path.exists(self.SETTINGS_PATH))
@classmethod
def tearDownClass(self) :
os.remove(self.SETTINGS_PATH)
示例2:
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import write [as 别名]
feed = feedGroup.getFeed(options.delete)
if not feed:
parser.error("not found: '%s'" % options.delete)
feedGroup.removeFeed(feed)
settings.clear() # otherwise the deleted feed persists in settings
if options.list:
kwargs = {}
if args:
kwargs['feedNames'] = args
for feed in feedGroup.getFeeds(**kwargs):
log.info(feed)
if doUpdate:
kwargs = {}
if args:
kwargs['feedNames'] = args
feedGroup.update(**kwargs)
elapsed = 0
interval = 1
while feedGroup.hasFeedsUpdating():
if elapsed > 10 and elapsed % 5 == 0:
log.info('waiting for: %s'
% ', '.join(feedGroup.getUpdatingFeedNames()))
time.sleep(interval)
elapsed += interval
feedGroup.writeSettings(settings)
settings.write()
示例3: cleanup
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import write [as 别名]
def cleanup(self) :
self.downloadProgressMonitor.cleanup()
self.videoManager.cleanup()
self.youtubeservice.cleanup()
Settings.write()