Subversion Repositories basico

Rev

Rev 374 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 374 Rev 375
Line 127... Line 127...
127
        total, used, free = self.get_disk_usage(path)
127
        total, used, free = self.get_disk_usage(path)
128
        return used/total
128
        return used/total
129
129
130
130
131
    def get_kilobytes(self, integer_bytes):
131
    def get_kilobytes(self, integer_bytes):
132
        kilo, bites = divmod(int(abs(integer_bytes)), 1_024)
-
 
-
 
132
        kilo, bites = divmod(int(abs(integer_bytes)), 1024)
133
        # ~ self.log.debug("%d bytes -> %d Kb", integer_bytes, kilo)
133
        # ~ self.log.debug("%d bytes -> %d Kb", integer_bytes, kilo)
134
        return kilo
134
        return kilo
135
135
136
136
137
    def get_megabytes(self, integer_bytes):
137
    def get_megabytes(self, integer_bytes):
138
        kilo = self.get_kilobytes(integer_bytes)
138
        kilo = self.get_kilobytes(integer_bytes)
139
        mega, kilo = divmod(kilo, 1_024)
-
 
-
 
139
        mega, kilo = divmod(kilo, 1024)
140
        # ~ self.log.debug("%d bytes -> %d Mb", integer_bytes, mega)
140
        # ~ self.log.debug("%d bytes -> %d Mb", integer_bytes, mega)
141
        return mega
141
        return mega
142
142
143
143
144
    def get_gigabytes(self, integer_bytes):
144
    def get_gigabytes(self, integer_bytes):
145
        mega = self.get_megabytes(integer_bytes)
145
        mega = self.get_megabytes(integer_bytes)
146
        giga, mega = divmod(mega, 1_024)
-
 
-
 
146
        giga, mega = divmod(mega, 1024)
147
        # ~ self.log.debug("%d bytes -> %d Gb", integer_bytes, giga)
147
        # ~ self.log.debug("%d bytes -> %d Gb", integer_bytes, giga)
148
        return giga
148
        return giga
149
149
150
150
151
    def get_human_sizes(self, integer_bytes):
151
    def get_human_sizes(self, integer_bytes):