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


Python StatsDateLib.getYearMonthDayInStrfTime方法代码示例

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


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

示例1: buildCsvFileName

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getYearMonthDayInStrfTime [as 别名]
def buildCsvFileName( infos ):
    """ 
    
        @summary: Builds and returns the file name to use for the csv file.
        
        @param infos: _CvsInfos instance containing the required 
                      information to build up the file name.
        
        @return: Return the built up file name.              
                      
    """
    
    global _ 
    
    StatsDateLib.setLanguage(infos.outputLanguage)
    paths = StatsPaths()
    paths.setPaths( infos.outputLanguage )
    
    machinesStr = str(infos.machinesForLabels).replace('[','').replace( ']','' ).replace(',', '').replace("'","").replace( '"','').replace( ' ','' )
    
    currentYear, currentMonth, currentDay = StatsDateLib.getYearMonthDayInStrfTime( StatsDateLib.getSecondsSinceEpoch (infos.start) )     
    currentWeek = time.strftime( "%W", time.gmtime( StatsDateLib.getSecondsSinceEpoch (infos.start) ) )
    
    
    fileName = paths.STATSCSVFILES
   
    if infos.span == "daily":
        fileName = fileName + "/" + _("daily/") + infos.fileType + "/%s/%s/%s/%s.csv" %( machinesStr, currentYear, currentMonth, currentDay )   
    
    elif infos.span == "weekly":
        fileName = fileName + "/" +  _("weekly/") + infos.fileType  + "/%s/%s/%s.csv" %( machinesStr, currentYear, currentWeek ) 
    
    elif infos.span == "monthly":
        fileName = fileName + "/" + _("monthly/") + infos.fileType + "/%s/%s/%s.csv" %( machinesStr, currentYear, currentMonth )
    
    elif infos.span == "yearly":
        fileName = fileName + "/" + _("yearly/") + infos.fileType  + "/%s/%s.csv" %( machinesStr, currentYear )
        
    
    StatsDateLib.setLanguage( LanguageTools.getMainApplicationLanguage() )    
        
    return fileName 
开发者ID:hawkeye438,项目名称:metpx,代码行数:44,代码来源:csvDataConversion.py

示例2: printWebPage

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getYearMonthDayInStrfTime [as 别名]

#.........这里部分代码省略.........
                
                </style>
    
                
            </head>    
            
            <body text="#000000" link="#FFFFFF" vlink="000000" bgcolor="#FFF4E5" > 
                <br>
                <table width = "100%">
                    <tr width = "100%">
                        <div class="left"><b><font size="5">"""
            + _("Yearly graphics for RX sources from MetPx.")
            + """ </font><font size = "2">"""
            + _("*updated monthly")
            + """</font></b></div> 
        
        """
        )

        oneFileFound = False

        for year in self.years:
            parameters = StatsConfigParameters()
            parameters.getAllParameters()
            machinesStr = (
                str(parameters.sourceMachinesTags)
                .replace("[", "")
                .replace("]", "")
                .replace(",", "")
                .replace("'", "")
                .replace('"', "")
                .replace(" ", "")
            )
            currentYear, currentMonth, currentDay = StatsDateLib.getYearMonthDayInStrfTime(year)

            _ = self.getTranslatorForModule(CURRENT_MODULE_ABS_PATH, self.filesLanguage)

            file = self.pathsTowardsGraphics.STATSCSVFILES + _("yearly/rx/%s/%s.csv") % (machinesStr, currentYear)
            webLink = _("csvFiles/yearly/rx/%s/%s.csv") % (machinesStr, currentYear)

            _ = self.getTranslatorForModule(CURRENT_MODULE_ABS_PATH, self.displayedLanguage)

            if os.path.isfile(file):
                if oneFileFound == False:
                    fileHandle.write(
                        "<div class='right'><font size='2' color='black'" + _("CSV files") + "&nbsp;:&nbsp; "
                    )
                    oneFileFound = True

                fileHandle.write("""<a  href="%s" class="blackLinks">%.4s.csv&nbsp;</a>""" % (webLink, currentYear))

        if oneFileFound == True:
            fileHandle.write(
                """
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                </font>
                            </div>
            """
            )

        fileHandle.write(
            """
                         </tr>
                    </td>
                 </table>   
             <br>
