parameters: (logger)
docstring: Get the yarn configuration.
  
      Returns
      -------
      {"yarn config": dict, "npm config": dict} if unsuccessfull the subdictionary are empty
docstring_summary: Get the yarn configuration.
docstring_tokens: Get the yarn configuration .
function: def _yarn_config(logger):
      """Get the yarn configuration.
  
      Returns
      -------
      {"yarn config": dict, "npm config": dict} if unsuccessfull the subdictionary are empty
      """
      configuration = {"yarn config": {}, "npm config": {}}
      try:
          node = which('node')
      except ValueError:  # Node not found == user with no need for building jupyterlab
          logger.debug("NodeJS was not found. Yarn user configuration is ignored.")
          return configuration
  
      try:
          output_binary = subprocess.check_output([node, YARN_PATH, 'config', 'list', '--json'], stderr=subprocess.PIPE, cwd=HERE)
          output = output_binary.decode('utf-8')
          lines = iter(output.splitlines())
          try:
              for line in lines:
                  info = json.loads(line)
                  if info["type"] == "info":
                      key = info["data"]
                      inspect = json.loads(next(lines))
                      if inspect["type"] == "inspect":
                          configuration[key] = inspect["data"]
          except StopIteration:
              pass
          logger.debug("Yarn configuration loaded.")
      except subprocess.CalledProcessError as e:
          logger.error("Fail to get yarn configuration. {!s}{!s}".format(e.stderr.decode('utf-8'), e.output.decode('utf-8')))
      except Exception as e:
          logger.error("Fail to get yarn configuration. {!s}".format(e))
      finally:
          return configuration
function_tokens: def _yarn_config ( logger ) : configuration = { "yarn config" : { } , "npm config" : { } } try : node = which ( 'node' ) except ValueError : # Node not found == user with no need for building jupyterlab logger . debug ( "NodeJS was not found. Yarn user configuration is ignored." ) return configuration try : output_binary = subprocess . check_output ( [ node , YARN_PATH , 'config' , 'list' , '--json' ] , stderr = subprocess . PIPE , cwd = HERE ) output = output_binary . decode ( 'utf-8' ) lines = iter ( output . splitlines ( ) ) try : for line in lines : info = json . loads ( line ) if info [ "type" ] == "info" : key = info [ "data" ] inspect = json . loads ( next ( lines ) ) if inspect [ "type" ] == "inspect" : configuration [ key ] = inspect [ "data" ] except StopIteration : pass logger . debug ( "Yarn configuration loaded." ) except subprocess . CalledProcessError as e : logger . error ( "Fail to get yarn configuration. {!s}{!s}" . format ( e . stderr . decode ( 'utf-8' ) , e . output . decode ( 'utf-8' ) ) ) except Exception as e : logger . error ( "Fail to get yarn configuration. {!s}" . format ( e ) ) finally : return configuration