parameters: ()
docstring: Grep the current module's name from gnuradio.project or CMakeLists.txt
docstring_summary: Grep the current module's name from gnuradio.project or CMakeLists.txt
docstring_tokens: Grep the current module s name from gnuradio . project or CMakeLists . txt
function: def get_modname():
      """ Grep the current module's name from gnuradio.project or CMakeLists.txt """
      modname_trans = {'howto-write-a-block': 'howto'}
      try:
          with open('gnuradio.project', 'r') as f:
              prfile = f.read()
          regexp = r'projectname\s*=\s*([a-zA-Z0-9-_]+)$'
          return re.search(regexp, prfile, flags=re.MULTILINE).group(1).strip()
      except IOError:
          pass
      # OK, there's no gnuradio.project. So, we need to guess.
      with open('CMakeLists.txt', 'r') as f:
          cmfile = f.read()
      regexp = r'(project\s*\(\s*|GR_REGISTER_COMPONENT\(")gr-(?P<modname>[a-zA-Z0-9-_]+)(\s*(CXX)?|" ENABLE)'
      try:
          modname = re.search(regexp, cmfile, flags=re.MULTILINE).group(
              'modname').strip()
          if modname in list(modname_trans.keys()):
              modname = modname_trans[modname]
          return modname
      except AttributeError:
          return None
function_tokens: def get_modname ( ) : modname_trans = { 'howto-write-a-block' : 'howto' } try : with open ( 'gnuradio.project' , 'r' ) as f : prfile = f . read ( ) regexp = r'projectname\s*=\s*([a-zA-Z0-9-_]+)$' return re . search ( regexp , prfile , flags = re . MULTILINE ) . group ( 1 ) . strip ( ) except IOError : pass # OK, there's no gnuradio.project. So, we need to guess. with open ( 'CMakeLists.txt' , 'r' ) as f : cmfile = f . read ( ) regexp = r'(project\s*\(\s*|GR_REGISTER_COMPONENT\(")gr-(?P<modname>[a-zA-Z0-9-_]+)(\s*(CXX)?|" ENABLE)' try : modname = re . search ( regexp , cmfile , flags = re . MULTILINE ) . group ( 'modname' ) . strip ( ) if modname in list ( modname_trans . keys ( ) ) : modname = modname_trans [ modname ] return modname except AttributeError : return None