You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mulpyplexer

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mulpyplexer

A module that multiplexes interactions with lists of python objects.

0.09
pipPyPI
Maintainers
4

Mulpyplexer is a piece of code that can multiplex interactions with lists of python objects. It's easier to show you:

import mulpyplexer

class A:
    def __init__(self, i):
        self.i = i

    def add(self, j):
        return A(self.i + (j.i if isinstance(j, A) else j))

    def sub(self, j):
        return A(self.i - (j.i if isinstance(j, A) else j))

    def __repr__(self):
        return "<A %d>" % self.i

    def str(self):
        return str(self.i)

    def __eq__(self, o):
        return self.i == o.i

one = mulpyplexer.MP([ A(10), A(20), A(30) ])

two = one.add(5)
assert two.mp_items == [ A(15), A(25), A(35) ]

three = two.sub(10)
assert three.mp_items == [ A(5), A(15), A(25) ]

four = three.add(one)
assert four.mp_items == [ A(15), A(35), A(55) ]

five = four.str()
assert five.mp_items == [ "15", "35", "55" ]

six = four.i
assert six.mp_items == [ 15, 35, 55 ]

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts