zsearch_definitions.protocols.Protocol.from_pretty_name

Here are the examples of the python api zsearch_definitions.protocols.Protocol.from_pretty_name taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: ztag Source File: protocols_test.py
    def test_subprotocols_with_bonus_underscores(self):
        modbus = Protocol.from_pretty_name("modbus")
        self.assertTrue(hasattr(modbus, "DEVICE_ID"))
        self.assertFalse(hasattr(modbus, "MEI"))
        self.assertFalse(hasattr(modbus, "DEVICE"))

Example 2

Project: ztag Source File: protocols_test.py
    def test_generic_subprotocols_exposed_as_attributes(self):
        proto_http = Protocol.from_pretty_name("http")
        self.assertTrue(hasattr(proto_http, "GET"))

Example 3

Project: ztag Source File: __main__.py
def zsearch_protocol(s):
    try:
        return protocols.Protocol.from_pretty_name(s)
    except KeyError as e:
        raise argparse.ArgumentTypeError(e)