Skip to content

Commit

Permalink
Better formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Larsson committed Nov 20, 2020
1 parent 978a22d commit e4f36dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
45 changes: 21 additions & 24 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,31 @@ var numberRecords int
var rootCmd = &cobra.Command{
Use: "tfr",
Short: "A lightweight commandline TFRecords processor",
Long: `tfr is tool for processing TFRecords.
Example:
tfr data_tfrecord-00000-of-00001
{
"features": {
"feature": {
"a": {
"bytesList": {
"value": [
"some text"
]
}
},
"label": {
"int64List": {
"value": [
0
]
}
Long: `tfr is a lightweight command-line TFRecords processor that
reads serialized .tfrecord files and outputs to stdout in JSON format.
Example:
$ tfr data_tfrecord-00000-of-00001
{
"features": {
"feature": {
"a": {
"bytesList": {
"value": [
"some text"
]
}
},
"label": {
"int64List": {
"value": [
0
]
}
}
}
}
}
`,

RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -75,8 +74,6 @@ var rootCmd = &cobra.Command{
},
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
Expand Down
8 changes: 3 additions & 5 deletions utils/reader.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
package utils


import (
"bufio"
"encoding/binary"
"errors"
"hash/crc32"
"hash/crc32"
"io"

"github.com/golang/protobuf/proto"
protobuf "github.com/emla2805/tfr/protobuf"
"github.com/golang/protobuf/proto"
)

const (
kMaskDelta = 0xa282ead8
)

var (
crc32c = crc32.MakeTable(crc32.Castagnoli)
crc32c = crc32.MakeTable(crc32.Castagnoli)
)


// Reader implements a reader for TFRecords with Example protos
type Reader struct {
reader *bufio.Reader
Expand Down

0 comments on commit e4f36dc

Please sign in to comment.