<commit_before>// Copyright 2016-2017 The psh Authors. All rights reserved.

package psh

import (
	"bytes"
	"fmt"
	"os"
	"path"
)

const (
	// SegmentVirtualEnvBackground is the background color to use
	SegmentVirtualEnvBackground = 22 // #585858
)

// SegmentVirtualEnv implements the python virtual env partial of the prompt.
//
// Renders the current virtalenv python environment name if it is available.
type SegmentVirtualEnv struct {
	Data []byte
}

// NewSegmentVirtualEnv creates an instace of SegmentVirtualEnv type.
func NewSegmentVirtualEnv() *SegmentVirtualEnv {
	segment := &SegmentVirtualEnv{}
	return segment
}

// Compile collects the data for this segment.
func (s *SegmentVirtualEnv) Compile() {
	s.Data = []byte("")
	virtualEnvPath, ok := os.LookupEnv("VIRTUAL_ENV")
	if ok {
		virtualEnvName := path.Base(virtualEnvPath)
		s.Data = []byte(virtualEnvName)
	}
}

// Render renders the segment results.
func (s *SegmentVirtualEnv) Render() []byte {
	var b bytes.Buffer
	if len(s.Data) > 0 {
		b.Write(SetBackground(SegmentVirtualEnvBackground))
		fmt.Fprint(&b, " ")
		b.Write(s.Data)
		fmt.Fprint(&b, " ")
	}
	return b.Bytes()
}<commit_msg>Added python powerline icon to the virtualenv segment<commit_after>// Copyright 2016-2017 The psh Authors. All rights reserved.

package psh

import (
	"bytes"
	"fmt"
	"os"
	"path"
)

const (
	// SegmentVirtualEnvBackground is the background color to use
	SegmentVirtualEnvBackground = 22 // #585858
)

// SegmentVirtualEnv implements the python virtual env partial of the prompt.
//
// Renders the current virtalenv python environment name if it is available.
type SegmentVirtualEnv struct {
	Data []byte
}

// NewSegmentVirtualEnv creates an instace of SegmentVirtualEnv type.
func NewSegmentVirtualEnv() *SegmentVirtualEnv {
	segment := &SegmentVirtualEnv{}
	return segment
}

// Compile collects the data for this segment.
func (s *SegmentVirtualEnv) Compile() {
	s.Data = []byte("")
	virtualEnvPath, ok := os.LookupEnv("VIRTUAL_ENV")
	if ok {
		virtualEnvName := path.Base(virtualEnvPath)
		s.Data = []byte(virtualEnvName)
	}
}

// Render renders the segment results.
func (s *SegmentVirtualEnv) Render() []byte {
	var b bytes.Buffer
	if len(s.Data) > 0 {
		b.Write(SetBackground(SegmentVirtualEnvBackground))
		fmt.Fprint(&b, " ")
		fmt.Fprint(&b, " ")
		b.Write(s.Data)
		fmt.Fprint(&b, " ")
	}
	return b.Bytes()
}
{'fraction_non_alphanumeric': 0.11675766484670307, 'fraction_numerical': 0.014279714405711887, 'mean_word_length': 4.269911504424779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2933265', 'n_tokens_mistral': 815, 'n_tokens_neox': 770, 'n_words': 231}