parameters: (args, directory=home)
return_statement: return data
docstring: Build the project and get the timings output.
docstring_summary: Build the project and get the timings output.
docstring_tokens: Build the project and get the timings output .
function: def build(args, directory=home):
      '''Build the project and get the timings output.'''
  
      os.chdir(directory)
      command = 'cargo +nightly build -Z timings=json'
      if args.no_default_features:
          command = f'{command} --no-default-features'
      if args.features:
          command = f'{command} --features={args.features}'
      process = subprocess.Popen(
          # Use shell for faster performance.
          # Spawning a new process is a **lot** slower, gives misleading info.
          command,
          shell=True,
          stderr=subprocess.DEVNULL,
          stdout=subprocess.PIPE,
      )
      process.wait()
      data = {}
      for line in iter(process.stdout.readline, b''):
          line = line.decode('utf-8')
          crate = json.loads(line)
          name = crate['target']['name']
          data[name] = (crate['duration'], crate['rmeta_time'])
  
      process.stdout.close()
  
      return data
function_tokens: def build ( args , directory = home ) : os . chdir ( directory ) command = 'cargo +nightly build -Z timings=json' if args . no_default_features : command = f'{command} --no-default-features' if args . features : command = f'{command} --features={args.features}' process = subprocess . Popen ( # Use shell for faster performance. # Spawning a new process is a **lot** slower, gives misleading info. command , shell = True , stderr = subprocess . DEVNULL , stdout = subprocess . PIPE , ) process . wait ( ) data = { } for line in iter ( process . stdout . readline , b'' ) : line = line . decode ( 'utf-8' ) crate = json . loads ( line ) name = crate [ 'target' ] [ 'name' ] data [ name ] = ( crate [ 'duration' ] , crate [ 'rmeta_time' ] ) process . stdout . close ( ) return data