MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / static_method

Function static_method

src/py_class/py_class_impl.py:569–596  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

567 impl(with_params, with_docs, with_visibility)
568
569def static_method():
570 def impl(with_visibility):
571 if with_visibility:
572 visibility_capture = '$visibility:vis'
573 visibility_expansion = '$visibility'
574 else:
575 visibility_capture = ''
576 visibility_expansion = 'pub'
577
578 generate_case(
579 '$(#[doc=$doc:expr])* @staticmethod %s def $name:ident ($($p:tt)*) -> $res_type:ty { $( $body:tt )* }' % (visibility_capture,),
580 new_impl='''
581 $crate::py_argparse_parse_plist!{
582 py_class_impl_item { $class, $py, %s, $name() $res_type; { $($body)* } }
583 ($($p)*)
584 }
585 ''' % (visibility_expansion,),
586 new_members=[('$name', '''
587 $crate::py_argparse_parse_plist!{
588 py_class_static_method {$py, $class::$name, {
589 concat!($($doc, "\\n"),*)
590 } }
591 ($($p)*)
592 }
593 ''')])
594
595 for with_visibility in (False, True):
596 impl(with_visibility)
597
598def static_data():
599 generate_case('static $name:ident = $init:expr;',

Callers 1

mainFunction · 0.70

Calls 1

implFunction · 0.85

Tested by

no test coverage detected