本文整理汇总了Python中java.util.ArrayList方法的典型用法代码示例。如果您正苦于以下问题:Python util.ArrayList方法的具体用法?Python util.ArrayList怎么用?Python util.ArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util
的用法示例。
在下文中一共展示了util.ArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getUserByExternalUid
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def getUserByExternalUid(self, uid, provider, userService):
newFormat = "passport-%s:%s:%s" % ("saml", provider, uid)
user = userService.getUserByAttribute("oxExternalUid", newFormat)
if user == None:
oldFormat = "passport-%s:%s" % ("saml", uid)
user = userService.getUserByAttribute("oxExternalUid", oldFormat)
if user != None:
# Migrate to newer format
list = HashSet(user.getAttributeValues("oxExternalUid"))
list.remove(oldFormat)
list.add(newFormat)
user.setAttribute("oxExternalUid", ArrayList(list))
print "Migrating user's oxExternalUid to newer format 'passport-saml:provider:uid'"
userService.updateUser(user)
return user
示例2: getExtraParametersForStep
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def getExtraParametersForStep(self, configurationAttributes, step):
print "Casa. getExtraParametersForStep %s" % str(step)
list = ArrayList()
if step > 1:
acr = CdiUtil.bean(Identity).getWorkingParameter("ACR")
if acr in self.authenticators:
module = self.authenticators[acr]
params = module.getExtraParametersForStep(module.configAttrs, step)
if params != None:
list.addAll(params)
list.addAll(Arrays.asList("ACR", "methods", "trustedDevicesInfo"))
list.addAll(Arrays.asList("casa_contextPath", "casa_prefix", "casa_faviconUrl", "casa_extraCss", "casa_logoUrl"))
print "extras are %s" % list
return list
示例3: __init__
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def __init__(self):
"""
The constructor of BurpDatabaseModels object defines a number of
class variables tracking the number of deleted records, and maintaining
the references to the arrays of records.
Args:
None
Returns:
None
"""
self.STATIC_MESSAGE_TABLE_COLUMN_COUNT = 6
self.lock = Lock()
self.arrayOfMessages = ArrayList()
self.arrayOfCampaigns = ArrayList()
self.arrayOfSettings = ArrayList()
self.deletedCampaignCount = 0
self.deletedRoleCount = 0
self.deletedMessageCount = 0
self.deletedSettingCount = 0
self.selfExtender = None
示例4: createMenuItems
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def createMenuItems(self, invocation):
'''
Invoked by Burp when a right-click menu is created; adds Git Bridge's
options to the menu.
'''
context = invocation.getInvocationContext()
tool = invocation.getToolFlag()
if tool == self.callbacks.TOOL_REPEATER:
if context in [invocation.CONTEXT_MESSAGE_EDITOR_REQUEST, invocation.CONTEXT_MESSAGE_VIEWER_RESPONSE]:
item = JMenuItem("Send to Git Bridge")
item.addActionListener(self.RepeaterHandler(self.callbacks, invocation, self.log))
items = ArrayList()
items.add(item)
return items
elif tool == self.callbacks.TOOL_SCANNER:
if context in [invocation.CONTEXT_SCANNER_RESULTS]:
item = JMenuItem("Send to Git Bridge")
item.addActionListener(self.ScannerHandler(self.callbacks, invocation, self.log))
items = ArrayList()
items.add(item)
return items
else:
# TODO: add support for other tools
pass
示例5: doPassiveScan
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def doPassiveScan(self, ihrr):
try:
urlReq = ihrr.getUrl()
testString = str(urlReq)
linkA = linkAnalyse(ihrr,self.helpers)
# check if JS file
if ".js" in str(urlReq):
# Exclude casual JS files
if any(x in testString for x in JSExclusionList):
print("\n" + "[-] URL excluded " + str(urlReq))
else:
self.outputTxtArea.append("\n" + "[+] Valid URL found: " + str(urlReq))
issueText = linkA.analyseURL()
for counter, issueText in enumerate(issueText):
#print("TEST Value returned SUCCESS")
self.outputTxtArea.append("\n" + "\t" + str(counter)+' - ' +issueText['link'])
issues = ArrayList()
issues.add(SRI(ihrr, self.helpers))
return issues
except UnicodeEncodeError:
print ("Error in URL decode.")
return None
示例6: test_setget_override
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def test_setget_override(self):
if not test_support.is_jython:
return
# http://bugs.jython.org/issue600790
class GoofyListMapThing(ArrayList):
def __init__(self):
self.silly = "Nothing"
def __setitem__(self, key, element):
self.silly = "spam"
def __getitem__(self, key):
self.silly = "eggs"
glmt = GoofyListMapThing()
glmt['my-key'] = String('el1')
self.assertEquals(glmt.silly, "spam")
glmt['my-key']
self.assertEquals(glmt.silly, "eggs")
示例7: _list_op_test
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def _list_op_test(self, initial_value, op_func, test_name):
"""
Tests a list operation
Ensures that performing an operation on:
- a python list
- a java.util.List instance
gives the same result in both cases
"""
lists = [list(initial_value), ArrayList(initial_value), Vector(initial_value)]
list_type_names = ['list', 'ArrayList', 'Vector']
results = [self._perform_op(l, op_func) for l in lists]
self.check_list(lists[0], lists[1:], list_type_names[1:], initial_value, test_name)
if not isinstance(results[0], list):
for r,n in zip(results[1:], list_type_names[1:]):
self.assertEquals(results[0], r, '%s: result for list does not match result for java type %s' % (test_name,n) )
else:
self.check_list(results[0], results[1:], list_type_names[1:], initial_value, test_name)
示例8: test_set_slice
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def test_set_slice(self):
initial_value = range(0, 5)
def make_op_func(i, j, k, v):
def _f(xs):
xs[i:j:k] = v
return _f
for i in [None] + range(-7, 7):
for j in [None] + range(-7, 7):
for k in [None] + range(-7, 7):
self._list_op_test(initial_value, make_op_func(i, j, k, []), 'set_slice [%s:%s:%s]=[]' % (i,j,k))
self._list_op_test(initial_value, make_op_func(i, j, k, range(0,2)), 'set_slice [%s:%s:%s]=range(0,2)' % (i,j,k))
self._list_op_test(initial_value, make_op_func(i, j, k, range(0,4)), 'set_slice [%s:%s:%s]=range(0,4)' % (i,j,k))
self._list_op_test(initial_value, make_op_func(i, j, k, xrange(0,2)), 'set_slice [%s:%s:%s]=xrange(0,2)' % (i,j,k))
self._list_op_test(initial_value, make_op_func(i, j, k, self._arraylist_of(range(0,2))), 'set_slice [%s:%s:%s]=ArrayList(range(0,2))' % (i,j,k))
self._list_op_test([1,2,3,4,5], make_op_func(1, None, None, [1,2,3,4,5]), 'set_slice [1:]=[1,2,3,4,5]')
示例9: test_list_delegation
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def test_list_delegation(self):
for c in ArrayList, Vector:
a = c()
self.assertRaises(IndexError, a.__getitem__, 0)
a.add("blah")
self.assertTrue("blah" in a)
self.assertEquals(1, len(a))
n = 0
for i in a:
n += 1
self.assertEquals("blah", i)
self.assertEquals(1, n)
self.assertEquals("blah", a[0])
a[0] = "bleh"
del a[0]
self.assertEquals(0, len(a))
示例10: initialize_variables
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def initialize_variables(self):
self.is_burp_pro = True if "Professional" in self.callbacks.getBurpVersion()[0] else False
self.regexp_version_number = re.compile("ver=([0-9.]+)", re.IGNORECASE)
self.regexp_stable_tag = re.compile(r"(?:stable tag|version):\s*(?!trunk)([0-9a-z.-]+)", re.IGNORECASE)
self.regexp_version_from_changelog = re.compile(
r"[=]+\s+(?:v(?:ersion)?\s*)?([0-9.-]+)[ \ta-z0-9().\-,]*[=]+",
re.IGNORECASE)
self.list_issues = ArrayList()
self.lock_issues = Lock()
self.lock_update_database = Lock()
self.lock_update_burp_wp = Lock()
self.api_errors = 0
self.database = {'plugins': collections.OrderedDict(), 'themes': collections.OrderedDict(), 'admin_ajax': {}}
self.list_plugins_on_website = defaultdict(list)
示例11: test_remove
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def test_remove(self):
# Verifies that overloaded java.util.List#remove(int) method can still be used, but with Python index semantics
# http://bugs.jython.org/issue2456
jl = ArrayList(xrange(10, -1, -1)) # 10 .. 0, inclusive
jl.remove(0) # removes jl[-1] (=0)
self.assertEqual(jl, range(10, 0, -1)) # 10 .. 1
self.assertRaises(ValueError, jl.remove, Integer(0)) # j.l.Integer does not support __index__ - maybe it should!
jl.remove(0) # removes jl[0] (=10)
self.assertEqual(jl, range(9, 0, -1)) # 9 .. 1
jl.remove(-1) # removes jl[-1] (=1) - support same index calculations as Python (= del jl[-1])
self.assertEqual(jl, range(9, 1, -1)) # 9 .. 2
jl.remove(3)
jl.remove(5)
self.assertEqual(jl, [9, 8, 7, 6, 4, 2])
a_to_z = list(chr(i) for i in xrange(ord('a'), ord('z') + 1))
b_to_z_by_2 = list(chr(i) for i in xrange(ord('b'), ord('z') + 1, 2))
jl = ArrayList(a_to_z)
for i in xrange(13):
jl.remove(i)
self.assertEqual(jl, b_to_z_by_2)
示例12: test_equals
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def test_equals(self):
# Test for bug #1338
a = range(5)
x = ArrayList()
x.addAll(a)
y = Vector()
y.addAll(a)
z = ArrayList()
z.addAll(range(1, 6))
self.assertTrue(x.equals(y))
self.assertEquals(x, y)
self.assertTrue(not (x != y))
self.assertTrue(not x.equals(z))
self.assertNotEquals(x, z)
self.assertTrue(not (x == z))
示例13: createMenuItems
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def createMenuItems(self, context_menu):
self.context = context_menu
menu_list = ArrayList()
menu_list.add(JMenuItem("Send to js scraper", actionPerformed=self.pre_scan))
return menu_list
示例14: createMenuItems
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def createMenuItems(self, contextMenuInvocation):
self._contextMenuData = contextMenuInvocation.getSelectedMessages()
menu_list = ArrayList()
menu_list.add(JMenuItem("Send to BurpSmartBuster",actionPerformed=self.menuItemClicked))
return menu_list
示例15: createMenuItems
# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import ArrayList [as 别名]
def createMenuItems(self, invocation):
#get only selected message
self.messageInfo = invocation.getSelectedMessages()[0]
menuItemList = ArrayList()
menuItemList.add(JMenuItem("Send request to ZIP File Raider extender Repeater", actionPerformed = self.contextRepeaterClick))
menuItemList.add(JMenuItem("Send request to ZIP File Raider extender Scanner", actionPerformed = self.contextScannerClick))
return menuItemList