crossbario / autobahn-python

@@ -354,10 +354,13 @@
Loading
354 354
    fields_by_id = {}
355 355
    for j in range(obj.FieldsLength()):
356 356
        fbs_field = obj.Fields(j)
357 +
357 358
        field_name = fbs_field.Name()
358 359
        if field_name:
359 360
            field_name = field_name.decode('utf8')
361 +
360 362
        field_id = int(fbs_field.Id())
363 +
361 364
        fbs_field_type = fbs_field.Type()
362 365
        field_type = FbsType(basetype=fbs_field_type.BaseType(),
363 366
                             element=fbs_field_type.Element(),
@@ -383,6 +386,79 @@
Loading
383 386
    return fields, fields_by_id
384 387
385 388
389 +
def parse_calls(svc_obj):
390 +
    calls = {}
391 +
    calls_by_id = {}
392 +
    for j in range(svc_obj.CallsLength()):
393 +
        fbs_call = svc_obj.Calls(j)
394 +
395 +
        call_name = fbs_call.Name()
396 +
        if call_name:
397 +
            call_name = call_name.decode('utf8')
398 +
399 +
        # FIXME: schema reflection.RPCCall lacks "Id" (!)
400 +
        # call_id = int(fbs_call.Id())
401 +
        call_id = j
402 +
403 +
        fbs_call_req = fbs_call.Request()
404 +
        call_req_name = fbs_call_req.Name()
405 +
        if call_req_name:
406 +
            call_req_name = call_req_name.decode('utf8')
407 +
        call_req_is_struct = fbs_call_req.IsStruct()
408 +
        call_req_min_align = fbs_call_req.Minalign()
409 +
        call_req_bytesize = fbs_call_req.Bytesize()
410 +
        call_req_docs = parse_docs(fbs_call_req)
411 +
        call_req_attrs = parse_attr(fbs_call_req)
412 +
        call_req_fields, call_fields_by_id = parse_fields(fbs_call_req)
413 +
        call_req = FbsObject(name=call_req_name,
414 +
                             fields=call_req_fields,
415 +
                             fields_by_id=call_fields_by_id,
416 +
                             is_struct=call_req_is_struct,
417 +
                             min_align=call_req_min_align,
418 +
                             bytesize=call_req_bytesize,
419 +
                             attrs=call_req_attrs,
420 +
                             docs=call_req_docs)
421 +
422 +
        fbs_call_resp = fbs_call.Response()
423 +
        call_resp_name = fbs_call_resp.Name()
424 +
        if call_resp_name:
425 +
            call_resp_name = call_resp_name.decode('utf8')
426 +
        call_resp_is_struct = fbs_call_resp.IsStruct()
427 +
        call_resp_min_align = fbs_call_resp.Minalign()
428 +
        call_resp_bytesize = fbs_call_resp.Bytesize()
429 +
        call_resp_docs = parse_docs(fbs_call_resp)
430 +
        call_resp_attrs = parse_attr(fbs_call_resp)
431 +
        call_resp_fields, call_resp_fields_by_id = parse_fields(fbs_call_resp)
432 +
        call_resp = FbsObject(name=call_resp_name,
433 +
                              fields=call_resp_fields,
434 +
                              fields_by_id=call_resp_fields_by_id,
435 +
                              is_struct=call_resp_is_struct,
436 +
                              min_align=call_resp_min_align,
437 +
                              bytesize=call_resp_bytesize,
438 +
                              attrs=call_resp_attrs,
439 +
                              docs=call_resp_docs)
440 +
441 +
        call_docs = parse_docs(fbs_call)
442 +
        call_attrs = parse_attr(fbs_call)
443 +
        call = FbsRPCCall(name=call_name,
444 +
                          id=call_id,
445 +
                          request=call_req,
446 +
                          response=call_resp,
447 +
                          docs=call_docs,
448 +
                          attrs=call_attrs)
449 +
450 +
        assert call_name not in calls, 'call "{}" with id "{}" already in calls {}'.format(call_name, call_id, sorted(calls.keys()))
451 +
        calls[call_name] = call
452 +
        assert call_id not in calls_by_id, 'call "{}" with id " {}" already in calls {}'.format(call_name, call_id, sorted(calls.keys()))
453 +
        calls_by_id[call_id] = call_name
454 +
455 +
    res = []
456 +
    for _, value in sorted(calls_by_id.items()):
457 +
        res.append(value)
458 +
    calls_by_id = res
459 +
    return calls, calls_by_id
460 +
461 +
386 462
class FbsObject(object):
387 463
    def __init__(self,
388 464
                 name: str,
@@ -477,11 +553,13 @@
Loading
477 553
class FbsRPCCall(object):
478 554
    def __init__(self,
479 555
                 name: str,
556 +
                 id: int,
480 557
                 request: FbsObject,
481 558
                 response: FbsObject,
482 559
                 docs: str,
483 560
                 attrs: Dict[str, FbsAttribute]):
484 561
        self._name = name
562 +
        self._id = id
485 563
        self._request = request
486 564
        self._response = response
487 565
        self._docs = docs
@@ -491,6 +569,10 @@
Loading
491 569
    def name(self):
492 570
        return self._name
493 571
572 +
    @property
573 +
    def id(self):
574 +
        return self._id
575 +
494 576
    @property
495 577
    def request(self):
496 578
        return self._request
@@ -528,10 +610,12 @@
Loading
528 610
    def __init__(self,
529 611
                 name: str,
530 612
                 calls: Dict[str, FbsRPCCall],
613 +
                 calls_by_id: Dict[int, str],
531 614
                 attrs: Dict[str, FbsAttribute],
532 615
                 docs: str):
533 616
        self._name = name
534 617
        self._calls = calls
618 +
        self._calls_by_id = calls_by_id
535 619
        self._attrs = attrs
536 620
        self._docs = docs
537 621
@@ -543,6 +627,10 @@
Loading
543 627
    def calls(self):
544 628
        return self._calls
545 629
630 +
    @property
631 +
    def calls_by_id(self):
632 +
        return self._calls_by_id
633 +
546 634
    @property
547 635
    def attrs(self):
548 636
        return self._attrs
@@ -861,65 +949,11 @@
Loading
861 949
            if svc_name:
862 950
                svc_name = svc_name.decode('utf8')
863 951
864 -
            calls = {}
865 -
            for j in range(svc_obj.CallsLength()):
866 -
                fbs_call = svc_obj.Calls(j)
867 -
868 -
                call_name = fbs_call.Name()
869 -
                if call_name:
870 -
                    call_name = call_name.decode('utf8')
871 -
872 -
                fbs_call_req = fbs_call.Request()
873 -
                call_req_name = fbs_call_req.Name()
874 -
                if call_req_name:
875 -
                    call_req_name = call_req_name.decode('utf8')
876 -
                call_req_is_struct = fbs_call_req.IsStruct()
877 -
                call_req_min_align = fbs_call_req.Minalign()
878 -
                call_req_bytesize = fbs_call_req.Bytesize()
879 -
                call_req_docs = parse_docs(fbs_call_req)
880 -
                call_req_attrs = parse_attr(fbs_call_req)
881 -
                call_req_fields, call_fields_by_id = parse_fields(fbs_call_req)
882 -
                call_req = FbsObject(name=call_req_name,
883 -
                                     fields=call_req_fields,
884 -
                                     fields_by_id=call_fields_by_id,
885 -
                                     is_struct=call_req_is_struct,
886 -
                                     min_align=call_req_min_align,
887 -
                                     bytesize=call_req_bytesize,
888 -
                                     attrs=call_req_attrs,
889 -
                                     docs=call_req_docs)
890 -
891 -
                fbs_call_resp = fbs_call.Response()
892 -
                call_resp_name = fbs_call_resp.Name()
893 -
                if call_resp_name:
894 -
                    call_resp_name = call_resp_name.decode('utf8')
895 -
                call_resp_is_struct = fbs_call_resp.IsStruct()
896 -
                call_resp_min_align = fbs_call_resp.Minalign()
897 -
                call_resp_bytesize = fbs_call_resp.Bytesize()
898 -
                call_resp_docs = parse_docs(fbs_call_resp)
899 -
                call_resp_attrs = parse_attr(fbs_call_resp)
900 -
                call_resp_fields, call_resp_fields_by_id = parse_fields(fbs_call_resp)
901 -
                call_resp = FbsObject(name=call_resp_name,
902 -
                                      fields=call_resp_fields,
903 -
                                      fields_by_id=call_resp_fields_by_id,
904 -
                                      is_struct=call_resp_is_struct,
905 -
                                      min_align=call_resp_min_align,
906 -
                                      bytesize=call_resp_bytesize,
907 -
                                      attrs=call_resp_attrs,
908 -
                                      docs=call_resp_docs)
909 -
910 -
                call_docs = parse_docs(fbs_call)
911 -
                call_attrs = parse_attr(fbs_call)
912 -
                call = FbsRPCCall(name=call_name,
913 -
                                  request=call_req,
914 -
                                  response=call_resp,
915 -
                                  docs=call_docs,
916 -
                                  attrs=call_attrs)
917 -
                assert call_name not in calls
918 -
                calls[call_name] = call
919 -
920 952
            docs = parse_docs(svc_obj)
921 953
            attrs = parse_attr(svc_obj)
922 -
            service = FbsService(name=svc_name, calls=calls, attrs=attrs, docs=docs)
954 +
            calls, calls_by_id = parse_calls(svc_obj)
955 +
956 +
            service = FbsService(name=svc_name, calls=calls, calls_by_id=calls_by_id, attrs=attrs, docs=docs)
923 957
            assert svc_name not in services
924 958
            services[svc_name] = service
925 959

@@ -180,3 +180,9 @@
Loading
180 180
        :returns: The unwrapped application payload.
181 181
        :rtype: object
182 182
        """
183 +
184 +
185 +
class IDelegate(ISeller, IBuyer):
186 +
    """
187 +
    XBR Delegate interface.
188 +
    """

@@ -36,7 +36,7 @@
Loading
36 36
    from autobahn.xbr._abi import XBR_TOKEN_ABI, XBR_NETWORK_ABI, XBR_MARKET_ABI, XBR_CATALOG_ABI, XBR_CHANNEL_ABI  # noqa
37 37
    from autobahn.xbr._abi import XBR_DEBUG_TOKEN_ADDR, XBR_DEBUG_NETWORK_ADDR, XBR_DEBUG_MARKET_ADDR, XBR_DEBUG_CATALOG_ADDR, XBR_DEBUG_CHANNEL_ADDR  # noqa
38 38
    from autobahn.xbr._abi import XBR_DEBUG_TOKEN_ADDR_SRC, XBR_DEBUG_NETWORK_ADDR_SRC, XBR_DEBUG_MARKET_ADDR_SRC, XBR_DEBUG_CATALOG_ADDR_SRC, XBR_DEBUG_CHANNEL_ADDR_SRC  # noqa
39 -
    from autobahn.xbr._interfaces import IMarketMaker, IProvider, IConsumer, ISeller, IBuyer  # noqa
39 +
    from autobahn.xbr._interfaces import IMarketMaker, IProvider, IConsumer, ISeller, IBuyer, IDelegate  # noqa
40 40
    from autobahn.xbr._util import make_w3, pack_uint256, unpack_uint256, with_0x, without_0x  # noqa
41 41
42 42
    from autobahn.xbr._eip712_member_register import sign_eip712_member_register, recover_eip712_member_register  # noqa
Files Coverage
autobahn 57.70%
Project Totals (72 files) 57.70%
Untitled

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading