本文整理汇总了Python中entry.Entry类的典型用法代码示例。如果您正苦于以下问题:Python Entry类的具体用法?Python Entry怎么用?Python Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node)
self.return_invalid_entry = fdt_util.GetBool(self._node,
'return-invalid-entry')
self.return_unknown_contents = fdt_util.GetBool(self._node,
'return-unknown-contents')
self.bad_update_contents = fdt_util.GetBool(self._node,
'bad-update-contents')
self.return_contents_once = fdt_util.GetBool(self._node,
'return-contents-once')
# Set to True when the entry is ready to process the FDT.
self.process_fdt_ready = False
self.never_complete_process_fdt = fdt_util.GetBool(self._node,
'never-complete-process-fdt')
self.require_args = fdt_util.GetBool(self._node, 'require-args')
# This should be picked up by GetEntryArgsOrProps()
self.test_existing_prop = 'existing'
self.force_bad_datatype = fdt_util.GetBool(self._node,
'force-bad-datatype')
(self.test_str_fdt, self.test_str_arg, self.test_int_fdt,
self.test_int_arg, existing) = self.GetEntryArgsOrProps([
EntryArg('test-str-fdt', str),
EntryArg('test-str-arg', str),
EntryArg('test-int-fdt', int),
EntryArg('test-int-arg', int),
EntryArg('test-existing-prop', str)], self.require_args)
if self.force_bad_datatype:
self.GetEntryArgsOrProps([EntryArg('test-bad-datatype-arg', bool)])
self.return_contents = True
示例2: test_simple_as_tsv
def test_simple_as_tsv():
entry = Entry()
entry.a = "A value"
assert entry.tsv == (
'a\n'
'A value\n'
)
示例3: test_set_of_tags_from_primitive
def test_set_of_tags_from_primitive():
entry = Entry()
entry.primitive = {
'fields': ['a', 'b', 'c'],
'name': 'foo'}
assert entry.name == 'foo'
assert entry.fields == ['a', 'b', 'c']
示例4: __init__
class WindowHelper:
def __init__(self, plugin, window):
self._window = window
self._plugin = plugin
self._entry = None
self._accel = gtk.AccelGroup()
self._accel.connect_group(gtk.keysyms.C, gtk.gdk.SUPER_MASK, 0, self._do_command)
self._window.add_accel_group(self._accel)
def deactivate(self):
self._window.remove_accel_group(self._accel)
self._window = None
self._plugin = None
def update_ui(self):
pass
def _do_command(self, group, obj, keyval, mod):
view = self._window.get_active_view()
if not view:
return False
if not self._entry:
self._entry = Entry(self._window.get_active_view())
self._entry.connect('destroy', self.on_entry_destroy)
self._entry.grab_focus()
return True
def on_entry_destroy(self, widget):
self._entry = None
示例5: read_existing_entry
def read_existing_entry(parameters): # some option to read last or read random
entry_id, writeable_param = peel(parameters)
writeable = False if not re.match('^w$', writeable_param) else True
e = Entry(entry_id, writeable = writeable)
e.edit_entry()
return None
示例6: test_get_entry_json_by_hash
def test_get_entry_json_by_hash():
entry = Entry()
entry.primitive = {"id": 123, "someField": "thevalue"}
response = app.get('/hash/%s.json' % entry.hash, base_url=field_url)
assert response.status_code == 200
data = json.loads(response.data.decode('utf-8'))
assert data == {"hash": entry.hash, "entry": entry.primitive}
示例7: test_empty_entry_from_json_with_whitespace
def test_empty_entry_from_json_with_whitespace():
entry = Entry()
entry.json = ('{}')
assert entry.json == ('{}')
entry.json = (' { }')
assert entry.json == ('{}')
示例8: __init__
def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node)
self.text_label, = self.GetEntryArgsOrProps(
[EntryArg('text-label', str)])
self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
if not self.value:
self.Raise("No value provided for text label '%s'" %
self.text_label)
示例9: parse
def parse(self, csvLines, csvHeader):
self.entries = [Entry(csvLines.pop(0), csvHeader)]
while (len(csvLines) > 0):
nextEntry = Entry(csvLines[0], csvHeader)
if nextEntry.getType() == "Root":
break
self.entries.append(nextEntry)
csvLines.pop(0)
self.postValidate()
示例10: testBindToFunction
def testBindToFunction(self):
def thatWhichMustBeCalled(newValue):
thatWhichMustBeCalled.called = True
thatWhichMustBeCalled.called = False
e = Entry()
e.bindOnChange(thatWhichMustBeCalled)
e.set('Hello World!')
self.assertTrue(thatWhichMustBeCalled.called)
示例11: test_get_entry_yaml_by_hash
def test_get_entry_yaml_by_hash():
entry = Entry()
entry.primitive = {'field': 'value'}
register.put(entry)
response = app.get('/hash/%s.yaml' % entry.hash, base_url=field_url)
assert response.status_code == 200
data = response.data.decode('utf-8')
assert data == "field: value\n"
示例12: test_set_of_tags_from_txt
def test_set_of_tags_from_txt():
entry = Entry()
entry.txt = ('fields:\n'
' - b\n'
' - c\n'
' - z\n'
'name: foo\n')
assert entry.name == "foo"
assert entry.fields == ['b', 'c', 'z']
示例13: testDelegate
def testDelegate(self):
class Delegate(object):
def onChange(self, newValue):
self.called = True
e = Entry()
e.delegate = Delegate()
e.delegate.called = False
e.set('Hello World!')
self.assertTrue(e.delegate.called)
示例14: testBindToMethod
def testBindToMethod(self):
class MethodHolder(object):
def methodThatMustBeCalled(self, newValue):
self.called = True
e = Entry()
methodHolder = MethodHolder()
methodHolder.called = False
e.bindOnChange(methodHolder.methodThatMustBeCalled)
e.set('Hello World!')
self.assertTrue(methodHolder.called)
示例15: test_update_entry_correct_priority
def test_update_entry_correct_priority(self):
ent = Entry('a','apple',5)
time.sleep(0.001)
ent2 = Entry('b','cat',3)
self.lruc4._add_entry(ent)
self.lruc4._add_entry(ent2)
time.sleep(0.001)
ent.touch()
self.lruc4._update_entry(ent)
smallest = heapq.heappop(self.lruc4._ordering)
assert smallest == ent2