python类map()的实例源码

segment.py 文件源码 项目:idascripts 作者: ctfhacker 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def list(**type):
    """List all the segments defined in the database.

    Search type can be identified by providing a named argument.
    like = glob match
    regex = regular expression
    selector = segment selector
    index = particular index
    name = specific segment name
    predicate = function predicate
    """
    res = __builtin__.list(iterate(**type))

    maxindex = max(__builtin__.map(operator.attrgetter('index'), res) or [1])
    maxaddr = max(__builtin__.map(operator.attrgetter('endEA'), res) or [1])
    maxsize = max(__builtin__.map(operator.methodcaller('size'), res) or [1])
    maxname = max(__builtin__.map(utils.compose(idaapi.get_true_segm_name,len), res) or [1])
    cindex = math.ceil(math.log(maxindex)/math.log(10))
    caddr = math.ceil(math.log(maxaddr)/math.log(16))
    csize = math.ceil(math.log(maxsize)/math.log(16))

    for seg in res:
        comment = idaapi.get_segment_cmt(seg, 0) or idaapi.get_segment_cmt(seg, 1)
        print("[{:{:d}d}] {:0{:d}x}:{:0{:d}x} {:>{:d}s} {:<+#{:d}x} sel:{:04x} flags:{:02x}{:s}".format(seg.index, int(cindex), seg.startEA, int(caddr), seg.endEA, int(caddr), idaapi.get_true_segm_name(seg), maxname, seg.size(), int(csize), seg.sel, seg.flags, "// {:s}".format(comment) if comment else ''))
    return

## searching
segment.py 文件源码 项目:idascripts 作者: ctfhacker 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def map(ea, size, newea, **kwds):
    """Map ``size`` bytes of data from ``ea`` into a new segment at ``newea``.
    ``name`` can be used to name the segment.
    """
    fpos,data = idaapi.get_fileregion_offset(ea),database.read(ea, size)
    if len(data) != size:
        raise ValueError("{:s}.map({:x}, {:#x}, {:x}) : Unable to read {:#x} bytes from {:#x}".format(__name__, ea, size, newea, size, ea))
    res = idaapi.mem2base(data, newea, fpos)
    if not res:
        raise ValueError("{:s}.map({:x}, {:#x}, {:x}) : Unable to remap {:#x}:{:+#x} to {:#x}".format(__name__, ea, size, newea, ea, size, newea))
    return create(newea, size, kwds.get("name', 'map_{:x}".format(ea)))
    #return create(newea, size, kwds.get("name', 'map_{:s}".format(newea>>4)))

# creation/destruction
pandas_py3k.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
pandas_py3k.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __repr__(self):
        if not self:
            return '%s()' % self.__class__.__name__
        items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
        return '%s({%s})' % (self.__class__.__name__, items)

    # Multiset-style mathematical operations discussed in:
    #       Knuth TAOCP Volume II section 4.6.3 exercise 19
    #       and at http://en.wikipedia.org/wiki/Multiset
    #
    # Outputs guaranteed to only include positive counts.
    #
    # To strip negative and zero counts, add-in an empty counter:
    #       c += Counter()
noniterators.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:packaging 作者: blockstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:islam-buddy 作者: hamir 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:islam-buddy 作者: hamir 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
__init__.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:FightstickDisplay 作者: calexil 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:FightstickDisplay 作者: calexil 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:Repobot 作者: Desgard 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:UMOG 作者: hsab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
__init__.py 文件源码 项目:blackmamba 作者: zrzka 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))
noniterators.py 文件源码 项目:beepboop 作者: nicolehe 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def flatmap(f, items):
    return chain.from_iterable(map(f, items))
__init__.py 文件源码 项目:beepboop 作者: nicolehe 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def lmap(*args, **kwargs):
        return list(map(*args, **kwargs))


问题


面经


文章

微信
公众号

扫码关注公众号