Changeset 8565a42 in mainline for tools/imgutil.py


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/imgutil.py

    r3061bc1 r8565a42  
    4040def align_up(size, alignment):
    4141        "Return size aligned up to alignment"
    42        
     42
    4343        if (size % alignment == 0):
    4444                return size
    45        
     45
    4646        return ((size // alignment) + 1) * alignment
    4747
    4848def count_up(size, alignment):
    4949        "Return units necessary to fit the size"
    50        
     50
    5151        if (size % alignment == 0):
    5252                return (size // alignment)
    53        
     53
    5454        return ((size // alignment) + 1)
    5555
    5656def num_of_trailing_bin_zeros(num):
    5757        "Return number of trailing zeros in binary representation"
    58        
     58
    5959        i = 0
    6060        if (num == 0): raise ValueError()
     
    6666def get_bit(number, n):
    6767        "Return True if n-th least-significant bit is set in the given number"
    68        
     68
    6969        return bool((number >> n) & 1)
    7070
    7171def set_bit(number, n):
    7272        "Return the number with n-th least-significant bit set"
    73        
     73
    7474        return number | (1 << n)
    7575
    7676class ItemToPack:
    7777        "Stores information about one directory item to be added to the image"
    78        
     78
    7979        def __init__(self, parent, name):
    8080                self.parent = parent
     
    8888def listdir_items(path):
    8989        "Return a list of items to be packed inside a fs image"
    90        
     90
    9191        for name in os.listdir(path):
    9292                if name in exclude_names:
    9393                        continue
    94                
     94
    9595                item = ItemToPack(path, name)
    96                
     96
    9797                if not (item.is_dir or item.is_file):
    9898                        continue
    99                
     99
    100100                yield item
    101101
    102102def chunks(item, chunk_size):
    103103        "Iterate contents of a file in chunks of a given size"
    104        
     104
    105105        inf = open(item.path, 'rb')
    106106        rd = 0
    107        
     107
    108108        while (rd < item.size):
    109109                data = bytes(inf.read(chunk_size))
    110110                yield data
    111111                rd += len(data)
    112        
     112
    113113        inf.close()
Note: See TracChangeset for help on using the changeset viewer.