开发者ID:khosrow,项目名称:metpx,代码行数:70,代码来源:YearlyGraphicsWebPageGenerator.py

示例3: printWebPage

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getYearMonthDayInStrfTime [as 别名]

#.........这里部分代码省略.........
                                                    </a>
                                            </center>
                                        </font>
                                    </div>
                                </td>
                                
                                <td bgcolor="#006699">
                                    <font color = "white">""" + _("List of available daily graphics.") + """</font>                                
                                </td>
                            </tr>   
                        </thead>
            
            
                        <tbody>
        
        """)
        
        
        
        
        for rxName in rxNamesArray :
            
            if rxNames[rxName] == "" :
                fileHandle.write( """<tr> <td bgcolor="#99FF99"> %s</td> """ %(rxName))
                fileHandle.write( """<td bgcolor="#66CCFF"> """ + _("Days") + """ :   """ )
            else:
                machineName = self.getMachineNameFromDescription( rxNames[rxName] ) 
                fileHandle.write( """<tr> <td bgcolor="#99FF99"><div class="left"> %s</div><div class="right"><a href="#" onClick="descriptionWindow.load('inline', '%s', 'Description');descriptionWindow.show(); return false"><font color="black">?</font></a></div><br>(%s)</td> """ %(rxName, rxNames[rxName].replace("'","").replace('"','').replace( ",", ", "), machineName ) )
                fileHandle.write( """<td bgcolor="#66CCFF"> """ + _("Days") + """ :   """ )
                
                    
            for day in self.days:
                
                currentYear, currentMonth, currentDay = StatsDateLib.getYearMonthDayInStrfTime( day )
                
                _ = self.getTranslatorForModule( CURRENT_MODULE_ABS_PATH, self.filesLanguage)
                
                file = file = self.pathsTowardsGraphics.STATSGRAPHSARCHIVES + _("daily/rx/%s/")%( rxName ) + str(currentYear) + "/" + str(currentMonth) + "/" + str(currentDay) + ".png"
                webLink = _("archives/daily/rx/%s/")%( rxName ) + str(currentYear) + "/" + str(currentMonth) + "/" + str(currentDay) + ".png"
                
                _ = self.getTranslatorForModule( CURRENT_MODULE_ABS_PATH, self.displayedLanguage )
                
                if os.path.isfile( file ):
                    fileHandle.write(  """<a target ="%s" href="%s">"""%( rxName, webLink) + "%s" %StatsDateLib.getDayOfTheWeek(day)  + """   </a>""" )
                else :
                    pass 
                     
            fileHandle.write( """</td></tr>""" )
        
        fileHandle.write( """
        
                </tbody>
            </table>
        </div>
           
        <h2>""" + _("Daily graphics for TX clients from MetPx.") + """ <font size = "2">""" +_("*updated hourly") + """</font></h2>
        
        <div class="tableContainer">         
            <table> 
                <thead>
                    <tr>
    
                         <td bgcolor="#006699">
                            <div class = "txTableEntry">
                                <font color = "white">
                                    <center>
开发者ID:hawkeye438,项目名称:metpx,代码行数:70,代码来源:DailyGraphicsWebPageGenerator.py

示例4: printWebPage

# 需要导入模块: from pxStats.lib.StatsDateLib import StatsDateLib [as 别名]
# 或者: from pxStats.lib.StatsDateLib.StatsDateLib import getYearMonthDayInStrfTime [as 别名]

