當前位置: 首頁>>代碼示例>>Python>>正文


Python Files.getDirsInDir方法代碼示例

本文整理匯總了Python中Files.getDirsInDir方法的典型用法代碼示例。如果您正苦於以下問題:Python Files.getDirsInDir方法的具體用法?Python Files.getDirsInDir怎麽用?Python Files.getDirsInDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Files的用法示例。


在下文中一共展示了Files.getDirsInDir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getDirsInDir [as 別名]
def main():

  """Initialize All Modules"""
  tokenList = Files.getTokenList() #[0] should be mine, and [1] should be my alt for group creation
  log.debug("Tokens:",tokenList)
  #Just my user id and token
  put = ("27094908", tokenList[0])
  
  #Totally Not The NSA Token
  Groups.Group.overlord = tokenList[1]
  
  #Just things
  log.network.debug.disable() #Suppress the return value of every message
  #log.command.low.enable() #For going through all the commands every time we get a command
  #log.user.low.enable() #For going through all the users every time we search for a user
  if Events.IS_TESTING:
    log.save.low.enable()
  
  #First load all the groups
  log.info("========== PRE-INIT (LOAD) ==========")
  toLoadList = []
  for folder in Files.getDirsInDir():
    if "Group " in folder: #If it a folder containing a group to load
      number = int(folder.split(" ")[-1])
      obj = (number, folder,) #Tuple of number and folder name
      flag = True
      for i in range(len(toLoadList)): #Sort the list
        if number < toLoadList[i][0]:
          toLoadList.insert(i, obj)
          flag = False
          break
      if flag: #If did not insert anywhere else
        toLoadList.append(obj)
        
  #Loadsd the groups guarenteed in order
  for group in toLoadList:
    Groups.loadGroup(group[1])
    
  log.info("Groups: ", Groups.getSortedList())
    
  #Do init and post-init
  log.info("========== INIT ==========")
  for group in list(Groups.getSortedList()): group.init()
  
  ### Named groups should be made after INIT to avoid duplicated initial users
  testGroup = makeNamedGroup(1, "23199161", put)
  
  toriGroup = makeNamedGroup(15, "23317842", put, "DLARulez")
  
  groupFam  = makeNamedGroup(2, "13972393", put, "easier")
  
  groupOldRocket  = makeNamedGroup(10, "26730422", put, "password")
    
  rocketMainGroup = makeCollective(20, "33057510", put)
  
  electronicsGroup = makeCollector(21, "33057523", put, rocketMainGroup)
  
  designAndMGroup = makeCollector(22, "33058451", put, rocketMainGroup)
  
  propulsionGroup = makeCollector(23, "33058488", put, rocketMainGroup)
  
  civGroup = makeCollective(30, "36614847", put, classType = Groups.Group) #Just a collective because I'm lazy in properly naming things. Is a normal group
  
  

  try: #This is so we can have our finally block remove any extra threads in case of error
    
    log.info("========== POST-INIT ==========")
    for group in list(Groups.getSortedList()): 
      try: group.postInit()
      except AssertionError: pass
    
        
    log.info("========== GROUP CLEANUP ==========")
    deletionList = Groups.getSortedList()
    deletionList.reverse()
    for i in deletionList.copy():
      if i.markedForDeletion:
        log.info("Deleting group", i)
        i.deleteSelf()
        del i
    del deletionList
    
  #try:
    def postEarlyMorningFact():
      joke = Jokes.funFacts.getJoke()
      if type(joke) == tuple:
        return Jokes.funFacts._postJoke(groupFam, ("Oh boy 3 A.M.!\n"+joke[0], joke[1]))
      return Jokes.funFacts._postJoke(groupFam, "Oh boy 3 A.M.!\n" + joke)
      
    def updateAllMsgLists():
      for searcher in MsgSearch._searcherList: #We could also probably get from all active groups instead of the searcher list
        searcher.GenerateCache()
        
    def postCivReminder():
      civGroup.handler.write("Don't forget to do your civ turn!")
    
    server = Server(('', Network.SERVER_CONNECTION_PORT), ServerHandler)
    
    #Update things for the groups every day at 5 a.m.
#.........這裏部分代碼省略.........
開發者ID:civilwargeeky,項目名稱:GroupMeServer3,代碼行數:103,代碼來源:mainServer.py


注:本文中的Files.getDirsInDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。