Retreive usage value within report
188529
def get_value(self):
        """"""
        if self.__is_value_array:
            if self.__bit_size == 8: #matching c_ubyte
                return list(self.__value)
            else:
                result = []
                for i in range(self.__report_count):
                    result.append(self.__getitem__(i))
                return result
        else:
            return self.__value
522172
def set_value(self, value):
        """"""
        if self.__is_value_array:
            if len(value) == self.__report_count:
                for index, item in enumerate(value):
                    self.__setitem__(index, item)
            else:
                raise ValueError("Value size should match report item size "\
                    "length" )
        else:
            self.__value = value & ((1 << self.__bit_size) - 1)
382335
def format_usage(self, usage):
        
        msg = '\nUsage: %s\n' % self.indent_lines(textwrap.dedent(usage), "  ")
        return msg
1198555
def print_report(label, user, system, real):
    
    print("{:<12s} {:12f} {:12f} ( {:12f} )".format(label,
                                                    user,
                                                    system,
                                                    real))
654742
private static void usage() {
        display("Usage: CSVDumper <params>");
        display("where <params> are:");
        display("   -app <name>         Doradus application name. Default is: {}", CSVConfig.DEFAULT_APPNAME);
        display("   -batchsize <#>      Batch size. Default is: {}", CSVConfig.DEFAULT_BATCH_SIZE);
        display("   -compress [T|F]     Compress messages. Default is: {}", CSVConfig.DEFAULT_COMPRESS);
        display("   -host <host>        Doradus server host name. Default is: {}", CSVConfig.DEFAULT_HOST);
        display("   -id <name>          Column name of ID field. Default is: {}", CSVConfig.DEFAULT_ID_FIELD);
        display("   -password <pw>      Password for tenant. Default is: {}", CSVConfig.DEFAULT_PASSWORD);
        display("   -port <port>        Doradus server port. Default is: {}", CSVConfig.DEFAULT_PORT);
        display("   -root <folder>      Root folder of CSV files. Default is: {}", CSVConfig.DEFAULT_ROOT);
        display("   -shard <name>       (OLAP only): Name of shard to load. Default is: {}", CSVConfig.DEFAULT_SHARD);
        display("   -tenant <name>      Name of tenant to use. Default is: {}", CSVConfig.DEFAULT_TENANT);
        display("   -user <ID>          User ID for tenant. Default is: {}", CSVConfig.DEFAULT_USER);
        display("   -workers <#>        # of worker threads. Default is: {}", CSVConfig.DEFAULT_WORKERS);
        display("Reads all records in all tables for the given OLAP or Spider application and dumps");
        display("them to CSV files found in 'root' folder. TLS options are also available.");
        System.exit(0);
    }
1257024
def get_usages(self):
        ""
        result = dict()
        for key, usage in self.items():
            result[key] = usage.value
        return result
1029211
def value(self):
        '''
        
        '''
        (counter_type, value) = win32pdh.GetFormattedCounterValue(
            self.handle, win32pdh.PDH_FMT_DOUBLE)
        self.type = counter_type
        return value
661767
def get_usage(self, start=None, end=None):
        """"""
        method = 'GET'
        endpoint = '/rest/v1/users/{}/usage'.format(self.client.sauce_username)
        data = {}
        if start:
            data['start'] = start
        if end:
            data['end'] = end
        if data:
            endpoint = '?'.join([endpoint, urlencode(data)])
        return self.client.request(method, endpoint)
334754
def _format_report_line(self, test, time_taken, color, status, percent):
        """"""
        return "[{0}] {3:04.2f}% {1}: {2}".format(
            status, test, self._colored_time(time_taken, color), percent
        )
826935
def usage(self):
        
        if self._usage is None:
            self._usage = UsageList(self._version, account_sid=self._solution['sid'], )
        return self._usage
1081581
def perf_total(self, value):
        
        if value == self._defaults['perfTotal'] and 'perfTotal' in self._values:
            del self._values['perfTotal']
        else:
            self._values['perfTotal'] = value