#.........这里部分代码省略.........
                     
                     <td bgcolor="#006699"  title =" """ +_( "Display the total of files received by all sources.") + """ "><font color = "white"><div class="left">""" + _("FileCount") + """</div><a target ="popup" href="help" onClick="wopen('helpPages/fileCount_%s.html' """%(self.displayedLanguage)+ """, 'popup', 875, 100); return false;"><div class="right">?</div></a></font></td>
                     
                     <td bgcolor="#006699"  title =" """ +_( "Display the total of errors that occured during all the receptions.") + """ "><font color = "white"><div class="left">""" + _("Errors") + """</div><a target ="popup"  href="help" onClick="wopen('helpPages/errors_%s.html'  """%(self.displayedLanguage)+ """, 'popup', 875, 100); return false;"><div class="right">?</div></a></font></td>
                     
                 </tr>
                    
                 """   ) 
             
             
             
             for timeType in timeTypes:    
                 
                 fileHandle.write( """ 
                 <tr> 
                     <td bgcolor="#99FF99" > %s %s</td>                  
             
                 """ %(( timeType[0].upper() + timeType[1:] ), updateFrequency[timeType] ) )
                 if timeType == timeTypes[0] :
                     timeContainer = self.days     
                 elif timeType == timeTypes[1] :
                     timeContainer = self.weeks
                 elif timeType == timeTypes[2] :
                     timeContainer = self.months
                 elif timeType == timeTypes[3] :
                     timeContainer = self.years
 
                                  
                 for type in rxTypes:
                     
                     fileHandle.write( """<td bgcolor="#66CCFF">  """ )
                     
                     for x in timeContainer:
                         year, month, day = StatsDateLib.getYearMonthDayInStrfTime( x )
                         week = time.strftime( "%W", time.gmtime(x))
                         if timeType ==  timeTypes[0] :
                             file = _("%sdaily/totals/%s/rx/%s/%s/%s/%s.png") %( self.pathsTowardsGraphics.STATSGRAPHSARCHIVES, machineName, year, month, type, day )     
                             webLink =  _("archives/daily/totals/%s/rx/%s/%s/%s/%s.png") %( machineName, year, month, type, day )     
                         elif timeType ==  timeTypes[1]:
                             file    = _("%sweekly/totals/%s/rx/%s/%s/%s.png") %(  self.pathsTowardsGraphics.STATSGRAPHSARCHIVES, machineName, year, type, week )
                             webLink = _("archives/weekly/totals/%s/rx/%s/%s/%s.png") %( machineName, year, type, week )
                         elif timeType ==  timeTypes[2]:
                             file    = _("%smonthly/totals/%s/rx/%s/%s/%s.png") %( self.pathsTowardsGraphics.STATSGRAPHSARCHIVES, machineName, year, type, month )
                             webLink = _("archives/monthly/totals/%s/rx/%s/%s/%s.png") %( machineName, year, type, month )
                         elif timeType ==  timeTypes[3]:
                             file    = _("%syearly/totals/%s/rx/%s/%s.png") %( self.pathsTowardsGraphics.STATSGRAPHSARCHIVES, machineName,  type, year ) 
                             webLink = _("archives/yearly/totals/%s/rx/%s/%s.png") %(  machineName,  type, year ) 
                         
                         
                         if os.path.isfile(file):  
  
                             if timeType == timeTypes[0] :
                                 label =  time.strftime( "%a", time.gmtime(x))   
                             elif timeType == timeTypes[1]:
                                 label = week
                             elif timeType == timeTypes[2]:
                                 label = month
                             elif timeType == timeTypes[3]:
                                 label = year   
                             fileHandle.write(  """<a target ="popup" href="%s" onClick="wopen('%s', 'popup', 875, 240); return false;">"""%( label, webLink ) +  "%s" %label  + """&nbsp;</a>"""  )
                       
                             
                     fileHandle.write( """</td>""" )
                 
                 fileHandle.write( """</tr>""" )       
                     
开发者ID:hawkeye438,项目名称:metpx,代码行数:69,代码来源:TotalsGraphicsWebPagesGenerator.py


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