当前位置: 首页>>代码示例>>Python>>正文


Python HashSet.remove方法代码示例

本文整理汇总了Python中java.util.HashSet.remove方法的典型用法代码示例。如果您正苦于以下问题:Python HashSet.remove方法的具体用法?Python HashSet.remove怎么用?Python HashSet.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.HashSet的用法示例。


在下文中一共展示了HashSet.remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CyclicTypeRecorder

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [as 别名]
    class CyclicTypeRecorder(object):

        def __init__(self):
            self.count = 0
            self.elements = HashMap()
            self.used = HashSet()

        def push(self, t):
            self.count += 1
            self.elements[t] = self.count
            return self.count

        def pop(self, t):
            del self.elements[t]
            if t in self.used:
                self.used.remove(t)

        def visit(self, t):
            i = self.elements.get(t)
            if i is not None:
                self.used.add(t)
            return i

        def isUsed(self, t):
            return t in self.used
开发者ID:ariejdl,项目名称:pysonarsq,代码行数:27,代码来源:Type.py

示例2: getUserByExternalUid

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [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
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:20,代码来源:SamlPassportAuthenticator.py

示例3: getAvailMethodsUser

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [as 别名]
    def getAvailMethodsUser(self, user, skip=None):
        methods = HashSet()

        for method in self.authenticators:
            try:
                module = self.authenticators[method]
                if module.hasEnrollments(module.configAttrs, user):
                    methods.add(method)
            except:
                print "Casa. getAvailMethodsUser. hasEnrollments call could not be issued for %s module" % method

        try:
            if skip != None:
                # skip is guaranteed to be a member of methods (if hasEnrollments routines are properly implemented).
                # A call to remove strangely crashes when skip is absent
                methods.remove(skip)
        except:
            print "Casa. getAvailMethodsUser. methods list does not contain %s" % skip

        print "Casa. getAvailMethodsUser %s" % methods.toString()
        return methods
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:23,代码来源:Casa.py

示例4: search

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [as 别名]
def search(metaclasses, regexp, options):
  print "Searching ..."
  rawResults = HashSet()
  session = Modelio.getInstance().getModelingSession()
  
  #--- (1) Add all instances of selected metaclasses 
  for metaclass in metaclasses:
    print "  searching for instance of metaclass ",metaclass.getSimpleName()," ... ",
    metaclassInstances = session.findByClass(metaclass)
    print unicode(len(metaclassInstances)),"elements found"
    rawResults.addAll(metaclassInstances)
  # remove predefined types
  predefTypes = Modelio.getInstance().getModelingSession().getModel().getUmlTypes().getBOOLEAN().getOwner()
  rawResults.remove(predefTypes)
  rawResults.remove(predefTypes.getOwner())
  print "  ==>",unicode(len(rawResults)),"elements found (primitive types excluded)"
  
  #--- (2) Check for name matching
  filteredResults = []
  try:
    if options[0] == 1:
      p = Pattern.compile(regexp)
      for result in rawResults:
        name = result.getName()
        if (p.matcher(name).matches()):
          filteredResults.append(result)
    else:
      for result in rawResults:
        if result.getName().find(regexp) != -1:
          filteredResults.append(result)
  except PatternSyntaxException:
    messageBox("The entered regular expression: '"+regexp+"' has a syntax error.")
  except IllegalArgumentException:
    messageBox("Illegal Argument Exception.")
  print "  "+unicode(len(filteredResults))+" elements selected after name filtering"
  
  #--- (3) sort results by name
  filteredResults.sort(key=lambda x:x.getName())
  return filteredResults
开发者ID:escribis,项目名称:macros,代码行数:41,代码来源:AdvancedSearch.py

示例5: getProducibleVars

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [as 别名]
 def getProducibleVars(self, sentence):
     """ generated source for method getProducibleVars """
     if not self.form.matches(sentence):
         raise RuntimeException("Sentence " + sentence + " does not match constant form")
     tuple_ = GdlUtils.getTupleFromSentence(sentence)
     candidateVars = HashSet()
     # Variables that appear multiple times go into multipleVars
     multipleVars = HashSet()
     # ...which, of course, means we have to spot non-candidate vars
     nonCandidateVars = HashSet()
     i = 0
     while i < len(tuple_):
         if isinstance(term, (GdlVariable,)) and not multipleVars.contains(term):
             if candidateVars.contains(var) or nonCandidateVars.contains(var):
                 multipleVars.add(var)
                 candidateVars.remove(var)
             elif self.dependentSlots.get(i):
                 candidateVars.add(var)
             else:
                 nonCandidateVars.add(var)
         i += 1
     return candidateVars
开发者ID:hobson,项目名称:ggpy,代码行数:24,代码来源:FunctionInfoImpl.py

示例6: infoAboutEngine

# 需要导入模块: from java.util import HashSet [as 别名]
# 或者: from java.util.HashSet import remove [as 别名]
    e.setAttribute("language", f.languageName)
    e.setAttribute("languageVersion", f.languageVersion)
    e.setAttribute("threading", f.getParameter("THREADING"))
    e.setAttribute("factory", f.getClass().canonicalName)

    if Compilable.isAssignableFrom(f.scriptEngine.getClass()):
        e.setAttribute("compilable", "yes")
    else:
        e.setAttribute("compilable", "no")
    if Invocable.isAssignableFrom(f.scriptEngine.getClass()):
        e.setAttribute("invocable", "yes")
    else:
        e.setAttribute("invocable", "no")

    for n in f.names:
        response.createElement(e, "name", n)
    for m in f.mimeTypes:
        response.createElement(e, "mimeType", m)
    for ext in f.extensions:
        response.createElement(e, "ext", ext)


for f in m.engineFactories:
    engines.remove(f.getClass())
    infoAboutEngine(f)

for f in engines:
    infoAboutEngine(f())

response.append(root)
开发者ID:scravy,项目名称:Obsolete,代码行数:32,代码来源:engines.py


注:本文中的java.util.HashSet.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。