parameters: (self, val=None, typ=None, **kwargs)
docstring: Register the typing of a global value.
          Functional usage with a Numba type::
              register_global(value, typ)
  
          Decorator usage with a template class::
              @register_global(value, typing_key=None)
              class Template:
                  ...
docstring_summary: Register the typing of a global value.
          Functional usage with a Numba type::
              register_global(value, typ)
docstring_tokens: Register the typing of a global value . Functional usage with a Numba type :: register_global ( value typ )
function: def register_global(self, val=None, typ=None, **kwargs):
          """
          Register the typing of a global value.
          Functional usage with a Numba type::
              register_global(value, typ)
  
          Decorator usage with a template class::
              @register_global(value, typing_key=None)
              class Template:
                  ...
          """
          if typ is not None:
              # register_global(val, typ)
              assert val is not None
              assert not kwargs
              self.globals.append((val, typ))
          else:
              def decorate(cls, typing_key):
                  class Template(cls):
                      key = typing_key
                  if callable(val):
                      typ = types.Function(Template)
                  else:
                      raise TypeError("cannot infer type for global value %r")
                  self.globals.append((val, typ))
                  return cls
  
              # register_global(val, typing_key=None)(<template class>)
              assert val is not None
              typing_key = kwargs.pop('typing_key', val)
              assert not kwargs
              if typing_key is val:
                  # Check the value is globally reachable, as it is going
                  # to be used as the key.
                  mod = sys.modules[val.__module__]
                  if getattr(mod, val.__name__) is not val:
                      raise ValueError("%r is not globally reachable as '%s.%s'"
                                       % (mod, val.__module__, val.__name__))
  
              def decorator(cls):
                  return decorate(cls, typing_key)
              return decorator
function_tokens: def register_global ( self , val = None , typ = None , * * kwargs ) : if typ is not None : # register_global(val, typ) assert val is not None assert not kwargs self . globals . append ( ( val , typ ) ) else : def decorate ( cls , typing_key ) : class Template ( cls ) : key = typing_key if callable ( val ) : typ = types . Function ( Template ) else : raise TypeError ( "cannot infer type for global value %r" ) self . globals . append ( ( val , typ ) ) return cls # register_global(val, typing_key=None)(<template class>) assert val is not None typing_key = kwargs . pop ( 'typing_key' , val ) assert not kwargs if typing_key is val : # Check the value is globally reachable, as it is going # to be used as the key. mod = sys . modules [ val . __module__ ] if getattr ( mod , val . __name__ ) is not val : raise ValueError ( "%r is not globally reachable as '%s.%s'" % ( mod , val . __module__ , val . __name__ ) ) def decorator ( cls ) : return decorate ( cls , typing_key ) return decorator