926153
private static void printUsage(String cmd) {
    if ("-report".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-report] [-service serviceName]");
    } else if ("-safemode".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-safemode enter | leave | get | wait | initqueues] [-service serviceName]");
    } else if ("-saveNamespace".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-saveNamespace [force] [uncompressed] [-service serviceName]");
    } else if ("-refreshNodes".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-refreshNodes] [-service serviceName]");
    } else if ("-finalizeUpgrade".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-finalizeUpgrade] [-service serviceName]");
    } else if ("-upgradeProgress".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-upgradeProgress status | details | force] [-service serviceName]");
    } else if ("-metasave".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
          + " [-metasave filename] [-service serviceName]");
    } else if ("-blockReplication".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
          + " [-blockReplication enable | disable]");
    } else if (SetQuotaCommand.matches(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [" + SetQuotaCommand.USAGE+"]");
    } else if (ClearQuotaCommand.matches(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " ["+ClearQuotaCommand.USAGE+"]");
    } else if (SetSpaceQuotaCommand.matches(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [" + SetSpaceQuotaCommand.USAGE+"]");
    } else if (ClearSpaceQuotaCommand.matches(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " ["+ClearSpaceQuotaCommand.USAGE+"]");
    } else if ("-refreshServiceAcl".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-refreshServiceAcl] [-service serviceName]");
    } else if ("-refreshNamenodes".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-refreshNamenodes] [datanodehost:port]");
    } else if ("-removeNamespace".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
          + " -removeNamespace nameserviceId [datanodehost:port]");
    } else if ("-refreshDatanodeDataDirs".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin [-refreshDatanodeDataDirs]"
                         + "[confFilePath] [datanodehost:port]");
    } else if ("-getOpenFiles".equals(cmd)) {
      System.err.println("Usage: java DFSAdmin"
                         + " [-getOpenFiles] path minutes");
    } else if ("-getBlockInfo".equals(cmd)) {
    	System.err.println("Usage: java DFSAdmin"
          							 + " [-getBlockInfo] block-id");
    } else if (RecountCommand.matches(cmd)) {
      System.err.println("Usage: java DFSAdmin" + "[" +
          RecountCommand.USAGE + "]");
    } else if("-refreshOfferService".equals(cmd)){
      System.err.println("Usage: java DFSAdmin -refreshOfferService -service serviceName");
    } else {
      System.err.println("Usage: java DFSAdmin");
      System.err.println("           [-report] [-service serviceName]");
      System.err.println("           [-safemode enter | leave | get | wait | initqueues] [-service serviceName]");
      System.err.println("           [-saveNamespace [force] [uncompressed] [-service serviceName]");
      System.err.println("           [-rollEditLog [-service serviceName]");
      System.err.println("           [-refreshNodes] [-service serviceName]");
      System.err.println("           [-finalizeUpgrade] [-service serviceName]");
      System.err.println("           [-upgradeProgress status | details | force] [-service serviceName]");
      System.err.println("           [-metasave filename] [-service serviceName]");
      System.err.println("           [-blockReplication enable | disable]");
      System.err.println("           [-refreshServiceAcl] [-service serviceName]");
      System.err.println("           ["+SetQuotaCommand.USAGE+"]");
      System.err.println("           ["+ClearQuotaCommand.USAGE+"]");
      System.err.println("           [-refreshNamenodes] [datanodehost:port]");
      System.err.println("           [removeNamespace nameserviceId [datanodehost:port]]");
      System.err.println("           [-refreshDatanodeDataDirs] [confFilePath] " 
                                           + "[datanodehost:port]");
      System.err.println("           [-getOpenFiles] path minutes");
      System.err.println("           [-getBlockInfo] block-id");
      System.err.println("           ["+SetSpaceQuotaCommand.USAGE+"]");
      System.err.println("           ["+ClearSpaceQuotaCommand.USAGE+"]");
      System.err.println("           ["+RecountCommand.USAGE+"]");
      System.err.println("           [-help [cmd]]");
      System.err.println();
      ToolRunner.printGenericCommandUsage(System.err);
    }
  }
203625
def get_usage_string(self):
        
        if self.string_index:
            usage_string_type = c_wchar * MAX_HID_STRING_LENGTH
            # 128 max string length
            abuffer = usage_string_type()
            hid_dll.HidD_GetIndexedString(
                self.hid_report.get_hid_object().hid_handle,
                self.string_index,
                byref(abuffer), MAX_HID_STRING_LENGTH-1 )
            return abuffer.value
        return ""
800796
def find_usage(self):
        
        logger.debug("Checking usage for service %s", self.service_name)
        self.connect()
        for lim in self.limits.values():
            lim._reset_usage()
        self._find_usage_apis()
        self._find_usage_api_keys()
        self._find_usage_certs()
        self._find_usage_plans()
        self._find_usage_vpc_links()
        self._have_usage = True
        logger.debug("Done checking usage.")
707152
def usage(self, startTime, endTime, vars=None, period=None,
              groupby=None, name=None, stype=None, etype=None,
              appId=None, deviceId=None, username=None, appOrgId=None,
              userOrgId=None, hostOrgId=None):
        

        url = self.root + "/usage"
        startTime = str(int(local_time_to_online(dt=startTime)))
        endTime = str(int(local_time_to_online(dt=endTime)))

        params = {
                    'f' : 'json',
                    'startTime' : startTime,
                    'endTime' : endTime,
                    'vars' : vars,
                    'period' : period,
                    'groupby' : groupby,
                    'name' : name,
                    'stype' : stype,
                    'etype' : etype,
                    'appId' : appId,
                    'deviceId' : deviceId,
                    'username' : username,
                    'appOrgId' : appOrgId,
                    'userOrgId' : userOrgId,
                    'hostOrgId' : hostOrgId,
                 }

        params = {key:item for key,item in params.items() if item is not None}
        return self._post(url=url,
                             param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
11490
def use_value(self, value):
        """"""
        if self.check_value(value):
            return value
        return self.convert_value(value)
419351
def reindex(report):
    """"""
    index = list(report.index)
    i = index.index('TOTAL')
    return report.reindex(index[:i] + index[i+1:] + ['TOTAL'])